diff --git a/src/api/infra/job/index.ts b/src/api/infra/job/index.ts index 63f15da0..c1398d07 100644 --- a/src/api/infra/job/index.ts +++ b/src/api/infra/job/index.ts @@ -13,50 +13,38 @@ export interface JobVO { createTime: Date } -export interface JobPageReqVO extends PageParam { - name?: string - status?: number - handlerName?: string -} - -export interface JobExportReqVO { - name?: string - status?: number - handlerName?: string -} - // 任务列表 -export const getJobPageApi = (params: JobPageReqVO) => { +export const getJobPage = (params: PageParam) => { return request.get({ url: '/infra/job/page', params }) } // 任务详情 -export const getJobApi = (id: number) => { +export const getJob = (id: number) => { return request.get({ url: '/infra/job/get?id=' + id }) } // 新增任务 -export const createJobApi = (data: JobVO) => { +export const createJob = (data: JobVO) => { return request.post({ url: '/infra/job/create', data }) } // 修改定时任务调度 -export const updateJobApi = (data: JobVO) => { +export const updateJob = (data: JobVO) => { return request.put({ url: '/infra/job/update', data }) } // 删除定时任务调度 -export const deleteJobApi = (id: number) => { +export const deleteJob = (id: number) => { return request.delete({ url: '/infra/job/delete?id=' + id }) } // 导出定时任务调度 -export const exportJobApi = (params: JobExportReqVO) => { +export const exportJob = (params) => { return request.download({ url: '/infra/job/export-excel', params }) } // 任务状态修改 -export const updateJobStatusApi = (id: number, status: number) => { +export const updateJobStatus = (id: number, status: number) => { const params = { id, status @@ -70,6 +58,6 @@ export const runJobApi = (id: number) => { } // 获得定时任务的下 n 次执行时间 -export const getJobNextTimesApi = (id: number) => { +export const getJobNextTimes = (id: number) => { return request.get({ url: '/infra/job/get_next_times?id=' + id }) } diff --git a/src/api/infra/jobLog/index.ts b/src/api/infra/jobLog/index.ts index 84b74fbd..f429cd9e 100644 --- a/src/api/infra/jobLog/index.ts +++ b/src/api/infra/jobLog/index.ts @@ -14,34 +14,18 @@ export interface JobLogVO { createTime: string } -export interface JobLogPageReqVO extends PageParam { - jobId?: number - handlerName?: string - beginTime?: string - endTime?: string - status?: number -} - -export interface JobLogExportReqVO { - jobId?: number - handlerName?: string - beginTime?: string - endTime?: string - status?: number -} - // 任务日志列表 -export const getJobLogPageApi = (params: JobLogPageReqVO) => { +export const getJobLogPage = (params: PageParam) => { return request.get({ url: '/infra/job-log/page', params }) } // 任务日志详情 -export const getJobLogApi = (id: number) => { +export const getJobLog = (id: number) => { return request.get({ url: '/infra/job-log/get?id=' + id }) } // 导出定时任务日志 -export const exportJobLogApi = (params: JobLogExportReqVO) => { +export const exportJobLog = (params) => { return request.download({ url: '/infra/job-log/export-excel', params diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 4d8c3dac..d8b5db64 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -162,7 +162,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ children: [ { path: 'job-log', - component: () => import('@/views/infra/job/JobLog.vue'), + component: () => import('@/views/infra/job/logger/index.vue'), name: 'JobLog', meta: { noCache: true, diff --git a/src/views/infra/job/JobDetail.vue b/src/views/infra/job/JobDetail.vue index b8b01584..081c50de 100644 --- a/src/views/infra/job/JobDetail.vue +++ b/src/views/infra/job/JobDetail.vue @@ -59,9 +59,9 @@ const open = async (id: number) => { if (id) { detailLoading.value = true try { - detailData.value = await JobApi.getJobApi(id) + detailData.value = await JobApi.getJob(id) // 获取下一次执行时间 - nextTimes.value = await JobApi.getJobNextTimesApi(id) + nextTimes.value = await JobApi.getJobNextTimes(id) } finally { detailLoading.value = false } diff --git a/src/views/infra/job/JobForm.vue b/src/views/infra/job/JobForm.vue index 585370bf..5148d181 100644 --- a/src/views/infra/job/JobForm.vue +++ b/src/views/infra/job/JobForm.vue @@ -80,7 +80,7 @@ const open = async (type: string, id?: number) => { if (id) { formLoading.value = true try { - formData.value = await JobApi.getJobApi(id) + formData.value = await JobApi.getJob(id) } finally { formLoading.value = false } @@ -100,10 +100,10 @@ const submitForm = async () => { try { const data = formData.value as unknown as JobApi.JobVO if (formType.value === 'create') { - await JobApi.createJobApi(data) + await JobApi.createJob(data) message.success(t('common.createSuccess')) } else { - await JobApi.updateJobApi(data) + await JobApi.updateJob(data) message.success(t('common.updateSuccess')) } modelVisible.value = false diff --git a/src/views/infra/job/JobLogView.vue b/src/views/infra/job/JobLogView.vue deleted file mode 100644 index c66e0d80..00000000 --- a/src/views/infra/job/JobLogView.vue +++ /dev/null @@ -1,74 +0,0 @@ - - diff --git a/src/views/infra/job/index.vue b/src/views/infra/job/index.vue index 13a8ccd5..72f6b95b 100644 --- a/src/views/infra/job/index.vue +++ b/src/views/infra/job/index.vue @@ -172,7 +172,7 @@ const exportLoading = ref(false) // 导出的加载中 const getList = async () => { loading.value = true try { - const data = await JobApi.getJobPageApi(queryParams) + const data = await JobApi.getJobPage(queryParams) list.value = data.list total.value = data.total } finally { @@ -199,7 +199,7 @@ const handleExport = async () => { await message.exportConfirm() // 发起导出 exportLoading.value = true - const data = await JobApi.exportJobApi(queryParams) + const data = await JobApi.exportJob(queryParams) download.excel(data, '定时任务.xls') } catch { } finally { @@ -224,7 +224,7 @@ const handleChangeStatus = async (row: JobApi.JobVO) => { ) const status = row.status === InfraJobStatusEnum.STOP ? InfraJobStatusEnum.NORMAL : InfraJobStatusEnum.STOP - await JobApi.updateJobStatusApi(row.id, status) + await JobApi.updateJobStatus(row.id, status) message.success(text + '成功') // 刷新列表 await getList() @@ -241,7 +241,7 @@ const handleDelete = async (id: number) => { // 删除的二次确认 await message.delConfirm() // 发起删除 - await JobApi.deleteJobApi(id) + await JobApi.deleteJob(id) message.success(t('common.delSuccess')) // 刷新列表 await getList() @@ -284,10 +284,10 @@ const openDetail = (id: number) => { detailRef.value.open(id) } -// 执行日志 -const handleJobLog = (rowId?: number) => { - if (rowId) { - push('/job/job-log?id=' + rowId) +/** 跳转执行日志 */ +const handleJobLog = (id: number) => { + if (id) { + push('/job/job-log?id=' + id) } else { push('/job/job-log') } diff --git a/src/views/infra/job/logger/JobLogDetail.vue b/src/views/infra/job/logger/JobLogDetail.vue new file mode 100644 index 00000000..7c4bab2b --- /dev/null +++ b/src/views/infra/job/logger/JobLogDetail.vue @@ -0,0 +1,57 @@ + + diff --git a/src/views/infra/job/JobLog.vue b/src/views/infra/job/logger/index.vue similarity index 74% rename from src/views/infra/job/JobLog.vue rename to src/views/infra/job/logger/index.vue index daa20046..ab28b285 100644 --- a/src/views/infra/job/JobLog.vue +++ b/src/views/infra/job/logger/index.vue @@ -1,37 +1,52 @@ - + - - + + - + -