From 5816101b464d7ff7410e2a2a1cf3efbfe1ed7d8e Mon Sep 17 00:00:00 2001 From: xingyuv Date: Thu, 23 Mar 2023 14:43:30 +0800 Subject: [PATCH] feat: job view --- src/views/infra/job/JobModal.vue | 54 +++++++++++++ src/views/infra/job/index.vue | 135 ++++++++++++++++++++++++++++++- src/views/infra/job/job.data.ts | 116 ++++++++++++++++++++++++++ 3 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 src/views/infra/job/JobModal.vue create mode 100644 src/views/infra/job/job.data.ts diff --git a/src/views/infra/job/JobModal.vue b/src/views/infra/job/JobModal.vue new file mode 100644 index 0000000..7bc4fde --- /dev/null +++ b/src/views/infra/job/JobModal.vue @@ -0,0 +1,54 @@ + + diff --git a/src/views/infra/job/index.vue b/src/views/infra/job/index.vue index 3b64cfc..79b3774 100644 --- a/src/views/infra/job/index.vue +++ b/src/views/infra/job/index.vue @@ -1,3 +1,136 @@ + diff --git a/src/views/infra/job/job.data.ts b/src/views/infra/job/job.data.ts new file mode 100644 index 0000000..9553f10 --- /dev/null +++ b/src/views/infra/job/job.data.ts @@ -0,0 +1,116 @@ +import { BasicColumn, FormSchema, useRender } from '@/components/Table' +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '任务编号', + dataIndex: 'id', + width: 100 + }, + { + title: '任务名称', + dataIndex: 'name', + width: 180 + }, + { + title: '处理器的名字', + dataIndex: 'handlerName', + width: 180 + }, + { + title: '处理器的参数', + dataIndex: 'handlerParam', + width: 180 + }, + { + title: 'CRON 表达式', + dataIndex: 'cronExpression', + width: 200 + }, + { + title: '任务状态', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.INFRA_JOB_STATUS) + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '任务名称', + field: 'name', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '任务状态', + field: 'status', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.INFRA_JOB_STATUS) + }, + colProps: { span: 8 } + }, + { + label: '处理器的名字', + field: 'handlerName', + component: 'Input', + colProps: { span: 8 } + } +] + +export const formSchema: FormSchema[] = [ + { + label: '任务编号', + field: 'id', + show: false, + component: 'Input' + }, + { + label: '任务名称', + field: 'name', + required: true, + component: 'Input' + }, + { + label: '处理器的名字', + field: 'handlerName', + required: true, + dynamicDisabled: ({ values }) => !!values.id, + component: 'Input' + }, + { + label: '处理器的参数', + field: 'handlerParam', + component: 'Input' + }, + { + label: 'CRON 表达式', + field: 'cronExpression', + required: true, + component: 'Input' + }, + { + label: '重试次数', + field: 'retryCount', + required: true, + helpMessage: '设置为 0 时,不进行重试', + component: 'InputNumber' + }, + { + label: '重试间隔', + field: 'retryInterval', + required: true, + helpMessage: '单位:毫秒。设置为 0 时,无需间隔', + component: 'InputNumber', + suffix: '毫秒' + }, + { + label: '监控超时时间', + field: 'monitorTimeout', + component: 'Input', + suffix: '毫秒' + } +]