diff --git a/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/controller/ActivityReimbursementApplyController.java b/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/controller/ActivityReimbursementApplyController.java index b3c19e9..aaf7cc9 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/controller/ActivityReimbursementApplyController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/controller/ActivityReimbursementApplyController.java @@ -6,9 +6,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Dict; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; import com.budwk.app.base.annotation.SLog; -import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.result.Result; import com.budwk.app.base.utils.PageUtil; @@ -96,7 +94,7 @@ public class ActivityReimbursementApplyController { @SaCheckPermission(value = {"activityReimbursement.apply", "h5.activityReimbursement.apply"}, mode = SaMode.OR) @SLog(tag = "活动申报", msg = "保存申请,申请人: ${args[0].username}") public Result save(@Param("data") ActivityReimbursementInfo activityReimbursementInfo) { - Result scopeResult = validateTemporaryUnionReimbursement(activityReimbursementInfo); + Result scopeResult = validateReimbursementIdentity(activityReimbursementInfo); if (scopeResult != null) { return scopeResult; } @@ -129,7 +127,7 @@ public class ActivityReimbursementApplyController { @SaCheckPermission(value = {"activityReimbursement.apply", "h5.activityReimbursement.apply"}, mode = SaMode.OR) @SLog(tag = "活动申报", msg = "提交申请,申请人: ${args[0].username}") public Result submit(@Param("data") ActivityReimbursementInfo activityReimbursementInfo) { - Result scopeResult = validateTemporaryUnionReimbursement(activityReimbursementInfo); + Result scopeResult = validateReimbursementIdentity(activityReimbursementInfo); if (scopeResult != null) { return scopeResult; } @@ -161,9 +159,8 @@ public class ActivityReimbursementApplyController { args.set(FlowConst.FORM_DATA, activityReimbursementInfo); args.set("outlayManageSource", activityReimbursementInfo.getOutlayManageSource()); args.set("actualMoney", activityReimbursementInfo.getActualMoney()); - // 临时报销人通过流程图中的“分工会代报销”独立分支进入财务审核,保留表单的分工会身份。 - args.set("next", AuthUtil.hasRole(RoleConstant.UNION_TEMP_REIMBURSEMENT_APPLICANT.name()) - ? "unionTemp" : activityReimbursementInfo.getReimbursementIdentity()); + // 审批分支由本次选择的报销身份决定,不因兼有临时报销角色而改变。 + args.set("next", activityReimbursementInfo.getReimbursementIdentity()); args.set("clubId",activityReimbursementInfo.getClubId()); ProcessInstance instance = flowEngine.startProcessInstanceByKey("HDBX", activityReimbursementInfo.getId(), SecurityUtil.getUserId(), args); @@ -182,7 +179,7 @@ public class ActivityReimbursementApplyController { @SaCheckPermission(value = {"activityReimbursement.apply", "h5.activityReimbursement.apply"}, mode = SaMode.OR) @SLog(tag = "活动申报", msg = "重新提交申请,申请人: ${args[0].username}") public Result submitAgain(@Param("data") ActivityReimbursementInfo activityReimbursementInfo, @Param("taskId") Long taskId) { - Result scopeResult = validateTemporaryUnionReimbursement(activityReimbursementInfo); + Result scopeResult = validateReimbursementIdentity(activityReimbursementInfo); if (scopeResult != null) { return scopeResult; } @@ -207,69 +204,92 @@ public class ActivityReimbursementApplyController { Dict dict = Dict.create(); dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId); dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode()); - if (AuthUtil.hasRole(RoleConstant.UNION_TEMP_REIMBURSEMENT_APPLICANT.name())) { - ProcessTask processTask = flowEngine.processTaskService().getById(taskId); - ProcessInstance processInstance = flowEngine.processInstanceService().getById(processTask.getProcessInstanceId()); - String originalNext = JSONUtil.parseObj(processInstance.getVariable()).getStr("next"); - // 新申请重提沿用独立分支;旧实例仍绑定旧定义,继续使用其已有的财务分支。 - dict.set("next", Objects.equals(originalNext, "unionTemp") ? "unionTemp" : "school"); - } + dict.set("next", activityReimbursementInfo.getReimbursementIdentity()); flowCommonService.executeTask(dict); return Result.success(); } /** - * 临时报销人按本分工会校验申请及实际扣款预算,防止篡改身份、经费类型或预算ID绕过限制。 + * 按角色关联的菜单权限校验报销身份,代报销沿用所选经费的预算范围。 */ - private Result validateTemporaryUnionReimbursement(ActivityReimbursementInfo info) { - if (!AuthUtil.hasRole(RoleConstant.UNION_TEMP_REIMBURSEMENT_APPLICANT.name())) { - return null; + private Result validateReimbursementIdentity(ActivityReimbursementInfo info) { + if (info == null || StrUtil.isBlank(info.getReimbursementIdentity())) { + return Result.error("请选择报销身份"); } - if (info == null || !Objects.equals(info.getReimbursementIdentity(), "union") - || !Objects.equals(info.getOutlayManageSource(), "ACTIVITY_BUDGET_TYPE_TWO") - || StrUtil.isNotBlank(info.getClubId())) { - return Result.error("分工会临时报销人仅可使用分工会身份申请分工会经费报销"); + String permission = switch (info.getReimbursementIdentity()) { + case "school" -> "activityReimbursement.apply.schoolHas"; + case "union" -> "activityReimbursement.apply.unionHas"; + case "club" -> "activityReimbursement.apply.clubHas"; + case "unionTemp" -> "activityReimbursement.apply.unionTempHas"; + default -> null; + }; + if (permission == null || !AuthUtil.hasPermission(permission)) { + return Result.error("无权使用所选报销身份"); + } + if (!Objects.equals(info.getReimbursementIdentity(), "unionTemp")) { + return null; } String unionId = SecurityUtil.getUnionId(); if (StrUtil.isBlank(unionId)) { - return Result.error("当前用户未关联分工会,无法申请报销"); + return Result.error("当前用户未关联分工会,无法申请代报销"); } if (StrUtil.isNotBlank(info.getId())) { ActivityReimbursementInfo savedInfo = dao.fetch(ActivityReimbursementInfo.class, info.getId()); if (savedInfo == null || !Objects.equals(savedInfo.getUserId(), SecurityUtil.getUserId()) - || !Objects.equals(savedInfo.getUnionId(), unionId) - || !Objects.equals(savedInfo.getReimbursementIdentity(), "union") - || !Objects.equals(savedInfo.getOutlayManageSource(), "ACTIVITY_BUDGET_TYPE_TWO")) { - return Result.error("仅可修改本人所在分工会的分工会经费报销申请"); + || !Objects.equals(savedInfo.getUnionId(), unionId)) { + return Result.error("仅可修改本人所在分工会的报销申请"); } } + String source = info.getOutlayManageSource(); + String activityType; + if (Objects.equals(source, "ACTIVITY_BUDGET_TYPE_ONE")) { + activityType = "SCHOOL_UNION"; + } else if (Objects.equals(source, "ACTIVITY_BUDGET_TYPE_TWO")) { + activityType = "BRANCH_UNION"; + } else if (Objects.equals(source, "ACTIVITY_BUDGET_TYPE_THREE") + && (AuthUtil.hasPermission("activityReimbursement.apply.schoolHas") + || AuthUtil.hasPermission("activityReimbursement.apply.clubHas"))) { + activityType = "CLUB"; + } else { + return Result.error("请选择有权限使用的经费类型"); + } if (StrUtil.isBlank(info.getDeductionBudgetId())) { - return Result.error("请选择本分工会的扣款预算"); + return Result.error("请选择扣款预算"); } ActivityBudget budget = dao.fetch(ActivityBudget.class, info.getDeductionBudgetId()); - if (budget == null || !Objects.equals(budget.getOutlayManageSource(), "ACTIVITY_BUDGET_TYPE_TWO") - || !Objects.equals(budget.getUnionId(), unionId)) { - return Result.error("扣款预算必须属于本分工会的分工会经费"); + // 使用原有预算查询的数据范围,并保留校工会预算的分工会、协会可用标记。 + List availableBudgets = activityReimbursementService.getBudgetMoney(source, info.getClubId()); + if (budget == null || !Objects.equals(budget.getOutlayManageSource(), source) + || availableBudgets.stream().noneMatch(v -> Objects.equals(v.getString("id"), budget.getId()))) { + return Result.error("扣款预算不属于所选经费的可用范围"); + } + if (Objects.equals(source, "ACTIVITY_BUDGET_TYPE_ONE") + && !AuthUtil.hasPermission("activityReimbursement.apply.schoolHas") + && !Boolean.TRUE.equals(budget.getIsUnionUse()) + && !(AuthUtil.hasPermission("activityReimbursement.apply.clubHas") + && Boolean.TRUE.equals(budget.getIsClubUse()))) { + return Result.error("该校工会预算未开放给分工会或协会使用"); } if (Objects.equals(info.getActivityReimbursementMode(), "activity")) { if (StrUtil.isBlank(info.getDeclareId())) { - return Result.error("请选择本分工会的申报活动"); + return Result.error("请选择申报活动"); } - // 申报通过活动类型区分工会,实际扣款经费类型及归属已由上方预算校验约束。 ActivityDeclareInfo declareInfo = dao.fetch(ActivityDeclareInfo.class, info.getDeclareId()); - if (declareInfo == null || !Objects.equals(declareInfo.getUnionId(), unionId) - || !Objects.equals(declareInfo.getActivityType(), "BRANCH_UNION")) { - return Result.error("仅可报销本分工会使用分工会经费的活动"); + if (declareInfo == null || !Objects.equals(declareInfo.getActivityType(), activityType) + || (Objects.equals(source, "ACTIVITY_BUDGET_TYPE_TWO") + && !Objects.equals(declareInfo.getUnionId(), unionId)) + || (Objects.equals(source, "ACTIVITY_BUDGET_TYPE_THREE") + && !Objects.equals(declareInfo.getClubId(), info.getClubId()))) { + return Result.error("申报活动不属于所选经费的可用范围"); } } else if (Objects.equals(info.getActivityReimbursementMode(), "daily")) { info.setDeclareId(null); } else { return Result.error("请选择报销模式"); } - // 分工会归属以登录用户为准,供后续审批流程使用。 info.setUnionId(unionId); - info.setActivityType("BRANCH_UNION"); + info.setActivityType(activityType); return null; } @@ -278,17 +298,11 @@ public class ActivityReimbursementApplyController { @SaCheckPermission(value = {"activityReimbursement.apply", "h5.activityReimbursement.apply"}, mode = SaMode.OR) public Result getActivityReimbursementByUser(String id, String outlayManageSource, String clubId) { String activityType = ""; - boolean temporaryUnionApplicant = AuthUtil.hasRole(RoleConstant.UNION_TEMP_REIMBURSEMENT_APPLICANT.name()); - if (temporaryUnionApplicant && (!Objects.equals(outlayManageSource, "ACTIVITY_BUDGET_TYPE_TWO") - || StrUtil.isBlank(SecurityUtil.getUnionId()))) { - return Result.error("分工会临时报销人仅可申请本分工会经费报销"); - } if (StrUtil.isNotBlank(id)) { ActivityReimbursementInfo reimbursementInfo = dao.fetch(ActivityReimbursementInfo.class, id); - if (temporaryUnionApplicant && (reimbursementInfo == null - || !Objects.equals(reimbursementInfo.getUserId(), SecurityUtil.getUserId()) - || !Objects.equals(reimbursementInfo.getUnionId(), SecurityUtil.getUnionId()) - || !Objects.equals(reimbursementInfo.getOutlayManageSource(), "ACTIVITY_BUDGET_TYPE_TWO"))) { + if (reimbursementInfo == null || (Objects.equals(reimbursementInfo.getReimbursementIdentity(), "unionTemp") + && (!Objects.equals(reimbursementInfo.getUserId(), SecurityUtil.getUserId()) + || !Objects.equals(reimbursementInfo.getUnionId(), SecurityUtil.getUnionId())))) { return Result.error("无权访问该报销申请"); } if (Objects.equals(reimbursementInfo.getActivityReimbursementMode(), "daily")) { @@ -412,20 +426,7 @@ public class ActivityReimbursementApplyController { @ApiOperation("获取申报的记录") @SaCheckPermission(value = {"activityReimbursement.apply", "h5.activityReimbursement.apply"}, mode = SaMode.OR) public Result getBudgetByYear(String outlayManageSource, String clubId) { - boolean temporaryUnionApplicant = AuthUtil.hasRole(RoleConstant.UNION_TEMP_REIMBURSEMENT_APPLICANT.name()); - if (temporaryUnionApplicant && (!Objects.equals(outlayManageSource, "ACTIVITY_BUDGET_TYPE_TWO") - || StrUtil.isBlank(SecurityUtil.getUnionId()))) { - return Result.error("分工会临时报销人仅可申请本分工会经费报销"); - } List budgetMoney = activityReimbursementService.getBudgetMoney(outlayManageSource, clubId); - if (temporaryUnionApplicant) { - // 兼有系统管理员角色时也必须限制为本分工会预算,不改变原预算金额展示规则。 - List unionBudgetIds = dao.query(ActivityBudget.class, - Cnd.where("unionId", "=", SecurityUtil.getUnionId()) - .and("outlayManageSource", "=", "ACTIVITY_BUDGET_TYPE_TWO")) - .stream().map(ActivityBudget::getId).toList(); - budgetMoney = budgetMoney.stream().filter(v -> unionBudgetIds.contains(v.getString("id"))).toList(); - } return Result.success(budgetMoney); } diff --git a/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/models/ActivityReimbursementInfo.java b/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/models/ActivityReimbursementInfo.java index d9f2571..df52fc3 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/models/ActivityReimbursementInfo.java +++ b/src/main/java/com/budwk/app/zhgh/activity/declarereimbursement/reimbursement/models/ActivityReimbursementInfo.java @@ -37,7 +37,7 @@ public class ActivityReimbursementInfo extends ActivityDeclareInfo { private String declareId; @Column - @Comment("报销身份(school/union/club)") + @Comment("报销身份(school/union/club/unionTemp,unionTemp为分工会代报销)") @ColDefine(type = ColType.VARCHAR, width = 30) private String reimbursementIdentity; diff --git a/src/main/resources/db/menu/init_union_temp_reimbursement_role.sql b/src/main/resources/db/menu/init_union_temp_reimbursement_role.sql index 2b24b62..7ec9fa6 100644 --- a/src/main/resources/db/menu/init_union_temp_reimbursement_role.sql +++ b/src/main/resources/db/menu/init_union_temp_reimbursement_role.sql @@ -1,18 +1,47 @@ --- 分工会临时报销人:复用现有报销菜单;经费范围由申请页面及后端按角色编码共同限制。 +-- 分工会临时报销人:新增分工会代报销身份权限,身份选项由后台角色关联菜单控制。 -- 适用于已配置费用报销菜单的 MySQL 数据库,可重复执行,不关联具体用户。 START TRANSACTION; INSERT INTO sys_role (id, name, code, aliasName, disabled, unitid, note, sort, createdBy, createdAt, updatedBy, updatedAt, delFlag) SELECT REPLACE(UUID(), '-', ''), '分工会临时报销人', 'UNION_TEMP_REIMBURSEMENT_APPLICANT', - '分工会临时报销人', 0, '', '仅可使用分工会身份申请本分工会经费报销', 0, + '分工会临时报销人', 0, '', '报销身份与经费范围由角色关联的菜单权限决定', 0, '', FLOOR(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000), '', FLOOR(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000), 0 WHERE NOT EXISTS ( SELECT 1 FROM sys_role WHERE code = 'UNION_TEMP_REIMBURSEMENT_APPLICANT' ); --- 只授权报销申请、我的报销及其导航父级,不复制原报销角色的审批等权限。 +-- 参照分工会(unionHas)身份权限创建同级菜单,沿用类型、平台及所属模块。 +-- 每级路径为四位,追加在同级最后;不重复创建,也不复制校工会或分工会身份授权。 +INSERT INTO sys_menu + (id, parentId, path, name, initialPinyinName, aliasName, type, href, target, icon, picIcon, + showit, disabled, permission, note, location, hasChildren, platform, moduleId, + isRecommendApp, isRecommendService, createdBy, createdAt, updatedBy, updatedAt, delFlag) +SELECT REPLACE(UUID(), '-', ''), template.parentId, + CONCAT(LEFT(template.path, CHAR_LENGTH(template.path) - 4), + LPAD(COALESCE(siblings.maxSuffix, 0) + 1, 4, '0')), + '分工会代报销', 'F', '分工会代报销', template.type, template.href, template.target, + template.icon, template.picIcon, template.showit, 0, + 'activityReimbursement.apply.unionTempHas', + '报销身份:分工会代报销,申请直接进入校工会财务审核', + COALESCE(siblings.maxLocation, 0) + 1, 0, template.platform, template.moduleId, + 0, 0, '', FLOOR(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000), + '', FLOOR(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000), 0 +FROM sys_menu template +LEFT JOIN ( + SELECT parentId, MAX(CAST(RIGHT(path, 4) AS UNSIGNED)) AS maxSuffix, + MAX(location) AS maxLocation + FROM sys_menu + GROUP BY parentId +) siblings ON siblings.parentId = template.parentId +WHERE template.permission = 'activityReimbursement.apply.unionHas' + AND NOT EXISTS ( + SELECT 1 FROM sys_menu existing + WHERE existing.permission = 'activityReimbursement.apply.unionTempHas' + ); + +-- 默认给临时报销角色关联代报销身份、报销申请、我的报销及导航父级,其他身份由后台自行配置。 -- activityDeclare 用于报销选取活动后读取申报详情,不授权活动申报、预算申报或审核子菜单。 -- 同时关联已有的手机端报销菜单;通过路径前缀补齐导航父级,不授权同级菜单。 INSERT INTO sys_role_menu (roleId, menuId) @@ -20,6 +49,7 @@ SELECT DISTINCT role.id, menu.id FROM sys_role role JOIN sys_menu entry ON entry.permission IN ( 'activityReimbursement.apply', + 'activityReimbursement.apply.unionTempHas', 'activityReimbursement.mine', 'h5.activityReimbursement.apply', 'h5.activityReimbursement.mine', @@ -46,7 +76,7 @@ INSERT INTO sys_dict createdBy, createdAt, updatedBy, updatedAt, delFlag) SELECT REPLACE(UUID(), '-', ''), parent.id, CONCAT(parent.path, LPAD(COALESCE(siblings.maxSuffix, 0) + 1, 4, '0')), - '分工会临时报销人', '仅可申请本分工会经费报销', 'UNION_TEMP_REIMBURSEMENT_APPLICANT', + '分工会临时报销人', '可分配分工会代报销等报销身份权限', 'UNION_TEMP_REIMBURSEMENT_APPLICANT', 0, COALESCE(siblings.maxLocation, 0) + 1, 0, '', FLOOR(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000), '', FLOOR(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000), 0 @@ -64,4 +94,12 @@ WHERE parent.code = 'BRANCH_UNION_ROLES' AND existing.code = 'UNION_TEMP_REIMBURSEMENT_APPLICANT' ); +UPDATE sys_role +SET note = '报销身份与经费范围由角色关联的菜单权限决定' +WHERE code = 'UNION_TEMP_REIMBURSEMENT_APPLICANT'; + +UPDATE sys_dict +SET remark = '可分配分工会代报销等报销身份权限' +WHERE code = 'UNION_TEMP_REIMBURSEMENT_APPLICANT'; + COMMIT; diff --git a/src/main/resources/views/platform/zhgh/activity/declarereimbursement/reimbursement/apply/index.html b/src/main/resources/views/platform/zhgh/activity/declarereimbursement/reimbursement/apply/index.html index 6c85ac6..dc421b4 100644 --- a/src/main/resources/views/platform/zhgh/activity/declarereimbursement/reimbursement/apply/index.html +++ b/src/main/resources/views/platform/zhgh/activity/declarereimbursement/reimbursement/apply/index.html @@ -361,11 +361,11 @@ layout("/layouts/platform.html"){ if (this.hasSchoolLevelRole()) { return this.budgetOption; } else if (this.formData.outlayManageSource === "ACTIVITY_BUDGET_TYPE_ONE") { - if (this.hasUnionRole() || this.hasClubRole()) { + if ((this.hasUnionRole() || this.hasUnionTempRole()) || this.hasClubRole()) { return this.budgetOption.filter(item => { - if (this.hasUnionRole() && this.hasClubRole()) { + if ((this.hasUnionRole() || this.hasUnionTempRole()) && this.hasClubRole()) { return item.isUnionUse === true || item.isClubUse === true; - } else if (this.hasUnionRole()) { + } else if ((this.hasUnionRole() || this.hasUnionTempRole())) { return item.isUnionUse === true; } else if (this.hasClubRole()) { return item.isClubUse === true; @@ -380,8 +380,8 @@ layout("/layouts/platform.html"){ } }, methods: { - isTemporaryUnionApplicant() { - return this.$auth.hasRole('UNION_TEMP_REIMBURSEMENT_APPLICANT') + hasUnionTempRole() { + return this.$auth.hasPermission('activityReimbursement.apply.unionTempHas') }, hasUnionRole() { return this.$auth.hasPermission('activityReimbursement.apply.unionHas') @@ -406,7 +406,7 @@ layout("/layouts/platform.html"){ this.$set(this.formData, "unionId", this.$store.state.user.union.id) if (val === "school") { this.$set(this.formData, "declareUnitName", "校工会") - } else if (val === "union") { + } else if (val === "union" || val === "unionTemp") { this.$set(this.formData, "declareUnitName", this.$store.state.user.union.name) } }, @@ -439,7 +439,7 @@ layout("/layouts/platform.html"){ if (this.hasSchoolLevelRole()) { return '预算名称:' + item.activityMatter + ',申报预算:' + item.totalBudgetMoney + ',已使用:' + item.usedBudgetMoney } else if (this.formData.outlayManageSource === "ACTIVITY_BUDGET_TYPE_ONE" && - (this.hasUnionRole() || this.hasClubRole())) { + ((this.hasUnionRole() || this.hasUnionTempRole()) || this.hasClubRole())) { return '预算名称:' + item.activityMatter } else { return '预算名称:' + item.activityMatter + ',申报预算:' + item.totalBudgetMoney + ',已使用:' + item.usedBudgetMoney @@ -568,10 +568,8 @@ layout("/layouts/platform.html"){ } this.formData.id = this.bizId ? this.bizId : null - if (this.isTemporaryUnionApplicant()) { - // 申报记录的ID不能作为报销主键,单独保留关联活动以供后端校验。 - this.$set(this.formData, 'declareId', id) - } + // 申报记录的ID不能作为报销主键,单独保留关联活动以供后端校验。 + this.$set(this.formData, 'declareId', id) if (data.planStartTime && data.planEndTime) { this.formData.planDate = [data.planStartTime, data.planEndTime] @@ -609,15 +607,6 @@ layout("/layouts/platform.html"){ }, initBudgetType() { this.$businessTool.getDictOptions("ACTIVITY_BUDGET_TYPE").then(resp => { - // 临时报销人即使兼有其他角色,也只能使用分工会经费。 - if (this.isTemporaryUnionApplicant()) { - this.budgetTypeOption = resp.filter(v => v.code === "ACTIVITY_BUDGET_TYPE_TWO") - if (!this.bizId) { - this.$set(this.formData, 'outlayManageSource', 'ACTIVITY_BUDGET_TYPE_TWO') - this.outlayManageSourceChange('ACTIVITY_BUDGET_TYPE_TWO') - } - return - } this.budgetTypeOption = resp const budgetTypeCloseOption = [] const typeOneOption = resp.find(v => v.code === "ACTIVITY_BUDGET_TYPE_ONE") @@ -634,7 +623,7 @@ layout("/layouts/platform.html"){ } }) } else { - if (this.$auth.hasPermission('activityReimbursement.apply.unionHas')) { + if (this.hasUnionRole() || this.hasUnionTempRole()) { 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) @@ -652,15 +641,8 @@ layout("/layouts/platform.html"){ }) }, initReimbursementIdentity() { - if (this.isTemporaryUnionApplicant()) { - this.reimbursementIdentityOption = [{name: "分工会", code: "union"}] - if (!this.bizId) { - this.$set(this.formData, 'reimbursementIdentity', 'union') - if (this.$store.state.user.union) { - this.reimbursementIdentityChange('union') - } - } - return + if (this.hasUnionTempRole()) { + this.reimbursementIdentityOption.push({name: "分工会代报销", code: "unionTemp"}) } if (this.$auth.hasPermission('activityReimbursement.apply.schoolHas')) { this.reimbursementIdentityOption.push({name: "校工会", code: "school"}) diff --git a/src/main/resources/views/platform/zhghh5/activity/declarereimbursement/reimbursement/apply/index.html b/src/main/resources/views/platform/zhghh5/activity/declarereimbursement/reimbursement/apply/index.html index 5a40408..1ebae2a 100644 --- a/src/main/resources/views/platform/zhghh5/activity/declarereimbursement/reimbursement/apply/index.html +++ b/src/main/resources/views/platform/zhghh5/activity/declarereimbursement/reimbursement/apply/index.html @@ -245,12 +245,12 @@ layout("/layouts/platform_h5.html"){ return this.budgetOption } if (this.formData.outlayManageSource === 'ACTIVITY_BUDGET_TYPE_ONE') { - if (this.hasUnionRole() || this.hasClubRole()) { + if ((this.hasUnionRole() || this.hasUnionTempRole()) || this.hasClubRole()) { return this.budgetOption.filter((item) => { - if (this.hasUnionRole() && this.hasClubRole()) { + if ((this.hasUnionRole() || this.hasUnionTempRole()) && this.hasClubRole()) { return item.isUnionUse === true || item.isClubUse === true } - if (this.hasUnionRole()) { + if ((this.hasUnionRole() || this.hasUnionTempRole())) { return item.isUnionUse === true } if (this.hasClubRole()) { @@ -276,8 +276,8 @@ layout("/layouts/platform_h5.html"){ } }, methods: { - isTemporaryUnionApplicant() { - return this.$auth.hasRole('UNION_TEMP_REIMBURSEMENT_APPLICANT') + hasUnionTempRole() { + return this.$auth.hasPermission('activityReimbursement.apply.unionTempHas') }, hasUnionRole() { return this.$auth.hasPermission('activityReimbursement.apply.unionHas') @@ -366,7 +366,7 @@ layout("/layouts/platform_h5.html"){ this.$set(this.formData, 'unionId', this.$store.state.user.union.id) if (val === 'school') { this.$set(this.formData, 'declareUnitName', '校工会') - } else if (val === 'union') { + } else if (val === 'union' || val === 'unionTemp') { this.$set(this.formData, 'declareUnitName', this.$store.state.user.union.name) } else if (val === 'club') { this.$set(this.formData, 'declareUnitName', this.formData.clubName || '') @@ -412,7 +412,7 @@ layout("/layouts/platform_h5.html"){ if (this.hasSchoolLevelRole()) { return this.getBudgetMoneyText(item) + ',名称:' + shortName } - if (this.formData.outlayManageSource === 'ACTIVITY_BUDGET_TYPE_ONE' && (this.hasUnionRole() || this.hasClubRole())) { + if (this.formData.outlayManageSource === 'ACTIVITY_BUDGET_TYPE_ONE' && ((this.hasUnionRole() || this.hasUnionTempRole()) || this.hasClubRole())) { return '名称:' + shortName } return this.getBudgetMoneyText(item) + ',名称:' + shortName @@ -743,6 +743,7 @@ layout("/layouts/platform_h5.html"){ const identityNameMap = { school: '校工会', union: '分工会', + unionTemp: '分工会代报销', club: '协会' } this.$set(this.formData, 'reimbursementIdentityName', identityNameMap[this.formData.reimbursementIdentity] || '') @@ -789,16 +790,6 @@ layout("/layouts/platform_h5.html"){ }, initBudgetType() { return this.$businessTool.getDictOptions('ACTIVITY_BUDGET_TYPE').then((resp) => { - // 与电脑端保持一致,临时报销人的经费范围不叠加其他角色权限。 - if (this.isTemporaryUnionApplicant()) { - this.budgetTypeOption = resp.filter((item) => item.code === 'ACTIVITY_BUDGET_TYPE_TWO') - if (!this.bizId) { - this.$set(this.formData, 'outlayManageSource', 'ACTIVITY_BUDGET_TYPE_TWO') - this.$set(this.formData, 'outlayManageSourceName', '分工会经费') - this.outlayManageSourceChange('ACTIVITY_BUDGET_TYPE_TWO') - } - return - } const result = [] const typeOne = resp.find((item) => item.code === 'ACTIVITY_BUDGET_TYPE_ONE') if (typeOne) { @@ -811,7 +802,7 @@ layout("/layouts/platform_h5.html"){ } }) } else { - if (this.hasUnionRole()) { + if (this.hasUnionRole() || this.hasUnionTempRole()) { const typeTwo = resp.find((item) => item.code === 'ACTIVITY_BUDGET_TYPE_TWO') if (typeTwo) { result.push(typeTwo) @@ -828,16 +819,8 @@ layout("/layouts/platform_h5.html"){ }) }, initReimbursementIdentity() { - if (this.isTemporaryUnionApplicant()) { - this.reimbursementIdentityOption = [{name: '分工会', code: 'union'}] - if (!this.bizId) { - this.$set(this.formData, 'reimbursementIdentity', 'union') - this.$set(this.formData, 'reimbursementIdentityName', '分工会') - if (this.$store.state.user.union) { - this.reimbursementIdentityChange('union') - } - } - return + if (this.hasUnionTempRole()) { + this.reimbursementIdentityOption.push({name: '分工会代报销', code: 'unionTemp'}) } if (this.hasSchoolLevelRole()) { this.reimbursementIdentityOption.push({name: '校工会', code: 'school'})