diff --git a/src/utils/api.js b/src/utils/api.js index b8e37a8..27b75bb 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,80 +1,83 @@ let host1 = 'http://121.37.12.51:8080'; export default { - // 交易类(流程类) - 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`, // 获取判分点详细信息 + // 交易类(流程类) + 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`, // 获取判分点详细信息 + copyJudgmentPoint: `/judgment/judgment/lcJudgmentPoint/copyJudgmentPoint`, + obtainTheCopyInformationAndEdit: `/judgment/judgment/lcJudgmentPoint/obtainTheCopyInformationAndEdit`, + obtainPreReplicationInformation: `/judgment/judgment/lcJudgmentPoint/obtainPreReplicationInformation`, - // 编程类 - 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`, // 批量删除判分点规则 + // 编程类 + 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: `/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`, + // 职站 + 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: `/judgment/judgment/pointOfJudgement/updateIsOpen`, //修改判分点状态 - queryUserIds:`/liuwanr/userInfo/queryUserIds`, + UpdateIsOpen: `/judgment/judgment/pointOfJudgement/updateIsOpen`, //修改判分点状态 + queryUserIds: `/liuwanr/userInfo/queryUserIds`, - // 科大子系统 - queryPoint: `/kdSys/queryPoint`, - querySubject: `/kdSys/querySubject`, - queryItem: `/kdSys/queryItem`, + // 科大子系统 + queryPoint: `/kdSys/queryPoint`, + querySubject: `/kdSys/querySubject`, + queryItem: `/kdSys/queryItem`, - // 科大平台 - 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`, + // 科大平台 + 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`, - secondaryLevel: `${host1}/sichuan/point/secondaryLevel`, - thirdLevel: `${host1}/sichuan/point/thirdLevel`, + // 川大子系统 + firstLevel: `${host1}/sichuan/point/firstLevel`, + secondaryLevel: `${host1}/sichuan/point/secondaryLevel`, + thirdLevel: `${host1}/sichuan/point/thirdLevel`, } \ No newline at end of file diff --git a/src/utils/http.js b/src/utils/http.js index 6da8171..e762c5a 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -7,22 +7,22 @@ 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.51:9000'; - } +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 + baseURL: host, + timeout: 10000000 }); // 请求超时时间 @@ -34,125 +34,125 @@ service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8' let logouted = 0; // 请求拦截器 service.interceptors.request.use(config => { - // 存在将token写入 request header - const { token } = router.currentRoute.query - config.headers.token = token ? atob(decodeURI(token)) : localStorage.getItem('token') - return config; - }, err => { - Message.error({ - message: '退出登陆', - onClose: function () { - router.push({name: 'login'}); - } - }) - return Promise.reject(err); + // 存在将token写入 request header + const { token } = router.currentRoute.query + config.headers.token = token ? atob(decodeURI(token)) : localStorage.getItem('token') + return config; +}, err => { + Message.error({ + message: '退出登陆', + onClose: function () { + router.push({ name: 'login' }); + } }) + return Promise.reject(err); +}) - 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: - if (!logouted) { - Message.error("登录过期,请重新登录"); - setTimeout(logouts,1500) - logouted = 1 - } - 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); - } +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: + if (!logouted) { + Message.error("登录过期,请重新登录"); + setTimeout(logouts, 1500) + logouted = 1 + } + 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 - store.replaceState({}) - if (referrer) { - location.href = referrer - } else { - window.history.back() - } +function logouts () { + let referrer = store.state.referrer + store.replaceState({}) + if (referrer) { + location.href = referrer + } else { + window.history.back() + } } -function get(url, params) { - return new Promise((resolve, reject) => { - service.get(url, { params: params }).then(res => { - resolve(res); - }).catch(err => { - reject(err); - }); - }); +function get (url, params) { + return new Promise((resolve, reject) => { + service.get(url, { params: params }).then(res => { + resolve(res); + }).catch(err => { + reject(err); + }); + }); } -function post(url, params) { - return new Promise((resolve, reject) => { - service.post(url, params).then(res => { - resolve(res); - }).catch(err => { - reject(err.data); - }); - }); +function post (url, params) { + return new Promise((resolve, reject) => { + service.post(url, params).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); + }); } -function del(url, params) { - return new Promise((resolve, reject) => { - service.delete(url, { - params - }).then(res => { - resolve(res); - }).catch(err => { - reject(err.data); - }); - }); +function del (url, params) { + return new Promise((resolve, reject) => { + service.delete(url, { + params + }).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); + }); } -function put(url, params) { - return new Promise((resolve, reject) => { - service.put(url, params).then(res => { - resolve(res); - }).catch(err => { - reject(err.data); - }); - }); +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 0c48062..8db9f41 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,9 +1,7 @@ @@ -122,6 +108,15 @@ export default { systemName: this.$route.query.systemName, isProcess: false, // 是否是流程类 multipleSelection: [], + curRow: {}, + copyVisible: false, + checkpoints: [], + form: { + name: '', + checkpointId: '', + }, + beforeCopying: false, + copying: false, }; }, components: { quill }, @@ -143,11 +138,9 @@ export default { } this.initData(); + this.getCheckpoint() }, methods: { - BackMain () { // 返回 - history.back() - }, handleCurrentChange (val) { // 切换页码 this.pageNum = val; this.initData(); @@ -275,6 +268,77 @@ export default { this.$router.push(`program?isAdd=true&systemId=${this.systemId}`); } }, + // 批量复制 + batchCopy () { + if (this.multipleSelection.length) { + this.form = { + name: '', + checkpointId: '', + } + this.curRow = null + this.copyVisible = true + } else { + this.$message.warning("请先选择数据 !"); + } + }, + // 复制 + async copy (row) { + this.curRow = row + this.copyVisible = true + this.beforeCopying = true + // 查询应该显示的判分点名称 + const res = await this.$post(this.api.obtainPreReplicationInformation, { + lcId: row.lcId + }) + + this.beforeCopying = false + this.form = { + name: res.newName || '', + checkpointId: +res.checkpointId || '', + } + }, + // 复制提交 + async copySubmit () { + const { name, checkpointId } = this.form + const list = this.multipleSelection + if (!list.length && !name) return this.$message.warning('请输入判分点名称') + if (!checkpointId) return this.$message.warning('请选择关联关卡') + try { + this.copying = true + if (list.length) { + // 批量复制 + await this.$post(this.api.copyJudgmentPoint, { + checkpointId, + lcIds: list.map(e => e.lcId) + }) + } else { + // 单个复制 + await this.$post(this.api.obtainTheCopyInformationAndEdit, { + name, + checkpointId, + lcId: this.curRow.lcId, + }) + } + this.copying = false + this.initData() + this.$message.success('复制成功!') + this.copyVisible = false + } catch (e) { + this.copying = false + } + }, + // 获取业务 + async getCheckpoint () { + const { data } = await this.$post(this.api.checkpointList, { + platformId: 3, + isEnable: 1 + }) + data.forEach(e => { + e.name = e.customsPassName + e.id = e.checkpointId + }) + this.checkpoints = data + }, handleEdit (row) { // 编辑 if (this.isProcess) { // 交易类 @@ -358,6 +422,9 @@ export default { rowClass () { return "text-align: center;"; }, + back () { + history.back() + }, } }; @@ -495,6 +562,7 @@ export default { border-radius: 20px; float: right; } + .button:focus { outline: 0; } diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index 7fb198d..5881d23 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -1,23 +1,15 @@