diff --git a/src/api/monitor/job.js b/src/api/monitor/job.js index 58c4343..4666455 100644 --- a/src/api/monitor/job.js +++ b/src/api/monitor/job.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询定时任务调度列表 export function listJob(query) { return request({ - url: '/monitor/job/list', + url: '/api/v1/monitor/cronJob/list', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listJob(query) { // 查询定时任务调度详细 export function getJob(jobId) { return request({ - url: '/monitor/job/' + jobId, + url: '/api/v1/monitor/cronJob/' + jobId, method: 'get' }) } @@ -20,7 +20,7 @@ export function getJob(jobId) { // 新增定时任务调度 export function addJob(data) { return request({ - url: '/monitor/job', + url: '/api/v1/monitor/cronJob/create', method: 'post', data: data }) @@ -29,37 +29,29 @@ export function addJob(data) { // 修改定时任务调度 export function updateJob(data) { return request({ - url: '/monitor/job', + url: '/api/v1/monitor/cronJob/modify', method: 'put', data: data }) } // 删除定时任务调度 -export function delJob(jobId) { +export function delJob(jobId, funcAlias) { return request({ - url: '/monitor/job/' + jobId, + url: `/api/v1/monitor/cronJob/${jobId}/${funcAlias}`, method: 'delete' }) } -// 导出定时任务调度 -export function exportJob(query) { - return request({ - url: '/monitor/job/export', - method: 'get', - params: query - }) -} - // 任务状态修改 -export function changeJobStatus(jobId, status) { +export function changeJobStatus(jobId, funcAlias, status) { const data = { jobId, + funcAlias, status } return request({ - url: '/monitor/job/changeStatus', + url: '/api/v1/monitor/cronJob/changeStatus', method: 'put', data: data }) @@ -67,14 +59,14 @@ export function changeJobStatus(jobId, status) { // 定时任务立即执行一次 -export function runJob(jobId, jobGroup) { +export function runJob(jobId, funcAlias) { const data = { jobId, - jobGroup + funcAlias } return request({ - url: '/monitor/job/run', + url: '/api/v1/monitor/cronJob/run', method: 'put', data: data }) -} \ No newline at end of file +} diff --git a/src/views/monitor/job/index.vue b/src/views/monitor/job/index.vue index 2a32ca7..67ea733 100644 --- a/src/views/monitor/job/index.vue +++ b/src/views/monitor/job/index.vue @@ -10,16 +10,6 @@ @keyup.enter.native="handleQuery" /> - - - - - 新增 + > 修改 + > 删除 - - - 导出 + > 日志 + > - + - - - + + @@ -114,18 +87,18 @@ 修改 + > 删除 + > handleCommand(command, scope.row)"> @@ -160,54 +133,14 @@ - - - - - - - - - - 调用方法 - - - Bean调用示例:ryTask.ryParams('ry') - Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry') - 参数说明:支持字符串,布尔类型,长整型,浮点型,整型 - - - - - + + - - - - - - - - 允许 - 禁止 - - - - - - - 立即执行 - 执行一次 - 放弃执行 - + + @@ -238,7 +171,6 @@ {{ form.jobName }} - {{ jobGroupFormat(form) }} {{ form.createTime }} @@ -248,7 +180,7 @@ {{ parseTime(form.nextValidTime) }} - {{ form.invokeTarget }} + {{ form.funcAlias }} @@ -288,8 +220,6 @@ export default { return { // 遮罩层 loading: true, - // 导出遮罩层 - exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -308,8 +238,6 @@ export default { open: false, // 是否显示详细弹出层 openView: false, - // 任务组名字典 - jobGroupOptions: [], // 状态字典 statusOptions: [], // 查询参数 @@ -317,7 +245,6 @@ export default { pageNum: 1, pageSize: 10, jobName: undefined, - jobGroup: undefined, status: undefined }, // 表单参数 @@ -327,10 +254,10 @@ export default { jobName: [ { required: true, message: "任务名称不能为空", trigger: "blur" } ], - invokeTarget: [ + funcAlias: [ { required: true, message: "调用目标字符串不能为空", trigger: "blur" } ], - cronExpression: [ + jobCron: [ { required: true, message: "cron执行表达式不能为空", trigger: "blur" } ] } @@ -338,9 +265,6 @@ export default { }, created() { this.getList(); - this.getDicts("sys_job_group").then(response => { - this.jobGroupOptions = response.data; - }); this.getDicts("sys_job_status").then(response => { this.statusOptions = response.data; }); @@ -350,15 +274,11 @@ export default { getList() { this.loading = true; listJob(this.queryParams).then(response => { - this.jobList = response.rows; - this.total = response.total; + this.jobList = response.data.list; + this.total = response.data.total; this.loading = false; }); }, - // 任务组名字典翻译 - jobGroupFormat(row, column) { - return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); - }, // 状态字典翻译 statusFormat(row, column) { return this.selectDictLabel(this.statusOptions, row.status); @@ -373,9 +293,8 @@ export default { this.form = { jobId: undefined, jobName: undefined, - jobGroup: undefined, - invokeTarget: undefined, - cronExpression: undefined, + funcAlias: undefined, + jobCron: undefined, misfirePolicy: 1, concurrent: 1, status: "0" @@ -395,7 +314,7 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.jobId); - this.single = selection.length != 1; + this.single = selection.length !== 1; this.multiple = !selection.length; }, // 更多操作触发 @@ -416,13 +335,13 @@ export default { }, // 任务状态修改 handleStatusChange(row) { - let text = row.status === "0" ? "启用" : "停用"; + let text = row.status === "1" ? "启用" : "停用"; this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(function() { - return changeJobStatus(row.jobId, row.status); + return changeJobStatus(row.jobId, row.funcAlias, row.status); }).then(() => { this.msgSuccess(text + "成功"); }).catch(function() { @@ -436,7 +355,7 @@ export default { cancelButtonText: "取消", type: "warning" }).then(function() { - return runJob(row.jobId, row.jobGroup); + return runJob(row.jobId); }).then(() => { this.msgSuccess("执行成功"); }).catch(() => {}); @@ -497,26 +416,11 @@ export default { cancelButtonText: "取消", type: "warning" }).then(function() { - return delJob(jobIds); + return delJob(jobIds, row.funcAlias); }).then(() => { this.getList(); this.msgSuccess("删除成功"); }).catch(() => {}); - }, - /** 导出按钮操作 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm("是否确认导出所有定时任务数据项?", "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportJob(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); } } }; diff --git a/src/views/monitor/job/log.vue b/src/views/monitor/job/log.vue index fce44cd..200e7ae 100644 --- a/src/views/monitor/job/log.vue +++ b/src/views/monitor/job/log.vue @@ -11,22 +11,6 @@ @keyup.enter.native="handleQuery" /> - - - - - 删除 + > 导出 + > 关闭 + > @@ -110,7 +90,6 @@ -