diff --git a/src/scheduleManage/component/cron/index.vue b/src/scheduleManage/component/cron/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..3fac10fa9be054fb85c510f497153570685c270d --- /dev/null +++ b/src/scheduleManage/component/cron/index.vue @@ -0,0 +1,180 @@ + + + + + diff --git a/src/scheduleManage/component/crontabManage/crud.tsx b/src/scheduleManage/component/crontabManage/crud.tsx index 7ae52d955c3b905f4832a7fb5400711acfab08a9..3ccfb41c13101c9918341411c19106f11c3fc845 100644 --- a/src/scheduleManage/component/crontabManage/crud.tsx +++ b/src/scheduleManage/component/crontabManage/crud.tsx @@ -1,10 +1,8 @@ import * as api from './api'; -import { dict, UserPageQuery, AddReq, DelReq, EditReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud'; -import { request } from '/@/utils/service'; -import { dictionary } from '/@/utils/dictionary'; -import { successMessage } from '/@/utils/message'; -import { inject } from 'vue'; -import {auth} from "/@/utils/authFunction"; +import { UserPageQuery, AddReq, DelReq, EditReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud'; +import { shallowRef } from 'vue'; +import cron from '../cron/index.vue'; +import { auth } from '/@/utils/authFunction'; export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet { const pageRequest = async (query: UserPageQuery) => { @@ -21,7 +19,6 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp return await api.AddObj(form); }; - return { crudOptions: { request: { @@ -30,6 +27,9 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp editRequest, delRequest, }, + search:{ + show:false, + }, rowHandle: { //固定右侧 fixed: 'right', @@ -53,11 +53,11 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp }, }, form: { + size: '80%', col: { span: 24 }, labelWidth: '110px', wrapper: { is: 'el-dialog', - width: '600px', }, }, columns: { @@ -78,31 +78,143 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp }, }, }, - minute: { - title: 'minute', - sortable: 'custom', + title: '分钟', type: 'text', + form: { + component: { + name: shallowRef(cron), + clearable: false, + placeholder: '*', + vModel: 'modelValue', + data: compute(({ row }) => { + if (row) { + return row.minute; + } + return '*'; + }), + rangeVlue: { + min: 0, + max: 59, + }, + }, + }, }, hour: { - title: 'hour', - sortable: 'custom', + title: '小时', type: 'text', + form: { + component: { + name: shallowRef(cron), + clearable: false, + placeholder: '*', + vModel: 'modelValue', + data: compute(({ row }) => { + if (row) { + return row.hour; + } + return '*'; + }), + dimension: '小时', + radioGroup: { + specific: true, + range: true, + step: true, + assign: true, + }, + rangeVlue: { + min: 0, + max: 23, + }, + }, + }, }, day_of_week: { - title: 'day_of_week', - sortable: 'custom', + title: '星期', type: 'text', + form: { + component: { + name: shallowRef(cron), + vModel: 'modelValue', + clearable: false, + placeholder: '*', + data: compute(({ row }) => { + if (row) { + return row.day_of_week; + } + return '*'; + }), + dimension: '星期', + radioGroup: { + specific: true, + range: true, + step: true, + assign: true, + }, + rangeVlue: { + min: 1, + max: 7, + }, + }, + }, }, day_of_month: { - title: 'day_of_month', - sortable: 'custom', + title: '日期', type: 'text', + form: { + component: { + name: shallowRef(cron), + vModel: 'modelValue', + clearable: false, + placeholder: '*', + data: compute(({ row }) => { + if (row) { + return row.day_of_month; + } + return '*'; + }), + dimension: '天', + radioGroup: { + specific: true, + range: true, + step: true, + assign: true, + }, + rangeVlue: { + min: 1, + max: 31, + }, + }, + }, }, month_of_year: { - title: 'month_of_year', - sortable: 'custom', + title: '月份', type: 'text', + form: { + component: { + name: shallowRef(cron), + vModel: 'modelValue', + clearable: false, + placeholder: '*', + data: compute(({ row }) => { + if (row) { + return row.month_of_year; + } + return '*'; + }), + dimension: '月', + radioGroup: { + specific: true, + range: true, + step: true, + assign: true, + }, + rangeVlue: { + min: 1, + max: 12, + }, + }, + }, }, }, }, diff --git a/src/scheduleManage/component/intervalManage/crud.tsx b/src/scheduleManage/component/intervalManage/crud.tsx index 50a30ed3645c997994516e1b6adda42cbd5b123a..88ff807f03e6957797a51cd6fc307f5cde725e9a 100644 --- a/src/scheduleManage/component/intervalManage/crud.tsx +++ b/src/scheduleManage/component/intervalManage/crud.tsx @@ -1,113 +1,109 @@ import * as api from './api'; -import { - dict, - UserPageQuery, - AddReq, - DelReq, - EditReq, - compute, - CreateCrudOptionsProps, - CreateCrudOptionsRet -} from '@fast-crud/fast-crud'; -import {request} from '/@/utils/service'; -import {dictionary} from '/@/utils/dictionary'; -import {successMessage} from '/@/utils/message'; -import {inject} from 'vue'; -import {auth} from "/@/utils/authFunction"; -export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps): CreateCrudOptionsRet { - const pageRequest = async (query: UserPageQuery) => { - return await api.GetList(query); - }; - const editRequest = async ({form, row}: EditReq) => { - form.id = row.id; - return await api.UpdateObj(form); - }; - const delRequest = async ({row}: DelReq) => { - return await api.DelObj(row.id); - }; - const addRequest = async ({form}: AddReq) => { - return await api.AddObj(form); - }; +import { dict, UserPageQuery, AddReq, DelReq, EditReq, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud'; +import { auth } from '/@/utils/authFunction'; +export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet { + const pageRequest = async (query: UserPageQuery) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }: EditReq) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }: DelReq) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }: AddReq) => { + return await api.AddObj(form); + }; - - return { - crudOptions: { - request: { - pageRequest, - addRequest, - editRequest, - delRequest, - }, - rowHandle: { - //固定右侧 - fixed: 'right', - width: 150, - buttons: { - view: { - show: false, - }, - edit: { - iconRight: 'Edit', - type: 'text', - // @ts-ignore - show: auth('api_white_list:Update'), - }, - remove: { - iconRight: 'Delete', - type: 'text', - // @ts-ignore - show: auth('api_white_list:Delete'), - }, - }, - }, - form: { - col: {span: 24}, - labelWidth: '110px', - wrapper: { - is: 'el-dialog', - width: '600px', - }, - }, - columns: { - _index: { - title: '序号', - form: {show: false}, - column: { - //type: 'index', - align: 'center', - width: '70px', - columnSetDisabled: true, //禁止在列设置中选择 - //@ts-ignore - formatter: (context) => { - //计算序号,你可以自定义计算规则,此处为翻页累加 - let index = context.index ?? 1; - let pagination: any = crudExpose!.crudBinding.value.pagination; - return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1; - }, - }, - }, - every: { - title: 'every', - sortable: 'custom', - type: 'text', - }, - period: { - title: 'period', - sortable: 'custom', - type: 'dict-select', - dict: dict({ - value: "value", - label: "label", - data: [ - {value: "days", label: "Days", color: "success"}, - {value: "hours", label: "Hours", color: "success"}, - {value: "minutes", label: "Minutes", color: "success"}, - {value: "seconds", label: "Seconds", color: "success"}, - {value: "microseconds", label: "Microseconds", color: "success"}, - ] - }) - }, - }, - }, - }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest, + }, + rowHandle: { + //固定右侧 + fixed: 'right', + width: 150, + buttons: { + view: { + show: false, + }, + edit: { + iconRight: 'Edit', + type: 'text', + // @ts-ignore + show: auth('api_white_list:Update'), + }, + remove: { + iconRight: 'Delete', + type: 'text', + // @ts-ignore + show: auth('api_white_list:Delete'), + }, + }, + }, + search: { + show: false, + }, + form: { + col: { span: 24 }, + labelWidth: '110px', + wrapper: { + is: 'el-dialog', + width: '80%', + }, + }, + columns: { + _index: { + title: '序号', + form: { show: false }, + column: { + //type: 'index', + align: 'center', + width: '70px', + columnSetDisabled: true, //禁止在列设置中选择 + //@ts-ignore + formatter: (context) => { + //计算序号,你可以自定义计算规则,此处为翻页累加 + let index = context.index ?? 1; + let pagination: any = crudExpose!.crudBinding.value.pagination; + return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1; + }, + }, + }, + period: { + title: '间隔单位', + sortable: 'custom', + type: 'dict-select', + dict: dict({ + value: 'value', + label: 'label', + data: [ + { value: 'days', label: '天', color: 'success' }, + { value: 'hours', label: '小时', color: 'success' }, + { value: 'minutes', label: '分钟', color: 'success' }, + { value: 'seconds', label: '秒', color: 'success' }, + { value: 'microseconds', label: '毫秒', color: 'success' }, + ], + }), + }, + every: { + title: '间隔频率', + sortable: 'custom', + type: 'number', + }, + described:{ + title: '描述', + type: 'text', + form:{ + show:false, + } + } + }, + }, + }; }; diff --git a/src/scheduleManage/index.vue b/src/scheduleManage/index.vue index 77695a86199f4ca73a2a4dccd2ec9c384a172735..723f314aaa8957c55dce79859ccbc102f51aba30 100644 --- a/src/scheduleManage/index.vue +++ b/src/scheduleManage/index.vue @@ -2,10 +2,10 @@ - + - + @@ -26,12 +26,12 @@ const handleClick = (tab: any, event: Event) => { \ No newline at end of file diff --git a/src/taskManage/api.ts b/src/taskManage/api.ts index 7b94b35e462284f700acb614c12a28b1016f4e9f..508bca3f8265cab0c864c253fdb51ade00f43760 100644 --- a/src/taskManage/api.ts +++ b/src/taskManage/api.ts @@ -76,7 +76,7 @@ export function RunTask(obj: AddReq) { export function DelTask(obj: DelReq) { return request({ - url: apiPrefix + 'task/' + obj.id + '/delete_task/', + url: apiPrefix + 'task/' + obj.id, method: 'delete', data: obj, }); diff --git a/src/taskManage/component/taskLog/crud.tsx b/src/taskManage/component/taskLog/crud.tsx index ec0cdf156555cc1bbd08311fda4a8889cc2f1588..b5c10be668af2e5abbc2de033ea5eda36237d5a9 100644 --- a/src/taskManage/component/taskLog/crud.tsx +++ b/src/taskManage/component/taskLog/crud.tsx @@ -3,7 +3,7 @@ import { dict, UserPageQuery, AddReq, DelReq, EditReq, compute, CreateCrudOption export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { const pageRequest = async (query: UserPageQuery) => { - return await api.GetList({ ...query, ...{ name: context!.taskItem.name } }); + return await api.GetList({ ...query, ...{ periodic_task_name: context!.taskItem.name } }); }; const editRequest = async ({ form, row }: EditReq) => { form.id = row.id; @@ -33,14 +33,13 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp rowHandle: { show: false, }, - form: { - col: { span: 24 }, - labelWidth: '110px', - wrapper: { - is: 'el-dialog', - width: '600px', - }, + search: { + show: false, + }, + table: { + height: null, }, + columns: { _index: { title: '序号', @@ -59,20 +58,24 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp }, }, }, - task_id: { - title: '任务ID', - search: { show: true }, - type: 'text', - }, periodic_task_name: { title: '任务名称', - search: { show: true }, - type: 'text', + column: { + minWidth: '100px', + }, + }, + task_name: { + title: '函数名称', + column: { + minWidth: '250px', + }, }, status: { title: '执行状态', - search: { show: true }, type: 'dict-select', + column: { + minWidth: '100px', + }, dict: dict({ data: [ { @@ -115,8 +118,24 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp ], }), }, + + date_created: { + title: '任务开始的时间', + column: { + minWidth: '160px', + }, + }, + date_done: { + title: '任务完成的时间', + column: { + minWidth: '160px', + }, + }, result: { title: '执行结果', + column: { + minWidth: '100px', + }, }, }, }, diff --git a/src/taskManage/index.vue b/src/taskManage/index.vue index bcd917185421c65679ec5ab769cb020ffe749762..d3021ff7c4d16d38861b8fad4fdbfbfd67610d71 100644 --- a/src/taskManage/index.vue +++ b/src/taskManage/index.vue @@ -1,261 +1,225 @@