From 26fea67ed94fe74e43e5658b01b5f5d135e6efbd Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Mon, 3 Nov 2025 15:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- .../dashboard/components/budgetStatic.vue | 59 +++++++++++++++---- .../statisticalReport/budgetProgress.vue | 37 ++++++++---- .../statisticalReport/quarterlyStatistics.vue | 27 ++++++--- 4 files changed, 97 insertions(+), 30 deletions(-) diff --git a/.env.development b/.env.development index 10d6f17..4b86c0b 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,9 @@ ENV = 'development' # base api -VUE_APP_DOMIAN=http://192.168.60.99:8003/ +VUE_APP_DOMIAN=http://192.168.60.99:9003/ VUE_APP_BASE_API = '' -VUE_APP_UPLOAD=http://192.168.60.99:8003/api/admin/upload-file +VUE_APP_UPLOAD=http://192.168.60.99:9003/api/admin/upload-file VUE_APP_OUT_URL = http://192.168.60.18:8001 #VUE_APP_DOMIAN=http://192.168.60.99:9003/ diff --git a/src/views/dashboard/components/budgetStatic.vue b/src/views/dashboard/components/budgetStatic.vue index c05fb4b..75511f6 100644 --- a/src/views/dashboard/components/budgetStatic.vue +++ b/src/views/dashboard/components/budgetStatic.vue @@ -107,7 +107,7 @@ export default { label: '进展率', width: 200, customFn: (row) => { - let m2 = row.update_money; + let m2 = row.update_money||0; let m1 = row.money; let m3 = row.use_money_total; let per = 0; @@ -169,7 +169,7 @@ export default { for (let m of res.list.data) { m.pid_info_name = m.pid_info?.name m.pid_info_id = m.pid_info?.id - console.log('m.pid_info_name',m.pid_info_name) + // console.log('m.pid_info_name',m.pid_info_name) } res.list.data.sort((a,b)=>{ return b.pid_info_id - a.pid_info_id @@ -186,6 +186,20 @@ export default { }, selected (selections, selected) { + // selections: 所有已选中的行数组 + // selected: 当前点击的行 + + // 确保 selected 存在且有效 + if (!selected || !selected.id) { + // 如果没有 selected,说明可能是取消选择操作,使用 selections 更新 + this.selections = Array.isArray(selections) ? selections : [] + return + } + + // 直接使用 selections 参数来更新选中列表,这样更可靠 + // 因为 selections 是表格组件当前所有已选中的行 + this.selections = Array.isArray(selections) ? [...selections] : [] + // if (selected['pid_info_name-span']?.rowspan > 1) { // if (this.selections.find(i => i.id === selected.id)) { // let len = selected['pid_info_name-span'].rowspan @@ -197,17 +211,29 @@ export default { // this.selections.push(...this.list.slice(idx,idx+len)) // } // } else { - if (this.selections.find(i => i.id === selected.id)) { - let idx = this.selections.indexOf(this.selections.find(i => i.id === selected.id)) - this.selections.splice(idx,1) - } else { - this.selections.push(selected) - } + // const existingIndex = this.selections.findIndex(i => i.id === selected.id) + // if (existingIndex > -1) { + // // 已选中,取消选中 + // this.selections.splice(existingIndex, 1) + // } else { + // // 未选中,添加到选中列表 + // this.selections.push(selected) + // } // } - }, selectAll (selections) { - this.selections = selections + // 确保 selections 是一个数组 + this.selections = Array.isArray(selections) ? [...selections] : [] + + // 强制更新视图,确保选中状态同步 + this.$nextTick(() => { + // 如果取消全选,确保表格的选中状态也被清除 + if (this.selections.length === 0) { + if (this.$refs.xyTable && this.$refs.xyTable.clearSelection) { + this.$refs.xyTable.clearSelection() + } + } + }) }, summary ({ columns,data }) { return columns.map((column,index) => { @@ -242,6 +268,19 @@ export default { this.getPlanProgress(val) }, immediate: true + }, + drawer: { + handler: function(val) { + if (val) { + // 打开抽屉时,清空选中状态 + this.selections = [] + this.$nextTick(() => { + if (this.$refs.xyTable && this.$refs.xyTable.clearSelection) { + this.$refs.xyTable.clearSelection() + } + }) + } + } } }, created() { diff --git a/src/views/statisticalReport/budgetProgress.vue b/src/views/statisticalReport/budgetProgress.vue index 87b60a9..b9db926 100644 --- a/src/views/statisticalReport/budgetProgress.vue +++ b/src/views/statisticalReport/budgetProgress.vue @@ -23,7 +23,7 @@ type="year" placement="bottom-start" style="width: 160px" - @on-change="(e)=>select.year = e" + @on-change="(e)=>{select.year = e,getType()}" /> @@ -37,7 +37,7 @@ type="date" style="width: 160px" > - + @@ -97,6 +97,9 @@ import { import { getparameter } from '@/api/system/dictionary' +import { + index as getPlanType +} from '@/api/budget/plantype.js' import { moneyFormatter } from '@/utils' @@ -152,7 +155,10 @@ export default { prop: 'update_money', width: 180, label: '调整后预算数(元)', - align: 'right' + align: 'right', + formatter: (cell, data, value) => { + return moneyFormatter(value) + } }, { prop: 'use_money_total', @@ -184,7 +190,7 @@ export default { width: 200, fixed: 'right', customFn: (row) => { - const per = (isNaN(Number(row.use_money_total ?? 0)) ? 0 : Number(row.use_money_total ?? 0)) / ((Number(row.update_money)) || (Number(row.money))) + const per = (isNaN(Number(row.use_money_total ?? 0)) ? 0 : Number(row.use_money_total ?? 0)) / ((Number(row.update_money||0)) || (Number(row.money))) return (
{ return item.id === value }) - return res[0]?.value || '未知' + return res[0]?.name || '未知' } }, { @@ -296,10 +302,21 @@ export default { }, async getType() { - const res = await getparameter({ + {/* const res = await getparameter({ number: 'money_way' + }) */} + const res = await getPlanType({ + page_size: 999, + page: 1, + sort_name: 'sort', + sort_type: 'asc', + filter: [{ + key: 'year', + op: 'eq', + value: this.select.year ? this.select.year : '' + }] }) - this.type = res.detail + this.type = res.data }, // 翻页 pageChange(e) { @@ -338,7 +355,7 @@ export default { this.total = res.list.total this.useMoneyTotal = res.use_money_total this.moneyTotal = res.money - this.updateMoneyTotal = res.update_money + this.updateMoneyTotal = res.update_money||0 this.rateTotal = this.toper(this.updateMoneyTotal, this.moneyTotal, this.useMoneyTotal) console.log("list",this.list) @@ -372,7 +389,7 @@ export default { money: parseFloat(pidInfo.money).toFixed(2), type: pidInfo.type, isParent:true, - update_money: parseFloat(pidInfo.update_money).toFixed(2), + update_money: parseFloat(pidInfo.update_money||0).toFixed(2), use_money_total: parseFloat(useMoneyTotal).toFixed(2), // 子项总和 children: children // 保留所有子项 }; @@ -381,7 +398,7 @@ export default { const arrayWithPer = mergedResult.map(row => { // 计算 per(公式:use_money_total / (update_money || money),处理 null 和 NaN) const useMoneyTotal = Number(row.use_money_total ?? 0); // null 视为 0,转换为数字 - const denominator = Number(row.update_money) || Number(row.money); // 取 update_money 或 money + const denominator = Number(row.update_money||0) || Number(row.money); // 取 update_money 或 money const calculation_result = isNaN(useMoneyTotal / denominator) ? 0 : useMoneyTotal / denominator; return { diff --git a/src/views/statisticalReport/quarterlyStatistics.vue b/src/views/statisticalReport/quarterlyStatistics.vue index f599889..4e0ddd3 100644 --- a/src/views/statisticalReport/quarterlyStatistics.vue +++ b/src/views/statisticalReport/quarterlyStatistics.vue @@ -19,8 +19,8 @@ style="width: 130px" > + item.name + }} 年份 @@ -31,7 +31,7 @@ type="year" placement="bottom-start" style="width: 160px" - @on-change="(e)=>select.year = e" + @on-change="(e)=>{select.year = e,getList()}" /> 关键字 @@ -46,7 +46,7 @@ type="primary" style="margin-left: 10px" ghost - @click="" + @click="select = {parameter_detail_id:'',type:1,page:1,page_size:10,keyword:'',is_auth:1,year:''}" >重置