From 87f19361a069d51ef500c7bce7642a6339e44b80 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Tue, 22 Jul 2025 16:02:09 +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 --- src/components/PlanPicker/actualPicker.vue | 56 ++- src/components/PlanPicker/index.vue | 6 +- src/components/PlanPicker/otherPlan.vue | 124 ++++-- src/store/modules/user.js | 11 +- src/views/budget/components/addActual.vue | 8 +- .../components/paymentRegistration.vue | 364 +++++++++++++++--- src/views/contract/contractEdit.vue | 62 ++- src/views/contract/contractList.vue | 61 ++- .../contract/paymentRegistrationList.vue | 4 +- src/views/finance/paymentRegistrationList.vue | 4 +- 10 files changed, 586 insertions(+), 114 deletions(-) diff --git a/src/components/PlanPicker/actualPicker.vue b/src/components/PlanPicker/actualPicker.vue index 204d839..e2a807e 100644 --- a/src/components/PlanPicker/actualPicker.vue +++ b/src/components/PlanPicker/actualPicker.vue @@ -17,7 +17,7 @@ type="year" @on-change="(e) => { planSelect.year = e - getBudgets() + getBudgets(true) }" > { - return row.pid != 0; + return row.pid > 0; }, }, { @@ -211,16 +212,49 @@ export default { planPick (selection, row) { if (row.year != new Date().getFullYear()) { this.$confirm("您选择了非本年预算,是否继续?").catch(_ => { - this.$refs['editorPlanTable'].toggleRowSelection(row) + if (selection.length > 1) { + // 只保留最新选择的项 + this.$refs.editorPlanTable.clearSelection(); + this.$refs.editorPlanTable.toggleRowSelection(selection[selection.length - 1]); + } }) + }else{ + if (selection.length > 1) { + // 只保留最新选择的项 + this.$refs.editorPlanTable.clearSelection(); + this.$refs.editorPlanTable.toggleRowSelection(selection[selection.length - 1]); + } } }, //获取预算计划 - async getBudgets() { + cellClassName({row,column,rowIndex,columnIndex}){ + if(columnIndex===0){ + return 'allSelect' + } + }, + initInputMoney(list) { + if (!Array.isArray(list)) return []; + + return list.map(item => { + // 使用 Vue.set 确保响应式 + this.$set(item, '_inputMoney', 0); + + if (Array.isArray(item.children)) { + item.children = this.initInputMoney(item.children); + } + + return item; + }); + }, + async getBudgets(refresh) { let res = await getBudget(this.planSelect); - res.list.forEach((item) => (item._inputMoney = 0)); + // res.list.forEach((item) => (item._inputMoney = 0)); + this.initInputMoney(res.list) this.plans = res.list; this.planTotal = res.list.total || 0; + if(refresh){ + this.$refs["editorPlanTable"].clearSelection(); + } }, getDepartment() { @@ -291,6 +325,12 @@ export default { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 3ed969d..7008241 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -23,6 +23,7 @@ const getDefaultState = () => { adminId: '', department: {}, role: [], + roles:[] } } @@ -44,6 +45,9 @@ const mutations = { SET_ROLE: (state, role) => { state.role = role }, + SET_ROLES: (state, roles) => { + state.roles = roles + }, SET_ADMIN_ID: (state, id) => { state.adminId = id }, @@ -118,13 +122,18 @@ const actions = { if (!response) { reject('身份验证失败请重新登录') } - const { name, avatar, id, role, department, username } = response + const { name, avatar, id, role,roles, department, username } = response + let rolseArr = [] + roles.map(item=>{ + rolseArr.push(item.name) + }) commit('SET_DEPARTMENT',department) commit('SET_NAME', name) commit('SET_AVATAR', avatar) commit('SET_ADMIN_ID', id) commit('SET_ROLE', role) + commit('SET_ROLES', rolseArr) commit('SET_USERNAME', username) resolve(response) }).catch(error => { diff --git a/src/views/budget/components/addActual.vue b/src/views/budget/components/addActual.vue index 1929ebc..b29c7e2 100644 --- a/src/views/budget/components/addActual.vue +++ b/src/views/budget/components/addActual.vue @@ -175,7 +175,13 @@ }; -