From 81d24264d5af9c6f0b00e82191e712c8877492ff Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 12 May 2023 15:39:02 +0800 Subject: [PATCH] feat: cron --- package.json | 1 + pnpm-lock.yaml | 15 + src/components/CronTab/index.ts | 4 + src/components/CronTab/src/CronTabInner.vue | 345 ++++++++++++++++++ src/components/CronTab/src/CronTabInput.vue | 76 ++++ src/components/CronTab/src/CronTabModal.vue | 20 + src/components/CronTab/src/cron.data.ts | 10 + src/components/CronTab/src/tabs/DayUI.vue | 87 +++++ src/components/CronTab/src/tabs/HourUI.vue | 59 +++ src/components/CronTab/src/tabs/MinuteUI.vue | 59 +++ src/components/CronTab/src/tabs/MonthUI.vue | 59 +++ src/components/CronTab/src/tabs/SecondUI.vue | 59 +++ src/components/CronTab/src/tabs/WeekUI.vue | 125 +++++++ src/components/CronTab/src/tabs/YearUI.vue | 49 +++ .../CronTab/src/tabs/useTabMixin.ts | 199 ++++++++++ src/components/CronTab/src/validator.ts | 48 +++ src/components/Form/src/types/index.ts | 1 + src/utils/dateUtil.ts | 39 ++ src/utils/index.ts | 26 ++ src/views/infra/job/job.data.ts | 6 +- 20 files changed, 1286 insertions(+), 1 deletion(-) create mode 100644 src/components/CronTab/index.ts create mode 100644 src/components/CronTab/src/CronTabInner.vue create mode 100644 src/components/CronTab/src/CronTabInput.vue create mode 100644 src/components/CronTab/src/CronTabModal.vue create mode 100644 src/components/CronTab/src/cron.data.ts create mode 100644 src/components/CronTab/src/tabs/DayUI.vue create mode 100644 src/components/CronTab/src/tabs/HourUI.vue create mode 100644 src/components/CronTab/src/tabs/MinuteUI.vue create mode 100644 src/components/CronTab/src/tabs/MonthUI.vue create mode 100644 src/components/CronTab/src/tabs/SecondUI.vue create mode 100644 src/components/CronTab/src/tabs/WeekUI.vue create mode 100644 src/components/CronTab/src/tabs/YearUI.vue create mode 100644 src/components/CronTab/src/tabs/useTabMixin.ts create mode 100644 src/components/CronTab/src/validator.ts diff --git a/package.json b/package.json index 22e9b588..287198cc 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "ant-design-vue": "^3.2.20", "axios": "^1.4.0", "codemirror": "^5.65.3", + "cron-parser": "^4.8.1", "cropperjs": "^1.5.13", "crypto-js": "^4.1.1", "dayjs": "^1.11.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4410b3d8..18c4cbb7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,6 +28,9 @@ dependencies: codemirror: specifier: ^5.65.3 version: 5.65.3 + cron-parser: + specifier: ^4.8.1 + version: 4.8.1 cropperjs: specifier: ^1.5.13 version: 1.5.13 @@ -3867,6 +3870,13 @@ packages: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} dev: true + /cron-parser@4.8.1: + resolution: {integrity: sha512-jbokKWGcyU4gl6jAfX97E1gDpY12DJ1cLJZmoDzaAln/shZ+S3KBFBuA2Q6WeUN4gJf/8klnV1EfvhA2lK5IRQ==} + engines: {node: '>=12.0.0'} + dependencies: + luxon: 3.3.0 + dev: false + /cropperjs@1.5.13: resolution: {integrity: sha512-by7jKAo73y5/Do0K6sxdTKHgndY0NMjG2bEdgeJxycbcmHuCiMXqw8sxy5C5Y5WTOTcDGmbT7Sr5CgKOXR06OA==} dev: false @@ -6064,6 +6074,11 @@ packages: engines: {node: '>=16.14'} dev: true + /luxon@3.3.0: + resolution: {integrity: sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==} + engines: {node: '>=12'} + dev: false + /magic-string@0.25.9: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} dependencies: diff --git a/src/components/CronTab/index.ts b/src/components/CronTab/index.ts new file mode 100644 index 00000000..691818c4 --- /dev/null +++ b/src/components/CronTab/index.ts @@ -0,0 +1,4 @@ +export { default as CronTab } from './src/CronTabInput.vue' +export { default as CronTabInner } from './src/CronTabInner.vue' +export { default as CronTabModal } from './src/CronTabModal.vue' +export { default as CronValidator } from './src/validator' diff --git a/src/components/CronTab/src/CronTabInner.vue b/src/components/CronTab/src/CronTabInner.vue new file mode 100644 index 00000000..cf3def38 --- /dev/null +++ b/src/components/CronTab/src/CronTabInner.vue @@ -0,0 +1,345 @@ +