Browse Source

Merge pull request #743 from colinin/add-param-display-name

作业参数加入显示名称
pull/747/head
yx lin 3 years ago
committed by GitHub
parent
commit
20f8be931e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      apps/vue/package.json
  2. 4
      apps/vue/src/api/task-management/model/backgroundJobInfoModel.ts
  3. 3
      apps/vue/src/components/Table/src/types/table.ts
  4. 25
      apps/vue/src/views/task-management/background-jobs/components/JobParamter.vue

2
apps/vue/package.json

@ -44,7 +44,7 @@
"@vueuse/core": "^8.3.0",
"@vueuse/shared": "^8.3.0",
"@zxcvbn-ts/core": "^2.0.1",
"ant-design-vue": "^3.2.0",
"ant-design-vue": "^3.2.15",
"axios": "^0.26.1",
"codemirror": "^5.65.3",
"cropperjs": "^1.5.12",

4
apps/vue/src/api/task-management/model/backgroundJobInfoModel.ts

@ -32,8 +32,8 @@ export enum JobPriority {
export interface BackgroundJobParamter {
name: string;
required: boolean;
DisplayName: string;
Description?: string;
displayName: string;
description?: string;
}
export interface BackgroundJobDefinition {

3
apps/vue/src/components/Table/src/types/table.ts

@ -1,7 +1,8 @@
import type { VNodeChild } from 'vue';
import type { PaginationProps } from './pagination';
import type { FormProps } from '/@/components/Form';
import type { TableRowSelection as ITableRowSelection, ColumnProps } from 'ant-design-vue/lib/table/interface';
import type { ColumnProps } from 'ant-design-vue/lib/table';
import type { TableRowSelection as ITableRowSelection } from 'ant-design-vue/lib/table/interface';
import type { AdvanceSearchProps } from './advancedSearch';
import { ComponentType } from './componentType';

25
apps/vue/src/views/task-management/background-jobs/components/JobParamter.vue

@ -10,7 +10,10 @@
</Button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<template v-if="column.key === 'key'">
<span>{{ getJobArgKey(record.key) }}</span>
</template>
<template v-else-if="column.key === 'action'">
<TableAction
:stop-button-propagation="true"
:actions="[
@ -41,7 +44,7 @@
</template>
<script lang="ts" setup>
import { computed, ref, nextTick, onMounted } from 'vue';
import { computed, ref, unref, nextTick, onMounted } from 'vue';
import { Button, Form, Select } from 'ant-design-vue';
import { BasicForm, useForm } from '/@/components/Form';
import { BasicModal, useModal } from '/@/components/Modal';
@ -64,6 +67,7 @@
});
const emits = defineEmits(['args-reset']);
const { L } = useLocalization(['TaskManagement', 'AbpUi']);
const crtJobDefinition = ref<BackgroundJobDefinition>();
const jobDefinitions = ref<BackgroundJobDefinition[]>([]);
const getJobDefinitionOptions = computed(() => {
return jobDefinitions.value.map((job) => {
@ -74,6 +78,19 @@
};
});
});
const getJobArgKey = computed(() => {
return (key: string) => {
const crtJobDef = unref(crtJobDefinition);
if (!crtJobDef) {
return key;
}
const findDef = crtJobDef.paramters.find((jobParam) => jobParam.name === key);
if (!findDef || !findDef.displayName) {
return key;
}
return `${key}(${findDef.displayName})`;
};
});
const [registerTable] = useTable({
rowKey: 'key',
columns: [
@ -153,18 +170,22 @@
onMounted(fetchDefinitionJobs);
function fetchDefinitionJobs() {
crtJobDefinition.value = undefined;
getDefinitions().then((res) => {
jobDefinitions.value = res.items;
});
}
function handleJobChange(key, job: BackgroundJobDefinition) {
crtJobDefinition.value = job;
if (key) {
const args: ExtraPropertyDictionary = {};
job.paramters.forEach((p) => {
args[p.name] = '';
});
emits('args-reset', args);
} else {
emits('args-reset', []);
}
}

Loading…
Cancel
Save