From 95b49b3728dde01002ddc37728474fd2de2c8fe9 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Tue, 26 Aug 2025 15:16:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E9=87=91=E4=B8=8A=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract/components/EditContract.vue | 79 ++++--- .../components/detailPaymentRegistration.vue | 39 ++-- .../components/paymentRegistration.vue | 39 ++-- src/views/contract/contractEdit.vue | 202 +++++++++++------- 4 files changed, 197 insertions(+), 162 deletions(-) diff --git a/src/views/contract/components/EditContract.vue b/src/views/contract/components/EditContract.vue index 27a508d..058b4bb 100644 --- a/src/views/contract/components/EditContract.vue +++ b/src/views/contract/components/EditContract.vue @@ -18,7 +18,7 @@ { - // 如果是一般采购,则不是必选 - if (this.form.is_common_purchase) { - callback() - return - } - // 如果合同金额大于等于10万,则必选 - if (this.form.total_money && Number(this.form.total_money) >= 100000) { - if (!value) { - callback(new Error('资金上会流程为必选项')) - return - } - } - callback() - }, - trigger: 'change' - } ] }, contractTypes: [ @@ -1229,31 +1209,46 @@ export default { }, submit() { this.$refs['elForm'].validate().then(_ => { - // 验证资金上会流程 + // 提示:金额达到阈值但未选择上会流程 if (this.isMeetingFlowRequired && !this.form.meeting_flow_id) { - this.$message({ - type: 'warning', - message: '资金上会流程为必选项' + this.$confirm( + '当前合同金额超出10万元,请确认是否需要选择资金上会流程', + '提示', + { + confirmButtonText: '直接提交', + cancelButtonText: '关闭', + type: 'warning', + closeOnClickModal: false, + closeOnPressEscape: false + } + ).then(() => { + this._proceedSubmit() + }).catch(() => { + // 用户取消/关闭,不继续提交 }) return } - - this.form.contract_to_contracts = this.selections.map(i => { - return { - contract_id: this.contrantId, - to_contract_id: i.id, - use_money: i.money - } - }) - this.form.contract_flow_links = this.form.contract_flow_links.map(i => ({ - ...i, - tag: this.flowConfig.find(j => j.custom_model_id == i.custom_model_id)?.tag - })) - editorContract(this.form).then(_ => { - this.$message.success('修改成功') - this.$emit('update:isShow', false) - this.$emit('refresh') - }) + + // 正常提交 + this._proceedSubmit() + }) + }, + _proceedSubmit() { + this.form.contract_to_contracts = this.selections.map(i => { + return { + contract_id: this.contrantId, + to_contract_id: i.id, + use_money: i.money + } + }) + this.form.contract_flow_links = this.form.contract_flow_links.map(i => ({ + ...i, + tag: this.flowConfig.find(j => j.custom_model_id == i.custom_model_id)?.tag + })) + editorContract(this.form).then(_ => { + this.$message.success('修改成功') + this.$emit('update:isShow', false) + this.$emit('refresh') }) } } diff --git a/src/views/contract/components/detailPaymentRegistration.vue b/src/views/contract/components/detailPaymentRegistration.vue index a4e3e41..c056101 100644 --- a/src/views/contract/components/detailPaymentRegistration.vue +++ b/src/views/contract/components/detailPaymentRegistration.vue @@ -323,20 +323,6 @@ export default { type: [{ required: true, message: '必选' - }], - meeting_flow_id: [{ - required: true, - message: '资金上会流程为必选项', - validator: (rule, value, callback) => { - // 如果申请付款金额大于等于5万,则必选 - if (this.form.apply_money && Number(this.form.apply_money) >= 50000) { - if (!value) { - callback(new Error('资金上会流程为必选项')) - return - } - } - callback() - } }] }, // OA流程相关 @@ -425,15 +411,30 @@ export default { }, editor() { - // 验证资金上会流程 + // 提示:金额达到阈值但未选择上会流程 if (this.isMeetingFlowRequired && !this.form.meeting_flow_id) { - Message({ - type: 'warning', - message: '资金上会流程为必选项' + this.$confirm( + '当前申请付款金额超出5万元,请确认是否需要选择资金上会流程', + '提示', + { + confirmButtonText: '直接提交', + cancelButtonText: '关闭', + type: 'warning', + closeOnClickModal: false, + closeOnPressEscape: false + } + ).then(() => { + this._proceedSubmit() + }).catch(() => { + // 用户取消/关闭,不继续提交 }) return } - + + // 正常提交 + this._proceedSubmit() + }, + _proceedSubmit() { editorFundLog(this.form).then(res => { this.$emit('success') this.isShow = false diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue index e61c2b1..01c044c 100644 --- a/src/views/contract/components/paymentRegistration.vue +++ b/src/views/contract/components/paymentRegistration.vue @@ -534,20 +534,6 @@ export default { type: [{ required: true, message: '必选' - }], - meeting_flow_id: [{ - required: true, - message: '资金上会流程为必选项', - validator: (rule, value, callback) => { - // 如果申请付款金额大于等于5万,则必选 - if (this.paymentRegistrationForm.applyMoney && Number(this.paymentRegistrationForm.applyMoney) >= 50000) { - if (!value) { - callback(new Error('资金上会流程为必选项')) - return - } - } - callback() - } }] }, departments: [], @@ -913,15 +899,30 @@ export default { }) }, submit() { - // 验证资金上会流程 + // 提示:金额达到阈值但未选择上会流程 if (this.isMeetingFlowRequired && !this.paymentRegistrationForm.meeting_flow_id) { - Message({ - type: 'warning', - message: '资金上会流程为必选项' + this.$confirm( + '当前申请付款金额超出5万元,请确认是否需要选择资金上会流程', + '提示', + { + confirmButtonText: '直接提交', + cancelButtonText: '关闭', + type: 'warning', + closeOnClickModal: false, + closeOnPressEscape: false + } + ).then(() => { + this._proceedSubmit() + }).catch(() => { + // 用户取消/关闭,不继续提交 }) return } - + + // 正常提交 + this._proceedSubmit() + }, + _proceedSubmit() { const data = { contract_id: this.contract.id, apply_money: this.paymentRegistrationForm.applyMoney, diff --git a/src/views/contract/contractEdit.vue b/src/views/contract/contractEdit.vue index 91707d7..c4869fb 100644 --- a/src/views/contract/contractEdit.vue +++ b/src/views/contract/contractEdit.vue @@ -194,7 +194,7 @@ @@ -697,7 +697,7 @@ @@ -1592,26 +1592,7 @@ export default { trigger: "change", }, ], - meeting_flow_id: [ - { - validator: (rule, value, callback) => { - // 如果是一般采购,则不是必选 - if (this.form.is_common_purchase) { - callback() - return - } - // 如果合同金额大于等于10万,则必选 - if (this.form.total_money && Number(this.form.total_money) >= 100000) { - if (!value) { - callback(new Error('资金上会流程为必选项')) - return - } - } - callback() - }, - trigger: "change", - }, - ], + // meeting_flow_id: 提示改为提交时校验 }, plans: [], planSelect: { @@ -2044,68 +2025,27 @@ export default { //submit this.$refs["form"].validate((valid) => { if (valid) { - // 验证资金上会流程 + // 提示:金额达到阈值但未选择上会流程 if (this.isMeetingFlowRequired && !this.form.meeting_flow_id) { - this.$message({ - type: 'warning', - message: '资金上会流程为必选项' - }) - return - } - - this.btnLoading = true; - if (!this.form.use_framework_buy) { - this.form.contract_to_contracts = []; - } else { - this.form.contract_plan_links = []; - } - this.form.is_purchase = - (this.flowIds?.find((i) => i.id == this.form.flow_mod_id)?.type == - 2 - ? 1 - : 0) || this.form.is_common_purchase; - if (this.form.is_common_purchase) { - this.form.is_contract = 1; - } - if (this.form.is_contract) { - this.form.is_tender_audit = 1; - } - if (this.form.is_simple) { - this.form.is_contract = 0; - this.form.is_tender_audit = 0; - } - // this.form.is_contract = this.flowIds?.find(i => i.id == this.form.flow_mod_id)?.type == 2 ? 0 : 1; - if (!this.form.money) { - this.form.money = this.form.plan_price; - } - if (this.type === "add") { - addContrant(this.form, true) - .then((res) => { - this.btnLoading = false; - //this.step = 3; - this.$router.push({ - path: - this.form.is_simple || !this.form.is_purchase - ? "/contract/contractAll" - : "/contract/contractList", - query: { - keyword: this.form.name, - }, - }); - }) - .catch((_) => (this.btnLoading = false)); - } - if (this.type === "edit") { - editorContract({ - id: this.contractId, - ...this.form, - }) - .then((res) => { - this.btnLoading = false; - this.step = 3; - }) - .catch((_) => (this.btnLoading = false)); + MessageBox.confirm( + '当前合同金额超出10万元,请确认是否需要选择资金上会流程', + '提示', + { + confirmButtonText: '直接提交', + cancelButtonText: '关闭', + type: 'warning', + closeOnClickModal: false, + closeOnPressEscape: false + } + ).then(() => { + this._proceedSubmit(); + }).catch(() => { + // 用户取消/关闭,不继续提交 + }); + return; } + // 正常提交 + this._proceedSubmit(); } }); } @@ -2251,7 +2191,105 @@ export default { contract_to_contracts: [], }; }, + _proceedSubmit() { + this.btnLoading = true; + if (!this.form.use_framework_buy) { + this.form.contract_to_contracts = []; + } else { + this.form.contract_plan_links = []; + } + this.form.is_purchase = + (this.flowIds?.find((i) => i.id == this.form.flow_mod_id)?.type == 2 + ? 1 + : 0) || this.form.is_common_purchase; + if (this.form.is_common_purchase) { + this.form.is_contract = 1; + } + if (this.form.is_contract) { + this.form.is_tender_audit = 1; + } + if (this.form.is_simple) { + this.form.is_contract = 0; + this.form.is_tender_audit = 0; + } + if (!this.form.money) { + this.form.money = this.form.plan_price; + } + if (this.type === 'add') { + addContrant(this.form, true) + .then((res) => { + this.btnLoading = false; + this.$router.push({ + path: + this.form.is_simple || !this.form.is_purchase + ? '/contract/contractAll' + : '/contract/contractList', + query: { + keyword: this.form.name, + }, + }); + }) + .catch((_) => (this.btnLoading = false)); + } + if (this.type === 'edit') { + editorContract({ id: this.contractId, ...this.form }) + .then((res) => { + this.btnLoading = false; + this.step = 3; + }) + .catch((_) => (this.btnLoading = false)); + } + }, }, + _proceedSubmit() { + this.btnLoading = true; + if (!this.form.use_framework_buy) { + this.form.contract_to_contracts = []; + } else { + this.form.contract_plan_links = []; + } + this.form.is_purchase = + (this.flowIds?.find((i) => i.id == this.form.flow_mod_id)?.type == 2 + ? 1 + : 0) || this.form.is_common_purchase; + if (this.form.is_common_purchase) { + this.form.is_contract = 1; + } + if (this.form.is_contract) { + this.form.is_tender_audit = 1; + } + if (this.form.is_simple) { + this.form.is_contract = 0; + this.form.is_tender_audit = 0; + } + if (!this.form.money) { + this.form.money = this.form.plan_price; + } + if (this.type === 'add') { + addContrant(this.form, true) + .then((res) => { + this.btnLoading = false; + this.$router.push({ + path: + this.form.is_simple || !this.form.is_purchase + ? '/contract/contractAll' + : '/contract/contractList', + query: { + keyword: this.form.name, + }, + }); + }) + .catch((_) => (this.btnLoading = false)); + } + if (this.type === 'edit') { + editorContract({ id: this.contractId, ...this.form }) + .then((res) => { + this.btnLoading = false; + this.step = 3; + }) + .catch((_) => (this.btnLoading = false)); + } + }, computed: { flowIdsFormat() { let temp = this.form.is_trade;