From a422300cc173ed7553bba188652bb353a92badc4 Mon Sep 17 00:00:00 2001 From: Siyu Kong Date: Thu, 23 Mar 2023 10:45:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20=E8=BF=87=E6=BB=A4ide=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0b05e6a6..3efc9c52 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ dist-ssr /dist* *-lock.* pnpm-debug + +.idea +.history \ No newline at end of file From 6c12505771580d5c912dc5ce6a7da11f3f3fbd65 Mon Sep 17 00:00:00 2001 From: gexinzhineng/gxzn27 <1348660141@qq.com> Date: Sat, 25 Mar 2023 15:31:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E9=80=89=E6=8B=A9select=E5=87=BA=E9=94=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/formCreate/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/formCreate/index.ts b/src/plugins/formCreate/index.ts index 69816d8a..0d72048e 100644 --- a/src/plugins/formCreate/index.ts +++ b/src/plugins/formCreate/index.ts @@ -10,6 +10,8 @@ import { ElTransfer, ElAlert, ElTabs, + ElTable, + ElTableColumn, ElTabPane } from 'element-plus' @@ -27,6 +29,8 @@ const components = [ ElTransfer, ElAlert, ElTabs, + ElTable, + ElTableColumn, ElTabPane ] From dd763019ba79f940ce448a1d20c1e0f029c5716f Mon Sep 17 00:00:00 2001 From: Siyu Kong Date: Mon, 27 Mar 2023 11:46:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.修改crud写法 2.修复dropdown组件与v-hasPermi冲突问题 3.优化详情页后续执行时间 --- src/views/infra/job/JobLog.vue | 237 ++++++++++---- src/views/infra/job/JobLogView.vue | 74 +++++ src/views/infra/job/form.vue | 172 ++++++++++ src/views/infra/job/index.vue | 490 ++++++++++++++--------------- src/views/infra/job/job.data.ts | 69 ---- src/views/infra/job/jobLog.data.ts | 75 ----- src/views/infra/job/utils.ts | 44 +++ src/views/infra/job/view.vue | 89 ++++++ 8 files changed, 792 insertions(+), 458 deletions(-) create mode 100644 src/views/infra/job/JobLogView.vue create mode 100644 src/views/infra/job/form.vue delete mode 100644 src/views/infra/job/job.data.ts delete mode 100644 src/views/infra/job/jobLog.data.ts create mode 100644 src/views/infra/job/utils.ts create mode 100644 src/views/infra/job/view.vue diff --git a/src/views/infra/job/JobLog.vue b/src/views/infra/job/JobLog.vue index 1bf9d745..daa20046 100644 --- a/src/views/infra/job/JobLog.vue +++ b/src/views/infra/job/JobLog.vue @@ -1,78 +1,179 @@ + diff --git a/src/views/infra/job/JobLogView.vue b/src/views/infra/job/JobLogView.vue new file mode 100644 index 00000000..c66e0d80 --- /dev/null +++ b/src/views/infra/job/JobLogView.vue @@ -0,0 +1,74 @@ + + diff --git a/src/views/infra/job/form.vue b/src/views/infra/job/form.vue new file mode 100644 index 00000000..24488fd7 --- /dev/null +++ b/src/views/infra/job/form.vue @@ -0,0 +1,172 @@ + + diff --git a/src/views/infra/job/index.vue b/src/views/infra/job/index.vue index 613f84c4..702b31fe 100644 --- a/src/views/infra/job/index.vue +++ b/src/views/infra/job/index.vue @@ -1,243 +1,175 @@ + diff --git a/src/views/infra/job/job.data.ts b/src/views/infra/job/job.data.ts deleted file mode 100644 index 38761cd7..00000000 --- a/src/views/infra/job/job.data.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -const { t } = useI18n() // 国际化 -// 表单校验 -export const rules = reactive({ - name: [required], - handlerName: [required], - cronExpression: [required], - retryCount: [required], - retryInterval: [required] -}) -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'id', - primaryTitle: '任务编号', - action: true, - actionWidth: '280px', - columns: [ - { - title: '任务名称', - field: 'name', - isSearch: true - }, - { - title: t('common.status'), - field: 'status', - dictType: DICT_TYPE.INFRA_JOB_STATUS, - dictClass: 'number', - isForm: false, - isSearch: true - }, - { - title: '处理器的名字', - field: 'handlerName', - isSearch: true - }, - { - title: '处理器的参数', - field: 'handlerParam', - isTable: false - }, - { - title: 'CRON 表达式', - field: 'cronExpression' - }, - { - title: '后续执行时间', - field: 'nextTimes', - isTable: false, - isForm: false - }, - { - title: '重试次数', - field: 'retryCount', - isTable: false - }, - { - title: '重试间隔', - field: 'retryInterval', - isTable: false - }, - { - title: '监控超时时间', - field: 'monitorTimeout', - isTable: false - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/infra/job/jobLog.data.ts b/src/views/infra/job/jobLog.data.ts deleted file mode 100644 index ccca3d08..00000000 --- a/src/views/infra/job/jobLog.data.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -// 国际化 -const { t } = useI18n() -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'id', - primaryTitle: '日志编号', - action: true, - columns: [ - { - title: '任务编号', - field: 'jobId', - isSearch: true - }, - { - title: '处理器的名字', - field: 'handlerName', - isSearch: true - }, - { - title: '处理器的参数', - field: 'handlerParam' - }, - { - title: '第几次执行', - field: 'executeIndex' - }, - { - title: '开始执行时间', - field: 'beginTime', - formatter: 'formatDate', - table: { - slots: { - default: 'beginTime_default' - } - }, - search: { - show: true, - itemRender: { - name: 'XDataPicker' - } - } - }, - { - title: '结束执行时间', - field: 'endTime', - formatter: 'formatDate', - isTable: false, - search: { - show: true, - itemRender: { - name: 'XDataPicker' - } - } - }, - { - title: '执行时长', - field: 'duration', - table: { - slots: { - default: 'duration_default' - } - } - }, - { - title: t('common.status'), - field: 'status', - dictType: DICT_TYPE.INFRA_JOB_LOG_STATUS, - dictClass: 'number', - isSearch: true - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/infra/job/utils.ts b/src/views/infra/job/utils.ts new file mode 100644 index 00000000..a3774f22 --- /dev/null +++ b/src/views/infra/job/utils.ts @@ -0,0 +1,44 @@ +export const parseTime = (time) => { + if (!time) { + return null + } + const format = '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if (typeof time === 'string' && /^[0-9]+$/.test(time)) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time + .replace(new RegExp(/-/gm), '/') + .replace('T', ' ') + .replace(new RegExp(/\.[\d]{3}/gm), '') + } + if (typeof time === 'number' && time.toString().length === 10) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} diff --git a/src/views/infra/job/view.vue b/src/views/infra/job/view.vue new file mode 100644 index 00000000..d195e0e3 --- /dev/null +++ b/src/views/infra/job/view.vue @@ -0,0 +1,89 @@ + +