作者 RuoYi

定时任务新增更多操作

@@ -115,17 +115,30 @@ @@ -115,17 +115,30 @@
115 <el-button 115 <el-button
116 size="mini" 116 size="mini"
117 type="text" 117 type="text"
118 - icon="el-icon-caret-right"  
119 - @click="handleRun(scope.row)"  
120 - v-hasPermi="['monitor:job:changeStatus']"  
121 - >执行一次</el-button> 118 + icon="el-icon-edit"
  119 + @click="handleUpdate(scope.row)"
  120 + v-hasPermi="['monitor:job:edit']"
  121 + >修改</el-button>
122 <el-button 122 <el-button
123 size="mini" 123 size="mini"
124 type="text" 124 type="text"
125 - icon="el-icon-view"  
126 - @click="handleView(scope.row)"  
127 - v-hasPermi="['monitor:job:query']"  
128 - >详细</el-button> 125 + icon="el-icon-delete"
  126 + @click="handleDelete(scope.row)"
  127 + v-hasPermi="['monitor:job:remove']"
  128 + >删除</el-button>
  129 + <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
  130 + <span class="el-dropdown-link">
  131 + <i class="el-icon-d-arrow-right el-icon--right"></i>更多
  132 + </span>
  133 + <el-dropdown-menu slot="dropdown">
  134 + <el-dropdown-item command="handleRun" icon="el-icon-caret-right"
  135 + v-hasPermi="['monitor:job:changeStatus']">执行一次</el-dropdown-item>
  136 + <el-dropdown-item command="handleView" icon="el-icon-view"
  137 + v-hasPermi="['monitor:job:query']">任务详细</el-dropdown-item>
  138 + <el-dropdown-item command="handleJobLog" icon="el-icon-s-operation"
  139 + v-hasPermi="['monitor:job:query']">调度日志</el-dropdown-item>
  140 + </el-dropdown-menu>
  141 + </el-dropdown>
129 </template> 142 </template>
130 </el-table-column> 143 </el-table-column>
131 </el-table> 144 </el-table>
@@ -385,6 +398,22 @@ export default { @@ -385,6 +398,22 @@ export default {
385 this.single = selection.length != 1; 398 this.single = selection.length != 1;
386 this.multiple = !selection.length; 399 this.multiple = !selection.length;
387 }, 400 },
  401 + // 更多操作触发
  402 + handleCommand(command, row) {
  403 + switch (command) {
  404 + case "handleRun":
  405 + this.handleRun(row);
  406 + break;
  407 + case "handleView":
  408 + this.handleView(row);
  409 + break;
  410 + case "handleJobLog":
  411 + this.handleJobLog(row);
  412 + break;
  413 + default:
  414 + break;
  415 + }
  416 + },
388 // 任务状态修改 417 // 任务状态修改
389 handleStatusChange(row) { 418 handleStatusChange(row) {
390 let text = row.status === "0" ? "启用" : "停用"; 419 let text = row.status === "0" ? "启用" : "停用";
@@ -420,8 +449,9 @@ export default { @@ -420,8 +449,9 @@ export default {
420 }); 449 });
421 }, 450 },
422 /** 任务日志列表查询 */ 451 /** 任务日志列表查询 */
423 - handleJobLog() {  
424 - this.$router.push("/job/log"); 452 + handleJobLog(row) {
  453 + const jobId = row.jobId || 0;
  454 + this.$router.push({ path: '/job/log', query: { jobId: jobId } })
425 }, 455 },
426 /** 新增按钮操作 */ 456 /** 新增按钮操作 */
427 handleAdd() { 457 handleAdd() {
@@ -94,6 +94,15 @@ @@ -94,6 +94,15 @@
94 v-hasPermi="['monitor:job:export']" 94 v-hasPermi="['monitor:job:export']"
95 >导出</el-button> 95 >导出</el-button>
96 </el-col> 96 </el-col>
  97 + <el-col :span="1.5">
  98 + <el-button
  99 + type="warning"
  100 + plain
  101 + icon="el-icon-close"
  102 + size="mini"
  103 + @click="handleClose"
  104 + >关闭</el-button>
  105 + </el-col>
97 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 106 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
98 </el-row> 107 </el-row>
99 108
@@ -168,6 +177,7 @@ @@ -168,6 +177,7 @@
168 </template> 177 </template>
169 178
170 <script> 179 <script>
  180 +import { getJob} from "@/api/monitor/job";
171 import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog"; 181 import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
172 182
173 export default { 183 export default {
@@ -209,7 +219,16 @@ export default { @@ -209,7 +219,16 @@ export default {
209 }; 219 };
210 }, 220 },
211 created() { 221 created() {
212 - this.getList(); 222 + const jobId = this.$route.query.jobId;
  223 + if (jobId !== undefined && jobId != 0) {
  224 + getJob(jobId).then(response => {
  225 + this.queryParams.jobName = response.data.jobName;
  226 + this.queryParams.jobGroup = response.data.jobGroup;
  227 + this.getList();
  228 + });
  229 + } else {
  230 + this.getList();
  231 + }
213 this.getDicts("sys_job_status").then(response => { 232 this.getDicts("sys_job_status").then(response => {
214 this.statusOptions = response.data; 233 this.statusOptions = response.data;
215 }); 234 });
@@ -236,6 +255,11 @@ export default { @@ -236,6 +255,11 @@ export default {
236 jobGroupFormat(row, column) { 255 jobGroupFormat(row, column) {
237 return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); 256 return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
238 }, 257 },
  258 + // 返回按钮
  259 + handleClose() {
  260 + this.$store.dispatch("tagsView/delView", this.$route);
  261 + this.$router.push({ path: "/monitor/job" });
  262 + },
239 /** 搜索按钮操作 */ 263 /** 搜索按钮操作 */
240 handleQuery() { 264 handleQuery() {
241 this.queryParams.pageNum = 1; 265 this.queryParams.pageNum = 1;