From bc6ee6440c7d4a5ed3fed341d4645ef1f305db6f Mon Sep 17 00:00:00 2001 From: jinna Date: Wed, 22 Apr 2026 10:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E6=9C=AC=E9=A1=B5=E9=9D=A2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../costManagement/subjectFeeMaintenance.vue | 67 ++++++++++++++++--- 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/src/views/costManagement/subjectFeeMaintenance.vue b/src/views/costManagement/subjectFeeMaintenance.vue index 620a51f7..df39e5ef 100644 --- a/src/views/costManagement/subjectFeeMaintenance.vue +++ b/src/views/costManagement/subjectFeeMaintenance.vue @@ -22,10 +22,10 @@ 新增 删除 - 成本计算 + @@ -105,7 +107,8 @@ v-model="scope.row.money" controls-position="right" :min="1" - :disabled="title == '详情'" + :disabled="title == '详情' || maintainForm.distributeType == 2" + @change="changePrice" > @@ -237,7 +240,7 @@ export default { searchLabelPosition: 'left', searchGutter: 24, searchSpan: 6, - menuAlign: 'left', + menuAlign: 'center', gridBtn: false, searchMenuPosition: 'right', addBtnIcon: ' ', @@ -328,6 +331,49 @@ export default { }, mounted() {}, methods: { + disabledDate(time) { + // 获取当前时间的年月 + const now = new Date(); + const currentYear = now.getFullYear(); + const currentMonth = now.getMonth(); // 0-11 + + // 获取传入日期的年月 + const targetYear = time.getFullYear(); + const targetMonth = time.getMonth(); // 0-11 + + // 如果年份小于当前年份,或者年份相同但月份小于当前月份,则禁用 + return (targetYear < currentYear) || (targetYear === currentYear && targetMonth < currentMonth); + }, + changeType(val){ + console.log('val---------------------',val) + if(val == 1){ + this.tableData.map(item =>{ + item.ratio = 0 + }) + } + }, + changePrice(val){ + console.log('val---------------------',val) + if(this.maintainForm.distributeType == 1){ + const totalMoney = this.tableData.reduce((sum, item) => { + // 确保 item.money 是数字类型,如果是 null 或 undefined 则视为 0 + return sum + (Number(item.money) || 0); + }, 0); + this.maintainForm.totalCost = totalMoney; + + }else{ + return + } + }, + changeRatio(val,row){ + console.log('val=============',val) + console.log('row=============',row) + if(this.maintainForm.distributeType == '2'){ + row.money = this.maintainForm.totalCost * (val / 100) + }else{ + return + } + }, // 点击导入按钮 handleImport() { this.isShowImport = true; @@ -380,6 +426,11 @@ export default { this.title = '维护'; this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() }; this.tableData = row.tableData; + if(this.maintainForm.distributeType == 1){ + this.tableData.map(item =>{ + item.ratio = 0 + }) + } this.showMaintain = true; }, // 获取当前月份