From c305bc5dfe69a2c0f36c21fcf0ab0d14dc55e560 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 3 Jun 2026 11:07:12 +0800 Subject: [PATCH] commit --- .../controller/CondolenceApplyController.java | 28 ++++- .../info/MemberInfoBoardController.java | 9 +- .../member/service/MemberInfoService.java | 7 ++ .../service/impl/MemberInfoServiceImpl.java | 12 ++ .../param/WelfareFilterUserPageForm.java | 3 + .../service/impl/WelfareListServiceImpl.java | 115 +++++++++++++----- .../staffmanage/member/info/board/index.html | 45 +++++-- .../zhgh/welfare/welfareUser/addUser.js | 54 +++++--- .../zhgh/welfare/welfareUser/index.html | 27 +++- 9 files changed, 229 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceApplyController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceApplyController.java index f43681a4..03889f07 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceApplyController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceApplyController.java @@ -76,6 +76,7 @@ public class CondolenceApplyController { @SaCheckPermission(value = {"condolence.apply", "h5.condolence.apply"}, mode = SaMode.OR) @SLog(tag = "职工慰问系统-慰问申请", msg = "保存申请") public Result save(@Param("data") Condolence condolence) { + validateHelpUserScope(condolence); if(StrUtil.isBlank(condolence.getId())) condolence.setCreateTime(DateUtil.now()); dao.insertOrUpdate(condolence); return Result.success(); @@ -87,6 +88,7 @@ public class CondolenceApplyController { @SLog(tag = "职工慰问系统-慰问申请", msg = "提交申请") @Aop(TransAop.READ_COMMITTED) public Result submit(@Param("data") Condolence condolence) { + validateHelpUserScope(condolence); if(StrUtil.isBlank(condolence.getId())) condolence.setCreateTime(DateUtil.now()); dao.insertOrUpdate(condolence); // 开启流程实例 @@ -108,6 +110,7 @@ public class CondolenceApplyController { @Aop(TransAop.READ_COMMITTED) @SaCheckPermission(value = {"condolence.apply", "h5.condolence.apply"}, mode = SaMode.OR) public Result submitAgain(@Param("data") Condolence condolence, @Param("taskId") Long taskId) { + validateHelpUserScope(condolence); dao.insertOrUpdate(condolence); Dict dict = Dict.create(); @@ -144,16 +147,37 @@ public class CondolenceApplyController { seg.or(View_user::getUsername, "like", "%" + keyword + "%"); cnd.and(seg); } + cnd.and(View_user::getMember, "=", 1); if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { - if(AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { + if (StrUtil.isNotBlank(SecurityUtil.getUnionId())) { cnd.and(View_user::getUnionId, "=", SecurityUtil.getUnionId()); } else { cnd.and(View_user::getId, "=", SecurityUtil.getUserId()); } - } sql.setCondition(cnd); Pagination pagination = condolenceService.listPageMap(1, 50, sql); return Result.success(pagination.getList()); } + + /** + * 校验慰问对象范围:只能选择会员,非校级角色只能选择本工会会员。 + */ + private void validateHelpUserScope(Condolence condolence) { + if (condolence == null || StrUtil.isBlank(condolence.getHelpUserId())) { + return; + } + View_user helpUser = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", condolence.getHelpUserId())); + if (helpUser == null) { + throw new RuntimeException("慰问对象不存在"); + } + if (!Integer.valueOf(1).equals(helpUser.getMember())) { + throw new RuntimeException("慰问对象必须是会员"); + } + if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { + if (StrUtil.isBlank(SecurityUtil.getUnionId()) || !SecurityUtil.getUnionId().equals(helpUser.getUnionId())) { + throw new RuntimeException("只能为本工会会员填写慰问申请"); + } + } + } } diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/member/controller/info/MemberInfoBoardController.java b/src/main/java/com/budwk/app/zhgh/staffmanage/member/controller/info/MemberInfoBoardController.java index 3dced777..1f8061b5 100644 --- a/src/main/java/com/budwk/app/zhgh/staffmanage/member/controller/info/MemberInfoBoardController.java +++ b/src/main/java/com/budwk/app/zhgh/staffmanage/member/controller/info/MemberInfoBoardController.java @@ -53,14 +53,12 @@ public class MemberInfoBoardController { } /** - * @return 今年和去年的会员数 + * @return 今年会员数、未缴费会员数和去年的会员数 */ @At @SaCheckPermission(value = {"member.info.board", "h5.member.info.board"}, mode = SaMode.OR) public Result memberNumber() { - int memberNum = memberInfoService.count(Sqls.create("select count(1) from sys_user where member = 1")); - int lastYearMemberNum = memberInfoService.count(Sqls.create("select count(1) from member_history where year = year(now()) -1 ")); - return Result.success(Map.of("memberNum", memberNum, "lastYearMemberNum", lastYearMemberNum)); + return Result.success(memberInfoService.getBoardMemberNumber()); } /** @@ -124,7 +122,8 @@ public class MemberInfoBoardController { SELECT un.name as unionname, un.unionCode, - ( SELECT count( 1 ) FROM vw_user WHERE member = 1 and unionId = un.id ) `value` + ( SELECT count( 1 ) FROM vw_user WHERE member = 1 and unionId = un.id ) `value`, + ( SELECT count( 1 ) FROM vw_user u LEFT JOIN sys_user su ON su.id = u.id WHERE u.member = 1 and u.unionId = un.id and (su.memberFeePaid = 0 or su.memberFeePaid is null) ) unpaidValue FROM sys_union un ORDER BY diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/MemberInfoService.java b/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/MemberInfoService.java index b0d5b33b..e9c1c959 100644 --- a/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/MemberInfoService.java +++ b/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/MemberInfoService.java @@ -61,6 +61,13 @@ public interface MemberInfoService extends BaseService { */ void exportMember(MemberInfoPageForm pageForm, HttpServletResponse response); + /** + * 获取会员看板会员数统计数据 + * + * @return memberNum 会员总数、unpaidMemberNum 未缴费会员数、lastYearMemberNum 去年会员数 + */ + NutMap getBoardMemberNumber(); + /** * 切换指定会员的缴费状态 * diff --git a/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/impl/MemberInfoServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/impl/MemberInfoServiceImpl.java index 27487342..c5cf4eba 100644 --- a/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/impl/MemberInfoServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffmanage/member/service/impl/MemberInfoServiceImpl.java @@ -270,6 +270,18 @@ public class MemberInfoServiceImpl extends BaseServiceImpl implements CommonDownloadUtil.download("会员档案表.xlsx", workbook, response); } + @Override + public NutMap getBoardMemberNumber() { + int memberNum = count(Sqls.create("select count(1) from sys_user where member = 1")); + // 空值按未缴费处理,保持会员列表中“是否缴费”的展示口径一致。 + int unpaidMemberNum = count(Sqls.create("select count(1) from sys_user where member = 1 and (memberFeePaid = 0 or memberFeePaid is null)")); + int lastYearMemberNum = count(Sqls.create("select count(1) from member_history where year = year(now()) -1 ")); + return NutMap.NEW() + .addv("memberNum", memberNum) + .addv("unpaidMemberNum", unpaidMemberNum) + .addv("lastYearMemberNum", lastYearMemberNum); + } + @Override @Aop(TransAop.READ_COMMITTED) public Boolean toggleMemberFeePaid(String userId) { diff --git a/src/main/java/com/budwk/app/zhgh/welfare/param/WelfareFilterUserPageForm.java b/src/main/java/com/budwk/app/zhgh/welfare/param/WelfareFilterUserPageForm.java index 1bd27b0f..1cbfdd6d 100644 --- a/src/main/java/com/budwk/app/zhgh/welfare/param/WelfareFilterUserPageForm.java +++ b/src/main/java/com/budwk/app/zhgh/welfare/param/WelfareFilterUserPageForm.java @@ -55,4 +55,7 @@ public class WelfareFilterUserPageForm extends PageForm { @ApiModelProperty("是否会员") private Boolean isMember; + @ApiModelProperty("是否缴费会员") + private Boolean memberFeePaid; + } diff --git a/src/main/java/com/budwk/app/zhgh/welfare/service/impl/WelfareListServiceImpl.java b/src/main/java/com/budwk/app/zhgh/welfare/service/impl/WelfareListServiceImpl.java index 6bbce8a1..ebd6457d 100644 --- a/src/main/java/com/budwk/app/zhgh/welfare/service/impl/WelfareListServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/welfare/service/impl/WelfareListServiceImpl.java @@ -33,6 +33,7 @@ import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; import org.nutz.lang.Lang; @@ -444,10 +445,12 @@ public class WelfareListServiceImpl extends BaseServiceImpl impleme u.unitName, u.unionId, u.unionName, - u.member + u.member, + IFNULL(su.memberFeePaid, 0) AS memberFeePaid FROM vw_user u LEFT JOIN welfare_list w ON u.id = w.userId AND w.projectId = @projectId + LEFT JOIN sys_user su ON su.id = u.id $condition """); sql.setParam("projectId", pageForm.getProjectId()); @@ -455,6 +458,13 @@ public class WelfareListServiceImpl extends BaseServiceImpl impleme Cnd cnd = Cnd.NEW(); cnd.and("w.userId", "is", null); + // 姓名/工号合并为一个输入框,输入值同时匹配姓名和工号。 + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup userSearchGroup = new SqlExpressionGroup(); + userSearchGroup.or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"); + userSearchGroup.or("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%"); + cnd.and(userSearchGroup); + } if (StrUtil.isNotBlank(pageForm.getUserName())) { cnd.where().andLike("u.username", pageForm.getUserName()); } @@ -466,19 +476,21 @@ public class WelfareListServiceImpl extends BaseServiceImpl impleme if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) { cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths()); } - cnd.andEX("u.unionId", "=", pageForm.getUnionId()); + applyWelfareUserUnionScope(cnd, "u.unionId", pageForm.getUnionId()); cnd.andEX("u.unitId", "in", pageForm.getUnitIds()); cnd.andEX("u.personType", "in", pageForm.getPersonTypes()); cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys()); cnd.andEX("u.userState", "in", pageForm.getUserStates()); cnd.andEX("u.member","=",pageForm.getIsMember()); + // 是否缴费会员来源于会员分组管理设置,空值按未缴费处理。 + cnd.andEX("IFNULL(su.memberFeePaid, 0)", "=", pageForm.getMemberFeePaid()); if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { cnd.asc("u.unionCode"); cnd.asc("u.unitCode"); cnd.asc("u.sex"); } else { - cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); + cnd.orderBy(getWelfareUserOrderName(pageForm.getPageOrderName()), PageUtil.getOrder(pageForm.getPageOrderBy())); } sql.setCondition(cnd); @@ -489,51 +501,62 @@ public class WelfareListServiceImpl extends BaseServiceImpl impleme public void addWelfareUser(WelfareFilterUserPageForm pageForm) { Sql sql = Sqls.create(""" SELECT - id, - loginname, - username, - sex, - birthday, - personType, - preparedBy, - userState, - unitId, - unitName, - unionId, - unionName, - member + u.id, + u.loginname, + u.username, + u.sex, + u.birthday, + u.personType, + u.preparedBy, + u.userState, + u.unitId, + u.unitName, + u.unionId, + u.unionName, + u.member, + IFNULL(su.memberFeePaid, 0) AS memberFeePaid FROM - vw_user + vw_user u + LEFT JOIN sys_user su ON su.id = u.id $condition """); Cnd cnd = Cnd.NEW(); + // 添加福利名单时复用弹窗的姓名/工号合并搜索条件,避免展示数量和实际添加数量不一致。 + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup userSearchGroup = new SqlExpressionGroup(); + userSearchGroup.or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%"); + userSearchGroup.or("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%"); + cnd.and(userSearchGroup); + } if (StrUtil.isNotBlank(pageForm.getUserName())) { - cnd.where().andLike("username", pageForm.getUserName()); + cnd.where().andLike("u.username", pageForm.getUserName()); } if (StrUtil.isNotBlank(pageForm.getLoginName())) { - cnd.where().andLike("loginname", pageForm.getLoginName()); + cnd.where().andLike("u.loginname", pageForm.getLoginName()); } - cnd.andEX("sex", "=", pageForm.getSex()); - cnd.andEX("birthday", "=", pageForm.getBirthday()); + cnd.andEX("u.sex", "=", pageForm.getSex()); + cnd.andEX("u.birthday", "=", pageForm.getBirthday()); if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) { - cnd.andEX("MONTH(birthday)", "in", pageForm.getBirthMonths()); + cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths()); } - cnd.andEX("unionId", "=", pageForm.getUnionId()); - cnd.andEX("unitId", "in", pageForm.getUnitIds()); - cnd.andEX("personType", "in", pageForm.getPersonTypes()); - cnd.andEX("preparedBy", "in", pageForm.getPreparedBys()); - cnd.andEX("userState", "in", pageForm.getUserStates()); - cnd.andEX("member","=",pageForm.getIsMember()); + applyWelfareUserUnionScope(cnd, "u.unionId", pageForm.getUnionId()); + cnd.andEX("u.unitId", "in", pageForm.getUnitIds()); + cnd.andEX("u.personType", "in", pageForm.getPersonTypes()); + cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys()); + cnd.andEX("u.userState", "in", pageForm.getUserStates()); + cnd.andEX("u.member","=",pageForm.getIsMember()); + // 是否缴费会员来源于会员分组管理设置,空值按未缴费处理。 + cnd.andEX("IFNULL(su.memberFeePaid, 0)", "=", pageForm.getMemberFeePaid()); if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { - cnd.asc("unionCode"); - cnd.asc("unitCode"); - cnd.asc("sex"); + cnd.asc("u.unionCode"); + cnd.asc("u.unitCode"); + cnd.asc("u.sex"); } else { - cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); + cnd.orderBy(getWelfareUserOrderName(pageForm.getPageOrderName()), PageUtil.getOrder(pageForm.getPageOrderBy())); } - cnd.and("id", "not in", Sqls.create("select userId from `welfare_list` where projectId = @projectId").setParam("projectId", pageForm.getProjectId())); + cnd.and("u.id", "not in", Sqls.create("select userId from `welfare_list` where projectId = @projectId").setParam("projectId", pageForm.getProjectId())); sql.setCondition(cnd); List list = listMap(sql); @@ -556,6 +579,32 @@ public class WelfareListServiceImpl extends BaseServiceImpl impleme dao().insert(welfareList); } + /** + * 福利添加人员查询已关联 sys_user,排序字段统一加 vw_user 别名,避免同名字段歧义。 + */ + private String getWelfareUserOrderName(String pageOrderName) { + if (StrUtil.isBlank(pageOrderName) || pageOrderName.contains(".")) { + return pageOrderName; + } + if ("memberFeePaid".equals(pageOrderName)) { + return "IFNULL(su.memberFeePaid, 0)"; + } + return "u." + pageOrderName; + } + + /** + * 分工会角色只能查询和添加本工会人员,其他角色按页面选择的工会筛选。 + */ + private void applyWelfareUserUnionScope(Cnd cnd, String unionColumn, String unionId) { + if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) + || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name()) + || AuthUtil.hasRole(RoleConstant.BRANCH_UNION_WENTI_SPORTS.name())) { + cnd.and(unionColumn, "=", SecurityUtil.getUnionId()); + } else { + cnd.andEX(unionColumn, "=", unionId); + } + } + @Override public void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response) { Sql sql = Sqls.create(""" diff --git a/src/main/resources/views/platform/zhgh/staffmanage/member/info/board/index.html b/src/main/resources/views/platform/zhgh/staffmanage/member/info/board/index.html index aa337ed5..e765ab62 100644 --- a/src/main/resources/views/platform/zhgh/staffmanage/member/info/board/index.html +++ b/src/main/resources/views/platform/zhgh/staffmanage/member/info/board/index.html @@ -292,9 +292,9 @@ layout("/layouts/platform.html"){
-
会员数
+
会员数/未缴费人数
- {{memberNumberData.memberNum}} + {{memberNumberData.memberNum}} / {{memberNumberData.unpaidMemberNum}}  人
@@ -322,7 +322,7 @@ layout("/layouts/platform.html"){
-
工会会员数
+
工会会员数/未缴费数
@@ -392,6 +392,7 @@ layout("/layouts/platform.html"){ }, memberNumberData: { memberNum: "--", + unpaidMemberNum: "--", lastYearMemberNum: "--", ratio: "0.0%", diff: 0 @@ -411,11 +412,11 @@ layout("/layouts/platform.html"){ this.$axios.post("/platform/member/info/board/memberNumber").then((resp) => { if (resp.code === 0) { const { - data: { memberNum, lastYearMemberNum } + data: { memberNum, unpaidMemberNum, lastYearMemberNum } } = resp const diff = memberNum - lastYearMemberNum const ratio = (lastYearMemberNum ? (Math.abs(diff) / lastYearMemberNum) * 100 : (diff / 1) * 10).toFixed(2) + " %" - this.memberNumberData = { memberNum, lastYearMemberNum, diff, ratio } + this.$set(this, "memberNumberData", { memberNum, unpaidMemberNum, lastYearMemberNum, diff, ratio }) this.loading.memberNumber = false } else { this.$message.warning(resp.msg) @@ -571,6 +572,30 @@ layout("/layouts/platform.html"){ * 各工会会员数 * @returns {Promise} */ + getUnionUnpaidValue(item) { + // 兼容后端 Record 字段大小写,空值统一按 0 处理。 + const unpaidValue = item.unpaidValue || item.unpaidvalue || 0 + return Number(unpaidValue) || 0 + }, + formatUnionMemberValue(item) { + const unpaidValue = this.getUnionUnpaidValue(item) + if (unpaidValue > 0) { + return item.value + "/" + unpaidValue + } + return item.value + }, + buildUnionMemberTooltip(title, items) { + if (!items || !items.length) { + return "" + } + const data = items[0].data || {} + const unpaidValue = this.getUnionUnpaidValue(data) + return '
' + + '
' + title + '
' + + '
会员数:' + data.value + '
' + + '
未缴费数:' + unpaidValue + '
' + + '
' + }, async getUnionMember() { this.loading.unionMember = true this.$axios.post("/platform/member/info/board/unionMember").then((resp) => { @@ -580,11 +605,8 @@ layout("/layouts/platform.html"){ this.unionMember = tableData - const labels = chartData.map((v) => v.unionname) - const values = chartData.map((v) => v.value) - if (chart.unionMemberChart) { - chart.unionMemberChart.changeData(values) + chart.unionMemberChart.changeData(chartData) return } @@ -612,7 +634,10 @@ layout("/layouts/platform.html"){ textShadow: '0 1px 2px rgba(0,0,0,0.5)', opacity: 0.9 }, - formatter: (datum) => datum.value // 显示原始值 + formatter: (datum) => this.formatUnionMemberValue(datum) + }, + tooltip: { + customContent: (title, items) => this.buildUnionMemberTooltip(title, items) }, // X轴配置 xAxis: { diff --git a/src/main/resources/views/platform/zhgh/welfare/welfareUser/addUser.js b/src/main/resources/views/platform/zhgh/welfare/welfareUser/addUser.js index 984ea2fb..6bf924f7 100644 --- a/src/main/resources/views/platform/zhgh/welfare/welfareUser/addUser.js +++ b/src/main/resources/views/platform/zhgh/welfare/welfareUser/addUser.js @@ -3,15 +3,9 @@ const addUser = { - - - - - - - + + @@ -109,6 +103,13 @@ const addUser = { + + + + + + @@ -154,8 +155,7 @@ const addUser = { visible: false, projectId: null, pageForm: { - userName: null, - loginName: null, + searchKeyword: null, sex: null, birthday: null, birthMonths: [], @@ -164,7 +164,8 @@ const addUser = { personTypes: [], preparedBys: [], userStates: [], - isMember: null + isMember: null, + memberFeePaid: null }, sexOptions: ["男", "女"], unionOptions: [], @@ -187,30 +188,47 @@ const addUser = { this.visible = true this.resetPageForm() this.pageForm.projectId = id - this.unionOptions = await this.$businessTool.listUnion() - this.unitOptions = await this.$businessTool.listUnit() + await this.initUnionAndUnitOptions() this.pageData() }, resetPageForm() { - this.$set(this.pageForm, "userName", null) - this.$set(this.pageForm, "loginName", null) + this.$set(this.pageForm, "searchKeyword", null) this.$set(this.pageForm, "sex", null) this.$set(this.pageForm, "birthday", null) this.$set(this.pageForm, "birthMonths", []) this.$set(this.pageForm, "unionId", null) - this.$set(this.pageForm, "unitId", null) + this.$set(this.pageForm, "unitIds", []) this.$set(this.pageForm, "personTypes", []) this.$set(this.pageForm, "preparedBys", []) this.$set(this.pageForm, "userStates", []) this.$set(this.pageForm, "isMember", null) + this.$set(this.pageForm, "memberFeePaid", null) + }, + + async initUnionAndUnitOptions() { + const hasSchoolUnionRole = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"]) + if (hasSchoolUnionRole) { + this.unionOptions = await this.$businessTool.listUnion() + this.unitOptions = await this.$businessTool.listUnit() + } else { + this.$set(this.pageForm, "unionId", this.$store.state.user.union.id) + this.unionOptions = await this.$businessTool.listUnion(this.$store.state.user.union.id) + this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id) + } }, async unionIdChange(val) { if (val) { this.unitOptions = await this.$businessTool.listUnit(val) } else { - this.pageForm.unitIds = [] + this.$set(this.pageForm, "unitIds", []) + if (!this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])) { + this.$set(this.pageForm, "unionId", this.$store.state.user.union.id) + this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id) + } else { + this.unitOptions = await this.$businessTool.listUnit() + } } }, diff --git a/src/main/resources/views/platform/zhgh/welfare/welfareUser/index.html b/src/main/resources/views/platform/zhgh/welfare/welfareUser/index.html index b215e1bd..08e94536 100644 --- a/src/main/resources/views/platform/zhgh/welfare/welfareUser/index.html +++ b/src/main/resources/views/platform/zhgh/welfare/welfareUser/index.html @@ -68,7 +68,7 @@ layout("/layouts/platform.html"){ - + @@ -341,12 +341,33 @@ layout("/layouts/platform.html"){ .finally(() => { this.tableLoading = false }) + }, + async initUnionAndUnitOptions() { + const hasSchoolUnionRole = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"]) + if (hasSchoolUnionRole) { + this.unionOptions = await this.$businessTool.listUnion() + this.unitOptions = await this.$businessTool.listUnit() + } else { + this.$set(this.pageForm, "unionId", this.$store.state.user.union.id) + this.unionOptions = await this.$businessTool.listUnion(this.$store.state.user.union.id) + this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id) + } + }, + async unionIdChange(val) { + this.$set(this.pageForm, "unitIds", []) + if (val) { + this.unitOptions = await this.$businessTool.listUnit(val) + } else if (!this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])) { + this.$set(this.pageForm, "unionId", this.$store.state.user.union.id) + this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id) + } else { + this.unitOptions = await this.$businessTool.listUnit() + } } }, async created() { this.getWelfareList() - this.unionOptions = await this.$businessTool.listUnion() - this.unitOptions = await this.$businessTool.listUnit() + await this.initUnionAndUnitOptions() this.pageData() } })