diff --git a/src/store/actions.js b/src/store/actions.js index af21461..387c7d3 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -1,8 +1,6 @@ export default { sethtnameAsync: (context, payload) => { - console.log('hhh'); setTimeout(() => { - console.log('hahha'); context.commit('sethtname', payload) }, 3000); console.log('lululu'); @@ -11,12 +9,7 @@ export default { //vuex是不能被vue实例的 let that = payload.that; let url = this.axios.urls.SYSTEM_USER_DOLOGIN; - console.log(url); that.axios.post(url, {}).then((res) => { - console.log('doAjax....'); - console.log(res); - }).catch((err) => { - console.log(err); - }) + }).catch((err) => {}) } } \ No newline at end of file diff --git a/src/utils/api.js b/src/utils/api.js index be943e1..b8e37a8 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,92 +1,77 @@ -let host = location.origin -const dev = process.env.NODE_ENV === 'development' // 本地 -// 科大接口切换,参数里带host的为科大,否则就是职站中台 -let isKd = /&host=(\d)/.exec(location.hash) //host:{1:测试环境,2:正式环境} -if(isKd){ - host = isKd[1] == 1 ? 'http://122.9.154.146' : 'http://116.63.168.79' -}else{ - let url = location.host; - // 职站中台接口切换 - if (url.includes('124.71.12.62')) { - host = 'http://124.71.12.62:9000'; // 巢湖版 - } else if (dev) { - host = 'http://121.37.12.51'; //线上 - // host = 'http://192.168.31.217:9000'; - } -} + let host1 = 'http://121.37.12.51:8080'; export default { // 交易类(流程类) - getAllBusiness: `${host}/judgment/judgment/lcRecord/getAllBusiness`, // 获取流程记录列表(树) - getProcess: `${host}/judgment/judgment/lcRecord/getProcess`, // 获取流程记录列表(树) - // getAllBusinessSt: `${host}/nakadai/nakadai/customsPass/checkpointList`, // 获取流程记录列表(树) - getProcessSt: `${host}/judgment/judgment/stRecord/getProcess`, // 获取流程记录列表(树) - getAllBusinessSt: `${host}/judgment/judgment/stRecord/getAllBusiness`, // 获取流程记录列表(树) - getSubjectInfoSt: `${host}/judgment/stSubject/getSubjectInfo`, // 根据题目id获取题目信息 - queryJudgmentPointDetailsSt: `${host}/judgment/judgment/lcJudgmentPoint/queryJudgmentPointDetailsBySt`, // 获取判分点详细信息 - getSubjectInfo: `${host}/judgment/judgment/lcSubject/getSubjectInfo`, // 根据题目id获取题目信息 - addJudgmentRule: `${host}/judgment/judgment/lcJudgmentRule/addJudgmentRule`, // 添加判分点规则 - updateJudgmentRule: `${host}/judgment/judgment/lcJudgmentRule/updateJudgmentRule`, // 添加判分点规则 - deleteJudgmentRule: `${host}/judgment/judgment/lcJudgmentRule/deleteJudgmentRule`, // 批量删除判分点规则 - addJudgmentPoint: `${host}/judgment/judgment/lcJudgmentPoint/addJudgmentPoint`, // 新增判分点 - updateJudgmentPoint: `${host}/judgment/judgment/lcJudgmentPoint/updateJudgmentPoint`, // 更新判分点 - deleteJudgmentPoint: `${host}/judgment/judgment/lcJudgmentPoint/deleteJudgmentPoint`, // 批量删除判分点 - calculate: `${host}/judgment/judgment/lcJudgmentPoint/calculate`, // 计算判分点规则 - updateIsOpen: `${host}/judgment/judgment/lcJudgmentPoint/updateIsOpen`, // 更新开启状态 - queryNameIsExist: `${host}/judgment/judgment/lcJudgmentPoint/queryNameIsExist`, // 新增/编辑判分点名称判重 - bandingProject: `${host}/judgment/judgment/lcJudgmentPoint/bandingProject`, // 绑定项目管理 - queryAllJudgmentPoint: `${host}/judgment/judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表 - queryJudgmentPointDetails: `${host}/judgment/judgment/lcJudgmentPoint/queryJudgmentPointDetails`, // 获取判分点详细信息 + getAllBusiness: `/judgment/judgment/lcRecord/getAllBusiness`, // 获取流程记录列表(树) + getProcess: `/judgment/judgment/lcRecord/getProcess`, // 获取流程记录列表(树) + checkpointList: `/nakadai/nakadai/customsPass/checkpointList`, // 获取流程记录列表(树) + getProcessSt: `/judgment/judgment/stRecord/getProcess`, // 获取流程记录列表(树) + getAllBusinessSt: `/judgment/judgment/stRecord/getAllBusiness`, // 获取流程记录列表(树) + getSubjectInfoSt: `/judgment/stSubject/getSubjectInfo`, // 根据题目id获取题目信息 + queryJudgmentPointDetailsSt: `/judgment/judgment/lcJudgmentPoint/queryJudgmentPointDetailsBySt`, // 获取判分点详细信息 + getSubjectInfo: `/judgment/judgment/lcSubject/getSubjectInfo`, // 根据题目id获取题目信息 + addJudgmentRule: `/judgment/judgment/lcJudgmentRule/addJudgmentRule`, // 添加判分点规则 + updateJudgmentRule: `/judgment/judgment/lcJudgmentRule/updateJudgmentRule`, // 添加判分点规则 + deleteJudgmentRule: `/judgment/judgment/lcJudgmentRule/deleteJudgmentRule`, // 批量删除判分点规则 + addJudgmentPoint: `/judgment/judgment/lcJudgmentPoint/addJudgmentPoint`, // 新增判分点 + updateJudgmentPoint: `/judgment/judgment/lcJudgmentPoint/updateJudgmentPoint`, // 更新判分点 + deleteJudgmentPoint: `/judgment/judgment/lcJudgmentPoint/deleteJudgmentPoint`, // 批量删除判分点 + calculate: `/judgment/judgment/lcJudgmentPoint/calculate`, // 计算判分点规则 + updateIsOpen: `/judgment/judgment/lcJudgmentPoint/updateIsOpen`, // 更新开启状态 + queryNameIsExist: `/judgment/judgment/lcJudgmentPoint/queryNameIsExist`, // 新增/编辑判分点名称判重 + bandingProject: `/judgment/judgment/lcJudgmentPoint/bandingProject`, // 绑定项目管理 + queryAllJudgmentPoint: `/judgment/judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表 + queryJudgmentPointDetails: `/judgment/judgment/lcJudgmentPoint/queryJudgmentPointDetails`, // 获取判分点详细信息 // 编程类 - getBcJudgmentPoint: `${host}/judgment/judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取判分点列表(分页) - queryBcJudgmentPointByBcId: `${host}/judgment/judgment/bcJudgmentPoint/queryBcJudgmentPointByBcId`, // 根据判分点id查询判分点详细信息 - queryBcJudgmentByBcId: `${host}/judgment/judgment/bcJudgmentPoint/queryBcJudgmentByBcId`, // 根据判分点id查询判分点信息(不带规则) - addBcJudgmentPoint: `${host}/judgment/judgment/bcJudgmentPoint/addBcJudgmentPoint`, // 添加判分点 - updateBcJudgmentPoint: `${host}/judgment/judgment/bcJudgmentPoint/updateBcJudgmentPoint`, // 更新判分点 - bcDeleteJudgmentPoint: `${host}/judgment/judgment/bcJudgmentPoint/deleteJudgmentPoint`, // 批量删除判分点 - bcQueryNameIsExist: `${host}/judgment/judgment/bcJudgmentPoint/queryNameIsExist`, // 新增/编辑判分点名称判重 - bcBandingProject: `${host}/judgment/judgment/bcJudgmentPoint/bcBandingProject`, // 绑定项目管理 - bcUpdateIsOpen: `${host}/judgment/judgment/bcJudgmentPoint/updateIsOpen`, // 更新开启状态 - bcAddJudgmentRule: `${host}/judgment/judgment/bcJudgmentRule/addJudgmentRule`, // 添加判分点规则 - bcUpdateJudgmentRule: `${host}/judgment/judgment/bcJudgmentRule/updateJudgmentRule`, // 更新判分点规则 - bcDeleteJudgmentRule: `${host}/judgment/judgment/bcJudgmentRule/deleteJudgmentRule`, // 批量删除判分点规则 + getBcJudgmentPoint: `/judgment/judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取判分点列表(分页) + queryBcJudgmentPointByBcId: `/judgment/judgment/bcJudgmentPoint/queryBcJudgmentPointByBcId`, // 根据判分点id查询判分点详细信息 + queryBcJudgmentByBcId: `/judgment/judgment/bcJudgmentPoint/queryBcJudgmentByBcId`, // 根据判分点id查询判分点信息(不带规则) + addBcJudgmentPoint: `/judgment/judgment/bcJudgmentPoint/addBcJudgmentPoint`, // 添加判分点 + updateBcJudgmentPoint: `/judgment/judgment/bcJudgmentPoint/updateBcJudgmentPoint`, // 更新判分点 + bcDeleteJudgmentPoint: `/judgment/judgment/bcJudgmentPoint/deleteJudgmentPoint`, // 批量删除判分点 + bcQueryNameIsExist: `/judgment/judgment/bcJudgmentPoint/queryNameIsExist`, // 新增/编辑判分点名称判重 + bcBandingProject: `/judgment/judgment/bcJudgmentPoint/bcBandingProject`, // 绑定项目管理 + bcUpdateIsOpen: `/judgment/judgment/bcJudgmentPoint/updateIsOpen`, // 更新开启状态 + bcAddJudgmentRule: `/judgment/judgment/bcJudgmentRule/addJudgmentRule`, // 添加判分点规则 + bcUpdateJudgmentRule: `/judgment/judgment/bcJudgmentRule/updateJudgmentRule`, // 更新判分点规则 + bcDeleteJudgmentRule: `/judgment/judgment/bcJudgmentRule/deleteJudgmentRule`, // 批量删除判分点规则 // 职站 - QueryPointOfJudgement: `${host}/judgment/judgment/pointOfJudgement/queryPointOfJudgement`, //判分点列表查询 - DeletePointOfJudgement: `${host}/judgment/judgment/pointOfJudgement/deletePointOfJudgement`, //判分点列表删除 - QueryPfdInformation: `${host}/judgment/judgment/pointOfJudgement/queryPfdInformation`, //判分点详细信息 - UpdatePointOfJudgement: `${host}/judgment/judgment/pointOfJudgement/updatePointOfJudgement`, //编辑判分点基本信息 - UpdatePointOfJudgementRule: `${host}/judgment/judgment/pointOfJudgement/updatePointOfJudgementRule`, //编辑判分点规则 - AddPfdgzInformation: `${host}/judgment/judgment/pointOfJudgement/addPfdgzInformation`, //新增判分规则 - AddPfdInformation: `${host}/judgment/judgment/pointOfJudgement/addPfdInformation`, //新增判分点基本信息 - QueryPfdgzInformation: `${host}/judgment/judgment/pointOfJudgement/queryPfdgzInformation`, //判分点规则信息查询 - QueryAddgz: `${host}/judgment/judgment/pointOfJudgement/queryAddgz`, //查询新增判分点规则新增的数据 - DeletePointOfJudgementRule: `${host}/judgment/judgment/pointOfJudgement/deletePointOfJudgementRule`, //删除判分点规则 - JudgmentPointNameRepetition: `${host}/judgment/judgment/pointOfJudgement/JudgmentPointNameRepetition`, + QueryPointOfJudgement: `/judgment/judgment/pointOfJudgement/queryPointOfJudgement`, //判分点列表查询 + DeletePointOfJudgement: `/judgment/judgment/pointOfJudgement/deletePointOfJudgement`, //判分点列表删除 + QueryPfdInformation: `/judgment/judgment/pointOfJudgement/queryPfdInformation`, //判分点详细信息 + UpdatePointOfJudgement: `/judgment/judgment/pointOfJudgement/updatePointOfJudgement`, //编辑判分点基本信息 + UpdatePointOfJudgementRule: `/judgment/judgment/pointOfJudgement/updatePointOfJudgementRule`, //编辑判分点规则 + AddPfdgzInformation: `/judgment/judgment/pointOfJudgement/addPfdgzInformation`, //新增判分规则 + AddPfdInformation: `/judgment/judgment/pointOfJudgement/addPfdInformation`, //新增判分点基本信息 + QueryPfdgzInformation: `/judgment/judgment/pointOfJudgement/queryPfdgzInformation`, //判分点规则信息查询 + QueryAddgz: `/judgment/judgment/pointOfJudgement/queryAddgz`, //查询新增判分点规则新增的数据 + DeletePointOfJudgementRule: `/judgment/judgment/pointOfJudgement/deletePointOfJudgementRule`, //删除判分点规则 + JudgmentPointNameRepetition: `/judgment/judgment/pointOfJudgement/JudgmentPointNameRepetition`, - UpdateIsOpen: `${host}/judgment/judgment/pointOfJudgement/updateIsOpen`, //修改判分点状态 - queryUserIds:`${host}/liuwanr/userInfo/queryUserIds`, + UpdateIsOpen: `/judgment/judgment/pointOfJudgement/updateIsOpen`, //修改判分点状态 + queryUserIds:`/liuwanr/userInfo/queryUserIds`, // 科大子系统 - queryPoint: `${host}/kdSys/queryPoint`, - querySubject: `${host}/kdSys/querySubject`, - queryItem: `${host}/kdSys/queryItem`, + queryPoint: `/kdSys/queryPoint`, + querySubject: `/kdSys/querySubject`, + queryItem: `/kdSys/queryItem`, // 科大平台 - queryListTrading: `${host}/judgment/judgment/tradingJudgmentPoints/query`, - deleteTrading: `${host}/judgment/judgment/tradingJudgmentPoints/delete`, - addTrading: `${host}/judgment/judgment/tradingJudgmentPoints/add`, - queryDetailsTrading: `${host}/judgment/judgment/tradingJudgmentPoints/queryDetails`, - updateTrading: `${host}/judgment/judgment/tradingJudgmentPoints/update`, - updateRuleTrading: `${host}/judgment/judgment/tradingJudgmentPoints/updateRule`, - deleteRuleTrading: `${host}/judgment/judgment/tradingJudgmentPoints/deleteRule`, - addRule: `${host}/judgment/judgment/tradingJudgmentPoints/addRule`, + queryListTrading: `/judgment/judgment/tradingJudgmentPoints/query`, + deleteTrading: `/judgment/judgment/tradingJudgmentPoints/delete`, + addTrading: `/judgment/judgment/tradingJudgmentPoints/add`, + queryDetailsTrading: `/judgment/judgment/tradingJudgmentPoints/queryDetails`, + updateTrading: `/judgment/judgment/tradingJudgmentPoints/update`, + updateRuleTrading: `/judgment/judgment/tradingJudgmentPoints/updateRule`, + deleteRuleTrading: `/judgment/judgment/tradingJudgmentPoints/deleteRule`, + addRule: `/judgment/judgment/tradingJudgmentPoints/addRule`, // 川大子系统 firstLevel: `${host1}/sichuan/point/firstLevel`, diff --git a/src/utils/http.js b/src/utils/http.js index 967fbc6..ef4d4f2 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -5,23 +5,36 @@ import { Message } from 'element-ui' import router from '../router/index' import store from '@/store' -// 环境的切换 -// if (process.env.NODE_ENV == 'development') { -// axios.defaults.baseURL = '/api'; -// } else if (process.env.NODE_ENV == 'debug') { -// axios.defaults.baseURL = ''; -// } else if (process.env.NODE_ENV == 'production') { -// axios.defaults.baseURL = 'http://api.123dailu.com/'; -// } +let host = location.origin +const dev = process.env.NODE_ENV === 'development' // 本地 +// 科大接口切换,参数里带host的为科大,否则就是职站中台 +let isKd = /&host=(\d)/.exec(location.hash) //host:{1:测试环境,2:正式环境} +if(isKd){ + host = isKd[1] == 1 ? 'http://122.9.154.146' : 'http://116.63.168.79' +}else{ + let url = location.host; + // 职站中台接口切换 + if (url.includes('124.71.12.62')) { + host = 'http://124.71.12.62:9000'; // 巢湖版 + } else if (dev) { + host = 'http://121.37.12.51'; + host = 'http://192.168.31.217:9000'; + } +} + +const service = axios.create({ + baseURL: host, + timeout: 10000000 +}); // 请求超时时间 -axios.defaults.timeout = 1000000000; +service.defaults.timeout = 1000000000; // post请求头 -axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; +service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; // 请求拦截器 -axios.interceptors.request.use(config => { +service.interceptors.request.use(config => { // if (sessionStorage.getItem('token')) { // 存在将token写入 request header config.headers.token = store.state.token @@ -37,69 +50,57 @@ axios.interceptors.request.use(config => { return Promise.reject(err); }) -// 响应拦截器 -// axios.interceptors.response.use( -// response => { -// consol.log(response.status) -// if (response.status === 200) { -// return Promise.resolve(response); -// } else { -// return Promise.reject(response); -// } -// }, -// // 服务器状态码不是200的情况 -// error => { -// if (error.response.status) { -// switch (error.response.status) { -// // 401: 未登录 -// // 未登录则跳转登录页面,并携带当前页面的路径 -// // 在登录成功后返回当前页面,这一步需要在登录页操作。 -// case 500: -// router.replace({ -// path: '/login', -// // query: { redirect: router.currentRoute.fullPath } -// }); -// break; -// // 403 token过期 -// // 登录过期对用户进行提示 -// // 清除本地token和清空vuex中token对象 -// // 跳转登录页面 -// case 403: -// // Toast({ -// // message: '登录过期,请重新登录', -// // duration: 1000, -// // forbidClick: true -// // }); -// // 清除token -// sessionStorage.removeItem('token'); -// store.commit('loginSuccess', null); -// // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面 -// setTimeout(() => { -// router.replace({ -// path: '/login', -// query: { -// redirect: router.currentRoute.fullPath -// } -// }); -// }, 1000); -// break; -// // 404请求不存在 -// case 404: -// router.replace({ -// path: '/404', -// }); -// break; -// // 其他错误,直接抛出错误提示 -// default: -// router.replace({ -// path: '/500', -// }); -// } -// return Promise.reject(error.response); -// } -// } -// ); - + service.interceptors.response.use( + response => { + const res = response.data; + if (res.status == 200 || res.status == 10000 || res.status == 30001) { + return Promise.resolve(res).catch(e => {}); + } else if (!res.status) { + return Promise.resolve(res).catch(e => {}); + } else { + Message.error(res.message); + return Promise.reject(res) + // return Promise.resolve(res).catch(e => {}); + } + }, + // 服务器状态码不是200的情况 + error => { + if (error.response.status) { + switch (error.response.status) { + // 401: 未登录 + // 未登录则跳转登录页面,并携带当前页面的路径 + // 在登录成功后返回当前页面,这一步需要在登录页操作。 + case 401: + Message.error("登录过期,请重新登录"); + setTimeout(logouts,1500) + break; + case 500: + Message.error("网络错误"); + break; + // 403 token过期 + // 登录过期对用户进行提示 + // 清除本地token和清空vuex中token对象 + // 跳转登录页面 + case 403: + Message.error("登录过期,请重新登录"); + // 清除token + // store.commit('loginSuccess', null); + // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面 + setTimeout(logouts,1500) + break; + // 404请求不存在 + case 404: + Message.error("网络请求不存在!"); + break; + // 其他错误,直接抛出错误提示 + default: + Message.error(error.response.data.message); + Promise.reject(res); + } + return Promise.reject(error.response); + } + } +); function logouts(){ let referrer = store.state.referrer @@ -111,262 +112,47 @@ let tokenStatus = { 0: '用户未登录,请登录后操作!', 1: 'token错误,请重新登录!' } -/** - * get方法,对应get请求 - */ -export function get(url, params){ - return new Promise((resolve, reject) =>{ - axios.get(url, { - params: params - }) - .then(res => { - if(typeof res.data == 'number'){ - this.$message.error(tokenStatus[res.data]) - setTimeout(logouts,1500) - return false - } - if (res.data.status) { - switch (res.data.status) { - case 200: - resolve(res.data); - break; - case 10000: - resolve(res.data); - break; - case 500: - this.$message.error( - res.data.errmessage || res.data.message - ); - break; - case 404: - this.$message.error( - res.data.errmessage - ); - break; - case 403: - this.$message.error( - res.data.errmessage - ); - break; - case 401: - Message.error("token失效,请重新登录"); - sessionStorage.removeItem('token'); - router.replace('/login') - break; - case 405: - this.$message.error( - res.data.errmessage - ); - break; - case 406: - this.$message.error( - res.data.errmessage - ); - reject(res.data) - break; - } - } - - }) - .catch(err => { - reject(err.data) - this.$message({ - showClose: true, - message: '请求失败,请刷新页面重新进行请求', - type: 'error' - }); - }) - }); + +function get(url, params) { + return new Promise((resolve, reject) => { + service.get(url, { params: params }).then(res => { + resolve(res); + }).catch(err => { + reject(err); + }); + }); } -/** - * post方法,对应post请求 - */ -export function post(url, params) { - return new Promise((resolve, reject) => { - axios.post(url,params) - .then(res => { - if(typeof res.data == 'number'){ - this.$message.error(tokenStatus[res.data]) - setTimeout(logouts,1500) - return false - } - if (res.data.status) { - switch (res.data.status) { - case 200: - resolve(res.data); - break; - case 500: - resolve(res.data); - // this.$message.error(res.data.errmessage || res.data.message); - break; - case 404: - this.$message.error( - res.data.errmessage - ); - break; - case 403: - this.$message.error( - res.data.errmessage - ); - break; - case 401: - Message.error("token失效,请重新登录"); - sessionStorage.removeItem('token'); - router.replace('/login') - break; - case 405: - this.$message.error( - res.data.errmessage - ); - break; - case 406: - this.$message.error( - res.data.errmessage - ); - break; - } - } else { - resolve(res.data) - } - }) - .catch(err => { - reject(err.data) - this.$message({ - showClose: true, - message: '请求失败,请刷新页面重新进行请求', - type: 'error' - }); - }) - }); + +function post(url, params) { + return new Promise((resolve, reject) => { + service.post(url, params).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); + }); } -/** - * delete方法,对应delete请求 - */ - export function del(url, params){ - return new Promise((resolve, reject) =>{ - axios.delete(url, { - params: params - }) - .then(res => { - if(typeof res.data == 'number'){ - this.$message.error(tokenStatus[res.data]) - setTimeout(logouts,1500) - return false - } - if (res.data.status) { - switch (res.data.status) { - case 200: - resolve(res.data); - break; - case 500: - this.$message.error( - res.data.errmessage - ); - break; - case 404: - this.$message.error( - res.data.errmessage - ); - router.replace({ - path: '/404', - }); - break; - case 403: - this.$message.error( - res.data.errmessage - ); - break; - case 401: - Message.error("token失效,请重新登录"); - sessionStorage.removeItem('token'); - router.replace('/login') - break; - case 405: - this.$message.error( - res.data.errmessage - ); - break; - case 406: - this.$message.error( - res.data.errmessage - ); - break; - } - } - - }) - .catch(err => { - reject(err.data) - this.$message({ - showClose: true, - message: '请求失败,请刷新页面重新进行请求', - type: 'error' - }); - }) - }); +function del(url, params) { + return new Promise((resolve, reject) => { + service.delete(url, { + params + }).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); + }); } -/** - * put修改 - * @param {} url - * @param {*} params - */ -export function put(url, params){ - return new Promise((resolve, reject) =>{ - axios.put(url, params) - .then(res => { - if(typeof res.data == 'number'){ - this.$message.error(tokenStatus[res.data]) - setTimeout(logouts,1500) - return false - } - if (res.data.status) { - switch (res.data.status) { - case 200: - resolve(res.data); - break; - case 500: - this.$message.error( - res.data.errmessage - ); - break; - case 404: - this.$message.error( - res.data.errmessage - ); - break; - case 403: - this.$message.error( - res.data.errmessage - ); - break; - case 401: - Message.error("token失效,请重新登录"); - sessionStorage.removeItem('token'); - router.replace('/login') - break; - case 405: - this.$message.error( - res.data.errmessage - ); - break; - case 406: - this.$message.error( - res.data.errmessage - ); - break; - } - } - - }) - .catch(err => { - reject(err.data) - this.$message({ - showClose: true, - message: '请求失败,请刷新页面重新进行请求', - type: 'error' - }); - }) - }); -} \ No newline at end of file +function put(url, params) { + return new Promise((resolve, reject) => { + service.put(url, params).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); + }); +} + +export { get, post, del, put }; \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index b61f5c8..642e886 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -334,6 +334,7 @@ export default { this.$message.error(res.message); } }).catch(err => { + row.isOpen = row.isOpen ? 0 : 1 console.log(err); }); } else { diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index 42702e4..99b4b0d 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -660,20 +660,25 @@ export default { }, // 获取业务 getBusiness () { - // if (this.isSt) { - // this.$post(this.api.getAllBusinessSt, { - // platformId: 3, - // }).then(({ data }) => { - // this.businessList = data - // }).catch(res => { }) - // } else { - // this.$post(`${this.api.getAllBusiness}?systemId=${this.systemId}`).then(({ stRecords, lcRecords }) => { - // this.businessList = this.isSt ? stRecords : lcRecords - // }).catch(res => { }) - // } - this.$post(`${this.api[this.isSt ? 'getAllBusinessSt' : 'getAllBusiness']}?systemId=${this.systemId}`).then(({ stRecords, lcRecords }) => { - this.businessList = this.isSt ? stRecords : lcRecords - }).catch(res => { }) + if (this.isSt) { + this.$post(this.api.checkpointList, { + platformId: 3, + isEnable: 1 + }).then(({ data }) => { + data.forEach(e => { + e.name = e.customsPassName + e.id = e.checkpointId + }) + this.businessList = data + }).catch(res => { }) + } else { + this.$post(`${this.api.getAllBusiness}?systemId=${this.systemId}`).then(({ stRecords, lcRecords }) => { + this.businessList = lcRecords + }).catch(res => { }) + } + // this.$post(`${this.api[this.isSt ? 'getAllBusinessSt' : 'getAllBusiness']}?systemId=${this.systemId}`).then(({ stRecords, lcRecords }) => { + // this.businessList = this.isSt ? stRecords : lcRecords + // }).catch(res => { }) }, handleSelectionChange (val) { this.multipleSelection = val @@ -777,9 +782,9 @@ export default { const temp = item.emptyTwo.split('~') if (temp.length) { const symbol = temp[0].match(/[<>=]+/g) - const num = temp[0].match(/[\d.]+/g) + const num = temp[0].match(/[^<>=]+/g) const symbol1 = temp.length > 1 ? temp[1].match(/[<>=]+/g) : '' - const num1 = temp.length > 1 ? temp[1].match(/[\d.]+/g) : '' + const num1 = temp.length > 1 ? temp[1].match(/[^<>=]+/g) : '' obj.value2 = symbol ? symbol[0] : '' obj.value3 = num ? num[0] : '' obj.value4 = num1 ? num1[0] : '' @@ -841,9 +846,9 @@ export default { const temp = item.emptyTwo.split('~') if (temp.length) { const symbol = temp[0].match(/[<>=]+/g) - const num = temp[0].match(/[\d.]+/g) + const num = temp[0].match(/[^<>=]+/g) const symbol1 = temp.length > 1 ? temp[1].match(/[<>=]+/g) : '' - const num1 = temp.length > 1 ? temp[1].match(/[\d.]+/g) : '' + const num1 = temp.length > 1 ? temp[1].match(/[^<>=]+/g) : '' obj.value2 = symbol ? symbol[0] : '' obj.value3 = num ? num[0] : '' obj.value4 = num1 ? num1[0] : ''