This commit is contained in:
=
2026-06-12 14:38:45 +08:00
parent 8291531e6e
commit f65bcf7b67
32 changed files with 4743 additions and 0 deletions
@@ -0,0 +1,110 @@
package com.budwk.app.zhgh.staffmanage.retired.group.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.group.models.RetiredGroup;
import com.budwk.app.zhgh.staffmanage.retired.group.service.RetiredGroupService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/group/manage")
public class RetiredGroupManageController {
@Inject
private RetiredGroupService retiredGroupService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/group/manage/index.html")
@SaCheckPermission("retired.group.manage")
public void index() {
}
@At
@SaCheckPermission("retired.group.manage")
public Result getTree() {
return Result.success(retiredGroupService.getTree());
}
@At
@SaCheckPermission("retired.group.manage")
public Result doSetGroup(@Param("..") RetiredGroup retiredGroup) {
retiredGroupService.saveGroup(retiredGroup);
return Result.success();
}
@At
@SaCheckPermission("retired.group.manage")
public Result groupPageData(PageForm pageForm) {
return Result.success(retiredGroupService.groupPageData(pageForm));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.group.manage")
public Result deleteGroup(String id) {
retiredGroupService.deleteGroup(id);
return Result.success();
}
@At
@SaCheckPermission("retired.group.manage")
public Result componentUnitPageData(PageForm pageForm, String groupId) {
return Result.success(retiredGroupService.componentUnitPageData(pageForm, groupId));
}
@At
@SaCheckPermission("retired.group.manage")
public Result groupComponentUnit(String groupId) {
return Result.success(retiredGroupService.groupComponentUnit(groupId));
}
@At
@SaCheckPermission("retired.group.manage")
public Result notSetUnit(String groupId) {
return Result.success(retiredGroupService.notSetUnit(groupId));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.group.manage")
public Result doSetComponentUnit(String groupId, @Param("units") String[] units) {
retiredGroupService.setComponentUnit(groupId, units);
return Result.success();
}
@At
@SaCheckPermission("retired.group.manage")
public Result groupUser(PageForm pageForm, String groupId) {
return Result.success(retiredGroupService.groupUser(pageForm, groupId));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.group.manage")
public Result setGroupLeader(String userId, String groupId) {
retiredGroupService.setGroupLeader(userId, groupId);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.group.manage")
public Result removeGroupLeader(String userId, String groupId) {
retiredGroupService.removeGroupLeader(userId, groupId);
return Result.success();
}
}
@@ -0,0 +1,43 @@
package com.budwk.app.zhgh.staffmanage.retired.group.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.group.service.RetiredGroupService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/group/statistics")
public class RetiredGroupStatisticsController {
@Inject
private RetiredGroupService retiredGroupService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/group/statistics/index.html")
@SaCheckPermission("retired.group.statistics")
public void index() {
}
@At
@SaCheckPermission("retired.group.statistics")
public Result data(@Param("retiredGroupId") String retiredGroupId) {
return Result.success(retiredGroupService.statisticsData(retiredGroupId));
}
@At
@SaCheckPermission("retired.group.statistics")
public Result retiredGroup() {
return Result.success(retiredGroupService.options());
}
}
@@ -0,0 +1,42 @@
package com.budwk.app.zhgh.staffmanage.retired.group.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Many;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("retired_group")
@Comment("离退休小组")
public class RetiredGroup extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("小组名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String groupName;
@Column
@Comment("小组代码")
@ColDefine(type = ColType.INT)
private Integer groupCode;
@Many(target = RetiredGroupUnit.class, field = "retiredGroupId", key = "id")
private List<RetiredGroupUnit> retiredGroupUnitList;
}
@@ -0,0 +1,36 @@
package com.budwk.app.zhgh.staffmanage.retired.group.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("retired_group_unit")
@Comment("离退休小组组成单位")
public class RetiredGroupUnit extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("小组ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String retiredGroupId;
@Column
@Comment("单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
}
@@ -0,0 +1,52 @@
package com.budwk.app.zhgh.staffmanage.retired.group.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffmanage.retired.group.models.RetiredGroup;
import org.nutz.lang.util.NutMap;
import java.util.List;
public interface RetiredGroupService extends BaseService<RetiredGroup> {
/** 查询离退休小组树。 */
List<NutMap> getTree();
/** 新增或修改离退休小组。 */
void saveGroup(RetiredGroup retiredGroup);
/** 分页查询离退休小组。 */
Pagination groupPageData(PageForm pageForm);
/** 删除离退休小组及其单位关联。 */
void deleteGroup(String id);
/** 分页查询小组组成单位。 */
Pagination componentUnitPageData(PageForm pageForm, String groupId);
/** 查询小组已配置单位 ID。 */
List<String> groupComponentUnit(String groupId);
/** 查询可配置到当前小组的单位。 */
List<NutMap> notSetUnit(String groupId);
/** 保存小组组成单位。 */
void setComponentUnit(String groupId, String[] units);
/** 分页查询小组覆盖的离退休人员。 */
Pagination groupUser(PageForm pageForm, String groupId);
/** 设置小组负责人。 */
void setGroupLeader(String userId, String groupId);
/** 取消小组负责人。 */
void removeGroupLeader(String userId, String groupId);
/** 查询小组统计数据。 */
List<NutMap> statisticsData(String retiredGroupId);
/** 查询全部小组选项。 */
List<RetiredGroup> options();
}
@@ -0,0 +1,222 @@
package com.budwk.app.zhgh.staffmanage.retired.group.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.zhgh.staffmanage.retired.group.models.RetiredGroup;
import com.budwk.app.zhgh.staffmanage.retired.group.models.RetiredGroupUnit;
import com.budwk.app.zhgh.staffmanage.retired.group.service.RetiredGroupService;
import org.nutz.dao.Chain;
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.Daos;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.Arrays;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class RetiredGroupServiceImpl extends BaseServiceImpl<RetiredGroup> implements RetiredGroupService {
private static final String GROUP_LEADER_ROLE_CODE = "BRANCH_UNION_GROUP_LEADER";
private static final List<String> RETIRED_STATES = List.of("退休", "离休", "离退休");
public RetiredGroupServiceImpl(Dao dao) {
super(dao);
}
@Override
public List<NutMap> getTree() {
NutMap topMap = NutMap.NEW().addv("label", "离退休小组").addv("id", "1");
Sql sql = Sqls.create("select id, groupName as label from retired_group $condition");
Cnd cnd = Cnd.NEW();
cnd.asc("groupCode");
appendGroupScope(cnd, "id");
sql.setCondition(cnd);
topMap.put("children", listMap(sql));
return List.of(topMap);
}
@Override
public void saveGroup(RetiredGroup retiredGroup) {
dao().insertOrUpdate(retiredGroup);
}
@Override
public Pagination groupPageData(PageForm pageForm) {
Sql sql = Sqls.create("select * from retired_group $condition");
Cnd cnd = Cnd.NEW();
appendGroupScope(cnd, "id");
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("groupName", pageForm.getSearchKeyword());
seg.orLike("groupCode", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.asc("groupCode");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public void deleteGroup(String id) {
dao().clear(RetiredGroup.class, Cnd.where("id", "=", id));
dao().clear(RetiredGroupUnit.class, Cnd.where("retiredGroupId", "=", id));
}
@Override
public Pagination componentUnitPageData(PageForm pageForm, String groupId) {
Sql sql = Sqls.create("select * from sys_unit $condition");
Cnd cnd = Cnd.NEW();
cnd.and("id", "in", Sqls.create("select unitId from retired_group_unit where retiredGroupId = @retiredGroupId").setParam("retiredGroupId", groupId));
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(Cnd.likeEX("name", pageForm.getSearchKeyword()));
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public List<String> groupComponentUnit(String groupId) {
Sql sql = Sqls.create("select unitId from retired_group_unit where retiredGroupId = @groupId").setParam("groupId", groupId);
return (List<String>) Daos.query(dao(), sql.toString(), Sqls.callback.strs());
}
@Override
public List<NutMap> notSetUnit(String groupId) {
Sql sql = Sqls.create("""
select id, name, unitcode
from sys_unit
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.or("id", "in", Sqls.create("select unitId from retired_group_unit where retiredGroupId = @retiredGroupId").setParam("retiredGroupId", groupId));
cnd.or("id", "not in", Sqls.create("select unitId from retired_group_unit where retiredGroupId != @retiredGroupId").setParam("retiredGroupId", groupId));
cnd.and("unitLevel", "=", 2);
cnd.asc("unitcode");
sql.setCondition(cnd);
return listMap(sql);
}
@Override
public void setComponentUnit(String groupId, String[] units) {
dao().clear(RetiredGroupUnit.class, Cnd.where("retiredGroupId", "=", groupId));
if (units == null || units.length == 0) {
return;
}
List<RetiredGroupUnit> insertGroupUnits = Arrays.stream(units).map(v -> {
RetiredGroupUnit groupUnit = new RetiredGroupUnit();
groupUnit.setRetiredGroupId(groupId);
groupUnit.setUnitId(v);
return groupUnit;
}).toList();
dao().insert(insertGroupUnits);
}
@Override
public Pagination groupUser(PageForm pageForm, String groupId) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
DATE(u.birthday) AS birthday,
u.mobile,
u.personType,
u.userState,
u.unitName as unitname,
u.unionName as unionname,
GROUP_CONCAT(DISTINCT r.code) as roleCode,
IFNULL(GROUP_CONCAT(DISTINCT r.name), '组员') as roleName
FROM vw_user u
LEFT JOIN sys_user_role sur ON sur.userId = u.id AND sur.unionGroupId = @groupId
LEFT JOIN sys_role r ON r.id = sur.roleId
$condition
""");
sql.setParam("groupId", groupId);
Cnd cnd = Cnd.NEW();
cnd.and("u.unitId", "in", Sqls.create("select unitId from retired_group_unit where retiredGroupId = @retiredGroupId").setParam("retiredGroupId", groupId));
cnd.and("u.userState", "in", RETIRED_STATES);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.groupBy("u.id");
cnd.desc("r.name");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public void setGroupLeader(String userId, String groupId) {
String roleId = groupLeaderRoleId();
dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userId).and("roleId", "=", roleId));
Sys_user_role role = new Sys_user_role();
role.setUserId(userId);
role.setRoleId(roleId);
role.setUnionGroupId(groupId);
dao().insert(role);
}
@Override
public void removeGroupLeader(String userId, String groupId) {
String roleId = groupLeaderRoleId();
dao().clear(Sys_user_role.class, Cnd.where("userId", "=", userId)
.and("roleId", "=", roleId)
.and("unionGroupId", "=", groupId));
}
@Override
public List<NutMap> statisticsData(String retiredGroupId) {
Sql sql = Sqls.create("""
SELECT
g.id,
g.groupName,
g.groupCode,
COUNT(u.userState) AS retireCount,
GROUP_CONCAT(DISTINCT n.name) as componentUnit
FROM retired_group g
LEFT JOIN retired_group_unit rgu ON rgu.retiredGroupId = g.id
LEFT JOIN sys_unit n on n.id = rgu.unitId
LEFT JOIN vw_user u ON u.unitId = rgu.unitId AND u.userState IN ('退休', '离休', '离退休')
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("g.id", "=", retiredGroupId);
appendGroupScope(cnd, "g.id");
cnd.groupBy("g.id", "g.groupName", "g.groupCode");
cnd.asc("g.groupCode");
sql.setCondition(cnd);
return listMap(sql);
}
@Override
public List<RetiredGroup> options() {
return query(Cnd.NEW().asc("groupCode"));
}
private void appendGroupScope(Cnd cnd, String groupIdColumn) {
if (!AuthUtil.hasRoleOr("ltbzr", "ltbfzr", "ltbms", "sysadmin", "SYSADMIN") && StpUtil.hasRole("ltbxzzz")) {
cnd.and(groupIdColumn, "in", Sqls.create("select unionGroupId from sys_user_role where userId = @userId and roleId = @roleId")
.setParam("userId", StpUtil.getLoginIdAsString())
.setParam("roleId", groupLeaderRoleId()));
}
}
private String groupLeaderRoleId() {
// 当前库角色 ID 可能和参考项目不同,按角色编码取 ID,避免硬编码旧数据导致组长无法回显。
return dao().fetch("sys_role", Cnd.where("code", "=", GROUP_LEADER_ROLE_CODE)).getString("id");
}
}
@@ -0,0 +1,117 @@
package com.budwk.app.zhgh.staffmanage.retired.partyBranch.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.models.RetiredPartyBranch;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.RetiredPartyBranchService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/partyBranch/manage")
public class RetiredPartyBranchManageController {
@Inject
private RetiredPartyBranchService retiredPartyBranchService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/partyBranch/manage/index.html")
@SaCheckPermission("retired.partyBranch.manage")
public void index() {
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result getTree() {
return Result.success(retiredPartyBranchService.getTree());
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result doSetPartyBranch(@Param("..") RetiredPartyBranch retiredPartyBranch) {
retiredPartyBranchService.savePartyBranch(retiredPartyBranch);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.partyBranch.manage")
public Result deletePartyBranch(String id) {
retiredPartyBranchService.deletePartyBranch(id);
return Result.success();
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result partyBranchPageData(PageForm pageForm) {
return Result.success(retiredPartyBranchService.partyBranchPageData(pageForm));
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result partyBranchUserPageData(PageForm pageForm, String partyBranchId) {
return Result.success(retiredPartyBranchService.partyBranchUserPageData(pageForm, partyBranchId));
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result queryNonSetUser(String val) {
return Result.success(retiredPartyBranchService.queryNonSetUser(val));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.partyBranch.manage")
public Result doAddBranchPartyUser(String partyBranchId, @Param("userIds") String[] userIds) {
retiredPartyBranchService.addBranchPartyUser(partyBranchId, userIds);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.partyBranch.manage")
public Result deleteUser(String userId, String partyBranchId) {
retiredPartyBranchService.deleteUser(userId, partyBranchId);
return Result.success();
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result queryUserByPartyBranchId(String partyBranchId, String val) {
return Result.success(retiredPartyBranchService.queryUserByPartyBranchId(partyBranchId, val));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.partyBranch.manage")
public Result doAddCommitteeUser(String partyBranchId, String userId, String roleCode) {
retiredPartyBranchService.addCommitteeUser(partyBranchId, userId, roleCode);
return Result.success();
}
@At
@SaCheckPermission("retired.partyBranch.manage")
public Result partyBranchCommitteePageData(PageForm pageForm, String partyBranchId) {
return Result.success(retiredPartyBranchService.partyBranchCommitteePageData(pageForm, partyBranchId));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.partyBranch.manage")
public Result deleteCommittee(String userId, String partyBranchId) {
retiredPartyBranchService.deleteCommittee(userId, partyBranchId);
return Result.success();
}
}
@@ -0,0 +1,43 @@
package com.budwk.app.zhgh.staffmanage.retired.partyBranch.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.RetiredPartyBranchService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/partyBranch/statistics")
public class RetiredPartyBranchStatisticsController {
@Inject
private RetiredPartyBranchService retiredPartyBranchService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/partyBranch/statistics/index.html")
@SaCheckPermission("retired.partyBranch.statistics")
public void index() {
}
@At
@SaCheckPermission("retired.partyBranch.statistics")
public Result data(@Param("retiredPartyBranchId") String retiredPartyBranchId) {
return Result.success(retiredPartyBranchService.statisticsData(retiredPartyBranchId));
}
@At
@SaCheckPermission("retired.partyBranch.statistics")
public Result retiredPartyBranch() {
return Result.success(retiredPartyBranchService.options());
}
}
@@ -0,0 +1,36 @@
package com.budwk.app.zhgh.staffmanage.retired.partyBranch.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("retired_party_branch")
@Comment("离退休党支部")
public class RetiredPartyBranch extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("党支部名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String partyBranchName;
@Column
@Comment("党支部代码")
@ColDefine(type = ColType.INT)
private Integer partyBranchCode;
}
@@ -0,0 +1,41 @@
package com.budwk.app.zhgh.staffmanage.retired.partyBranch.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("retired_party_branch_user")
@Comment("离退休党支部人员")
public class RetiredPartyBranchUser extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("党支部ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String partyBranchId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("党支部委员角色编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String roleCode;
}
@@ -0,0 +1,55 @@
package com.budwk.app.zhgh.staffmanage.retired.partyBranch.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.models.RetiredPartyBranch;
import org.nutz.lang.util.NutMap;
import java.util.List;
public interface RetiredPartyBranchService extends BaseService<RetiredPartyBranch> {
/** 查询离退休党支部树。 */
List<NutMap> getTree();
/** 新增或修改离退休党支部。 */
void savePartyBranch(RetiredPartyBranch retiredPartyBranch);
/** 删除离退休党支部及其人员关联。 */
void deletePartyBranch(String id);
/** 分页查询离退休党支部。 */
Pagination partyBranchPageData(PageForm pageForm);
/** 分页查询党支部人员。 */
Pagination partyBranchUserPageData(PageForm pageForm, String partyBranchId);
/** 查询未设置党支部的离退休人员。 */
List<NutMap> queryNonSetUser(String val);
/** 批量添加党支部人员。 */
void addBranchPartyUser(String partyBranchId, String[] userIds);
/** 删除党支部人员。 */
void deleteUser(String userId, String partyBranchId);
/** 查询党支部下可设为委员的人员。 */
List<NutMap> queryUserByPartyBranchId(String partyBranchId, String val);
/** 设置党支部委员角色。 */
void addCommitteeUser(String partyBranchId, String userId, String roleCode);
/** 分页查询党支部委员。 */
Pagination partyBranchCommitteePageData(PageForm pageForm, String partyBranchId);
/** 删除党支部委员角色。 */
void deleteCommittee(String userId, String partyBranchId);
/** 查询党支部统计数据。 */
List<NutMap> statisticsData(String retiredPartyBranchId);
/** 查询全部党支部选项。 */
List<RetiredPartyBranch> options();
}
@@ -0,0 +1,232 @@
package com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.models.RetiredPartyBranch;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.models.RetiredPartyBranchUser;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.RetiredPartyBranchService;
import org.nutz.dao.Chain;
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.lang.util.NutMap;
import java.util.Arrays;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class RetiredPartyBranchServiceImpl extends BaseServiceImpl<RetiredPartyBranch> implements RetiredPartyBranchService {
private static final List<String> RETIRED_STATES = List.of("退休", "离休", "离退休");
public RetiredPartyBranchServiceImpl(Dao dao) {
super(dao);
}
@Override
public List<NutMap> getTree() {
NutMap topMap = NutMap.NEW().addv("label", "离退休党支部").addv("id", "1");
Sql sql = Sqls.create("select id, partyBranchName as label from retired_party_branch order by partyBranchCode");
topMap.put("children", listMap(sql));
return List.of(topMap);
}
@Override
public void savePartyBranch(RetiredPartyBranch retiredPartyBranch) {
dao().insertOrUpdate(retiredPartyBranch);
}
@Override
public void deletePartyBranch(String id) {
dao().delete(RetiredPartyBranch.class, id);
dao().clear(RetiredPartyBranchUser.class, Cnd.where("partyBranchId", "=", id));
}
@Override
public Pagination partyBranchPageData(PageForm pageForm) {
Sql sql = Sqls.create("select * from retired_party_branch $condition");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("partyBranchName", pageForm.getSearchKeyword());
seg.orLike("partyBranchCode", pageForm.getSearchKeyword());
cnd.and(seg);
}
cnd.asc("partyBranchCode");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public Pagination partyBranchUserPageData(PageForm pageForm, String partyBranchId) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.mobile,
u.personType,
u.userState,
u.unitName as unitname,
u.unionName as unionname
FROM retired_party_branch_user rpbu
LEFT JOIN vw_user u ON u.id = rpbu.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("rpbu.partyBranchId", "=", partyBranchId);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public List<NutMap> queryNonSetUser(String val) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.unitName as unitname,
u.userState,
u.political
FROM vw_user u
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.userState", "in", RETIRED_STATES);
cnd.and("u.id", "not in", Sqls.create("select userId from retired_party_branch_user"));
if (StrUtil.isNotBlank(val)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", val);
seg.orLike("u.loginname", val);
cnd.and(seg);
}
sql.setCondition(cnd);
return listPageMap(1, 10, sql).getList();
}
@Override
public void addBranchPartyUser(String partyBranchId, String[] userIds) {
if (userIds == null || userIds.length == 0) {
return;
}
List<RetiredPartyBranchUser> users = Arrays.stream(userIds).map(v -> {
RetiredPartyBranchUser partyBranchUser = new RetiredPartyBranchUser();
partyBranchUser.setPartyBranchId(partyBranchId);
partyBranchUser.setUserId(v);
return partyBranchUser;
}).toList();
dao().insert(users);
}
@Override
public void deleteUser(String userId, String partyBranchId) {
dao().clear(RetiredPartyBranchUser.class, Cnd.where("userId", "=", userId).and("partyBranchId", "=", partyBranchId));
}
@Override
public List<NutMap> queryUserByPartyBranchId(String partyBranchId, String val) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.unitName as unitname
FROM retired_party_branch_user rpbu
LEFT JOIN vw_user u ON u.id = rpbu.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.userState", "in", RETIRED_STATES);
cnd.and("rpbu.partyBranchId", "=", partyBranchId);
if (StrUtil.isNotBlank(val)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", val);
seg.orLike("u.loginname", val);
cnd.and(seg);
}
sql.setCondition(cnd);
return listMap(sql);
}
@Override
public void addCommitteeUser(String partyBranchId, String userId, String roleCode) {
dao().update(RetiredPartyBranchUser.class, Chain.make("roleCode", roleCode), Cnd.where("partyBranchId", "=", partyBranchId).and("userId", "=", userId));
}
@Override
public Pagination partyBranchCommitteePageData(PageForm pageForm, String partyBranchId) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.mobile,
u.personType,
u.userState,
u.unitName as unitname,
u.unionName as unionname,
dict.name as roleName
FROM retired_party_branch_user rpbu
LEFT JOIN sys_dict dict ON dict.code = rpbu.roleCode
LEFT JOIN vw_user u ON u.id = rpbu.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("rpbu.roleCode", "is not", null);
cnd.and("rpbu.partyBranchId", "=", partyBranchId);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public void deleteCommittee(String userId, String partyBranchId) {
dao().update(RetiredPartyBranchUser.class, Chain.make("roleCode", null), Cnd.where("userId", "=", userId).and("partyBranchId", "=", partyBranchId));
}
@Override
public List<NutMap> statisticsData(String retiredPartyBranchId) {
Sql sql = Sqls.create("""
SELECT
rpb.id,
rpb.partyBranchName,
rpb.partyBranchCode,
count(rpbu.userId) AS userCount
FROM retired_party_branch rpb
LEFT JOIN retired_party_branch_user rpbu ON rpbu.partyBranchId = rpb.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("rpb.id", "=", retiredPartyBranchId);
cnd.groupBy("rpb.id");
cnd.asc("rpb.partyBranchCode");
sql.setCondition(cnd);
return listMap(sql);
}
@Override
public List<RetiredPartyBranch> options() {
return query(Cnd.NEW().asc("partyBranchCode"));
}
}
@@ -0,0 +1,16 @@
package com.budwk.app.zhgh.staffmanage.retired.user.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum RetiredUserChangeType {
JOB_TO_RETIRED("在职转离退休", 1),
RETIRED_TO_DEAD("离退休转去世", 2);
private final String desc;
private final int code;
}
@@ -0,0 +1,42 @@
package com.budwk.app.zhgh.staffmanage.retired.user.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.user.service.RetiredUserService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/change")
public class RetiredChangeController {
@Inject
private RetiredUserService retiredUserService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/change/index.html")
@SaCheckPermission("retired.change")
public void index() {
}
@At
@SaCheckPermission("retired.change")
public Result pageData(PageForm pageForm,
Integer year,
@Param("unitId") String unitId,
@Param("unionId") String unionId,
@Param("changeType") Integer changeType) {
return Result.success(retiredUserService.changePageData(pageForm, year, unitId, unionId, changeType));
}
}
@@ -0,0 +1,61 @@
package com.budwk.app.zhgh.staffmanage.retired.user.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.group.service.RetiredGroupService;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.RetiredPartyBranchService;
import com.budwk.app.zhgh.staffmanage.retired.user.service.RetiredUserService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/history")
public class RetiredHistoryController {
@Inject
private RetiredUserService retiredUserService;
@Inject
private RetiredGroupService retiredGroupService;
@Inject
private RetiredPartyBranchService retiredPartyBranchService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/history/index.html")
@SaCheckPermission("retired.history")
public void index() {
}
@At
@SaCheckPermission("retired.history")
public Result pageData(PageForm pageForm,
@Param("year") Integer year,
@Param("unitId") String unitId,
@Param("unionId") String unionId,
@Param("retiredGroupId") String retiredGroupId,
@Param("retiredPartyBranchId") String retiredPartyBranchId) {
return Result.success(retiredUserService.historyPageData(pageForm, year, unitId, unionId, retiredGroupId, retiredPartyBranchId));
}
@At
@SaCheckPermission("retired.history")
public Result retiredGroup() {
return Result.success(retiredGroupService.options());
}
@At
@SaCheckPermission("retired.history")
public Result retiredPartyBranch() {
return Result.success(retiredPartyBranchService.options());
}
}
@@ -0,0 +1,121 @@
package com.budwk.app.zhgh.staffmanage.retired.user.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.group.service.RetiredGroupService;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.RetiredPartyBranchService;
import com.budwk.app.zhgh.staffmanage.retired.user.service.RetiredUserService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.Date;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/list")
public class RetiredListController {
@Inject
private RetiredUserService retiredUserService;
@Inject
private RetiredGroupService retiredGroupService;
@Inject
private RetiredPartyBranchService retiredPartyBranchService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/list/index.html")
@SaCheckPermission("retired.list")
public void index() {
}
@At
@SaCheckPermission("retired.list")
public Result pageData(PageForm pageForm,
@Param("unitId") String unitId,
@Param("unionId") String unionId,
@Param("retiredGroupId") String retiredGroupId,
@Param("retiredPartyBranchId") String retiredPartyBranchId) {
return Result.success(retiredUserService.pageData(pageForm, unitId, unionId, retiredGroupId, retiredPartyBranchId));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.list")
public Result changeToDie(String userId, Date deathDate) {
retiredUserService.changeToDie(userId, deathDate);
return Result.success();
}
@At
@SaCheckPermission("retired.list")
public Result nonRetiredUserPageData(PageForm pageForm) {
return Result.success(retiredUserService.nonRetiredUserPageData(pageForm));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.list")
public Result doBatchJoinRetire(@Param("userIds") String[] userIds) {
retiredUserService.batchJoinRetire(userIds);
return Result.success();
}
@At
@SaCheckPermission("retired.list")
public Result retiredGroup() {
return Result.success(retiredGroupService.options());
}
@At
@SaCheckPermission("retired.list")
public Result retiredPartyBranch() {
return Result.success(retiredPartyBranchService.options());
}
@At
@SaCheckPermission("retired.list")
public Result backUp() {
retiredUserService.backUp();
return Result.success();
}
@At
@SaCheckPermission("retired.list")
public Result userInfo(String userId) {
return Result.success(retiredUserService.userInfo(userId));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.list")
public Result doSubmit(@Param("user") String user, @Param("userId") String userId) {
retiredUserService.submit(user, userId);
return Result.success();
}
@At
@SaCheckPermission("retired.list")
public Result getInfo(String id) {
return Result.success(retiredUserService.getInfo(id));
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("retired.list")
public Result doDelete(String id) {
retiredUserService.deleteRetired(id);
return Result.success();
}
}
@@ -0,0 +1,60 @@
package com.budwk.app.zhgh.staffmanage.retired.user.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.staffmanage.retired.group.service.RetiredGroupService;
import com.budwk.app.zhgh.staffmanage.retired.partyBranch.service.RetiredPartyBranchService;
import com.budwk.app.zhgh.staffmanage.retired.user.service.RetiredUserService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/retired/statistics")
public class RetiredStatisticsController {
@Inject
private RetiredUserService retiredUserService;
@Inject
private RetiredGroupService retiredGroupService;
@Inject
private RetiredPartyBranchService retiredPartyBranchService;
@At("")
@Ok("beetl:/platform/zhgh/staffmanage/retired/statistics/index.html")
@SaCheckPermission("retired.statistics")
public void index() {
}
@At
@SaCheckPermission("retired.statistics")
public Result pageData(PageForm pageForm,
@Param("unitId") String unitId,
@Param("unionId") String unionId,
@Param("retiredGroupId") String retiredGroupId,
@Param("retiredPartyBranchId") String retiredPartyBranchId) {
return Result.success(retiredUserService.statisticsPageData(pageForm, unitId, unionId, retiredGroupId, retiredPartyBranchId));
}
@At
@SaCheckPermission("retired.statistics")
public Result retiredGroup() {
return Result.success(retiredGroupService.options());
}
@At
@SaCheckPermission("retired.statistics")
public Result retiredPartyBranch() {
return Result.success(retiredPartyBranchService.options());
}
}
@@ -0,0 +1,43 @@
package com.budwk.app.zhgh.staffmanage.retired.user.models;
import com.budwk.app.base.model.BaseModel;
import com.budwk.app.zhgh.staffmanage.retired.user.constant.RetiredUserChangeType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("retired_user_change")
@Comment("离退休人员变动记录")
public class RetiredUserChange extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("变动时间")
@ColDefine(type = ColType.DATETIME)
private Date changeDate;
@Column
@Comment("变动类型")
@ColDefine(type = ColType.INT)
private Integer changeType;
}
@@ -0,0 +1,33 @@
package com.budwk.app.zhgh.staffmanage.retired.user.models;
import com.budwk.app.sys.models.Sys_user;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@Table("retired_user_history")
@Comment("离退休人员年度历史快照")
public class RetiredUserHistory extends Sys_user {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("年度")
@ColDefine(type = ColType.INT, width = 4)
private Integer year;
}
@@ -0,0 +1,49 @@
package com.budwk.app.zhgh.staffmanage.retired.user.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.models.Sys_user;
import org.nutz.lang.util.NutMap;
import java.util.Date;
public interface RetiredUserService extends BaseService<Sys_user> {
/** 分页查询离退休人员名单。 */
Pagination pageData(PageForm pageForm, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId);
/** 将离退休人员设置为去世并写入变动记录。 */
void changeToDie(String userId, Date deathDate);
/** 分页查询可加入离退休名单的人员。 */
Pagination nonRetiredUserPageData(PageForm pageForm);
/** 批量将人员设置为离退休。 */
void batchJoinRetire(String[] userIds);
/** 按当前年度备份离退休人员快照。 */
void backUp();
/** 查询人员详情展示数据。 */
NutMap userInfo(String userId);
/** 新增或修改离退休人员,userJson 为前端表单 JSON。 */
void submit(String userJson, String userId);
/** 查询人员编辑数据。 */
Sys_user getInfo(String id);
/** 将人员移出离退休名单。 */
void deleteRetired(String id);
/** 分页查询离退休人员变动记录。 */
Pagination changePageData(PageForm pageForm, Integer year, String unitId, String unionId, Integer changeType);
/** 分页查询离退休人员历史快照。 */
Pagination historyPageData(PageForm pageForm, Integer year, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId);
/** 分页查询离退休统计明细。 */
Pagination statisticsPageData(PageForm pageForm, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId);
}
@@ -0,0 +1,393 @@
package com.budwk.app.zhgh.staffmanage.retired.user.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.zhgh.staffmanage.retired.user.constant.RetiredUserChangeType;
import com.budwk.app.zhgh.staffmanage.retired.user.models.RetiredUserChange;
import com.budwk.app.zhgh.staffmanage.retired.user.models.RetiredUserHistory;
import com.budwk.app.zhgh.staffmanage.retired.user.service.RetiredUserService;
import org.nutz.dao.Chain;
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.Daos;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class RetiredUserServiceImpl extends BaseServiceImpl<Sys_user> implements RetiredUserService {
private static final String GROUP_LEADER_ROLE_CODE = "BRANCH_UNION_GROUP_LEADER";
private static final List<String> RETIRED_STATES = List.of("退休", "离休", "离退休");
public RetiredUserServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination pageData(PageForm pageForm, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId) {
Sql sql = retiredUserSql();
Cnd cnd = retiredUserCnd(pageForm, unitId, unionId, retiredGroupId, retiredPartyBranchId);
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public void changeToDie(String userId, Date deathDate) {
Date changeDate = deathDate == null ? new Date() : deathDate;
update(Chain.make("userState", "死亡").add("personType", "去世人员"), Cnd.where("id", "=", userId));
insertChange(userId, RetiredUserChangeType.RETIRED_TO_DEAD, changeDate);
}
@Override
public Pagination nonRetiredUserPageData(PageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.mobile,
u.idCard,
u.position,
u.professionalTitle,
u.preparedBy,
u.education,
u.academicDegree,
u.nation,
null as campusName,
u.unionGroupName,
u.political,
u.personType,
u.userState,
u.unitName as unitname,
u.unionName as unionname,
null as threeUnitName
FROM vw_user u
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.userState", "not in", RETIRED_STATES);
cnd.and("u.userState", "!=", "死亡");
appendSearch(cnd, pageForm, "u");
appendUserScope(cnd, "u.unitId");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public void batchJoinRetire(String[] userIds) {
if (userIds == null || userIds.length == 0) {
return;
}
update(Chain.make("userState", "退休").add("personType", "离退休人员").add("retireDate", new Date()), Cnd.where("id", "in", userIds));
List<RetiredUserChange> changes = Arrays.stream(userIds).map(userId -> buildChange(userId, RetiredUserChangeType.JOB_TO_RETIRED, new Date())).toList();
dao().insert(changes);
}
@Override
public void backUp() {
dao().clear(RetiredUserHistory.class, Cnd.where("year", "=", DateUtil.thisYear()));
List<Sys_user> users = query(Cnd.where("userState", "in", RETIRED_STATES));
if (Lang.isEmpty(users)) {
return;
}
List<RetiredUserHistory> histories = new ArrayList<>();
for (Sys_user user : users) {
RetiredUserHistory history = new RetiredUserHistory();
BeanUtils.copyProperties(user, history, "password", "salt");
history.setId(R.UU32());
history.setYear(DateUtil.thisYear());
histories.add(history);
}
dao().fastInsert(histories);
}
@Override
public NutMap userInfo(String userId) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.political,
u.joinPartyDate,
u.nation,
u.nativePlace,
u.idCardType,
u.idCard,
u.mobile,
u.education,
u.marriage,
u.academicDegree,
u.position,
u.professionalTitle,
u.preparedBy,
u.arrivalAtSchoolDate,
u.teachingTime,
u.userState,
u.personType,
u.retireDate,
u.email,
u.unitId,
u.unitName,
u.unionId,
u.unionName,
u.unionGroupId,
u.unionGroupName,
u.memberTime,
u.families,
u.personalData,
null as campusName,
null as threeUnitName,
rg.groupName as retiredGroupName,
rpb.partyBranchName as retiredPartyBranchName
FROM vw_user u
LEFT JOIN retired_group_unit rgu ON rgu.unitId = u.unitId
LEFT JOIN retired_group rg ON rg.id = rgu.retiredGroupId
LEFT JOIN retired_party_branch_user rpbu ON rpbu.userId = u.id
LEFT JOIN retired_party_branch rpb ON rpb.id = rpbu.partyBranchId
WHERE u.id = @id
""").setParam("id", userId);
return (NutMap) Daos.query(dao(), sql.toString(), Sqls.callback.map());
}
@Override
public void submit(String userJson, String userId) {
if (StrUtil.isBlank(userJson)) {
throw new RuntimeException("人员信息不能为空");
}
// 前端按 JSON 字符串提交表单,统一在 service 层解析,避免 controller 承担公共参数处理。
Sys_user user = Json.fromJson(Sys_user.class, userJson);
if (StrUtil.isBlank(userId)) {
if (StrUtil.isBlank(user.getUserState())) {
user.setUserState("退休");
}
if (StrUtil.isBlank(user.getPersonType())) {
user.setPersonType("离退休人员");
}
if (user.getRetireDate() == null) {
user.setRetireDate(new Date());
}
dao().insert(user);
insertChange(user.getId(), RetiredUserChangeType.JOB_TO_RETIRED, new Date());
} else {
if (StrUtil.isBlank(user.getId())) {
user.setId(userId);
}
dao().updateIgnoreNull(user);
}
}
@Override
public Sys_user getInfo(String id) {
return dao().fetch(Sys_user.class, id);
}
@Override
public void deleteRetired(String id) {
update(Chain.make("userState", "在职").add("personType", null).add("retireDate", null), Cnd.where("id", "=", id));
dao().clear(RetiredUserChange.class, Cnd.where("userId", "=", id));
}
@Override
public Pagination changePageData(PageForm pageForm, Integer year, String unitId, String unionId, Integer changeType) {
Sql sql = Sqls.create("""
SELECT
ruc.id,
ruc.changeDate,
ruc.changeType,
u.loginname,
u.username,
u.sex,
u.birthday,
u.mobile,
u.idCard,
u.position,
u.professionalTitle,
u.preparedBy,
u.education,
u.academicDegree,
u.nation,
null as campusName,
u.unionGroupName,
u.personType,
u.userState,
u.unitName as unitname,
u.unionName as unionname
FROM retired_user_change ruc
LEFT JOIN vw_user u ON u.id = ruc.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.unionId", "=", unionId);
cnd.andEX("YEAR(ruc.changeDate)", "=", year);
cnd.andEX("ruc.changeType", "=", changeType);
appendUserScope(cnd, "u.unitId");
appendSearch(cnd, pageForm, "u");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public Pagination historyPageData(PageForm pageForm, Integer year, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.mobile,
u.idCard,
u.position,
u.professionalTitle,
u.preparedBy,
u.education,
u.academicDegree,
u.nation,
null as campusName,
unionGroup.name as unionGroupName,
u.personType,
u.userState,
n.name AS unitname,
gh.name AS unionname,
u.political,
null as threeUnitName,
rg.groupName AS retiredGroupName,
rpb.partyBranchName AS retiredPartyBranchName
FROM retired_user_history u
LEFT JOIN sys_unit n ON n.id = u.unitId
LEFT JOIN sys_union gh ON gh.id = n.unionId
LEFT JOIN sys_union_group unionGroup ON unionGroup.id = n.unionGroupId
LEFT JOIN retired_group_unit rgu ON rgu.unitId = u.unitId
LEFT JOIN retired_group rg ON rg.id = rgu.retiredGroupId
LEFT JOIN retired_party_branch_user rpbu ON rpbu.userId = u.id
LEFT JOIN retired_party_branch rpb ON rpb.id = rpbu.partyBranchId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("gh.id", "=", unionId);
cnd.andEX("u.year", "=", year);
cnd.andEX("rg.id", "=", retiredGroupId);
cnd.andEX("rpb.id", "=", retiredPartyBranchId);
appendSearch(cnd, pageForm, "u");
appendUserScope(cnd, "u.unitId");
cnd.groupBy("u.id");
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public Pagination statisticsPageData(PageForm pageForm, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId) {
Sql sql = retiredUserSql();
Cnd cnd = retiredUserCnd(pageForm, unitId, unionId, retiredGroupId, retiredPartyBranchId);
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
private Sql retiredUserSql() {
return Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
u.sex,
u.birthday,
u.mobile,
u.idCard,
u.position,
u.professionalTitle,
u.preparedBy,
u.education,
u.academicDegree,
u.nation,
null as campusName,
u.unionGroupName,
u.personType,
u.userState,
u.unitName as unitname,
u.unionName as unionname,
u.political,
null as threeUnitName,
rg.groupName as retiredGroupName,
rpb.partyBranchName as retiredPartyBranchName
FROM vw_user u
LEFT JOIN retired_group_unit rgu ON rgu.unitId = u.unitId
LEFT JOIN retired_group rg ON rg.id = rgu.retiredGroupId
LEFT JOIN retired_party_branch_user rpbu ON rpbu.userId = u.id
LEFT JOIN retired_party_branch rpb ON rpb.id = rpbu.partyBranchId
$condition
""");
}
private Cnd retiredUserCnd(PageForm pageForm, String unitId, String unionId, String retiredGroupId, String retiredPartyBranchId) {
Cnd cnd = Cnd.NEW();
cnd.and("u.userState", "in", RETIRED_STATES);
cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("u.unionId", "=", unionId);
cnd.andEX("rg.id", "=", retiredGroupId);
cnd.andEX("rpb.id", "=", retiredPartyBranchId);
appendSearch(cnd, pageForm, "u");
appendUserScope(cnd, "u.unitId");
cnd.groupBy("u.id");
return cnd;
}
private void appendSearch(Cnd cnd, PageForm pageForm, String alias) {
if (pageForm != null && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike(alias + ".loginname", pageForm.getSearchKeyword());
seg.orLike(alias + ".username", pageForm.getSearchKeyword());
cnd.and(seg);
}
}
private void appendUserScope(Cnd cnd, String unitColumn) {
if (!AuthUtil.hasRoleOr("ltbzr", "ltbfzr", "ltbms", "sysadmin", "SYSADMIN") && StpUtil.hasRole("ltbxzzz")) {
cnd.and(unitColumn, "in", Sqls.create("""
select rgu.unitId
from retired_group_unit rgu
inner join sys_user_role sur on rgu.retiredGroupId = sur.unionGroupId
where sur.userId = @userId and sur.roleId = @roleId
""").setParam("userId", StpUtil.getLoginIdAsString()).setParam("roleId", groupLeaderRoleId()));
}
}
private String groupLeaderRoleId() {
// 当前库角色 ID 可能和参考项目不同,按角色编码取 ID,保证离退休小组长数据范围正确。
return dao().fetch("sys_role", Cnd.where("code", "=", GROUP_LEADER_ROLE_CODE)).getString("id");
}
private void insertChange(String userId, RetiredUserChangeType type, Date changeDate) {
dao().insert(buildChange(userId, type, changeDate));
}
private RetiredUserChange buildChange(String userId, RetiredUserChangeType type, Date changeDate) {
RetiredUserChange change = new RetiredUserChange();
change.setUserId(userId);
change.setChangeDate(changeDate);
change.setChangeType(type.getCode());
return change;
}
}
@@ -0,0 +1,363 @@
/**
*Desc:
*Create by: jug
*Create time:2023/11/20/16:49
*/
<template>
<div>
<el-form :model="formData" :rules="formRules" label-width="0" ref="form" class="flow-task-form">
<el-descriptions :column="3" border>
<el-descriptions-item label="工号">
<el-form-item prop="loginname">
<el-input v-model="formData.loginname" maxlength="120" size="small"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="姓名">
<el-form-item prop="username">
<el-input v-model="formData.username" maxlength="100" size="small"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="性别">
<el-form-item prop="sex">
<el-radio-group v-model="formData.sex" size="small">
<el-radio border label="男">男</el-radio>
<el-radio border label="女">女</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="民族">
<el-form-item prop="nation">
<dict-select style="width: 100%" placeholder="请选择民族" v-model="formData.nation"
code="USER_NATION"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="出生日期">
<el-form-item prop="birthday">
<el-date-picker v-model="formData.birthday" type="date"
placeholder="请选择出生日期"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="籍贯">
<el-form-item prop="nativePlace">
<el-input v-model="formData.nativePlace" maxlength="100" placeholder="请输入籍贯"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="政治面貌">
<el-form-item prop="political">
<dict-select style="width: 100%" placeholder="请选择政治面貌" v-model="formData.political"
code="USER_POLITICAL"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="入党时间">
<el-form-item prop="joinPartyDate">
<el-date-picker v-model="formData.joinPartyDate" type="date"
placeholder="请选择入党时间"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="学历">
<el-form-item prop="education">
<dict-select style="width: 100%" placeholder="请选择学历" v-model="formData.education"
code="USER_EDUCATION"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="学位">
<el-form-item prop="academicDegree">
<dict-select style="width: 100%" placeholder="请选择学位" v-model="formData.academicDegree"
code="USER_ACADEMIC_DEGREE"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="婚姻状况">
<el-form-item prop="marriage">
<el-input v-model="formData.marriage" maxlength="50" placeholder="请输入婚姻状况"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="党政职务">
<el-form-item prop="position">
<el-input v-model="formData.position" maxlength="50" placeholder="请输入党政职务"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="职称">
<el-form-item prop="professionalTitle">
<el-input v-model="formData.professionalTitle" maxlength="50" placeholder="请输入职称"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="编制类别">
<el-form-item prop="preparedBy">
<el-input v-model="formData.preparedBy" maxlength="30" placeholder="请输入编制类别"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="来校时间">
<el-form-item prop="arrivalAtSchoolDate">
<el-input v-model="formData.arrivalAtSchoolDate" maxlength="20" placeholder="请输入来校时间"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="从教年月">
<el-form-item prop="teachingTime">
<el-date-picker v-model="formData.teachingTime" type="date"
placeholder="请选择从教年月"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="入会时间">
<el-form-item prop="memberTime">
<el-date-picker v-model="formData.memberTime" type="date"
placeholder="请选择入会时间"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属校区">
<el-form-item prop="campusName">
<el-input v-model="formData.campusName" readonly placeholder="系统自动显示"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="工作单位">
<el-form-item prop="unitId">
<el-select clearable filterable placeholder="请选择工作单位" style="width: 100%"
v-model="formData.unitId" @change="handleUnitChange">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="所属工会">
<el-form-item prop="unionName">
<el-input v-model="formData.unionName" readonly placeholder="系统自动显示"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="工会小组">
<el-form-item prop="unionGroupName">
<el-input v-model="formData.unionGroupName" readonly placeholder="系统自动显示"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="在职状态">
<el-form-item prop="userState">
<dict-select v-model="formData.userState" code="USER_STATE" style="width: 100%"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="教职工类别">
<el-form-item prop="personType">
<dict-select v-model="formData.personType" code="USER_PERSON_TYPE" style="width: 100%"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="退休时间">
<el-form-item prop="retireDate">
<el-date-picker v-model="formData.retireDate" type="date"
placeholder="请选择退休时间"
value-format="yyyy-MM-dd"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="身份证号码">
<el-form-item prop="idCard">
<el-input v-model="formData.idCard" maxlength="30" placeholder="请输入身份证号码"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="联系电话">
<el-form-item prop="mobile">
<el-input v-model="formData.mobile" maxlength="32" placeholder="请输入联系电话"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="电子邮箱">
<el-form-item prop="email">
<el-input v-model="formData.email" maxlength="255" placeholder="请输入电子邮箱"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="家庭主要成员" :span="3">
<el-form-item prop="families">
<el-table :data="formData.families" border size="small">
<el-table-column label="关系" prop="relation">
<template slot-scope="{row}">
<el-input v-model="row.relation" maxlength="50" placeholder="请输入与本人关系"></el-input>
</template>
</el-table-column>
<el-table-column label="姓名" prop="name">
<template slot-scope="{row}">
<el-input v-model="row.name" maxlength="50" placeholder="请输入姓名"></el-input>
</template>
</el-table-column>
<el-table-column label="工作单位" prop="unit">
<template slot-scope="{row}">
<el-input v-model="row.unit" maxlength="100" placeholder="请输入工作单位"></el-input>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark">
<template slot-scope="{row}">
<el-input v-model="row.remark" maxlength="100" placeholder="请输入备注"></el-input>
</template>
</el-table-column>
<el-table-column width="100px">
<template slot="header" slot-scope="scope">
<el-button type="primary" size="mini" @click="addFamily">添加</el-button>
</template>
<template slot-scope="scope">
<el-button type="danger" icon="el-icon-delete" size="mini"
@click="removeFamily(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="个人简历" :span="3">
<el-form-item prop="personalData">
<el-input type="textarea" :rows="4" v-model="formData.personalData" maxlength="2000"
placeholder="请输入个人简历"></el-input>
</el-form-item>
</el-descriptions-item>
</el-descriptions>
</el-form>
<el-row :gutter="10" class="mt10" type="flex" justify="end">
<el-button @click="doSubmit" type="primary">确定</el-button>
</el-row>
</div>
</template>
<script>
module.exports = {
name: "userEdit",
data() {
return {
userId: null,
units: [],
formData: this.defaultFormData(),
formRules: {
loginname: [{required: true, message: "必填", trigger: ["change", "blur"]}],
username: [{required: true, message: "必填", trigger: ["change", "blur"]}],
sex: [{required: true, message: "必填", trigger: ["change", "blur"]}],
userState: [{required: true, message: "必填", trigger: ["change", "blur"]}],
personType: [{required: true, message: "必填", trigger: ["change", "blur"]}]
}
}
},
components: {
'dict-select': httpVueLoader('/components/plugins/sysDict/DictSelect.vue?v=1.0.0')
},
methods: {
// 新增和重置共用默认值,避免页面直接修改同一个对象引用。
defaultFormData() {
return {
userState: '退休',
personType: '离退休人员',
families: []
}
},
doSubmit() {
this.$refs.form.validate(async valid => {
if (valid) {
const {code, msg} = await $.post('/platform/retired/list/doSubmit', {
user: JSON.stringify(this.formData),
userId: this.userId
})
if (code === 0) {
this.$message.success(msg)
this.$emit('finish')
} else {
this.$message.warning(msg)
}
}
})
},
reset() {
this.$set(this, "userId", null)
this.$set(this, "formData", this.defaultFormData())
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
async getInfo(id) {
this.$set(this, "userId", id)
const resp = await $.post('/platform/retired/list/userInfo', {userId: this.userId})
const data = this.normalizeUserData(resp.data || {})
this.$set(this, "formData", data)
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
handleUnitChange(unitId) {
const unit = this.units.find(item => item.id === unitId)
this.$set(this.formData, "unitName", unit ? unit.name : null)
},
addFamily() {
const families = (this.formData.families || []).concat([{}])
this.$set(this.formData, "families", families)
},
removeFamily(index) {
const families = (this.formData.families || []).slice()
families.splice(index, 1)
this.$set(this.formData, "families", families)
},
async loadUnits() {
const units = await this.$businessTool.listUnit()
this.$set(this, "units", units || [])
},
normalizeUserData(user) {
const data = Object.assign(this.defaultFormData(), user)
// 详情数据可能来自视图或实体,统一把大小写差异字段整理成页面绑定的驼峰字段。
const fieldMap = {
idcard: "idCard",
idcardtype: "idCardType",
unitid: "unitId",
unitname: "unitName",
unionid: "unionId",
unionname: "unionName",
uniongroupid: "unionGroupId",
uniongroupname: "unionGroupName",
joinpartydate: "joinPartyDate",
nativeplace: "nativePlace",
academicdegree: "academicDegree",
professionaltitle: "professionalTitle",
arrivalatschooldate: "arrivalAtSchoolDate",
teachingtime: "teachingTime",
userstate: "userState",
persontype: "personType",
retiredate: "retireDate",
membertime: "memberTime",
personaldata: "personalData",
campusname: "campusName",
threeunitname: "threeUnitName",
retiredgroupname: "retiredGroupName",
retiredpartybranchname: "retiredPartyBranchName"
}
Object.keys(fieldMap).forEach(key => {
if ((data[fieldMap[key]] === undefined || data[fieldMap[key]] === null) && user[key] !== undefined) {
this.$set(data, fieldMap[key], user[key])
}
})
if (typeof data.families === "string") {
try {
this.$set(data, "families", JSON.parse(data.families))
} catch (e) {
this.$set(data, "families", [])
}
} else if (!data.families) {
this.$set(data, "families", [])
}
return data
}
},
created() {
this.loadUnits()
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,168 @@
/**
*Desc:
*Create by: jug
*Create time:2023/7/25/9:14
*/
<template>
<div>
<el-descriptions :column="3" border>
<el-descriptions-item label="工号">{{ emptyText(formData.loginname) }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ emptyText(formData.username) }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ emptyText(formData.sex) }}</el-descriptions-item>
<el-descriptions-item label="民族">{{ emptyText(formData.nation) }}</el-descriptions-item>
<el-descriptions-item label="出生日期">{{ formatDate(formData.birthday) }}</el-descriptions-item>
<el-descriptions-item label="籍贯">{{ emptyText(formData.nativePlace) }}</el-descriptions-item>
<el-descriptions-item label="政治面貌">{{ emptyText(formData.political) }}</el-descriptions-item>
<el-descriptions-item label="入党时间">{{ formatDate(formData.joinPartyDate) }}</el-descriptions-item>
<el-descriptions-item label="婚姻状况">{{ emptyText(formData.marriage) }}</el-descriptions-item>
<el-descriptions-item label="学历">{{ emptyText(formData.education) }}</el-descriptions-item>
<el-descriptions-item label="学位">{{ emptyText(formData.academicDegree) }}</el-descriptions-item>
<el-descriptions-item label="党政职务">{{ emptyText(formData.position) }}</el-descriptions-item>
<el-descriptions-item label="职称">{{ emptyText(formData.professionalTitle) }}</el-descriptions-item>
<el-descriptions-item label="编制类别">{{ emptyText(formData.preparedBy) }}</el-descriptions-item>
<el-descriptions-item label="来校时间">{{ formatDate(formData.arrivalAtSchoolDate) }}</el-descriptions-item>
<el-descriptions-item label="从教年月">{{ formatDate(formData.teachingTime) }}</el-descriptions-item>
<el-descriptions-item label="入会时间">{{ formatDate(formData.memberTime) }}</el-descriptions-item>
<el-descriptions-item label="所属校区">{{ emptyText(formData.campusName) }}</el-descriptions-item>
<el-descriptions-item label="工作单位">{{ emptyText(formData.unitName) }}</el-descriptions-item>
<el-descriptions-item label="所属工会">{{ emptyText(formData.unionName) }}</el-descriptions-item>
<el-descriptions-item label="工会小组">{{ emptyText(formData.unionGroupName) }}</el-descriptions-item>
<el-descriptions-item label="所在科室">{{ emptyText(formData.threeUnitName) }}</el-descriptions-item>
<el-descriptions-item label="离退休小组">{{ emptyText(formData.retiredGroupName) }}</el-descriptions-item>
<el-descriptions-item label="离退休党支部">{{ emptyText(formData.retiredPartyBranchName) }}</el-descriptions-item>
<el-descriptions-item label="在职状态">{{ emptyText(formData.userState) }}</el-descriptions-item>
<el-descriptions-item label="教职工类别">{{ emptyText(formData.personType) }}</el-descriptions-item>
<el-descriptions-item label="退休时间">{{ formatDate(formData.retireDate) }}</el-descriptions-item>
<el-descriptions-item label="身份证号码">{{ emptyText(formData.idCard) }}</el-descriptions-item>
<el-descriptions-item label="联系电话">{{ emptyText(formData.mobile) }}</el-descriptions-item>
<el-descriptions-item label="电子邮箱">{{ emptyText(formData.email) }}</el-descriptions-item>
<el-descriptions-item label="家庭主要成员" :span="3">
<el-table v-if="formData.families && formData.families.length"
:data="formData.families" size="mini" border
:header-cell-style="{background:'#eff3f6'}"
style="width: 100%">
<el-table-column prop="relation" label="与本人关系" align="center"></el-table-column>
<el-table-column prop="name" label="姓名" align="center"></el-table-column>
<el-table-column prop="unit" label="单位" align="center"></el-table-column>
<el-table-column prop="remark" label="备注" align="center"></el-table-column>
</el-table>
<el-empty v-else :image-size="50" description="暂无家庭成员信息"></el-empty>
</el-descriptions-item>
<el-descriptions-item label="个人简历" :span="3">
<div v-if="formData.personalData" class="text-left" v-html="formData.personalData"></div>
<el-tag type="warning" v-else>暂无</el-tag>
</el-descriptions-item>
</el-descriptions>
<slot></slot>
</div>
</template>
<script>
module.exports = {
name: "userInfo",
props: {
id: {
type: String,
required: true
}
},
data() {
return {
formData: {}
}
},
methods: {
formatDate(val) {
if (val) {
return moment(val).format('YYYY-MM-DD')
}
return '暂无'
},
emptyText(val) {
if (val === undefined || val === null || val === '') {
return '暂无'
}
return val
},
getInfo() {
if (this.id) {
$.post('/platform/retired/list/userInfo', {userId: this.id}).then(res => {
this.$set(this, "formData", this.normalizeUserData(res.data || {}))
})
} else {
this.$set(this, "formData", {})
}
},
normalizeUserData(user) {
const data = Object.assign({}, user)
// 兼容视图查询和实体查询返回字段大小写不一致的情况,保证查看页字段能正常回显。
const fieldMap = {
idcard: "idCard",
idcardtype: "idCardType",
unitid: "unitId",
unitname: "unitName",
unionid: "unionId",
unionname: "unionName",
uniongroupid: "unionGroupId",
uniongroupname: "unionGroupName",
joinpartydate: "joinPartyDate",
nativeplace: "nativePlace",
academicdegree: "academicDegree",
professionaltitle: "professionalTitle",
arrivalatschooldate: "arrivalAtSchoolDate",
teachingtime: "teachingTime",
userstate: "userState",
persontype: "personType",
retiredate: "retireDate",
membertime: "memberTime",
personaldata: "personalData",
campusname: "campusName",
threeunitname: "threeUnitName",
retiredgroupname: "retiredGroupName",
retiredpartybranchname: "retiredPartyBranchName"
}
Object.keys(fieldMap).forEach(key => {
if ((data[fieldMap[key]] === undefined || data[fieldMap[key]] === null) && user[key] !== undefined) {
this.$set(data, fieldMap[key], user[key])
}
})
if (typeof data.families === "string") {
try {
this.$set(data, "families", JSON.parse(data.families))
} catch (e) {
this.$set(data, "families", [])
}
} else if (!data.families) {
this.$set(data, "families", [])
}
return data
}
},
watch: {
id: {
handler: function (val) {
this.getInfo()
},
immediate: true
}
},
created() {
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,101 @@
<template>
<div class="v-tree-layout">
<div class="shrink" :style="'left:' + (showTree ? 'calc(20% - 15px)' : '0')" @click="shrink">
<i v-if="!showTree" class="el-icon-arrow-right"></i>
<i v-else class="el-icon-arrow-left"></i>
</div>
<div class="v-tree-layout-left" :style="{width: showTree ? '20%' : '0'}">
<slot name="tree"></slot>
</div>
<div class="v-tree-layout-right" :style="{width: showTree ? '80%' : '100%'}">
<slot></slot>
</div>
</div>
</template>
<script>
module.exports = {
props: {},
data() {
return {
showTree: true
}
},
methods: {
shrink() {
this.showTree = !this.showTree
}
}
}
</script>
<style>
.shrink {
position: absolute;
height: 30px;
width: 30px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 15px;
background-color: white;
z-index: 99;
top: 0;
bottom: 0;
margin: auto;
box-shadow: 0 0 5px rgb(200, 200, 200);
cursor: pointer;
transition: all 500ms;
}
.shrink:hover {
box-shadow: 0 0 10px rgb(150, 150, 150);
}
.v-tree-layout-left::-webkit-scrollbar {
width: 4px;
height: 10px;
}
.v-tree-layout-left::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #dcdcdc;
}
.v-tree-layout-left::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px transparent;
border-radius: 10px;
background: transparent;
}
.v-tree-layout {
width: 100%;
height: 100%;
position: relative;
display: flex;
flex-direction: row;
}
.v-tree-layout-left {
width: 20%;
}
.v-tree-layout-left,
.v-tree-layout-left .el-tree {
background-color: #ffffff;
}
.v-tree-layout-right {
width: 80%;
border-left: 1px solid rgb(240, 240, 240);
}
.v-tree-layout-left,
.v-tree-layout-right {
height: 100%;
box-sizing: border-box;
overflow: auto;
transition: all 500ms;
position: relative;
}
</style>
@@ -0,0 +1,184 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年度:</div>
<div class="search-item-option">
<el-date-picker
placeholder="选择年度"
style="width: 100%"
type="year"
v-model="pageForm.year"
:clearable="false"
value-format="yyyy">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input v-model="pageForm.searchKeyword" clearable maxlength="20"></el-input>
</div>
</div>
<div class="search-item"
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">变更类型:</div>
<div class="search-item-option">
<el-select v-model="pageForm.changeType" style="width: 100%" clearable>
<el-option v-for="item in changeTypes" :label="item.desc" :value="item.code"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="退休人员" :app="this"></table-tool>
<el-table :data="tableData" style="width: 100%" stripe border
:header-cell-style="{background:'#FAFAFA'}" row-key="id" @sort-change="pageOrder"
v-loading="tableLoading">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:key="column.prop"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template slot-scope="{row}">
<span v-if="column.prop==='unitname'">{{isDisPlayCode ? '(' + row.unitcode + ')' : ''}}{{row.unitname}}</span>
<span v-else-if="column.prop==='unionname'">{{isDisPlayCode ? '(' + row.unioncode + ')' : ''}}{{row.unionname}}</span>
<span v-else-if="column.prop==='changeType'">{{getChangeTypeName(row.changeType)}}</span>
<span v-else>{{row[column.prop]}}</span>
</template>
</el-table-column>
<!--<el-table-column align="center" header-align="center" label="操作" width="200px">
<template slot-scope="{row}">
<el-button size="mini" @click="openView(row.id)">查看</el-button>
</template>
</el-table-column>-->
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
unions: [],
isDisPlayCode: false,
units: [],
tableColumns: [
{prop: 'loginname', label: '工号'},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'birthday', label: '出生年月', sortable: true},
{prop: 'mobile', label: '联系电话'},
{prop: 'idCard', label: '身份证号', width: 170},
{prop: 'position', label: '职务', sortable: true, checked: 0},
{prop: 'professionalTitle', label: '职称', sortable: true, checked: 0},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
{prop: 'nation', label: '民族', checked: 0},
{prop: 'political', label: '政治面貌', checked: 0},
{prop: 'changeType', label: '变更类型'}
],
changeTypes: [],
pageForm: {
year: (new Date().getFullYear()).toString()
}
}
},
methods: {
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
if (this.$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])) {
this.$set(this, "units", await this.$businessTool.listUnit(this.pageForm.unionId))
} else {
this.$set(this, "units", await this.$businessTool.listUnit(this.$store.state.user.union.id))
}
},
getChangeTypeName(changeType) {
const item = this.changeTypes.find(v => v.code === changeType)
return item ? item.desc : ''
},
openChange(row) {
this.$confirm('您确定要将' + row.username + '设为死亡吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async res => {
const resp = await $.post(loc() + '/changeToDie', {userId: row.id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
}
},
async created() {
this.pageData()
this.$set(this, "changeTypes", [
{code: 1, desc: '在职转离退休'},
{code: 2, desc: '离退休转去世'}
])
this.$set(this, "unions", await this.$businessTool.listUnion())
this.flushUnits()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,514 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__body {
height: calc(100% - 40px);
}
.el-transfer-panel__list {
height: 100%;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
padding-top: 0;
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-input
@input="(val)=>{$refs.tree.filter(val)}"
placeholder="输入关键字进行查找" clearable
v-model="filterText">
</el-input>
</div>
<el-tree ref="tree" :data="treeData" v-loading="treeLoading" node-key="id"
:props="{label:'groupName'}"
:expand-on-click-node="false"
:default-expanded-keys="['1']"
@node-click="handleNodeClick" accordion
highlight-current :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node">
<i class="el-icon-office-building"></i>&nbsp;
{{ data.label }}
</div>
<div v-if="node.level==2" style="font-size: 15px" :title="data.name" class="v-node">
<i class="el-icon-school"></i>
&nbsp; {{ data.label }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding: 0 10px">
<el-tabs v-model="tabActive" @tab-click="doSearch" type="card" style="box-shadow: none">
<el-tab-pane v-if="currentNode.level===1" label="小组信息" name="groupInfo"></el-tab-pane>
<el-tab-pane v-if="currentNode.level===2" label="组成单位"
name="componentUnit"></el-tab-pane>
<el-tab-pane v-if="currentNode.level===2" label="小组人员" name="userInfo"></el-tab-pane>
</el-tabs>
<el-card shadow="never">
<div style="display: flex; align-items: center; width: 100%">
<div class="btn-group tool-button" style="width: 220px">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
</el-input>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
</div>
<div style="margin-left: auto"
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<el-button v-if="tabActive==='groupInfo'" type="primary" icon="el-icon-plus"
@click="openAddGroup">新增小组
</el-button>
<el-button v-if="tabActive==='componentUnit'" type="primary" icon="el-icon-plus"
@click="openAddComponentUnit">新增组成单位
</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<div id="secondaryTableWrap" data-bottom="80">
<el-table :data="groupTableData" :height="tableHeight" v-if="tabActive==='groupInfo'">
<el-table-column type="index" label="序号" width="70px"></el-table-column>
<el-table-column prop="groupName" label="小组名称"></el-table-column>
<el-table-column prop="groupCode" label="小组代码"></el-table-column>
<el-table-column label="操作" width="200px">
<template slot-scope="{row}">
<el-button size="mini" type="primary" @click="openEditGroup(row)">
编辑
</el-button>
<el-button size="mini" type="danger" @click="deleteGroup(row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-table :data="componentUnitTableData" :height="tableHeight"
v-else-if="tabActive==='componentUnit'">
<el-table-column type="index" label="序号" width="70px"></el-table-column>
<el-table-column prop="name" label="单位名称"></el-table-column>
<el-table-column prop="unitcode" label="单位代码"></el-table-column>
</el-table>
<el-table :data="userTableData" :height="tableHeight" v-else-if="tabActive==='userInfo'">
<el-table-column type="index" label="序号" width="70px"></el-table-column>
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="username" label="姓名"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="birthday" label="出生年月"></el-table-column>
<el-table-column prop="mobile" label="联系电话"></el-table-column>
<el-table-column prop="unitname" label="所属单位"
show-overflow-tooltip></el-table-column>
<el-table-column prop="unionname" label="所属工会"
show-overflow-tooltip></el-table-column>
<el-table-column prop="roleName" label="身份"></el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{action:setGroupLeader,value:row}"
v-if="row.roleCode==null">
设为组长
</el-dropdown-item>
<el-dropdown-item :command="{action:removeGroupLeader,value:row}"
v-if="row.roleCode!=null">
取消组长
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</div>
<el-row class="el-pagination-container" style="margin-bottom: 0px">
<el-pagination
@size-change="(val)=>{pageForm.pageSize=val;pageData()}"
@current-change="(val)=>{pageForm.pageNumber=val;pageData()}"
:current-page="pageForm.pageNumber"
:page-sizes="[5,10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</guava>
<el-dialog :visible.sync="groupDialogVisible" title="新增离退休小组" width="40%">
<el-form :model="groupFormData" label-width="80px" ref="form">
<el-form-item label="小组名称" prop="groupName"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-input v-model="groupFormData.groupName" maxlength="20"></el-input>
</el-form-item>
<el-form-item label="小组代码" prop="groupCode"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-input-number v-model="groupFormData.groupCode" style="width: 100%;"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="groupDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doSetGroup">确定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="componentUnitDialogVisible" title="组成单位">
<div style="width: 100%;">
<el-transfer v-model="groupComponentUnit" :data="groupComponentUnitLeft"
filterable
ref="componentUnitTransfer"
:props="{
key: 'id',
label: 'name'
}"
:titles="['可选单位', '当前成员单位']"
></el-transfer>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="componentUnitDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doSetComponentUnit">确定</el-button>
</span>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
},
data() {
return {
treeLoading: false,
treeData: [],
filterText: null,
currentData: null,
currentNode: {level: 1},
tabActive: 'groupInfo',
tableHeight: null,
//小组table
groupTableData: [],
groupDialogVisible: false,
groupFormData: {
groupName: null,
groupCode: null,
id: null
},
//组成单位table
componentUnitTableData: [],
componentUnitDialogVisible: false,
groupComponentUnit: [],
groupComponentUnitLeft: [],
userTableData: []
}
},
methods: {
// 根据表格容器位置动态计算高度,避免依赖旧项目全局方法。
resizeTableHeight() {
this.$nextTick(() => {
const wrap = document.getElementById('secondaryTableWrap')
if (!wrap) {
return
}
const bottom = Number(wrap.getAttribute('data-bottom') || 80)
const height = window.innerHeight - wrap.getBoundingClientRect().top - bottom
this.$set(this, "tableHeight", height > 240 ? height : 240)
})
},
doSearch() {
this.$set(this.pageForm, "pageNumber", 1)
this.pageData()
},
pageData() {
if (this.tabActive === 'groupInfo') {
this.groupPageData()
} else if (this.tabActive === 'componentUnit') {
this.componentUnitPageData()
} else if (this.tabActive === 'userInfo') {
this.getGroupUser()
}
},
handleNodeClick(data, node) {
this.$set(this, "currentData", data)
this.$set(this, "currentNode", node)
if (node.level === 1) {
this.$set(this, "tabActive", 'groupInfo')
this.groupPageData()
} else if (node.level === 2) {
this.$set(this, "tabActive", 'componentUnit')
this.componentUnitPageData()
}
},
filterNode(value, data, node) {
if (!value) return true
return data.label.includes(value)
},
//左侧树数据
async getTree() {
const resp = await $.post(loc() + '/getTree')
if (resp.code === 0) {
this.$set(this, "treeData", resp.data)
if (this.$refs.tree && this.$refs.tree.root.childNodes) {
this.$set(this, "currentNode", this.$refs.tree.root.childNodes[0])
}
} else {
this.notifyWarning(resp.msg)
}
},
//打开新增小组模态框
openAddGroup() {
this.$set(this, "groupDialogVisible", true)
this.$nextTick(() => {
this.$set(this, "groupFormData", {
groupName: null,
groupCode: null,
id: null
})
this.$refs.form.resetFields()
})
},
openEditGroup(row) {
this.$set(this, "groupDialogVisible", true)
this.$set(this, "groupFormData", Object.assign({}, row))
},
//新增、编辑小组
async doSetGroup() {
const resp = await $.post(loc() + '/doSetGroup', this.groupFormData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.$set(this, "groupDialogVisible", false)
this.getTree()
this.groupPageData()
} else {
this.notifyWarning(resp.msg)
}
},
//小组分页数据
async groupPageData() {
const resp = await $.post(loc() + '/groupPageData', this.pageForm)
if (resp.code === 0) {
this.$set(this, "groupTableData", resp.data.list)
this.$set(this.pageForm, "totalCount", resp.data.totalCount)
}
},
//删除小组
deleteGroup(id) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async res => {
const resp = await $.post(loc() + '/deleteGroup', {id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getTree()
this.groupPageData()
} else {
this.notifyWarning(resp.msg)
}
})
},
//组成单位分页数据
async componentUnitPageData() {
const resp = await $.post(loc() + '/componentUnitPageData', Object.assign({}, this.pageForm, {
groupId: this.currentData.id
}))
if (resp.code === 0) {
this.$set(this, "componentUnitTableData", resp.data.list)
this.$set(this.pageForm, "totalCount", resp.data.totalCount)
}
},
openAddComponentUnit() {
this.$set(this, "componentUnitDialogVisible", true)
const groupId = this.currentData.id
this.getNotSetUnit(groupId)
this.getGroupComponentUnit(groupId)
if (this.$refs.componentUnitTransfer) {
this.$refs.componentUnitTransfer.clearQuery('left')
this.$refs.componentUnitTransfer.clearQuery('right')
}
},
//小组组成单位
async getGroupComponentUnit(groupId) {
const resp = await $.post(loc() + '/groupComponentUnit', {groupId})
if (resp.code === 0) {
this.$set(this, "groupComponentUnit", resp.data)
}
},
async getNotSetUnit(groupId) {
const resp = await $.post(loc() + '/notSetUnit', {groupId})
if (resp.code === 0) {
this.$set(this, "groupComponentUnitLeft", resp.data)
}
},
async doSetComponentUnit() {
const params = {
groupId: this.currentData.id,
units: JSON.stringify(this.groupComponentUnit)
}
const resp = await $.post(loc() + '/doSetComponentUnit', params)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.$set(this, "componentUnitDialogVisible", false)
this.componentUnitPageData()
} else {
this.notifyWarning(resp.msg)
}
},
async getGroupUser() {
const resp = await $.post(loc() + '/groupUser', Object.assign({}, this.pageForm, {groupId: this.currentData.id}))
if (resp.code === 0) {
this.$set(this, "userTableData", resp.data.list)
this.$set(this.pageForm, "totalCount", resp.data.totalCount)
} else {
this.notifyWarning(resp.msg)
}
},
setGroupLeader(user) {
this.$confirm('您确定要将' + user.username + '设为小组组长吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/setGroupLeader', {
userId: user.id,
groupId: this.currentData.id
})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getGroupUser()
} else {
this.notifyWarning(resp.msg)
}
})
},
removeGroupLeader(user) {
this.$confirm('您确定要将' + user.username + '设为小组组员吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/removeGroupLeader', {
userId: user.id,
groupId: this.currentData.id
})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getGroupUser()
} else {
this.notifyWarning(resp.msg)
}
})
}
},
async mounted() {
//动态改变table高度
await httpVueLoader('/components/plugins/Guava.vue', 'Guava')()
await httpVueLoader('/components/plugins/TreeLayout.vue', 'tree-layout')()
this.resizeTableHeight()
window.addEventListener('resize', this.resizeTableHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.resizeTableHeight)
},
created() {
this.getTree()
this.groupPageData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,99 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">所属小组:</div>
<div class="search-item-option">
<el-select placeholder="所属小组" v-model="retiredGroupId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredGroupOption" :label="item.groupName" :value="item.id"
:key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="getData" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="statisticsData"
header-align="center"
align="center"
show-summary
:summary-method="summaryMethod"
border
highlight-current-row>
<el-table-column label="序号" type="index" width="70px"></el-table-column>
<el-table-column label="小组名称" prop="groupName"></el-table-column>
<el-table-column label="小组代码" prop="groupCode" sortable></el-table-column>
<el-table-column label="组成单位" prop="componentUnit"></el-table-column>
<el-table-column label="人数" prop="retireCount" sortable></el-table-column>
</el-table>
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
data() {
return {
retiredGroupId: null,
statisticsData: [],
retiredGroupOption: []
}
},
methods: {
async getData() {
const resp = await $.post(loc() + '/data', {retiredGroupId: this.retiredGroupId})
if (resp.code === 0) {
this.$set(this, "statisticsData", resp.data)
} else {
this.notifyWarning(resp.msg)
}
},
summaryMethod(param) {
const {columns, data} = param
let sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (column.property === 'retireCount') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
}
})
return sums
},
async getRetiredGroup() {
const resp = await $.post(loc() + '/retiredGroup')
this.$set(this, "retiredGroupOption", resp.data)
},
},
created() {
this.getData()
this.getRetiredGroup()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,196 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年度:</div>
<div class="search-item-option">
<el-date-picker v-model="pageForm.year" value-format="yyyy" format="yyyy" type="year" style="width: 100%;" :clearable="false"></el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input clearable maxlength="20" v-model.trim="pageForm.searchKeyword"></el-input>
</div>
</div>
<div class="search-item"
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属小组:</div>
<div class="search-item-option">
<el-select placeholder="所属小组" v-model="pageForm.retiredGroupId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredGroupOption" :label="item.groupName" :value="item.id"
:key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属支部:</div>
<div class="search-item-option">
<el-select placeholder="所属支部" v-model="pageForm.retiredPartyBranchId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredPartyBranchOption" :label="item.partyBranchName"
:value="item.id" :key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="退休人员" :app="this">
</table-tool>
<el-table :data="tableData" style="width: 100%" stripe border
:header-cell-style="{background:'#FAFAFA'}" row-key="id" @sort-change="pageOrder"
v-loading="tableLoading">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:key="column.prop"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template slot-scope="{row}">
<span v-if="column.prop==='unitname'">{{isDisPlayCode ? '(' + row.unitcode + ')' : ''}}{{row.unitname}}</span>
<span v-else-if="column.prop==='unionname'">{{isDisPlayCode ? '(' + row.unioncode + ')' : ''}}{{row.unionname}}</span>
<span v-else-if="column.prop==='memberJoinTime'">{{row.memberJoinTime ? moment(row.memberJoinTime).format('YYYY-MM-DD') : ''}}</span>
<span v-else>{{row[column.prop]}}</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100px">
<template slot-scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
查看
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
unions: [],
isDisPlayCode: false,
units: [],
tableColumns: [
{prop: 'loginname', label: '工号'},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'birthday', label: '出生年月', sortable: true},
{prop: 'mobile', label: '联系电话'},
{prop: 'idCard', label: '身份证号', width: 170, checked: 0},
{prop: 'position', label: '职务', sortable: true, checked: 0},
{prop: 'professionalTitle', label: '职称', sortable: true, checked: 0},
{prop: 'personType', label: '人员类型', sortable: true, checked: 0},
{prop: 'userState', label: '在职状态', sortable: true, checked: 0},
{prop: 'political', label: '政治面貌'},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
{prop: 'unionGroupName', label: '工会小组', sortable: true, checked: 0},
{prop: 'retiredGroupName', label: '退休小组', sortable: true},
{prop: 'retiredPartyBranchName', label: '退休党支部', sortable: true},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
{prop: 'nation', label: '民族', checked: 0},
],
retiredGroupOption: [],
retiredPartyBranchOption: [],
pageForm: {
year: new Date().getFullYear() + ''
}
}
},
methods: {
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
if (this.$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])) {
this.$set(this, "units", await this.$businessTool.listUnit(this.pageForm.unionId))
} else {
this.$set(this, "units", await this.$businessTool.listUnit(this.$store.state.user.union.id))
}
},
async getRetiredGroup() {
const resp = await $.post(loc() + '/retiredGroup')
this.$set(this, "retiredGroupOption", resp.data)
},
async getRetiredPartyBranch() {
const resp = await $.post(loc() + '/retiredPartyBranch')
this.$set(this, "retiredPartyBranchOption", resp.data)
}
},
async created() {
this.pageData()
this.$set(this, "unions", await this.$businessTool.listUnion())
this.flushUnits()
this.getRetiredGroup()
this.getRetiredPartyBranch()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,379 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input clearable maxlength="20"
placeholder="请输入姓名工号进行查询"
v-model.trim="pageForm.searchKeyword"></el-input>
</div>
</div>
<div class="search-item"
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="请选择所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="请选择所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属小组:</div>
<div class="search-item-option">
<el-select placeholder="请选择所属小组" v-model="pageForm.retiredGroupId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredGroupOption" :label="item.groupName" :value="item.id"
:key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属支部:</div>
<div class="search-item-option">
<el-select placeholder="请选择所属支部" v-model="pageForm.retiredPartyBranchId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredPartyBranchOption" :label="item.partyBranchName"
:value="item.id" :key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="退休人员" :app="this">
<template #func>
<el-button size="small" type="primary" @click="openAdd">新增退休人员(系统中不存在)</el-button>
<el-button size="small" type="primary" @click="openSet">设置退休人员(系统中存在)</el-button>
<el-button size="small" type="primary" @click="backUp">备份为历史数据</el-button>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%" stripe border
:header-cell-style="{background:'#FAFAFA'}" row-key="id" @sort-change="pageOrder"
v-loading="tableLoading">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:key="column.prop"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template slot-scope="{row}">
<span v-if="column.prop==='unitname'">{{isDisPlayCode ? '(' + row.unitcode + ')' : ''}}{{row.unitname}}</span>
<span v-else-if="column.prop==='unionname'">{{isDisPlayCode ? '(' + row.unioncode + ')' : ''}}{{row.unionname}}</span>
<span v-else-if="column.prop==='memberJoinTime'">{{row.memberJoinTime ? moment(row.memberJoinTime).format('YYYY-MM-DD') : ''}}</span>
<span v-else>{{row[column.prop]}}</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100px">
<template slot-scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{action:openView,value:row}">
查看
</el-dropdown-item>
<el-dropdown-item :command="{action:openEdit,value:row}">
编辑
</el-dropdown-item>
<!-- <el-dropdown-item :command="{action:openChange,value:row}">-->
<!-- 变更-->
<!-- </el-dropdown-item>-->
<el-dropdown-item :command="{action:doDelete,value:row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button size="mini" @click="openView(row.id)">查看</el-button>
<el-button size="mini" type="primary" @click="openChange(row)">编辑</el-button>-->
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<user-info :id="userId"></user-info>
</template>
<template #edit>
<user-edit ref="userEdit" @finish="$refs.guava.index();pageData()"></user-edit>
</template>
<el-drawer title="设置退休人员(系统中存在)" :visible.sync="retireUserAddDialogVisible" size="70%">
<el-timeline>
<el-timeline-item timestamp="" placement="top">
<el-input placeholder="请输入内容" clearable v-model="nonRetiredUserPageForm.searchKeyword"
@keyup.enter.native="nonRetiredUserPageForm.pageNumber=1;nonRetiredUserPageData()"
style="width: 300px">
<el-select v-model="nonRetiredUserPageForm.searchName" slot="prepend" style="width: 80px;">
<el-option label="姓名" value="username"></el-option>
<el-option label="工号" value="loginname"></el-option>
</el-select>
</el-input>
<el-button type="primary" icon="el-icon-search"
@click="nonRetiredUserPageForm.pageNumber=1;nonRetiredUserPageData()"></el-button>
</el-timeline-item>
<el-timeline-item timestamp="" placement="top">
<el-table :data="nonRetiredUserTableData" style="width: 100%" row-key="id"
ref="nonRetiredUserTable">
<el-table-column type="selection" reserve-selection></el-table-column>
<el-table-column label="工号" prop="loginname" align="center"></el-table-column>
<el-table-column label="姓名" prop="username" align="center"></el-table-column>
<el-table-column label="性别" prop="sex" align="center"></el-table-column>
<el-table-column label="电话" prop="mobile" align="center"></el-table-column>
<el-table-column label="在职状态" prop="userState" align="center"></el-table-column>
<el-table-column label="人员类型" prop="personType" align="center"></el-table-column>
<el-table-column label="单位" prop="unitname" align="center"
show-overflow-tooltip></el-table-column>
<el-table-column label="工会" prop="unionname" align="center"
show-overflow-tooltip></el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
@size-change="(val)=>{nonRetiredUserPageForm.pageSize=val;nonRetiredUserPageData()}"
@current-change="(val)=>{nonRetiredUserPageForm.pageNumber=val;nonRetiredUserPageData()}"
:current-page="nonRetiredUserPageForm.pageNumber"
:page-size="nonRetiredUserPageForm.pageSize"
layout="total, prev, pager, next"
:total="nonRetiredUserPageForm.totalCount">
</el-pagination>
</el-row>
</el-timeline-item>
</el-timeline>
<span style="position: absolute;bottom: 20px;right: 20px">
<el-button @click="retireUserAddDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doBatchJoinRetire">确定</el-button>
</span>
</el-drawer>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'user-info': httpVueLoader('/components/module/retired/userInfo.vue'),
'user-edit': httpVueLoader('/components/module/retired/userEdit.vue'),
},
data() {
return {
retireUserAddDialogVisible: false,
isDisPlayCode: false,
unions: [],
units: [],
tableColumns: [
{prop: 'loginname', label: '工号'},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'birthday', label: '出生年月', sortable: true},
{prop: 'mobile', label: '联系电话'},
{prop: 'idCard', label: '身份证号', width: 170, checked: 0},
{prop: 'position', label: '职务', sortable: true, checked: 0},
{prop: 'professionalTitle', label: '职称', sortable: true, checked: 0},
{prop: 'personType', label: '人员类型', sortable: true, checked: 0},
{prop: 'userState', label: '在职状态', sortable: true, checked: 0},
{prop: 'political', label: '政治面貌'},
// {prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
{prop: 'unionGroupName', label: '工会小组', sortable: true, checked: 0},
{prop: 'retiredGroupName', label: '退休小组', sortable: true},
{prop: 'retiredPartyBranchName', label: '退休党支部', sortable: true},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
{prop: 'nation', label: '民族', checked: 0},
],
nonRetiredUserPageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0
},
nonRetiredUserTableData: [],
deadDialogVisible: false,
deathFormData: {},
retiredGroupOption: [],
retiredPartyBranchOption: [],
userId: null
}
},
methods: {
backUp() {
this.$confirm('确定把当前数据备份吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/backUp')
if (resp.code === 0) {
this.notifySuccess(resp.msg)
} else {
this.notifyWarning(resp.msg)
}
})
},
openAdd() {
this.$set(this, "userId", null)
this.$refs.guava.edit()
this.$refs.userEdit.reset()
},
openSet() {
this.$set(this, "retireUserAddDialogVisible", true)
this.$set(this.nonRetiredUserPageForm, "pageNumber", 1)
this.nonRetiredUserPageData()
if (this.$refs.nonRetiredUserTable) {
this.$refs.nonRetiredUserTable.clearSelection()
}
},
openEdit(row) {
this.$refs.guava.edit()
this.$refs.userEdit.getInfo(row.id)
},
async nonRetiredUserPageData() {
const resp = await $.post(loc() + '/nonRetiredUserPageData', this.nonRetiredUserPageForm)
if (resp.code === 0) {
this.$set(this, "nonRetiredUserTableData", resp.data.list)
this.$set(this.nonRetiredUserPageForm, "totalCount", resp.data.totalCount)
} else {
this.notifyWarning(resp.msg)
}
},
async doBatchJoinRetire() {
const selection = this.$refs.nonRetiredUserTable.selection
if (!selection.length) {
this.notifyWarning("请先勾选需要设置为退休的人员")
return
}
const resp = await $.post(loc() + "/doBatchJoinRetire", {userIds: JSON.stringify(selection.map(v => v.id))})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.$set(this, "retireUserAddDialogVisible", false)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
if (this.$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])) {
this.$set(this, "units", await this.$businessTool.listUnit(this.pageForm.unionId))
} else {
this.$set(this, "units", await this.$businessTool.listUnit(this.$store.state.user.union.id))
}
},
openChange(row) {
this.$set(this, "deadDialogVisible", true)
this.$nextTick(() => {
this.$set(this, "deathFormData", Object.assign({}, row))
})
},
setUserDeathInfo() {
this.$refs['deathForm'].validate(async valid => {
if (valid) {
const {id: userId, deathDate} = this.deathFormData
const resp = await $.post(loc() + '/changeToDie', {userId, deathDate})
if (resp.code === 0) {
this.$set(this, "deadDialogVisible", false)
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
}
})
},
async getRetiredGroup() {
const resp = await $.post(loc() + '/retiredGroup')
this.$set(this, "retiredGroupOption", resp.data)
},
async getRetiredPartyBranch() {
const resp = await $.post(loc() + '/retiredPartyBranch')
this.$set(this, "retiredPartyBranchOption", resp.data)
},
async openView(row) {
this.$set(this, "userId", row.id)
this.$refs.guava.view()
},
async doDelete(row) {
const confirm = await this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ('confirm' !== confirm) return
const resp = await $.post(loc() + "/doDelete", {id: row.id})
if (resp.code == 0) {
this.$message.success(resp.msg)
this.doSearch()
} else {
this.$message.warning(resp.msg)
}
}
},
async created() {
this.pageData()
this.$set(this, "unions", await this.$businessTool.listUnion())
this.flushUnits()
this.getRetiredGroup()
this.getRetiredPartyBranch()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,595 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__body {
height: calc(100% - 40px);
}
.el-transfer-panel__list {
height: 100%;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-input
@input="(val)=>{$refs.tree.filter(val)}"
placeholder="输入关键字进行查找" clearable
v-model="filterText">
</el-input>
</div>
<el-tree ref="tree" :data="treeData" v-loading="treeLoading" node-key="id"
:props="{label:'partyBranchName'}"
:expand-on-click-node="false"
:default-expanded-keys="['1']"
@node-click="handleNodeClick" accordion
highlight-current :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node">
<i class="el-icon-office-building"></i>&nbsp;
{{ data.label }}
</div>
<div v-if="node.level==2" style="font-size: 15px" :title="data.name" class="v-node">
<i class="el-icon-school"></i>
&nbsp; {{ data.label }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding: 0 10px">
<el-tabs v-model="tabActive" @tab-click="doSearch" type="card" style="box-shadow: none">
<el-tab-pane v-if="currentNode.level===1" label="党支部信息" name="groupInfo"></el-tab-pane>
<el-tab-pane v-if="currentNode.level===2" label="党支部人员" name="userInfo"></el-tab-pane>
<el-tab-pane v-if="currentNode.level===2" label="党支部委员会"
name="committee"></el-tab-pane>
</el-tabs>
<el-card shadow="never">
<div style="display: flex; align-items: center; width: 100%">
<div class="btn-group tool-button" style="width: 220px">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
</el-input>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
</div>
<div style="margin-left: auto">
<el-button v-if="tabActive==='groupInfo'" type="primary" icon="el-icon-plus"
@click="openAddPartyBranch">新增党支部
</el-button>
<el-button v-if="tabActive==='userInfo'" type="primary" icon="el-icon-plus"
@click="openAddUser">新增党支部人员
</el-button>
<el-button v-if="tabActive==='committee'" type="primary" icon="el-icon-plus"
@click="openAddCommittee">新增支部委员会人员
</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<div id="secondaryTableWrap" data-bottom="80">
<el-table :data="partyBranchTableData" :height="tableHeight" v-if="tabActive==='groupInfo'"
key="partyBranchTable">
<el-table-column type="index" label="序号" width="70px"></el-table-column>
<el-table-column prop="partyBranchName" label="党支部名称"></el-table-column>
<el-table-column prop="partyBranchCode" label="党支部代码"></el-table-column>
<el-table-column label="操作" width="200px">
<template slot-scope="{row}">
<el-button size="mini" type="primary" @click="openEditPartyBranch(row)">
编辑
</el-button>
<el-button size="mini" type="danger" @click="deletePartyBranch(row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-table :data="userTableData" :height="tableHeight" v-else-if="tabActive==='userInfo'"
key="userTable">
<el-table-column type="index" label="序号" width="70px"></el-table-column>
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="username" label="姓名"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="birthday" label="出生年月"></el-table-column>
<el-table-column prop="mobile" label="联系电话"></el-table-column>
<el-table-column prop="unitname" label="所属单位"
show-overflow-tooltip></el-table-column>
<el-table-column prop="unionname" label="所属工会"
show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="{row}">
<el-button size="mini" type="danger" @click="deleteUser(row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-table :data="committeeTableData" :height="tableHeight" v-else-if="tabActive==='committee'"
key="committeeTable">
<el-table-column type="index" label="序号" width="70px"></el-table-column>
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="username" label="姓名"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="birthday" label="出生年月"></el-table-column>
<el-table-column prop="mobile" label="联系电话"></el-table-column>
<el-table-column prop="roleName" label="身份"></el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="{row}">
<el-button size="mini" type="danger" @click="deleteCommittee(row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-row class="el-pagination-container" style="margin-bottom: 0px">
<el-pagination
@size-change="(val)=>{pageForm.pageSize=val;pageData()}"
@current-change="(val)=>{pageForm.pageNumber=val;pageData()}"
:current-page="pageForm.pageNumber"
:page-sizes="[5,10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</guava>
<el-dialog :visible.sync="partyBranchDialogVisible" title="新增离退休党支部" width="40%">
<el-form :model="partyBranchFormData" label-width="100px" ref="form">
<el-form-item label="党支部名称" prop="partyBranchName"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-input v-model="partyBranchFormData.partyBranchName" maxlength="20"></el-input>
</el-form-item>
<el-form-item label="党支部代码" prop="partyBranchCode"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-input-number v-model="partyBranchFormData.partyBranchCode" style="width: 100%"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="partyBranchDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doSetPartyBranch">确定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="userDialogVisible" title="新增党支部人员" width="40%">
<el-form :model="partyBranchUserFormData" label-width="80px" ref="partyBranchUserForm">
<el-form-item label="人员" prop="userIds"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-select v-model="partyBranchUserFormData.userIds"
style="width: 100%"
multiple
filterable
remote
reserve-keyword
placeholder="请输入姓名或者工号查询"
:remote-method="queryNonSetUser">
<el-option
v-for="item in nonSetUserOptions"
:key="item.id"
:label="item.username"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="userDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doAddBranchPartyUser">确定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="committeeDialogVisible" title="新增党支部委员" width="40%">
<el-form :model="partyBranchCommitteeFormData" label-width="80px" ref="partyBranchCommitteeForm">
<el-form-item label="人员" prop="userId"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-select v-model="partyBranchCommitteeFormData.userId"
style="width: 100%"
filterable
remote
placeholder="请输入姓名或者工号查询"
:remote-method="queryUserByPartyBranchId">
<el-option
v-for="item in committeeUserOptions"
:key="item.id"
:label="item.username"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="身份" prop="roleCode"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-select v-model="partyBranchCommitteeFormData.roleCode" style="width: 100%;">
<el-option v-for="item in retiredPartyBranchCommitteeRoleOptions"
:label="item.name"
:value="item.code"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="committeeDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doAddCommitteeUser">确定</el-button>
</span>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
},
data() {
return {
treeLoading: false,
treeData: [],
filterText: null,
currentData: null,
currentNode: {level: 1},
tabActive: 'groupInfo',
tableHeight: null,
//党支部table
partyBranchTableData: [],
partyBranchDialogVisible: false,
partyBranchFormData: {
partyBranchName: null,
partyBranchCode: null,
id: null
},
partyBranchUserFormData: {
userIds: []
},
userTableData: [],
userDialogVisible: false,
nonSetUserOptions: [],
//支部委员会信息
retiredPartyBranchCommitteeRoleOptions: [],
committeeDialogVisible: false,
committeeUserOptions: [],
partyBranchCommitteeFormData: {
userId: null,
roleCode: null
},
committeeTableData: []
}
},
methods: {
// 根据表格容器位置动态计算高度,避免依赖旧项目全局方法。
resizeTableHeight() {
this.$nextTick(() => {
const wrap = document.getElementById('secondaryTableWrap')
if (!wrap) {
return
}
const bottom = Number(wrap.getAttribute('data-bottom') || 80)
const height = window.innerHeight - wrap.getBoundingClientRect().top - bottom
this.$set(this, "tableHeight", height > 240 ? height : 240)
})
},
doSearch() {
this.$set(this.pageForm, "pageNumber", 1)
this.pageData()
},
pageData() {
if (this.tabActive === 'groupInfo') {
this.partyBranchPageData()
} else if (this.tabActive === 'userInfo') {
this.partyBranchUserPageData()
} else if (this.tabActive === 'committee') {
this.partyBranchCommitteePageData()
}
},
handleNodeClick(data, node) {
this.$set(this, "currentData", data)
this.$set(this, "currentNode", node)
if (node.level === 1) {
this.$set(this, "tabActive", 'groupInfo')
this.partyBranchPageData()
} else if (node.level === 2) {
this.$set(this, "tabActive", 'userInfo')
this.partyBranchUserPageData()
}
},
filterNode(value, data, node) {
if (!value) return true
return data.label.includes(value)
},
//左侧树数据
async getTree() {
const resp = await $.post(loc() + '/getTree')
if (resp.code === 0) {
this.$set(this, "treeData", resp.data)
if (this.$refs.tree && this.$refs.tree.root.childNodes) {
this.$set(this, "currentNode", this.$refs.tree.root.childNodes[0])
}
} else {
this.notifyWarning(resp.msg)
}
},
//打开新增党支部模态框
openAddPartyBranch() {
this.$set(this, "partyBranchDialogVisible", true)
this.$nextTick(() => {
this.$set(this, "partyBranchFormData", {
partyBranchName: null,
partyBranchCode: null,
id: null
})
this.$refs.form.resetFields()
})
},
openEditPartyBranch(row) {
this.$set(this, "partyBranchDialogVisible", true)
this.$set(this, "partyBranchFormData", Object.assign({}, row))
},
//新增、编辑党支部
async doSetPartyBranch() {
const resp = await $.post(loc() + '/doSetPartyBranch', this.partyBranchFormData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.$set(this, "partyBranchDialogVisible", false)
this.getTree()
this.partyBranchPageData()
} else {
this.notifyWarning(resp.msg)
}
},
//党支部分页数据
async partyBranchPageData() {
const resp = await $.post(loc() + '/partyBranchPageData', this.pageForm)
if (resp.code === 0) {
this.$set(this, "partyBranchTableData", resp.data.list)
this.$set(this.pageForm, "totalCount", resp.data.totalCount)
}
},
//删除党支部
deletePartyBranch(id) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async res => {
const resp = await $.post(loc() + '/deletePartyBranch', {id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getTree()
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
},
async partyBranchUserPageData() {
const resp = await $.post(loc() + '/partyBranchUserPageData', Object.assign({}, this.pageForm, {
partyBranchId: this.currentData.id
}))
if (resp.code === 0) {
this.$set(this, "userTableData", resp.data.list)
this.$set(this.pageForm, "totalCount", resp.data.totalCount)
} else {
this.notifyWarning(resp.msg)
}
},
openAddUser() {
this.$set(this, "userDialogVisible", true)
this.$set(this.partyBranchUserFormData, "userIds", [])
this.queryNonSetUser(null)
},
async queryNonSetUser(val) {
if (val !== '') {
const resp = await $.post(loc() + '/queryNonSetUser', {val})
if (resp.code === 0) {
this.$set(this, "nonSetUserOptions", resp.data)
}
} else {
this.$set(this, "nonSetUserOptions", [])
}
},
async doAddBranchPartyUser() {
this.$refs['partyBranchUserForm'].validate(async valid => {
if (valid) {
const userIds = JSON.stringify(this.partyBranchUserFormData.userIds)
const partyBranchId = this.currentData.id
const resp = await $.post(loc() + '/doAddBranchPartyUser', {
partyBranchId,
userIds
})
if (resp.code === 0) {
this.$set(this, "userDialogVisible", false)
this.notifySuccess(resp.msg)
this.partyBranchUserPageData()
} else {
this.notifyWarning(resp.msg)
}
}
})
},
async deleteUser(userId) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async res => {
const resp = await $.post(loc() + '/deleteUser', {userId, partyBranchId: this.currentData.id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
},
//打开新增支部委员会
openAddCommittee() {
this.$set(this, "committeeDialogVisible", true)
this.$set(this, "partyBranchCommitteeFormData", {
userId: null,
roleCode: null
})
this.queryUserByPartyBranchId(null)
},
//查询党支部下的人员
async queryUserByPartyBranchId(val) {
if (val) {
const resp = await $.post(loc() + '/queryUserByPartyBranchId', {
val,
partyBranchId: this.currentData.id
})
if (resp.code === 0) {
this.$set(this, "committeeUserOptions", resp.data)
}
} else {
this.$set(this, "committeeUserOptions", [])
}
},
//添加党支部委员会人员
doAddCommitteeUser() {
this.$refs['partyBranchCommitteeForm'].validate(async valid => {
if (valid) {
const resp = await $.post(loc() + '/doAddCommitteeUser', Object.assign({partyBranchId: this.currentData.id}, this.partyBranchCommitteeFormData))
if (resp.code === 0) {
this.$set(this, "committeeDialogVisible", false)
this.partyBranchCommitteePageData()
this.notifySuccess(resp.msg)
} else {
this.notifyWarning(resp.msg)
}
}
})
},
async partyBranchCommitteePageData() {
const resp = await $.post(loc() + '/partyBranchCommitteePageData', Object.assign({}, this.pageForm, {
partyBranchId: this.currentData.id
}))
if (resp.code === 0) {
this.$set(this, "committeeTableData", resp.data.list)
this.$set(this.pageForm, "totalCount", resp.data.totalCount)
} else {
this.notifyWarning(resp.msg)
}
},
deleteCommittee(userId) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/deleteCommittee', {userId, partyBranchId: this.currentData.id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
}
},
async mounted() {
//动态改变table高度
await httpVueLoader('/components/plugins/Guava.vue', 'Guava')()
await httpVueLoader('/components/plugins/TreeLayout.vue', 'tree-layout')()
this.resizeTableHeight()
window.addEventListener('resize', this.resizeTableHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.resizeTableHeight)
},
created() {
this.getTree()
this.partyBranchPageData()
this.$businessTool.getDictOptions('RETIRED_PARTY_BRANCH_COMMITTEE_ROLE').then(res => {
this.$set(this, "retiredPartyBranchCommitteeRoleOptions", res)
})
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,99 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">所属支部:</div>
<div class="search-item-option">
<el-select placeholder="所属支部" v-model="retiredPartyBranchId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredPartyBranchOption" :label="item.partyBranchName"
:value="item.id" :key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="getData" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="statisticsData"
header-align="center"
align="center"
show-summary
:summary-method="summaryMethod"
border
highlight-current-row>
<el-table-column label="序号" type="index" width="70px"></el-table-column>
<el-table-column label="党支部名称" prop="partyBranchName"></el-table-column>
<el-table-column label="党支部代码" prop="partyBranchCode" sortable
:summary-method="()=>{}"></el-table-column>
<el-table-column label="党员人数" prop="userCount" sortable></el-table-column>
</el-table>
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
data() {
return {
retiredPartyBranchId: null,
retiredPartyBranchOption: [],
statisticsData: [],
}
},
methods: {
async getData() {
const resp = await $.post(loc() + '/data', {retiredPartyBranchId: this.retiredPartyBranchId})
if (resp.code === 0) {
this.$set(this, "statisticsData", resp.data)
} else {
this.notifyWarning(resp.msg)
}
},
summaryMethod(param) {
const {columns, data} = param
let sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (column.property === 'userCount') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
}
})
return sums
},
async getRetiredPartyBranch() {
const resp = await $.post(loc() + '/retiredPartyBranch')
this.$set(this, "retiredPartyBranchOption", resp.data)
}
},
created() {
this.getData()
this.getRetiredPartyBranch()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,198 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input clearable maxlength="20" v-model.trim="pageForm.searchKeyword"
placeholder="请输入工号或者姓名查询"></el-input>
</div>
</div>
<div class="search-item"
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属小组:</div>
<div class="search-item-option">
<el-select placeholder="所属小组" v-model="pageForm.retiredGroupId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredGroupOption" :label="item.groupName" :value="item.id"
:key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属支部:</div>
<div class="search-item-option">
<el-select placeholder="所属支部" v-model="pageForm.retiredPartyBranchId" style="width: 100%;"
clearable
filterable>
<el-option v-for="item in retiredPartyBranchOption" :label="item.partyBranchName"
:value="item.id" :key="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="退休人员" :app="this">
</table-tool>
<el-table :data="tableData" style="width: 100%" stripe border
:header-cell-style="{background:'#FAFAFA'}" row-key="id" @sort-change="pageOrder"
v-loading="tableLoading">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:key="column.prop"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template slot-scope="{row}">
<span v-if="column.prop==='unitname'">{{isDisPlayCode ? '(' + row.unitcode + ')' : ''}}{{row.unitname}}</span>
<span v-else-if="column.prop==='unionname'">{{isDisPlayCode ? '(' + row.unioncode + ')' : ''}}{{row.unionname}}</span>
<span v-else-if="column.prop==='memberJoinTime'">{{row.memberJoinTime ? moment(row.memberJoinTime).format('YYYY-MM-DD') : ''}}</span>
<span v-else>{{row[column.prop]}}</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100px">
<template slot-scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{action:openView,value:row}">
查看
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<user-info :id="userId"></user-info>
</template>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'user-info': httpVueLoader('/components/module/retired/userInfo.vue'),
},
data() {
return {
unions: [],
isDisPlayCode: false,
units: [],
tableColumns: [
{prop: 'loginname', label: '工号'},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'birthday', label: '出生年月', sortable: true},
{prop: 'mobile', label: '联系电话'},
{prop: 'idCard', label: '身份证号', width: 170, checked: 0},
{prop: 'position', label: '职务', sortable: true, checked: 0},
{prop: 'professionalTitle', label: '职称', sortable: true, checked: 0},
{prop: 'personType', label: '人员类型', sortable: true, checked: 0},
{prop: 'userState', label: '在职状态', sortable: true, checked: 0},
{prop: 'political', label: '政治面貌'},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
{prop: 'unionGroupName', label: '工会小组', sortable: true, checked: 0},
{prop: 'retiredGroupName', label: '退休小组', sortable: true},
{prop: 'retiredPartyBranchName', label: '退休党支部', sortable: true},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
{prop: 'nation', label: '民族', checked: 0},
],
retiredGroupOption: [],
retiredPartyBranchOption: [],
userId: null
}
},
methods: {
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
if (this.$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_MEMBER_ADMIN'])) {
this.$set(this, "units", await this.$businessTool.listUnit(this.pageForm.unionId))
} else {
this.$set(this, "units", await this.$businessTool.listUnit(this.$store.state.user.union.id))
}
},
async getRetiredGroup() {
const resp = await $.post(loc() + '/retiredGroup')
this.$set(this, "retiredGroupOption", resp.data)
},
async getRetiredPartyBranch() {
const resp = await $.post(loc() + '/retiredPartyBranch')
this.$set(this, "retiredPartyBranchOption", resp.data)
},
async openView(row) {
this.$set(this, "userId", row.id)
this.$refs.guava.view()
}
},
async created() {
this.pageData()
this.$set(this, "unions", await this.$businessTool.listUnion())
this.flushUnits()
this.getRetiredGroup()
this.getRetiredPartyBranch()
}
})
</script>
<!--#
}
#-->