Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-05-18 10:37:25 +08:00
40 changed files with 470 additions and 185 deletions
@@ -146,20 +146,22 @@ public class SysUnitController {
@At
@ApiOperation("按关键字查询单位下的人员")
@Ok("json:{ignoreNull:true}")
public Result listUserSelect(@Valid String unitId, @Valid String keyWord) {
Sql sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
Cnd cnd = Cnd.NEW();
cnd.and(View_user::getUnitId, "=", unitId);
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike(View_user::getLoginname, keyWord, true);
seg.orLike(View_user::getUsername, keyWord, true);
cnd.and(seg);
cnd.limit(1, 10);
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(sysUnitService.dao().getEntity(View_user.class));
sysUnitService.dao().execute(sql);
List<View_user> list = sql.getList(View_user.class);
public Result listUserSelect(@Valid String unitId, @Valid String keyWord, @Valid String roleCode) {
// Sql sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
// Cnd cnd = Cnd.NEW();
// cnd.and(View_user::getUnitId, "=", unitId);
// SqlExpressionGroup seg = new SqlExpressionGroup();
// seg.orLike(View_user::getLoginname, keyWord, true);
// seg.orLike(View_user::getUsername, keyWord, true);
// cnd.and(seg);
// cnd.limit(1, 10);
// sql.setCondition(cnd);
// sql.setCallback(Sqls.callback.entities());
// sql.setEntity(sysUnitService.dao().getEntity(View_user.class));
// sysUnitService.dao().execute(sql);
// List<View_user> list = sql.getList(View_user.class);
// 人员范围判断放到 service 层,便于按单位干部角色复用同一套查询规则。
List<View_user> list = sysUnitService.listUserSelect(unitId, keyWord, roleCode);
return Result.success(list);
}
@@ -2,6 +2,9 @@ package com.budwk.app.sys.services;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.sys.models.Sys_unit;
import com.budwk.app.sys.views.View_user;
import java.util.List;
/**
* Created by wizzer on 2016/12/22.
@@ -22,6 +25,16 @@ public interface SysUnitService extends BaseService<Sys_unit> {
*/
void deleteAndChild(Sys_unit unit);
/**
* 按单位干部角色查询可选择人员。
*
* @param unitId 当前单位ID
* @param keyWord 人员工号或姓名关键字
* @param roleCode 当前选择的单位干部角色编码
* @return 可选择人员列表
*/
List<View_user> listUserSelect(String unitId, String keyWord, String roleCode);
/**
* 清空缓存
*/
@@ -1,21 +1,27 @@
package com.budwk.app.sys.services.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.constant.RedisConstant;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_unit;
import com.budwk.app.sys.services.SysUnitService;
import com.budwk.app.sys.views.View_user;
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.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
import java.util.List;
/**
* Created by wizzer on 2016/12/22.
*/
@@ -69,6 +75,71 @@ public class SysUnitServiceImpl extends BaseServiceImpl<Sys_unit> implements Sys
}
}
/**
* 按单位干部角色查询可选择人员。
* 选择单位党委书记时,人员范围放大到当前单位所属分工会下所有单位的人员;
* 选择单位分管校领导时,查询已关联单位分管校领导角色的人员;其他角色保持当前单位范围。
*
* @param unitId 当前单位ID
* @param keyWord 人员工号或姓名关键字
* @param roleCode 当前选择的单位干部角色编码
* @return 可选择人员列表
*/
@Override
public List<View_user> listUserSelect(String unitId, String keyWord, String roleCode) {
Sql sql;
Cnd cnd = Cnd.NEW();
if ("UNIT_SCHOOL_LEADER".equals(roleCode)) {
sql = Sqls.create("""
select distinct
u.id,
u.loginname,
u.username,
u.unitname
from vw_user u
inner join sys_user_role ur on ur.userId = u.id
inner join sys_role r on r.id = ur.roleId
$condition
""");
// 单位分管校领导从已绑定 UNIT_SCHOOL_LEADER 角色的人员中选择。
cnd.and("r.code", "=", "UNIT_SCHOOL_LEADER");
} else {
sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
}
if (RoleConstant.UNIT_PARTY_SECRETARY.name().equals(roleCode)) {
Sys_unit unit = this.fetch(unitId);
if (unit != null && Strings.isNotBlank(unit.getUnionId())) {
SqlExpressionGroup scopeGroup = new SqlExpressionGroup();
// 单位党委书记可从当前单位所属分工会下选择人员,同时保留本单位人员兜底。
scopeGroup.or(View_user::getUnionId, "=", unit.getUnionId());
scopeGroup.or(View_user::getUnitId, "=", unitId);
cnd.and(scopeGroup);
} else {
// 当前单位未维护分工会时,至少保留本单位人员可选。
cnd.and(View_user::getUnitId, "=", unitId);
}
} else if ("UNIT_SCHOOL_LEADER".equals(roleCode)) {
// 角色范围已经通过 sys_user_role 与 sys_role 关联限定,这里不再叠加单位范围。
} else {
cnd.and(View_user::getUnitId, "=", unitId);
}
SqlExpressionGroup seg = new SqlExpressionGroup();
if ("UNIT_SCHOOL_LEADER".equals(roleCode)) {
seg.orLike("u.loginname", keyWord, true);
seg.orLike("u.username", keyWord, true);
} else {
seg.orLike(View_user::getLoginname, keyWord, true);
seg.orLike(View_user::getUsername, keyWord, true);
}
cnd.and(seg);
cnd.limit(1, 10);
sql.setCondition(cnd);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao().getEntity(View_user.class));
dao().execute(sql);
return sql.getList(View_user.class);
}
@CacheRemoveAll
public void clearCache() {
@@ -135,7 +135,7 @@ public class CommonController {
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("unit.unionId", "=", unionId);
cnd.and("unit.unitTypeCode", "=", "1");
cnd.and("unit.unitLevel", "=", "2");
cnd.asc("unit.unitcode");
sql.setCondition(cnd);
List<NutMap> unitList = sysUserService.listMap(sql);
@@ -24,6 +24,8 @@ import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
import com.budwk.app.zhgh.activity.basic.param.ActivityUserScopePageParam;
import com.budwk.app.zhgh.activity.basic.service.ActivityBasicScopeService;
import com.budwk.app.zhgh.activity.basic.template.UserTemp;
import com.budwk.app.zhgh.club.model.SysClub;
import com.budwk.app.zhgh.club.service.SysClubService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
@@ -73,6 +75,9 @@ public class ActivityBasicScopeController {
@Inject
private ActivityBasicScopeService activityBasicScopeService;
@Inject
private SysClubService sysClubService;
@Inject
private Dao dao;
@@ -244,6 +249,8 @@ public class ActivityBasicScopeController {
return Result.success(new NutMap() {{
addv("is_A06", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()));
addv("is_H04", StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()));
addv("is_H02", StpUtil.hasRole(RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name()));
addv("is_CLUB_PRESIDENT", StpUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name()));
addv("is_sysadmin", StpUtil.hasRole(RoleConstant.SYSADMIN.name()));
addv("unionid", SecurityUtil.getUnionId());
}});
@@ -377,7 +384,23 @@ public class ActivityBasicScopeController {
try {
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())){
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
boolean isBranchUnionChairman = AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name());
boolean isClubPresident = AuthUtil.hasRole(RoleConstant.CLUB_PRESIDENT.name());
List<String> manageClubIdList = sysClubService.getMyManageClub().stream().map(SysClub::getId).toList();
if (isBranchUnionChairman && isClubPresident) {
// Users with both roles can search their union users and their managed club members.
SqlExpressionGroup scopeGroup = new SqlExpressionGroup();
scopeGroup.or("u.unionid", "=", SecurityUtil.getUnionId());
if (Lang.isNotEmpty(manageClubIdList)) {
scopeGroup.or("clubuser.clubid", "in", manageClubIdList);
}
cnd.and(scopeGroup);
} else if (isClubPresident) {
// Club presidents can only search members from clubs they manage.
cnd.and("clubuser.clubid", "in", Lang.isNotEmpty(manageClubIdList) ? manageClubIdList : List.of("__EMPTY_CLUB_ID__"));
} else {
cnd.andEX("u.unionid", "=", SecurityUtil.getUnionId());
}
}
cnd.andEX("u.unionid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnionId());
cnd.andEX("u.unitid", EQ_OR_NEQ_OP, activityUserScopePageParam.getUnitId());
@@ -141,7 +141,8 @@ public class ActivityCultureApplyActivityController {
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
args.set(FlowConst.FORM_DATA, tissue);
args.set("activity_type", tissue.getActivity_type());
ProcessInstance instance = flowEngine.startProcessInstanceByKey(tissue.getActivity_type().equals(40002) ? "FGHWHHD" : "XHWHHD", tissue.getId(), SecurityUtil.getUserId(), args);
// ProcessInstance instance = flowEngine.startProcessInstanceByKey(tissue.getActivity_type().equals(40002) ? "FGHWHHD" : "XHWHHD", tissue.getId(), SecurityUtil.getUserId(), args);
ProcessInstance instance = flowEngine.startProcessInstanceByKey("WHHD", tissue.getId(), SecurityUtil.getUserId(), args);
// 自动完成第一个申请任务
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
@@ -82,4 +82,11 @@ public class ClubCommonController {
return Result.success(list);
}
@At
@SaCheckLogin
public Result listManageClubByRole() {
// Activity user scope uses manageable clubs, not all clubs the user has joined.
return Result.success(sysClubService.getMyManageClub());
}
}
@@ -282,7 +282,8 @@ public class ClubInfoManageController {
}
Sys_role sysRole = sysRoleService.getByCode(roleCode);
for (String user : users) {
if (AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name()) || !Objects.equals(RoleConstant.CLUB_MEMBER.name(), roleCode)) {
// 校工会主席可按校级管理角色录入协会会员并同步用户角色。
if (AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name()) || !Objects.equals(RoleConstant.CLUB_MEMBER.name(), roleCode)) {
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setUserId(user);
sysUserRole.setRoleId(sysRole.getId());
@@ -118,8 +118,10 @@ public class ClubRefreshReportController {
public Object submit(@Param("data") SysClubRefresh clubRefresh) {
Cnd cnd = Cnd.NEW();
cnd.and("userId", "=", SecurityUtil.getUserId());
// cnd.and("userId", "=", SecurityUtil.getUserId());
// cnd.and("clubId", "=", clubRefresh.getClubId());
// 只校验当前协会的未完成换届报告申请,避免其他协会记录误拦截。
cnd.and(SysClubRefresh::getClubId, "=", clubRefresh.getClubId());
if(StrUtil.isNotBlank(clubRefresh.getId())) {
cnd.and(SysClubRefresh::getId, "!=", clubRefresh.getId());
}
@@ -119,6 +119,8 @@ public class ClubRuleUpdateController {
public Object submit(@Param("data")SysClubRule clubRule) {
Cnd cnd = Cnd.NEW();
// 只校验当前协会的未完成章程备案申请,避免其他协会记录误拦截。
cnd.and(SysClubRule::getClubId, "=", clubRule.getClubId());
if(StrUtil.isNotBlank(clubRule.getId())) {
cnd.and(SysClubRule::getId, "!=", clubRule.getId());
}
@@ -291,8 +291,20 @@ public class ClubStatisticsController {
response.setHeader("Content-Disposition", "attachment;filename=" + URLUtil.encode("上传资料数据.zip"));
LinkedHashMap<String, List<JSONObject>> fileList = new LinkedHashMap<>();
//查询社团
List<SysClub> clubList = sysClubService.query(Cnd.NEW().andEX("id", "=", clubId));
// 导出上传资料时只取未删除且注册流程已完成的协会,避免历史删除协会资料被打包。
Cnd clubCnd = Cnd.NEW();
clubCnd.andEX("id", "=", clubId);
clubCnd.and("dismiss", "=", false);
List<SysClub> clubList = sysClubService.query(clubCnd);
if (!clubList.isEmpty()) {
List<ProcessInstance> instanceList = sysClubService.dao().query(
ProcessInstance.class,
Cnd.where(ProcessInstance::getBusinessNo, "in", clubList.stream().map(SysClub::getId).toList())
.and(ProcessInstance::getState, "=", ProcessInstanceStateEnum.FINISHED.getCode())
);
List<String> passList = instanceList.stream().map(ProcessInstance::getBusinessNo).toList();
clubList = clubList.stream().filter(o -> passList.contains(o.getId())).toList();
}
clubList.forEach(item -> {
List<JSONObject> file = new ArrayList<>();
file.addAll(Optional.ofNullable(item.getFiles()).orElseGet(ArrayList::new));
@@ -301,7 +313,6 @@ public class ClubStatisticsController {
file.addAll(Optional.ofNullable(item.getManageFile()).orElseGet(ArrayList::new));
file.addAll(Optional.ofNullable(item.getYearPlanFile()).orElseGet(ArrayList::new));
file.addAll(Optional.ofNullable(item.getReplaceReport()).orElseGet(ArrayList::new));
file.addAll(Optional.ofNullable(item.getRulesFile()).orElseGet(ArrayList::new));
fileList.put(item.getId(), file);
});
@@ -113,7 +113,8 @@ public class SysClubInfoManageServiceImpl extends BaseServiceImpl<ClubCommonPage
cnd.andEX("year(c.createTime)", "=", pageForm.getYear());
cnd.and("c.dismiss", "=", false);
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
// 校工会主席在协会管理界面按校级管理角色查看全部协会。
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(), RoleConstant.CLUB_OPERATOR.name()));
List<Sys_user_role> clubList = dao().query(Sys_user_role.class, Cnd.where("roleId", "in", roleList).and("userId", "=", SecurityUtil.getUserId()).and("clubId", "is not", null));
List<String> clubIdList = clubList.stream().map(Sys_user_role::getClubId).toList();
@@ -114,7 +114,8 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
Cnd cnd = Cnd.where("dismiss", "=", false);
cnd.asc("createTime");
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name())) {
// 校工会主席在协会管理界面按校级管理角色查看全部协会。
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name(), RoleConstant.SCHOOL_UNION_CLUB_ADMIN.name(), RoleConstant.SCHOOL_UNION_CHAIRMAN.name())) {
List<String> roleList = commonService.findUserRoleByRoleCode(List.of(RoleConstant.CLUB_PRESIDENT.name(), RoleConstant.CLUB_VICE_PRESIDENT.name(), RoleConstant.CLUB_SECRETARY.name(), RoleConstant.CLUB_VICE_SECRETARY.name(),RoleConstant.CLUB_OPERATOR.name()));
List<Sys_user_role> clubList = dao().query(Sys_user_role.class, Cnd.where("roleId", "in", roleList).and("userId", "=", SecurityUtil.getUserId()).and("clubId", "is not", null));
List<String> clubIdList = clubList.stream().map(Sys_user_role::getClubId).toList();
@@ -245,6 +246,7 @@ public class SysClubServiceImpl extends BaseServiceImpl<SysClub> implements SysC
cnd.andEX("year(info.createTime)", "=", pageForm.getYear());
cnd.and("info.userId", "=", SecurityUtil.getUserId());
cnd.desc("createTime");
// cnd.groupBy("info.id");
sql.setCondition(cnd);
return listPageVO(pageForm, sql, ClubRegisterPageVo.class);
}
@@ -8,6 +8,7 @@ import com.budwk.app.sys.models.Sys_dict;
import com.budwk.app.sys.services.SysDictService;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -35,6 +36,9 @@ public class ProposalQueryDelegationController {
@Inject
private SysDictService sysDictService;
@Inject
private ProposalCommonService proposalCommonService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/proposal/query/delegation/index.html")
@@ -66,6 +70,7 @@ public class ProposalQueryDelegationController {
Cnd cnd = Cnd.NEW();
cnd.andEX("dbt.sessionId", "=", sessionId);
if (!AuthUtil.hasRoleOr("SYSADMIN", "SCHOOL_UNION_ADMIN")) {
cnd.and("dbt.id", "in", proposalCommonService.getSelfManageDelegationIds());
}
cnd.asc("dbt.`code`");
sql.setCondition(cnd);
@@ -101,6 +106,9 @@ public class ProposalQueryDelegationController {
$condition
""");
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr("SYSADMIN", "SCHOOL_UNION_ADMIN")) {
cnd.and("info.delegationId", "in", proposalCommonService.getSelfManageDelegationIds());
}
ProposalSearchParam.buildSearch(cnd, pageForm);
cnd.groupBy("info.id");
sql.setCondition(cnd);
@@ -71,7 +71,10 @@ public class ProposalWriteController {
@ApiOperation("保存提案")
@SLog(tag = "提案管理系统-我的提案", msg = "保存提案")
public Result save(@Param("info") ProposalInfo proposalInfo) {
if (StrUtil.isBlank(proposalInfo.getCode())) {
// 保存草稿允许表单未填完整,只有具备生成编号所需信息时才生成提案编号。
if (StrUtil.isBlank(proposalInfo.getCode())
&& StrUtil.isNotBlank(proposalInfo.getSessionId())
&& StrUtil.isNotBlank(proposalInfo.getDelegationId())) {
proposalInfo.setCode(proposalWriteService.generateProposalCode(proposalInfo.getSessionId(), proposalInfo.getDelegationId()));
}
dao.insertOrUpdate(proposalInfo);
@@ -76,7 +76,7 @@ public class ProposalQueryComprehensiveParam extends PageForm {
//教代会届次
if (Lang.isNotEmpty(searchParam.getSessionIds())) {
cnd.and("info.sessionId", "in", searchParam.getSessionIds());
} else {
} else if (StrUtil.isNotBlank(searchParam.getSessionId())) {
cnd.andEX("info.sessionId", "=", searchParam.getSessionId());
}
@@ -296,9 +296,6 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.put(FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_feedback"), "√");
info.put("tf_feedback", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_feedback"));
info.put("tf_opinion", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_opinion"));
info.put("tf_phone", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_phone"));
info.put("tf_address", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_address"));
info.put("tf_postcode", FlowUtil.variableToDict(feedbackTask.getVariable()).getStr("tf_postcode"));
}
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
@@ -165,7 +165,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.id,
info.name,
info.code,
info.researchFindings,
info.brief,
info.measures,
info.createUserName,
@@ -221,7 +220,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
exportEntities.add(new ExcelExportEntity("提案编号", "code", 20));
exportEntities.add(new ExcelExportEntity("提案名称", "name", 20));
exportEntities.add(new ExcelExportEntity("提案案由", "brief", 40));
exportEntities.add(new ExcelExportEntity("代表调研情况", "researchFindings", 40));
exportEntities.add(new ExcelExportEntity("代表建议措施", "measures", 40));
exportEntities.add(new ExcelExportEntity("提案人", "createUserName", 20));
exportEntities.add(new ExcelExportEntity("提案人电话", "mobile", 20));
@@ -397,7 +395,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.code,
DATE_FORMAT(info.createTime, '%Y年%m月%d日') AS createTime,
info.suggestUnits,
info.researchFindings,
info.brief,
info.measures,
info.createUserName,
@@ -540,7 +537,6 @@ public class ProposalExportServiceImpl extends BaseServiceImpl<ProposalInfo> imp
info.id,
info.name,
info.code,
info.researchFindings,
info.brief,
info.measures,
info.createUserName,
@@ -207,17 +207,29 @@ public class TeacherCongressDelegateManageController {
`sys_user` t1
LEFT JOIN sys_unit t2 ON t2.id = t1.unitId
WHERE
t1.id NOT IN ( SELECT userId FROM teacher_congress_delegate WHERE sessionId = @sessionId AND delegationId = @delegationId )
-- 原逻辑只排除当前代表团已有人员:t1.id NOT IN ( SELECT userId FROM teacher_congress_delegate WHERE sessionId = @sessionId AND delegationId = @delegationId )
t1.id NOT IN ( SELECT userId FROM teacher_congress_delegate WHERE sessionId = @sessionId )
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 = sysUserService.listPageMap(1, 50, sql);
if (ObjectUtil.isEmpty(pagination.getList())) {
// 可选人员为空时,额外检查当前关键字是否命中了已存在代表,给出重复新增提示。
List<Teacher_congress_delegate> repeatDelegates = dao.query(Teacher_congress_delegate.class,
Cnd.where(Teacher_congress_delegate::getSessionId, "=", param.getSessionId())
.and(Cnd.exps(Teacher_congress_delegate::getLoginName, "like", "%" + param.getKeyWord() + "%")
.or(Teacher_congress_delegate::getUserName, "like", "%" + param.getKeyWord() + "%"))
.limit(1, 1));
if (ObjectUtil.isNotEmpty(repeatDelegates)) {
Teacher_congress_delegate repeatDelegate = repeatDelegates.get(0);
return Result.error("工号" + repeatDelegate.getLoginName() + " " + repeatDelegate.getUserName() + "已是当前届次代表,不能重复新增");
}
}
return Result.success(pagination.getList());
}
@@ -21,6 +21,8 @@ import com.budwk.app.flow.service.FlowCommonService;
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.delegate.models.TeacherCongressDelegatePush;
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
@@ -66,6 +68,10 @@ public class TeacherCongressDelegatePushZgAuditController {
@Inject
private FlowCommonService flowCommonService;
@Inject
private SysUserService sysUserService;
@Inject
private SysRoleService sysRoleService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegate/push/zcAudit.html")
@@ -255,6 +261,8 @@ public class TeacherCongressDelegatePushZgAuditController {
userRole.setTcSessionId(delegatePush.getSessionId());
baseService.dao().insert(delegate);
// baseService.dao().insert(userRole);
// 资格审查通过进入代表库后,同步设置教代会代表角色,保证用户立即拥有正式/列席代表权限。
insertDelegateUserRole(userRole);
// 去改改用户表的手机号
baseService.dao().update(
@@ -337,6 +345,8 @@ public class TeacherCongressDelegatePushZgAuditController {
userRole.setTcSessionId(delegatePush.getSessionId());
baseService.dao().insert(delegate);
// 资格审查批量通过进入代表库后,同步设置教代会代表角色,保证用户立即拥有正式/列席代表权限。
insertDelegateUserRole(userRole);
// 去改改用户表的手机号
baseService.dao().update(
@@ -358,4 +368,19 @@ public class TeacherCongressDelegatePushZgAuditController {
return Result.success();
}
/**
* 同步代表角色关系。
* 资格审查通过后代表库会新增记录,这里补充 sys_user_role,避免用户已是代表但没有代表角色。
*
* @param userRole 待写入的代表角色关系,必须包含 userId、roleId、tcSessionId
*/
private void insertDelegateUserRole(Sys_user_role userRole) {
baseService.dao().clear(Sys_user_role.class, Cnd.where(Sys_user_role::getUserId, "=", userRole.getUserId())
.and(Sys_user_role::getRoleId, "=", userRole.getRoleId())
.and(Sys_user_role::getTcSessionId, "=", userRole.getTcSessionId()));
baseService.dao().insert(userRole);
sysUserService.clearCache();
sysRoleService.clearCache();
}
}
@@ -190,8 +190,8 @@ public class TeacherCongressDelegateTransitionController {
// 当前代表团
Teacher_congress_delegation delegation = dao.fetch(Teacher_congress_delegation.class, delegationId);
// 当前届次代表团代表
List<Teacher_congress_delegate> delegates = dao.query(Teacher_congress_delegate.class, Cnd.where(Teacher_congress_delegate::getSessionId, "=", sessionId).and(Teacher_congress_delegate::getDelegationId, "=", delegation.getId()));
// 当前届次全部代表。转出人员本届已不在当前代表团,必须用全部代表与上一届代表做对比。
List<Teacher_congress_delegate> delegates = dao.query(Teacher_congress_delegate.class, Cnd.where(Teacher_congress_delegate::getSessionId, "=", sessionId));
dao.fetchLinks(delegates, "delegation");
// 上一届次代表
@@ -240,8 +240,8 @@ public class TeacherCongressDelegateTransitionController {
// 减少代表数据 (上一届次是代表 本届次不是代表)
List<NutMap> reduceUser = delegateFull.stream().filter(delegate -> delegate.getString("lastDelegationCode").equals(delegation.getCode()) && StrUtil.isBlank(delegate.getString("delegationCode"))).toList();
// 当前代表人数
int currentCount = delegates.size();
// 当前代表人数只统计本届仍在当前代表团的人员。
long currentCount = delegateFull.stream().filter(delegate -> delegate.getString("delegationCode").equals(delegation.getCode())).count();
HashMap<String, Object> map = new HashMap<>();
map.put("addUser", addUser);
@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
@@ -50,8 +51,6 @@ public class HuiminMineController {
t1.*
FROM
huimin t1
LEFT JOIN activity_user_scope aus ON t1.groupId = aus.groupId
AND aus.userId = @userId
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -62,8 +61,8 @@ public class HuiminMineController {
// 添加启用状态过滤(只显示启用的记录)
cnd.and("t1.enable", "=", true);
// 添加权限过滤
cnd.and(Cnd.exps("t1.groupId", "is", null).or("aus.groupId", "is not", null));
sql.params().set("userId", SecurityUtil.getUserId());
cnd.and(Cnd.exps("t1.groupId", "is", null)
.or(new Static("EXISTS (SELECT 1 FROM activity_user_scope aus WHERE aus.groupId = t1.groupId AND aus.userId = '%s')".formatted(SecurityUtil.getUserId()))));
sql.setCondition(cnd);
Pagination pagination = huiminService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
@@ -48,6 +48,19 @@ const businessTool = {
}
})
},
// 查询当前用户可管理的协会,供活动人员范围筛选使用
listManageClubByRole() {
return commonUtil
.axiosService()
.post("/platform/club/common/listManageClubByRole", {})
.then((resp) => {
if (resp.code === 0) {
return resp.data
} else {
return []
}
})
},
/**
* 获取字典数据,不包含禁用
* @param code
@@ -228,12 +228,12 @@
</template>
<el-row class="query-row"
v-if="is_A06===true||is_sysadmin===true||is_H02===true">
v-if="is_A06===true||is_sysadmin===true||is_H02===true||is_CLUB_PRESIDENT===true">
<el-col class="query-title">协会:</el-col>
<el-col class="query-content">
<el-select v-model="pageForm.clubId" placeholder="请选择协会" @change="doSearch"
filterable
:clearable="is_A06===true||is_sysadmin===true||(is_H04===true&&is_H02===true)"
:clearable="is_A06===true||is_sysadmin===true||is_CLUB_PRESIDENT===true||(is_H04===true&&is_H02===true)"
style="width: 100%">
<el-option
v-for="item in clubOptions"
@@ -482,6 +482,9 @@ module.exports = {
is_H02() {
return this.roleData.is_H02
},
is_CLUB_PRESIDENT() {
return this.roleData.is_CLUB_PRESIDENT
},
is_sysadmin() {
return this.roleData.is_sysadmin
},
@@ -661,9 +664,13 @@ module.exports = {
async created() {
this.listSession()
await this.getRolesAndUnion()
this.clubOptions = await this.$businessTool.listCLubByRole()
if ((this.is_sysadmin || this.is_A06 || this.is_H02) === false && this.is_H04 === true) {
this.unions = this.$businessTool.listUnion(this.unionid)
if (this.is_CLUB_PRESIDENT === true && (this.is_sysadmin || this.is_A06 || this.is_H02) === false) {
this.clubOptions = await this.$businessTool.listManageClubByRole()
} else {
this.clubOptions = await this.$businessTool.listCLubByRole()
}
if ((this.is_sysadmin || this.is_A06 || this.is_H02 || this.is_CLUB_PRESIDENT) === false && this.is_H04 === true) {
this.unions = await this.$businessTool.listUnion(this.unionid)
this.$set(this.pageForm, "unionId", this.unions[0].id)
} else {
this.unions = await this.$businessTool.listUnion()
@@ -673,6 +680,9 @@ module.exports = {
this.$set(this.pageForm, "clubId", this.clubOptions[0].id)
}
}
if (this.is_H04 === false && this.is_H02 === false && this.is_CLUB_PRESIDENT === true && this.clubOptions.length === 1) {
this.$set(this.pageForm, "clubId", this.clubOptions[0].id)
}
await this.flushUnits()
await this.getActivityGroup()
this.personTypeOptions = await this.$businessTool.getDictOptions("USER_PERSON_TYPE")
@@ -207,7 +207,7 @@
<el-table-column v-if="!is_view" label="操作" width="100px">
<template v-slot="{row,$index}">
<el-button size="mini" :disabled="nr.bzs.length<=1 || (!row.canDelete && row.id !== null)" type="danger" icon="el-icon-delete"
<el-button size="mini" :disabled="nr.bzs.length<=1 || (!row.canDelete && row.id)" type="danger" icon="el-icon-delete"
@click="nr.bzs.splice($index,1)"></el-button>
</template>
</el-table-column>
@@ -1,10 +1,18 @@
<template>
<div>
<div class="h5-file-upload">
<div v-if="upload_mode === 'file' && fileList.length" class="h5-file-list">
<div class="h5-file-item" v-for="(file, index) in fileList" :key="file.url || file.name || index">
<van-icon name="description" class="h5-file-icon"></van-icon>
<div class="h5-file-name van-ellipsis">{{ getFileDisplayName(file) }}</div>
<van-icon name="cross" class="h5-file-delete" @click.stop="deleteFile(index)"></van-icon>
</div>
</div>
<van-uploader
v-model="fileList"
:before-read="beforeRead"
:after-read="afterRead"
:before-delete="beforeDelete"
:preview-image="upload_mode !== 'file'"
multiple
progress
:accept="accept"
@@ -142,6 +150,15 @@ module.exports = {
}
},
methods: {
// 文件模式使用自定义预览格,优先展示上传时记录的原始文件名。
getFileDisplayName(file) {
return file.displayName || file.originalName || file.name || (file.file ? file.file.name : "") || ""
},
// 自定义预览格删除后同步父组件,避免表单继续提交已删除附件。
deleteFile(index) {
this.fileList.splice(index, 1)
this.$emit("update:value", this.fileList)
},
beforeDelete(file) {
this.fileList = this.fileList.filter((f) => f.url !== file.url)
this.$emit("update:value", this.fileList)
@@ -178,33 +195,43 @@ module.exports = {
if (valid) {
return true
}
this.$toast(`文件只能是 ${this.accept} 格式!`)
this.$toast("文件只能是 " + this.accept + " 格式!")
return false
},
afterRead(files) {
this.fileList.map((f) => {
if (f.file && f.file.name === files.file.name) {
f.status = "loading"
}
})
const uploadPromises = this.fileList
.filter((f) => f.status === "loading")
const readFiles = Array.isArray(files) ? files : [files]
const uploadPromises = readFiles
.filter((f) => f.file)
.map((f) => {
const formData = new FormData()
formData.append("file", f.file)
this.$set(f, "status", "loading")
return this.$axios.post(this.action, formData).then((resp) => {
if (resp.code === 0) {
f.name = f.file.name
f.size = f.file.size
f.status = null
f.url = resp.data
f.response = resp
f.percentage = 100
f.isImage = true
delete f.file
delete f.content
const fileName = f.file.name
const fileExt = fileName.split(".").pop().toLowerCase()
let fileIndex = this.fileList.indexOf(f)
if (fileIndex === -1) {
fileIndex = this.fileList.findIndex((item) => {
return item.file && item.file.name === fileName && item.file.size === f.file.size
})
}
const uploadFile = {
displayName: fileName,
originalName: fileName,
name: fileName,
size: f.file.size,
status: null,
url: resp.data,
response: resp,
percentage: 100,
isImage: ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(fileExt)
}
if (fileIndex > -1) {
this.$set(this.fileList, fileIndex, uploadFile)
}
} else {
f.status = "fail"
this.$set(f, "status", "fail")
}
})
})
@@ -241,4 +268,47 @@ module.exports = {
.van-uploader__wrapper {
margin-left: 0;
}
.h5-file-upload {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.h5-file-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.h5-file-item {
position: relative;
box-sizing: border-box;
width: 80px;
height: 80px;
padding: 14px 6px 8px;
color: #646566;
text-align: center;
background-color: #f7f8fa;
}
.h5-file-icon {
margin-top: 8px;
font-size: 22px;
}
.h5-file-name {
margin-top: 8px;
font-size: 12px;
}
.h5-file-delete {
position: absolute;
top: 0;
right: 0;
padding: 2px;
color: #fff;
font-size: 12px;
background-color: rgba(0, 0, 0, .65);
}
</style>
@@ -36,15 +36,17 @@ const UNIT_LEADER_MANAGE_TEMPLATE = {
<el-dialog title="添加" :visible.sync="dialogFormVisible" width="600px" :close-on-click-modal="false">
<el-form :model="formData" ref="form" size="small" label-width="60px">
<el-form-item prop="roleCode" label="角色">
<dict-select placeholder="请选择角色" v-model="formData.roleCode" code="UNIT_ROLES"></dict-select>
<!-- <dict-select placeholder="请选择角色" v-model="formData.roleCode" code="UNIT_ROLES"></dict-select> -->
<dict-select placeholder="请选择角色" v-model="formData.roleCode" code="UNIT_ROLES" @change="onRoleChange"></dict-select>
</el-form-item>
<el-form-item prop="userId" label="人员">
<!-- 原人员查询范围只传当前单位::api_params="{ unitId: currentData?.id }" -->
<user-select
placeholder="请选择人员"
style="width: 100%"
v-model="formData.userId"
api="/platform/sys/unit/listUserSelect"
:api_params="{ unitId: currentData?.id }"
:api_params="{ unitId: currentData?.id, roleCode: formData.roleCode }"
:option_label_func="
(item) => {
return item.username + item.loginname + '(' + item.unitName + ')'
@@ -86,6 +88,10 @@ const UNIT_LEADER_MANAGE_TEMPLATE = {
},
computed: {},
methods: {
onRoleChange() {
// 切换角色后人员查询范围可能变化,清空已选人员避免保存到旧范围里的人员。
this.$set(this.formData, "userId", "")
},
doDelete({ userId, roleCode }) {
this.$confirm("您确定要删除吗?", "提示", {
confirmButtonText: "确定",
@@ -3,8 +3,9 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
<div>
<template>
<custom-card>
<!-- :define_key="activity_type===40002?'FGHWHHD':'XHWHHD'" -->
<snaker-start slot="header" label="文化活动申报"
:define_key="activity_type===40002?'FGHWHHD':'XHWHHD'"
define_key="WHHD"
v-if="activity_type===40002||activity_type===40003"></snaker-start>
<el-form :model="formData" :rules="formRules" label-suffix=":" label-width="170px"
ref="addForm" v-loading="formLoading">
@@ -17,7 +17,7 @@ const CLUB_INFO_MANAGE_TEMPLATE = {
<el-card shadow="never" class="mt10">
<table-tool label="会员信息">
<template v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<template v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_CHAIRMAN'])">
<el-button size="small" type="primary" icon="el-icon-download" @click="exportRegistrationDoc">导出登记表</el-button>
<el-button @click="openImport" size="small" type="primary">导入成员</el-button>
<el-button size="small" type="primary" @click="openUserAdd(true)">录入成员</el-button>
@@ -57,7 +57,7 @@ const SCHOOL_CLUB_MANAGE_TEMPLATE = {
<el-dropdown-item :command="{type:'edit',data:row}">
编辑
</el-dropdown-item>
<el-dropdown-item v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])" :command="{type:'delete',data:row}">
<el-dropdown-item v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN', 'SCHOOL_UNION_CHAIRMAN'])" :command="{type:'delete',data:row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
@@ -342,11 +342,12 @@ layout("/layouts/platform.html"){
}).then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
if (this.sessionOptions) {
/*if (this.sessionOptions) {
this.$set(this.pageForm, "sessionId", this.sessionOptions[0].id)
this.listDelegation()
this.pageData()
}
}*/
this.pageData()
}
})
},
@@ -13,7 +13,7 @@ layout("/layouts/platform.html"){
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="代表团列表" :columns.sync="tableColumns"></table-tool>
<table-tool label="代表团列表:" :columns.sync="tableColumns"></table-tool>
<el-table :data="tableData" ref="tableRef" header-align="center" style="width: 100%" row-key="id" show-summary>
<el-table-column
:index="indexMethod"
@@ -141,18 +141,6 @@ layout("/layouts/platform.html"){
placeholder="请输入您的办理意见"
></el-input>
</el-descriptions-item>
<el-descriptions-item label="通讯地址" :span="2">
<el-input v-model="task.taskFormData.tf_address" placeholder="请输入通讯地址"
clearable></el-input>
</el-descriptions-item>
<el-descriptions-item label="联系电话" :span="2">
<el-input v-model="task.taskFormData.tf_phone" placeholder="请输入联系电话"
clearable></el-input>
</el-descriptions-item>
<el-descriptions-item label="邮政编码" :span="2">
<el-input v-model="task.taskFormData.tf_postcode" placeholder="请输入邮政编码"
clearable></el-input>
</el-descriptions-item>
</el-descriptions>
</template>
<el-row type="flex" justify="end" slot="footer">
@@ -219,21 +219,14 @@ layout("/layouts/platform.html"){
},
methods: {
async onSave() {
const valid = await this.$refs["addForm"].validate()
if (valid) {
if (!this.formData.name || this.formData.name.trim().length < 1) {
this.$message.warning("请填写提案名称")
return
// 保存草稿不做必填校验,提交时再统一校验完整表单。
this.$axios.post("/platform/proposal/write/save", {info: JSON.stringify(this.formData)}).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.formData = res.data
commonUtil.pjaxPush('/platform/proposal/mine')
}
this.$axios.post("/platform/proposal/write/save", {info: JSON.stringify(this.formData)}).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.formData = res.data
commonUtil.pjaxPush('/platform/proposal/mine')
}
})
}
})
},
@@ -1,10 +1,10 @@
const HEAD_TABLE_TEMPLATE = {
template: `
<div>
<div style="height: 100%; display: flex; flex-direction: column; min-height: 0;">
<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 :data="tableData" border max-height="528" style="width: 100%;">
<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>
@@ -2,6 +2,38 @@
layout("/layouts/platform.html"){
#-->
<style>
.delegation-detail-tabs {
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
}
.delegation-detail-tabs > .el-tabs__content {
flex: 1;
min-height: 0;
overflow: hidden;
}
.delegation-detail-tabs > .el-tabs__content > .el-tab-pane {
height: 100%;
min-height: 0;
}
.delegation-tab-card {
height: calc(100% - 10px);
}
.delegation-tab-card > .el-card__body {
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
min-height: 0;
}
</style>
<div id="app" v-cloak>
<el-row :gutter="10" style="height: calc(100vh - 84px)" type="flex">
<el-col :span="5">
@@ -45,9 +77,9 @@ layout("/layouts/platform.html"){
</el-card>
</template>
<template v-else>
<el-tabs v-model="secondLevelTabActive">
<el-tabs class="delegation-detail-tabs" v-model="secondLevelTabActive">
<el-tab-pane label="组成单位" name="partUnitTable">
<el-card class="mt10" shadow="never" style="border: 1px solid var(--border-color-lighter)">
<el-card class="mt10 delegation-tab-card" shadow="never" style="border: 1px solid var(--border-color-lighter)">
<part-unit-table
:delegation_id="currentTreeData.id"
:session_id="pageForm.sessionId"
@@ -57,7 +89,7 @@ layout("/layouts/platform.html"){
</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)">
<el-card class="mt10 delegation-tab-card" shadow="never" style="border: 1px solid var(--border-color-lighter)">
<head-table
:delegation_id="currentTreeData.id"
:session_id="pageForm.sessionId"
@@ -1,10 +1,10 @@
const PART_UNIT_TABLE_TEMPLATE = {
template: `
<div>
<div style="height: 100%; display: flex; flex-direction: column; min-height: 0;">
<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 :data="tableData" border max-height="528" style="width: 100%;">
<el-table-column type="index" label="序号" width="100px"></el-table-column>
<el-table-column prop="name" label="名称"></el-table-column>
</el-table>
@@ -83,37 +83,6 @@ layout("/layouts/platform_h5.html"){
show-word-limit
></van-field>
<template v-if="['SATISFIED','FAIRLY_SATISFIED'].includes(formData.tf_feedback)">
<van-field
v-model="formData.tf_address"
name="tf_address"
label="通讯地址"
placeholder="请输入通讯地址"
:rules="[{ required: true, message: '请输入通讯地址' }]"
required
show-word-limit
></van-field>
<!--联系电话-->
<van-field
v-model="formData.tf_phone"
name="tf_phone"
label="联系电话"
placeholder="请输入联系电话"
:rules="[{ required: true, message: '请输入联系电话' }]"
required
show-word-limit
></van-field>
<!--邮政编码-->
<van-field
v-model="formData.tf_postcode"
name="tf_postcode"
label="邮政编码"
placeholder="请输入邮政编码"
:rules="[{ required: true, message: '请输入邮政编码' }]"
required
show-word-limit
></van-field>
</template>
</van-form>
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button type="danger" block @click="$refs.proposalInfoRef.onClose()">取消</van-button>
@@ -4,15 +4,18 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
<van-search
v-model="pageForm.searchKeyword"
:show-action="false"
clearable
placeholder="请输入工号或者姓名查询"
@input="onSearchInput"
@search="doSearch"
@clear="clearSearch"
></van-search>
<van-tabs v-model="isInvite" @click="isInviteClick">
<van-tab title="已邀请" name="1"></van-tab>
<van-tab title="可邀请" name="0"></van-tab>
</van-tabs>
<van-checkbox-group v-model="tableSelection" v-if="tableData && tableData.length>0">
<van-checkbox-group v-model="selectedLoginNames" v-if="tableData && tableData.length>0">
<van-cell-group >
<van-cell
v-for="(item, index) in tableData"
@@ -28,9 +31,10 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
{{item.unitName}}
</span>
<van-checkbox
:name="item"
:name="item.loginName"
:ref="'checkboxes'+item.loginName"
slot="right-icon"
@click.stop
v-if="!pageForm.isInvite"></van-checkbox>
</van-cell>
</van-cell-group>
@@ -62,13 +66,21 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
},
config: {},
isInvite: "0",
tableSelection: []
selectedLoginNames: [],
selectedSeconders: {},
searchTimer: null
}
},
methods: {
async onOpen(record) {
this.visible = true
this.record = record
this.isInvite = "0"
this.pageForm.isInvite = false
this.pageForm.pageNumber = 1
this.pageForm.searchKeyword = null
this.selectedLoginNames = []
this.selectedSeconders = {}
await this.getConfig()
this.pageData()
@@ -77,15 +89,15 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
detail(id) {
},
invite() {
if (this.tableSelection.length === 0) {
if (this.selectedLoginNames.length === 0) {
this.$toast("请先选择附议人后在点击邀请")
return
}
const loginNames = [...new Set(this.tableSelection.map((s) => s.loginName))]
const userName = [...new Set(this.tableSelection.map((s) => s.userName))]
console.log(this.tableSelection)
const loginNames = [...new Set(this.selectedLoginNames)]
const userName = loginNames.map((loginName) => {
return this.selectedSeconders[loginName]?.userName || loginName
})
this.$dialog.confirm({
title: '提示',
@@ -98,7 +110,8 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
if (res.code === 0) {
this.pageData()
this.$toast.success(res.msg)
this.tableSelection = []
this.selectedLoginNames = []
this.selectedSeconders = {}
// this.visible = false
this.$emit("refresh", null)
}
@@ -117,20 +130,14 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
this.echoCheckBox()
this.cacheCurrentPageSeconders()
}
})
},
// 翻页回显勾选
echoCheckBox() {
this.$nextTick(() => {
this.tableData.forEach((item) => {
const checkboxRef = this.$refs['checkboxes' + item.loginName]
if (checkboxRef && this.tableSelection.map((s) => s.loginName).includes(item.loginName)) {
checkboxRef[0].toggle()
}
})
cacheCurrentPageSeconders() {
this.tableData.forEach((item) => {
this.$set(this.selectedSeconders, item.loginName, item)
})
},
@@ -139,13 +146,39 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
this.pageData()
},
onSearchInput(val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.doSearch()
}, 300)
},
clearSearch() {
clearTimeout(this.searchTimer)
this.pageForm.searchKeyword = null
this.doSearch()
},
isInviteClick(index, title) {
this.pageForm.isInvite = index === "1"
this.doSearch()
},
tableRowToggle(index) {
console.log(index)
if (this.pageForm.isInvite) {
return
}
const item = this.tableData[index]
if (!item) {
return
}
this.$set(this.selectedSeconders, item.loginName, item)
const checkedIndex = this.selectedLoginNames.indexOf(item.loginName)
if (checkedIndex > -1) {
this.selectedLoginNames.splice(checkedIndex, 1)
} else {
this.selectedLoginNames.push(item.loginName)
}
},
async getConfig() {
@@ -463,33 +463,26 @@ layout("/layouts/platform_h5.html"){
},
async onSave() {
// 表单验证
try {
await this.$refs.formRef.validate();
// 保存草稿不做必填校验,提交时再统一校验完整表单。
this.$toast.loading({
message: '保存中...',
forbidClick: true,
});
this.$toast.loading({
message: '保存中...',
forbidClick: true,
this.$axios.post("/platform/proposal/write/save", {info: JSON.stringify(this.formData)})
.then((res) => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success(res.msg);
pjaxReplace('/platform/proposal/mine/h5')
} else {
this.$toast.fail(res.msg || '保存失败');
}
})
.catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
this.$axios.post("/platform/proposal/write/save", {info: JSON.stringify(this.formData)})
.then((res) => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success(res.msg);
pjaxReplace('/platform/proposal/mine/h5')
} else {
this.$toast.fail(res.msg || '保存失败');
}
})
.catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
} catch (error) {
// 表单验证失败
console.log('表单验证失败', error);
}
},
// 提交