diff --git a/src/api/infoApi.js b/src/api/infoApi.js index 93b5b1b..45eba25 100644 --- a/src/api/infoApi.js +++ b/src/api/infoApi.js @@ -119,7 +119,6 @@ const infoApi = { return postPBRequest('/driver', null, 54001) }, // 查询查询驱动下设备的可用模板列表 - // 查询驱动配置项 getTxTemplate(params) { return postPBRequest("/driver", params, 54011, params.driver_name); }, diff --git a/src/components/AddSet.vue b/src/components/AddSet.vue index 2d951af..26a6478 100644 --- a/src/components/AddSet.vue +++ b/src/components/AddSet.vue @@ -70,7 +70,6 @@ export default { driver_name: props.formData.name } const res = await infoApi.getTxTemplate(param); - if (res.code == 0) { // 获取数据 state.modelArr = []; @@ -84,7 +83,7 @@ export default { } state.addForm.template_name = state.modelArr[0].name; } else { - ElMessage.error(res.data || res.messgae); + ElMessage.error(res.data || res.message); } }; const closeDialog = () => { diff --git a/src/components/ViewSet.vue b/src/components/ViewSet.vue index 83ae594..8172dfa 100644 --- a/src/components/ViewSet.vue +++ b/src/components/ViewSet.vue @@ -79,6 +79,7 @@ export default { if (res.code == 0) { state.propertiesData = res.data || []; } else { + ElMessage.error(res.data || res.message); } }; const closeDialog = () => { diff --git a/src/utils/axios.js b/src/utils/axios.js index a869df9..7ac0991 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -35,21 +35,20 @@ axios.interceptors.response.use( } } } - if(res.config.headers['action'] == 53211) { // 导出文件 + if(!res.request || res.request.responseType === 'blob') { // 特殊情况处理,导出文件 return res; } - const ret = res.data; // token过期 - if (ret.code === 3004) { + if (res.data.code === 3004) { localRemove("token"); ElMessage.closeAll(); - ElMessage.error(ret.message || "Token异常,请重新登录"); + ElMessage.error(res.data.message || "Token异常,请重新登录"); router.push({ path: "/login" }); - return Promise.reject(ret); + return Promise.reject(res.data); } - return ret; + return Promise.resolve(res.data); }, (error) => { ElMessage.closeAll();