diff --git a/src/main.js b/src/main.js index e192d77..be23fcb 100644 --- a/src/main.js +++ b/src/main.js @@ -62,7 +62,7 @@ if(window.top !== window.self) { // 当前页面在iframe中 window._IN_IFRAME = true; Vue.config.errorHandler = (err, vm, info) => { - parent?._addError(err.message, err.stack) + top?._addError(err.message, err.stack) console.error(err) } } diff --git a/src/utils/request.js b/src/utils/request.js index d3c37f1..06aeb9b 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -42,7 +42,7 @@ service.interceptors.request.use( error => { // do something with request error console.log(error) // for debug - parent?._addError(error, 'axios-request', error.config.params||error.config.data) + top?._addError(error, 'axios-request', error.config.params||error.config.data) return Promise.reject(error) } ) @@ -88,11 +88,11 @@ service.interceptors.response.use( location.reload() }) if (window._IN_IFRAME) { - parent?._logout() + top?._logout() } }) } - parent?._addError(res.msg, `axios-response ${response.config.url}`, response.config.params || response.config.data) + top?._addError(res.msg, `axios-response ${response.config.url}`, response.config.params || response.config.data) return Promise.reject(new Error(res.msg || 'Error')) } else { return res.data @@ -106,7 +106,7 @@ service.interceptors.response.use( type: 'error', duration: 5 * 1000 }) - parent?._addError(error.toString(), `axios-request ${error.config.url}`, error.config.params || error.config.data) + top?._addError(error.toString(), `axios-request ${error.config.url}`, error.config.params || error.config.data) return Promise.reject(error) } ) diff --git a/src/views/away/index.vue b/src/views/away/index.vue index 335a5f8..c158d67 100644 --- a/src/views/away/index.vue +++ b/src/views/away/index.vue @@ -146,7 +146,7 @@ @@ -316,6 +304,7 @@ import paymentRegistration from "./components/paymentRegistration"; import contractSign from "@/views/contract/components/contractSign"; import contractPaymentRegistration from "@/views/contract/components/contractPaymentRegistration"; import pieChart from '@/views/dashboard/components/PieChart.vue' +import {getToken} from "@/utils/auth"; export default { components: { pieChart, @@ -337,9 +326,25 @@ export default { } }; return { + isShowOaModal: false, + oaUrl: '', + flowStatus: new Map([ + [2, "待申请"], + [-1, "已退回"], + [-2, "-"], + [0, "流转中"], + [1, "已办结"] + ]), + flowStatusColor: new Map([ + [-2, "rgb(140, 140, 140)"], + [-1, "#dca550"], + [2, "rgb(96, 109, 241)"], + [0, "rgb(219, 122, 122)"], + [1, "rgb(147, 201, 134)"] + ]), pageTitle: "合同列表", type: 0, //pageType 合同列表_0 和 履约保函收取登记_1 公用 - userList: ["liuxiangyu", "zhushulan", "admin", "jiangjiao"], + userList: ["liuxiangyu", "admin"], window: { width: 0, height: 0, @@ -440,10 +445,19 @@ export default { table: [ { label: "项目名称", - width: 340, + width: 380, prop: "name", fixed: "left", align: "left", + customFn:row => { + if (row.type === 1 && row.end_date && (this.$moment().valueOf() - this.$moment(row.end_date).valueOf()) > 0) { + return (【已到期】{row.name}) + } else { + return ( + {row.name} + ) + } + } }, { label: "采购形式", @@ -473,95 +487,62 @@ export default { { label: "采购流程", multiHd: [ - // { - // label: "请示流程", - // width: 140, - // prop: "req_status", - // formatter: (cell, data, value) => { - // if (cell.is_plan === 1) { - // return "无"; - // } - // switch (value) { - // case 1: - // return "待申请"; - // break; - // case 2: - // return "流转中"; - // break; - // case 3: - // return "已办结"; - // break; - // default: - // return "异常"; - // break; - // } - // }, - // }, { label: "采购业务审批流程", width: 158, prop: "purchase_status", - formatter: (cell, data, value) => { - switch (value) { - case 1: - return "待申请"; - break; - case 2: - return "流转中"; - break; - case 3: - return "已办结"; - break; - default: - return "异常"; - break; - } - }, + customFn:row => { + return ( +
+ { this.flowStatus.get(row.FLOWSTATUS.caigou.getStatus()) || '无2' } +
+ { + (row.FLOWSTATUS.caigou.getStatus() !== 2 && row.FLOWSTATUS.caigou.getStatus() !== -2) ? this.toOaDetail('caigou',row)}}>查看 : '' + } +
+ ) + } }, { label: "招标审核流程", width: 145, prop: "invite_status", - formatter: (cell, data, value) => { - if (cell.purchase_way?.remark === "false") { - return "无"; + customFn:row => { + if (!row.FLOWSTATUS.zhaobiao.getStatus()) { + return (); } - switch (value) { - case 1: - return "待申请"; - break; - case 2: - return "流转中"; - break; - case 3: - return "已办结"; - break; - default: - return "异常"; - break; - } - }, + return ( +
+ { this.flowStatus.get(row.FLOWSTATUS.zhaobiao.getStatus()) } +
+ { + (row.FLOWSTATUS.zhaobiao.getStatus() !== 2 && row.FLOWSTATUS.zhaobiao.getStatus() !== -2) ? { + this.$refs['biddingUpload'].setId(row.id) + this.$refs['biddingUpload'].show() + }}}>查看 : '' + } +
+ ) + } }, { - label: "合同会签流程", + label: "合同审批流程", width: 145, prop: "join_status", - formatter: (cell, data, value) => { - switch (value) { - case 1: - return "待申请"; - break; - case 2: - return "流转中"; - break; - case 3: - return "已办结"; - break; - default: - return "异常"; - break; + customFn:row => { + if (!row.FLOWSTATUS.shenpi.getStatus()) { + return (); } - }, + return ( +
+ { this.flowStatus.get(row.FLOWSTATUS.shenpi.getStatus()) } +
+ { + (row.FLOWSTATUS.shenpi.getStatus() !== 2 && row.FLOWSTATUS.shenpi.getStatus() !== -2) ? this.toOaDetail('hetong',row)}}>查看 : '' + } +
+ ) + } }, ], }, @@ -993,6 +974,26 @@ export default { } }, methods: { + async toOaDetail (tbname,row) { + let url = `${process.env.VUE_APP_OUT_URL}/#/flow/detail?auth_token=${window.encodeURIComponent(getToken())}&isSinglePage=1&flow_id=` + switch (tbname) { + case "caigou": + let caigou = row.flow_list.find(i => i.tag === 'caigou') + url += caigou?.flow_id + break; + case "hetong": + let contract = row.flow_list.find(i => i.tag === 'contract') + url += contract?.flow_id + break; + case "other": + url += row.other_flow_id + break; + default: + url = `${process.env.VUE_APP_OUT_URL}/flow/list/todo` + } + this.oaUrl = url + this.isShowOaModal = true + }, reset() { this.select = deepCopy(this.selectCopy); }, @@ -1073,110 +1074,6 @@ export default { return sums; }, - cellStyle({ row, column, rowIndex, columnIndex }) { - if (column.property === "req_status") { - if (row.is_plan === 1) { - return { - color: "rgb(140,140,140)", - }; - } - switch (row.req_status) { - case 1: - return { - color: "rgb(96,109,241)", - }; - break; - case 2: - return { - color: "rgb(219,122,122)", - }; - break; - case 3: - return { - color: "rgb(147,201,134)", - }; - break; - default: - return { - color: "rgb(220,185,126)", - }; - } - } - if (column.property === "purchase_status") { - switch (row.purchase_status) { - case 1: - return { - color: "rgb(96,109,241)", - }; - break; - case 2: - return { - color: "rgb(219,122,122)", - }; - break; - case 3: - return { - color: "rgb(147,201,134)", - }; - break; - default: - return { - color: "rgb(220,185,126)", - }; - } - } - if (column.property === "invite_status") { - if (row.purchase_way?.remark === "false") { - return { - color: "rgb(140,140,140)", - }; - } - switch (row.invite_status) { - case 1: - return { - color: "rgb(96,109,241)", - }; - break; - case 2: - return { - color: "rgb(219,122,122)", - }; - break; - case 3: - return { - color: "rgb(147,201,134)", - }; - break; - default: - return { - color: "rgb(220,185,126)", - }; - } - } - if (column.property === "join_status") { - switch (row.join_status) { - case 1: - return { - color: "rgb(96,109,241)", - }; - break; - case 2: - return { - color: "rgb(219,122,122)", - }; - break; - case 3: - return { - color: "rgb(147,201,134)", - }; - break; - default: - return { - color: "rgb(220,185,126)", - }; - } - } - }, confirmPlanForSearch() { this.isShowPlanForSearch = false; this.getContracts(); @@ -1347,7 +1244,7 @@ export default { page: this.select.pageIndex, ...this.select, }); - + res.list.data.forEach(i => this.handleContractFlow(i)) this.list = res.list.data; this.total = res.list.total; this.tableTotal.fundLogTotal = res.fund_log_total; @@ -1358,6 +1255,102 @@ export default { .toFixed(2) .replace(/(\d)(?=(\d{3})+\.)/g, "$1,"); }, + //数据流程状态处理 + handleContractFlow (item) { + class Flow { + status = 0 + executable = false + constructor(status=-2, executable=false) { + this.status = status + this.executable = executable + } + setStatus (status) { + this.status = status + } + setExecutable (executable) { + if (typeof executable === 'boolean') { + this.executable = executable + } + } + getStatus () { + return this.status + } + isEnabled () { + return this.executable && (this.status === 2 || this.status === "") + } + } + // [2, "待申请"], + // [-1, "已退回"], + // [-2, "-"], + // [0, "流转中"], + // [1, "已办结"] + let flowStatus = { + "caigou": new Flow(), + "zhaobiao": new Flow(), + "shenpi": new Flow(), + "qianding": new Flow(), + "zhifu": new Flow(), + "other": new Flow() + } + const caigou = item.flow_list.find(i => i.tag === 'caigou') + const shenpi = item.flow_list.find(i => i.tag === 'contract') + if (item.is_purchase) { + //为采购项目 + if (item.is_simple !== 1 && !item.is_substitute) { + //不为简易 采购未开始 + flowStatus["caigou"].setStatus(caigou?.flow_status ?? 2) + if (!caigou) { + //采购未开始 + if (item.is_plan === 1) { + flowStatus["caigou"].setExecutable(true) + } + } + } + if (item.purchase_way?.value !== '网上商城' && item.is_contract && item.purchase_way?.remark === 'true' && !item.is_substitute) { + //不为网上商场 是合同\ + flowStatus["zhaobiao"].setStatus(item.invite_status ?? 2) + if ((!item.invite_status || item.invite_status === 2) && caigou?.flow_status === 1) { + //采购完成,招标未开始 + flowStatus["zhaobiao"].setExecutable(true) + } + } + if (item.is_contract && item.purchase_way?.value !== "网上商城") { + //为合同 不为网上商城 + flowStatus["shenpi"].setStatus(shenpi?.flow_status ?? 2) + if ((!shenpi?.flow_status || shenpi?.flow_status === 2) && (item.invite_status === 1 || + ((item.purchase_way?.remark === 'false' || item.flow_mod_id === 5 || item.flow_mod_id === 29) && caigou?.flow_status === 1))) { + //审批未开始 走招标招标完成或不走招标采购完成 + flowStatus["shenpi"].setExecutable(true) + } + } + if (item.is_contract && item.purchase_way?.value !== "网上商城" && !item.is_substitute) { + flowStatus["qianding"].setStatus(item.status) + if (shenpi?.flow_status === 1 && item.status === 1) { + flowStatus["qianding"].setExecutable(true) + } + } + } else { + if (item.flow_mod_id) { + //非采购事前流程 + flowStatus["other"].setStatus(item.other_flow_status??1) + if (item.other_flow_status === 1 || !item.other_flow_status) { + flowStatus["other"].setExecutable(true) + } + } + } + if (item.is_end === 0) { + flowStatus["zhifu"].setStatus(2) + //最后一笔没付完 + if ((item.is_purchase === 0 && item.other_flow_status === 3) || (!item.is_contract && !item.is_substitute && caigou?.flow_status === 1) || (item.purchase_way?.value === "网上商城" && caigou?.flow_status === 1) || + item.status === 2 || + (!item.is_contract && item.is_simple) || (item.is_contract && item.is_substitute && shenpi?.flow_status === 1)) { + //网上商场的话采购完成 合同签订完成 不为合同并且为简易 + flowStatus["zhifu"].setExecutable(true) + } + } + + item.FLOWSTATUS = flowStatus + }, //新建合同 //显示 diff --git a/src/views/finance/paymentRegistrationList.vue b/src/views/finance/paymentRegistrationList.vue index fbbf436..5b805c5 100644 --- a/src/views/finance/paymentRegistrationList.vue +++ b/src/views/finance/paymentRegistrationList.vue @@ -540,7 +540,7 @@ export default { computed: { authOa () { return function (row) { - return row.flow_list.find(i => i.tag === 'pay')?.status === 1 + return row.flow_list.find(i => i.tag === 'pay')?.flow_status === 1 } } },