Просмотр исходного кода

定时任务新增更多操作

RuoYi лет назад: 4
Родитель
Сommit
816479e092
2 измененных файлов с 65 добавлено и 11 удалено
  1. 40 10
      ruoyi-ui/src/views/monitor/job/index.vue
  2. 25 1
      ruoyi-ui/src/views/monitor/job/log.vue

+ 40 - 10
ruoyi-ui/src/views/monitor/job/index.vue

@@ -114,17 +114,30 @@
114 114
           <el-button
115 115
             size="mini"
116 116
             type="text"
117
-            icon="el-icon-caret-right"
118
-            @click="handleRun(scope.row)"
119
-            v-hasPermi="['monitor:job:changeStatus']"
120
-          >执行一次</el-button>
117
+            icon="el-icon-edit"
118
+            @click="handleUpdate(scope.row)"
119
+            v-hasPermi="['monitor:job:edit']"
120
+          >修改</el-button>
121 121
           <el-button
122 122
             size="mini"
123 123
             type="text"
124
-            icon="el-icon-view"
125
-            @click="handleView(scope.row)"
126
-            v-hasPermi="['monitor:job:query']"
127
-          >详细</el-button>
124
+            icon="el-icon-delete"
125
+            @click="handleDelete(scope.row)"
126
+            v-hasPermi="['monitor:job:remove']"
127
+          >删除</el-button>
128
+          <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
129
+            <span class="el-dropdown-link">
130
+              <i class="el-icon-d-arrow-right el-icon--right"></i>更多
131
+            </span>
132
+            <el-dropdown-menu slot="dropdown">
133
+              <el-dropdown-item command="handleRun" icon="el-icon-caret-right"
134
+                v-hasPermi="['monitor:job:changeStatus']">执行一次</el-dropdown-item>
135
+              <el-dropdown-item command="handleView" icon="el-icon-view"
136
+                v-hasPermi="['monitor:job:query']">任务详细</el-dropdown-item>
137
+              <el-dropdown-item command="handleJobLog" icon="el-icon-s-operation"
138
+                v-hasPermi="['monitor:job:query']">调度日志</el-dropdown-item>
139
+            </el-dropdown-menu>
140
+          </el-dropdown>
128 141
         </template>
129 142
       </el-table-column>
130 143
     </el-table>
@@ -382,6 +395,22 @@ export default {
382 395
       this.single = selection.length != 1;
383 396
       this.multiple = !selection.length;
384 397
     },
398
+    // 更多操作触发
399
+    handleCommand(command, row) {
400
+      switch (command) {
401
+        case "handleRun":
402
+          this.handleRun(row);
403
+          break;
404
+        case "handleView":
405
+          this.handleView(row);
406
+          break;
407
+        case "handleJobLog":
408
+          this.handleJobLog(row);
409
+          break;
410
+        default:
411
+          break;
412
+      }
413
+    },
385 414
     // 任务状态修改
386 415
     handleStatusChange(row) {
387 416
       let text = row.status === "0" ? "启用" : "停用";
@@ -417,8 +446,9 @@ export default {
417 446
       });
418 447
     },
419 448
     /** 任务日志列表查询 */
420
-    handleJobLog() {
421
-      this.$router.push("/job/log");
449
+    handleJobLog(row) {
450
+      const jobId = row.jobId || 0;
451
+      this.$router.push({ path: '/job/log', query: { jobId: jobId } })
422 452
     },
423 453
     /** 新增按钮操作 */
424 454
     handleAdd() {

+ 25 - 1
ruoyi-ui/src/views/monitor/job/log.vue

@@ -93,6 +93,15 @@
93 93
           v-hasPermi="['monitor:job:export']"
94 94
         >导出</el-button>
95 95
       </el-col>
96
+      <el-col :span="1.5">
97
+        <el-button
98
+          type="warning"
99
+          plain
100
+          icon="el-icon-close"
101
+          size="mini"
102
+          @click="handleClose"
103
+        >关闭</el-button>
104
+      </el-col>
96 105
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
97 106
     </el-row>
98 107
 
@@ -167,6 +176,7 @@
167 176
 </template>
168 177
 
169 178
 <script>
179
+import { getJob} from "@/api/monitor/job";
170 180
 import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
171 181
 
172 182
 export default {
@@ -206,7 +216,16 @@ export default {
206 216
     };
207 217
   },
208 218
   created() {
209
-    this.getList();
219
+    const jobId = this.$route.query.jobId;
220
+    if (jobId !== undefined && jobId != 0) {
221
+      getJob(jobId).then(response => {
222
+        this.queryParams.jobName = response.data.jobName;
223
+        this.queryParams.jobGroup = response.data.jobGroup;
224
+        this.getList();
225
+      });
226
+    } else {
227
+      this.getList();
228
+    }
210 229
     this.getDicts("sys_job_status").then(response => {
211 230
       this.statusOptions = response.data;
212 231
     });
@@ -233,6 +252,11 @@ export default {
233 252
     jobGroupFormat(row, column) {
234 253
       return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
235 254
     },
255
+    // 返回按钮
256
+    handleClose() {
257
+      this.$store.dispatch("tagsView/delView", this.$route);
258
+      this.$router.push({ path: "/monitor/job" });
259
+    },
236 260
     /** 搜索按钮操作 */
237 261
     handleQuery() {
238 262
       this.queryParams.pageNum = 1;