This commit is contained in:
那些花儿
2025-06-20 14:48:06 +08:00
parent 3015f968e3
commit ca04b43385
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:";
/**
* Token 缓存前缀
*/
@@ -55,4 +54,9 @@ public class RedisConstant {
* 签名前缀
*/
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;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
@@ -83,24 +84,43 @@ public class SysLoginController {
@At("/doLogin")
@Ok("json")
@ApiOperation("用户本地账号密码登录")
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) {
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) {
if (StrUtil.isBlank(username)) {
return Result.error("用户名不能为空");
}
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 {
Sys_user user = null;
// sysUserService.checkLoginname(username);
validateService.checkCode(captchaKey, captchaCode);
user = sysUserService.loginByPassword(username, password);
// 验证码校验
try {
validateService.checkCode(captchaKey, captchaCode);
} catch (BaseException e) {
return Result.error(e.getMessage());
}
// 用户名密码校验
Sys_user user = sysUserService.loginByPassword(username, password);
if (user == null) {
throw new BaseException("用户登录失败");
}
//前端去跳转地址
// 成功登录
sysUserService.loginPlus(user, LoginType.PC_LOCAL, req);
return Result.success("login.success");
} catch (Exception e) {
log.error(e.getMessage(), e);
redisService.set(lockKey, Convert.toStr(errCount + 1));
String message = e.getMessage();
return Result.error(e.getMessage());
}
}
@@ -116,6 +136,7 @@ public class SysLoginController {
String loginName = assertion.getPrincipal().getName();
sysUserService.checkThirdPlatformLoginName(loginName);
Sys_user sysUser = sysUserService.loginByLoginName(loginName);
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.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -57,6 +58,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
private SysRoleService sysRoleService;
@Inject
private SLogService sLogService;
@Inject
private RedisService redisService;
@Override
@CacheResult(cacheKey = "${userId}_getPermissionList")
@@ -91,8 +94,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
dao().fetchLinks(user, "roles");
List<String> roleNameList = new ArrayList<String>();
for (Sys_role role : user.getRoles()) {
if (!role.isDisabled())
roleNameList.add(role.getCode());
if (!role.isDisabled()) roleNameList.add(role.getCode());
}
return roleNameList;
}
@@ -156,8 +158,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/
// @CacheResult(cacheKey = "${userId}_getMenus")
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 " +
" 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 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");
sql.params().set("userId", userId);
sql.params().set("f", false);
sql.params().set("t", true);
@@ -172,8 +173,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/
// @CacheResult(cacheKey = "${userId}_getMenusAndButtons")
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 " +
" 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 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");
sql.params().set("userId", userId);
sql.params().set("f", false);
return sysMenuService.listEntity(sql);
@@ -192,8 +192,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/
@CacheResult(cacheKey = "${userId}_getDatas")
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 " +
" 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 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");
sql.params().set("userId", userId);
sql.params().set("f", false);
return sysMenuService.listEntity(sql);
@@ -230,8 +229,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/
@CacheResult(cacheKey = "${userId}_${pid}_getRoleMenus")
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 " +
"$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 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");
sql.params().set("userId", userId);
sql.params().set("f", false);
if (Strings.isNotBlank(pid)) {
@@ -250,8 +248,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
*/
@CacheResult(cacheKey = "${userId}_${pid}_hasChildren")
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 " +
"$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 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");
sql.params().set("userId", userId);
sql.params().set("f", false);
if (Strings.isNotBlank(pid)) {
@@ -390,12 +387,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
StpUtil.login(user.getId());
StpUtil.checkLogin();
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());
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());
Sys_log sysLog = new Sys_log();
sysLog.setType("info");
sysLog.setTag("用户登陆");
@@ -410,6 +402,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
sysLog.setLoginname(user.getLoginname());
sLogService.async(sysLog);
// 清除登录锁
redisService.del(RedisConstant.USER_LOGIN_LOCK_PREFIX + user.getLoginname());
// 微信登录
if (StrUtil.isNotBlank(wxOpenId)) {
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()))) {
user.setIdCard(DesensitizedUtil.idCardNum(user.getIdCard(), 7, 4));
user.setIdCard(DesensitizedUtil.idCardNum(user.getIdCard(), 3, 4));
user.setMobile(DesensitizedUtil.mobilePhone(user.getMobile()));
return Result.success(user);
}
// 分工会操作员同主席权限一致
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()));
return Result.success(user);
}
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.staffmanage.member.controller.info;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.DesensitizedUtil;
import com.alibaba.excel.EasyExcel;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
@@ -29,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* @version 1.0
@@ -58,7 +60,10 @@ public class MemberInfoGroupController {
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
public Result pageData(@Valid @Param("pageForm") MemberInfoPageForm 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);
}
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.staffmanage.member.controller.statistics;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.DesensitizedUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
@@ -46,7 +47,10 @@ public class MemberComprehensiveController {
@SaCheckPermission("member.statistics.comprehensive")
public Result pageData(MemberStatisticsPageForm 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);
}
@@ -57,6 +61,9 @@ public class MemberComprehensiveController {
public void doExport(MemberStatisticsPageForm pageForm, HttpServletResponse response){
Sql sql = memberStatisticsService.getComprehensiveSql(pageForm);
List<NutMap> list = memberStatisticsService.listMap(sql);
for (NutMap row : list) {
row.put("mobile", DesensitizedUtil.mobilePhone(row.getString("mobile")));
}
try {
Workbook workbook = memberInfoService.setHistoryExcelData(list);
CommonDownloadUtil.download("会员综合统计表.xlsx", workbook, response);
@@ -70,7 +70,6 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
sex,
birthday,
mobile,
idCard,
personType,
userState,
preparedBy,
@@ -236,7 +235,7 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 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("聘用方式", "preparedBy", 20));
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
@@ -127,7 +127,6 @@ public class MemberStatisticsServiceImpl extends BaseServiceImpl<Sys_user> imple
u.nativePlace,
u.nationality,
u.idCardType,
u.idCard,
u.mobile,
u.education,
u.academicDegree,
@@ -89,7 +89,7 @@ public class WelfareProjectMangeController {
* @return
*/
@At
@SaCheckPermission("welfare.project.mange")
@SaCheckPermission("welfare")
public Result findOne(String 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.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.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.service.WelfareListService;
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.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
@@ -27,6 +32,8 @@ import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@IocBean
@Ok("json:full")
@@ -62,6 +69,33 @@ public class WelfareSelectionSituationController {
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
@SaCheckPermission("welfare.selection.situation")
@Ok("void")
@@ -210,11 +210,11 @@ public class WelfareProject extends BaseModel implements SysHomeConvert {
sysHomeActivity.setId(this.getId());
sysHomeActivity.setName(this.getName());
sysHomeActivity.setCover(this.getCover());
sysHomeActivity.setUrl("/platform/welfare/userChoose");
sysHomeActivity.setH5Url("/platform/h5/welfare/userChoose/list");
sysHomeActivity.setUrl("/platform/welfare/userSelect");
sysHomeActivity.setH5Url("/platform/h5/welfare/userSelect/index?id=" + this.getId());
sysHomeActivity.setStartDate(this.getChoiceTimeStart());
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.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
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.params.ExcelExportEntity;
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.result.Result;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.base.utils.CommonDownloadUtil;
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.param.WelfareSelectionSituationPageForm;
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
@@ -38,6 +41,8 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
Sql sql = Sqls.create("""
SELECT
t1.id,
t1.projectId,
t1.userId,
t1.welfareUnionName,
t1.welfareUnitName,
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
@@ -54,6 +59,11 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
$condition
""");
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.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId());
@@ -106,6 +116,11 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
$condition
""");
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.andEX("t2.selectOptionId", "=", pageForm.getWelfareOptionId());
@@ -26,7 +26,7 @@ module.exports = {
props: {
value: { type: String },
code: {
type: String,
type: [String, Array],
default: ""
},
option_value: {
@@ -10,14 +10,14 @@ const MEMBER_MANAGE_TABLE = {
<el-radio-button :label="1">会员</el-radio-button>
<el-radio-button :label="0">非会员</el-radio-button>
</el-radio-group>
<span class="text-danger">福利会员</span>
<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="1">福利会员</el-radio-button>
<el-radio-button :label="0">非福利会员</el-radio-button>
</el-radio-group>
<!-- <span class="text-danger">福利会员</span>-->
<!-- <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="1">福利会员</el-radio-button>-->
<!-- <el-radio-button :label="0">非福利会员</el-radio-button>-->
<!-- </el-radio-group>-->
<span class="text-danger">人员异动</span>
<el-radio-group @change="doSearch" class="mr5" size="small"
v-model="pageForm.changed">
@@ -25,16 +25,17 @@ const MEMBER_MANAGE_TABLE = {
<el-radio-button :label="1">异动</el-radio-button>
<el-radio-button :label="0">未异动</el-radio-button>
</el-radio-group>
<!--<div v-if="pageForm.changed == '1'" class="div-enum">
<dict-select v-model="pageForm.USER_CHANGE_TYPE" placeholder="异动类型" @change="doSearch"
code="UserType"></dict-select>
</div>-->
<!--<el-button @click="addMember" type="primary" size="small">新增会员</el-button>-->
</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"
label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="column.label" :prop="column.prop"
@@ -59,11 +60,12 @@ const MEMBER_MANAGE_TABLE = {
</template>
</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">
</el-table-column>
<el-table-column align="center" header-align="center" label="会员" prop="member"
show-overflow-tooltip sortable>
<template scope="{row}">
@@ -75,18 +77,18 @@ const MEMBER_MANAGE_TABLE = {
</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="福利会员" prop="member"
show-overflow-tooltip sortable>
<template scope="{row}">
<span class="text-success" v-if="row.welfareMember==1">
<i class="fa fa-circle ml5"></i>
</span>
<span class="text-danger" v-else>
<i class="fa fa-circle ml5"></i>
</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" header-align="center" label="福利会员" prop="member"-->
<!-- show-overflow-tooltip sortable>-->
<!-- <template scope="{row}">-->
<!-- <span class="text-success" v-if="row.welfareMember==1">-->
<!-- <i class="fa fa-circle ml5"></i> -->
<!-- </span>-->
<!-- <span class="text-danger" v-else>-->
<!-- <i class="fa fa-circle ml5"></i> -->
<!-- </span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!--<el-table-column align="center" header-align="center" label="劳模" prop="member"
show-overflow-tooltip sortable>
<template scope="{row}">
@@ -112,8 +114,8 @@ const MEMBER_MANAGE_TABLE = {
查看
</el-dropdown-item>
<el-dropdown-item
:command="{type:'change',data:row}"
v-if="$auth.hasRoleOr(['SYSADMIN','SCHOOL_UNION_ADMIN','BRANCH_UNION_CHAIRMAN','BRANCH_UNION_CHAIRMAN'])">
:command="{type:'change',data:row}"
v-if="$auth.hasRoleOr(['SYSADMIN','SCHOOL_UNION_ADMIN','BRANCH_UNION_CHAIRMAN','BRANCH_UNION_CHAIRMAN'])">
变更
</el-dropdown-item>
<!--<el-dropdown-item
@@ -133,7 +135,7 @@ const MEMBER_MANAGE_TABLE = {
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<el-dialog title="变更信息" :visible.sync="changeInfoVisible" width="70%">
<member-change-info ref="memberChangeInfoRef"></member-change-info>
</el-dialog>
@@ -158,7 +160,11 @@ const MEMBER_MANAGE_TABLE = {
{ prop: "unitName", label: "所属单位", sortable: true }
],
changeInfoVisible: false,
userId: ''
userId: "",
pageForm: {
isMember: 1,
changed: 2
}
}
},
methods: {
@@ -206,11 +212,11 @@ const MEMBER_MANAGE_TABLE = {
} else {
this.$message.error(res.msg)
}
})
})
})
},
openChange(data) {
this.$emit("change-member", {id: data.id, username: data.username})
this.$emit("change-member", { id: data.id, username: data.username })
},
openView(id) {
this.$emit("view-member", id)
@@ -221,7 +227,7 @@ const MEMBER_MANAGE_TABLE = {
openUserChangeInfo(row) {
this.changeInfoVisible = true
this.$nextTick(() => {
this.$refs.memberChangeInfoRef.onOpen(row.id,null)
this.$refs.memberChangeInfoRef.onOpen(row.id, null)
})
},
getChangeTypes(changeTypes) {
@@ -208,7 +208,6 @@ layout("/layouts/platform.html"){
{ prop: "sex", label: "性别" },
{ prop: "birthday", label: "出生年月", sortable: true },
{ prop: "mobile", label: "联系电话" },
{ prop: "idCard", label: "身份证号", width: 170 },
{ prop: "userState", label: "在职状态", sortable: true },
{ prop: "preparedBy", label: "聘用方式", sortable: true },
{ prop: "personType", label: "人员类型", sortable: true },
@@ -120,8 +120,6 @@ layout("/layouts/platform.html"){
{ prop: "sex", label: "性别" },
{ prop: "birthday", label: "出生年月", width: 120, sortable: true },
{ prop: "mobile", label: "联系电话" },
{ prop: "idCardType", label: "证件类型" },
{ prop: "idCard", label: "证件号码", width: 180 },
{ prop: "userState", label: "在职状态", width: 120, sortable: true },
{ prop: "personType", label: "教职工类别", width: 120, sortable: true },
{ prop: "preparedBy", label: "聘用方式", width: 120, sortable: true },
@@ -6,7 +6,7 @@ const optionSelect = {
<i class="el-icon-warning"></i>
<span>选择截止时间即将到期请尽快选择</span>
</div>
<!-- 选择提示 -->
<div class="welfare-notice">
<el-alert
@@ -15,7 +15,7 @@ const optionSelect = {
show-icon>
</el-alert>
</div>
<div class="welfare-content">
<!-- 项目信息卡片 -->
<el-card class="welfare-info-card">
@@ -37,11 +37,15 @@ const optionSelect = {
</div>
<div class="info-item">
<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 class="info-item">
<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 class="info-item">
<div class="info-label">发放地点</div>
@@ -49,7 +53,7 @@ const optionSelect = {
</div>
</div>
</el-card>
<!-- 福利选项 -->
<el-card class="welfare-options-card">
<div slot="header" class="welfare-info-header">
@@ -57,40 +61,42 @@ const optionSelect = {
<span>福利选项</span>
<span class="options-count"> {{ projectInfo.options.length }} </span>
</div>
<div class="welfare-options-grid">
<div v-for="option in projectInfo.options"
:key="option.id"
class="welfare-option"
<div v-for="option in projectInfo.options"
:key="option.id"
class="welfare-option"
:class="{ selected: projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0 }"
@click="projectInfo.isCheckBox === 'radio' ? selectRadioOption(option.id) : null">
<el-tag v-if="projectInfo.isCheckBox === 'radio' ? selectedRadioId === option.id : option.selectNum > 0"
class="option-tag" type="primary" effect="plain">已选择</el-tag>
<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">
<el-image :src="option.imgUrl" fit="cover"></el-image>
</div>
<div class="option-content">
<div class="option-title">{{ option.optionName }}</div>
<!-- 查看详情按钮 -->
<div class="option-detail-btn" @click.stop="showOptionDetail(option)">
<i class="el-icon-info"></i>
<span>查看详情</span>
</div>
<!-- 单选模式使用单选按钮 -->
<div class="option-radio" v-if="projectInfo.isCheckBox === 'radio'">
<el-radio v-model="selectedRadioId" :label="option.id">{{ null }}</el-radio>
</div>
<!-- 多选模式使用步进器 -->
<div class="option-stepper" v-else>
<el-input-number
v-model="option.selectNum"
:min="0"
<el-input-number
v-model="option.selectNum"
:min="0"
:max="projectInfo.multiSelectNum || 99"
size="small"
controls-position="right">
@@ -101,12 +107,13 @@ const optionSelect = {
</div>
</el-card>
</div>
<!-- 底部提交按钮 -->
<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>
<!-- 选项详情弹窗 -->
<el-dialog
title="福利详情"
@@ -119,7 +126,7 @@ const optionSelect = {
<div class="welfare-detail-content" v-html="selectedOption.description"></div>
</div>
</el-dialog>
<!-- 确认弹窗 -->
<el-dialog
title="确认选择"
@@ -133,9 +140,9 @@ const optionSelect = {
<div class="confirm-section-title">联系信息</div>
<el-form :model="contactForm" ref="contactForm" :rules="contactRules">
<el-form-item prop="mobile">
<el-input
v-model="contactForm.mobile"
placeholder="请输入手机号码"
<el-input
v-model="contactForm.mobile"
placeholder="请输入手机号码"
maxlength="11"
clearable>
<template slot="prepend">联系电话</template>
@@ -143,14 +150,14 @@ const optionSelect = {
</el-form-item>
</el-form>
</div>
<div class="confirm-section-title">已选择项目</div>
<div class="selected-items">
<div v-for="option in selectedOptions" :key="option.id" class="selected-item">
<div class="selected-item-left">
<div class="selected-item-image">
<el-image
:src="option.imgUrl"
<el-image
:src="option.imgUrl"
fit="cover"
:preview-src-list="[option.imgUrl]">
<div slot="error" class="image-slot">
@@ -167,27 +174,27 @@ const optionSelect = {
</div>
</div>
<div class="selected-item-right">
<el-tag
size="small"
type="primary"
effect="plain"
<el-tag
size="small"
type="primary"
effect="plain"
v-if="projectInfo.isCheckBox === 'checkBox'">
× {{ option.selectNum }}
</el-tag>
</div>
</div>
</div>
<div class="confirm-total" v-if="projectInfo.isCheckBox === 'checkBox'">
<span class="total-label">总数量</span>
<span class="total-value">{{ totalSelectedCount }} </span>
</div>
<div class="confirm-warning" :class="{ 'warning': hasSubmittedBefore }">
<i class="el-icon-info"></i>
<span>{{ confirmMessage }}</span>
</div>
<div class="deadline-info" v-if="deadlineText">
<i class="el-icon-time"></i>
<span>{{ deadlineText }}</span>
@@ -200,16 +207,16 @@ const optionSelect = {
</el-dialog>
</div>
`,
store,
data() {
return {
projectId: null,
projectInfo: {},
userSelection: [],
welfareProvideMode: [],
welfareSignMode: [],
projectId: null, // 项目ID
userId: null, // 用户id 代选的时候用得到
projectInfo: {}, // 项目信息
userSelection: [], // 用户选择的选项
selectedRadioId: "", // 单选模式下选中的选项ID
showConfirmDialog: false,
isSubmitting: false,
showConfirmDialog: false, // 确认弹窗
isSubmitting: false, // 是否正在提交
hasSubmittedBefore: false, // 是否之前提交过
deadlineTime: null, // 选择截止时间
showOptionDetailDialog: false, // 选项详情弹窗
@@ -219,13 +226,18 @@ const optionSelect = {
},
contactRules: {
mobile: [
{ required: true, message: '请输入联系电话', trigger: 'blur' },
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
{ required: true, message: "请输入联系电话", trigger: "blur" },
{
pattern: /^1[3456789]\d{9}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
}
}
},
computed: {
// 是否有选择
hasSelection() {
if (this.projectInfo.isCheckBox === "radio") {
return !!this.selectedRadioId
@@ -235,6 +247,7 @@ const optionSelect = {
}
},
// 已选择的选项
selectedOptions() {
if (this.projectInfo.isCheckBox === "radio") {
if (!this.selectedRadioId || !this.projectInfo.options) return []
@@ -245,11 +258,13 @@ const optionSelect = {
}
},
// 已选择的数量
totalSelectedCount() {
if (!this.projectInfo.options) return 0
return this.projectInfo.options.reduce((sum, option) => sum + (option.selectNum || 0), 0)
},
// 截止时间快了
isDeadlineSoon() {
if (!this.projectInfo.choiceTimeEnd) return false
@@ -260,6 +275,7 @@ const optionSelect = {
return diffHours > 0 && diffHours < 24
},
// 截止时间提示
deadlineText() {
if (!this.deadlineTime) return ""
const now = new Date()
@@ -279,21 +295,36 @@ const optionSelect = {
}
},
// 确认弹窗提示
confirmMessage() {
if (this.hasSubmittedBefore) {
return "修改后的选择将覆盖之前的选择"
}
return "请仔细确认您的选择"
},
// 是否代选
isProxySelect() {
return !!this.userId
}
},
methods: {
onOpen(projectId) {
// 打开选择项目弹窗 userId为null默认则是本人
onOpen(projectId, userId = null) {
this.projectId = projectId
this.userId = userId
this.selectedRadioId = null
this.contactForm = {
mobile: ""
}
this.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) {
this.projectInfo = res.data
this.deadlineTime = this.projectInfo.choiceTimeEnd
@@ -314,17 +345,24 @@ const optionSelect = {
// 获取用户选择的数据
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) {
this.userSelection = resp.data
this.hasSubmittedBefore = this.userSelection.length > 0
// 如果有用户选择数据,从中获取手机号
if (this.userSelection && this.userSelection.length > 0 && 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
if (this.userSelection && this.userSelection.length > 0) {
this.contactForm.mobile = this.userSelection[0]?.mobile
}
// 设置已选择的选项
@@ -356,11 +394,11 @@ const optionSelect = {
// 执行提交
doSubmit() {
// 验证手机号
this.$refs.contactForm.validate(valid => {
this.$refs.contactForm.validate((valid) => {
if (!valid) {
return
}
if (this.isSubmitting) return
this.isSubmitting = true
@@ -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
.post("/platform/welfare/userSelect/confirmSelect", {
projectId: this.projectId,
selections: JSON.stringify(selections)
})
.post(url, formData)
.then((res) => {
this.isSubmitting = false
if (res.code === 0) {
this.showConfirmDialog = false
this.$message.success("选择成功")
this.$emit("refresh")
} else {
@@ -516,9 +562,15 @@ const optionSelect = {
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.01); }
100% { transform: scale(1); }
0% {
transform: scale(1);
}
50% {
transform: scale(1.01);
}
100% {
transform: scale(1);
}
}
.welfare-deadline i {
@@ -568,7 +620,7 @@ const optionSelect = {
left: 0;
right: 0;
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 {
@@ -711,7 +763,7 @@ const optionSelect = {
left: 0;
right: 0;
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 {
@@ -826,7 +878,7 @@ const optionSelect = {
position: relative;
padding-left: 10px;
}
.confirm-section-title::before {
content: '';
position: absolute;
@@ -842,7 +894,7 @@ const optionSelect = {
.confirm-mobile-section {
margin-bottom: 20px;
}
.selected-items {
background: #f8f9fb;
border-radius: 8px;
@@ -1046,8 +1098,14 @@ const optionSelect = {
/* 动画 */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.welfare-select-container > * {
@@ -101,19 +101,28 @@ layout("/layouts/platform.html"){
></el-table-column>
<el-table-column align="center" fixed="right" header-align="center" label="操作" width="100px">
<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>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<el-dialog title="代选" :visible.sync="optionSelectVisible" width="60%">
<option-select ref="optionSelectRef" @refresh="optionSelectVisible=false;doSearch();"></option-select>
</el-dialog>
</guava>
</div>
<script>
<!--#include("../select/optionSelect.js"){}#-->
new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"option-select": optionSelect
},
data() {
return {
pageForm: {
@@ -133,7 +142,8 @@ layout("/layouts/platform.html"){
{ prop: "welfareUnitName", label: "所属单位", sortable: true },
{ prop: "selectedOptions", label: "所选福利", sortable: true },
{ prop: "mobile", label: "联系电话", sortable: true }
]
],
optionSelectVisible: false
}
},
computed: {
@@ -145,6 +155,7 @@ layout("/layouts/platform.html"){
}
},
methods: {
// 获取福利列表
getWelfareList() {
this.$axios.post("/platform/welfare/common/list", { year: this.pageForm.year }).then((res) => {
this.projectOptions = res.data
@@ -157,6 +168,7 @@ layout("/layouts/platform.html"){
})
},
// 获取数据
pageData() {
this.tableLoading = true
this.$axios
@@ -172,12 +184,18 @@ layout("/layouts/platform.html"){
})
},
// 导出选择情况表
exportXlsx() {
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() {
this.getWelfareList()
@@ -811,7 +811,7 @@ layout("/layouts/platform_h5.html"){
methods: {
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) {
this.projectInfo = res.data
@@ -839,12 +839,11 @@ layout("/layouts/platform_h5.html"){
// 如果有用户选择数据,从中获取手机号
if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) {
this.formData.mobile = this.userSelection[0].mobile
// 获取签名信息(如果有)
if (this.userSelection[0].userSign) {
this.formData.userSign = this.userSelection[0].userSign
}
} else if (this.$store.user && this.$store.user.mobile) {
// 如果没有选择过,使用store中的默认手机号
debugger
@@ -1073,12 +1072,12 @@ layout("/layouts/platform_h5.html"){
this.selectedOption = option
this.showOptionDetailDialog = true
},
// 重置签名
resetSignature() {
this.formData.userSign = ""
// 如果组件有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()
}
},
@@ -1145,7 +1144,7 @@ layout("/layouts/platform_h5.html"){
}
}
},
// 监听确认弹窗显示状态
showConfirmDialog(val) {
if (val && this.projectInfo.signMode === 2) {
@@ -1153,7 +1152,7 @@ layout("/layouts/platform_h5.html"){
this.$nextTick(() => {
if (this.$refs.signatureRef) {
// 如果组件有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)
}
}