diff --git a/apps/web-antd/src/components/cron-tab/cron-tab.vue b/apps/web-antd/src/components/cron-tab/cron-tab.vue new file mode 100644 index 000000000..2bae0c7db --- /dev/null +++ b/apps/web-antd/src/components/cron-tab/cron-tab.vue @@ -0,0 +1,1225 @@ + + + + + + + 每分钟 + 每小时 + 每天零点 + 每月一号零点 + 每月最后一天零点 + 每周星期日零点 + + {{ item.text }} + + 自定义 + + + + + + + + + + + 秒 + {{ value_second }} + + + + + + 任意值 + 范围 + 间隔 + 指定 + + + + + - + + + + + 秒开始,每 + + 秒执行一次 + + + + + + + + + + + + + 分钟 + {{ value_minute }} + + + + + + 任意值 + 范围 + 间隔 + 指定 + + + + + - + + + + + 分钟开始,每 + + 分钟执行一次 + + + + + + + + + + + + + 小时 + {{ value_hour }} + + + + + + 任意值 + 范围 + 间隔 + 指定 + + + + + - + + + + + 小时开始,每 + + 小时执行一次 + + + + + + + + + + + + + 日 + {{ value_day }} + + + + + + 任意值 + 范围 + 间隔 + 指定 + 本月最后一天 + 不指定 + + + + + - + + + + + 号开始,每 + + 天执行一次 + + + + + + + + + + + + + 月 + {{ value_month }} + + + + + + 任意值 + 范围 + 间隔 + 指定 + + + + + - + + + + + 月开始,每 + + 月执行一次 + + + + + + + + + + + + + 周 + {{ value_week }} + + + + + + 任意值 + 范围 + 间隔 + 指定 + 本月最后一周 + 不指定 + + + + + + + - + + + + + + 第 + + 周的星期 + + + + 执行一次 + + + + + + + + + + + + + + + + + + 年 + {{ value_year }} + + + + + + 忽略 + 任意值 + 范围 + 间隔 + 指定 + + + + + - + + + + + 年开始,每 + + 年执行一次 + + + + + + + + + + + + + 取 消 + 确 认 + + + + + diff --git a/apps/web-antd/src/components/cron-tab/index.ts b/apps/web-antd/src/components/cron-tab/index.ts new file mode 100644 index 000000000..8f4baae59 --- /dev/null +++ b/apps/web-antd/src/components/cron-tab/index.ts @@ -0,0 +1 @@ +export { default as CronTab } from './cron-tab.vue'; diff --git a/apps/web-antd/src/views/infra/job/data.ts b/apps/web-antd/src/views/infra/job/data.ts index 0f1e663d7..1fa6b2d5a 100644 --- a/apps/web-antd/src/views/infra/job/data.ts +++ b/apps/web-antd/src/views/infra/job/data.ts @@ -2,12 +2,13 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { DescriptionItemSchema } from '#/components/description'; -import { h } from 'vue'; +import { h, markRaw } from 'vue'; import { formatDateTime } from '@vben/utils'; import { Timeline } from 'ant-design-vue'; +import { CronTab } from '#/components/cron-tab'; import { DictTag } from '#/components/dict-tag'; import { DICT_TYPE, getDictOptions } from '#/utils'; @@ -37,10 +38,12 @@ export function useFormSchema(): VbenFormSchema[] { component: 'Input', componentProps: { placeholder: '请输入处理器的名字', - // readonly: ({ values }) => !!values.id, + }, + dependencies: { + triggerFields: ['id'], + disabled: (values) => !!values.id, }, rules: 'required', - // TODO @芋艿:在修改场景下,禁止调整 }, { fieldName: 'handlerParam', @@ -53,12 +56,8 @@ export function useFormSchema(): VbenFormSchema[] { { fieldName: 'cronExpression', label: 'CRON 表达式', - component: 'Input', - componentProps: { - placeholder: '请输入 CRON 表达式', - }, + component: markRaw(CronTab), rules: 'required', - // TODO @芋艿:未来支持动态的 CRON 表达式选择 }, { fieldName: 'retryCount',