妇代会

This commit is contained in:
=
2026-03-20 17:05:26 +08:00
parent a1ed9678db
commit d5e0c09b2b
34 changed files with 3246 additions and 0 deletions
@@ -74,6 +74,11 @@ RoleConstant {
WORKER_CONGRESS_DELEGATE_SPECIALLY_INVITE("工代会特邀代表"),
WORKER_CONGRESS_DELEGATION_HEAD("工代会代表团团长"),
WOMAN_CONGRESS_DELEGATE_FORMAL("妇代会正式代表"),
WOMAN_CONGRESS_DELEGATE_ATTENDANCE("妇代会列席代表"),
WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE("妇代会特邀代表"),
WOMAN_CONGRESS_DELEGATION_HEAD("妇代会代表团团长"),
SCHOOL_UNION_WC_AUDIT_ADMIN("基层双代会校工会批复人"),
SCHOOL_HOSPITAL_LEADER("校医院负责人"),
@@ -50,6 +50,16 @@ public class Sys_user_role {
@Comment("工代会届次ID")
private String wcSessionId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("妇代会代表团ID")
private String womanDelegationId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("妇代会届次ID")
private String womanSessionId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("协会ID")
@@ -0,0 +1,298 @@
package com.budwk.app.zhgh.democratic.womancongress.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.param.TeacherCongressDelegateManageSearchAdjustUserParam;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation_unit;
import com.budwk.app.zhgh.democratic.womancongress.param.*;
import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressDelegateService;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.*;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.dao.util.cri.SqlExpressionGroup;
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 javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
/**
* @ClassName WomanCongressDelegateController
* @Description TODO
* @Author zhf
* @Date 2024/8/16 10:27
*/
@IocBean
@At("/platform/womanCongress/delegate/manage")
@Ok("json:full")
public class WomanCongressDelegateController {
@At("")
@Ok("beetl:/platform/zhgh/democratic/womancongress/delegate/manage/index.html")
@SaCheckPermission("woman.delegate.manage")
public void index() {
}
@Inject
private WomanCongressDelegateService womanCongressDelegateService;
@Inject
private Dao dao;
@Inject
private SysUserService sysUserService;
@Inject
private SysRoleService sysRoleService;
@At
@SaCheckPermission("woman.delegate.manage")
public Result pageData(@Valid WomanCongressDelegateManagePageParam pageForm) {
Pagination<Teacher_congress_delegate> pagination = womanCongressDelegateService.pageData(pageForm);
return Result.success(pagination);
}
@At
@SaCheckPermission("woman.delegate.manage")
public Result publicUser(@Valid WomanCongressDelegateManagePublicUserParam param) {
List<Woman_congress_delegation_unit> units = dao.query(Woman_congress_delegation_unit.class, Cnd.where("sessionId", "=", param.getSessionId()).and("delegationId", "=", param.getDelegationId()));
List<String> unitIds = units.stream().map(Woman_congress_delegation_unit::getUnitId).toList();
if(ObjectUtil.isEmpty(unitIds)){
return Result.error("代表团没有组成单位");
}
Sql sql = Sqls.create("""
SELECT
t1.id,
t1.username AS userName,
t1.loginName AS loginName,
t2.NAME AS unitName
FROM
`sys_user` t1
LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
WHERE
t1.id NOT IN ( SELECT userId FROM woman_congress_delegate WHERE sessionId = @sessionId AND delegationId = @delegationId )
AND
t1.unitId in (@unitIds)
AND
(t1.loginname like @keyWord or username like @keyWord)
""");
sql.setParam("sessionId", param.getSessionId());
sql.setParam("delegationId", param.getDelegationId());
sql.setParam("unitIds", unitIds);
sql.setParam("keyWord", "%" + param.getKeyWord() + "%");
Pagination pagination = womanCongressDelegateService.listPageMap(1, 50, sql);
return Result.success(pagination.getList());
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.delegate.manage")
@SLog(tag = "民主管理", msg = "妇代会代表管理新增代表")
public Result insert(@Valid @Param("data") WomanCongressDelegateManageInsertParam param) {
List<String> userIds = param.getUserIds();
Sql sql = Sqls.queryEntity("""
SELECT
t1.id as userId,
t1.username AS userName,
t1.loginName AS loginName,
t1.sex,
t1.mobile,
t1.unitId,
t2.NAME AS unitName,
t3.id AS unionId,
t3.NAME AS unionName
FROM
`sys_user` t1
LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
LEFT JOIN sys_union t3 ON t3.id = t2.unionId
WHERE t1.id in (@userIds)
""");
sql.setParam("userIds", userIds);
sql.setEntity(dao.getEntity(Woman_congress_delegate.class));
dao.execute(sql);
List<Woman_congress_delegate> delegates = sql.getList(Woman_congress_delegate.class);
for (Woman_congress_delegate delegate : delegates) {
delegate.setDelegationId(param.getDelegationId());
delegate.setSessionId(param.getSessionId());
delegate.setRoleId(param.getRoleId());
}
dao.insert(delegates);
for (String userId : userIds) {
dao.insert("sys_user_role", Chain.make("userId", userId).add("roleId", param.getRoleId())
.add("womanSessionId", param.getSessionId())
.add("womanDelegationId", param.getDelegationId()));
}
sysUserService.clearCache();
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.delegate.manage")
@SLog(tag = "民主管理", msg = "妇代会代表管理删除代表")
public Result delete(@Valid @Param("data") WomanCongressDelegateManageIdParam param) {
Dao extDao = Daos.ext(dao, FieldFilter.create(Woman_congress_delegate.class, "^userId|roleId|sessionId|delegationId$"));
List<Woman_congress_delegate> list = extDao.query(Woman_congress_delegate.class, Cnd.where("id", "in", param.getIds()));
//删除角色
for (Woman_congress_delegate delegate : list) {
dao.clear("sys_user_role", Cnd.where("userId", "=", delegate.getUserId())
.and("roleId", "=", delegate.getRoleId())
.and("womanSessionId", "=", delegate.getSessionId())
.and("womanDelegationId", "=", delegate.getDelegationId()));
}
dao.clear(Woman_congress_delegate.class, Cnd.where("id", "in", param.getIds()));
sysUserService.clearCache();
return Result.success();
}
/**
* 代表调整搜索用户
*
* @param param
* @return
*/
@At
@SaCheckPermission("woman.delegate.manage")
@Ok("json:{ignoreNull:true}")
public Result adjustUserList(@Valid TeacherCongressDelegateManageSearchAdjustUserParam param) {
// Dao extDao = Daos.ext(dao, FieldFilter.create(Teacher_congress_delegate.class, "^id|userId|userName|loginName|unitName$"));
// SqlExpressionGroup seg = new SqlExpressionGroup();
// seg.orLike("userName", param.getKeyWord());
// seg.orLike("loginName", param.getKeyWord());
// List<Teacher_congress_delegate> list = extDao.query(Teacher_congress_delegate.class, Cnd.where("sessionId", "=", param.getSessionId()).and(seg).limit(1, 10));
// return Result.success(list);
Sql sql = Sqls.create("""
SELECT
u.id,
u.id AS userId,
u.username AS userName,
u.loginname AS loginName,
u.sex,
u.unionName,
u.unitName
FROM
vw_user u
LEFT JOIN woman_congress_delegate tcd ON tcd.userId = u.id
$condition
""");
Cnd cnd = Cnd.NEW();
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", param.getKeyWord());
seg.orLike("u.loginname", param.getKeyWord());
cnd.and(seg);
sql.setCondition(cnd);
Pagination pagination = sysUserService.listPageMap(1, 10, sql);
return Result.success(pagination.getList());
}
/**
* 调整代表
*
* @param params
* @return
*/
@At
@SaCheckPermission("woman.delegate.manage")
@Aop(TransAop.READ_COMMITTED)
public Result doAdjustUser(@Valid String sessionId, @Valid @Param("data") WomanCongressDelegateManageAdjustUserParam[] params) {
if (ObjectUtil.isEmpty(params)) {
return Result.error("调整用户不能为空");
}
//角色数据
Sys_role delegateFormalRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_FORMAL.name());
Sys_role delegateAttendanceRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_ATTENDANCE.name());
Sys_role delegateSpeciallyInviteRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE.name());
Sys_role delegationHeadRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD.name());
//删除相关的数据
for (WomanCongressDelegateManageAdjustUserParam param : params) {
//删除代表表数据
dao.clear(Woman_congress_delegate.class, Cnd.where(Woman_congress_delegate::getUserId, "=", param.getUserId())
.and(Woman_congress_delegate::getSessionId, "=", param.getSessionId()));
//删除角色数据
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getUserId, "=", param.getUserId())
.and(Sys_user_role::getRoleId, "in", List.of(delegateFormalRole.getId(), delegateAttendanceRole.getId(), delegateSpeciallyInviteRole.getId(), delegationHeadRole.getId()))
.and(Sys_user_role::getWomanSessionId, "=", param.getSessionId()));
}
Sql sql = Sqls.queryEntity("""
SELECT
t1.id as userId,
t1.username AS userName,
t1.loginName AS loginName,
t1.sex,
TIMESTAMPDIFF(YEAR,t1.birthday,CURDATE()) AS age,
t1.mobile,
t1.unitId,
t2.NAME AS unitName,
t3.id AS unionId,
t3.NAME AS unionName
FROM
`sys_user` t1
LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
LEFT JOIN sys_union t3 ON t3.id = t2.unionId
WHERE t1.id in (@userIds)
""");
sql.setParam("userIds", Arrays.stream(params).map(WomanCongressDelegateManageAdjustUserParam::getUserId).toList());
sql.setEntity(dao.getEntity(Woman_congress_delegate.class));
dao.execute(sql);
List<Woman_congress_delegate> delegates = sql.getList(Woman_congress_delegate.class);
//插入到代表表
for (Woman_congress_delegate delegate : delegates) {
Optional<WomanCongressDelegateManageAdjustUserParam> paramOptional = Arrays.stream(params).filter(param -> param.getUserId().equals(delegate.getUserId())).findFirst();
if (paramOptional.isPresent()) {
String delegationId = paramOptional.get().getDelegationId();
String roleId = paramOptional.get().getRoleId();
delegate.setDelegationId(delegationId);
delegate.setRoleId(roleId);
delegate.setSessionId(sessionId);
}
}
dao.insert(delegates);
//插入权限
List<Sys_user_role> sysUserRoles = delegates.stream().map(delegate -> {
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setUserId(delegate.getUserId());
sysUserRole.setRoleId(delegate.getRoleId());
sysUserRole.setWomanSessionId(sessionId);
sysUserRole.setWomanDelegationId(delegate.getDelegationId());
return sysUserRole;
}).toList();
dao.insert(sysUserRoles);
sysUserService.clearCache();
sysRoleService.clearCache();
return Result.success();
}
}
@@ -0,0 +1,61 @@
package com.budwk.app.zhgh.democratic.womancongress.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
import com.budwk.app.zhgh.democratic.womancongress.param.WomanCongressDelegateManagePageParam;
import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressDelegateService;
import org.nutz.dao.Dao;
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 javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
/**
* @ClassName WomanCongressDelegateReadController
* @Description TODO
* @Author zhf
* @Date 2024/11/26 17:47
*/
@IocBean
@At("/platform/womanCongress/delegate/read")
@Ok("json:full")
public class WomanCongressDelegateReadController {
@At("")
@Ok("beetl:/platform/zhgh/democratic/womancongress/delegate/read/index.html")
@SaCheckPermission("woman.delegate.read")
public void index() {
}
@Inject
private WomanCongressDelegateService womanCongressDelegateService;
@Inject
private Dao dao;
@At
@SaCheckPermission("woman.delegate.read")
public Result pageData(@Valid WomanCongressDelegateManagePageParam pageForm) {
Pagination<Teacher_congress_delegate> pagination = womanCongressDelegateService.pageData(pageForm);
return Result.success(pagination);
}
/**
* 导出xlsx 这里不要加@valid注解 不需要分页
*/
@At
@Ok("void")
@SaCheckPermission("woman.delegate.read")
public void exportXlsx(WomanCongressDelegateManagePageParam param, HttpServletResponse response) {
womanCongressDelegateService.exportXlsx(param, response);
}
}
@@ -0,0 +1,337 @@
package com.budwk.app.zhgh.democratic.womancongress.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_unit;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation_unit;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
/**
* 代表团管理
*/
@IocBean
@At("/platform/womanCongress/delegation")
@Ok("json:full")
public class WomanCongressDelegationController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@Inject
private SysUserService sysUserService;
@Inject
private SysRoleService sysRoleService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/womancongress/delegation/index.html")
@SaCheckPermission("woman.delegation")
public void index() {
}
@At
@SaCheckPermission("woman.delegation")
public Result tree(String sessionId) {
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
nodeList.add(new TreeNode<>("妇代会代表团", "0", "妇代会代表团", 1000));
List<Woman_congress_delegation> delegations = dao.query(Woman_congress_delegation.class, Cnd.where("sessionId", "=", sessionId).asc("code"));
for (int i = 0; i < delegations.size(); i++) {
nodeList.add(new TreeNode<>(delegations.get(i).getId(), "妇代会代表团", delegations.get(i).getName(), i));
}
List<Tree<String>> treeList = TreeUtil.build(nodeList, "0");
return Result.success(treeList);
}
@At
@POST
@SaCheckPermission("woman.delegation")
@ApiOperation(value = "届次信息列表", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "sessionId", value = "届次ID", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "delegationId", value = "代表团ID", dataType = "String", paramType = "query")
})
public Result pageData(@Valid @ApiParam(value = "分页表单") PageForm pageForm, @Valid @ApiParam(value = "届次ID") String sessionId) {
Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
Sql sql = Sqls.create("""
SELECT
wcd.*,
wcs.fullName as sessionName,
GROUP_CONCAT(u.username,u.loginname) as delegationHead
FROM
woman_congress_delegation wcd
LEFT JOIN woman_congress_session wcs ON wcs.id = wcd.sessionId
LEFT JOIN sys_user_role sur ON sur.womanDelegationId = wcd.id
AND sur.roleId = @roleId and sur.womanSessionId=@sessionId
LEFT JOIN sys_user u ON u.id = sur.userId
$condition""");
sql.setParam("roleId", role.getId());
sql.setParam("sessionId", sessionId);
Cnd cnd = Cnd.NEW();
cnd.and("wcd.sessionId","=",sessionId);
cnd.groupBy("wcd.id");
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.where().andLike("name", pageForm.getSearchKeyword());
}
cnd.asc("wcd.code");
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.delegation")
public Result insert(Woman_congress_delegation delegation) {
dao.insert(delegation);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.delegation")
public Result update(Woman_congress_delegation delegation) {
dao.updateIgnoreNull(delegation);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.delegation")
public Result delete(String id) {
dao.delete(Woman_congress_delegation.class, id);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.delegation")
public Result findOne(String id) {
Woman_congress_delegation delegation = dao.fetch(Woman_congress_delegation.class, id);
return Result.success(delegation);
}
/**
* 组成单位数据
*
* @param delegationId 代表团ID
* @return
*/
@At
@SaCheckPermission("woman.delegation")
public Result partUnitTransferData(String delegationId, String sessionId) {
//找出本届次已经设置了代表团的所有单位
List<Woman_congress_delegation_unit> delegationUnits = dao.query(Woman_congress_delegation_unit.class, Cnd.where("sessionId", "=", sessionId));
List<String> unitIds = delegationUnits.stream().map(Woman_congress_delegation_unit::getUnitId).toList();
//找出本代表团的单位
List<String> selectUnitIds = delegationUnits.stream().filter(unit -> unit.getDelegationId().equals(delegationId)).map(Woman_congress_delegation_unit::getUnitId).toList();
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orEX("id", "not in", unitIds);
seg.orEX("id", "in", selectUnitIds);
// Cnd cnd = Cnd.where("unitLevel", "=", 2);
Cnd cnd = Cnd.where("unitTypeCode", "=", "1");
if (!seg.isEmpty()) {
cnd.and(seg);
}
cnd.asc("unitcode");
List<Sys_unit> units = dao.query(Sys_unit.class, cnd);
NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", units);
return Result.success(transferData);
}
@At
@SaCheckPermission("woman.delegation")
@Aop(TransAop.READ_COMMITTED)
public Result partUnitSet(String delegationId, String sessionId, @Param("unitIds") String[] unitIds) {
dao.clear(Woman_congress_delegation_unit.class, Cnd.where("delegationId", "=", delegationId).and("sessionId", "=", sessionId));
List<Woman_congress_delegation_unit> insertData = Arrays.stream(unitIds).map(unitId -> {
Woman_congress_delegation_unit delegationUnit = new Woman_congress_delegation_unit();
delegationUnit.setUnitId(unitId);
delegationUnit.setDelegationId(delegationId);
delegationUnit.setSessionId(sessionId);
return delegationUnit;
}).toList();
dao.insert(insertData);
return Result.success();
}
/**
* 设置团长
*
* @param delegationId
* @param sessionId
* @param userId
* @return
*/
@At
@SaCheckPermission("woman.delegation")
@Aop(TransAop.READ_COMMITTED)
public Result insertHead(String delegationId, String sessionId, String userId) {
Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
//删除权限 只能有一个团长
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getWomanDelegationId, "=", delegationId)
.and(Sys_user_role::getWomanSessionId, "=", sessionId)
.and(Sys_user_role::getRoleId, "=", role.getId())
);
//再加
dao.insert("sys_user_role", Chain.make("userId", userId).add("roleId", role.getId())
.add("womanDelegationId", delegationId).add("womanSessionId", sessionId));
sysUserService.clearCache();
return Result.success();
}
@At
@SaCheckPermission("woman.delegation")
public Result notHeadUser(@Valid String sessionId, @Valid String delegationId, String keyWord) {
Cnd cnd = Cnd.NEW();
cnd.andEX("delegationId", "=", delegationId);
cnd.andEX("sessionId", "=", sessionId);
if (StrUtil.isNotBlank(keyWord)) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.or("loginName", "like", "%" + keyWord + "%");
group.or("userName", "like", "%" + keyWord + "%");
cnd.and(group);
}
Sql sql = Sqls.create("select userId,loginName,userName,unitName from woman_congress_delegate $condition");
sql.setCondition(cnd);
Pagination pagination = sysUserService.listPageMap(1, 10, sql);
return Result.success(pagination.getList());
}
/**
* @param pageForm
* @param sessionId
* @param delegationId
* @return com.budwk.app.base.result.Result
* @author zhf
* @description 点击组成单位返回分页数据
*/
@At
@SaCheckPermission("woman.delegation")
public Result partUnitPageData(@Valid PageForm pageForm, @Valid String sessionId, @Valid String delegationId) {
Sql sql = Sqls.create("""
SELECT
t2.id,
t2.`name`
FROM
woman_congress_delegation_unit t1
LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t1.delegationId", "=", delegationId);
cnd.and("t1.sessionId", "=", sessionId);
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.where().andLike("t2.name", pageForm.getSearchKeyword());
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@SaCheckPermission("woman.delegation")
public Result headUser(@Valid String sessionId, @Valid String delegationId) {
Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
Record record = dao.fetch("sys_user_role", Cnd.where("womanSessionId", "=", sessionId)
.and("womanDelegationId", "=", delegationId)
.and("roleId", "=", role.getId()));
String userId = Optional.ofNullable(record).map(r -> r.getString("userId")).orElse(null);
Sql sql = Sqls.create("""
SELECT
u.id as userId,
u.loginname as loginName,
u.username as userName,
u.mobile,
n.name as unitName
FROM
sys_user u
LEFT JOIN sys_unit n on n.id = u.unitId
WHERE
u.id = @userId
""");
sql.setParam("userId", userId);
sql.setCallback(Sqls.callback.map());
dao.execute(sql);
NutMap user = (NutMap) sql.getResult();
return Result.success().addData(user);
}
/**
* 删除团长角色
*
* @param delegationId
* @param sessionId
* @param userId
* @return
*/
@At
@SaCheckPermission("woman.delegation")
public Result deleteHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId) {
Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
//先删除角色
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getWomanDelegationId, "=", delegationId)
.and(Sys_user_role::getWomanSessionId, "=", sessionId)
.and(Sys_user_role::getRoleId, "=", role.getId())
.and(Sys_user_role::getUserId, "=", userId)
);
sysUserService.clearCache();
return Result.success();
}
}
@@ -0,0 +1,104 @@
package com.budwk.app.zhgh.democratic.womancongress.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.exception.BaseException;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressSessionService;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
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;
@IocBean
@At("/platform/womanCongress/session")
@Ok("json:full")
public class WomanCongressSessionController {
@Inject
private Dao dao;
@Inject
private SysUserService sysUserService;
@Inject
private SysRoleService sysRoleService;
@Inject
private BaseService baseService;
@Inject
private WomanCongressSessionService womanCongressSessionService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/womancongress/session/index.html")
@SaCheckPermission("woman.session")
public void index() {
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.session")
public Result pageData(PageForm pageForm, String j, String c, Integer year) {
Sql sql = Sqls.create("select * from woman_congress_session $condition");
Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(startDate)", "=", year);
cnd.andEX("j", "=", j);
cnd.andEX("c", "=", c);
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.session")
public Result insert(Woman_congress_session session, boolean isExtend) {
womanCongressSessionService.insertSession(session,isExtend);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.session")
public Result update(Woman_congress_session session) {
int count = dao.count(Woman_congress_session.class,
Cnd.where(Woman_congress_session::getJ, "=", session.getJ())
.and(Woman_congress_session::getC, "=", session.getC())
.and(Woman_congress_session::getId, "!=", session.getId())
);
if (count > 0) {
throw new BaseException("请勿重复创建");
}
session.setFullName("" + session.getJ() + "" + session.getC());
dao.updateIgnoreNull(session);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.session")
public Result delete(String id) {
womanCongressSessionService.deleteSession(id);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("woman.session")
public Result findOne(String id) {
Woman_congress_session session = dao.fetch(Woman_congress_session.class, id);
return Result.success(session);
}
}
@@ -0,0 +1,69 @@
package com.budwk.app.zhgh.democratic.womancongress.controller.common;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.validation.Valid;
import java.util.List;
@IocBean
@At("/platform/womanCongress/common")
@Ok("json:full")
public class WomanCongressCommonController {
@Inject
private Dao dao;
@Inject
private SysRoleService sysRoleService;
@At
@SaCheckLogin
public Result listSession() {
List<Woman_congress_session> list = dao.query(Woman_congress_session.class, Cnd.NEW().desc("startDate"));
return Result.success(list);
}
@At
@SaCheckLogin
public Result listOpenSession() {
List<Woman_congress_session> list = dao.query(Woman_congress_session.class, Cnd.where("enable", "=", 1).desc("startDate"));
return Result.success(list);
}
@At
@SaCheckLogin
public Result listDelegation(@Valid String sessionId) {
List<Woman_congress_delegation> list = dao.query(Woman_congress_delegation.class, Cnd.where("sessionId", "=", sessionId).asc("code"));
return Result.success(list);
}
/**
* 代表类型
*
* @return
*/
@At
@SaCheckLogin
public Result listDelegateRole() {
List<Sys_role> list = List.of(
sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_FORMAL),
sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_ATTENDANCE),
sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE)
);
return Result.success(list);
}
}
@@ -0,0 +1,105 @@
package com.budwk.app.zhgh.democratic.womancongress.listener;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.event.user.SysUserEvent;
import com.budwk.app.base.event.user.SysUserEventListener;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegation_unit;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
import org.nutz.aop.interceptor.async.Async;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
/**
* @version 1.0
* @Author zzr
* @nameWomanCongressDelegateListener
* @Date 2024/11/29 17:51
* @注释
*/
@IocBean
public class WomanCongressDelegateListener implements SysUserEventListener {
@Inject
private Dao dao;
@Inject
private SysUserService sysUserService;
@Inject
private SysRoleService sysRoleService;
@Override
@Async
public void onEvent(SysUserEvent event) {
if (event.getMemberChangeType() != MemberChangeType.UNIT_CHANGE) {
return;
}
//查询当前最新届次
Woman_congress_session session = dao.fetch(Woman_congress_session.class, Cnd.NEW().desc(Woman_congress_session::getStartDate));
if (session == null) {
return;
}
String userId = event.getUserId();
//查询校领导的单位
ProposalConfig config = dao.fetch(ProposalConfig.class, Cnd.NEW());
List<String> schoolLeaderUnitIds = config.getSchoolLeaderUnitIds();
View_user user = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", userId));
//校领导排除在外
if (StrUtil.isNotBlank(user.getUnitId()) && schoolLeaderUnitIds.contains(user.getUnitId())) {
return;
}
//查询当前代表的信息
Woman_congress_delegate currentDelegate = dao.fetch(Woman_congress_delegate.class, Cnd.where(Woman_congress_delegate::getUserId, "=", userId).and(Woman_congress_delegate::getSessionId, "=", session.getId()));
if (currentDelegate == null) {
return;
}
//查询当前分配的单位属于哪个代表团
String unitId = user.getUnitId();
Woman_congress_delegation_unit unit = dao.fetch(Woman_congress_delegation_unit.class, Cnd.where(Woman_congress_delegation_unit::getSessionId, "=", session)
.and(Woman_congress_delegation_unit::getUnitId, "=", unitId));
String delegationId = unit.getDelegationId();
currentDelegate.setDelegationId(delegationId);
currentDelegate.setUnitId(user.getUnitId());
currentDelegate.setUnitName(user.getUnitName());
currentDelegate.setUnionId(user.getUnionId());
currentDelegate.setUnionName(user.getUnionName());
dao.updateIgnoreNull(currentDelegate);
//角色数据
Sys_role delegateFormalRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_FORMAL.name());
Sys_role delegateAttendanceRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_ATTENDANCE.name());
Sys_role delegateSpeciallyInviteRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATE_SPECIALLY_INVITE.name());
Sys_role delegationHeadRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD.name());
//删除角色数据
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getUserId, "=", userId)
.and(Sys_user_role::getRoleId, "in", List.of(delegateFormalRole.getId(), delegateAttendanceRole.getId(), delegateSpeciallyInviteRole.getId(), delegationHeadRole.getId()))
.and(Sys_user_role::getWcSessionId, "=", session.getId()));
//再加权限
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setUserId(userId);
sysUserRole.setWcSessionId(session.getId());
sysUserRole.setWcDelegationId(currentDelegate.getDelegationId());
sysUserRole.setRoleId(currentDelegate.getRoleId());
dao.insert(sysUserRole);
sysUserService.clearCache();
sysRoleService.clearCache();
}
}
@@ -0,0 +1,87 @@
package com.budwk.app.zhgh.democratic.womancongress.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("woman_congress_delegate")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("妇代会代表")
public class Woman_congress_delegate 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.VARCHAR, width = 100)
private String loginName;
@Column
@Comment("代表姓名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String userName;
@Column
@Comment("代表性别")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String sex;
@Column
@Comment("代表年龄")
@ColDefine(type = ColType.INT)
private Integer age;
@Column
@Comment("代表手机号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile;
@Column
@Comment("代表单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("代表单位名称")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String unitName;
@Column
@Comment("代表工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("代表基层工会名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("代表团ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String delegationId;
@Column
@Comment("妇代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String sessionId;
@Column
@Comment("角色ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String roleId;
}
@@ -0,0 +1,37 @@
package com.budwk.app.zhgh.democratic.womancongress.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("woman_congress_delegation")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("妇代会代表团")
public class Woman_congress_delegation extends BaseModel {
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("代表团名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String name;
@Column
@Comment("代表团编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String code;
@Column
@Comment("妇代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String sessionId;
}
@@ -0,0 +1,37 @@
package com.budwk.app.zhgh.democratic.womancongress.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("woman_congress_delegation_union")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("妇代会代表团组成分工会")
public class Woman_congress_delegation_union 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 delegationId;
@Column
@Comment("分工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("妇代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String sessionId;
}
@@ -0,0 +1,37 @@
package com.budwk.app.zhgh.democratic.womancongress.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("woman_congress_delegation_unit")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("妇代会代表团组成单位")
public class Woman_congress_delegation_unit 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 delegationId;
@Column
@Comment("单位id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("妇代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String sessionId;
}
@@ -0,0 +1,60 @@
package com.budwk.app.zhgh.democratic.womancongress.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("woman_congress_session")
@TableMeta("{'mysql-charset':'utf8mb4'}")
@Comment("妇代会届次")
public class Woman_congress_session extends BaseModel {
@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;
@Column
@Comment("届数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String j;
@Column
@Comment("次数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String c;
@Column
@Comment("教代会全称")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String fullName;
@Column
@Comment("教代会开启时间")
@ColDefine(type = ColType.DATE)
private Date startDate;
@Column
@Comment("教代会描述")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String description;
@Column
@Comment("教代会开启状态")
@ColDefine(type = ColType.BOOLEAN)
@Default(value = "0")
private Boolean enable;
}
@@ -0,0 +1,29 @@
package com.budwk.app.zhgh.democratic.womancongress.param;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @ClassName WomanCongressDelegateManageAdjustUserParam
* @Description TODO
* @Author zhf
* @Date 2024/11/26 18:06
*/
@Data
public class WomanCongressDelegateManageAdjustUserParam {
@NotBlank(message = "教代会届次不能为空")
private String sessionId;
@NotBlank(message = "代表主键ID不能为空")
private String id;
@NotBlank(message = "代表ID不能为空")
private String userId;
@NotBlank(message = "代表团ID不能为空")
private String delegationId;
@NotBlank(message = "代表身份不能为空")
private String roleId;
}
@@ -0,0 +1,18 @@
package com.budwk.app.zhgh.democratic.womancongress.param;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* @ClassName WomanCongressDelegateManageIdParam
* @Description TODO
* @Author zhf
* @Date 2024/8/16 15:02
*/
@Data
public class WomanCongressDelegateManageIdParam {
@NotEmpty(message = "用户id不能为null")
private List<String> ids;
}
@@ -0,0 +1,29 @@
package com.budwk.app.zhgh.democratic.womancongress.param;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* @ClassName WomanCongressDelegateManageInsertParam
* @Description TODO
* @Author zhf
* @Date 2024/8/16 14:10
*/
@Data
public class WomanCongressDelegateManageInsertParam {
@NotBlank(message = "教代会届次不能为空")
private String sessionId;
@NotBlank(message = "代表团不能为空")
private String delegationId;
@NotBlank(message = "代表类型不能为空")
private String roleId;
@NotEmpty(message = "用户不能为空")
private List<String> userIds;
}
@@ -0,0 +1,26 @@
package com.budwk.app.zhgh.democratic.womancongress.param;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @ClassName WomanCongressDelegateManagePageParam
* @Description TODO
* @Author zhf
* @Date 2024/8/16 10:57
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class WomanCongressDelegateManagePageParam extends PageForm {
private String sessionId;
private String delegationId;
private String roleId;
private String unionId;
private String unitId;
}
@@ -0,0 +1,23 @@
package com.budwk.app.zhgh.democratic.womancongress.param;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @ClassName WomanCongressDelegateManagePublicUserParam
* @Description TODO
* @Author zhf
* @Date 2024/8/16 11:32
*/
@Data
public class WomanCongressDelegateManagePublicUserParam {
@NotBlank(message = "妇代会届次不能为空")
private String sessionId;
@NotBlank(message = "代表团不能为空")
private String delegationId;
@NotBlank(message = "搜索关键字不能为空")
private String keyWord;
}
@@ -0,0 +1,27 @@
package com.budwk.app.zhgh.democratic.womancongress.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
import com.budwk.app.zhgh.democratic.womancongress.param.WomanCongressDelegateManagePageParam;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
public interface WomanCongressDelegateService extends BaseService<Woman_congress_delegate> {
/**
* 分页
*/
Pagination<Teacher_congress_delegate> pageData(WomanCongressDelegateManagePageParam pageForm);
/**
* 获取自管代表团
* @return
*/
List<String> getSelfManageDelegationIds();
void exportXlsx(WomanCongressDelegateManagePageParam pageForm, HttpServletResponse response);
}
@@ -0,0 +1,12 @@
package com.budwk.app.zhgh.democratic.womancongress.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_session;
public interface WomanCongressSessionService extends BaseService<Woman_congress_session> {
void insertSession(Woman_congress_session session, Boolean isExtend);
void deleteSession(String id);
}
@@ -0,0 +1,116 @@
package com.budwk.app.zhgh.democratic.womancongress.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.vo.TeacherCongressDelegateExcelVO;
import com.budwk.app.zhgh.democratic.womancongress.models.Woman_congress_delegate;
import com.budwk.app.zhgh.democratic.womancongress.param.WomanCongressDelegateManagePageParam;
import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressDelegateService;
import org.apache.poi.ss.usermodel.Workbook;
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.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @ClassName WomanCongressDelegateServiceImpl
* @Description TODO
* @Author zhf
* @Date 2024/8/16 10:59
*/
@IocBean(args = {"refer:dao"})
public class WomanCongressDelegateServiceImpl extends BaseServiceImpl<Woman_congress_delegate> implements WomanCongressDelegateService {
public WomanCongressDelegateServiceImpl(Dao dao) {
super(dao);
}
@Inject
private SysRoleService sysRoleService;
@Override
public Pagination<Teacher_congress_delegate> pageData(WomanCongressDelegateManagePageParam pageForm) {
Cnd cnd = buildCondition(pageForm, "");
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && !AuthUtil.hasRole(RoleConstant.SCHOOL_UNION_WC_ADMIN.name())) {
cnd.and("delegationId", "in", getSelfManageDelegationIds());
}
Pagination<Teacher_congress_delegate> pagination = listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return pagination;
}
@Override
public List<String> getSelfManageDelegationIds() {
Sys_role role = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD.name());
List<Sys_user_role> sysUserRoles = dao().query(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
.and(Sys_user_role::getUserId, "=", SecurityUtil.getUserId()));
List<String> delegationIds = sysUserRoles.stream()
.map(Sys_user_role::getWcDelegationId)
.filter(StrUtil::isNotBlank)
.toList();
return delegationIds;
}
@Override
public void exportXlsx(WomanCongressDelegateManagePageParam pageForm, HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
t1.*,
t2.`name` AS delegationName,
t3.`fullName` AS sessionName,
t4.`name` AS roleName
FROM
woman_congress_delegate t1
LEFT JOIN woman_congress_delegation t2 ON t2.id = t1.delegationId
LEFT JOIN woman_congress_session t3 ON t3.id = t1.sessionId
LEFT JOIN sys_role t4 ON t4.id = t1.roleId
$condition
""");
Cnd cnd = buildCondition(pageForm, "t1.");
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name()) && !AuthUtil.hasRole(RoleConstant.SCHOOL_UNION_WC_ADMIN.name())) {
cnd.and("t1.delegationId", "in", getSelfManageDelegationIds());
}
sql.setCondition(cnd);
List<TeacherCongressDelegateExcelVO> list = listVO(sql, TeacherCongressDelegateExcelVO.class);
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TeacherCongressDelegateExcelVO.class, list);
CommonDownloadUtil.download("代表信息表.xlsx", workbook, response);
}
private Cnd buildCondition(WomanCongressDelegateManagePageParam pageForm, String prefix) {
Cnd cnd = Cnd.NEW();
cnd.andEX(prefix + "sessionId", "=", pageForm.getSessionId());
cnd.andEX(prefix + "delegationId", "=", pageForm.getDelegationId());
cnd.andEX(prefix + "roleId", "=", pageForm.getRoleId());
cnd.andEX(prefix + "unionId", "=", pageForm.getUnionId());
cnd.andEX(prefix + "unitId", "=", pageForm.getUnitId());
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike(prefix + "userName", pageForm.getSearchKeyword(), false);
seg.orLike(prefix + "loginName", pageForm.getSearchKeyword(), false);
cnd.and(seg);
}
return cnd;
}
}
@@ -0,0 +1,202 @@
package com.budwk.app.zhgh.democratic.womancongress.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.exception.BaseException;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.sys.services.SysUserService;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_session;
import com.budwk.app.zhgh.democratic.womancongress.models.*;
import com.budwk.app.zhgh.democratic.womancongress.service.WomanCongressSessionService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
import java.util.Date;
import java.util.List;
/**
* @ClassName WomanCongressSessionServiceImpl
* @Description TODO
* @Author zhf
* @Date 2024/12/28 上午9:55
*/
@IocBean(args = {"refer:dao"})
public class WomanCongressSessionServiceImpl extends BaseServiceImpl<Woman_congress_session> implements WomanCongressSessionService {
@Inject
private SysRoleService sysRoleService;
@Inject
private SysUserService sysUserService;
public WomanCongressSessionServiceImpl(Dao dao) {
super(dao);
}
@Override
public void insertSession(Woman_congress_session session, Boolean isExtend) {
int count = count(Cnd.where(Woman_congress_session::getJ, "=", session.getJ())
.and(Woman_congress_session::getC, "=", session.getC()));
if (count > 0) {
throw new BaseException("请勿重复创建");
}
session.setStartDate(new Date());
session.setFullName("" + session.getJ() + "" + session.getC());
insert(session);
//代表团角色ID
Sys_role delegationHeadRole = sysRoleService.getByCode(RoleConstant.WOMAN_CONGRESS_DELEGATION_HEAD);
if (isExtend) {
// 继承上届信息
//查询本届上次的信息
int c_num = Convert.chineseToNumber(session.getC().replaceAll("", ""));
if (c_num == 1) return;
int last_c_num = c_num - 1;
String last_c = Convert.numberToChinese(last_c_num, false);
Woman_congress_session lastSession = fetch(Cnd.where(Woman_congress_session::getJ, "=", session.getJ())
.and(Teacher_congress_session::getC, "=", last_c + ""));
if (ObjectUtil.isEmpty(lastSession)) return;
//从代表团入手
List<Woman_congress_delegation> lastDelegations = dao().query(Woman_congress_delegation.class, Cnd.where("sessionId", "=", lastSession.getId()));
for (Woman_congress_delegation lastDelegation : lastDelegations) {
//代表团继承
Woman_congress_delegation newDelegation = BeanUtil.copyProperties(lastDelegation, Woman_congress_delegation.class);
newDelegation.setId(null);
newDelegation.setSessionId(session.getId());
dao().insert(newDelegation);
//团长角色权限继承
List<Sys_user_role> lastHeadUserRoles = dao().query(Sys_user_role.class, Cnd.where(Sys_user_role::getWcDelegationId, "=", lastDelegation.getId())
.and(Sys_user_role::getRoleId, "=", delegationHeadRole.getId()));
for (Sys_user_role lastHeadUser : lastHeadUserRoles) {
Sys_user_role newHeadUser = BeanUtil.copyProperties(lastHeadUser, Sys_user_role.class);
newHeadUser.setWcDelegationId(newDelegation.getId());
newHeadUser.setWcSessionId(session.getId());
dao().insert(newHeadUser);
}
//组成分工会
List<Woman_congress_delegation_union> lastDelegationUnions = dao().query(Woman_congress_delegation_union.class, Cnd.where(Woman_congress_delegation_union::getDelegationId, "=", lastDelegation.getId()));
List<Woman_congress_delegation_union> newDelegationUnions = lastDelegationUnions.stream().map(lastDelegationUnion -> {
Woman_congress_delegation_union newDelegationUnion = BeanUtil.copyProperties(lastDelegationUnion, Woman_congress_delegation_union.class);
newDelegationUnion.setId(R.UU32());
newDelegationUnion.setDelegationId(newDelegation.getId());
newDelegationUnion.setSessionId(session.getId());
newDelegationUnion.setCreatedAt(null);
newDelegationUnion.setUpdatedAt(null);
newDelegationUnion.setCreatedBy(null);
newDelegationUnion.setUpdatedBy(null);
return newDelegationUnion;
}).toList();
dao().fastInsert(newDelegationUnions);
//组成单位
List<Woman_congress_delegation_unit> lastDelegationUnits = dao().query(Woman_congress_delegation_unit.class, Cnd.where(Woman_congress_delegation_unit::getDelegationId, "=", lastDelegation.getId()));
List<Woman_congress_delegation_unit> newDelegationUnits = lastDelegationUnits.stream().map(lastDelegationUnit -> {
Woman_congress_delegation_unit newDelegationUnit = BeanUtil.copyProperties(lastDelegationUnit, Woman_congress_delegation_unit.class);
newDelegationUnit.setId(R.UU32());
newDelegationUnit.setDelegationId(newDelegation.getId());
newDelegationUnit.setSessionId(session.getId());
newDelegationUnit.setCreatedAt(null);
newDelegationUnit.setUpdatedAt(null);
newDelegationUnit.setCreatedBy(null);
newDelegationUnit.setUpdatedBy(null);
return newDelegationUnit;
}).toList();
dao().fastInsert(newDelegationUnits);
}
//代表数据 单位 分工会 要根据最新的设置来调整
//代表数据
List<Woman_congress_delegate> lastDelegates = dao().query(Woman_congress_delegate.class, Cnd.where(Woman_congress_delegate::getSessionId, "=", lastSession.getId()));
List<Woman_congress_delegate> newDelegates = lastDelegates.stream().map(lastDelegate -> {
Woman_congress_delegate newDelegate = BeanUtil.copyProperties(lastDelegate, Woman_congress_delegate.class);
newDelegate.setId(R.UU32());
newDelegate.setSessionId(session.getId());
newDelegate.setCreatedAt(null);
newDelegate.setUpdatedAt(null);
newDelegate.setCreatedBy(null);
newDelegate.setUpdatedBy(null);
//查询本人最新的信息从用户表中
View_user vwUser = dao().fetch(View_user.class, Cnd.where(Sys_user::getId, "=", lastDelegate.getUserId()));
if (ObjectUtil.isNotEmpty(vwUser)) {
newDelegate.setUnitId(vwUser.getUnitId());
newDelegate.setUnitName(vwUser.getUnitName());
newDelegate.setUnionId(vwUser.getUnionId());
newDelegate.setUnionName(vwUser.getUnionName());
newDelegate.setSex(vwUser.getSex());
newDelegate.setMobile(vwUser.getMobile());
//去查询他当前所处的单位、分工会处于哪个代表团
if (StrUtil.isNotBlank(vwUser.getUnionId())) {
Woman_congress_delegation_union delegationUnion = dao().fetch(Woman_congress_delegation_union.class, Cnd.where(Woman_congress_delegation_union::getSessionId, "=", session.getId())
.and(Woman_congress_delegation_union::getUnionId, "=", vwUser.getUnionId()));
if (ObjectUtil.isNotEmpty(delegationUnion)) {
newDelegate.setDelegationId(delegationUnion.getDelegationId());
}
}
if (StrUtil.isNotBlank(vwUser.getUnitId())) {
Woman_congress_delegation_unit delegationUnit = dao().fetch(Woman_congress_delegation_unit.class, Cnd.where(Woman_congress_delegation_unit::getSessionId, "=", session.getId())
.and(Woman_congress_delegation_unit::getUnitId, "=", vwUser.getUnitId()));
if (ObjectUtil.isNotEmpty(delegationUnit)) {
newDelegate.setDelegationId(delegationUnit.getDelegationId());
}
}
}
return newDelegate;
}).toList();
dao().insert(newDelegates);
//代表权限数据
for (Woman_congress_delegate newDelegate : newDelegates) {
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setWcSessionId(session.getId());
sysUserRole.setWcDelegationId(newDelegate.getDelegationId());
sysUserRole.setUserId(newDelegate.getUserId());
sysUserRole.setRoleId(newDelegate.getRoleId());
dao().insert(sysUserRole);
}
}
sysRoleService.clearCache();
sysUserService.clearCache();
}
@Override
public void deleteSession(String id) {
//届次
dao().delete(Woman_congress_session.class, id);
//代表团
dao().clear(Woman_congress_delegation.class, Cnd.where("sessionId", "=", id));
//代表团组成单位
dao().clear(Woman_congress_delegation_unit.class, Cnd.where("sessionId", "=", id));
//代表团组成分工会
dao().clear(Woman_congress_delegation_union.class, Cnd.where("sessionId", "=", id));
//代表
dao().clear(Woman_congress_delegate.class, Cnd.where("sessionId", "=", id));
//删除相关权限
dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getWcSessionId, "=", id));
//删除相关待办 todo
sysUserService.clearCache();
sysRoleService.clearCache();
}
}
@@ -0,0 +1,136 @@
const AddForm = {
template: `
<el-dialog title="新增代表" :visible.sync="dialogFormVisible" width="1000px" :close-on-click-modal="false">
<el-form :model="formData" ref="formRef" label-width="120px" :rules="formRules">
<el-form-item prop="sessionId" label="届次">
<el-select v-model="formData.sessionId"
style="width: 100%"
placeholder="代表所属教代会"
@change="sessionChange">
<el-option v-for="item in sessionOptions"
:key="item.id"
:label="item.fullName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="delegationId" label="代表团">
<el-select v-model="formData.delegationId" filterable @change="delegationChange" clearable style="width: 100%">
<el-option v-for="i in delegationOptions"
:label="i.name"
:key="i.id"
:value="i.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="roleId" label="代表类型">
<el-select v-model="formData.roleId" filterable style="width: 100%">
<el-option v-for="i in roleOptions"
:label="i.name"
:key="i.id"
:value="i.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="userIds" label="用户">
<user-select v-model="formData.userIds"
v-if="dialogFormVisible"
api="/platform/womanCongress/delegate/manage/publicUser"
:api_params="{sessionId:formData.sessionId,delegationId:formData.delegationId}"
api_input_key_name="keyWord"
:option_label_func="(item)=>{return item.userName + item.loginName + '(' + item.unitName + ')'}"
:multiple="true"
style="width: 100%"></user-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</div>
</el-dialog>
`,
data() {
return {
dialogFormVisible: false,
formData: {
userIds: [],
sessionId: null,
delegationId: null,
roleId: null
},
formRules: {
sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
delegationId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
roleId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
userIds: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
},
sessionOptions: [],
delegationOptions: [],
roleOptions: []
}
},
methods: {
onOpen(sessionId) {
if (!sessionId) {
return
}
this.formData = {
userIds: [],
sessionId: sessionId,
delegationId: null,
roleId: null
}
this.listSession()
this.listDelegation(sessionId)
this.listRole()
this.dialogFormVisible = true
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
}
})
},
listDelegation(sessionId) {
this.$axios.post("/platform/womanCongress/common/listDelegation", { sessionId }).then((res) => {
if (res.code === 0) {
this.delegationOptions = res.data
}
})
},
listRole() {
this.$axios.post("/platform/womanCongress/common/listDelegateRole").then((res) => {
if (res.code === 0) {
this.roleOptions = res.data
}
})
},
sessionChange(sessionId) {
this.listDelegation(sessionId)
this.formData.userIds = []
},
delegationChange() {
this.formData.userIds = []
},
doSubmit() {
this.$refs.formRef.validate((valid) => {
if (valid) {
this.$axios.post("/platform/womanCongress/delegate/manage/insert", { data: JSON.stringify(this.formData) }).then((res) => {
if (res.code === 0) {
this.dialogFormVisible = false
this.$message.success(res.msg)
this.$emit("refresh")
}
})
}
})
}
},
created() {}
}
@@ -0,0 +1,185 @@
var AdjustForm = {
template:
/*language=HTML*/
`
<el-dialog title="代表调整" :visible.sync="dialogFormVisible" width="65%" :close-on-click-modal="false">
<el-form :model="formData" ref="formRef" label-width="120px" :rules="formRules">
<el-row type="flex" justify="space-between">
<el-form-item prop="sessionId" label="届次">
<el-select v-model="formData.sessionId"
style="width: 100%"
placeholder="代表所属教代会"
@change="sessionChange">
<el-option v-for="item in sessionOptions"
:key="item.id"
:label="item.fullName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="userId" label="用户">
<user-select v-model="formData.userId"
ref="userSelectRef"
v-if="dialogFormVisible"
api="/platform/womanCongress/delegate/manage/adjustUserList"
:api_params="{sessionId:formData.sessionId}"
api_input_key_name="keyWord"
:option_label_func="(item)=>{return item.userName + item.loginName + '(' + item.unitName + ')'}"
></user-select>
<el-button icon="el-icon-plus" type="primary" @click="move">添加到待调整列表</el-button>
</el-form-item>
</el-row>
<el-form-item prop="users" label="待调整用户">
<el-table :data="formData.users" size="small">
<el-table-column label="工号" prop="loginName"></el-table-column>
<el-table-column label="姓名" prop="userName"></el-table-column>
<el-table-column label="性别" prop="sex" width="50"></el-table-column>
<el-table-column label="所属工会" prop="unionName" show-overflow-tooltip></el-table-column>
<el-table-column label="所属单位" prop="unitName" show-overflow-tooltip></el-table-column>
<el-table-column label="代表团">
<template slot-scope="scope">
<el-form-item :prop="'users.'+scope.$index+'.delegationId'"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-select v-model="scope.row.delegationId" filterable>
<el-option v-for="d in delegationOptions" :label="d.name" :value="d.id"
:key="d.id"></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="代表身份">
<template slot-scope="scope">
<el-form-item :prop="'users.'+scope.$index+'.roleId'"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-select v-model="scope.row.roleId" filterable style="width: 100%">
<el-option v-for="i in roleOptions"
:label="i.name"
:key="i.id"
:value="i.id"></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="formData.users.splice(scope.$index,1)">取消调整
</el-link>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</div>
</el-dialog>
`,
data() {
return {
dialogFormVisible: false,
formData: {},
formRules: {
sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
},
sessionOptions: [],
delegationOptions: [],
roleOptions: []
}
},
methods: {
onOpen(sessionId) {
if (!sessionId) {
return
}
this.formData = {
sessionId: sessionId,
users: []
}
this.listRole()
this.listSession()
this.listDelegation(sessionId)
this.dialogFormVisible = true
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
}
})
},
listDelegation(sessionId) {
this.$axios.post("/platform/womanCongress/common/listDelegation", { sessionId }).then((res) => {
if (res.code === 0) {
this.delegationOptions = res.data
}
})
},
listRole() {
this.$axios.post("/platform/womanCongress/common/listDelegateRole").then((res) => {
if (res.code === 0) {
this.roleOptions = res.data
}
})
},
sessionChange(sessionId) {
this.listDelegation(sessionId)
},
move() {
if (!this.formData.userId) {
this.$message.warning("请先搜索需要调整的代表")
return
}
const user = this.$refs.userSelectRef.options.find((user) => user.id === this.formData.userId)
const repeat = this.formData.users.some((u) => u.id === user.id)
if (repeat) {
this.$message.warning("调整列表中已存在,请勿重复添加")
return
}
this.formData.users.unshift(user)
this.formData.userId = null
this.$refs.userSelectRef.clearOptions()
},
doSubmit() {
if (this.formData.users.length === 0) {
this.$message.warning("请先搜索并添加需要调整的代表")
return
}
this.$refs.formRef.validate((valid) => {
if (valid) {
const data = this.formData.users.map((param) => {
return {
id: param.id,
userId: param.userId,
delegationId: param.delegationId,
sessionId: this.formData.sessionId,
roleId: param.roleId
}
})
this.$axios
.post("/platform/womanCongress/delegate/manage/doAdjustUser", {
data: JSON.stringify(data),
sessionId: this.formData.sessionId
})
.then((res) => {
if (res.code === 0) {
this.dialogFormVisible = false
this.$message.success(res.msg)
this.$emit("refresh")
}
})
}
})
}
},
created() {}
}
@@ -0,0 +1,207 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="姓名/工号">
<el-input placeholder="请输入姓名或工号" clearable v-model="pageForm.searchKeyword"></el-input>
</search-item>
<search-item label="教代会">
<el-select v-model="pageForm.sessionId" @change="sessionChange">
<el-option v-for="item in sessionOptions" :label="item.fullName" :value="item.id" :key="item.id"></el-option>
</el-select>
</search-item>
<search-item label="代表团">
<el-select v-model="pageForm.delegationId" filterable @change="delegationChange" clearable style="width: 100%">
<el-option v-for="i in delegationOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
<search-item label="所属工会">
<el-select placeholder="请选择所属工会" v-model="pageForm.unionId" @change="listUnit" clearable style="width: 100%">
<el-option v-for="i in unionOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select placeholder="请选择所属单位" v-model="pageForm.unitId" clearable style="width: 100%">
<el-option v-for="i in unitOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
<search-item label="代表类型">
<el-select v-model="pageForm.roleId" filterable clearable style="width: 100%">
<el-option v-for="i in roleOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never">
<table-tool>
<el-button size="small" type="primary" icon="el-icon-plus" @click="$refs.addFormRef.onOpen(pageForm.sessionId)">新增代表</el-button>
<el-button
size="small"
type="danger"
icon="el-icon-delete"
@click="batchDelete()"
:disabled="$refs.tableRef && $refs.tableRef.selection.length===0"
>
批量删除
</el-button>
<el-button size="small" type="primary" icon="el-icon-plus" @click="$refs.adjustFormRef.onOpen(pageForm.sessionId)">代表调整</el-button>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" header-align="center" row-key="id" ref="tableRef" style="width: 100%">
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<el-table-column type="index" width="55" label="序号" :index="indexMethod" fixed="left"></el-table-column>
<el-table-column label="工号" prop="loginName" fixed="left"></el-table-column>
<el-table-column label="姓名" prop="userName" fixed="left" sortable></el-table-column>
<el-table-column label="性别" prop="sex" sortable></el-table-column>
<el-table-column label="年龄" prop="age" sortable></el-table-column>
<el-table-column label="联系方式" prop="mobile"></el-table-column>
<el-table-column label="代表团" prop="delegationId" width="150" show-overflow-tooltip sortable>
<template scope="{row}">
<dict-tag :options="delegationOptions" :value="row.delegationId" option_value="id" option_label="name"></dict-tag>
</template>
</el-table-column>
<el-table-column label="所属工会" prop="unionName" show-overflow-tooltip sortable></el-table-column>
<el-table-column label="所属单位" prop="unitName" show-overflow-tooltip sortable></el-table-column>
<el-table-column label="届次" prop="sessionId">
<template scope="{row}">
<dict-tag :options="sessionOptions" :value="row.sessionId" option_value="id" option_label="fullName"></dict-tag>
</template>
</el-table-column>
<el-table-column label="代表身份" prop="roleId" sortable>
<template scope="{row}">
<dict-tag :options="roleOptions" :value="row.roleId" option_value="id" option_label="name"></dict-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="doDelete([scope.row.id])">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<add-form ref="addFormRef" @refresh="doSearch"></add-form>
<adjust-form ref="adjustFormRef" @refresh="doSearch"></adjust-form>
</div>
<script nonce="${cspNonce!}">
<!--#include("addForm.js"){}#-->
<!--#include("adjust.js"){}#-->
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"add-form": AddForm,
"adjust-form": AdjustForm
},
data() {
return {
pageForm: {
sessionId: null,
delegationId: null,
unionId: null,
unitId: null
},
sessionOptions: [],
delegationOptions: [],
unionOptions: [],
unitOptions: [],
roleOptions: [],
formRules: {}
}
},
methods: {
sessionChange() {
this.pageForm.delegationId = null
this.delegationOptions = []
this.listDelegation()
},
delegationChange() {
this.pageForm.unionId = null
this.pageForm.unitId = null
},
listDelegation() {
this.delegationOptions = []
this.pageForm.delegationId = null
this.$axios.post("/platform/womanCongress/common/listDelegation", { sessionId: this.pageForm.sessionId }).then((res) => {
if (res.code === 0) {
this.delegationOptions = res.data
}
})
},
listRole() {
this.$axios.post("/platform/womanCongress/common/listDelegateRole").then((res) => {
if (res.code === 0) {
this.roleOptions = res.data
}
})
},
listUnion() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
})
},
listUnit() {
this.$businessTool.listUnit(this.pageForm.unionId).then((res) => {
this.unitOptions = res
})
},
doDelete(ids) {
this.$confirm("您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info"
}).then(() => {
this.$axios.post(loc() + "/delete", { data: JSON.stringify({ ids: ids }) }).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.doSearch()
}
})
})
},
batchDelete() {
if (this.$refs.tableRef && this.$refs.tableRef.rowKey) {
const ids = this.$refs.tableRef.selection.map((row) => row[this.$refs.tableRef.rowKey])
if (ids.length === 0) {
this.$message.warning("请勾选数据后再删除")
return
}
this.doDelete(ids)
this.$refs.tableRef.clearSelection()
}
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
if (this.sessionOptions && this.sessionOptions.length > 0) {
this.pageForm.sessionId = this.sessionOptions[0].id
this.listDelegation()
this.pageData()
}
}
})
}
},
created() {
this.listRole()
this.listUnion()
this.listUnit()
this.listSession()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,163 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="姓名/工号">
<el-input placeholder="请输入姓名或工号" clearable v-model="pageForm.searchKeyword"></el-input>
</search-item>
<search-item label="教代会">
<el-select v-model="pageForm.sessionId" @change="sessionChange">
<el-option v-for="item in sessionOptions" :label="item.fullName" :value="item.id" :key="item.id"></el-option>
</el-select>
</search-item>
<search-item label="代表团">
<el-select v-model="pageForm.delegationId" filterable @change="delegationChange" clearable style="width: 100%">
<el-option v-for="i in delegationOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
<search-item label="所属工会">
<el-select placeholder="请选择所属工会" v-model="pageForm.unionId" @change="listUnit" clearable style="width: 100%">
<el-option v-for="i in unionOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select placeholder="请选择所属单位" v-model="pageForm.unitId" clearable style="width: 100%">
<el-option v-for="i in unitOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
<search-item label="代表类型">
<el-select v-model="pageForm.roleId" filterable clearable style="width: 100%">
<el-option v-for="i in roleOptions" :label="i.name" :key="i.id" :value="i.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never">
<table-tool>
<el-button size="small" type="primary" icon="el-icon-download" @click="exportXlsx">导出Excel</el-button>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" header-align="center" row-key="id" ref="tableRef" style="width: 100%">
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<el-table-column type="index" width="55" label="序号" :index="indexMethod" fixed="left"></el-table-column>
<el-table-column label="工号" prop="loginName" fixed="left"></el-table-column>
<el-table-column label="姓名" prop="userName" fixed="left" sortable></el-table-column>
<el-table-column label="性别" prop="sex" sortable></el-table-column>
<el-table-column label="年龄" prop="age" sortable></el-table-column>
<el-table-column label="联系方式" prop="mobile"></el-table-column>
<el-table-column label="代表团" prop="delegationId" width="150" show-overflow-tooltip sortable>
<template scope="{row}">
<dict-tag :options="delegationOptions" :value="row.delegationId" option_value="id" option_label="name"></dict-tag>
</template>
</el-table-column>
<el-table-column label="所属工会" prop="unionName" show-overflow-tooltip sortable></el-table-column>
<el-table-column label="所属单位" prop="unitName" show-overflow-tooltip sortable></el-table-column>
<el-table-column label="届次" prop="sessionId">
<template scope="{row}">
<dict-tag :options="sessionOptions" :value="row.sessionId" option_value="id" option_label="fullName"></dict-tag>
</template>
</el-table-column>
<el-table-column label="代表身份" prop="roleId" sortable>
<template scope="{row}">
<dict-tag :options="roleOptions" :value="row.roleId" option_value="id" option_label="name"></dict-tag>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
},
data() {
return {
pageForm: {
sessionId: null,
delegationId: null,
unionId: null,
unitId: null
},
sessionOptions: [],
delegationOptions: [],
unionOptions: [],
unitOptions: [],
roleOptions: [],
formRules: {}
}
},
methods: {
sessionChange() {
this.pageForm.delegationId = null
this.delegationOptions = []
this.listDelegation()
},
delegationChange() {
this.pageForm.unionId = null
this.pageForm.unitId = null
},
listDelegation() {
this.delegationOptions = []
this.pageForm.delegationId = null
this.$axios.post("/platform/womanCongress/common/listDelegation", { sessionId: this.pageForm.sessionId }).then((res) => {
if (res.code === 0) {
this.delegationOptions = res.data
}
})
},
listRole() {
this.$axios.post("/platform/womanCongress/common/listDelegateRole").then((res) => {
if (res.code === 0) {
this.roleOptions = res.data
}
})
},
listUnion() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
})
},
listUnit() {
this.$businessTool.listUnit(this.pageForm.unionId).then((res) => {
this.unitOptions = res
})
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
if (this.sessionOptions && this.sessionOptions.length > 0) {
this.pageForm.sessionId = this.sessionOptions[0].id
this.listDelegation()
this.pageData()
}
}
})
},
exportXlsx() {
this.$downLoad(loc() + "/exportXlsx", this.pageForm)
},
},
created() {
this.listRole()
this.listUnion()
this.listUnit()
this.listSession()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,82 @@
const AU_FORM_TEMPLATE = {
template: `
<el-dialog :title="formData.id ? '编辑':'新增'" :visible.sync="dialogFormVisible" width="700px" :close-on-click-modal="false">
<el-form :model="formData" ref="formRef" size="small" label-width="120px" :rules="formRules">
<el-form-item prop="sessionId" label="妇代会">
<el-select v-model="formData.sessionId">
<el-option v-for="item in sessionOptions" :label="item.fullName" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="name" label="代表团名称">
<el-input placeholder="请输入代表团名称" v-model="formData.name" maxlength="100"></el-input>
</el-form-item>
<el-form-item prop="code" label="代表团编码">
<el-input placeholder="请输入代表团编码" v-model="formData.code" maxlength="50"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</div>
</el-dialog>
`,
data() {
return {
dialogFormVisible: false,
formData: {},
formRules: {
sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
name: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
code: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
},
sessionOptions: []
}
},
methods: {
onOpen(id) {
this.dialogFormVisible = true
this.listSession()
if (id) {
this.$axios.post("/platform/womanCongress/delegation/findOne", { id }).then((res) => {
if (res.code === 0) {
this.formData = res.data
}
})
} else {
this.formData = {}
this.$nextTick(() => {
if (this.$refs.formRef) {
this.$refs.formRef.clearValidate()
}
})
}
},
doSubmit() {
this.$refs.formRef.validate((valid) => {
if (valid) {
this.$axios
.post("/platform/womanCongress/delegation" + (this.formData.id ? "/update" : "/insert"), this.formData)
.then((res) => {
if (res.code === 0) {
this.dialogFormVisible = false
this.$message.success(res.msg)
this.$emit("refresh", null)
}
})
}
})
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
}
})
}
},
created() {
this.listSession()
}
}
@@ -0,0 +1,89 @@
const HEAD_FORM_TEMPLATE = {
template: `
<el-dialog title="设置团长" :visible.sync="headDialogFormVisible" width="700px" :close-on-click-modal="false">
<el-form :model="formData" ref="headFormRef" size="small" label-width="120px" :rules="formRules">
<el-form-item prop="sessionId" label="教代会">
<el-select v-model="formData.sessionId" disabled>
<el-option v-for="item in sessionOptions" :label="item.fullName" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="userId" label="团长">
<user-select v-model="formData.userId"
v-if="headDialogFormVisible"
api="/platform/womanCongress/delegation/notHeadUser"
:api_params="{sessionId:formData.sessionId,delegationId:formData.delegationId}"
api_input_key_name="keyWord"
:option_list="headOptions"
option_value="userId"
:option_label_func="(item)=>{return item.userName + item.loginName + '(' + item.unitName + ')'}"
placeholder="请输入工号或者姓名"
style="width: 100%"></user-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="headDialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmitHead">确 定</el-button>
</div>
</el-dialog>
`,
data() {
return {
formData: {},
headDialogFormVisible: false,
headOptions: [],
sessionOptions: [],
formRules: {
sessionId: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
name: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
code: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
}
}
},
methods: {
onOpen(delegationId, sessionId) {
if (!delegationId || !sessionId) {
return
}
this.headDialogFormVisible = true
this.listSession()
this.formData = {
sessionId,
delegationId
}
// this.findHeadUser()
},
// findHeadUser() {
// this.$axios.post("/platform/teacherCongress/delegation/headUser", this.formData).then((res) => {
// if (res.code === 0) {
// if (res.data) {
// this.headOptions = [res.data]
// this.$set(this.formData, "userId", res.data.id)
// }
// }
// })
// },
doSubmitHead() {
this.$refs.headFormRef.validate((valid) => {
if (valid) {
this.$axios.post("/platform/womanCongress/delegation/insertHead", this.formData).then((res) => {
if (res.code === 0) {
this.headDialogFormVisible = false
this.$message.success(res.msg)
this.$emit("refresh", null)
}
})
}
})
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
}
})
}
}
}
@@ -0,0 +1,97 @@
const HEAD_TABLE_TEMPLATE = {
template: `
<div>
<table-tool>
<el-button size="small" type="primary" icon="el-icon-edit" @click="open">添加团长</el-button>
</table-tool>
<el-table :data="tableData" border>
<el-table-column type="index" label="序号" width="100px"></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="mobile" label="电话"></el-table-column>
<el-table-column label="操作" width="100px">
<template scope="scope">
<el-link type="danger" @click="doDelete(scope.row.userId)">删除</el-link>
</template>
</el-table-column>
</el-table>
</div>
`,
props: {
session_id: {
type: String,
required: true
},
delegation_id: {
type: String,
required: true
}
},
data() {
return {
tableData: [],
pageForm: {}
}
},
watch: {
session_id: {
handler: function (val) {
if (val) {
this.pageData()
}
},
immediate: true
},
delegation_id: {
handler: function (val) {
if (val) {
this.pageData()
}
},
immediate: true
}
},
methods: {
pageData() {
this.$axios
.post("/platform/womanCongress/delegation/headUser", {
...this.pageForm,
sessionId: this.session_id,
delegationId: this.delegation_id
})
.then((res) => {
if (res.code === 0) {
if (res.data) {
this.tableData = [res.data]
} else {
this.tableData = []
}
}
})
},
open() {
this.$emit("open", this.delegation_id, this.session_id)
},
doDelete(userId) {
this.$confirm("您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info"
}).then(() => {
this.$axios
.post("/platform/womanCongress/delegation/deleteHead", {
userId,
sessionId: this.session_id,
delegationId: this.delegation_id
})
.then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.$emit("refresh")
this.pageData()
}
})
})
}
}
}
@@ -0,0 +1,166 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-row :gutter="10" style="height: calc(100vh - 126px)" type="flex">
<el-col :span="5">
<tree @node-click="treeNodeClick" @session-change="sessionChange" ref="treeRef"></tree>
</el-col>
<el-col :span="19">
<el-card shadow="never" style="height: 100%">
<template v-if="!currentTreeNode || (currentTreeNode && currentTreeNode.level===1)">
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter)">
<el-row type="flex">
<el-input clearable placeholder="请输入代表团名称" style="width: 220px" v-model="pageForm.searchKeyword"></el-input>
<el-button @click="doSearch" class="ml5" icon="el-icon-search" size="small" type="primary"></el-button>
</el-row>
</el-card>
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter)">
<table-tool>
<el-button @click="$refs.auFormRef.onOpen()" icon="el-icon-plus" size="small" type="primary">新增</el-button>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" border header-align="center" style="width: 100%">
<el-table-column :index="indexMethod" label="序号" type="index" width="50"></el-table-column>
<el-table-column label="名称" prop="name"></el-table-column>
<el-table-column label="编码" prop="code" width="150px"></el-table-column>
<el-table-column label="届次" prop="sessionName"></el-table-column>
<el-table-column label="团长" prop="delegationHead"></el-table-column>
<el-table-column label="操作" width="300">
<template slot-scope="scope">
<el-link @click="$refs.auFormRef.onOpen(scope.row.id)" size="mini" type="primary">编辑</el-link>
<el-link @click="$refs.headFormRef.onOpen(scope.row.id,scope.row.sessionId)" size="mini" type="primary">
设置团长
</el-link>
<el-link @click="$refs.partUnitRef.onOpen(scope.row.id,scope.row.sessionId)" size="mini" type="primary">
设置组成单位
</el-link>
<el-link @click="doDelete(scope.row.id)" size="mini" type="danger">删除</el-link>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template v-else>
<el-tabs v-model="secondLevelTabActive">
<el-tab-pane label="组成单位" name="partUnitTable">
<el-card class="mt10" shadow="never" style="border: 1px solid var(--border-color-lighter)">
<part-unit-table
:delegation_id="currentTreeData.id"
:session_id="pageForm.sessionId"
@open="(delegation_id,session_id)=>{$refs.partUnitRef.onOpen(delegation_id,session_id)}"
ref="partUnitTableRef"
></part-unit-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="设置团长" name="head">
<el-card class="mt10" shadow="never" style="border: 1px solid var(--border-color-lighter)">
<head-table
:delegation_id="currentTreeData.id"
:session_id="pageForm.sessionId"
@open="(delegation_id,session_id)=>{$refs.headFormRef.onOpen(delegation_id,session_id)}"
ref="headTableRef"
@refresh="refresh"
></head-table>
</el-card>
</el-tab-pane>
</el-tabs>
</template>
</el-card>
</el-col>
</el-row>
<au-form @refresh="refresh" ref="auFormRef"></au-form>
<part-unit @refresh="refresh" ref="partUnitRef"></part-unit>
<head-form @refresh="refresh" ref="headFormRef"></head-form>
</div>
<script nonce="${cspNonce!}">
<!--#include("tree.js"){}#-->
<!--#include("auForm.js"){}#-->
<!--#include("partUnit.js"){}#-->
<!--#include("headForm.js"){}#-->
<!--#include("partUnitTable.js"){}#-->
<!--#include("headTable.js"){}#-->
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
sessionOptions: [],
currentTreeNode: null,
currentTreeData: null,
currentTreeSessionId: null,
secondLevelTabActive: "partUnitTable"
}
},
components: {
tree: TREE_TEMPLATE,
"au-form": AU_FORM_TEMPLATE,
"part-unit": PART_UNIT_TEMPLATE,
"head-form": HEAD_FORM_TEMPLATE,
"part-unit-table": PART_UNIT_TABLE_TEMPLATE,
"head-table": HEAD_TABLE_TEMPLATE
},
methods: {
refresh() {
this.$refs.treeRef.listTree()
if (this.$refs.partUnitTableRef) {
this.$refs.partUnitTableRef.doSearch()
}
if (this.$refs.headTableRef) {
this.$refs.headTableRef.pageData()
}
this.doSearch()
},
sessionChange(id) {
this.pageForm.sessionId = id
this.pageData()
},
treeNodeClick(data, node) {
this.currentTreeData = data
this.currentTreeNode = node
console.log(data)
console.log(node)
},
doDelete(id) {
this.$confirm("您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info"
}).then(() => {
debugger
this.$axios.post(loc() + "/delete", { id: id }).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.refresh()
}
})
})
},
pageData() {
this.$axios
.post(loc() + "/pageData", {
...this.pageForm,
sessionId: this.pageForm.sessionId
})
.then((res) => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
}
},
created() {}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,74 @@
const PART_UNIT_TEMPLATE = {
template: `
<el-dialog title="设置组成单位" :visible.sync="partUnitDialogFormVisible" width="1000px" :close-on-click-modal="false">
<el-transfer
ref="transferRef"
:titles="['可选二级单位', '当前成员单位']"
filterable
:props="{
key: 'id',
label: 'name'
}"
:filter-method="(query,item)=>{return item.name.indexOf(query) > -1}"
v-model="selectUnitsIds"
:data="allUnits"
></el-transfer>
<div slot="footer" class="dialog-footer">
<el-button @click="partUnitDialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmitPartUnit">确 定</el-button>
</div>
</el-dialog>
`,
data() {
return {
partUnitDialogFormVisible: false,
selectUnitsIds: [],
allUnits: [],
delegationId: null,
sessionId: null
}
},
methods: {
onOpen(delegationId, sessionId) {
if (!delegationId || !sessionId) {
return
}
this.partUnitDialogFormVisible = true
this.delegationId = delegationId
this.sessionId = sessionId
if (this.$refs.transferRef) {
this.$refs.transferRef.clearQuery("left")
this.$refs.transferRef.clearQuery("right")
}
this.$axios
.post("/platform/womanCongress/delegation/partUnitTransferData", {
delegationId,
sessionId
})
.then((res) => {
if (res.code === 0) {
this.selectUnitsIds = res.data.selectUnitIds
this.allUnits = res.data.allUnits
}
})
},
doSubmitPartUnit() {
this.$axios
.post(loc() + "/partUnitSet", {
unitIds: JSON.stringify(this.selectUnitsIds),
delegationId: this.delegationId,
sessionId: this.sessionId
})
.then((res) => {
if (res.code === 0) {
this.partUnitDialogFormVisible = false
this.$message.success(res.msg)
this.$emit("refresh", null)
}
})
}
},
created() {}
}
@@ -0,0 +1,70 @@
const PART_UNIT_TABLE_TEMPLATE = {
template: `
<div>
<table-tool>
<el-button size="small" type="primary" icon="el-icon-edit" @click="open">设置组成单位</el-button>
</table-tool>
<el-table :data="tableData" border>
<el-table-column type="index" label="序号" width="100px"></el-table-column>
<el-table-column prop="name" label="名称"></el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</div>
`,
mixins: [initTableMixins],
props: {
session_id: {
type: String,
required: true
},
delegation_id: {
type: String,
required: true
}
},
data() {
return {
tableData: [],
pageForm: {}
}
},
watch: {
session_id: {
handler: function (val) {
if (val) {
this.doSearch()
}
},
immediate: true
},
delegation_id: {
handler: function (val) {
if (val) {
this.doSearch()
}
},
immediate: true
}
},
methods: {
pageData() {
this.$axios
.post("/platform/womanCongress/delegation/partUnitPageData", {
...this.pageForm,
sessionId: this.session_id,
delegationId: this.delegation_id
})
.then((res) => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
},
open() {
this.$emit("open", this.delegation_id, this.session_id)
}
},
created() {
}
}
@@ -0,0 +1,74 @@
const TREE_TEMPLATE = {
template: `
<el-card shadow="never" style="height: 100%" body-style="{ height: '100%' }">
<el-select placeholder="输入关键字进行查找" v-model="sessionId" clearable class="mb10" @change="sessionIdChange">
<el-option v-for="item in sessionOptions" :label="item.fullName" :value="item.id" :key="item.id"></el-option>
</el-select>
<el-tree
:data="treeData"
ref="treeRef"
:expand-on-click-node="false"
:props="{
children: 'children',
label: 'name'
}"
default-expand-all
@node-click="treeNodeClick"
:filter-node-method="filterNode"
>
<template slot-scope="{ node, data }">
<span class="el-tree-node__label">
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
<i class="el-icon-folder" v-else></i>
{{node.label}}
</span>
</template>
</el-tree>
</el-card>
`,
data() {
return {
currentTreeNode: null,
currentTreeData: null,
sessionOptions: [],
sessionId: null,
treeData: []
}
},
watch: {
sessionId(val) {
this.$emit("session-change", val)
}
},
methods: {
treeNodeClick(data, node) {
this.$emit("node-click", data, node)
},
filterNode() {},
listTree() {
this.$axios.post("/platform/womanCongress/delegation/tree", { sessionId: this.sessionId }).then((res) => {
if (res.code === 0) {
this.treeData = res.data
}
})
},
listSession() {
this.$axios.post("/platform/womanCongress/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
if (this.sessionOptions && this.sessionOptions.length > 0) {
this.sessionId = this.sessionOptions[0].id
this.listTree()
}
}
})
},
sessionIdChange() {
this.listTree()
}
},
created() {
this.listSession()
}
}
@@ -0,0 +1,174 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年份">
<el-date-picker
:clearable="false"
v-model="pageForm.year"
value-format="yyyy"
formData="yyyy"
type="year"
placeholder="选择年份"
></el-date-picker>
</search-item>
<search-item label="届数">
<dict-select v-model="pageForm.j" code="TEACHER_CONGRESS_J"></dict-select>
</search-item>
<search-item label="次数">
<dict-select v-model="pageForm.c" code="TEACHER_CONGRESS_C"></dict-select>
</search-item>
</search>
</el-card>
<el-card shadow="never">
<table-tool>
<el-button size="small" type="primary" icon="el-icon-plus" @click="openAdd">新增</el-button>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" header-align="center" style="width: 100%">
<el-table-column type="index" :index="indexMethod" width="50" label="序号"></el-table-column>
<el-table-column prop="year" label="年份"></el-table-column>
<el-table-column prop="j" label="届数"></el-table-column>
<el-table-column prop="c" label="次数"></el-table-column>
<el-table-column prop="description" label="描述"></el-table-column>
<el-table-column prop="startDate" label="开启时间"></el-table-column>
<el-table-column prop="enable" label="开启状态">
<template slot-scope="{row}">
<i class="fa fa-circle" :class="row.enable ? 'text-success' : 'text-danger'" style="margin-left: 5px"></i>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="openEdit(scope.row.id)">编辑</el-button>
<el-button size="mini" type="danger" @click="doDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<el-dialog :title="formData.id ? '编辑':'新增'" :visible.sync="dialogFormVisible" width="60%" :close-on-click-modal="false">
<el-form :model="formData" ref="formRef" size="small" label-width="120px" :rules="formRules">
<el-form-item prop="year" label="年份">
<el-date-picker
style="width: 100%"
:clearable="false"
v-model="formData.year"
value-format="yyyy"
formData="yyyy"
type="year"
placeholder="选择年"
></el-date-picker>
</el-form-item>
<el-form-item prop="j" label="届数">
<dict-select v-model="formData.j" code="TEACHER_CONGRESS_J"></dict-select>
</el-form-item>
<el-form-item prop="c" label="次数">
<dict-select v-model="formData.c" code="TEACHER_CONGRESS_C"></dict-select>
</el-form-item>
<el-form-item prop="description" label="描述">
<el-input type="textarea" :rows="2" style="width: 100%" placeholder="请输入描述" v-model="formData.description"></el-input>
</el-form-item>
<el-form-item prop="enable" label="状态">
<el-radio-group v-model="formData.enable" size="small">
<el-radio :label="true" border>开启</el-radio>
<el-radio :label="false" border>关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="isExtend" label="是否延用" v-if="!formData.id">
<el-radio-group v-model="formData.isExtend" size="small">
<el-radio :label="true" border></el-radio>
<el-radio :label="false" border></el-radio>
</el-radio-group>
<div>
延用上一次妇代会的组织机构及代表信息,包含【代表团;妇代会代表】。
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</div>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
dialogFormVisible: false,
formRules: {
year: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
j: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
c: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
enable: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
isExtend: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
}
}
},
methods: {
openAdd() {
this.dialogFormVisible = true
this.$nextTick(() => {
this.formData = {}
})
},
openEdit(id) {
this.dialogFormVisible = true
this.$axios.post(loc() + "/findOne", { id }).then((res) => {
if (res.code === 0) {
res.data.year = res.data.year.toString()
this.formData = res.data
}
})
},
doDelete(id) {
// 确认删除吗
this.$confirm("确认删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post("/platform/womanCongress/session/delete", { id }).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.doSearch()
}
})
})
},
doSubmit() {
this.$refs.formRef.validate((valid) => {
if (valid) {
this.$axios.post(loc() + (this.formData.id ? "/update" : "/insert"), this.formData).then((res) => {
if (res.code === 0) {
this.dialogFormVisible = false
this.$message.success(res.msg)
this.doSearch()
}
})
}
})
}
},
created() {
this.pageData()
}
})
</script>
<!--#
}
#-->