diff --git a/src/utils/api.js b/src/utils/api.js index dd4e5e2..2df76e3 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -29,16 +29,7 @@ service.interceptors.response.use( hideLoading() const res = response.data if (res.code === 1) { - if (res.data !== null) { - if (res.data.returnData !== undefined && JSON.stringify(res.data.returnData) !== '{}') { - return res.data.returnData - } else { - return res.data - } - } - return null - } else if (res.returnCode === 1) { - return res.returnData + return res.data } else if (res.code === 20001) { Notification({ showClose: true, diff --git a/src/utils/apibjd.js b/src/utils/apibjd.js index e6ae09d..8090249 100644 --- a/src/utils/apibjd.js +++ b/src/utils/apibjd.js @@ -1,6 +1,5 @@ import axios from 'axios' import { Notification } from 'element-ui' -import store from '../store' import { showLoading, hideLoading } from './apiHelper' // 创建axios实例 const service = axios.create({ @@ -27,55 +26,8 @@ service.interceptors.response.use( response => { hideLoading() const res = response.data - if (res.returnCode === '1000') { - return res - } if (res.code === 1) { - if (res.data !== null) { - if (res.data.returnCode) { - if (res.data.returnCode === 1) { - return res.data.returnData - } else if (res.data.returnCode === '20011') { - Notification({ - showClose: true, - message: res.returnMsg, - type: 'error', - duration: 500, - onClose: () => { - store.dispatch('FedLogOut').then(() => { - location.reload()// 为了重新实例化vue-router对象 避免bug - }) - } - }) - return Promise.reject('未登录') - } else { - Notification({ - message: res.data.returnMsg || '请求处理异常,请稍后再试', - type: 'error', - duration: 3 * 1000 - }) - return Promise.reject(res) - } - } else { - return res.data - } - } - return null - } if (res.returnCode === 1) { - return res.returnData - } else if (res.returnCode === '20011') { - Notification({ - showClose: true, - message: res.returnMsg, - type: 'error', - duration: 500, - onClose: () => { - store.dispatch('FedLogOut').then(() => { - location.reload()// 为了重新实例化vue-router对象 避免bug - }) - } - }) - return Promise.reject('未登录') + return res.data } else { let msg = '' if (res.message) { @@ -85,9 +37,6 @@ service.interceptors.response.use( } else { msg = res.returnMsg } - if (res.data && res.data.constructor === String) { - msg = msg ? msg + ':' + res.data : res.data - } Notification({ message: msg, type: 'error', diff --git a/src/views/bjd/dj_list.vue b/src/views/bjd/dj_list.vue index c3742a1..4c74541 100644 --- a/src/views/bjd/dj_list.vue +++ b/src/views/bjd/dj_list.vue @@ -418,16 +418,7 @@ export default { return qs.stringify(params, { indices: false }) } }).then((data) => { - this.$message({ - message: - (data.bianhao !== null && data.bianhao !== undefined - ? '流水号为' + - data.bianhao + - '的项目关联的任务已经分配不能作废!' - : '') + - (data.count === 0 ? '' : data.count + '条项目作废成功'), - type: 'info' - }) + this.$notify.success('操作成功!') this.getList() }) }) diff --git a/src/views/bjd/dt_list.vue b/src/views/bjd/dt_list.vue index 8663f91..561fca9 100644 --- a/src/views/bjd/dt_list.vue +++ b/src/views/bjd/dt_list.vue @@ -272,16 +272,7 @@ export default { return qs.stringify(params, { indices: false }) } }).then((data) => { - this.$message({ - message: - (data.bianhao !== null && data.bianhao !== undefined - ? '流水号为' + - data.bianhao + - '的项目关联的任务已经分配不能作废!' - : '') + - (data.count === 0 ? '' : data.count + '条项目作废成功'), - type: 'info' - }) + this.$notify.success('操作成功!') this.getList() }) }) @@ -357,7 +348,7 @@ export default { editBjd($index) { const bjd = this.list[$index] let type = '/update' - if (bjd.bjState === '2') { + if (bjd.bjState === 2) { type = '/finish' } if (bjd.jianyanleibie === 'DJ') { @@ -466,7 +457,7 @@ export default { this.$message({ message: '只允许单台报检单收回', type: 'error' }) return false } - if (this.multipleSelection[0].bjState !== '2') { + if (this.multipleSelection[0].bjState !== 2) { this.$message({ message: '非审核通过数据不允许异常收回!', type: 'error' }) return false } diff --git a/src/views/bjd/jj_list.vue b/src/views/bjd/jj_list.vue index fb26905..e9ec88b 100644 --- a/src/views/bjd/jj_list.vue +++ b/src/views/bjd/jj_list.vue @@ -330,16 +330,7 @@ export default { return qs.stringify(params, { indices: false }) } }).then((data) => { - this.$message({ - message: - (data.bianhao !== null && data.bianhao !== undefined - ? '流水号为' + - data.bianhao + - '的项目关联的任务已经分配不能作废!' - : '') + - (data.count === 0 ? '' : data.count + '条项目作废成功'), - type: 'info' - }) + this.$notify.success('操作成功!') this.getList() }) }) diff --git a/src/views/bjd/qy_list.vue b/src/views/bjd/qy_list.vue index 423fae7..ca8dde3 100644 --- a/src/views/bjd/qy_list.vue +++ b/src/views/bjd/qy_list.vue @@ -250,17 +250,8 @@ export default { paramsSerializer: function(params) { return qs.stringify(params, { indices: false }) } - }).then((data) => { - this.$message({ - message: - (data.bianhao !== null && data.bianhao !== undefined - ? '流水号为' + - data.bianhao + - '的项目关联的任务已经分配不能作废!' - : '') + - (data.count === 0 ? '' : data.count + '条项目作废成功'), - type: 'info' - }) + }).then(() => { + this.$notify.success('操作成功!') this.getList() }) }) @@ -385,7 +376,7 @@ export default { this.$message({ message: '只允许单台报检单收回', type: 'error' }) return false } - if (this.multipleSelection[0].bjState !== '2') { + if (this.multipleSelection[0].bjState !== 2) { this.$message({ message: '非审核通过数据不允许异常收回!', type: 'error' }) return false }