diff --git a/src/views/contract/components/editorContract.vue b/src/views/contract/components/editorContract.vue index fc0d2d4..a113020 100644 --- a/src/views/contract/components/editorContract.vue +++ b/src/views/contract/components/editorContract.vue @@ -561,23 +561,24 @@ }, //选择计划 selectPlan(sel, row) { - if (sel) { - let select = sel.map(item => { return { label: item.name, value: { plan_id: item.id, - use_money: item.useMoney, + use_money: item.useMoney || 0, new_money: item.money } } }) - - this.plan = [...this.detail.plan, ...select] + + // 合并已选计划和新增计划,去重 + const existingPlanIds = this.detail.plan.map(p => p.value.plan_id) + const newPlans = select.filter(p => !existingPlanIds.includes(p.value.plan_id)) + this.plan = [...this.detail.plan, ...newPlans] } else { - this.plan = this.detail.plan; + this.plan = this.detail.plan } }, delPlan(val) { @@ -611,15 +612,18 @@ }, //默认选择计划 toggleSelection(plans) { - var selPlans = [...this.detail.plan, ...this.plan] - if (plans) { - this.plans.filter(plan => { - if (plans.includes(plan.id)) { - plan.useMoney = selPlans[plans.indexOf(plan.id)].value.use_money - return true + if (plans && plans.length > 0) { + this.plans.forEach(plan => { + const isSelected = plans.includes(plan.id) + if (isSelected) { + const selectedPlan = this.plan.find(p => p.value.plan_id === plan.id) + if (selectedPlan) { + plan.useMoney = selectedPlan.value.use_money + } + this.$nextTick(() => { + this.$refs.editorPlanTable.toggleRowSelection(plan, true) + }) } - }).map(row => { - this.$refs.editorPlanTable.toggleRowSelection(row) }) } else { this.$refs.editorPlanTable.clearSelection() @@ -632,14 +636,14 @@ this.contrantId = res.id this.detail = { name: res.name, - is_simple:res?.is_simple, + is_simple: res?.is_simple, has_charge: res?.has_charge, date: res.date, req_status: res.req_status, purchase_status: res.purchase_status, join_status: res.join_status, invite_status: res.invite_status, - supply:res?.supply, + supply: res?.supply, type: res.type, methods: res.purchase_type_id, modality: res.purchase_way_id, @@ -649,13 +653,12 @@ price: res.plan_price, isBudget: res.is_plan === 1 ? true : false, plan: res.plans.map(item => { + const planLink = res.plan_link.find(link => link.plan_id === item.id) return { label: item.name, value: { plan_id: item.id, - use_money: res.plan_link.filter(item1 => { - return item1.plan_id === item.id - })[0].use_money, + use_money: planLink ? planLink.use_money : 0, new_money: item.money } } @@ -664,15 +667,8 @@ gov_plane: res.gov_plane, contract_carry_department: res.contract_carry_department.map(i => i.carry_department_id) } + this.plan = [...this.detail.plan] this.$refs['govPlane'].selected = res.gov_plane - this.plan = this.detail.plan - - this.oaFlow = { - hetonghuiqian: res.join_last_flow_id, - caigou: res.purchase_last_flow_id, - zhaobiaowenjianshencha: res.invite_last_flow_id, - qingshi: res.req_last_flow_id - } }, //y验证合同的名称是否存在重复 checkName(e) { diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index adabebe..5502434 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -493,12 +493,12 @@
事前支付表格
-
+
事后支付表格
-
+
@@ -512,15 +512,39 @@