diff --git a/src/utils/request.js b/src/utils/request.js index b31cf8b33..951a48452 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -6,6 +6,7 @@ import { MessageBox } from 'element-ui'; import { getToken } from '@/utils/auth'; import { getBaseUrl } from '@/utils/baseUrl'; import { EventBus } from '@/scripts/event-bus'; +import Vue from 'vue'; const BASE_API = getBaseUrl(); @@ -61,8 +62,15 @@ service.interceptors.response.use( }); }); }); + } else { + Vue.prototype.$alert('服务异常: ' + res.message + '', '请求结果', { + confirmButtonText: '确定', + dangerouslyUseHTMLString: true, + closeOnClickModal: false + }).then(() => { + return Promise.reject(res); + }); } - return Promise.reject(res); } else { return response.data; } diff --git a/src/views/planMonitor/editTool/menus/createEmptyPlan.vue b/src/views/planMonitor/editTool/menus/createEmptyPlan.vue index fd3017917..6413edccf 100644 --- a/src/views/planMonitor/editTool/menus/createEmptyPlan.vue +++ b/src/views/planMonitor/editTool/menus/createEmptyPlan.vue @@ -227,9 +227,11 @@ export default { } else { importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => { that.loadingDig.close(); - that.$message.success(that.$t('tip.importOperationGraphSuccessfully')); - that.$emit('refresh'); + if (response && response.code == 200) { + that.$message.success(that.$t('tip.importOperationGraphSuccessfully')); + that.$emit('refresh'); // this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} }); + } }).catch(error => { that.loadingDig.close(); that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);