From f73436e94f630cf95b64511efc3d6577d118b4b3 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Mon, 7 Apr 2025 11:23:32 +0800 Subject: [PATCH 01/13] fix: captcha types --- packages/effects/common-ui/package.json | 8 ++-- .../verification/Verify/VerifyPoints.vue | 47 ++----------------- 2 files changed, 9 insertions(+), 46 deletions(-) diff --git a/packages/effects/common-ui/package.json b/packages/effects/common-ui/package.json index 51984bc6e..205240d45 100644 --- a/packages/effects/common-ui/package.json +++ b/packages/effects/common-ui/package.json @@ -32,16 +32,16 @@ "@vben/types": "workspace:*", "@vueuse/core": "catalog:", "@vueuse/integrations": "catalog:", + "crypto-js": "catalog:", "qrcode": "catalog:", "tippy.js": "catalog:", "vue": "catalog:", "vue-json-viewer": "catalog:", "vue-router": "catalog:", - "vue-tippy": "catalog:", - "crypto-js": "catalog:" + "vue-tippy": "catalog:" }, "devDependencies": { - "@types/qrcode": "catalog:", - "@types/crypto-js": "catalog:" + "@types/crypto-js": "catalog:", + "@types/qrcode": "catalog:" } } diff --git a/packages/effects/common-ui/src/components/captcha/verification/Verify/VerifyPoints.vue b/packages/effects/common-ui/src/components/captcha/verification/Verify/VerifyPoints.vue index f1dc502d7..61cdd4a39 100644 --- a/packages/effects/common-ui/src/components/captcha/verification/Verify/VerifyPoints.vue +++ b/packages/effects/common-ui/src/components/captcha/verification/Verify/VerifyPoints.vue @@ -1,8 +1,9 @@ + + diff --git a/apps/web-antd/src/views/infra/job/logger/data.ts b/apps/web-antd/src/views/infra/job/logger/data.ts new file mode 100644 index 000000000..d8c7f92ac --- /dev/null +++ b/apps/web-antd/src/views/infra/job/logger/data.ts @@ -0,0 +1,143 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { InfraJobLogApi } from '#/api/infra/job-log'; + +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; +import { useAccess } from '@vben/access'; +import dayjs from 'dayjs'; +import { formatDateTime } from '@vben/utils'; + +const { hasAccessByCodes } = useAccess(); + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'handlerName', + label: '处理器的名字', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入处理器的名字', + }, + }, + { + fieldName: 'beginTime', + label: '开始执行时间', + component: 'DatePicker', + componentProps: { + allowClear: true, + placeholder: '选择开始执行时间', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + showTime: { + format: 'HH:mm:ss', + defaultValue: dayjs('00:00:00', 'HH:mm:ss'), + }, + }, + }, + { + fieldName: 'endTime', + label: '结束执行时间', + component: 'DatePicker', + componentProps: { + allowClear: true, + placeholder: '选择结束执行时间', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + showTime: { + format: 'HH:mm:ss', + defaultValue: dayjs('23:59:59', 'HH:mm:ss'), + }, + }, + }, + { + fieldName: 'status', + label: '任务状态', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.INFRA_JOB_LOG_STATUS, 'number'), + allowClear: true, + placeholder: '请选择任务状态', + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '日志编号', + minWidth: 80, + }, + { + field: 'jobId', + title: '任务编号', + minWidth: 80, + }, + { + field: 'handlerName', + title: '处理器的名字', + minWidth: 180, + }, + { + field: 'handlerParam', + title: '处理器的参数', + minWidth: 140, + }, + { + field: 'executeIndex', + title: '第几次执行', + minWidth: 100, + }, + { + field: 'beginTime', + title: '执行时间', + minWidth: 280, + formatter: ({ row }) => { + return `${formatDateTime(row.beginTime)} ~ ${formatDateTime(row.endTime)}`; + }, + }, + { + field: 'duration', + title: '执行时长', + minWidth: 120, + formatter: ({ row }) => { + return `${row.duration} 毫秒`; + }, + }, + { + field: 'status', + title: '任务状态', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_JOB_LOG_STATUS }, + }, + }, + { + field: 'operation', + title: '操作', + width: 80, + fixed: 'right', + align: 'center', + cellRender: { + attrs: { + nameField: 'id', + nameTitle: '日志', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'detail', + text: '详细', + show: hasAccessByCodes(['infra:job:query']), + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/infra/job/logger/index.vue b/apps/web-antd/src/views/infra/job/logger/index.vue new file mode 100644 index 000000000..4b1698bf9 --- /dev/null +++ b/apps/web-antd/src/views/infra/job/logger/index.vue @@ -0,0 +1,100 @@ + + + diff --git a/apps/web-antd/src/views/infra/job/logger/modules/detail.vue b/apps/web-antd/src/views/infra/job/logger/modules/detail.vue new file mode 100644 index 000000000..7caa255be --- /dev/null +++ b/apps/web-antd/src/views/infra/job/logger/modules/detail.vue @@ -0,0 +1,68 @@ + + + diff --git a/apps/web-antd/src/views/infra/job/modules/detail.vue b/apps/web-antd/src/views/infra/job/modules/detail.vue new file mode 100644 index 000000000..3823664e2 --- /dev/null +++ b/apps/web-antd/src/views/infra/job/modules/detail.vue @@ -0,0 +1,77 @@ + + + diff --git a/apps/web-antd/src/views/infra/job/modules/form.vue b/apps/web-antd/src/views/infra/job/modules/form.vue new file mode 100644 index 000000000..c9f72e1ec --- /dev/null +++ b/apps/web-antd/src/views/infra/job/modules/form.vue @@ -0,0 +1,80 @@ + + + diff --git a/packages/@core/base/icons/src/lucide.ts b/packages/@core/base/icons/src/lucide.ts index 81225ba4b..a2e6da46a 100644 --- a/packages/@core/base/icons/src/lucide.ts +++ b/packages/@core/base/icons/src/lucide.ts @@ -67,4 +67,5 @@ export { X, Download, Upload, + History, } from 'lucide-vue-next'; diff --git a/packages/@core/base/shared/src/utils/date.ts b/packages/@core/base/shared/src/utils/date.ts index 3736b9ad5..17e5848f3 100644 --- a/packages/@core/base/shared/src/utils/date.ts +++ b/packages/@core/base/shared/src/utils/date.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs'; -export function formatDate(time: number | string, format = 'YYYY-MM-DD') { +export function formatDate(time: number | string | Date, format = 'YYYY-MM-DD') { try { const date = dayjs(time); if (!date.isValid()) { @@ -13,7 +13,7 @@ export function formatDate(time: number | string, format = 'YYYY-MM-DD') { } } -export function formatDateTime(time: number | string) { +export function formatDateTime(time: number | string | Date) { return formatDate(time, 'YYYY-MM-DD HH:mm:ss'); } From 6a76844bde6f6b14bd08459324cdaca25d5a6b73 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 7 Apr 2025 19:27:50 +0800 Subject: [PATCH 05/13] =?UTF-8?q?feat=EF=BC=9A=E5=AE=8C=E5=96=84=20file=20?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/infra/file/data.ts | 17 +++- apps/web-antd/src/views/infra/file/index.vue | 6 +- .../src/views/infra/file/modules/form.vue | 81 ++++++------------- .../src/views/infra/fileConfig/data.ts | 2 +- 4 files changed, 45 insertions(+), 61 deletions(-) diff --git a/apps/web-antd/src/views/infra/file/data.ts b/apps/web-antd/src/views/infra/file/data.ts index cff729781..1f78d606c 100644 --- a/apps/web-antd/src/views/infra/file/data.ts +++ b/apps/web-antd/src/views/infra/file/data.ts @@ -1,4 +1,4 @@ -import { type VbenFormSchema, z } from '#/adapter/form'; +import { type VbenFormSchema } from '#/adapter/form'; import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; import type { InfraFileApi } from '#/api/infra/file'; @@ -7,6 +7,21 @@ import { getRangePickerDefaultProps } from '#/utils/date'; const { hasAccessByCodes } = useAccess(); +/** 表单的字段 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'file', + label: '文件上传', + component: 'Upload', + rules: 'required', + componentProps: { + placeholder: '请选择要上传的文件', + }, + } + ]; +} + /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ diff --git a/apps/web-antd/src/views/infra/file/index.vue b/apps/web-antd/src/views/infra/file/index.vue index 8491ce700..aef029f58 100644 --- a/apps/web-antd/src/views/infra/file/index.vue +++ b/apps/web-antd/src/views/infra/file/index.vue @@ -4,7 +4,7 @@ import type { InfraFileApi } from '#/api/infra/file'; import { Page, useVbenModal } from '@vben/common-ui'; import { Button, message, Image } from 'ant-design-vue'; -import { Plus } from '@vben/icons'; +import { Upload } from '@vben/icons'; import Form from './modules/form.vue'; import { $t } from '#/locales'; @@ -123,8 +123,8 @@ const [Grid, gridApi] = useVbenVxeGrid({