增加角色模块
Showing
7 changed files
with
1022 additions
and
0 deletions
... | @@ -299,6 +299,24 @@ export const asyncRoutes = [ | ... | @@ -299,6 +299,24 @@ export const asyncRoutes = [ |
299 | component: () => import('@/views/system/timedTask/index'), | 299 | component: () => import('@/views/system/timedTask/index'), |
300 | name: 'timedTask', | 300 | name: 'timedTask', |
301 | meta: { title: '定时任务' } | 301 | meta: { title: '定时任务' } |
302 | }, | ||
303 | { | ||
304 | path: 'menus', | ||
305 | component: () => import('@/views/system/menus/index'), | ||
306 | name: 'menus', | ||
307 | meta: { title: '菜单管理' } | ||
308 | }, | ||
309 | { | ||
310 | path: 'users', | ||
311 | component: () => import('@/views/system/users/index'), | ||
312 | name: 'users', | ||
313 | meta: { title: '人员管理' } | ||
314 | }, | ||
315 | { | ||
316 | path: 'roles', | ||
317 | component: () => import('@/views/system/roles/index'), | ||
318 | name: 'roles', | ||
319 | meta: { title: '角色管理' } | ||
302 | } | 320 | } |
303 | ] | 321 | ] |
304 | } | 322 | } | ... | ... |
src/views/system/menus/data/index.js
0 → 100644
1 | import filter from '@/utils/filter.js' | ||
2 | class data extends filter { | ||
3 | constructor() { | ||
4 | super() | ||
5 | } | ||
6 | columns () { | ||
7 | return [ | ||
8 | { | ||
9 | prop: "job_name", | ||
10 | label: "任务名称", | ||
11 | width: 130 | ||
12 | }, | ||
13 | { | ||
14 | prop: "description", | ||
15 | label: "任务描述", | ||
16 | width: 300 | ||
17 | }, | ||
18 | { | ||
19 | prop: "cron_expression", | ||
20 | label: "cron表达式" | ||
21 | }, | ||
22 | { | ||
23 | prop: "bean_class", | ||
24 | width: 260, | ||
25 | label: "任务类" | ||
26 | }, | ||
27 | { | ||
28 | prop: "job_group", | ||
29 | label: "任务分组" | ||
30 | }, | ||
31 | { | ||
32 | label: "状态", | ||
33 | render: (h, scope) => { | ||
34 | return ( | ||
35 | <div> | ||
36 | { this.stateStatus(scope.row.job_status) } | ||
37 | </div> | ||
38 | ) | ||
39 | }, | ||
40 | } | ||
41 | ] | ||
42 | } | ||
43 | } | ||
44 | export default new data() |
src/views/system/menus/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="timedTask from-clues"> | ||
3 | <div class="from-clues-header"> | ||
4 | <el-form ref="form" :model="form" label-width="80px"> | ||
5 | <el-row> | ||
6 | <el-col :span="6"> | ||
7 | <el-form-item label="搜索标题"> | ||
8 | <el-input v-model="form.job_name" placeholder="请输入标题"></el-input> | ||
9 | </el-form-item> | ||
10 | </el-col> | ||
11 | <el-col :span="18" class="btnColRight"> | ||
12 | <btn nativeType="cx" @click="handleSubmit">搜索</btn> | ||
13 | <btn nativeType="sb" @click="handleAdd">新增</btn> | ||
14 | </el-col> | ||
15 | </el-row> | ||
16 | </el-form> | ||
17 | </div> | ||
18 | <div class="from-clues-content"> | ||
19 | <lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :total="pageData.total" | ||
20 | @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns" | ||
21 | :data="tableData.data"> | ||
22 | </lb-table> | ||
23 | <add-task ref="task" :taskData="taskData" /> | ||
24 | <message-tips ref="msg" :message="message" /> | ||
25 | </div> | ||
26 | </div> | ||
27 | </template> | ||
28 | <script> | ||
29 | // 定时任务 | ||
30 | import data from "./data" | ||
31 | import system from '@/api/system.js' | ||
32 | import tableMixin from '@/mixins/tableMixin.js' | ||
33 | import addTask from '../components/addTask.vue' | ||
34 | export default { | ||
35 | name: "menus", | ||
36 | mixins: [tableMixin], | ||
37 | components: { | ||
38 | addTask | ||
39 | }, | ||
40 | data () { | ||
41 | return { | ||
42 | taskData: null, | ||
43 | form: { | ||
44 | job_name: '', | ||
45 | currentPage: 1 | ||
46 | }, | ||
47 | selectionList: [], | ||
48 | tableData: { | ||
49 | columns: [{ | ||
50 | label: '序号', | ||
51 | type: 'index', | ||
52 | width: '50', | ||
53 | index: this.indexMethod, | ||
54 | }].concat(data.columns()).concat([ | ||
55 | { | ||
56 | label: "操作", | ||
57 | width: 380, | ||
58 | render: (h, scope) => { | ||
59 | return ( | ||
60 | <div> | ||
61 | <el-button type="text" size="mini" style="color: #67C23A" | ||
62 | v-show={scope.row.job_status !== '1' && scope.row.job_status !== '2'} | ||
63 | icon="el-icon-magic-stick" | ||
64 | onClick={() => { this.handleRecovery(scope.row) }}>激活 | ||
65 | </el-button> | ||
66 | |||
67 | <el-button type="text" size="mini" | ||
68 | style="color: #67C23A;margin-left:0" | ||
69 | icon="el-icon-refresh-right" | ||
70 | v-show={scope.row.job_status === '2'} | ||
71 | onClick={() => { this.handleActivation(scope.row) }}>恢复 | ||
72 | </el-button> | ||
73 | |||
74 | <el-button type="text" size="mini" | ||
75 | v-show={scope.row.job_status !== '1'} | ||
76 | icon="el-icon-stopwatch" | ||
77 | onClick={() => { this.handletest(scope.row) }}>手动测试 | ||
78 | </el-button> | ||
79 | <el-button type="text" size="mini" | ||
80 | v-show={scope.row.job_status === '1'} | ||
81 | icon="el-icon-video-pause" | ||
82 | onClick={() => { this.handleSuspend(scope.row) }}>暂停 | ||
83 | </el-button> | ||
84 | <el-button type="text" size="mini" | ||
85 | icon="el-icon-edit" | ||
86 | v-show={scope.row.job_status === '2' || scope.row.job_status === '-1' || scope.row.job_status === '0'} | ||
87 | onClick={() => { this.handleEdit(scope.row) }}>编辑 | ||
88 | </el-button> | ||
89 | <el-button type="text" size="mini" | ||
90 | icon="el-icon-delete" style="color:#F56C6C" | ||
91 | v-show={scope.row.job_status !== '1'} | ||
92 | onClick={() => { this.handleDel(scope.row) }}>删除 | ||
93 | </el-button> | ||
94 | </div> | ||
95 | ); | ||
96 | }, | ||
97 | }, | ||
98 | ]), | ||
99 | data: [] | ||
100 | }, | ||
101 | pageData: { | ||
102 | total: 0, | ||
103 | pageSize: 15, | ||
104 | current: 1, | ||
105 | }, | ||
106 | } | ||
107 | }, | ||
108 | methods: { | ||
109 | handleAdd () { | ||
110 | this.taskData = null | ||
111 | this.$refs.task.isShow() | ||
112 | }, | ||
113 | async featchData () { | ||
114 | try { | ||
115 | this.form = Object.assign(this.form, this.formData) | ||
116 | let { result: { list, total, pages: pageSize, pageNum: current } | ||
117 | } = await system.getTaskListByName(this.form) | ||
118 | this.tableData.data = list | ||
119 | this.pageData = { | ||
120 | pageSize, | ||
121 | current, | ||
122 | total | ||
123 | } | ||
124 | } catch (error) { | ||
125 | this.message = error | ||
126 | this.$refs.msg.messageShow() | ||
127 | } | ||
128 | }, | ||
129 | // 暂停 | ||
130 | handleSuspend (row) { | ||
131 | this.$confirm('此操将进行暂停操作, 是否继续?', '提示', { | ||
132 | confirmButtonText: '确定', | ||
133 | cancelButtonText: '取消', | ||
134 | type: 'warning', | ||
135 | }) | ||
136 | .then(() => { | ||
137 | system.pauseJob(row.id) | ||
138 | .then((res) => { | ||
139 | if ((res.code = 200)) { | ||
140 | this.$message({ | ||
141 | type: 'success', | ||
142 | message: res.message, | ||
143 | }) | ||
144 | this.featchData() | ||
145 | } | ||
146 | }) | ||
147 | .catch((error) => { | ||
148 | this.$alert(error, '提示', { | ||
149 | confirmButtonText: '确定', | ||
150 | type: 'error' | ||
151 | }) | ||
152 | }) | ||
153 | }) | ||
154 | .catch(() => { | ||
155 | this.$message({ | ||
156 | type: 'info', | ||
157 | message: '已取消', | ||
158 | }) | ||
159 | }) | ||
160 | }, | ||
161 | // 激活 | ||
162 | handleRecovery (row) { | ||
163 | this.$confirm('此操将进行激活操作, 是否继续?', '提示', { | ||
164 | confirmButtonText: '确定', | ||
165 | cancelButtonText: '取消', | ||
166 | type: 'warning', | ||
167 | }) | ||
168 | .then(() => { | ||
169 | system.activateJob(row.id) | ||
170 | .then((res) => { | ||
171 | if ((res.code = 200)) { | ||
172 | this.$message({ | ||
173 | type: 'success', | ||
174 | message: res.message, | ||
175 | }) | ||
176 | this.featchData() | ||
177 | } | ||
178 | }) | ||
179 | .catch((error) => { | ||
180 | this.$alert(error, '提示', { | ||
181 | confirmButtonText: '确定', | ||
182 | type: 'error' | ||
183 | }) | ||
184 | }) | ||
185 | }) | ||
186 | .catch(() => { | ||
187 | this.$message({ | ||
188 | type: 'info', | ||
189 | message: '已取消', | ||
190 | }) | ||
191 | }) | ||
192 | }, | ||
193 | // 恢复 | ||
194 | handleActivation (row) { | ||
195 | this.$confirm('此操将进行恢复操作, 是否继续?', '提示', { | ||
196 | confirmButtonText: '确定', | ||
197 | cancelButtonText: '取消', | ||
198 | type: 'warning', | ||
199 | }) | ||
200 | .then(() => { | ||
201 | system.resumeJob(row.id) | ||
202 | .then((res) => { | ||
203 | if ((res.code = 200)) { | ||
204 | this.$message({ | ||
205 | type: 'success', | ||
206 | message: res.message, | ||
207 | }) | ||
208 | this.featchData() | ||
209 | } | ||
210 | }) | ||
211 | .catch((error) => { | ||
212 | this.$alert(error, '提示', { | ||
213 | confirmButtonText: '确定', | ||
214 | type: 'error' | ||
215 | }) | ||
216 | }) | ||
217 | }) | ||
218 | .catch(() => { | ||
219 | this.$message({ | ||
220 | type: 'info', | ||
221 | message: '已取消', | ||
222 | }) | ||
223 | }) | ||
224 | }, | ||
225 | // 手动测试 | ||
226 | handletest (row) { | ||
227 | this.$confirm('此操将进行手动测试, 是否继续?', '提示', { | ||
228 | confirmButtonText: '确定', | ||
229 | cancelButtonText: '取消', | ||
230 | type: 'warning', | ||
231 | }) | ||
232 | .then(() => { | ||
233 | system.sjsbTaskRun(row.id) | ||
234 | .then((res) => { | ||
235 | if ((res.code = 200)) { | ||
236 | this.$alert(res.message, '提示', { | ||
237 | confirmButtonText: '确定', | ||
238 | type: 'success' | ||
239 | }); | ||
240 | this.featchData() | ||
241 | } | ||
242 | }) | ||
243 | .catch((error) => { | ||
244 | this.$alert(error, '提示', { | ||
245 | confirmButtonText: '确定', | ||
246 | type: 'error' | ||
247 | }) | ||
248 | }) | ||
249 | }) | ||
250 | .catch(() => { | ||
251 | this.$message({ | ||
252 | type: 'info', | ||
253 | message: '已取消', | ||
254 | }) | ||
255 | }) | ||
256 | }, | ||
257 | handleEdit (row) { | ||
258 | this.taskData = row | ||
259 | this.$refs.task.isShow() | ||
260 | }, | ||
261 | handleDel (row) { | ||
262 | this.$confirm('此操将进行删除操作, 是否继续?', '提示', { | ||
263 | confirmButtonText: '确定', | ||
264 | cancelButtonText: '取消', | ||
265 | type: 'warning', | ||
266 | }) | ||
267 | .then(() => { | ||
268 | system.sjsbTaskRemove(row.id) | ||
269 | .then((res) => { | ||
270 | if ((res.code = 200)) { | ||
271 | this.$message({ | ||
272 | type: 'success', | ||
273 | message: res.message, | ||
274 | }) | ||
275 | this.featchData() | ||
276 | } | ||
277 | }) | ||
278 | .catch((error) => { | ||
279 | this.$alert(error, '提示', { | ||
280 | confirmButtonText: '确定', | ||
281 | type: 'error' | ||
282 | }) | ||
283 | }) | ||
284 | }) | ||
285 | .catch(() => { | ||
286 | this.$message({ | ||
287 | type: 'info', | ||
288 | message: '已取消', | ||
289 | }) | ||
290 | }) | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | </script> | ||
295 | <style scoped lang="scss"> | ||
296 | @import "~@/styles/mixin.scss"; | ||
297 | @import "~@/styles/public.scss"; | ||
298 | </style> |
src/views/system/roles/data/index.js
0 → 100644
1 | import filter from '@/utils/filter.js' | ||
2 | class data extends filter { | ||
3 | constructor() { | ||
4 | super() | ||
5 | } | ||
6 | columns () { | ||
7 | return [ | ||
8 | { | ||
9 | prop: "job_name", | ||
10 | label: "任务名称", | ||
11 | width: 130 | ||
12 | }, | ||
13 | { | ||
14 | prop: "description", | ||
15 | label: "任务描述", | ||
16 | width: 300 | ||
17 | }, | ||
18 | { | ||
19 | prop: "cron_expression", | ||
20 | label: "cron表达式" | ||
21 | }, | ||
22 | { | ||
23 | prop: "bean_class", | ||
24 | width: 260, | ||
25 | label: "任务类" | ||
26 | }, | ||
27 | { | ||
28 | prop: "job_group", | ||
29 | label: "任务分组" | ||
30 | }, | ||
31 | { | ||
32 | label: "状态", | ||
33 | render: (h, scope) => { | ||
34 | return ( | ||
35 | <div> | ||
36 | { this.stateStatus(scope.row.job_status) } | ||
37 | </div> | ||
38 | ) | ||
39 | }, | ||
40 | } | ||
41 | ] | ||
42 | } | ||
43 | } | ||
44 | export default new data() |
src/views/system/roles/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="timedTask from-clues"> | ||
3 | <div class="from-clues-header"> | ||
4 | <el-form ref="form" :model="form" label-width="80px"> | ||
5 | <el-row> | ||
6 | <el-col :span="6"> | ||
7 | <el-form-item label="搜索标题"> | ||
8 | <el-input v-model="form.job_name" placeholder="请输入标题"></el-input> | ||
9 | </el-form-item> | ||
10 | </el-col> | ||
11 | <el-col :span="18" class="btnColRight"> | ||
12 | <btn nativeType="cx" @click="handleSubmit">搜索</btn> | ||
13 | <btn nativeType="sb" @click="handleAdd">新增</btn> | ||
14 | </el-col> | ||
15 | </el-row> | ||
16 | </el-form> | ||
17 | </div> | ||
18 | <div class="from-clues-content"> | ||
19 | <lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :total="pageData.total" | ||
20 | @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns" | ||
21 | :data="tableData.data"> | ||
22 | </lb-table> | ||
23 | <add-task ref="task" :taskData="taskData" /> | ||
24 | <message-tips ref="msg" :message="message" /> | ||
25 | </div> | ||
26 | </div> | ||
27 | </template> | ||
28 | <script> | ||
29 | // 定时任务 | ||
30 | import data from "./data" | ||
31 | import system from '@/api/system.js' | ||
32 | import tableMixin from '@/mixins/tableMixin.js' | ||
33 | import addTask from '../components/addTask.vue' | ||
34 | export default { | ||
35 | name: "roles", | ||
36 | mixins: [tableMixin], | ||
37 | components: { | ||
38 | addTask | ||
39 | }, | ||
40 | data () { | ||
41 | return { | ||
42 | taskData: null, | ||
43 | form: { | ||
44 | job_name: '', | ||
45 | currentPage: 1 | ||
46 | }, | ||
47 | selectionList: [], | ||
48 | tableData: { | ||
49 | columns: [{ | ||
50 | label: '序号', | ||
51 | type: 'index', | ||
52 | width: '50', | ||
53 | index: this.indexMethod, | ||
54 | }].concat(data.columns()).concat([ | ||
55 | { | ||
56 | label: "操作", | ||
57 | width: 380, | ||
58 | render: (h, scope) => { | ||
59 | return ( | ||
60 | <div> | ||
61 | <el-button type="text" size="mini" style="color: #67C23A" | ||
62 | v-show={scope.row.job_status !== '1' && scope.row.job_status !== '2'} | ||
63 | icon="el-icon-magic-stick" | ||
64 | onClick={() => { this.handleRecovery(scope.row) }}>激活 | ||
65 | </el-button> | ||
66 | |||
67 | <el-button type="text" size="mini" | ||
68 | style="color: #67C23A;margin-left:0" | ||
69 | icon="el-icon-refresh-right" | ||
70 | v-show={scope.row.job_status === '2'} | ||
71 | onClick={() => { this.handleActivation(scope.row) }}>恢复 | ||
72 | </el-button> | ||
73 | |||
74 | <el-button type="text" size="mini" | ||
75 | v-show={scope.row.job_status !== '1'} | ||
76 | icon="el-icon-stopwatch" | ||
77 | onClick={() => { this.handletest(scope.row) }}>手动测试 | ||
78 | </el-button> | ||
79 | <el-button type="text" size="mini" | ||
80 | v-show={scope.row.job_status === '1'} | ||
81 | icon="el-icon-video-pause" | ||
82 | onClick={() => { this.handleSuspend(scope.row) }}>暂停 | ||
83 | </el-button> | ||
84 | <el-button type="text" size="mini" | ||
85 | icon="el-icon-edit" | ||
86 | v-show={scope.row.job_status === '2' || scope.row.job_status === '-1' || scope.row.job_status === '0'} | ||
87 | onClick={() => { this.handleEdit(scope.row) }}>编辑 | ||
88 | </el-button> | ||
89 | <el-button type="text" size="mini" | ||
90 | icon="el-icon-delete" style="color:#F56C6C" | ||
91 | v-show={scope.row.job_status !== '1'} | ||
92 | onClick={() => { this.handleDel(scope.row) }}>删除 | ||
93 | </el-button> | ||
94 | </div> | ||
95 | ); | ||
96 | }, | ||
97 | }, | ||
98 | ]), | ||
99 | data: [] | ||
100 | }, | ||
101 | pageData: { | ||
102 | total: 0, | ||
103 | pageSize: 15, | ||
104 | current: 1, | ||
105 | }, | ||
106 | } | ||
107 | }, | ||
108 | methods: { | ||
109 | handleAdd () { | ||
110 | this.taskData = null | ||
111 | this.$refs.task.isShow() | ||
112 | }, | ||
113 | async featchData () { | ||
114 | try { | ||
115 | this.form = Object.assign(this.form, this.formData) | ||
116 | let { result: { list, total, pages: pageSize, pageNum: current } | ||
117 | } = await system.getTaskListByName(this.form) | ||
118 | this.tableData.data = list | ||
119 | this.pageData = { | ||
120 | pageSize, | ||
121 | current, | ||
122 | total | ||
123 | } | ||
124 | } catch (error) { | ||
125 | this.message = error | ||
126 | this.$refs.msg.messageShow() | ||
127 | } | ||
128 | }, | ||
129 | // 暂停 | ||
130 | handleSuspend (row) { | ||
131 | this.$confirm('此操将进行暂停操作, 是否继续?', '提示', { | ||
132 | confirmButtonText: '确定', | ||
133 | cancelButtonText: '取消', | ||
134 | type: 'warning', | ||
135 | }) | ||
136 | .then(() => { | ||
137 | system.pauseJob(row.id) | ||
138 | .then((res) => { | ||
139 | if ((res.code = 200)) { | ||
140 | this.$message({ | ||
141 | type: 'success', | ||
142 | message: res.message, | ||
143 | }) | ||
144 | this.featchData() | ||
145 | } | ||
146 | }) | ||
147 | .catch((error) => { | ||
148 | this.$alert(error, '提示', { | ||
149 | confirmButtonText: '确定', | ||
150 | type: 'error' | ||
151 | }) | ||
152 | }) | ||
153 | }) | ||
154 | .catch(() => { | ||
155 | this.$message({ | ||
156 | type: 'info', | ||
157 | message: '已取消', | ||
158 | }) | ||
159 | }) | ||
160 | }, | ||
161 | // 激活 | ||
162 | handleRecovery (row) { | ||
163 | this.$confirm('此操将进行激活操作, 是否继续?', '提示', { | ||
164 | confirmButtonText: '确定', | ||
165 | cancelButtonText: '取消', | ||
166 | type: 'warning', | ||
167 | }) | ||
168 | .then(() => { | ||
169 | system.activateJob(row.id) | ||
170 | .then((res) => { | ||
171 | if ((res.code = 200)) { | ||
172 | this.$message({ | ||
173 | type: 'success', | ||
174 | message: res.message, | ||
175 | }) | ||
176 | this.featchData() | ||
177 | } | ||
178 | }) | ||
179 | .catch((error) => { | ||
180 | this.$alert(error, '提示', { | ||
181 | confirmButtonText: '确定', | ||
182 | type: 'error' | ||
183 | }) | ||
184 | }) | ||
185 | }) | ||
186 | .catch(() => { | ||
187 | this.$message({ | ||
188 | type: 'info', | ||
189 | message: '已取消', | ||
190 | }) | ||
191 | }) | ||
192 | }, | ||
193 | // 恢复 | ||
194 | handleActivation (row) { | ||
195 | this.$confirm('此操将进行恢复操作, 是否继续?', '提示', { | ||
196 | confirmButtonText: '确定', | ||
197 | cancelButtonText: '取消', | ||
198 | type: 'warning', | ||
199 | }) | ||
200 | .then(() => { | ||
201 | system.resumeJob(row.id) | ||
202 | .then((res) => { | ||
203 | if ((res.code = 200)) { | ||
204 | this.$message({ | ||
205 | type: 'success', | ||
206 | message: res.message, | ||
207 | }) | ||
208 | this.featchData() | ||
209 | } | ||
210 | }) | ||
211 | .catch((error) => { | ||
212 | this.$alert(error, '提示', { | ||
213 | confirmButtonText: '确定', | ||
214 | type: 'error' | ||
215 | }) | ||
216 | }) | ||
217 | }) | ||
218 | .catch(() => { | ||
219 | this.$message({ | ||
220 | type: 'info', | ||
221 | message: '已取消', | ||
222 | }) | ||
223 | }) | ||
224 | }, | ||
225 | // 手动测试 | ||
226 | handletest (row) { | ||
227 | this.$confirm('此操将进行手动测试, 是否继续?', '提示', { | ||
228 | confirmButtonText: '确定', | ||
229 | cancelButtonText: '取消', | ||
230 | type: 'warning', | ||
231 | }) | ||
232 | .then(() => { | ||
233 | system.sjsbTaskRun(row.id) | ||
234 | .then((res) => { | ||
235 | if ((res.code = 200)) { | ||
236 | this.$alert(res.message, '提示', { | ||
237 | confirmButtonText: '确定', | ||
238 | type: 'success' | ||
239 | }); | ||
240 | this.featchData() | ||
241 | } | ||
242 | }) | ||
243 | .catch((error) => { | ||
244 | this.$alert(error, '提示', { | ||
245 | confirmButtonText: '确定', | ||
246 | type: 'error' | ||
247 | }) | ||
248 | }) | ||
249 | }) | ||
250 | .catch(() => { | ||
251 | this.$message({ | ||
252 | type: 'info', | ||
253 | message: '已取消', | ||
254 | }) | ||
255 | }) | ||
256 | }, | ||
257 | handleEdit (row) { | ||
258 | this.taskData = row | ||
259 | this.$refs.task.isShow() | ||
260 | }, | ||
261 | handleDel (row) { | ||
262 | this.$confirm('此操将进行删除操作, 是否继续?', '提示', { | ||
263 | confirmButtonText: '确定', | ||
264 | cancelButtonText: '取消', | ||
265 | type: 'warning', | ||
266 | }) | ||
267 | .then(() => { | ||
268 | system.sjsbTaskRemove(row.id) | ||
269 | .then((res) => { | ||
270 | if ((res.code = 200)) { | ||
271 | this.$message({ | ||
272 | type: 'success', | ||
273 | message: res.message, | ||
274 | }) | ||
275 | this.featchData() | ||
276 | } | ||
277 | }) | ||
278 | .catch((error) => { | ||
279 | this.$alert(error, '提示', { | ||
280 | confirmButtonText: '确定', | ||
281 | type: 'error' | ||
282 | }) | ||
283 | }) | ||
284 | }) | ||
285 | .catch(() => { | ||
286 | this.$message({ | ||
287 | type: 'info', | ||
288 | message: '已取消', | ||
289 | }) | ||
290 | }) | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | </script> | ||
295 | <style scoped lang="scss"> | ||
296 | @import "~@/styles/mixin.scss"; | ||
297 | @import "~@/styles/public.scss"; | ||
298 | </style> |
src/views/system/users/data/index.js
0 → 100644
1 | import filter from '@/utils/filter.js' | ||
2 | class data extends filter { | ||
3 | constructor() { | ||
4 | super() | ||
5 | } | ||
6 | columns () { | ||
7 | return [ | ||
8 | { | ||
9 | prop: "job_name", | ||
10 | label: "任务名称", | ||
11 | width: 130 | ||
12 | }, | ||
13 | { | ||
14 | prop: "description", | ||
15 | label: "任务描述", | ||
16 | width: 300 | ||
17 | }, | ||
18 | { | ||
19 | prop: "cron_expression", | ||
20 | label: "cron表达式" | ||
21 | }, | ||
22 | { | ||
23 | prop: "bean_class", | ||
24 | width: 260, | ||
25 | label: "任务类" | ||
26 | }, | ||
27 | { | ||
28 | prop: "job_group", | ||
29 | label: "任务分组" | ||
30 | }, | ||
31 | { | ||
32 | label: "状态", | ||
33 | render: (h, scope) => { | ||
34 | return ( | ||
35 | <div> | ||
36 | { this.stateStatus(scope.row.job_status) } | ||
37 | </div> | ||
38 | ) | ||
39 | }, | ||
40 | } | ||
41 | ] | ||
42 | } | ||
43 | } | ||
44 | export default new data() |
src/views/system/users/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="timedTask from-clues"> | ||
3 | <h1>水水水水水</h1> | ||
4 | </div> | ||
5 | </template> | ||
6 | <script> | ||
7 | // 定时任务 | ||
8 | import data from "./data" | ||
9 | import system from '@/api/system.js' | ||
10 | import tableMixin from '@/mixins/tableMixin.js' | ||
11 | import addTask from '../components/addTask.vue' | ||
12 | export default { | ||
13 | name: "users", | ||
14 | mixins: [tableMixin], | ||
15 | components: { | ||
16 | addTask | ||
17 | }, | ||
18 | data () { | ||
19 | return { | ||
20 | taskData: null, | ||
21 | form: { | ||
22 | job_name: '', | ||
23 | currentPage: 1 | ||
24 | }, | ||
25 | selectionList: [], | ||
26 | tableData: { | ||
27 | columns: [{ | ||
28 | label: '序号', | ||
29 | type: 'index', | ||
30 | width: '50', | ||
31 | index: this.indexMethod, | ||
32 | }].concat(data.columns()).concat([ | ||
33 | { | ||
34 | label: "操作", | ||
35 | width: 380, | ||
36 | render: (h, scope) => { | ||
37 | return ( | ||
38 | <div> | ||
39 | <el-button type="text" size="mini" style="color: #67C23A" | ||
40 | v-show={scope.row.job_status !== '1' && scope.row.job_status !== '2'} | ||
41 | icon="el-icon-magic-stick" | ||
42 | onClick={() => { this.handleRecovery(scope.row) }}>激活 | ||
43 | </el-button> | ||
44 | |||
45 | <el-button type="text" size="mini" | ||
46 | style="color: #67C23A;margin-left:0" | ||
47 | icon="el-icon-refresh-right" | ||
48 | v-show={scope.row.job_status === '2'} | ||
49 | onClick={() => { this.handleActivation(scope.row) }}>恢复 | ||
50 | </el-button> | ||
51 | |||
52 | <el-button type="text" size="mini" | ||
53 | v-show={scope.row.job_status !== '1'} | ||
54 | icon="el-icon-stopwatch" | ||
55 | onClick={() => { this.handletest(scope.row) }}>手动测试 | ||
56 | </el-button> | ||
57 | <el-button type="text" size="mini" | ||
58 | v-show={scope.row.job_status === '1'} | ||
59 | icon="el-icon-video-pause" | ||
60 | onClick={() => { this.handleSuspend(scope.row) }}>暂停 | ||
61 | </el-button> | ||
62 | <el-button type="text" size="mini" | ||
63 | icon="el-icon-edit" | ||
64 | v-show={scope.row.job_status === '2' || scope.row.job_status === '-1' || scope.row.job_status === '0'} | ||
65 | onClick={() => { this.handleEdit(scope.row) }}>编辑 | ||
66 | </el-button> | ||
67 | <el-button type="text" size="mini" | ||
68 | icon="el-icon-delete" style="color:#F56C6C" | ||
69 | v-show={scope.row.job_status !== '1'} | ||
70 | onClick={() => { this.handleDel(scope.row) }}>删除 | ||
71 | </el-button> | ||
72 | </div> | ||
73 | ); | ||
74 | }, | ||
75 | }, | ||
76 | ]), | ||
77 | data: [] | ||
78 | }, | ||
79 | pageData: { | ||
80 | total: 0, | ||
81 | pageSize: 15, | ||
82 | current: 1, | ||
83 | }, | ||
84 | } | ||
85 | }, | ||
86 | methods: { | ||
87 | handleAdd () { | ||
88 | this.taskData = null | ||
89 | this.$refs.task.isShow() | ||
90 | }, | ||
91 | async featchData () { | ||
92 | try { | ||
93 | this.form = Object.assign(this.form, this.formData) | ||
94 | let { result: { list, total, pages: pageSize, pageNum: current } | ||
95 | } = await system.getTaskListByName(this.form) | ||
96 | this.tableData.data = list | ||
97 | this.pageData = { | ||
98 | pageSize, | ||
99 | current, | ||
100 | total | ||
101 | } | ||
102 | } catch (error) { | ||
103 | this.message = error | ||
104 | this.$refs.msg.messageShow() | ||
105 | } | ||
106 | }, | ||
107 | // 暂停 | ||
108 | handleSuspend (row) { | ||
109 | this.$confirm('此操将进行暂停操作, 是否继续?', '提示', { | ||
110 | confirmButtonText: '确定', | ||
111 | cancelButtonText: '取消', | ||
112 | type: 'warning', | ||
113 | }) | ||
114 | .then(() => { | ||
115 | system.pauseJob(row.id) | ||
116 | .then((res) => { | ||
117 | if ((res.code = 200)) { | ||
118 | this.$message({ | ||
119 | type: 'success', | ||
120 | message: res.message, | ||
121 | }) | ||
122 | this.featchData() | ||
123 | } | ||
124 | }) | ||
125 | .catch((error) => { | ||
126 | this.$alert(error, '提示', { | ||
127 | confirmButtonText: '确定', | ||
128 | type: 'error' | ||
129 | }) | ||
130 | }) | ||
131 | }) | ||
132 | .catch(() => { | ||
133 | this.$message({ | ||
134 | type: 'info', | ||
135 | message: '已取消', | ||
136 | }) | ||
137 | }) | ||
138 | }, | ||
139 | // 激活 | ||
140 | handleRecovery (row) { | ||
141 | this.$confirm('此操将进行激活操作, 是否继续?', '提示', { | ||
142 | confirmButtonText: '确定', | ||
143 | cancelButtonText: '取消', | ||
144 | type: 'warning', | ||
145 | }) | ||
146 | .then(() => { | ||
147 | system.activateJob(row.id) | ||
148 | .then((res) => { | ||
149 | if ((res.code = 200)) { | ||
150 | this.$message({ | ||
151 | type: 'success', | ||
152 | message: res.message, | ||
153 | }) | ||
154 | this.featchData() | ||
155 | } | ||
156 | }) | ||
157 | .catch((error) => { | ||
158 | this.$alert(error, '提示', { | ||
159 | confirmButtonText: '确定', | ||
160 | type: 'error' | ||
161 | }) | ||
162 | }) | ||
163 | }) | ||
164 | .catch(() => { | ||
165 | this.$message({ | ||
166 | type: 'info', | ||
167 | message: '已取消', | ||
168 | }) | ||
169 | }) | ||
170 | }, | ||
171 | // 恢复 | ||
172 | handleActivation (row) { | ||
173 | this.$confirm('此操将进行恢复操作, 是否继续?', '提示', { | ||
174 | confirmButtonText: '确定', | ||
175 | cancelButtonText: '取消', | ||
176 | type: 'warning', | ||
177 | }) | ||
178 | .then(() => { | ||
179 | system.resumeJob(row.id) | ||
180 | .then((res) => { | ||
181 | if ((res.code = 200)) { | ||
182 | this.$message({ | ||
183 | type: 'success', | ||
184 | message: res.message, | ||
185 | }) | ||
186 | this.featchData() | ||
187 | } | ||
188 | }) | ||
189 | .catch((error) => { | ||
190 | this.$alert(error, '提示', { | ||
191 | confirmButtonText: '确定', | ||
192 | type: 'error' | ||
193 | }) | ||
194 | }) | ||
195 | }) | ||
196 | .catch(() => { | ||
197 | this.$message({ | ||
198 | type: 'info', | ||
199 | message: '已取消', | ||
200 | }) | ||
201 | }) | ||
202 | }, | ||
203 | // 手动测试 | ||
204 | handletest (row) { | ||
205 | this.$confirm('此操将进行手动测试, 是否继续?', '提示', { | ||
206 | confirmButtonText: '确定', | ||
207 | cancelButtonText: '取消', | ||
208 | type: 'warning', | ||
209 | }) | ||
210 | .then(() => { | ||
211 | system.sjsbTaskRun(row.id) | ||
212 | .then((res) => { | ||
213 | if ((res.code = 200)) { | ||
214 | this.$alert(res.message, '提示', { | ||
215 | confirmButtonText: '确定', | ||
216 | type: 'success' | ||
217 | }); | ||
218 | this.featchData() | ||
219 | } | ||
220 | }) | ||
221 | .catch((error) => { | ||
222 | this.$alert(error, '提示', { | ||
223 | confirmButtonText: '确定', | ||
224 | type: 'error' | ||
225 | }) | ||
226 | }) | ||
227 | }) | ||
228 | .catch(() => { | ||
229 | this.$message({ | ||
230 | type: 'info', | ||
231 | message: '已取消', | ||
232 | }) | ||
233 | }) | ||
234 | }, | ||
235 | handleEdit (row) { | ||
236 | this.taskData = row | ||
237 | this.$refs.task.isShow() | ||
238 | }, | ||
239 | handleDel (row) { | ||
240 | this.$confirm('此操将进行删除操作, 是否继续?', '提示', { | ||
241 | confirmButtonText: '确定', | ||
242 | cancelButtonText: '取消', | ||
243 | type: 'warning', | ||
244 | }) | ||
245 | .then(() => { | ||
246 | system.sjsbTaskRemove(row.id) | ||
247 | .then((res) => { | ||
248 | if ((res.code = 200)) { | ||
249 | this.$message({ | ||
250 | type: 'success', | ||
251 | message: res.message, | ||
252 | }) | ||
253 | this.featchData() | ||
254 | } | ||
255 | }) | ||
256 | .catch((error) => { | ||
257 | this.$alert(error, '提示', { | ||
258 | confirmButtonText: '确定', | ||
259 | type: 'error' | ||
260 | }) | ||
261 | }) | ||
262 | }) | ||
263 | .catch(() => { | ||
264 | this.$message({ | ||
265 | type: 'info', | ||
266 | message: '已取消', | ||
267 | }) | ||
268 | }) | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | </script> | ||
273 | <style scoped lang="scss"> | ||
274 | @import "~@/styles/mixin.scss"; | ||
275 | @import "~@/styles/public.scss"; | ||
276 | </style> |
-
Please register or sign in to post a comment