This commit is contained in:
server
2025-06-20 14:49:22 +08:00
19 changed files with 315 additions and 158 deletions
@@ -30,7 +30,6 @@ public class RedisConstant {
public final static String REDIS_KEY_API_SIGN_OPEN_NONCE = PLATFORM_REDIS_PREFIX + "api:sign:open:nonce:"; public final static String REDIS_KEY_API_SIGN_OPEN_NONCE = PLATFORM_REDIS_PREFIX + "api:sign:open:nonce:";
/** /**
* Token 缓存前缀 * Token 缓存前缀
*/ */
@@ -55,4 +54,9 @@ public class RedisConstant {
* 签名前缀 * 签名前缀
*/ */
public static final String SIGNATURE_PREFIX = PLATFORM_REDIS_PREFIX + "sys:signature:"; public static final String SIGNATURE_PREFIX = PLATFORM_REDIS_PREFIX + "sys:signature:";
/**
* 用户登录锁前缀
*/
public static final String USER_LOGIN_LOCK_PREFIX = PLATFORM_REDIS_PREFIX + "user:login:lock:";
} }
@@ -1,6 +1,7 @@
package com.budwk.app.sys.controller; package com.budwk.app.sys.controller;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
@@ -83,24 +84,43 @@ public class SysLoginController {
@At("/doLogin") @At("/doLogin")
@Ok("json") @Ok("json")
@ApiOperation("用户本地账号密码登录") @ApiOperation("用户本地账号密码登录")
public Object doLogin(@Param("username") String username, public Object doLogin(@Param("username") String username, @Param("password") String password, @Param("platformKey") String captchaKey, @Param("platformCaptcha") String captchaCode, HttpServletRequest req, HttpServletResponse response, HttpSession session) {
@Param("password") String password, if (StrUtil.isBlank(username)) {
@Param("platformKey") String captchaKey, return Result.error("用户名不能为空");
@Param("platformCaptcha") String captchaCode, }
HttpServletRequest req, HttpServletResponse response, HttpSession session) { if (StrUtil.isBlank(password)) {
return Result.error("密码不能为空");
}
String lockKey = RedisConstant.USER_LOGIN_LOCK_PREFIX + username;
int errCount = Convert.toInt(StrUtil.blankToDefault(redisService.get(lockKey), "0"));
log.info("用户名:" + username + "登录失败次数:" + errCount);
if (errCount > 5) {
redisService.setex(lockKey, 5 * 60, String.valueOf(errCount + 1));
return Result.error("登录失败次数过多,请5分钟后再试");
}
try { try {
Sys_user user = null; // 验证码校验
// sysUserService.checkLoginname(username); try {
validateService.checkCode(captchaKey, captchaCode); validateService.checkCode(captchaKey, captchaCode);
user = sysUserService.loginByPassword(username, password); } catch (BaseException e) {
return Result.error(e.getMessage());
}
// 用户名密码校验
Sys_user user = sysUserService.loginByPassword(username, password);
if (user == null) { if (user == null) {
throw new BaseException("用户登录失败"); throw new BaseException("用户登录失败");
} }
//前端去跳转地址
// 成功登录
sysUserService.loginPlus(user, LoginType.PC_LOCAL, req); sysUserService.loginPlus(user, LoginType.PC_LOCAL, req);
return Result.success("login.success"); return Result.success("login.success");
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
redisService.set(lockKey, Convert.toStr(errCount + 1));
String message = e.getMessage();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
} }
@@ -116,6 +136,7 @@ public class SysLoginController {
String loginName = assertion.getPrincipal().getName(); String loginName = assertion.getPrincipal().getName();
sysUserService.checkThirdPlatformLoginName(loginName); sysUserService.checkThirdPlatformLoginName(loginName);
Sys_user sysUser = sysUserService.loginByLoginName(loginName); Sys_user sysUser = sysUserService.loginByLoginName(loginName);
return ">>:" + sysUserService.loginPlus(sysUser, LoginType.CAS, request); return ">>:" + sysUserService.loginPlus(sysUser, LoginType.CAS, request);
} }
@@ -24,6 +24,7 @@ import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
@@ -57,6 +58,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
private SysRoleService sysRoleService; private SysRoleService sysRoleService;
@Inject @Inject
private SLogService sLogService; private SLogService sLogService;
@Inject
private RedisService redisService;
@Override @Override
@CacheResult(cacheKey = "${userId}_getPermissionList") @CacheResult(cacheKey = "${userId}_getPermissionList")
@@ -91,8 +94,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
dao().fetchLinks(user, "roles"); dao().fetchLinks(user, "roles");
List<String> roleNameList = new ArrayList<String>(); List<String> roleNameList = new ArrayList<String>();
for (Sys_role role : user.getRoles()) { for (Sys_role role : user.getRoles()) {
if (!role.isDisabled()) if (!role.isDisabled()) roleNameList.add(role.getCode());
roleNameList.add(role.getCode());
} }
return roleNameList; return roleNameList;
} }
@@ -156,8 +158,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/ */
// @CacheResult(cacheKey = "${userId}_getMenus") // @CacheResult(cacheKey = "${userId}_getMenus")
public List<Sys_menu> getMenus(String userId) { public List<Sys_menu> getMenus(String userId) {
Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + " b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f and a.showit=@t and a.type='menu' order by a.location ASC,a.path asc");
" b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f and a.showit=@t and a.type='menu' order by a.location ASC,a.path asc");
sql.params().set("userId", userId); sql.params().set("userId", userId);
sql.params().set("f", false); sql.params().set("f", false);
sql.params().set("t", true); sql.params().set("t", true);
@@ -172,8 +173,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/ */
// @CacheResult(cacheKey = "${userId}_getMenusAndButtons") // @CacheResult(cacheKey = "${userId}_getMenusAndButtons")
public List<Sys_menu> getMenusAndButtons(String userId) { public List<Sys_menu> getMenusAndButtons(String userId) {
Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + " b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc");
" b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc");
sql.params().set("userId", userId); sql.params().set("userId", userId);
sql.params().set("f", false); sql.params().set("f", false);
return sysMenuService.listEntity(sql); return sysMenuService.listEntity(sql);
@@ -192,8 +192,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/ */
@CacheResult(cacheKey = "${userId}_getDatas") @CacheResult(cacheKey = "${userId}_getDatas")
public List<Sys_menu> getDatas(String userId) { public List<Sys_menu> getDatas(String userId) {
Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + " b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f and a.type='data' order by a.location ASC,a.path asc");
" b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f and a.type='data' order by a.location ASC,a.path asc");
sql.params().set("userId", userId); sql.params().set("userId", userId);
sql.params().set("f", false); sql.params().set("f", false);
return sysMenuService.listEntity(sql); return sysMenuService.listEntity(sql);
@@ -230,8 +229,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/ */
@CacheResult(cacheKey = "${userId}_${pid}_getRoleMenus") @CacheResult(cacheKey = "${userId}_${pid}_getRoleMenus")
public List<Sys_menu> getRoleMenus(String userId, String pid) { public List<Sys_menu> getRoleMenus(String userId, String pid) {
Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and " + "$m and b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc");
"$m and b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc");
sql.params().set("userId", userId); sql.params().set("userId", userId);
sql.params().set("f", false); sql.params().set("f", false);
if (Strings.isNotBlank(pid)) { if (Strings.isNotBlank(pid)) {
@@ -250,8 +248,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/ */
@CacheResult(cacheKey = "${userId}_${pid}_hasChildren") @CacheResult(cacheKey = "${userId}_${pid}_hasChildren")
public boolean hasChildren(String userId, String pid) { public boolean hasChildren(String userId, String pid) {
Sql sql = Sqls.create("select count(*) from sys_menu a,sys_role_menu b where a.id=b.menuId and " + Sql sql = Sqls.create("select count(*) from sys_menu a,sys_role_menu b where a.id=b.menuId and " + "$m and b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc");
"$m and b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc");
sql.params().set("userId", userId); sql.params().set("userId", userId);
sql.params().set("f", false); sql.params().set("f", false);
if (Strings.isNotBlank(pid)) { if (Strings.isNotBlank(pid)) {
@@ -390,12 +387,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
StpUtil.login(user.getId()); StpUtil.login(user.getId());
StpUtil.checkLogin(); StpUtil.checkLogin();
StpUtil.getSession(true) StpUtil.getSession(true).set("loginname", Strings.sNull(user.getLoginname())).set("username", Strings.sNull(user.getUsername())).set("unitId", Strings.sNull(user.getUnitId())).set("unitPath", Strings.sNull(user.getUnitPath())).set("unionId", ObjectUtil.isEmpty(user.getUnion()) ? "" : user.getUnion().getId());
.set("loginname", Strings.sNull(user.getLoginname()))
.set("username", Strings.sNull(user.getUsername()))
.set("unitId", Strings.sNull(user.getUnitId()))
.set("unitPath", Strings.sNull(user.getUnitPath()))
.set("unionId", ObjectUtil.isEmpty(user.getUnion()) ? "" : user.getUnion().getId());
Sys_log sysLog = new Sys_log(); Sys_log sysLog = new Sys_log();
sysLog.setType("info"); sysLog.setType("info");
sysLog.setTag("用户登陆"); sysLog.setTag("用户登陆");
@@ -410,6 +402,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
sysLog.setLoginname(user.getLoginname()); sysLog.setLoginname(user.getLoginname());
sLogService.async(sysLog); sLogService.async(sysLog);
// 清除登录锁
redisService.del(RedisConstant.USER_LOGIN_LOCK_PREFIX + user.getLoginname());
// 微信登录 // 微信登录
if (StrUtil.isNotBlank(wxOpenId)) { if (StrUtil.isNotBlank(wxOpenId)) {
dao().update(Sys_user.class, Chain.make("wxOpenId", wxOpenId), Cnd.where("id", "=", user.getId())); dao().update(Sys_user.class, Chain.make("wxOpenId", wxOpenId), Cnd.where("id", "=", user.getId()));
@@ -41,14 +41,14 @@ public class MemberApplyCommonController {
// 分会主席只能查看本分会用户或未分配分会的用户 // 分会主席只能查看本分会用户或未分配分会的用户
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) && (user.getUnionId().equals(SecurityUtil.getUnionId()) || StrUtil.isBlank(user.getUnionId()))) { if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()) && (user.getUnionId().equals(SecurityUtil.getUnionId()) || StrUtil.isBlank(user.getUnionId()))) {
user.setIdCard(DesensitizedUtil.idCardNum(user.getIdCard(), 7, 4)); user.setIdCard(DesensitizedUtil.idCardNum(user.getIdCard(), 3, 4));
user.setMobile(DesensitizedUtil.mobilePhone(user.getMobile())); user.setMobile(DesensitizedUtil.mobilePhone(user.getMobile()));
return Result.success(user); return Result.success(user);
} }
// 分工会操作员同主席权限一致 // 分工会操作员同主席权限一致
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_OPERATOR.name()) && (user.getUnionId().equals(SecurityUtil.getUnionId()) || StrUtil.isBlank(user.getUnionId()))) { if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_OPERATOR.name()) && (user.getUnionId().equals(SecurityUtil.getUnionId()) || StrUtil.isBlank(user.getUnionId()))) {
user.setIdCard(DesensitizedUtil.idCardNum(user.getIdCard(), 7, 4)); user.setIdCard(DesensitizedUtil.idCardNum(user.getIdCard(), 3, 4));
user.setMobile(DesensitizedUtil.mobilePhone(user.getMobile())); user.setMobile(DesensitizedUtil.mobilePhone(user.getMobile()));
return Result.success(user); return Result.success(user);
} }
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.staffmanage.member.controller.info; package com.budwk.app.zhgh.staffmanage.member.controller.info;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.DesensitizedUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination; import com.budwk.app.base.page.Pagination;
@@ -29,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* @version 1.0 * @version 1.0
@@ -58,7 +60,10 @@ public class MemberInfoGroupController {
@Ok("json:{dateFormat:'yyyy-MM-dd'}") @Ok("json:{dateFormat:'yyyy-MM-dd'}")
public Result pageData(@Valid @Param("pageForm") MemberInfoPageForm pageForm) { public Result pageData(@Valid @Param("pageForm") MemberInfoPageForm pageForm) {
Sql sql = memberInfoService.getSql(pageForm); Sql sql = memberInfoService.getSql(pageForm);
Pagination pagination = memberInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination<NutMap> pagination = memberInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
for (NutMap row : pagination.getList()) {
row.put("mobile",DesensitizedUtil.mobilePhone(row.getString("mobile")));
}
return Result.success(pagination); return Result.success(pagination);
} }
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.staffmanage.member.controller.statistics; package com.budwk.app.zhgh.staffmanage.member.controller.statistics;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.DesensitizedUtil;
import com.budwk.app.base.page.Pagination; import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result; import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil; import com.budwk.app.base.utils.CommonDownloadUtil;
@@ -46,7 +47,10 @@ public class MemberComprehensiveController {
@SaCheckPermission("member.statistics.comprehensive") @SaCheckPermission("member.statistics.comprehensive")
public Result pageData(MemberStatisticsPageForm pageForm) { public Result pageData(MemberStatisticsPageForm pageForm) {
Sql sql = memberStatisticsService.getComprehensiveSql(pageForm); Sql sql = memberStatisticsService.getComprehensiveSql(pageForm);
Pagination pagination = memberStatisticsService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination<NutMap> pagination = memberStatisticsService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
for (NutMap row : pagination.getList()) {
row.put("mobile", DesensitizedUtil.mobilePhone(row.getString("mobile")));
}
return Result.success(pagination); return Result.success(pagination);
} }
@@ -57,6 +61,9 @@ public class MemberComprehensiveController {
public void doExport(MemberStatisticsPageForm pageForm, HttpServletResponse response){ public void doExport(MemberStatisticsPageForm pageForm, HttpServletResponse response){
Sql sql = memberStatisticsService.getComprehensiveSql(pageForm); Sql sql = memberStatisticsService.getComprehensiveSql(pageForm);
List<NutMap> list = memberStatisticsService.listMap(sql); List<NutMap> list = memberStatisticsService.listMap(sql);
for (NutMap row : list) {
row.put("mobile", DesensitizedUtil.mobilePhone(row.getString("mobile")));
}
try { try {
Workbook workbook = memberInfoService.setHistoryExcelData(list); Workbook workbook = memberInfoService.setHistoryExcelData(list);
CommonDownloadUtil.download("会员综合统计表.xlsx", workbook, response); CommonDownloadUtil.download("会员综合统计表.xlsx", workbook, response);
@@ -70,7 +70,6 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
sex, sex,
birthday, birthday,
mobile, mobile,
idCard,
personType, personType,
userState, userState,
preparedBy, preparedBy,
@@ -236,7 +235,7 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
exportEntities.add(new ExcelExportEntity("姓名", "username", 20)); exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 20)); exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20)); exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30)); // exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30));
exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20)); exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
exportEntities.add(new ExcelExportEntity("聘用方式", "preparedBy", 20)); exportEntities.add(new ExcelExportEntity("聘用方式", "preparedBy", 20));
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20)); exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
@@ -127,7 +127,6 @@ public class MemberStatisticsServiceImpl extends BaseServiceImpl<Sys_user> imple
u.nativePlace, u.nativePlace,
u.nationality, u.nationality,
u.idCardType, u.idCardType,
u.idCard,
u.mobile, u.mobile,
u.education, u.education,
u.academicDegree, u.academicDegree,
@@ -89,7 +89,7 @@ public class WelfareProjectMangeController {
* @return * @return
*/ */
@At @At
@SaCheckPermission("welfare.project.mange") @SaCheckPermission("welfare")
public Result findOne(String id) { public Result findOne(String id) {
return Result.success(projectService.projectInfo(id)); return Result.success(projectService.projectInfo(id));
} }
@@ -2,10 +2,13 @@ package com.budwk.app.zhgh.welfare.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination; import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm; import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result; import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.PageUtil; import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm; import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
import com.budwk.app.zhgh.welfare.service.WelfareListService; import com.budwk.app.zhgh.welfare.service.WelfareListService;
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService; import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
@@ -14,10 +17,12 @@ import com.budwk.app.zhgh.welfare.service.WelfareStatisticsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
@@ -27,6 +32,8 @@ import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List;
@IocBean @IocBean
@Ok("json:full") @Ok("json:full")
@@ -62,6 +69,33 @@ public class WelfareSelectionSituationController {
return Result.success(pagination); return Result.success(pagination);
} }
@At
@SaCheckPermission("welfare.selection.situation")
@ApiOperation("获取某个用户选择信息")
public Result getUserSelection(String projectId, String userId) {
List<WelfareUserSelection> list = dao.query(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", userId));
return Result.success(list);
}
@At
@Aop(TransAop.READ_COMMITTED)
@SLog(type = "welfare", tag = "选择福利", msg = "代选福利")
@SaCheckPermission("welfare.selection.situation")
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId, String userId) {
//删除上次选择的
dao.clear(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", userId));
for (WelfareUserSelection welfareUserSelection : selections) {
welfareUserSelection.setWelfareId(projectId);
welfareUserSelection.setSelectUserId(userId);
welfareUserSelection.setSelectTime(new Date());
}
dao.insert(selections);
return Result.success("选择成功");
}
@At @At
@SaCheckPermission("welfare.selection.situation") @SaCheckPermission("welfare.selection.situation")
@Ok("void") @Ok("void")
@@ -210,11 +210,11 @@ public class WelfareProject extends BaseModel implements SysHomeConvert {
sysHomeActivity.setId(this.getId()); sysHomeActivity.setId(this.getId());
sysHomeActivity.setName(this.getName()); sysHomeActivity.setName(this.getName());
sysHomeActivity.setCover(this.getCover()); sysHomeActivity.setCover(this.getCover());
sysHomeActivity.setUrl("/platform/welfare/userChoose"); sysHomeActivity.setUrl("/platform/welfare/userSelect");
sysHomeActivity.setH5Url("/platform/h5/welfare/userChoose/list"); sysHomeActivity.setH5Url("/platform/h5/welfare/userSelect/index?id=" + this.getId());
sysHomeActivity.setStartDate(this.getChoiceTimeStart()); sysHomeActivity.setStartDate(this.getChoiceTimeStart());
sysHomeActivity.setEndDate(this.getChoiceTimeEnd()); sysHomeActivity.setEndDate(this.getChoiceTimeEnd());
sysHomeActivity.setAllowUserSql("select userId from welfare_list where projectId = '"+this.getId()+"' and userId = @userId"); sysHomeActivity.setAllowUserSql("select userId from welfare_list where projectId = '" + this.getId() + "' and userId = @userId");
sysHomeActivity.setEnable(true); sysHomeActivity.setEnable(true);
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName()); sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
return sysHomeActivity; return sysHomeActivity;
@@ -5,11 +5,14 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil; 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.page.Pagination;
import com.budwk.app.base.result.Result; import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.base.utils.CommonDownloadUtil; import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.base.utils.PageUtil; import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.welfare.model.WelfareList; import com.budwk.app.zhgh.welfare.model.WelfareList;
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm; import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService; import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
@@ -38,6 +41,8 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
t1.id, t1.id,
t1.projectId,
t1.userId,
t1.welfareUnionName, t1.welfareUnionName,
t1.welfareUnitName, t1.welfareUnitName,
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions, GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
@@ -54,6 +59,11 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
}
cnd.and("t1.projectId", "=", pageForm.getProjectId()); cnd.and("t1.projectId", "=", pageForm.getProjectId());
cnd.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId()); cnd.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId());
@@ -106,6 +116,11 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
cnd.and("t1.welfareUnionId", "=", SecurityUtil.getUnionId());
}
cnd.and("t1.projectId", "=", pageForm.getProjectId()); cnd.and("t1.projectId", "=", pageForm.getProjectId());
cnd.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId()); cnd.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId());
@@ -26,7 +26,7 @@ module.exports = {
props: { props: {
value: { type: String }, value: { type: String },
code: { code: {
type: String, type: [String, Array],
default: "" default: ""
}, },
option_value: { option_value: {
@@ -11,12 +11,12 @@ const MEMBER_MANAGE_TABLE = {
<el-radio-button :label="0">非会员</el-radio-button> <el-radio-button :label="0">非会员</el-radio-button>
</el-radio-group> </el-radio-group>
<span class="text-danger">福利会员:</span> <!-- <span class="text-danger">福利会员:</span>-->
<el-radio-group @change="doSearch" class="mr5" size="small" v-model="pageForm.isWelfareMember"> <!-- <el-radio-group @change="doSearch" class="mr5" size="small" v-model="pageForm.isWelfareMember">-->
<el-radio-button :label="null">全部</el-radio-button> <!-- <el-radio-button :label="null">全部</el-radio-button>-->
<el-radio-button :label="1">福利会员</el-radio-button> <!-- <el-radio-button :label="1">福利会员</el-radio-button>-->
<el-radio-button :label="0">非福利会员</el-radio-button> <!-- <el-radio-button :label="0">非福利会员</el-radio-button>-->
</el-radio-group> <!-- </el-radio-group>-->
<span class="text-danger">人员异动:</span> <span class="text-danger">人员异动:</span>
<el-radio-group @change="doSearch" class="mr5" size="small" <el-radio-group @change="doSearch" class="mr5" size="small"
@@ -34,7 +34,8 @@ const MEMBER_MANAGE_TABLE = {
<!--<el-button @click="addMember" type="primary" size="small">新增会员</el-button>--> <!--<el-button @click="addMember" type="primary" size="small">新增会员</el-button>-->
</table-tool> </table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%"> <el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id"
style="width: 100%">
<el-table-column :index="indexMethod" align="center" header-align="center" <el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index" width="80px"></el-table-column> label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="column.label" :prop="column.prop" <el-table-column :label="column.label" :prop="column.prop"
@@ -60,7 +61,8 @@ const MEMBER_MANAGE_TABLE = {
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column v-if="$auth.hasRole('BRANCH_UNION_CHAIRMAN')" header-align="center" label="审核状态" <el-table-column v-if="$auth.hasRole('BRANCH_UNION_CHAIRMAN')" header-align="center"
label="审核状态"
prop="auditState"> prop="auditState">
</el-table-column> </el-table-column>
@@ -76,17 +78,17 @@ const MEMBER_MANAGE_TABLE = {
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" header-align="center" label="福利会员" prop="member" <!-- <el-table-column align="center" header-align="center" label="福利会员" prop="member"-->
show-overflow-tooltip sortable> <!-- show-overflow-tooltip sortable>-->
<template scope="{row}"> <!-- <template scope="{row}">-->
<span class="text-success" v-if="row.welfareMember==1"> <!-- <span class="text-success" v-if="row.welfareMember==1">-->
<i class="fa fa-circle ml5"></i> 是 <!-- <i class="fa fa-circle ml5"></i> 是-->
</span> <!-- </span>-->
<span class="text-danger" v-else> <!-- <span class="text-danger" v-else>-->
<i class="fa fa-circle ml5"></i> 否 <!-- <i class="fa fa-circle ml5"></i> 否-->
</span> <!-- </span>-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<!--<el-table-column align="center" header-align="center" label="劳模" prop="member" <!--<el-table-column align="center" header-align="center" label="劳模" prop="member"
show-overflow-tooltip sortable> show-overflow-tooltip sortable>
<template scope="{row}"> <template scope="{row}">
@@ -112,8 +114,8 @@ const MEMBER_MANAGE_TABLE = {
查看 查看
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
:command="{type:'change',data:row}" :command="{type:'change',data:row}"
v-if="$auth.hasRoleOr(['SYSADMIN','SCHOOL_UNION_ADMIN','BRANCH_UNION_CHAIRMAN','BRANCH_UNION_CHAIRMAN'])"> v-if="$auth.hasRoleOr(['SYSADMIN','SCHOOL_UNION_ADMIN','BRANCH_UNION_CHAIRMAN','BRANCH_UNION_CHAIRMAN'])">
变更 变更
</el-dropdown-item> </el-dropdown-item>
<!--<el-dropdown-item <!--<el-dropdown-item
@@ -158,7 +160,11 @@ const MEMBER_MANAGE_TABLE = {
{ prop: "unitName", label: "所属单位", sortable: true } { prop: "unitName", label: "所属单位", sortable: true }
], ],
changeInfoVisible: false, changeInfoVisible: false,
userId: '' userId: "",
pageForm: {
isMember: 1,
changed: 2
}
} }
}, },
methods: { methods: {
@@ -206,11 +212,11 @@ const MEMBER_MANAGE_TABLE = {
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
} }
}) })
}) })
}, },
openChange(data) { openChange(data) {
this.$emit("change-member", {id: data.id, username: data.username}) this.$emit("change-member", { id: data.id, username: data.username })
}, },
openView(id) { openView(id) {
this.$emit("view-member", id) this.$emit("view-member", id)
@@ -221,7 +227,7 @@ const MEMBER_MANAGE_TABLE = {
openUserChangeInfo(row) { openUserChangeInfo(row) {
this.changeInfoVisible = true this.changeInfoVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.memberChangeInfoRef.onOpen(row.id,null) this.$refs.memberChangeInfoRef.onOpen(row.id, null)
}) })
}, },
getChangeTypes(changeTypes) { getChangeTypes(changeTypes) {
@@ -208,7 +208,6 @@ layout("/layouts/platform.html"){
{ prop: "sex", label: "性别" }, { prop: "sex", label: "性别" },
{ prop: "birthday", label: "出生年月", sortable: true }, { prop: "birthday", label: "出生年月", sortable: true },
{ prop: "mobile", label: "联系电话" }, { prop: "mobile", label: "联系电话" },
{ prop: "idCard", label: "身份证号", width: 170 },
{ prop: "userState", label: "在职状态", sortable: true }, { prop: "userState", label: "在职状态", sortable: true },
{ prop: "preparedBy", label: "聘用方式", sortable: true }, { prop: "preparedBy", label: "聘用方式", sortable: true },
{ prop: "personType", label: "人员类型", sortable: true }, { prop: "personType", label: "人员类型", sortable: true },
@@ -120,8 +120,6 @@ layout("/layouts/platform.html"){
{ prop: "sex", label: "性别" }, { prop: "sex", label: "性别" },
{ prop: "birthday", label: "出生年月", width: 120, sortable: true }, { prop: "birthday", label: "出生年月", width: 120, sortable: true },
{ prop: "mobile", label: "联系电话" }, { prop: "mobile", label: "联系电话" },
{ prop: "idCardType", label: "证件类型" },
{ prop: "idCard", label: "证件号码", width: 180 },
{ prop: "userState", label: "在职状态", width: 120, sortable: true }, { prop: "userState", label: "在职状态", width: 120, sortable: true },
{ prop: "personType", label: "教职工类别", width: 120, sortable: true }, { prop: "personType", label: "教职工类别", width: 120, sortable: true },
{ prop: "preparedBy", label: "聘用方式", width: 120, sortable: true }, { prop: "preparedBy", label: "聘用方式", width: 120, sortable: true },
@@ -37,11 +37,15 @@ const optionSelect = {
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-label">选择时间</div> <div class="info-label">选择时间</div>
<div class="info-value">{{ formatTimeRange(projectInfo.choiceTimeStart, projectInfo.choiceTimeEnd) }}</div> <div class="info-value">{{ formatTimeRange(projectInfo.choiceTimeStart,
projectInfo.choiceTimeEnd) }}
</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-label">发放时间</div> <div class="info-label">发放时间</div>
<div class="info-value">{{ formatTimeRange(projectInfo.provideTimeStart, projectInfo.provideTimeEnd) }}</div> <div class="info-value">{{ formatTimeRange(projectInfo.provideTimeStart,
projectInfo.provideTimeEnd) }}
</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-label">发放地点</div> <div class="info-label">发放地点</div>
@@ -65,8 +69,10 @@ const optionSelect = {
:class="{ selected: projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0 }" :class="{ selected: projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0 }"
@click="projectInfo.isCheckBox === 'radio' ? selectRadioOption(option.id) : null"> @click="projectInfo.isCheckBox === 'radio' ? selectRadioOption(option.id) : null">
<el-tag v-if="projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0" <el-tag
class="option-tag" type="primary" effect="plain">已选择</el-tag> v-if="projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0"
class="option-tag" type="primary" effect="plain">已选择
</el-tag>
<div class="option-image"> <div class="option-image">
<el-image :src="option.imgUrl" fit="cover"></el-image> <el-image :src="option.imgUrl" fit="cover"></el-image>
@@ -104,7 +110,8 @@ const optionSelect = {
<!-- 底部提交按钮 --> <!-- 底部提交按钮 -->
<div class="welfare-footer"> <div class="welfare-footer">
<el-button type="primary" size="medium" :disabled="!hasSelection" @click="submitSelection">确认选择</el-button> <el-button type="primary" size="medium" :disabled="!hasSelection" @click="submitSelection">确认选择
</el-button>
</div> </div>
<!-- 选项详情弹窗 --> <!-- 选项详情弹窗 -->
@@ -200,16 +207,16 @@ const optionSelect = {
</el-dialog> </el-dialog>
</div> </div>
`, `,
store,
data() { data() {
return { return {
projectId: null, projectId: null, // 项目ID
projectInfo: {}, userId: null, // 用户id 代选的时候用得到
userSelection: [], projectInfo: {}, // 项目信息
welfareProvideMode: [], userSelection: [], // 用户选择的选项
welfareSignMode: [],
selectedRadioId: "", // 单选模式下选中的选项ID selectedRadioId: "", // 单选模式下选中的选项ID
showConfirmDialog: false, showConfirmDialog: false, // 确认弹窗
isSubmitting: false, isSubmitting: false, // 是否正在提交
hasSubmittedBefore: false, // 是否之前提交过 hasSubmittedBefore: false, // 是否之前提交过
deadlineTime: null, // 选择截止时间 deadlineTime: null, // 选择截止时间
showOptionDetailDialog: false, // 选项详情弹窗 showOptionDetailDialog: false, // 选项详情弹窗
@@ -219,13 +226,18 @@ const optionSelect = {
}, },
contactRules: { contactRules: {
mobile: [ mobile: [
{ required: true, message: '请输入联系电话', trigger: 'blur' }, { required: true, message: "请输入联系电话", trigger: "blur" },
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' } {
pattern: /^1[3456789]\d{9}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
] ]
} }
} }
}, },
computed: { computed: {
// 是否有选择
hasSelection() { hasSelection() {
if (this.projectInfo.isCheckBox === "radio") { if (this.projectInfo.isCheckBox === "radio") {
return !!this.selectedRadioId return !!this.selectedRadioId
@@ -235,6 +247,7 @@ const optionSelect = {
} }
}, },
// 已选择的选项
selectedOptions() { selectedOptions() {
if (this.projectInfo.isCheckBox === "radio") { if (this.projectInfo.isCheckBox === "radio") {
if (!this.selectedRadioId || !this.projectInfo.options) return [] if (!this.selectedRadioId || !this.projectInfo.options) return []
@@ -245,11 +258,13 @@ const optionSelect = {
} }
}, },
// 已选择的数量
totalSelectedCount() { totalSelectedCount() {
if (!this.projectInfo.options) return 0 if (!this.projectInfo.options) return 0
return this.projectInfo.options.reduce((sum, option) => sum + (option.selectNum || 0), 0) return this.projectInfo.options.reduce((sum, option) => sum + (option.selectNum || 0), 0)
}, },
// 截止时间快了
isDeadlineSoon() { isDeadlineSoon() {
if (!this.projectInfo.choiceTimeEnd) return false if (!this.projectInfo.choiceTimeEnd) return false
@@ -260,6 +275,7 @@ const optionSelect = {
return diffHours > 0 && diffHours < 24 return diffHours > 0 && diffHours < 24
}, },
// 截止时间提示
deadlineText() { deadlineText() {
if (!this.deadlineTime) return "" if (!this.deadlineTime) return ""
const now = new Date() const now = new Date()
@@ -279,21 +295,36 @@ const optionSelect = {
} }
}, },
// 确认弹窗提示
confirmMessage() { confirmMessage() {
if (this.hasSubmittedBefore) { if (this.hasSubmittedBefore) {
return "修改后的选择将覆盖之前的选择" return "修改后的选择将覆盖之前的选择"
} }
return "请仔细确认您的选择" return "请仔细确认您的选择"
},
// 是否代选
isProxySelect() {
return !!this.userId
} }
}, },
methods: { methods: {
onOpen(projectId) { // 打开选择项目弹窗 userId为null默认则是本人
onOpen(projectId, userId = null) {
this.projectId = projectId this.projectId = projectId
this.userId = userId
this.selectedRadioId = null
this.contactForm = {
mobile: ""
}
this.getProjectInfo() this.getProjectInfo()
}, },
// 获取项目信息
getProjectInfo() { getProjectInfo() {
this.$axios.post("/platform/welfare/project/mange/findOne", { id: this.projectId }).then((res) => { this.$axios.post("/platform/welfare/common/projectInfo", { id: this.projectId }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.projectInfo = res.data this.projectInfo = res.data
this.deadlineTime = this.projectInfo.choiceTimeEnd this.deadlineTime = this.projectInfo.choiceTimeEnd
@@ -314,17 +345,24 @@ const optionSelect = {
// 获取用户选择的数据 // 获取用户选择的数据
getUserSelection() { getUserSelection() {
this.$axios.post("/platform/welfare/userSelect/getUserSelection", { projectId: this.projectId }).then((resp) => { let url = "/platform/welfare/userSelect/getUserSelection"
const formData = {
projectId: this.projectId
}
if (this.isProxySelect) {
url = "/platform/welfare/selection/situation/getUserSelection"
formData.userId = this.userId
}
this.$axios.post(url, formData).then((resp) => {
if (resp.code === 0) { if (resp.code === 0) {
this.userSelection = resp.data this.userSelection = resp.data
this.hasSubmittedBefore = this.userSelection.length > 0 this.hasSubmittedBefore = this.userSelection.length > 0
// 如果有用户选择数据,从中获取手机号 if (this.userSelection && this.userSelection.length > 0) {
if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) { this.contactForm.mobile = this.userSelection[0]?.mobile
this.contactForm.mobile = this.userSelection[0].mobile
} else if (this.$store.user && this.$store.user.mobile) {
// 如果没有选择过,使用store中的默认手机号
this.contactForm.mobile = this.$store.user.mobile
} }
// 设置已选择的选项 // 设置已选择的选项
@@ -356,7 +394,7 @@ const optionSelect = {
// 执行提交 // 执行提交
doSubmit() { doSubmit() {
// 验证手机号 // 验证手机号
this.$refs.contactForm.validate(valid => { this.$refs.contactForm.validate((valid) => {
if (!valid) { if (!valid) {
return return
} }
@@ -387,15 +425,23 @@ const optionSelect = {
})) }))
} }
let url = "/platform/welfare/userSelect/confirmSelect"
const formData = {
projectId: this.projectId,
selections: JSON.stringify(selections)
}
if (this.isProxySelect) {
url = "/platform/welfare/selection/situation/confirmSelect"
formData.userId = this.userId
}
this.$axios this.$axios
.post("/platform/welfare/userSelect/confirmSelect", { .post(url, formData)
projectId: this.projectId,
selections: JSON.stringify(selections)
})
.then((res) => { .then((res) => {
this.isSubmitting = false this.isSubmitting = false
if (res.code === 0) { if (res.code === 0) {
this.showConfirmDialog = false
this.$message.success("选择成功") this.$message.success("选择成功")
this.$emit("refresh") this.$emit("refresh")
} else { } else {
@@ -516,9 +562,15 @@ const optionSelect = {
} }
@keyframes pulse { @keyframes pulse {
0% { transform: scale(1); } 0% {
50% { transform: scale(1.01); } transform: scale(1);
100% { transform: scale(1); } }
50% {
transform: scale(1.01);
}
100% {
transform: scale(1);
}
} }
.welfare-deadline i { .welfare-deadline i {
@@ -568,7 +620,7 @@ const optionSelect = {
left: 0; left: 0;
right: 0; right: 0;
height: 40px; height: 40px;
background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0)); background: linear-gradient(to top, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
} }
.project-cover .el-image { .project-cover .el-image {
@@ -711,7 +763,7 @@ const optionSelect = {
left: 0; left: 0;
right: 0; right: 0;
height: 40px; height: 40px;
background: linear-gradient(to top, rgba(0,0,0,0.2), transparent); background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
} }
.option-image .el-image { .option-image .el-image {
@@ -1046,8 +1098,14 @@ const optionSelect = {
/* 动画 */ /* 动画 */
@keyframes fadeIn { @keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); } from {
to { opacity: 1; transform: translateY(0); } opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
} }
.welfare-select-container > * { .welfare-select-container > * {
@@ -101,19 +101,28 @@ layout("/layouts/platform.html"){
></el-table-column> ></el-table-column>
<el-table-column align="center" fixed="right" header-align="center" label="操作" width="100px"> <el-table-column align="center" fixed="right" header-align="center" label="操作" width="100px">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button @click="handleSelect(row)" size="mini" type="primary">代选</el-button> <el-button size="mini" type="primary" @click="proxySelect(row)">代选</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!--#include("/layouts/pagination.html"){}#--> <!--#include("/layouts/pagination.html"){}#-->
</el-card> </el-card>
<el-dialog title="代选" :visible.sync="optionSelectVisible" width="60%">
<option-select ref="optionSelectRef" @refresh="optionSelectVisible=false;doSearch();"></option-select>
</el-dialog>
</guava> </guava>
</div> </div>
<script> <script>
<!--#include("../select/optionSelect.js"){}#-->
new Vue({ new Vue({
el: "#app", el: "#app",
mixins: [initTableMixins], mixins: [initTableMixins],
components: {
"option-select": optionSelect
},
data() { data() {
return { return {
pageForm: { pageForm: {
@@ -133,7 +142,8 @@ layout("/layouts/platform.html"){
{ prop: "welfareUnitName", label: "所属单位", sortable: true }, { prop: "welfareUnitName", label: "所属单位", sortable: true },
{ prop: "selectedOptions", label: "所选福利", sortable: true }, { prop: "selectedOptions", label: "所选福利", sortable: true },
{ prop: "mobile", label: "联系电话", sortable: true } { prop: "mobile", label: "联系电话", sortable: true }
] ],
optionSelectVisible: false
} }
}, },
computed: { computed: {
@@ -145,6 +155,7 @@ layout("/layouts/platform.html"){
} }
}, },
methods: { methods: {
// 获取福利列表
getWelfareList() { getWelfareList() {
this.$axios.post("/platform/welfare/common/list", { year: this.pageForm.year }).then((res) => { this.$axios.post("/platform/welfare/common/list", { year: this.pageForm.year }).then((res) => {
this.projectOptions = res.data this.projectOptions = res.data
@@ -157,6 +168,7 @@ layout("/layouts/platform.html"){
}) })
}, },
// 获取数据
pageData() { pageData() {
this.tableLoading = true this.tableLoading = true
this.$axios this.$axios
@@ -172,12 +184,18 @@ layout("/layouts/platform.html"){
}) })
}, },
// 导出选择情况表
exportXlsx() { exportXlsx() {
this.$downLoad("/platform/welfare/selection/situation/exportXlsx", { pageForm: JSON.stringify(this.pageForm) }) this.$downLoad("/platform/welfare/selection/situation/exportXlsx", { pageForm: JSON.stringify(this.pageForm) })
}, },
// 管理员待选 // 管理员待选
handleSelect() {} proxySelect(row) {
this.optionSelectVisible = true
this.$nextTick(() => {
this.$refs.optionSelectRef.onOpen(row.projectId, row.userId)
})
}
}, },
async created() { async created() {
this.getWelfareList() this.getWelfareList()
@@ -811,7 +811,7 @@ layout("/layouts/platform_h5.html"){
methods: { methods: {
getProjectInfo() { getProjectInfo() {
this.$axios.post("/platform/welfare/project/mange/findOne", { id: this.projectId }).then((res) => { this.$axios.post("/platform/welfare/common/projectInfo", { id: this.projectId }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.projectInfo = res.data this.projectInfo = res.data
@@ -844,7 +844,6 @@ layout("/layouts/platform_h5.html"){
if (this.userSelection[0].userSign) { if (this.userSelection[0].userSign) {
this.formData.userSign = this.userSelection[0].userSign this.formData.userSign = this.userSelection[0].userSign
} }
} else if (this.$store.user && this.$store.user.mobile) { } else if (this.$store.user && this.$store.user.mobile) {
// 如果没有选择过,使用store中的默认手机号 // 如果没有选择过,使用store中的默认手机号
debugger debugger
@@ -1078,7 +1077,7 @@ layout("/layouts/platform_h5.html"){
resetSignature() { resetSignature() {
this.formData.userSign = "" this.formData.userSign = ""
// 如果组件有reset方法,调用它 // 如果组件有reset方法,调用它
if (this.$refs.signatureRef && typeof this.$refs.signatureRef.reset === 'function') { if (this.$refs.signatureRef && typeof this.$refs.signatureRef.reset === "function") {
this.$refs.signatureRef.reset() this.$refs.signatureRef.reset()
} }
}, },
@@ -1153,7 +1152,7 @@ layout("/layouts/platform_h5.html"){
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.signatureRef) { if (this.$refs.signatureRef) {
// 如果组件有setSignature或类似方法可以调用 // 如果组件有setSignature或类似方法可以调用
if (this.formData.userSign && typeof this.$refs.signatureRef.setSignature === 'function') { if (this.formData.userSign && typeof this.$refs.signatureRef.setSignature === "function") {
this.$refs.signatureRef.setSignature(this.formData.userSign) this.$refs.signatureRef.setSignature(this.formData.userSign)
} }
} }