From 2204380c766f387507f1fac62495602ea539b00d Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Thu, 27 Jun 2024 15:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=A1=AE=E8=AE=A4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/XyTable/index.vue | 4 +- .../contract/components/contractSign.vue | 12 +- .../components/examineRegistration.vue | 149 ++++++------------ 3 files changed, 64 insertions(+), 101 deletions(-) diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index 74ef2ab..c19a073 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -127,9 +127,9 @@ export default { createIndexRow(){ return }, - toggleRowSelection(row){ + toggleRowSelection(row, selected){ this.$nextTick(()=>{ - this.$refs.table.toggleRowSelection(row); + this.$refs.table.toggleRowSelection(row, selected); }) }, clearSelection(){ diff --git a/src/views/contract/components/contractSign.vue b/src/views/contract/components/contractSign.vue index dffa37f..d36e446 100644 --- a/src/views/contract/components/contractSign.vue +++ b/src/views/contract/components/contractSign.vue @@ -142,7 +142,7 @@
*质保期
-
+
@@ -666,6 +666,16 @@ content: '年' } } + .xy-table-item-month { + position: relative; + + &::after { + position: absolute; + right: 4%; + top: 0; + content: '月' + } + } ::v-deep .el-input__inner { text-align: left; diff --git a/src/views/finance/components/examineRegistration.vue b/src/views/finance/components/examineRegistration.vue index 572a57b..3eb8c89 100644 --- a/src/views/finance/components/examineRegistration.vue +++ b/src/views/finance/components/examineRegistration.vue @@ -205,16 +205,15 @@
- @@ -300,6 +299,8 @@ import { listdeptNoAuth } from '@/api/system/department' moneyWay: [], //资金列支渠道 files: [] }, + selectionTag: 0, + originalPlan: [], paymentRegistrationRules: { applyMoney: [{ required: true, @@ -344,10 +345,13 @@ import { listdeptNoAuth } from '@/api/system/department' plan_department_id: "", type: "" }, - planTable: [{ + planTable: [ + { sortable: false, width: 44, + reserveSelection: true, type: 'selection', + fixed: "left" }, { label: "年份", @@ -374,8 +378,9 @@ import { listdeptNoAuth } from '@/api/system/department' { label: "名称", prop: 'name', - width: 280, - align: 'left' + width: 220, + align: 'left', + fixed: "left" }, { @@ -410,12 +415,12 @@ import { listdeptNoAuth } from '@/api/system/department' } }, methods: { - delPlan(val) { - this.paymentRegistrationForm.plan.map((item, index) => { - if (item.plan_id === val.plan_id) { - this.paymentRegistrationForm.plan.splice(index, 1) - } - }) + delPlan(item) { + this.$refs["planTable"].toggleRowSelection(item, false) + }, + delPidPlan (item) { + let index = this.originalPlan.findIndex(i => i.id === item.id) + this.originalPlan.splice(index, 1) }, //合计申请金额 totalApplyMoney() { @@ -437,7 +442,7 @@ import { listdeptNoAuth } from '@/api/system/department' }); this.plansSelect[`type`]=_arr +''; } - if (this.paymentRegistrationForm.plan.length === 0) { + if (this.originalPlan.length === 0) { this.getBudgets() } }, @@ -448,11 +453,6 @@ import { listdeptNoAuth } from '@/api/system/department' return } row.use_money = e - this.paymentRegistrationForm.plan.forEach(item => { - if (item.plan_id == row.id) { - item.use_money = e - } - }) }, async getPlanTypes() { @@ -504,7 +504,8 @@ import { listdeptNoAuth } from '@/api/system/department' this.payment.forEach(item => { total += Number(item.act_money??0) }) - return ((((total / Number(this.contract?.money||0)) || 0) * 100)).toFixed(2) || 0 + let per = total / Number(this.contract?.money||0) + return isFinite(per) ? (per * 100).toFixed(2) : 0; }, async getRegistration(id) { @@ -524,10 +525,8 @@ import { listdeptNoAuth } from '@/api/system/department' this.paymentRegistrationForm.deductionMoney = res.discount_money this.paymentRegistrationForm.applyMoney = res.apply_money this.paymentRegistrationForm.remark = res.remark - for (var m of res.plan_link) { - m.label = m.plan ? m.plan.name : "无计划名称"; - } - this.paymentRegistrationForm.plan = res.plan_link + + this.originalPlan = res.plan_link.filter(i => i.plan).map(i => i.plan) this.paymentRegistrationForm.actMoney = res.apply_money this.paymentRegistrationForm.moneyWay = res.money_way_id?.split(',')?.map(item => Number(item)) @@ -535,7 +534,7 @@ import { listdeptNoAuth } from '@/api/system/department' this.getContract(res.contract) this.moneyWayChange(this.paymentRegistrationForm.moneyWay) if (res.plan_link.length > 0) { - await this.getBudgets(1) + await this.getBudgets() } }, @@ -548,23 +547,19 @@ import { listdeptNoAuth } from '@/api/system/department' contract_id: this.contract.id }) this.payment = res.data + }, - this.toggleSelection(this.paymentRegistrationForm.plan.map(item => { - return item.plan_id - })) + add (num1, num2) { + const num1Digits = (num1.toString().split('.')[1] || '').length; + const num2Digits = (num2.toString().split('.')[1] || '').length; + const baseNum = Math.pow(10, Math.max(num1Digits, num2Digits)); + return (num1 * baseNum + num2 * baseNum) / baseNum; }, //确认审核 editor() { - console.log({ - id: this.registrationId, - contract_id: this.contract.id, - act_money: this.paymentRegistrationForm.actMoney, - status: 1, - money_way_id: this.paymentRegistrationForm.moneyWay.toString(), - contract_plan_act_links: this.paymentRegistrationForm.plan - }) - let total = this.$refs["planTable"].getSelection().reduce((pre,cur) => pre + Number(cur.use_money),0) + let total = this.planSelection.reduce((pre,cur) => this.add(pre, Number(cur.use_money)),0) + console.log(Number(this.paymentRegistrationForm.actMoney),total) if (Number(this.paymentRegistrationForm.actMoney) !== total) { this.$message({ type: 'warning', @@ -581,7 +576,7 @@ import { listdeptNoAuth } from '@/api/system/department' discount_money: this.paymentRegistrationForm.deductionMoney, money_way_id: this.paymentRegistrationForm.moneyWay.toString(), audit_date: this.$moment().format('YYYY-MM-DD'), - contract_plan_act_links: this.$refs["planTable"].getSelection().map(item => ({ + contract_plan_act_links: this.planSelection.map(item => ({ contract_id: this.contract.id, plan_id: item.id, use_money: item.use_money, @@ -604,75 +599,29 @@ import { listdeptNoAuth } from '@/api/system/department' //计划 //获取预算计划 - async getBudgets(is_tree=0) { + async getBudgets() { let res = await getBudget({ - top_pid: is_tree ? 0 : 1, + top_pid: this.originalPlan.length > 0 ? 0 : 1, ...this.plansSelect, - pid: is_tree ? this.paymentRegistrationForm.plan?.map(i => i.plan_id)?.toString() : "" + pid: this.originalPlan.length > 0 ? this.originalPlan.map(i => i.id)?.toString() : "", + page: this.originalPlan.length > 0 ? 1 : this.plansSelect.page }) this.plans = res.list.data this.planTotal = res.list.total - // this.toggleSelection(this.paymentRegistrationForm.plan.map(item => { - // return item.plan_id - // })) + console.log(this.planSelection) + this.plans.forEach(item => { + let findSelection = this.planSelection.find(i => i.id === item.id) + if (findSelection) { + item.use_money = findSelection.use_money + } + }) }, planPageChange(e) { this.plansSelect.page = e this.getBudgets() }, - selectPlan(sel, row) { - if (sel) { - let select = sel.map(item => { - return { - contract_id: this.contract.id, - plan_id: item.id, - use_money: item.use_money, - new_money: item.money, - label: item.name - } - }); - //说明被删除了 - if (sel.filter(plan => { - return plan.id == row.id - }).length == 0) { - this.delPlan({ - plan_id: row.id - }) - } - let _plan = JSON.parse(JSON.stringify(this.paymentRegistrationForm.plan)); - - var _select = []; - select.map(item => { - if (_plan.filter(plan => { - return plan.plan_id == item.plan_id - }).length == 0) { - _select.push(item) - } - }); - this.paymentRegistrationForm.plan = [..._plan, ..._select] - - - } else { - this.paymentRegistrationForm.plan = [] - } - }, - //默认选择计划 - toggleSelection(plans) { - if (plans) { - this.plans.filter(plan => { - if (plans.includes(plan.id)) { - plan.use_money = this.paymentRegistrationForm.plan[plans.indexOf(plan.id)].use_money - return true - } - }).map(row => { - this.$refs.planTable.toggleRowSelection(row) - }) - } else { - this.$refs.planTable.clearSelection() - } - }, //获取科室 getDepartment() { listdeptNoAuth().then((res) => { @@ -685,6 +634,10 @@ import { listdeptNoAuth } from '@/api/system/department' return function(money) { return moneyFormatter(money) } + }, + planSelection () { + let temp = this.selectionTag + return this.$refs["planTable"]?.getSelection() || [] } }, watch: {