From 9503b5aa7355b5ec01583dcca24006a682af27e4 Mon Sep 17 00:00:00 2001 From: zhangrui Date: Tue, 25 Aug 2026 13:50:47 +0800 Subject: [PATCH] change --- .../app/flow/service/FlowCommonService.java | 7 +- .../app/sys/controller/SysConfController.java | 14 +- .../app/sys/controller/SysRoleController.java | 3 +- .../sys/controller/SysUnionController.java | 33 +- .../app/sys/services/SysConfigService.java | 14 + .../app/sys/services/SysUnionService.java | 13 + .../services/impl/SysConfigServiceImpl.java | 32 ++ .../services/impl/SysUnionServiceImpl.java | 52 +++ ...layManageUnionIncomeExpenseController.java | 13 + .../OutlayManageUnionUseDetailController.java | 13 + .../views/platform/sys/conf/index.html | 157 ++++++-- .../views/platform/sys/role/index.html | 342 ++++++++++++++---- .../platform/sys/union/branchUnionManage.js | 2 +- .../club/infoManage/auditManager/index.html | 15 +- .../zhgh/club/infoManage/change/index.html | 38 +- .../club/infoManage/exitManage/index.html | 15 +- .../club/infoManage/manage/clubInfoManage.js | 44 ++- .../zhgh/club/infoManage/manage/index.html | 133 ++++++- .../infoManage/manage/schoolClubManage.js | 44 ++- .../zhgh/club/infoManage/pay/index.html | 12 +- .../club/infoManage/refreshReport/index.html | 15 +- .../club/infoManage/ruleUpdate/index.html | 15 +- .../infoManage/schoolAuditReport/index.html | 15 +- .../infoManage/schoolAuditRule/index.html | 15 +- .../outlayManage/union/allocate/index.html | 22 +- .../union/incomeExpense/index.html | 83 ++++- .../outlayManage/union/manage/index.html | 13 +- .../outlayManage/union/useDetail/index.html | 77 +++- .../useDetail/quarterlyOutlayAllocate.js | 4 +- 29 files changed, 1035 insertions(+), 220 deletions(-) diff --git a/src/main/java/com/budwk/app/flow/service/FlowCommonService.java b/src/main/java/com/budwk/app/flow/service/FlowCommonService.java index 5cbb62ee..1230331c 100644 --- a/src/main/java/com/budwk/app/flow/service/FlowCommonService.java +++ b/src/main/java/com/budwk/app/flow/service/FlowCommonService.java @@ -11,6 +11,8 @@ import com.budwk.app.flow.engine.event.ProcessPublisher; import com.budwk.app.flow.entity.ProcessInstance; import com.budwk.app.flow.entity.ProcessTask; import com.budwk.app.flow.enums.*; +import com.budwk.app.sys.models.Sys_unit; +import com.budwk.app.sys.views.View_user; import com.budwk.app.web.commons.auth.utils.SecurityUtil; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Chain; @@ -22,6 +24,7 @@ import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; import java.util.List; +import java.util.Optional; @IocBean public class FlowCommonService { @@ -61,11 +64,13 @@ public class FlowCommonService { args.put(FlowConst.SUBMIT_TYPE, submitType); + Sys_unit sysUnit = dao.fetch(Sys_unit.class, Cnd.where("id", "=", SecurityUtil.getUnitId())); + // 设置办理人信息到表单参数 args.put(FlowConst.TASK_FORM_DATA_PREFIX + "userName", SecurityUtil.getUserUsername()); args.put(FlowConst.TASK_FORM_DATA_PREFIX + "loginName", SecurityUtil.getUserLoginname()); args.put(FlowConst.TASK_FORM_DATA_PREFIX + "unitId", SecurityUtil.getUnitId()); - args.put(FlowConst.TASK_FORM_DATA_PREFIX + "unitName", SecurityUtil.getUnitId()); + args.put(FlowConst.TASK_FORM_DATA_PREFIX + "unitName", Optional.of(sysUnit).map(Sys_unit::getName).orElse("")); args.put(FlowConst.TASK_FORM_DATA_PREFIX + "unionId", SecurityUtil.getUnionId()); if (ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.ROLLBACK.getCode())) { diff --git a/src/main/java/com/budwk/app/sys/controller/SysConfController.java b/src/main/java/com/budwk/app/sys/controller/SysConfController.java index d6a0e76e..35788e11 100644 --- a/src/main/java/com/budwk/app/sys/controller/SysConfController.java +++ b/src/main/java/com/budwk/app/sys/controller/SysConfController.java @@ -4,7 +4,6 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.constant.RedisConstant; import com.budwk.app.base.result.Result; -import com.budwk.app.base.utils.PageUtil; import com.budwk.app.sys.models.Sys_config; import com.budwk.app.sys.services.SysConfigService; import com.budwk.app.web.commons.auth.utils.SecurityUtil; @@ -139,17 +138,18 @@ public class SysConfController { @At @Ok("json:full") @SaCheckPermission("sys.manager.conf") - public Object data(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) { + public Object data(@Param("pageNumber") int pageNumber, + @Param("pageSize") int pageSize, + @Param("pageOrderName") String pageOrderName, + @Param("pageOrderBy") String pageOrderBy, + @Param("configKey") String configKey) { try { ensureAppImageConfig("AppHomeImg", "PC首页轮播图"); ensureAppImageConfig("H5AppHomeImg", "移动端首页轮播图"); ensureAppImageConfig("AppFeaturedActivityImg", "精彩活动页顶部图片"); ensureAppImageConfig("AppFestivalBenefitImg", "节日福利页顶部图片"); - Cnd cnd = Cnd.NEW(); - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) { - cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); - } - return Result.success().addData(sysConfigService.listPage(pageNumber, pageSize, cnd)); + return Result.success().addData(sysConfigService.pageData( + pageNumber, pageSize, pageOrderName, pageOrderBy, configKey)); } catch (Exception e) { return Result.error(); } diff --git a/src/main/java/com/budwk/app/sys/controller/SysRoleController.java b/src/main/java/com/budwk/app/sys/controller/SysRoleController.java index 8b3d9cf4..83de63fe 100644 --- a/src/main/java/com/budwk/app/sys/controller/SysRoleController.java +++ b/src/main/java/com/budwk/app/sys/controller/SysRoleController.java @@ -419,14 +419,13 @@ public class SysRoleController { public Object user(@Param("roleId") String roleId, @Param("searchName") String searchName, @Param("searchKeyword") String searchKeyword, @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) { try { - Sql sql = Sqls.create("SELECT a.*,c.name as unitname FROM sys_user a,sys_user_role b,sys_unit c WHERE a.unitid=c.id and a.id=b.userId and b.roleId=@roleId $s $o"); + Sql sql = Sqls.create("SELECT a.*,c.name as unitname FROM sys_user a,sys_user_role b,sys_unit c WHERE a.unitid=c.id and a.id=b.userId and enable='1' and b.roleId=@roleId $s $o"); sql.params().set("roleId", roleId); if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { sql.vars().set("s", " and a." + searchName + " like '%" + searchKeyword + "%'"); } if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) { sql.vars().set("o", " order by a." + pageOrderName + " " + PageUtil.getOrder(pageOrderBy)); - } return Result.success().addData(sysUserService.listPage(pageNumber, pageSize, sql)); } catch (Exception e) { diff --git a/src/main/java/com/budwk/app/sys/controller/SysUnionController.java b/src/main/java/com/budwk/app/sys/controller/SysUnionController.java index 7e2f49e4..e6607b1a 100644 --- a/src/main/java/com/budwk/app/sys/controller/SysUnionController.java +++ b/src/main/java/com/budwk/app/sys/controller/SysUnionController.java @@ -456,10 +456,16 @@ public class SysUnionController { unionCadre.setIsJoin(true); dao.insert(unionCadre); - // 去走工作流 + // 校级管理员新增普通干部时直接授权,不生成无实际审核意义的流程数据。 boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()); + if (isAdmin) { + sysUnionService.assignBranchUnionRole(userId, role.getId(), unionId, List.of()); + return Result.success(); + } + + // 非校级管理员仍按原业务发起基层干部授权审核流程。 Dict args = Dict.create(); - args.set("submit", isAdmin ? "admin" : "branch"); + args.set("submit", "branch"); args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode()); args.set(FlowConst.FORM_DATA, unionCadre); @@ -470,20 +476,12 @@ public class SysUnionController { flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args); } - if (isAdmin) { - // 如果是管理员,直接加角色 - sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId)); - sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId)); - sysRoleService.clearCache(); - sysUserService.clearCache(); - } - return Result.success(); } /** - * 发起二级党委书记授权审批。一个审批申请可关联当前分工会下的多个单位。 - * 审核通过后由流程拦截器按单位写入角色,避免影响普通分工会角色的授权方式。 + * 新增二级党委书记授权。校级管理员直接按单位授权,其他用户发起审批, + * 审核通过后由流程拦截器按单位写入角色。 * * @param userId 人员ID * @param unionId 分工会ID @@ -536,11 +534,18 @@ public class SysUnionController { unionCadre.setIsJoin(true); dao.insert(unionCadre); + boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()); + if (isAdmin) { + // 校级管理员直接按所选单位授权,不创建 JCGHWY 流程实例和审核任务。 + sysUnionService.assignBranchUnionRole(userId, role.getId(), unionId, distinctUnitIds); + return Result.success(); + } + + // 非校级管理员保留原审批流程,并将所选单位随表单传给审核通过拦截器。 JSONObject formData = JSONUtil.parseObj(unionCadre); formData.set("unitIds", distinctUnitIds); Dict args = Dict.create(); - boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name()); - args.set("submit", isAdmin ? "admin" : "branch"); + args.set("submit", "branch"); args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode()); args.set(FlowConst.FORM_DATA, formData.toString()); ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args); diff --git a/src/main/java/com/budwk/app/sys/services/SysConfigService.java b/src/main/java/com/budwk/app/sys/services/SysConfigService.java index 017974a9..04490ba7 100644 --- a/src/main/java/com/budwk/app/sys/services/SysConfigService.java +++ b/src/main/java/com/budwk/app/sys/services/SysConfigService.java @@ -1,5 +1,6 @@ package com.budwk.app.sys.services; +import com.budwk.app.base.page.Pagination; import com.budwk.app.sys.models.Sys_config; import com.budwk.app.base.service.BaseService; @@ -16,4 +17,17 @@ public interface SysConfigService extends BaseService { List getAllList(); Sys_config getValueByKey(String key); + + /** + * 分页查询系统参数,支持按参数名模糊查询和安全排序。 + * + * @param pageNumber 页码 + * @param pageSize 每页条数 + * @param pageOrderName 排序字段 + * @param pageOrderBy 排序方向 + * @param configKey 参数名关键字 + * @return 系统参数分页数据 + */ + Pagination pageData(int pageNumber, int pageSize, String pageOrderName, + String pageOrderBy, String configKey); } diff --git a/src/main/java/com/budwk/app/sys/services/SysUnionService.java b/src/main/java/com/budwk/app/sys/services/SysUnionService.java index 302a4769..dcfceb16 100644 --- a/src/main/java/com/budwk/app/sys/services/SysUnionService.java +++ b/src/main/java/com/budwk/app/sys/services/SysUnionService.java @@ -3,5 +3,18 @@ package com.budwk.app.sys.services; import com.budwk.app.base.service.BaseService; import com.budwk.app.sys.models.Sys_union; +import java.util.List; + public interface SysUnionService extends BaseService { + + /** + * 直接分配分工会干部角色。普通干部传空单位集合时按分工会写入一条角色关系; + * 二级党委书记传单位集合时按单位分别写入角色关系。 + * + * @param userId 用户ID + * @param roleId 角色ID + * @param unionId 分工会ID + * @param unitIds 授权单位ID集合,普通干部角色传空集合 + */ + void assignBranchUnionRole(String userId, String roleId, String unionId, List unitIds); } diff --git a/src/main/java/com/budwk/app/sys/services/impl/SysConfigServiceImpl.java b/src/main/java/com/budwk/app/sys/services/impl/SysConfigServiceImpl.java index 74b38ff4..d586bf68 100644 --- a/src/main/java/com/budwk/app/sys/services/impl/SysConfigServiceImpl.java +++ b/src/main/java/com/budwk/app/sys/services/impl/SysConfigServiceImpl.java @@ -1,15 +1,19 @@ package com.budwk.app.sys.services.impl; import com.budwk.app.base.exception.BaseException; +import com.budwk.app.base.page.Pagination; import com.budwk.app.base.service.impl.BaseServiceImpl; +import com.budwk.app.base.utils.PageUtil; import com.budwk.app.sys.models.Sys_config; import com.budwk.app.sys.services.SysConfigService; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; +import org.nutz.lang.Strings; import java.util.List; +import java.util.Set; /** * Created by wizzer on 2016/12/23. @@ -32,4 +36,32 @@ public class SysConfigServiceImpl extends BaseServiceImpl implements } return sys_config; } + + /** + * 分页查询系统参数。参数名使用模糊匹配,排序字段限定在列表可展示字段内, + * 防止未经校验的前端字段直接进入排序 SQL。 + * + * @param pageNumber 页码 + * @param pageSize 每页条数 + * @param pageOrderName 排序字段 + * @param pageOrderBy 排序方向 + * @param configKey 参数名关键字 + * @return 系统参数分页数据 + */ + @Override + @SuppressWarnings("unchecked") + public Pagination pageData(int pageNumber, int pageSize, String pageOrderName, + String pageOrderBy, String configKey) { + Cnd cnd = Cnd.NEW(); + if (Strings.isNotBlank(configKey)) { + cnd.where().andLike("configKey", configKey.trim()); + } + Set sortableColumns = Set.of("configKey", "configValue", "note"); + if (sortableColumns.contains(pageOrderName) && Strings.isNotBlank(pageOrderBy)) { + cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); + } else { + cnd.asc("configKey"); + } + return listPage(pageNumber, pageSize, cnd); + } } diff --git a/src/main/java/com/budwk/app/sys/services/impl/SysUnionServiceImpl.java b/src/main/java/com/budwk/app/sys/services/impl/SysUnionServiceImpl.java index 71a760ce..7efcc632 100644 --- a/src/main/java/com/budwk/app/sys/services/impl/SysUnionServiceImpl.java +++ b/src/main/java/com/budwk/app/sys/services/impl/SysUnionServiceImpl.java @@ -2,13 +2,65 @@ package com.budwk.app.sys.services.impl; import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.sys.models.Sys_union; +import com.budwk.app.sys.models.Sys_user_role; +import com.budwk.app.sys.services.SysRoleService; import com.budwk.app.sys.services.SysUnionService; +import com.budwk.app.sys.services.SysUserService; +import org.nutz.dao.Cnd; import org.nutz.dao.Dao; +import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import java.util.List; + @IocBean(args = {"refer:dao"}) public class SysUnionServiceImpl extends BaseServiceImpl implements SysUnionService { + + @Inject + private SysRoleService sysRoleService; + + @Inject + private SysUserService sysUserService; + public SysUnionServiceImpl(Dao dao) { super(dao); } + + /** + * 直接分配分工会干部角色,并在授权完成后统一清理权限缓存。 + * 普通角色按分工会授权一次,包含单位的角色按每个单位分别授权。 + * + * @param userId 用户ID + * @param roleId 角色ID + * @param unionId 分工会ID + * @param unitIds 授权单位ID集合,普通干部角色传空集合 + */ + @Override + public void assignBranchUnionRole(String userId, String roleId, String unionId, List unitIds) { + // 先清理同一用户在当前分工会下的相同角色,保证重新授权后不存在重复关系。 + dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "=", roleId) + .and(Sys_user_role::getUserId, "=", userId) + .and(Sys_user_role::getUnionId, "=", unionId)); + + if (unitIds == null || unitIds.isEmpty()) { + Sys_user_role userRole = new Sys_user_role(); + userRole.setRoleId(roleId); + userRole.setUserId(userId); + userRole.setUnionId(unionId); + dao().insert(userRole); + } else { + // 二级党委书记按选中的单位分别生成角色关系,供后续单位级权限判断使用。 + for (String unitId : unitIds) { + Sys_user_role userRole = new Sys_user_role(); + userRole.setRoleId(roleId); + userRole.setUserId(userId); + userRole.setUnionId(unionId); + userRole.setUnitId(unitId); + dao().insert(userRole); + } + } + + sysRoleService.clearCache(); + sysUserService.clearCache(); + } } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionIncomeExpenseController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionIncomeExpenseController.java index 53e6b90f..e67b7a43 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionIncomeExpenseController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionIncomeExpenseController.java @@ -14,6 +14,7 @@ import com.budwk.app.base.service.BaseService; import com.budwk.app.base.utils.CommonDownloadUtil; import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayManageUnionStatisticsService; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.vo.OutlayUnionIncomeExpenseVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -44,6 +45,8 @@ public class OutlayManageUnionIncomeExpenseController { @Inject private BaseService baseService; + @Inject + private OutlayManageUnionStatisticsService outlayManageUnionStatisticsService; @At("") @Ok("beetl:/platform/zhgh/dayofficework/outlay/outlayManage/union/incomeExpense/index.html") @@ -60,6 +63,16 @@ public class OutlayManageUnionIncomeExpenseController { return Result.success(pagination); } + /** + * 查询当前筛选范围内全部分工会经费收支合计,不受分页参数影响。 + */ + @At + @ApiOperation("查询经费收支合计") + @SaCheckPermission("outlay.outlayManage.union.incomeExpense") + public Result summary(Integer year, String unionId) { + return Result.success(outlayManageUnionStatisticsService.queryIncomeExpenseSummary(year, unionId)); + } + @At @Ok("void") @ApiOperation("导出") diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionUseDetailController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionUseDetailController.java index c4948be5..6688cf76 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionUseDetailController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/outlay/outlayManage/union/controller/OutlayManageUnionUseDetailController.java @@ -12,6 +12,7 @@ import com.budwk.app.web.commons.auth.utils.AuthUtil; import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.model.OutlayUseDetail; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayUseDetailService; +import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayManageUnionStatisticsService; import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutLayAllocateUnion; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -46,6 +47,8 @@ public class OutlayManageUnionUseDetailController { private BaseService baseService; @Inject private OutlayUseDetailService outlayUseDetailService; + @Inject + private OutlayManageUnionStatisticsService outlayManageUnionStatisticsService; @At("") @Ok("beetl:/platform/zhgh/dayofficework/outlay/outlayManage/union/useDetail/index.html") @@ -81,6 +84,16 @@ public class OutlayManageUnionUseDetailController { return Result.success(pagination); } + /** + * 查询当前筛选范围内全部分工会预算使用情况合计,不受分页参数影响。 + */ + @At + @ApiOperation("查询预算使用情况合计") + @SaCheckPermission("outlay.outlayManage.union.useDetail") + public Result summary(Integer year, String unionId) { + return Result.success(outlayManageUnionStatisticsService.queryUseDetailSummary(year, unionId)); + } + @At @ApiOperation("某个分工会预算使用详情") diff --git a/src/main/resources/views/platform/sys/conf/index.html b/src/main/resources/views/platform/sys/conf/index.html index bca250ff..0f6a7548 100644 --- a/src/main/resources/views/platform/sys/conf/index.html +++ b/src/main/resources/views/platform/sys/conf/index.html @@ -1,18 +1,54 @@ +
- - - - - 添加配置项 - - +
+ + + + + + - - + + + 新增 + + +
@@ -183,13 +220,18 @@ layout("/layouts/platform.html"){ return { addDialogVisible: false, editDialogVisible: false, + tableLoading: false, + tableHeight: 300, + tableResizeObserver: null, + pageRequestSequence: 0, tableData: [], pageForm: { pageSize: 10, pageNumber: 1, pageOrderName: "", pageOrderBy: "", - totalCount: 0 + totalCount: 0, + configKey: "" }, formData: { configKey: "", @@ -203,6 +245,10 @@ layout("/layouts/platform.html"){ } }, methods: { + doSearch: function () { + this.pageForm.pageNumber = 1 + this.pageData() + }, openAdd: function () { this.addDialogVisible = true this.formData = {} //打开新增窗口,表单先清空 @@ -317,24 +363,60 @@ layout("/layouts/platform.html"){ this.pageData() }, pageData: function () { - //加载分页数据 + // 查询期间清空旧页并显示加载状态,快速连续查询时仅接收最后一次响应。 var self = this - $.post( - base + "/platform/sys/conf/data", - self.pageForm, - function (data) { - if (data.code == 0) { - self.tableData = data.data.list - self.pageForm.totalCount = data.data.totalCount - } else { - self.$message({ - message: data.msg, - type: "error" - }) + var requestSequence = ++self.pageRequestSequence + self.tableData = [] + self.tableLoading = true + $.post(base + "/platform/sys/conf/data", self.pageForm).then(function (data) { + if (requestSequence != self.pageRequestSequence) { + return + } + if (data.code == 0) { + self.tableData = data.data.list || [] + self.pageForm.totalCount = data.data.totalCount || 0 + self.updateTableHeight() + } else { + self.$message({ + message: data.msg, + type: "error" + }) + } + }).always(function () { + if (requestSequence == self.pageRequestSequence) { + self.tableLoading = false + } + }) + }, + updateTableHeight: function () { + var self = this + this.$nextTick(function () { + var cardBody = self.$el.querySelector(".sys-conf-list-card > .el-card__body") + if (!cardBody || cardBody.clientHeight <= 0) { + return + } + var getOuterHeight = function (element) { + if (!element) { + return 0 } - }, - "json" - ) + var style = window.getComputedStyle(element) + return element.offsetHeight + + (parseFloat(style.marginTop) || 0) + + (parseFloat(style.marginBottom) || 0) + } + var bodyStyle = window.getComputedStyle(cardBody) + var bodyPadding = (parseFloat(bodyStyle.paddingTop) || 0) + + (parseFloat(bodyStyle.paddingBottom) || 0) + var tableTool = cardBody.querySelector(".ele-table-tool") + var pagination = cardBody.querySelector(".el-pagination-container") + var reservedHeight = bodyPadding + getOuterHeight(tableTool) + getOuterHeight(pagination) + self.tableHeight = Math.max(1, Math.floor(cardBody.clientHeight - reservedHeight)) + self.$nextTick(function () { + if (self.$refs.tableRef) { + self.$refs.tableRef.doLayout() + } + }) + }) }, dropdownCommand: function (command) { //监听下拉框事件 @@ -392,6 +474,29 @@ layout("/layouts/platform.html"){ }, created: function () { this.pageData() + }, + mounted: function () { + var self = this + this.updateTableHeight() + if (window.ResizeObserver) { + this.tableResizeObserver = new ResizeObserver(function () { + self.updateTableHeight() + }) + this.tableResizeObserver.observe(this.$el) + } else { + this.resizeHandler = function () { + self.updateTableHeight() + } + window.addEventListener("resize", this.resizeHandler) + } + }, + beforeDestroy: function () { + if (this.tableResizeObserver) { + this.tableResizeObserver.disconnect() + } + if (this.resizeHandler) { + window.removeEventListener("resize", this.resizeHandler) + } } }) diff --git a/src/main/resources/views/platform/sys/role/index.html b/src/main/resources/views/platform/sys/role/index.html index d2b0533a..4e452b42 100644 --- a/src/main/resources/views/platform/sys/role/index.html +++ b/src/main/resources/views/platform/sys/role/index.html @@ -9,10 +9,124 @@ layout("/layouts/platform.html"){ padding: 1px 2px; border-radius: 2px; } + + /* 关联用户弹窗固定占用可视区域,数据过多时仅表格内部滚动。 */ + .role-user-dialog { + display: flex; + flex-direction: column; + height: 90vh; + margin-bottom: 0; + overflow: hidden; + } + .role-user-dialog .el-dialog__header { + flex: 0 0 auto; + padding: 22px 30px 18px; + border-bottom: 1px solid #ebeef5; + } + .role-user-dialog .el-dialog__title { + color: #1f2d3d; + font-size: 18px; + font-weight: 600; + } + .role-user-dialog .el-dialog__body { + flex: 1 1 auto; + min-height: 0; + padding: 8px 30px 12px; + overflow: hidden; + } + .role-user-dialog .el-dialog__footer { + flex: 0 0 auto; + padding: 14px 30px 18px; + border-top: 1px solid #ebeef5; + } + .role-user-layout { + display: flex; + flex-direction: column; + height: 100%; + min-height: 0; + overflow: hidden; + } + .role-user-tip { + flex: 0 0 auto; + padding: 13px 16px; + color: #1677ff; + background: #f0f7ff; + border-radius: 4px; + } + .role-user-tip i { + margin-right: 8px; + } + .role-user-toolbar { + display: flex; + flex: 0 0 auto; + align-items: center; + gap: 12px; + margin: 16px 0; + } + .role-user-add-area, + .role-user-search-area { + display: flex; + align-items: center; + gap: 8px; + } + .role-user-remove-button { + margin-left: auto; + } + .role-user-table-wrap { + flex: 1 1 auto; + min-height: 0; + overflow: hidden; + } + .role-user-pagination { + flex: 0 0 auto; + margin-top: 16px; + } + .role-user-status-dot { + display: inline-block; + width: 8px; + height: 8px; + margin-right: 7px; + border-radius: 50%; + } + .role-user-status-dot.is-success { + background: #21c77a; + } + .role-user-status-dot.is-danger { + background: #f56c6c; + } + + /* 角色管理列表固定占满平台内容区,避免页面主体出现纵向滚动条。 */ + #app .role-manage-page { + display: flex; + flex-direction: column; + height: calc(100vh - 82px); + min-height: 0; + overflow: hidden; + } + #app .role-manage-query-card { + flex: 0 0 auto; + } + #app .role-manage-list-card { + flex: 1 1 auto; + min-height: 0; + overflow: hidden; + } + #app .role-manage-list-card > .el-card__body { + box-sizing: border-box; + display: flex; + flex-direction: column; + height: 100%; + min-height: 0; + overflow: hidden; + } + #app .role-manage-list-card .el-pagination-container { + flex: 0 0 auto; + }
- +
+ @@ -61,9 +175,11 @@ layout("/layouts/platform.html"){ - + +
@@ -274,71 +391,89 @@ layout("/layouts/platform.html"){ -
- - - - 将用户加入角色 -
- 从角色中移除 + custom-class="role-user-dialog" top="5vh" width="82%" @opened="updateUserTableHeight"> +
+
+
+ + + + 将用户加入角色 +
+
+ + + + + + + 查询 +
+ 从角色中移除
+
+ + + + + + + + + + + + +
+
- - - - - - - - - - - - - - - 关 闭 - @@ -388,6 +523,9 @@ layout("/layouts/platform.html"){ isLeaf: "leaf" }, tableData: [], + roleTableHeight: 300, + roleTableResizeObserver: null, + roleTableResizeHandler: null, moduleOptions: [], options: [], parentUnit: [], @@ -447,6 +585,8 @@ layout("/layouts/platform.html"){ doCmsForm: {}, userForm: { roleId: "", + searchName: "loginname", + searchKeyword: "", pageNumber: 1, pageSize: 10, totalCount: 0, @@ -454,6 +594,7 @@ layout("/layouts/platform.html"){ pageOrderBy: "" }, userTableData: [], + userTableHeight: 360, loading: false, dbUsers: [], //分配用户 selUsers: [], //分配选中的用户 @@ -575,6 +716,31 @@ layout("/layouts/platform.html"){ this.pageForm.pageNumber = 1 this.pageData() }, + // 根据角色列表卡片的剩余空间设置表格高度,分页区域始终保持可见。 + updateRoleTableHeight() { + this.$nextTick(() => { + const cardBody = this.$el.querySelector('.role-manage-list-card > .el-card__body') + if (!cardBody || cardBody.clientHeight <= 0) { + return + } + const pagination = cardBody.querySelector('.el-pagination-container') + const bodyStyle = window.getComputedStyle(cardBody) + const bodyPadding = (parseFloat(bodyStyle.paddingTop) || 0) + + (parseFloat(bodyStyle.paddingBottom) || 0) + const paginationStyle = pagination ? window.getComputedStyle(pagination) : null + const paginationHeight = pagination + ? pagination.offsetHeight + + (parseFloat(paginationStyle.marginTop) || 0) + + (parseFloat(paginationStyle.marginBottom) || 0) + : 0 + this.roleTableHeight = Math.max(1, Math.floor(cardBody.clientHeight - bodyPadding - paginationHeight)) + this.$nextTick(() => { + if (this.$refs.roleTableRef) { + this.$refs.roleTableRef.doLayout() + } + }) + }) + }, // 加载可选 PC 模块,创建、编辑和列表筛选共用同一数据源。 loadModuleOptions() { this.$axios.post("/platform/sys/role/listModule").then((res) => { @@ -624,6 +790,26 @@ layout("/layouts/platform.html"){ this.userForm.pageSize = val this.doUserLoad() }, + // 查询当前角色已关联用户,查询时从第一页重新加载。 + doUserSearch() { + this.userForm.pageNumber = 1 + this.doUserLoad() + }, + // 根据弹窗内表格容器的剩余空间计算高度,确保仅表格内部产生滚动条。 + updateUserTableHeight() { + this.$nextTick(() => { + const tableWrap = document.querySelector('.role-user-dialog .role-user-table-wrap') + if (!tableWrap || tableWrap.clientHeight <= 0) { + return + } + this.userTableHeight = Math.max(180, Math.floor(tableWrap.clientHeight)) + this.$nextTick(() => { + if (this.$refs.userTableRef) { + this.$refs.userTableRef.doLayout() + } + }) + }) + }, remoteMethod(query) { if (query !== "") { this.loading = true @@ -763,6 +949,7 @@ layout("/layouts/platform.html"){ this.userDialogVisible = true this.roleId = command.id this.userForm.roleId = command.id + this.userForm.pageNumber = 1 this.doUserLoad() } if ("enable" === command.type || "disable" === command.type) { @@ -903,6 +1090,31 @@ layout("/layouts/platform.html"){ this.loadModuleOptions() this.pageData() // await this.getMenuOptions() + }, + mounted() { + this.updateRoleTableHeight() + window.addEventListener("resize", this.updateUserTableHeight) + const page = this.$el.querySelector('.role-manage-page') + if (window.ResizeObserver && page) { + this.roleTableResizeObserver = new ResizeObserver(() => { + this.updateRoleTableHeight() + }) + this.roleTableResizeObserver.observe(page) + } else { + this.roleTableResizeHandler = () => { + this.updateRoleTableHeight() + } + window.addEventListener("resize", this.roleTableResizeHandler) + } + }, + beforeDestroy() { + window.removeEventListener("resize", this.updateUserTableHeight) + if (this.roleTableResizeObserver) { + this.roleTableResizeObserver.disconnect() + } + if (this.roleTableResizeHandler) { + window.removeEventListener("resize", this.roleTableResizeHandler) + } } }) diff --git a/src/main/resources/views/platform/sys/union/branchUnionManage.js b/src/main/resources/views/platform/sys/union/branchUnionManage.js index 8df135d5..a39abcd9 100644 --- a/src/main/resources/views/platform/sys/union/branchUnionManage.js +++ b/src/main/resources/views/platform/sys/union/branchUnionManage.js @@ -6,7 +6,7 @@ const branchUnionManage = { - 基层干部审核 + 基层干部审核 新建分工会 diff --git a/src/main/resources/views/platform/zhgh/club/infoManage/auditManager/index.html b/src/main/resources/views/platform/zhgh/club/infoManage/auditManager/index.html index ff21fb4f..459b8a48 100644 --- a/src/main/resources/views/platform/zhgh/club/infoManage/auditManager/index.html +++ b/src/main/resources/views/platform/zhgh/club/infoManage/auditManager/index.html @@ -1,12 +1,15 @@ - +
- - + +