Skip to content

Commit 4d82fe6

Browse files
committed
patch🚑: 消息提示修改为服务端返回消息
1 parent fd4aba9 commit 4d82fe6

File tree

22 files changed

+256
-139
lines changed

22 files changed

+256
-139
lines changed

src/views/admin/dict/data.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export default {
300300
if (this.form.dictCode !== undefined) {
301301
updateData(this.form).then(response => {
302302
if (response.code === 200) {
303-
this.msgSuccess('修改成功')
303+
this.msgSuccess(response.msg)
304304
this.open = false
305305
this.getList()
306306
} else {
@@ -310,7 +310,7 @@ export default {
310310
} else {
311311
addData(this.form).then(response => {
312312
if (response.code === 200) {
313-
this.msgSuccess('新增成功')
313+
this.msgSuccess(response.msg)
314314
this.open = false
315315
this.getList()
316316
} else {
@@ -330,9 +330,14 @@ export default {
330330
type: 'warning'
331331
}).then(function() {
332332
return delData(dictCodes)
333-
}).then(() => {
334-
this.getList()
335-
this.msgSuccess('删除成功')
333+
}).then((response) => {
334+
if (response.code === 200) {
335+
this.msgSuccess(response.msg)
336+
this.open = false
337+
this.getList()
338+
} else {
339+
this.msgError(response.msg)
340+
}
336341
}).catch(function() {})
337342
},
338343
/** 导出按钮操作 */

src/views/admin/dict/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export default {
293293
if (this.form.id !== undefined) {
294294
updateType(this.form).then(response => {
295295
if (response.code === 200) {
296-
this.msgSuccess('修改成功')
296+
this.msgSuccess(response.msg)
297297
this.open = false
298298
this.getList()
299299
} else {
@@ -303,7 +303,7 @@ export default {
303303
} else {
304304
addType(this.form).then(response => {
305305
if (response.code === 200) {
306-
this.msgSuccess('新增成功')
306+
this.msgSuccess(response.msg)
307307
this.open = false
308308
this.getList()
309309
} else {

src/views/admin/sys-api/index.vue

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -272,21 +272,21 @@ export default {
272272
},
273273
methods: {
274274
handleClose(done) {
275-
if (this.loading) {
276-
return
277-
}
278-
this.$confirm('需要提交表单吗?')
279-
.then(_ => {
280-
this.loading = true
281-
this.timer = setTimeout(() => {
282-
done()
283-
// 动画关闭需要一定的时间
284-
setTimeout(() => {
285-
this.loading = false
286-
}, 400)
287-
}, 2000)
288-
})
289-
.catch(_ => {})
275+
// if (this.loading) {
276+
// return
277+
// }
278+
// this.$confirm('需要提交表单吗?')
279+
// .then(_ => {
280+
// this.loading = true
281+
// this.timer = setTimeout(() => {
282+
// done()
283+
// // 动画关闭需要一定的时间
284+
// setTimeout(() => {
285+
// this.loading = false
286+
// }, 400)
287+
// }, 2000)
288+
// })
289+
// .catch(_ => {})
290290
},
291291
/** 查询参数列表 */
292292
getList() {
@@ -382,7 +382,7 @@ export default {
382382
if (this.form.id !== undefined) {
383383
updateSysApi(this.form).then(response => {
384384
if (response.code === 200) {
385-
this.msgSuccess('修改成功')
385+
this.msgSuccess(response.msg)
386386
this.open = false
387387
this.getList()
388388
} else {
@@ -392,7 +392,7 @@ export default {
392392
} else {
393393
addSysApi(this.form).then(response => {
394394
if (response.code === 200) {
395-
this.msgSuccess('新增成功')
395+
this.msgSuccess(response.msg)
396396
this.open = false
397397
this.getList()
398398
} else {
@@ -413,11 +413,15 @@ export default {
413413
type: 'warning'
414414
}).then(function() {
415415
return delSysApi({ 'ids': Ids })
416-
}).then(() => {
417-
this.getList()
418-
this.msgSuccess('删除成功')
419-
}).catch(function() {
420-
})
416+
}).then((response) => {
417+
if (response.code === 200) {
418+
this.msgSuccess(response.msg)
419+
this.open = false
420+
this.getList()
421+
} else {
422+
this.msgError(response.msg)
423+
}
424+
}).catch(function() {})
421425
}
422426
}
423427
}

src/views/admin/sys-config/index.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export default {
369369
if (this.form.id !== undefined) {
370370
updateConfig(this.form).then(response => {
371371
if (response.code === 200) {
372-
this.msgSuccess('修改成功')
372+
this.msgSuccess(response.msg)
373373
this.open = false
374374
this.getList()
375375
} else {
@@ -379,7 +379,7 @@ export default {
379379
} else {
380380
addConfig(this.form).then(response => {
381381
if (response.code === 200) {
382-
this.msgSuccess('新增成功')
382+
this.msgSuccess(response.msg)
383383
this.open = false
384384
this.getList()
385385
} else {
@@ -399,9 +399,14 @@ export default {
399399
type: 'warning'
400400
}).then(function() {
401401
return delConfig({ 'ids': Ids })
402-
}).then(() => {
403-
this.getList()
404-
this.msgSuccess('删除成功')
402+
}).then((response) => {
403+
if (response.code === 200) {
404+
this.msgSuccess(response.msg)
405+
this.open = false
406+
this.getList()
407+
} else {
408+
this.msgError(response.msg)
409+
}
405410
}).catch(function() {})
406411
},
407412
/** 导出按钮操作 */

src/views/admin/sys-config/set.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export default {
290290
}
291291
updateSetConfig(list).then(response => {
292292
if (response.code === 200) {
293-
this.msgSuccess('修改成功')
293+
this.msgSuccess(response.msg)
294294
this.open = false
295295
this.getList()
296296
} else {

src/views/admin/sys-dept/index.vue

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export default {
312312
if (this.form.deptId !== undefined) {
313313
updateDept(this.form, this.form.deptId).then(response => {
314314
if (response.code === 200) {
315-
this.msgSuccess('修改成功')
315+
this.msgSuccess(response.msg)
316316
this.open = false
317317
this.getList()
318318
} else {
@@ -322,7 +322,7 @@ export default {
322322
} else {
323323
addDept(this.form).then(response => {
324324
if (response.code === 200) {
325-
this.msgSuccess('新增成功')
325+
this.msgSuccess(response.msg)
326326
this.open = false
327327
this.getList()
328328
} else {
@@ -346,12 +346,15 @@ export default {
346346
)
347347
.then(function() {
348348
return delDept(row.deptId)
349-
})
350-
.then(() => {
351-
this.getList()
352-
this.msgSuccess('删除成功')
353-
})
354-
.catch(function() {})
349+
}).then((response) => {
350+
if (response.code === 200) {
351+
this.msgSuccess(response.msg)
352+
this.open = false
353+
this.getList()
354+
} else {
355+
this.msgError(response.msg)
356+
}
357+
}).catch(function() {})
355358
}
356359
}
357360
}

src/views/admin/sys-login-log/index.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,15 @@ export default {
291291
type: 'warning'
292292
}).then(function() {
293293
return delSysLoginlog(Ids)
294-
}).then(() => {
295-
this.getList()
296-
this.msgSuccess('删除成功')
297-
}).catch(function() {
298-
})
294+
}).then((response) => {
295+
if (response.code === 200) {
296+
this.msgSuccess(response.msg)
297+
this.open = false
298+
this.getList()
299+
} else {
300+
this.msgError(response.msg)
301+
}
302+
}).catch(function() {})
299303
}
300304
}
301305
}

0 commit comments

Comments
 (0)