From b056f0885f0719f6f67f173adf2ddd5816ac449b Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 31 Jul 2025 16:10:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/components/oaLink.vue | 42 +- .../components/paymentRegistration.vue | 368 +++++++++++------- 2 files changed, 268 insertions(+), 142 deletions(-) diff --git a/src/views/contract/components/oaLink.vue b/src/views/contract/components/oaLink.vue index 2868689..b910d9d 100644 --- a/src/views/contract/components/oaLink.vue +++ b/src/views/contract/components/oaLink.vue @@ -10,7 +10,8 @@ placeholder="请输入关键词"> 查询 -
+
+ 1){ this.$message.warning('只能选择一条流程关联') return } + let foreign_ids = this.joinIds(this.row.id,flowsList[0].out_contract_id) + console.log("flowsList",foreign_ids) + // return oaSave({ foreign_field:'out_contract_id', - foreign_id:this.row.id, + foreign_id:foreign_ids, flow_id:flowsList[0].id }).then(res=>{ this.$message.success('关联成功') @@ -147,7 +171,9 @@ // 只保留最新选择的项 this.$refs.oaTable.clearSelection(); this.$refs.oaTable.toggleRowSelection(selectedRows[selectedRows.length - 1]); - } + } + // this.$refs.oaTable.clearSelection(); + // this.$refs.oaTable.toggleRowSelection(selectedRows); } } } diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue index 248530d..452dc99 100644 --- a/src/views/contract/components/paymentRegistration.vue +++ b/src/views/contract/components/paymentRegistration.vue @@ -72,6 +72,10 @@
+ + +
+
@@ -90,7 +94,7 @@
- + @@ -203,116 +207,119 @@ - @@ -367,10 +374,11 @@ name: "", page_size: 20, page: 1, - is_tree: 1, + // is_tree: 1, year: new Date().getFullYear().toString(), plan_department_id: "", - type: "" + type: "", + top_pid: 1, }, plans: [], planTypes: [], @@ -442,7 +450,8 @@ }, ], }, departments:[], - planTable: [{ + planTable: [ + { sortable: false, width: 44, type: "selection", @@ -506,11 +515,82 @@ align: "right", formatter: (v1, v2, value) => value ? `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : "", - } - ], + }], + showPlanList:[], + showPlanTable: [ + { + label: "科室", + prop: "plan_department_id", + width: 120, + align: "center", + formatter: (row, column, value) => { + return this.departments.find(i => i.id === row.plan_department_id)?.name + } + }, + { + label: "年份", + prop: "year", + width: 80, + align: "center", + }, + { + label: "分类", + prop: "type", + width: 120, + }, + { + label: "名称", + prop: "name", + minWidth: 180, + align: "left", + }, + { + label: "内容", + prop: "content", + minWidth: 240, + align: "left", + showOverflowTooltip: true + }, + { + label: "计划金额", + prop: "money", + align: "right", + width: 120, + formatter: (v1, v2, value) => { + return `${(value && parseFloat(value) !== 0) ? value : v1.update_money }`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + }, + { + label: "使用金额", + prop: "use_money", + width: 120, + align: "right", + formatter: (v1, v2, value) => + value ? `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : "", + }] }; }, - methods: { + methods: { + findVal(arr, id) { + for (let i = 0; i < arr.length; i++) { + // 1. 找到匹配项,直接返回name + if (arr[i].id == id) { + console.log("arr[i].name", arr[i].name); + return arr[i].name; + } + // 2. 有children数组,递归查找 + else if (arr[i].children instanceof Array) { + // 接收递归的返回值 + const childResult = this.findVal(arr[i].children, id); + // 若子数组中找到结果,直接返回(传递到上层) + if (childResult) { + return childResult; + } + } + } + // 3. 所有层级都没找到,返回null或空字符串(可选) + return null; + }, //上传 successHandle(response, file, fileList) { this.fileList = fileList; @@ -536,24 +616,24 @@ // this.planTypes = res.detail; // }, async getPlanTypes() { - const res = await getparameterTree({ - id: 3 - }); - const dataHandler = (data) => { - data.forEach(i => { - if (i.hasOwnProperty('detail')) { - i.children = i.detail.map(j => { - j.name = j.value - return j; - }) - } else { - dataHandler(i['children']) - } + const res = await getparameterTree({ + id: 3 + }); + const dataHandler = (data) => { + data.forEach(i => { + if (i.hasOwnProperty('detail')) { + i.children = i.detail.map(j => { + j.name = j.value + return j; }) - return data; + } else { + dataHandler(i['children']) } - this.planTypes = dataHandler(res?.children) || [] - }, + }) + return data; + } + this.planTypes = dataHandler(res?.children) || [] + }, //翻页 pageChange(e) { @@ -593,7 +673,23 @@ return ((total / this.contract.money) * 100 || 0).toFixed(2) || 0; }, - //获取合同信息 + //获取合同信息 + mergePlanData(plans, planLink) { + // 创建 plans 的映射表,键为 plan_id,值为 use_money + const planMap = new Map( + plans.map(plan => [plan.plan_id, plan.use_money]) + ); + + // 遍历 planLink,为每个项添加匹配的 use_money + return planLink.map(item => { + // 如果找到匹配的 plan_id,则添加 use_money,否则添加 null 或默认值 + const useMoney = planMap.get(item.id) || null; + return { + ...item, + use_money: useMoney + }; + }); + }, async getContract(info) { this.contract = await detailContract({ @@ -601,7 +697,11 @@ }); this.paymentRegistrationForm.plan = this.contract.plan_link - console.log("this.paymentRegistrationForm.plan",this.contract.plan_link) + + if(this.contract.plan_link,length>0){ + this.showPlanList = this.mergePlanData(this.contract.plan_link,this.contract.plans) + } + console.log("this.paymentRegistrationForm.plan",this.contract.plan_link,this.showPlanList) if(this.contract.plan_link.legnth===0){ Message({ type: 'warning', @@ -735,13 +835,13 @@ }, async getBudgets(refresh) { let res = await getBudget(this.planSelect); - this.initInputMoney(res.list) - this.plans = res.list; + this.initInputMoney(res.list.data) + this.plans = res.list.data; if(refresh){ this.$refs.editorPlanTable.clearSelection() } - // this.planTotal = res.list.total; + this.planTotal = res.list.total; // this.toggleSelection(this.paymentRegistrationForm.plan.map(item => { // return item.plan_id