From f427fd963316b98f9695d22b20e80d9a3e129390 Mon Sep 17 00:00:00 2001 From: KAI <1373639299@qq.com> Date: Wed, 26 Jun 2024 18:54:50 +0800 Subject: [PATCH 01/19] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E8=A1=A8=E6=A0=BC=E5=92=8C=E8=A1=A8?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/job.ts | 34 ++++ src/apis/system/type.ts | 6 + src/views/system/job/JobAddModal.vue | 177 ++++++++++++++++++++ src/views/system/job/components/JobTags.vue | 31 ++++ src/views/system/job/data.ts | 34 ++++ src/views/system/job/index.vue | 127 ++++++++++++++ 6 files changed, 409 insertions(+) create mode 100644 src/apis/system/job.ts create mode 100644 src/views/system/job/JobAddModal.vue create mode 100644 src/views/system/job/components/JobTags.vue create mode 100644 src/views/system/job/data.ts create mode 100644 src/views/system/job/index.vue diff --git a/src/apis/system/job.ts b/src/apis/system/job.ts new file mode 100644 index 0000000..5d50f06 --- /dev/null +++ b/src/apis/system/job.ts @@ -0,0 +1,34 @@ +import type * as System from './type' +import http from '@/utils/http' + +const BASE_URL = '/system/job' + +/** @desc 查询定时任务列表 */ +export function listJob(query: System.JobQuery) { + return http.get(`${BASE_URL}/page/list`, query) +} + +/** @desc 查询部门详情 */ +export function getJob(id: string) { + return http.get(`${BASE_URL}/${id}`) +} + +/** @desc 新增任务 */ +export function addJob(data: any) { + return http.post(`${BASE_URL}`, data) +} + +/** @desc 修改任务 */ +export function updateDept(data: any, id: string) { + return http.put(`${BASE_URL}/${id}`, data) +} + +/** @desc 删除任务 */ +export function deleteDept(id: string) { + return http.del(`${BASE_URL}/${id}`) +} + +// /** @desc 导出任务 */ +// export function exportDept(query: System.DeptQuery) { +// return http.download(`${BASE_URL}/export`, query) +// } diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index 2de3400..116dea5 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -351,5 +351,11 @@ export interface MessageQuery { sort: Array } +/** 定时任务查询 */ +export interface JobQuery { + jobName?: string + jobStatus?: number +} + export interface MessagePageQuery extends MessageQuery, PageQuery { } diff --git a/src/views/system/job/JobAddModal.vue b/src/views/system/job/JobAddModal.vue new file mode 100644 index 0000000..870bda3 --- /dev/null +++ b/src/views/system/job/JobAddModal.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/src/views/system/job/components/JobTags.vue b/src/views/system/job/components/JobTags.vue new file mode 100644 index 0000000..e6ba11f --- /dev/null +++ b/src/views/system/job/components/JobTags.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/views/system/job/data.ts b/src/views/system/job/data.ts new file mode 100644 index 0000000..1da75b8 --- /dev/null +++ b/src/views/system/job/data.ts @@ -0,0 +1,34 @@ +// 任务状态选项 +export const jobStatusOptions = [ + { label: '启用', value: 1 }, + { label: '禁用', value: 2 } +] +// 执行器类型选项 +export const executorTypeOptions = [ + { label: 'Java', value: 1 } +] +// 任务类型选项 +export const taskTypeOptions = [ + { value: 1, color: 'arcoblue', label: '集群' }, + { value: 2, color: 'green', label: '广播' }, + { value: 3, color: 'red', label: '切片' } +] +// 路由策略选项 +export const routerKeyOptions = [ + { value: 1, label: '一致性Hash' }, + { value: 2, label: '随机' }, + { value: 3, label: 'LRU' }, + { value: 4, label: '轮询' } +] +// 阻塞策略选项 +export const blockStrategyOptions = [ + { value: 1, color: 'arcoblue', label: '丢弃' }, + { value: 2, color: 'green', label: '覆盖' }, + { value: 3, color: 'red', label: '并行' } +] +// 触发类型选项 +export const triggerTypeOptions = [ + { value: 2, color: 'arcoblue', label: '固定时间' }, + { value: 3, color: 'green', label: 'CRON表达式' }, + { value: 99, color: 'red', label: '工作流' } +] diff --git a/src/views/system/job/index.vue b/src/views/system/job/index.vue new file mode 100644 index 0000000..aeec422 --- /dev/null +++ b/src/views/system/job/index.vue @@ -0,0 +1,127 @@ + + + + + -- Gitee From 1190a68532cd388959313068648a0b88eefaaf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E5=87=AF?= <1373639299@qq.com> Date: Thu, 27 Jun 2024 00:17:20 +0800 Subject: [PATCH 02/19] =?UTF-8?q?feat:=20=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=A1=B5=E9=9D=A2=E5=8A=9F=E8=83=BD=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/job.ts | 20 ++++++---- src/views/system/job/JobAddModal.vue | 60 ++++++++++++++++++++++------ src/views/system/job/index.vue | 37 +++++++++++++---- 3 files changed, 88 insertions(+), 29 deletions(-) diff --git a/src/apis/system/job.ts b/src/apis/system/job.ts index 5d50f06..ce3130b 100644 --- a/src/apis/system/job.ts +++ b/src/apis/system/job.ts @@ -3,31 +3,35 @@ import http from '@/utils/http' const BASE_URL = '/system/job' +/** @desc 查询任务组 */ +export function listGroup() { + return http.get(`${BASE_URL}/groupList`) +} + /** @desc 查询定时任务列表 */ export function listJob(query: System.JobQuery) { return http.get(`${BASE_URL}/page/list`, query) } -/** @desc 查询部门详情 */ -export function getJob(id: string) { - return http.get(`${BASE_URL}/${id}`) -} - /** @desc 新增任务 */ export function addJob(data: any) { return http.post(`${BASE_URL}`, data) } /** @desc 修改任务 */ -export function updateDept(data: any, id: string) { - return http.put(`${BASE_URL}/${id}`, data) +export function updateJob(data: any) { + return http.put(`${BASE_URL}`, data) } /** @desc 删除任务 */ -export function deleteDept(id: string) { +export function deleteJob(id: string) { return http.del(`${BASE_URL}/${id}`) } +/** @desc 执行任务 */ +export function triggerJob(id: string) { + return http.get(`${BASE_URL}/trigger/${id}`) +} // /** @desc 导出任务 */ // export function exportDept(query: System.DeptQuery) { // return http.download(`${BASE_URL}/export`, query) diff --git a/src/views/system/job/JobAddModal.vue b/src/views/system/job/JobAddModal.vue index 870bda3..058c61e 100644 --- a/src/views/system/job/JobAddModal.vue +++ b/src/views/system/job/JobAddModal.vue @@ -14,7 +14,7 @@ - + @@ -46,15 +46,15 @@ - - + + @@ -102,7 +102,7 @@ diff --git a/src/components/CornTab/CrontabModel.vue b/src/components/CornTab/CrontabModel.vue new file mode 100644 index 0000000..a622bb8 --- /dev/null +++ b/src/components/CornTab/CrontabModel.vue @@ -0,0 +1,18 @@ + + + + + diff --git a/src/components/CornTab/CrontabMonth.vue b/src/components/CornTab/CrontabMonth.vue new file mode 100644 index 0000000..98e3c0d --- /dev/null +++ b/src/components/CornTab/CrontabMonth.vue @@ -0,0 +1,106 @@ + + + diff --git a/src/components/CornTab/CrontabWeek.vue b/src/components/CornTab/CrontabWeek.vue new file mode 100644 index 0000000..dd8915f --- /dev/null +++ b/src/components/CornTab/CrontabWeek.vue @@ -0,0 +1,121 @@ + + + diff --git a/src/components/CornTab/CrontabYear.vue b/src/components/CornTab/CrontabYear.vue new file mode 100644 index 0000000..7b1399d --- /dev/null +++ b/src/components/CornTab/CrontabYear.vue @@ -0,0 +1,106 @@ + + + diff --git a/src/views/system/job/JobAddModal.vue b/src/views/system/job/JobAddModal.vue index 4a68bd9..138d989 100644 --- a/src/views/system/job/JobAddModal.vue +++ b/src/views/system/job/JobAddModal.vue @@ -53,17 +53,14 @@ - - + + + + @@ -160,13 +157,21 @@ const { form, resetForm } = useForm({ maxRetryTimes: 3, retryInterval: 1, parallelNum: 1 - +}) +// 计算属性 用于类型转化 +const triggerIntervalNumber = computed({ + get() { + return Number(form.triggerInterval) + }, + set(newValue) { + form.triggerInterval = newValue.toString() + } }) // 触发类型值改变事件 const triggerTypeChange = () => { - switch (form.triggerInterval) { + switch (form.triggerType) { case 2: - form.triggerInterval = '60' + form.triggerInterval = 60 break case 3: diff --git a/src/views/system/job/index.vue b/src/views/system/job/index.vue index 1e6310f..95e3f9f 100644 --- a/src/views/system/job/index.vue +++ b/src/views/system/job/index.vue @@ -1,13 +1,13 @@ +