7ac06c40 by 任超

style:定时任务

1 parent 40dcaf8d
1 import request from '@/utils/request' 1 import request from '@/utils/request'
2 import SERVER from './config'
2 3
3 class system { 4 class sjsbTask {
4 // 定时任务 5 // 定时任务
5
6 // 定时任务查询接口 6 // 定时任务查询接口
7 async getTaskListByName (data) { 7 async getTaskListByName (data) {
8 return request({ 8 return request({
9 url: '/sjsbTask/getTaskListByName', 9 url: SERVER.SERVERAPI + '/sjsbTask/getTaskListByName',
10 method: 'post', 10 method: 'post',
11 data 11 data
12 }) 12 })
...@@ -14,7 +14,7 @@ class system { ...@@ -14,7 +14,7 @@ class system {
14 // 定时任务新增接口 14 // 定时任务新增接口
15 async sjsbTaskSave (data) { 15 async sjsbTaskSave (data) {
16 return request({ 16 return request({
17 url: '/sjsbTask/save', 17 url: SERVER.SERVERAPI + '/sjsbTask/save',
18 method: 'post', 18 method: 'post',
19 data 19 data
20 }) 20 })
...@@ -22,7 +22,7 @@ class system { ...@@ -22,7 +22,7 @@ class system {
22 // 修改定时任务执行时间接口 22 // 修改定时任务执行时间接口
23 async updateCron (data) { 23 async updateCron (data) {
24 return request({ 24 return request({
25 url: '/sjsbTask/updateCron', 25 url: SERVER.SERVERAPI + '/sjsbTask/updateCron',
26 method: 'post', 26 method: 'post',
27 data 27 data
28 }) 28 })
...@@ -30,7 +30,7 @@ class system { ...@@ -30,7 +30,7 @@ class system {
30 // 定时任务删除接口 30 // 定时任务删除接口
31 async sjsbTaskRemove (id) { 31 async sjsbTaskRemove (id) {
32 return request({ 32 return request({
33 url: '/sjsbTask/remove', 33 url: SERVER.SERVERAPI + '/sjsbTask/remove',
34 method: 'get', 34 method: 'get',
35 params: { 35 params: {
36 id: id 36 id: id
...@@ -40,7 +40,7 @@ class system { ...@@ -40,7 +40,7 @@ class system {
40 // 暂停任务接口 40 // 暂停任务接口
41 async pauseJob (id) { 41 async pauseJob (id) {
42 return request({ 42 return request({
43 url: '/sjsbTask/pauseJob', 43 url: SERVER.SERVERAPI + '/sjsbTask/pauseJob',
44 method: 'get', 44 method: 'get',
45 params: { 45 params: {
46 id: id 46 id: id
...@@ -50,7 +50,7 @@ class system { ...@@ -50,7 +50,7 @@ class system {
50 // 恢复任务接口 50 // 恢复任务接口
51 async resumeJob (id) { 51 async resumeJob (id) {
52 return request({ 52 return request({
53 url: '/sjsbTask/resumeJob', 53 url: SERVER.SERVERAPI + '/sjsbTask/resumeJob',
54 method: 'get', 54 method: 'get',
55 params: { 55 params: {
56 id: id 56 id: id
...@@ -60,7 +60,7 @@ class system { ...@@ -60,7 +60,7 @@ class system {
60 // 激活任务接口 60 // 激活任务接口
61 async activateJob (id) { 61 async activateJob (id) {
62 return request({ 62 return request({
63 url: '/sjsbTask/activateJob', 63 url: SERVER.SERVERAPI + '/sjsbTask/activateJob',
64 method: 'get', 64 method: 'get',
65 params: { 65 params: {
66 id: id 66 id: id
...@@ -70,7 +70,7 @@ class system { ...@@ -70,7 +70,7 @@ class system {
70 // 手动测试 70 // 手动测试
71 async sjsbTaskRun (id) { 71 async sjsbTaskRun (id) {
72 return request({ 72 return request({
73 url: '/sjsbTask/run', 73 url: SERVER.SERVERAPI + '/sjsbTask/run',
74 method: 'get', 74 method: 'get',
75 params: { 75 params: {
76 id: id 76 id: id
...@@ -78,4 +78,4 @@ class system { ...@@ -78,4 +78,4 @@ class system {
78 }) 78 })
79 } 79 }
80 } 80 }
81 export default new system()
...\ No newline at end of file ...\ No newline at end of file
81 export default new sjsbTask()
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 </template> 40 </template>
41 41
42 <script> 42 <script>
43 import system from '@/api/system.js' 43 import sjsbTask from '@/api/sjsbTask.js'
44 export default { 44 export default {
45 props: { 45 props: {
46 taskData: { 46 taskData: {
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
92 if (valid) { 92 if (valid) {
93 if (!_this.taskData) { 93 if (!_this.taskData) {
94 try { 94 try {
95 let res = await system.sjsbTaskSave(_this.ruleForm) 95 let res = await sjsbTask.sjsbTaskSave(_this.ruleForm)
96 if (res.code == 200) { 96 if (res.code == 200) {
97 _this.loading = false 97 _this.loading = false
98 _this.$message({ 98 _this.$message({
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
108 } 108 }
109 } else { 109 } else {
110 try { 110 try {
111 let res = await system.updateCron(_this.ruleForm) 111 let res = await sjsbTask.updateCron(_this.ruleForm)
112 if (res.code == 200) { 112 if (res.code == 200) {
113 _this.$message({ 113 _this.$message({
114 message: res.message, 114 message: res.message,
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 <script> 28 <script>
29 // 定时任务 29 // 定时任务
30 import data from "./data" 30 import data from "./data"
31 import system from '@/api/system.js' 31 import sjsbTask from '@/api/sjsbTask.js'
32 import tableMixin from '@/mixins/tableMixin.js' 32 import tableMixin from '@/mixins/tableMixin.js'
33 import addTask from '../components/addTask.vue' 33 import addTask from '../components/addTask.vue'
34 export default { 34 export default {
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
114 try { 114 try {
115 this.form = Object.assign(this.form, this.formData) 115 this.form = Object.assign(this.form, this.formData)
116 let { result: { list, total, pages: pageSize, pageNum: current } 116 let { result: { list, total, pages: pageSize, pageNum: current }
117 } = await system.getTaskListByName(this.form) 117 } = await sjsbTask.getTaskListByName(this.form)
118 this.tableData.data = list 118 this.tableData.data = list
119 this.pageData = { 119 this.pageData = {
120 pageSize, 120 pageSize,
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
134 type: 'warning', 134 type: 'warning',
135 }) 135 })
136 .then(() => { 136 .then(() => {
137 system.pauseJob(row.id) 137 sjsbTask.pauseJob(row.id)
138 .then((res) => { 138 .then((res) => {
139 if ((res.code = 200)) { 139 if ((res.code = 200)) {
140 this.$message({ 140 this.$message({
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
166 type: 'warning', 166 type: 'warning',
167 }) 167 })
168 .then(() => { 168 .then(() => {
169 system.activateJob(row.id) 169 sjsbTask.activateJob(row.id)
170 .then((res) => { 170 .then((res) => {
171 if ((res.code = 200)) { 171 if ((res.code = 200)) {
172 this.$message({ 172 this.$message({
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
198 type: 'warning', 198 type: 'warning',
199 }) 199 })
200 .then(() => { 200 .then(() => {
201 system.resumeJob(row.id) 201 sjsbTask.resumeJob(row.id)
202 .then((res) => { 202 .then((res) => {
203 if ((res.code = 200)) { 203 if ((res.code = 200)) {
204 this.$message({ 204 this.$message({
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
230 type: 'warning', 230 type: 'warning',
231 }) 231 })
232 .then(() => { 232 .then(() => {
233 system.sjsbTaskRun(row.id) 233 sjsbTask.sjsbTaskRun(row.id)
234 .then((res) => { 234 .then((res) => {
235 if ((res.code = 200)) { 235 if ((res.code = 200)) {
236 this.$alert(res.message, '提示', { 236 this.$alert(res.message, '提示', {
...@@ -265,7 +265,7 @@ export default { ...@@ -265,7 +265,7 @@ export default {
265 type: 'warning', 265 type: 'warning',
266 }) 266 })
267 .then(() => { 267 .then(() => {
268 system.sjsbTaskRemove(row.id) 268 sjsbTask.sjsbTaskRemove(row.id)
269 .then((res) => { 269 .then((res) => {
270 if ((res.code = 200)) { 270 if ((res.code = 200)) {
271 this.$message({ 271 this.$message({
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 <script> 28 <script>
29 // 定时任务 29 // 定时任务
30 import data from "./data" 30 import data from "./data"
31 import system from '@/api/system.js' 31 import sjsbTask from '@/api/sjsbTask.js'
32 import tableMixin from '@/mixins/tableMixin.js' 32 import tableMixin from '@/mixins/tableMixin.js'
33 import addTask from '../components/addTask.vue' 33 import addTask from '../components/addTask.vue'
34 export default { 34 export default {
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
114 try { 114 try {
115 this.form = Object.assign(this.form, this.formData) 115 this.form = Object.assign(this.form, this.formData)
116 let { result: { list, total, pages: pageSize, pageNum: current } 116 let { result: { list, total, pages: pageSize, pageNum: current }
117 } = await system.getTaskListByName(this.form) 117 } = await sjsbTask.getTaskListByName(this.form)
118 this.tableData.data = list 118 this.tableData.data = list
119 this.pageData = { 119 this.pageData = {
120 pageSize, 120 pageSize,
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
134 type: 'warning', 134 type: 'warning',
135 }) 135 })
136 .then(() => { 136 .then(() => {
137 system.pauseJob(row.id) 137 sjsbTask.pauseJob(row.id)
138 .then((res) => { 138 .then((res) => {
139 if ((res.code = 200)) { 139 if ((res.code = 200)) {
140 this.$message({ 140 this.$message({
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
166 type: 'warning', 166 type: 'warning',
167 }) 167 })
168 .then(() => { 168 .then(() => {
169 system.activateJob(row.id) 169 sjsbTask.activateJob(row.id)
170 .then((res) => { 170 .then((res) => {
171 if ((res.code = 200)) { 171 if ((res.code = 200)) {
172 this.$message({ 172 this.$message({
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
198 type: 'warning', 198 type: 'warning',
199 }) 199 })
200 .then(() => { 200 .then(() => {
201 system.resumeJob(row.id) 201 sjsbTask.resumeJob(row.id)
202 .then((res) => { 202 .then((res) => {
203 if ((res.code = 200)) { 203 if ((res.code = 200)) {
204 this.$message({ 204 this.$message({
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
230 type: 'warning', 230 type: 'warning',
231 }) 231 })
232 .then(() => { 232 .then(() => {
233 system.sjsbTaskRun(row.id) 233 sjsbTask.sjsbTaskRun(row.id)
234 .then((res) => { 234 .then((res) => {
235 if ((res.code = 200)) { 235 if ((res.code = 200)) {
236 this.$alert(res.message, '提示', { 236 this.$alert(res.message, '提示', {
...@@ -265,7 +265,7 @@ export default { ...@@ -265,7 +265,7 @@ export default {
265 type: 'warning', 265 type: 'warning',
266 }) 266 })
267 .then(() => { 267 .then(() => {
268 system.sjsbTaskRemove(row.id) 268 sjsbTask.sjsbTaskRemove(row.id)
269 .then((res) => { 269 .then((res) => {
270 if ((res.code = 200)) { 270 if ((res.code = 200)) {
271 this.$message({ 271 this.$message({
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 <script> 28 <script>
29 // 定时任务 29 // 定时任务
30 import data from "./data" 30 import data from "./data"
31 import system from '@/api/system.js' 31 import sjsbTask from '@/api/sjsbTask.js'
32 import tableMixin from '@/mixins/tableMixin.js' 32 import tableMixin from '@/mixins/tableMixin.js'
33 import addTask from '../components/addTask.vue' 33 import addTask from '../components/addTask.vue'
34 export default { 34 export default {
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
114 try { 114 try {
115 this.form = Object.assign(this.form, this.formData) 115 this.form = Object.assign(this.form, this.formData)
116 let { result: { list, total, pages: pageSize, pageNum: current } 116 let { result: { list, total, pages: pageSize, pageNum: current }
117 } = await system.getTaskListByName(this.form) 117 } = await sjsbTask.getTaskListByName(this.form)
118 this.tableData.data = list 118 this.tableData.data = list
119 this.pageData = { 119 this.pageData = {
120 pageSize, 120 pageSize,
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
134 type: 'warning', 134 type: 'warning',
135 }) 135 })
136 .then(() => { 136 .then(() => {
137 system.pauseJob(row.id) 137 sjsbTask.pauseJob(row.id)
138 .then((res) => { 138 .then((res) => {
139 if ((res.code = 200)) { 139 if ((res.code = 200)) {
140 this.$message({ 140 this.$message({
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
166 type: 'warning', 166 type: 'warning',
167 }) 167 })
168 .then(() => { 168 .then(() => {
169 system.activateJob(row.id) 169 sjsbTask.activateJob(row.id)
170 .then((res) => { 170 .then((res) => {
171 if ((res.code = 200)) { 171 if ((res.code = 200)) {
172 this.$message({ 172 this.$message({
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
198 type: 'warning', 198 type: 'warning',
199 }) 199 })
200 .then(() => { 200 .then(() => {
201 system.resumeJob(row.id) 201 sjsbTask.resumeJob(row.id)
202 .then((res) => { 202 .then((res) => {
203 if ((res.code = 200)) { 203 if ((res.code = 200)) {
204 this.$message({ 204 this.$message({
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
230 type: 'warning', 230 type: 'warning',
231 }) 231 })
232 .then(() => { 232 .then(() => {
233 system.sjsbTaskRun(row.id) 233 sjsbTask.sjsbTaskRun(row.id)
234 .then((res) => { 234 .then((res) => {
235 if ((res.code = 200)) { 235 if ((res.code = 200)) {
236 this.$alert(res.message, '提示', { 236 this.$alert(res.message, '提示', {
...@@ -265,7 +265,7 @@ export default { ...@@ -265,7 +265,7 @@ export default {
265 type: 'warning', 265 type: 'warning',
266 }) 266 })
267 .then(() => { 267 .then(() => {
268 system.sjsbTaskRemove(row.id) 268 sjsbTask.sjsbTaskRemove(row.id)
269 .then((res) => { 269 .then((res) => {
270 if ((res.code = 200)) { 270 if ((res.code = 200)) {
271 this.$message({ 271 this.$message({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 <script> 6 <script>
7 // 定时任务 7 // 定时任务
8 import data from "./data" 8 import data from "./data"
9 import system from '@/api/system.js' 9 import sjsbTask from '@/api/sjsbTask.js'
10 import tableMixin from '@/mixins/tableMixin.js' 10 import tableMixin from '@/mixins/tableMixin.js'
11 import addTask from '../components/addTask.vue' 11 import addTask from '../components/addTask.vue'
12 export default { 12 export default {
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
92 try { 92 try {
93 this.form = Object.assign(this.form, this.formData) 93 this.form = Object.assign(this.form, this.formData)
94 let { result: { list, total, pages: pageSize, pageNum: current } 94 let { result: { list, total, pages: pageSize, pageNum: current }
95 } = await system.getTaskListByName(this.form) 95 } = await sjsbTask.getTaskListByName(this.form)
96 this.tableData.data = list 96 this.tableData.data = list
97 this.pageData = { 97 this.pageData = {
98 pageSize, 98 pageSize,
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
112 type: 'warning', 112 type: 'warning',
113 }) 113 })
114 .then(() => { 114 .then(() => {
115 system.pauseJob(row.id) 115 sjsbTask.pauseJob(row.id)
116 .then((res) => { 116 .then((res) => {
117 if ((res.code = 200)) { 117 if ((res.code = 200)) {
118 this.$message({ 118 this.$message({
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
144 type: 'warning', 144 type: 'warning',
145 }) 145 })
146 .then(() => { 146 .then(() => {
147 system.activateJob(row.id) 147 sjsbTask.activateJob(row.id)
148 .then((res) => { 148 .then((res) => {
149 if ((res.code = 200)) { 149 if ((res.code = 200)) {
150 this.$message({ 150 this.$message({
...@@ -176,7 +176,7 @@ export default { ...@@ -176,7 +176,7 @@ export default {
176 type: 'warning', 176 type: 'warning',
177 }) 177 })
178 .then(() => { 178 .then(() => {
179 system.resumeJob(row.id) 179 sjsbTask.resumeJob(row.id)
180 .then((res) => { 180 .then((res) => {
181 if ((res.code = 200)) { 181 if ((res.code = 200)) {
182 this.$message({ 182 this.$message({
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
208 type: 'warning', 208 type: 'warning',
209 }) 209 })
210 .then(() => { 210 .then(() => {
211 system.sjsbTaskRun(row.id) 211 sjsbTask.sjsbTaskRun(row.id)
212 .then((res) => { 212 .then((res) => {
213 if ((res.code = 200)) { 213 if ((res.code = 200)) {
214 this.$alert(res.message, '提示', { 214 this.$alert(res.message, '提示', {
...@@ -243,7 +243,7 @@ export default { ...@@ -243,7 +243,7 @@ export default {
243 type: 'warning', 243 type: 'warning',
244 }) 244 })
245 .then(() => { 245 .then(() => {
246 system.sjsbTaskRemove(row.id) 246 sjsbTask.sjsbTaskRemove(row.id)
247 .then((res) => { 247 .then((res) => {
248 if ((res.code = 200)) { 248 if ((res.code = 200)) {
249 this.$message({ 249 this.$message({
......