diff --git a/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/service/impl/ActivityReimbursementServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/service/impl/ActivityReimbursementServiceImpl.java index 842d2c7..fa2560d 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/service/impl/ActivityReimbursementServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/service/impl/ActivityReimbursementServiceImpl.java @@ -77,7 +77,9 @@ public class ActivityReimbursementServiceImpl extends BaseServiceImpl + @change="getActivityReimbursementByUser" + :disabled="isDailyReimbursementFixed"> 活动报销 日常报销 @@ -93,13 +94,12 @@ layout("/layouts/platform.html"){ - @@ -338,7 +338,60 @@ layout("/layouts/platform.html"){ components: { "info": INFO, }, + computed: { + isDailyReimbursementFixed() { + return !this.hasSchoolLevelRole() && + this.formData.outlayManageSource === "ACTIVITY_BUDGET_TYPE_ONE"; + }, + + filteredBudgetOption() { + if (this.hasSchoolLevelRole()) { + return this.budgetOption; + } else if (this.formData.outlayManageSource === "ACTIVITY_BUDGET_TYPE_ONE" && + (this.hasUnionRole() || this.hasClubRole())) { + return this.budgetOption.filter(item => { + if (this.hasUnionRole() && this.hasClubRole()) { + return item.isUnionUse === true || item.isClubUse === true; + } + else if (this.hasUnionRole()) { + return item.isUnionUse === true; + } + else if (this.hasClubRole()) { + return item.isClubUse === true; + } + return true; + }); + } + return this.budgetOption; + } + }, methods: { + hasUnionRole() { + return this.$auth.hasRoleOr([ + "UNION_REIMBURSEMENT_MANAGER", + "BRANCH_UNION_CHAIRMAN", + "BRANCH_UNION_WENTI_SPORTS", + "BRANCH_UNION_ADMIN", + "BRANCH_UNION_VICE_CHAIRMAN" + ]); + }, + + hasClubRole() { + return this.$auth.hasRoleOr([ + "CLUB_REIMBURSEMENT_MANAGER", + "CLUB_PRESIDENT" + ]); + }, + + hasSchoolLevelRole() { + return this.$auth.hasRoleOr([ + "SYSADMIN", + "SCHOOL_UNION_ADMIN", + "SCHOOL_UNION_CHAIRMAN", + "SCHOOL_UNION_VICE_CHAIRMAN" + ]); + }, + clubIdChange() { this.$set(this.formData, 'deductionBudgetId', null) const club = this.clubOption.find(v => v.id === this.formData.clubId) @@ -352,6 +405,11 @@ layout("/layouts/platform.html"){ this.$set(this.formData, 'declareId', null) this.$set(this.formData, 'budgets', []) this.$set(this.formData, 'activityTime', []) + + if (val === "ACTIVITY_BUDGET_TYPE_ONE" && !this.hasSchoolLevelRole()) { + this.$set(this.formData, 'activityReimbursementMode', 'daily') + } + if (val === "ACTIVITY_BUDGET_TYPE_ONE") { this.$set(this.formData, "declareUnitName", "校工会") } else if (val === "ACTIVITY_BUDGET_TYPE_TWO") { @@ -369,9 +427,20 @@ layout("/layouts/platform.html"){ }).then(res => { if (res.code === 0) { this.budgetOption = res.data + console.log(this.budgetOption) } }) }, + getBudgetLabel(item) { + if (this.hasSchoolLevelRole()) { + return '预算名称:' + item.activityMatter + ',申报预算:' + item.totalBudgetMoney + ',已使用:' + item.usedBudgetMoney + } else if (this.formData.outlayManageSource === "ACTIVITY_BUDGET_TYPE_ONE" && + (this.hasUnionRole() || this.hasClubRole())) { + return '预算名称:' + item.activityMatter + } else { + return '预算名称:' + item.activityMatter + ',申报预算:' + item.totalBudgetMoney + ',已使用:' + item.usedBudgetMoney + } + }, // 保存 onSave() { this.$confirm("您确定保存吗?", "提示", { @@ -517,34 +586,36 @@ layout("/layouts/platform.html"){ this.$businessTool.getDictOptions("ACTIVITY_BUDGET_TYPE").then(resp => { this.budgetTypeOption = resp const budgetTypeCloseOption = [] - if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])) { + const typeOneOption = resp.find(v => v.code === "ACTIVITY_BUDGET_TYPE_ONE") + if (typeOneOption) { + budgetTypeCloseOption.push(typeOneOption) + } + if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN","SCHOOL_UNION_CHAIRMAN","SCHOOL_UNION_VICE_CHAIRMAN"])) { + const allCodes = [ "ACTIVITY_BUDGET_TYPE_TWO", "ACTIVITY_BUDGET_TYPE_THREE"] + allCodes.forEach(code => { + const option = resp.find(v => v.code === code) + if (option && !budgetTypeCloseOption.some(existing => existing.code === code)) { + budgetTypeCloseOption.push(option) + } + }) } else { - if (this.$auth.hasRoleOr(["SCHOOL_REIMBURSEMENT_MANAGER"])) { - this.budgetTypeOption.map(v => { - if (["ACTIVITY_BUDGET_TYPE_ONE"].includes(v.code)) { - budgetTypeCloseOption.push(v) - } - }) - } - if (this.$auth.hasRoleOr(["UNION_REIMBURSEMENT_MANAGER", "BRANCH_UNION_CHAIRMAN", "BRANCH_UNION_WENTI_SPORTS"])) { - this.budgetTypeOption.map(v => { - if (["ACTIVITY_BUDGET_TYPE_TWO"].includes(v.code)) { - budgetTypeCloseOption.push(v) - } - }) + if (this.$auth.hasRoleOr(["UNION_REIMBURSEMENT_MANAGER", "BRANCH_UNION_CHAIRMAN", "BRANCH_UNION_WENTI_SPORTS","BRANCH_UNION_ADMIN","BRANCH_UNION_VICE_CHAIRMAN"])) { + const typeTwoOption = resp.find(v => v.code === "ACTIVITY_BUDGET_TYPE_TWO") + if (typeTwoOption && !budgetTypeCloseOption.some(existing => existing.code === "ACTIVITY_BUDGET_TYPE_TWO")) { + budgetTypeCloseOption.push(typeTwoOption) + } } if (this.$auth.hasRoleOr(["CLUB_REIMBURSEMENT_MANAGER", "CLUB_PRESIDENT"])) { - this.budgetTypeOption.map(v => { - if (["ACTIVITY_BUDGET_TYPE_THREE"].includes(v.code)) { - budgetTypeCloseOption.push(v) - } - }) + const typeThreeOption = resp.find(v => v.code === "ACTIVITY_BUDGET_TYPE_THREE") + if (typeThreeOption && !budgetTypeCloseOption.some(existing => existing.code === "ACTIVITY_BUDGET_TYPE_THREE")) { + budgetTypeCloseOption.push(typeThreeOption) + } } - this.budgetTypeOption = budgetTypeCloseOption } - }) + this.budgetTypeOption = budgetTypeCloseOption + }) }, }, async created() { diff --git a/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/allocationEdit/index.html b/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/allocationEdit/index.html index 0bca201..2882fa6 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/allocationEdit/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/outlay/activityBudget/allocationEdit/index.html @@ -104,7 +104,7 @@ layout("/layouts/platform.html"){ + width="250">