From 0687ca4751748d2ca0be2e9115d6263b16434217 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Mon, 5 Jan 2026 15:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=AE=97=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/views/budget/seeBudget.vue | 206 ++++++++++++++++-- .../statisticalReport/budgetProgress.vue | 184 +++++++++++++++- .../statisticalReport/quarterlyStatistics.vue | 4 +- 4 files changed, 372 insertions(+), 26 deletions(-) diff --git a/.env.development b/.env.development index 0459c6b..da9c5e3 100644 --- a/.env.development +++ b/.env.development @@ -3,10 +3,10 @@ ENV = 'development' # base api -VUE_APP_DOMIAN=http://192.168.60.99:9003/ +VUE_APP_DOMIAN=http://192.168.60.99:8003/ VUE_APP_BASE_API = '' VUE_APP_UPLOAD=http://192.168.60.99:8003/api/admin/upload-file -VUE_APP_OUT_URL = http://192.168.60.18:8001 +VUE_APP_OUT_URL = http://192.168.60.18:2021 #VUE_APP_DOMIAN=http://192.168.60.99:9003/ #VUE_APP_UPLOAD=http://192.168.60.99:9003/api/admin/upload-file diff --git a/src/views/budget/seeBudget.vue b/src/views/budget/seeBudget.vue index 6426db7..8d4c441 100644 --- a/src/views/budget/seeBudget.vue +++ b/src/views/budget/seeBudget.vue @@ -12,7 +12,7 @@ placement="bottom" :value="select.year" style="width: 130px;" - @on-change="(e)=>select.year = e" + @on-change="(e)=>{select.year = e, changeYear(e)}" /> @@ -20,9 +20,30 @@ 预算类型 - + + + + + @@ -37,7 +58,7 @@ @@ -101,7 +116,8 @@ import { index as getPlanType } from '@/api/budget/plantype.js' import { - moneyFormatter + moneyFormatter, + buildTree } from '@/utils' import { mergeTableRow @@ -110,13 +126,21 @@ import { export default { data() { return { - type: [], // 预算类型 + type: [], // 预算类型(扁平数组) + types: [], // 预算类型(树形结构) + typesbefore: [], // 原始预算类型数据 + checkArr: [], // 树形选择器选中的节点 + defaultProps: { + children: 'children', + label: 'name' + }, departments: [], select: { page_size:999, pageIndex: 1, year: '', type: '', + typeName: '', // 预算类型名称 department: '', showDatePicker: '', start_created_at: '', @@ -249,7 +273,21 @@ export default { await this.getDepartment() this.select.department = Number(this.$route.query.departmentId) || '' - this.select.type = Number(this.$route.query.type) || '' + const routeType = Number(this.$route.query.type) || '' + if (routeType) { + this.select.type = routeType + // 根据 type ID 查找对应的名称 + const typeItem = this.typesbefore.find(item => item.id === routeType) + if (typeItem) { + this.select.typeName = typeItem.name + this.checkArr = [routeType] + this.$nextTick(() => { + if (this.$refs.tree1) { + this.$refs.tree1.setCheckedKeys([routeType]) + } + }) + } + } await this.getPlanProgress() }, @@ -335,6 +373,55 @@ export default { }] }) this.type = res.data + this.typesbefore = res.data + this.types = buildTree(res.data) + }, + changeType(e) { + if (!e) { + this.select.type = '' + this.select.typeName = '' + this.checkArr = [] + if (this.$refs.tree1) { + this.$refs.tree1.setCheckedKeys([]) + } + } + }, + getSelectedNodes(data, node, ref) { + const ref_data = ref || 'tree1' + this.$refs[ref_data].setCheckedKeys([]) + this.checkArr = [] + if (data.children && data.children.length > 0) { + this.$Message.warning('当前节点不可选择') + this.select.type = '' + this.select.typeName = '' + this.$refs[ref_data].setCheckedKeys([]) + return + } + this.$refs[ref_data].setCheckedKeys([]) // 删除所有选中节点 + this.$refs[ref_data].setCheckedNodes([data]) // 选中已选中节点 + this.select.type = data.id + this.select.typeName = data.name + this.checkArr = [data.id] + this.$forceUpdate() + }, + resetSelect() { + this.select = { + pageIndex: 1, + year: '', + type: '', + typeName: '', + department: '', + showDatePicker: '', + start_created_at: '', + end_created_at: '', + sort_type: 'asc', + name: '', + page_size: 999 + } + this.checkArr = [] + if (this.$refs.tree1) { + this.$refs.tree1.setCheckedKeys([]) + } }, // 翻页 pageChange(e) { @@ -432,4 +519,87 @@ export default { + + diff --git a/src/views/statisticalReport/quarterlyStatistics.vue b/src/views/statisticalReport/quarterlyStatistics.vue index 83e2429..6e57191 100644 --- a/src/views/statisticalReport/quarterlyStatistics.vue +++ b/src/views/statisticalReport/quarterlyStatistics.vue @@ -10,7 +10,7 @@ - 资金性质分类 + 年份