This commit is contained in:
2025-03-07 17:14:09 +08:00
parent 9ca751b55d
commit a023e2b858
28 changed files with 3283 additions and 940 deletions
@@ -1,14 +1,17 @@
package io.v.nutz.activity.controller.basic; package io.v.nutz.activity.controller.basic;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import io.v.nutz.activity.models.ActivityUserCnd; import io.v.nutz.activity.models.ActivityUserCnd;
import io.v.nutz.activity.models.ActivityUserScope; import io.v.nutz.activity.models.ActivityUserScope;
import io.v.nutz.activity.services.ActivityBasicScopeService; import io.v.nutz.activity.services.ActivityBasicScopeService;
import io.v.nutz.activity.template.UserTemp;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.SimpleService; import io.v.nutz.base.service.SimpleService;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
@@ -20,28 +23,31 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
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.dao.util.cri.SqlExpressionGroup; import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.dao.util.cri.Static; import org.nutz.dao.util.cri.Static;
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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; import org.nutz.json.Json;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.*;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.annotation.POST; import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
@@ -57,6 +63,8 @@ public class ActivityBasicScopeController {
@Inject @Inject
private SimpleService simpleService; private SimpleService simpleService;
@Inject
private RedisService redisService;
@Inject @Inject
private ActivityBasicScopeService activityBasicScopeService; private ActivityBasicScopeService activityBasicScopeService;
@@ -99,6 +107,7 @@ public class ActivityBasicScopeController {
@Param(value = "personTypes", required = false) String[] personTypes, @Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates, @Param(value = "userStates", required = false) String[] userStates,
@Param(value = "memberTypes", required = false) String[] memberTypes, @Param(value = "memberTypes", required = false) String[] memberTypes,
@Param(value = "maritalTypes", required = false) String[] maritalTypes,
@Param(value = "sexTypes", required = false) String[] sexTypes, @Param(value = "sexTypes", required = false) String[] sexTypes,
@Param(value = "age", required = false) String[] age, @Param(value = "age", required = false) String[] age,
@Param(value = "teacherMeetingId", required = false) String teacherMeetingId, @Param(value = "teacherMeetingId", required = false) String teacherMeetingId,
@@ -107,7 +116,8 @@ public class ActivityBasicScopeController {
@Param(value = "clubId", required = false) String clubId, @Param(value = "clubId", required = false) String clubId,
@Param(value = "reverseSelection") boolean reverseSelection, @Param(value = "reverseSelection") boolean reverseSelection,
@Param(value = "activityGroupId", required = false) Integer activityGroupId, @Param(value = "activityGroupId", required = false) Integer activityGroupId,
@Param(value = "activityUserCnd", required = false) String activityUserCndStr) { @Param(value = "activityUserCnd", required = false) String activityUserCndStr,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
DISTINCT(u.id) as id, DISTINCT(u.id) as id,
@@ -120,16 +130,22 @@ public class ActivityBasicScopeController {
u.userState, u.userState,
u.unitname AS unitName, u.unitname AS unitName,
u.unionname AS unionName, u.unionname AS unionName,
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age,
TIMESTAMPDIFF(YEAR, u.schoolTime, CURDATE()) AS teachNum,
su.maritalStatus
FROM FROM
`user` u `user` u
LEFT JOIN sys_user_role sur on sur.userid = u.id LEFT JOIN sys_user_role sur on sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
LEFT JOIN single_user su on su.userId = u.id
$condition $condition
"""); """);
try { try {
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr); Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, maritalTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd); sql.setCondition(cnd);
return simpleService.list(pageForm, sql); return simpleService.list(pageForm, sql);
@@ -153,6 +169,7 @@ public class ActivityBasicScopeController {
@At @At
@ViReturn @ViReturn
@POST @POST
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("activity.basic.scope") @RequiresPermissions("activity.basic.scope")
public Object doSetActivityUser(PageForm pageForm, public Object doSetActivityUser(PageForm pageForm,
@Param(value = "unionId", required = false) String unionId, @Param(value = "unionId", required = false) String unionId,
@@ -160,6 +177,7 @@ public class ActivityBasicScopeController {
@Param(value = "personTypes", required = false) String[] personTypes, @Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates, @Param(value = "userStates", required = false) String[] userStates,
@Param(value = "memberTypes", required = false) String[] memberTypes, @Param(value = "memberTypes", required = false) String[] memberTypes,
@Param(value = "maritalTypes", required = false) String[] maritalTypes,
@Param(value = "sexTypes", required = false) String[] sexTypes, @Param(value = "sexTypes", required = false) String[] sexTypes,
@Param(value = "age", required = false) String[] age, @Param(value = "age", required = false) String[] age,
@Param(value = "activityGroupId", required = false) Integer activityGroupId, @Param(value = "activityGroupId", required = false) Integer activityGroupId,
@@ -171,7 +189,8 @@ public class ActivityBasicScopeController {
@Param(value = "userId", required = false) String[] userId, @Param(value = "userId", required = false) String[] userId,
@Param(value = "clubId", required = false) String clubId, @Param(value = "clubId", required = false) String clubId,
@Param(value = "reverseSelection") boolean reverseSelection, @Param(value = "reverseSelection") boolean reverseSelection,
@Param(value = "activityUserCnd", required = false) String activityUserCndStr) { @Param(value = "activityUserCnd", required = false) String activityUserCndStr,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT DISTINCT SELECT DISTINCT
( u.id ) AS userId ( u.id ) AS userId
@@ -179,10 +198,14 @@ public class ActivityBasicScopeController {
`user` u `user` u
LEFT JOIN sys_user_role sur ON sur.userid = u.id LEFT JOIN sys_user_role sur ON sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
LEFT JOIN single_user su on su.userId = u.id
$condition $condition
"""); """);
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr); Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, maritalTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd); sql.setCondition(cnd);
sql.setCallback(Sqls.callback.entities()); sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(ActivityUserScope.class)); sql.setEntity(dao.getEntity(ActivityUserScope.class));
@@ -259,8 +282,8 @@ public class ActivityBasicScopeController {
@ViReturn @ViReturn
// @RequiresPermissions("activity.basic.scope") // @RequiresPermissions("activity.basic.scope")
public Object getScopeUser(String activityGroupId, @Param(value = "userId", required = false) String userId) { public Object getScopeUser(String activityGroupId, @Param(value = "userId", required = false) String userId) {
userId = StrUtil.isNotBlank(userId) ? userId : io.v.nutz.util.ShiroUtil.getUserId(); String userid = StrUtil.isNotBlank(userId) ? userId : io.v.nutz.util.ShiroUtil.getUserId();
return simpleService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", userId)); return simpleService.dao().count(ActivityUserScope.class, Cnd.where("groupId", "=", activityGroupId).and("userId", "=", io.v.nutz.util.ShiroUtil.getUserId()));
} }
@At @At
@@ -310,7 +333,7 @@ public class ActivityBasicScopeController {
COLUMN_COMMENT COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'sys_user' WHERE TABLE_NAME = 'sys_user'
AND TABLE_SCHEMA = 'union_jvic' AND TABLE_SCHEMA = 'zhgh_jviv'
"""); """);
List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql); List<NutMap> sqlDataList = activityBasicScopeService.listMap(sql);
sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE")))); sqlDataList.forEach(v -> v.put("DATA_TYPE", new String((byte[]) v.get("DATA_TYPE"))));
@@ -324,6 +347,7 @@ public class ActivityBasicScopeController {
@At @At
@ViReturn @ViReturn
@RequiresPermissions("activity.basic.scope") @RequiresPermissions("activity.basic.scope")
public void doExportUser(PageForm pageForm, public void doExportUser(PageForm pageForm,
@Param(value = "props", required = false) String props, @Param(value = "props", required = false) String props,
@@ -332,6 +356,7 @@ public class ActivityBasicScopeController {
@Param(value = "personTypes", required = false) String[] personTypes, @Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates, @Param(value = "userStates", required = false) String[] userStates,
@Param(value = "memberTypes", required = false) String[] memberTypes, @Param(value = "memberTypes", required = false) String[] memberTypes,
@Param(value = "maritalTypes", required = false) String[] maritalTypes,
@Param(value = "sexTypes", required = false) String[] sexTypes, @Param(value = "sexTypes", required = false) String[] sexTypes,
@Param(value = "age", required = false) String[] age, @Param(value = "age", required = false) String[] age,
@Param(value = "teacherMeetingId", required = false) String teacherMeetingId, @Param(value = "teacherMeetingId", required = false) String teacherMeetingId,
@@ -340,7 +365,9 @@ public class ActivityBasicScopeController {
@Param(value = "clubId", required = false) String clubId, @Param(value = "clubId", required = false) String clubId,
@Param(value = "reverseSelection") boolean reverseSelection, @Param(value = "reverseSelection") boolean reverseSelection,
@Param(value = "activityGroupId", required = false) Integer activityGroupId, @Param(value = "activityGroupId", required = false) Integer activityGroupId,
@Param(value = "activityUserCnd", required = false) String activityUserCndStr, HttpServletResponse response) { @Param(value = "activityUserCnd", required = false) String activityUserCndStr,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey,
HttpServletResponse response) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
@@ -354,17 +381,23 @@ public class ActivityBasicScopeController {
u.userState, u.userState,
u.unitname AS unitName, u.unitname AS unitName,
u.unionname AS unionName, u.unionname AS unionName,
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age,
TIMESTAMPDIFF(YEAR, u.schoolTime, CURDATE()) AS teachNum,
su.maritalStatus
FROM FROM
`user` u `user` u
LEFT JOIN sys_user_role sur on sur.userid = u.id LEFT JOIN sys_user_role sur on sur.userid = u.id
LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id LEFT JOIN sys_club_user clubuser ON clubuser.userid=u.id
LEFT JOIN single_user su on su.userId = u.id
$condition $condition
"""); """);
try { try {
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr); Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, maritalTypes, sexTypes, age, teacherMeetingId, roleIds, userId, clubId, reverseSelection, activityGroupId, activityUserCndStr);
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd); sql.setCondition(cnd);
List<NutMap> map = simpleService.listMap(sql); List<NutMap> map = simpleService.listMap(sql);
@@ -393,6 +426,7 @@ public class ActivityBasicScopeController {
String[] personTypes, String[] personTypes,
String[] userStates, String[] userStates,
String[] memberTypes, String[] memberTypes,
String[] maritalTypes,
String[] sexTypes, String[] sexTypes,
String[] age, String[] age,
String teacherMeetingId, String teacherMeetingId,
@@ -427,6 +461,16 @@ public class ActivityBasicScopeController {
if (ArrayUtils.contains(memberTypes, "基金会员")) { if (ArrayUtils.contains(memberTypes, "基金会员")) {
cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)")); cnd.and(new Static(" u.loginname " + IN_OR_NIN_OP + " (select loginname from sick_fund_member)"));
} }
if (ArrayUtils.contains(memberTypes, "单身教工")) {
cnd.and(new Static("u.id " + IN_OR_NIN_OP + " (select userId from single_user)"));
}
if (ArrayUtils.contains(memberTypes, "30教龄教工")) {
cnd.and("u.isThirtyTeach", EQ_OR_NEQ_OP, 1);
}
}
if (Lang.isNotEmpty(maritalTypes)) {
cnd.and("su.maritalStatus", IN_OR_NIN_OP, Arrays.asList(maritalTypes));
} }
if (!Lang.isEmptyArray(age)) { if (!Lang.isEmptyArray(age)) {
@@ -463,4 +507,74 @@ public class ActivityBasicScopeController {
} }
/**
* 清空查询条件
*
* @param existsLoginNameRedisKey
* @return java.lang.Object
* @author zhf
* @description
*/
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("activity.basic.scope")
public Object clearSearchCnd(String existsLoginNameRedisKey) {
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
redisService.del(existsLoginNameRedisKey);
}
return null;
}
@At
@Aop(TransAop.READ_COMMITTED)
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("activity.basic.scope")
public Object doImport(String groupId, TempFile file) {
String matchUserLoginNamesKey = "ActivityBasicScopeController.doImport.time=" + System.currentTimeMillis();
List<UserTemp> userImportList = ExcelImportUtil.importExcel(file.getFile(), UserTemp.class, new ImportParams());
//判断人员哪些存在哪些不存在
Sql sql = Sqls.queryString("""
SELECT
u.loginname
FROM
sys_user u
""");
dao.execute(sql);
String[] sysLoginNames = (String[]) sql.getResult();
//存在的工号
List<String> existsLoginNames = new ArrayList<>();
for (UserTemp excelUser : userImportList) {
if (ArrayUtil.contains(sysLoginNames, excelUser.getLoginname())) {
existsLoginNames.add(excelUser.getLoginname());
} else {
excelUser.setRemarks("系统查不到此人");
}
}
//匹配不到的用户
List<UserTemp> errorExcelTempUsers = userImportList.stream().filter(v -> StrUtil.isNotBlank(v.getRemarks())).collect(Collectors.toList());
NutMap nutMap = NutMap.NEW();
nutMap.setv("totalCount", userImportList.size());
nutMap.setv("successCount", existsLoginNames.size());
nutMap.setv("errorCount", errorExcelTempUsers.size());
nutMap.setv("errorList", errorExcelTempUsers.stream().map(v -> {
return new NutMap().addv("工号", v.getLoginname()).addv("姓名", v.getUsername()).addv("错误信息", v.getRemarks());
}));
nutMap.setv("existsLoginNameRedisKey", matchUserLoginNamesKey);
//保存存在的工号
if (Lang.isNotEmpty(existsLoginNames)) {
redisService.lpush(matchUserLoginNamesKey, existsLoginNames.toArray(new String[0]));
redisService.expire(matchUserLoginNamesKey, 60 * 3);
}
return io.v.nutz.base.result.Result.success(nutMap);
}
} }
@@ -1,30 +1,40 @@
package io.v.nutz.activity.controller.basic; package io.v.nutz.activity.controller.basic;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
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.ArrayUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import io.v.nutz.activity.models.ActivityUserScope; import io.v.nutz.activity.models.ActivityUserScope;
import io.v.nutz.activity.template.UserTemp;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.result.Result;
import io.v.nutz.base.service.SimpleService; import io.v.nutz.base.service.SimpleService;
import io.v.nutz.modules.models.PageForm; import io.v.nutz.modules.models.PageForm;
import io.v.nutz.sys.models.User;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import io.v.nutz.util.ViTool; import io.v.nutz.util.ViTool;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
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.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.*;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.annotation.POST; import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
@@ -45,6 +55,12 @@ public class ActivityBasicUserController {
@Inject @Inject
private SimpleService simpleService; private SimpleService simpleService;
@Inject
private Dao dao;
@Inject
private RedisService redisService;
@At("") @At("")
@Ok("beetl:platform/activity/basic/ActivityUser.html") @Ok("beetl:platform/activity/basic/ActivityUser.html")
@RequiresPermissions("activity.basic.user") @RequiresPermissions("activity.basic.user")
@@ -54,7 +70,7 @@ public class ActivityBasicUserController {
@At @At
@ViReturn @ViReturn
@POST @POST
@RequiresPermissions("activity.basic.user") @RequiresAuthentication
public Object pageData(PageForm pageForm, public Object pageData(PageForm pageForm,
@Param(value = "unionId", required = false) String unionId, @Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId, @Param(value = "unitId", required = false) String unitId,
@@ -62,7 +78,8 @@ public class ActivityBasicUserController {
@Param(value = "userState", required = false) String userState, @Param(value = "userState", required = false) String userState,
@Param(value = "groupId", required = false) Integer groupId, @Param(value = "groupId", required = false) Integer groupId,
@Param(value = "activityUnionId", required = false) String activityUnionId, @Param(value = "activityUnionId", required = false) String activityUnionId,
@Param(value = "activityUnitId", required = false) String activityUnitId) { @Param(value = "activityUnitId", required = false) String activityUnitId,
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
aus.id, aus.id,
@@ -100,6 +117,10 @@ public class ActivityBasicUserController {
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.andEX("aus.creator", "=", ShiroUtil.getPrincipalProperty("id")); cnd.andEX("aus.creator", "=", ShiroUtil.getPrincipalProperty("id"));
} }
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
List<String> loginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
cnd.andEX("u.loginname", "in", loginNames);
}
sql.setCondition(cnd); sql.setCondition(cnd);
return simpleService.list(pageForm, sql); return simpleService.list(pageForm, sql);
@@ -113,6 +134,7 @@ public class ActivityBasicUserController {
*/ */
@At @At
@ViReturn @ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("activity.basic.user") @RequiresPermissions("activity.basic.user")
public Object doDelete(@Param(value = "id", required = false) String id, public Object doDelete(@Param(value = "id", required = false) String id,
@Param(value = "groupId", required = false) Integer groupId, @Param(value = "groupId", required = false) Integer groupId,
@@ -123,55 +145,50 @@ public class ActivityBasicUserController {
@Param(value = "activityUnionId", required = false) String activityUnionId, @Param(value = "activityUnionId", required = false) String activityUnionId,
@Param(value = "activityUnitId", required = false) String activityUnitId, @Param(value = "activityUnitId", required = false) String activityUnitId,
@Param(value = "personType", required = false) String personType, @Param(value = "personType", required = false) String personType,
@Param(value = "userState", required = false) String userState) { @Param(value = "userState", required = false) String userState,
Cnd cnd = Cnd.NEW(); @Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
if (StrUtil.isNotBlank(id)) {
cnd.and("id", "=", id); List<String> existsLoginNames = new ArrayList<>();
simpleService.dao().clear(ActivityUserScope.class, cnd); if(StrUtil.isNotBlank(existsLoginNameRedisKey) && redisService.exists(existsLoginNameRedisKey)){
} else { existsLoginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
List<User> users = simpleService.dao().query(User.class, Cnd.NEW()); if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
if (StrUtil.isNotBlank(searchKeyword) && StrUtil.isNotBlank(searchName)) { redisService.del(existsLoginNameRedisKey);
users = users.stream().filter(v -> v.getLoginname().equals(searchKeyword) || v.getUsername().equals(searchKeyword)).collect(Collectors.toList());
} }
if (StrUtil.isNotBlank(unionId)) {
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getUnionid()) && v.getUnionid().equals(unionId)).collect(Collectors.toList());
}
if (StrUtil.isNotBlank(unitId)) {
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getUnitid()) && v.getUnitid().equals(unitId)).collect(Collectors.toList());
}
if (StrUtil.isNotBlank(personType)) {
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getPersonType()) && v.getPersonType().equals(personType)).collect(Collectors.toList());
}
if (StrUtil.isNotBlank(userState)) {
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getUserState()) && v.getUserState().equals(userState)).collect(Collectors.toList());
}
if (StrUtil.isNotBlank(activityUnitId)) {
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getActivityUnitId()) && v.getActivityUnitId().equals(activityUnitId)).collect(Collectors.toList());
}
if (StrUtil.isNotBlank(activityUnionId)) {
users = users.stream().filter(v -> StrUtil.isNotBlank(v.getActivityUnionId()) && v.getActivityUnionId().equals(activityUnionId)).collect(Collectors.toList());
}
List<String> ids = users.stream().map(User::getId).collect(Collectors.toList());
cnd.andEX("userId", "in", ids);
cnd.andEX("groupId", "=", groupId);
if (Lang.isEmpty(ids)) {
return null;
} }
simpleService.dao().clear(ActivityUserScope.class, cnd); Sql sql = Sqls.create("select id from `user` u $condition");
Cnd userCnd = Cnd.NEW();
if (StrUtil.isNotBlank(searchName) && StrUtil.isNotBlank(searchKeyword)) {
userCnd.and(Cnd.likeEX(searchName, searchKeyword));
} }
userCnd.andEX("u.unionid", "=", unionId);
userCnd.andEX("u.unitid", "=", unitId);
userCnd.andEX("u.personType", "=", personType);
userCnd.andEX("u.userState", "=", userState);
userCnd.andEX("u.id", "=", id);
userCnd.andEX("u.loginname","in",existsLoginNames);
sql.setCondition(userCnd);
Cnd cnd = Cnd.NEW();
cnd.andEX("groupId","=",groupId);
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.andEX("creator", "=", ShiroUtil.getPrincipalProperty("id"));
}
if(StrUtil.isNotBlank(id)){
cnd.and("id","=",id);
}else {
cnd.and(new Static("userId in ("+ sql +")"));
}
dao.clear(ActivityUserScope.class,cnd);
return null; return null;
} }
@At @At
@Ok("void") @Ok("void")
@RequiresPermissions("activity.basic.user")
public void doExportUser(Integer groupId, HttpServletResponse response) { public void doExportUser(Integer groupId, HttpServletResponse response) {
try { try {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
u.username AS userName, u.username AS userName,
@@ -209,5 +226,94 @@ public class ActivityBasicUserController {
} }
@At
@Ok("void")
@RequiresPermissions("activity.basic.user")
public void downloadImport(HttpServletResponse response) {
try {
ViTool.excelResponse(response, "人员导入模板.xlsx");
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
entityList.add(new ExcelExportEntity("姓名", "username", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, new ArrayList<>());
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("activity.basic.user")
public Object doImport(String groupId, TempFile file) {
String matchUserLoginNamesKey = "ActivityBasicUserController.doImport.groupId=" + groupId + "time=" + System.currentTimeMillis();
List<UserTemp> userImportList = ExcelImportUtil.importExcel(file.getFile(), UserTemp.class, new ImportParams());
//判断人员哪些存在哪些不存在
Sql sql = Sqls.queryString("""
SELECT
u.loginname
FROM
activity_user_scope aus
LEFT JOIN sys_user u ON u.id = aus.userId
WHERE
aus.groupId = @groupId
""").setParam("groupId", groupId);
dao.execute(sql);
String[] sysLoginNames = (String[]) sql.getResult();
//存在的工号
List<String> existsLoginNames = new ArrayList<>();
for (UserTemp excelUser : userImportList) {
if (ArrayUtil.contains(sysLoginNames, excelUser.getLoginname())) {
existsLoginNames.add(excelUser.getLoginname());
} else {
excelUser.setRemarks("系统查不到此人");
}
}
//匹配不到的用户
List<UserTemp> errorExcelTempUsers = userImportList.stream().filter(v -> StrUtil.isNotBlank(v.getRemarks())).collect(Collectors.toList());
NutMap nutMap = NutMap.NEW();
nutMap.setv("totalCount", userImportList.size());
nutMap.setv("successCount", existsLoginNames.size());
nutMap.setv("errorCount", errorExcelTempUsers.size());
nutMap.setv("errorList", errorExcelTempUsers.stream().map(v -> {
return new NutMap().addv("工号", v.getLoginname()).addv("姓名", v.getUsername()).addv("错误信息", v.getRemarks());
}));
nutMap.setv("existsLoginNameRedisKey", matchUserLoginNamesKey);
//保存存在的工号
if (Lang.isNotEmpty(existsLoginNames)) {
redisService.lpush(matchUserLoginNamesKey, existsLoginNames.toArray(new String[0]));
redisService.expire(matchUserLoginNamesKey, 60 * 3);
}
return Result.success(nutMap);
}
/**
* 清空查询条件
*
* @param existsLoginNameRedisKey
* @return java.lang.Object
* @author zhf
* @description
*/
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("activity.basic.user")
public Object clearSearchCnd(String existsLoginNameRedisKey) {
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
redisService.del(existsLoginNameRedisKey);
}
return null;
}
} }
@@ -0,0 +1,18 @@
package io.v.nutz.activity.template;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@Data
public class UserTemp {
@Excel(name = "工号")
private String loginname;
@Excel(name = "姓名")
private String username;
@Excel(name = "备注")
private String remarks;
}
@@ -0,0 +1,145 @@
package io.v.nutz.single.controller;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.single.model.SingleUser;
import io.v.nutz.single.service.SingleUserService;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/single/myApply")
public class SingleMyApplyController {
@Inject
private SingleUserService singleUserService;
@At("")
@Ok("beetl:/platform/single/myApply.html")
@RequiresPermissions("single.user.myApply")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("single.user.myApply")
public Object pageData(PageForm pageForm,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "threeUnitId", required = false) String threeUnitId,
@Param(value = "unionGroupId", required = false) String unionGroupId,
@Param(value = "personType", required = false) String personType,
@Param(value = "userState", required = false) String userState,
@Param(value = "sex", required = false) String sex,
@Param(value = "isJoin",required = false) Boolean isJoin) {
Sql sql = Sqls.create("""
SELECT
su.*,
u.unionname AS unionName,
u.unitname AS unitName,
u.username,
u.sex,
u.loginname,
u.userState,
u.personType,
state.stateName
FROM
`single_user` su
LEFT JOIN `user` u ON u.id = su.userId
LEFT JOIN `audit_state` state ON state.stateId = su.singleState
$condition
""");
CndPlus cnd = CndPlus.create();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")){
cnd.and("u.id","=",ShiroUtil.getUserId());
}
cnd.and("su.singleState","in",isJoin? Lang.list(8000,8010,8015,8020,8025,8030): Lang.list(8040,8045,8050,8055,8060));
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.threeUnitId", "=", threeUnitId);
cnd.andEX("u.unionGroupId", "=", unionGroupId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEX("u.sex","=",sex);
cnd.desc("su.applyTime");
sql.setCondition(cnd);
return singleUserService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql);
}
/**
* 退会
* @param id
* @return
*/
@At
@ViReturn
@RequiresPermissions("single.user.myApply")
public Object exitSingle(String id) {
int count = singleUserService.count(Cnd.where("id", "=", id).and("singleState", "=", "8030"));
if (count == 1) {
singleUserService.update(Chain.make("singleState", "8040"), Cnd.where("id", "=", id));
}
return null;
}
@At
@ViReturn
@RequiresPermissions("single.user.myApply")
public Object removeById(String id){
singleUserService.delete(id);
return null;
}
@At
@ViReturn
@RequiresPermissions("single.user.myApply")
public Object doEdit(SingleUser user){
singleUserService.updateIgnoreNull(user);
return null;
}
@At
@ViReturn
public Object findAuditSuccess(){
Sql sql = Sqls.create("""
SELECT
su.*,
u.unionname AS unionName,
u.unitname AS unitName,
u.username AS userName,
u.sex,
u.loginname AS loginName
FROM
`single_user` su
LEFT JOIN `user` u ON u.id = su.userId
WHERE
su.singleState = '8030'
AND su.userId = @userId
""").setParam("userId", ShiroUtil.getUserId());
return singleUserService.listMap(sql).stream().findFirst().orElse(null);
}
}
@@ -0,0 +1,137 @@
package io.v.nutz.single.controller;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.Audit;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.single.model.SingleUser;
import io.v.nutz.single.service.SingleUserService;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.Date;
@IocBean
@Ok("json:full")
@At("/platform/single/schoolAudit")
public class SingleSchoolAuditController {
@Inject
private Dao dao;
@Inject
private SingleUserService singleUserService;
@At("")
@Ok("beetl:/platform/single/schoolAudit.html")
@RequiresPermissions("single.user.schoolAudit")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("single.user.unionAudit")
public Object pageData(PageForm pageForm,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "threeUnitId", required = false) String threeUnitId,
@Param(value = "unionGroupId", required = false) String unionGroupId,
@Param(value = "personType", required = false) String personType,
@Param(value = "userState", required = false) String userState,
@Param(value = "isJoin", required = false) String isJoin,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "sex", required = false) String sex) {
Sql sql = Sqls.create("""
SELECT
su.*,
u.unionname AS unionName,
u.unitname AS unitName,
u.username,
u.sex,
u.loginname,
u.userState,
u.personType,
state.stateName
FROM
`single_user` su
LEFT JOIN `user` u ON u.id = su.userId
LEFT JOIN `audit_state` state ON state.stateId = su.singleState
$condition
""");
CndPlus cnd = CndPlus.create();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.threeUnitId", "=", threeUnitId);
cnd.andEX("u.unionGroupId", "=", unionGroupId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEX("u.sex", "=", sex);
if ("false".equals(isJoin)) {
cnd.and("su.singleState", ">", 8030);
} else {
cnd.and("su.singleState", "<=", 8030);
}
cnd.and("su.singleState", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", "true".equals(isJoin) ? 8020 : 8050);
sql.setCondition(cnd);
return singleUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("single.user.unionAudit")
public Object doAudit(@Param("audit") Audit audit, String id, String isPass, String isJoin) {
dao.insert(audit);
dao.update(SingleUser.class, Chain.make("singleState", "1".equals(isPass) ? "true".equals(isJoin) ? 8030 : 8060 : "true".equals(isJoin) ? 8025 : 8055)
.add("true".equals(isJoin) ? "joinTime" : "exitTime", new Date())
.add("true".equals(isJoin) ? "schoolAuditId" : "exitSchoolAuditId", audit.getId()), Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("single.user.unionAudit")
public Object doRollBack(String id, String isJoin) {
SingleUser user = singleUserService.fetch(id);
dao.clear(Audit.class, Cnd.where("id", "=", "true".equals(isJoin) ? user.getSchoolAuditId() : user.getExitSchoolAuditId()));
singleUserService.update(Chain.make("true".equals(isJoin) ? "schoolAuditId" : "exitSchoolAuditId", null)
.add("true".equals(isJoin) ? "joinTime" : "exitTime", null)
.add("singleState", "true".equals(isJoin) ? 8020 : 8050), Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
public Object getAuditNum(String isAudit, String unionId) {
return singleUserService.getAuditNum("school", isAudit, unionId);
}
}
@@ -0,0 +1,130 @@
package io.v.nutz.single.controller;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.Audit;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.single.model.SingleUser;
import io.v.nutz.single.service.SingleUserService;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/single/unionAudit")
public class SingleUnionAuditController {
@Inject
private Dao dao;
@Inject
private SingleUserService singleUserService;
@At("")
@Ok("beetl:/platform/single/unionAudit.html")
@RequiresPermissions("single.user.unionAudit")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("single.user.unionAudit")
public Object pageData(PageForm pageForm,
@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId,
@Param(value = "threeUnitId", required = false) String threeUnitId,
@Param(value = "unionGroupId", required = false) String unionGroupId,
@Param(value = "personType", required = false) String personType,
@Param(value = "userState", required = false) String userState,
@Param(value = "isJoin", required = false) String isJoin,
@Param(value = "isAudit", required = false) String isAudit,
@Param(value = "sex", required = false) String sex) {
Sql sql = Sqls.create("""
SELECT
su.*,
u.unionname AS unionName,
u.unitname AS unitName,
u.username,
u.sex,
u.loginname,
u.userState,
u.personType,
state.stateName
FROM
`single_user` su
LEFT JOIN `user` u ON u.id = su.userId
LEFT JOIN `audit_state` state ON state.stateId = su.singleState
$condition
""");
CndPlus cnd = CndPlus.create();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("u.username", pageForm.getSearchKeyword());
seg.orLike("u.loginname", pageForm.getSearchKeyword());
cnd.and(seg);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
cnd.andEX("u.threeUnitId", "=", threeUnitId);
cnd.andEX("u.unionGroupId", "=", unionGroupId);
cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState);
cnd.andEX("u.sex", "=", sex);
if ("false".equals(isJoin)) {
cnd.and("su.singleState", ">", 8030);
} else {
cnd.and("su.singleState", "<=", 8030);
}
cnd.and("su.singleState", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", "true".equals(isJoin) ? 8010 : 8040);
sql.setCondition(cnd);
return singleUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("single.user.unionAudit")
public Object doAudit(@Param("audit") Audit audit, String id, String isPass, String isJoin) {
dao.insert(audit);
dao.update(SingleUser.class, Chain.make("singleState", "1".equals(isPass) ? "true".equals(isJoin) ? 8020 : 8050 : "true".equals(isJoin) ? 8015 : 8045)
.add("true".equals(isJoin) ? "unionAuditId" : "exitUnionAuditId", audit.getId()), Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("single.user.unionAudit")
public Object doRollBack(String id, String isJoin) {
SingleUser user = singleUserService.fetch(id);
dao.clear(Audit.class, Cnd.where("id", "=", "true".equals(isJoin) ? user.getUnionAuditId() : user.getExitUnionAuditId()));
singleUserService.update(Chain.make("true".equals(isJoin) ? "unionAuditId" : "exitUnionAuditId", null)
.add("singleState", "true".equals(isJoin) ? 8010 : 8040), Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
public Object getAuditNum(String isAudit,String unionId) {
return singleUserService.getAuditNum("union", isAudit,unionId);
}
}
@@ -0,0 +1,81 @@
package io.v.nutz.single.controller;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.single.model.SingleUser;
import io.v.nutz.single.service.SingleUserService;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/single/apply")
public class SingleUserApplyController {
@Inject
private SingleUserService singleUserService;
@At("")
@Ok("beetl:/platform/single/apply.html")
@RequiresPermissions("single.user.apply")
public void index() {}
@At
@ViReturn
@RequiresPermissions("single.user.apply")
public Object doSubmit(SingleUser user, boolean isSubmit){
if (isSubmit) {
user.setSingleState("8010");
}else {
user.setSingleState("8000");
}
user.setUserId(ShiroUtil.getUserId());
user.setApplyTime(new Date());
singleUserService.insert(user);
return null;
}
@At
@ViReturn
@RequiresPermissions("single.user.apply")
public Object findOneSingle(String id){
return singleUserService.findOne(id);
}
@At
@ViReturn
@RequiresPermissions("single.user.apply")
public Object doModifyInfo(SingleUser user){
return singleUserService.updateIgnoreNull(user);
}
@At
@ViReturn
@RequiresPermissions("single.user.apply")
public Object isJoinedBeforeAndIsAudit(){
//之前是否加入过
List<SingleUser> singleUserList = singleUserService.query(Cnd.where("userId", "=", ShiroUtil.getUserId()).and("singleState", "=", "8060"));
SingleUser singleUser = singleUserList.stream().min(Comparator.comparing(SingleUser::getExitTime, Comparator.nullsFirst(Comparator.naturalOrder()))).orElse(null);
//是否有审核的记录
SingleUser user = singleUserService.fetch(Cnd.where("userId", "=", ShiroUtil.getUserId())
.and("singleState", "is not", null).and("singleState", "!=", "")
.and("singleState", "<", "8060").and("singleState", ">=", "8010"));
NutMap nutMap = new NutMap();
nutMap.setv("singleUser",singleUser);
nutMap.setv("auditUser",user);
return nutMap;
}
}
@@ -1,28 +1,39 @@
package io.v.nutz.single.controller; package io.v.nutz.single.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.result.Result;
import io.v.nutz.modules.models.PageForm; import io.v.nutz.modules.models.PageForm;
import io.v.nutz.single.service.SingleUserService; import io.v.nutz.single.service.SingleUserService;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.util.ViTool; import io.v.nutz.util.ViTool;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.sql.Sql;
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.json.Json; import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @ClassName SingleUserController * @ClassName SingleUserController
@@ -37,12 +48,13 @@ import java.util.Map;
public class SingleUserController { public class SingleUserController {
@Inject @Inject
private SingleUserService userService; private SingleUserService singleUserService;
@At("") @At("")
@Ok("beetl:/platform/single/list.html") @Ok("beetl:/platform/single/list.html")
@RequiresPermissions("single.user.list") @RequiresPermissions("single.user.list")
public void index() {} public void index() {
}
@At @At
@ViReturn @ViReturn
@@ -54,15 +66,21 @@ public class SingleUserController {
@Param(value = "unionGroupId", required = false) String unionGroupId, @Param(value = "unionGroupId", required = false) String unionGroupId,
@Param(value = "personTypes", required = false) String[] personTypes, @Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "userStates", required = false) String[] userStates, @Param(value = "userStates", required = false) String[] userStates,
@Param(value = "age", required = false) String[] age,
@Param(value = "campus", required = false) String campus, @Param(value = "campus", required = false) String campus,
@Param(value = "sex", required = false) String sex, @Param(value = "sex", required = false) String sex,
@Param(value = "memberStatus", required = false) Integer memberStatus, @Param(value = "memberStatus", required = false) Integer memberStatus,
@Param(value = "position", required = false) String position, @Param(value = "position", required = false) String position,
@Param(value = "jobTitle", required = false) String jobTitle, @Param(value = "jobTitle", required = false) String jobTitle,
@Param(value = "searchName", required = false) String searchName, @Param(value = "searchName", required = false) String searchName,
@Param(value = "searchKeyWord", required = false) String searchKeyWord) { @Param(value = "searchKeyWord", required = false) String searchKeyWord,
return userService.singlePageList(pageForm.getPageNumber(),pageForm.getPageSize(), unionId, unitId, threeUnitId, unionGroupId, @Param(value = "isJoin", required = false) Boolean isJoin,
personTypes, userStates, campus, sex, memberStatus, position, jobTitle, searchName, searchKeyWord); @Param(value = "education", required = false) String education,
@Param(value = "maritalStatus", required = false) String maritalStatus) {
Sql sql = singleUserService.singlePageList(unionId, unitId, threeUnitId, unionGroupId,
personTypes, userStates, age, campus, sex, memberStatus, position, jobTitle,
searchName, searchKeyWord, isJoin, education, maritalStatus);
return singleUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
} }
@@ -71,24 +89,29 @@ public class SingleUserController {
@RequiresPermissions("member.group.person") @RequiresPermissions("member.group.person")
public void export(HttpServletResponse response, public void export(HttpServletResponse response,
String props, String props,
PageForm pageForm,
@Param(value = "unionId", required = false) String unionId, @Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId", required = false) String unitId, @Param(value = "unitId", required = false) String unitId,
@Param(value = "threeUnitId", required = false) String threeUnitId, @Param(value = "threeUnitId", required = false) String threeUnitId,
@Param(value = "unionGroupId", required = false) String unionGroupId, @Param(value = "unionGroupId", required = false) String unionGroupId,
@Param(value = "personTypes", required = false) String personTypes, @Param(value = "personTypes", required = false) String personTypes,
@Param(value = "userStates", required = false) String userStates, @Param(value = "userStates", required = false) String userStates,
@Param(value = "age", required = false) String age,
@Param(value = "campus", required = false) String campus, @Param(value = "campus", required = false) String campus,
@Param(value = "sex", required = false) String sex, @Param(value = "sex", required = false) String sex,
@Param(value = "memberStatus", required = false) Integer memberStatus, @Param(value = "memberStatus", required = false) Integer memberStatus,
@Param(value = "position", required = false) String position, @Param(value = "position", required = false) String position,
@Param(value = "jobTitle", required = false) String jobTitle, @Param(value = "jobTitle", required = false) String jobTitle,
@Param(value = "searchName", required = false) String searchName, @Param(value = "searchName", required = false) String searchName,
@Param(value = "searchKeyWord", required = false) String searchKeyWord) { @Param(value = "searchKeyWord", required = false) String searchKeyWord,
@Param(value = "isJoin", required = false) Boolean isJoin,
@Param(value = "education", required = false) String education,
@Param(value = "maritalStatus", required = false) String maritalStatus) {
try { try {
ViTool.excelResponse(response, "单身教工名单.xls"); ViTool.excelResponse(response, "单身教工名单.xlsx");
List<NutMap> dataList = userService.singlePageList(unionId, unitId, threeUnitId, unionGroupId, Json.fromJsonAsArray(String.class, personTypes), Sql sql = singleUserService.singlePageList(unionId, unitId, threeUnitId, unionGroupId, Json.fromJsonAsArray(String.class, personTypes),
Json.fromJsonAsArray(String.class, userStates), campus, sex, memberStatus, position, jobTitle, searchName, searchKeyWord); Json.fromJsonAsArray(String.class, userStates), Json.fromJsonAsArray(String.class, age), campus, sex, memberStatus, position,
jobTitle, searchName, searchKeyWord, isJoin, education, maritalStatus);
List<NutMap> dataList = singleUserService.listMap(sql);
List<ExcelExportEntity> entityList = new ArrayList<>(); List<ExcelExportEntity> entityList = new ArrayList<>();
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10); ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
no.setFormat("isAddIndex"); no.setFormat("isAddIndex");
@@ -98,6 +121,12 @@ public class SingleUserController {
propMap.forEach((k, v) -> { propMap.forEach((k, v) -> {
entityList.add(new ExcelExportEntity(v, k, 20)); entityList.add(new ExcelExportEntity(v, k, 20));
}); });
entityList.add(new ExcelExportEntity("身高(cm)", "height", 10));
entityList.add(new ExcelExportEntity("籍贯", "hometown", 20));
entityList.add(new ExcelExportEntity("学历", "education", 20));
entityList.add(new ExcelExportEntity("爱好", "hobby", 20));
entityList.add(new ExcelExportEntity("交友意向", "intentionFriends", 50));
entityList.add(new ExcelExportEntity("个人介绍", "personalIntroduction", 50));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, dataList); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, dataList);
workbook.write(response.getOutputStream()); workbook.write(response.getOutputStream());
} catch (IOException e) { } catch (IOException e) {
@@ -106,4 +135,50 @@ public class SingleUserController {
} }
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object doImport(TempFile file, boolean isFlag) {
/* try {
List<ThirtyTeachTemp> thirtyTeachImportList = ExcelImportUtil.importExcel(file.getFile(), ThirtyTeachTemp.class, new ImportParams());
List<Sys_user> users = singleUserService.dao().query(Sys_user.class, Cnd.NEW());
List<String> allUserList = users.stream().map(Sys_user::getLoginname).collect(Collectors.toList());
List<ThirtyTeachTemp> errorInfos = new ArrayList<>();
List<String> insertUserIds = new ArrayList<>();
thirtyTeachImportList.forEach(v -> {
if (allUserList.contains(v.getLoginName().trim())) {
insertUserIds.add(v.getLoginName());
} else {
v.setRemark("获取不到该用户的工号,请检查工号是否正确!");
errorInfos.add(v);
}
});
int i = 0;
if (Lang.isNotEmpty(insertUserIds)) {
if (isFlag) {
singleUserService.update(Chain.make("marriage", null), Cnd.where("marriage", "=", "未婚"));
}
i = singleUserService.update(Chain.make("marriage", "已婚"), Cnd.where("loginname", "in", insertUserIds));
}
if (Lang.isNotEmpty(errorInfos)) {
NutMap nutMap = NutMap.NEW();
nutMap.setv("totalCount", thirtyTeachImportList.size());
nutMap.setv("successCount", i);
nutMap.setv("errorCount", errorInfos.size());
nutMap.setv("errorList", errorInfos.stream().map(v -> {
return NutMap.NEW().addv("工号", v.getLoginName()).addv("姓名", v.getUserName()).addv("错误原因", v.getRemark());
}).collect(Collectors.toList()));
return Result.success(nutMap);
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}*/
return Result.success();
}
} }
@@ -37,16 +37,17 @@ public class SingleUserStatisticsController {
@At("") @At("")
@Ok("beetl:/platform/single/statistics.html") @Ok("beetl:/platform/single/statistics.html")
@RequiresPermissions("single.user.statistics") @RequiresPermissions("single.user.statistics")
public void index() {} public void index() {
}
@At @At
@ViReturn @ViReturn
@RequiresPermissions("single.user.statistics") @RequiresPermissions("single.user.statistics")
public Object pageData(@Param(value = "unionId",required = false) String unionId, public Object pageData(@Param(value = "unionId", required = false) String unionId,
@Param(value = "unitId",required = false) String unitId, @Param(value = "unitId", required = false) String unitId,
@Param(value = "personTypes",required = false) String[] personTypes, @Param(value = "personTypes", required = false) String[] personTypes,
@Param(value = "analyze",required = false) String analyze) { @Param(value = "analyze", required = false) String analyze) {
return userService.singleStatisticsList(personTypes, unionId, unitId, analyze); return userService.singleStatisticsList(personTypes, unionId, unitId, analyze);
} }
@@ -57,7 +58,7 @@ public class SingleUserStatisticsController {
List<NutMap> singleUserList = userService.singleStatisticsList(personTypes, unionId, unitId, analyze); List<NutMap> singleUserList = userService.singleStatisticsList(personTypes, unionId, unitId, analyze);
List<NutMap> finalMemberList = singleUserList; List<NutMap> finalMemberList = singleUserList;
NutMap sumMap = new NutMap() {{ NutMap sumMap = new NutMap() {{
addv("0".equals(analyze)?"unionCode":"unitCode", "合计"); addv("unCode", "合计");
addv("totalNumber", finalMemberList.stream().mapToInt(v -> v.getInt("totalNumber")).sum()); addv("totalNumber", finalMemberList.stream().mapToInt(v -> v.getInt("totalNumber")).sum());
addv("male", finalMemberList.stream().mapToInt(v -> v.getInt("male")).sum()); addv("male", finalMemberList.stream().mapToInt(v -> v.getInt("male")).sum());
addv("female", finalMemberList.stream().mapToInt(v -> v.getInt("female")).sum()); addv("female", finalMemberList.stream().mapToInt(v -> v.getInt("female")).sum());
@@ -73,13 +74,9 @@ public class SingleUserStatisticsController {
singleUserList.add(sumMap); singleUserList.add(sumMap);
List<ExcelExportEntity> entityList = new ArrayList<>(); List<ExcelExportEntity> entityList = new ArrayList<>();
if ("0".equals(analyze)) { entityList.add(new ExcelExportEntity("0".equals(analyze) ? "分工会代码" : "单位代码", "unCode", 20));
entityList.add(new ExcelExportEntity("分工会代码", "unionCode", 20)); entityList.add(new ExcelExportEntity("0".equals(analyze) ? "分工会名称" : "单位名称", "unName", 20));
entityList.add(new ExcelExportEntity("分工会名称", "unionName", 20));
}else if("1".equals(analyze)){
entityList.add(new ExcelExportEntity("单位代码", "unitCode", 20));
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
}
entityList.add(new ExcelExportEntity("总人数", "totalNumber", 20)); entityList.add(new ExcelExportEntity("总人数", "totalNumber", 20));
entityList.add(new ExcelExportEntity("", "male", 20)); entityList.add(new ExcelExportEntity("", "male", 20));
entityList.add(new ExcelExportEntity("", "female", 20)); entityList.add(new ExcelExportEntity("", "female", 20));
@@ -94,7 +91,7 @@ public class SingleUserStatisticsController {
try { try {
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("单身教工统计表.xls").getBytes("utf-8"), "ISO8859-1")); response.setHeader("Content-Disposition", "attachment;filename=" + new String(("单身教工统计表.xlsx").getBytes("utf-8"), "ISO8859-1"));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, singleUserList); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, singleUserList);
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream); workbook.write(outputStream);
@@ -0,0 +1,134 @@
package io.v.nutz.single.model;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
import java.util.List;
@Data
@Table
public class SingleUser {
@Name
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("用户Id")
private String userId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("出生年月")
private String birthday;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("联系方式")
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 10)
@Comment("身高")
private String height;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("籍贯")
private String hometown;
@Column
@ColDefine(type = ColType.VARCHAR, width = 10)
@Comment("学历")
private String education;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("兴趣爱好")
private String hobby;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("子女情况")
private String childrenSituation;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("月收入")
private String monthlyIncome;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("住房情况")
private String housingSituation;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("上传照片")
private List<Sys_file> picFiles;
@Column
@ColDefine(type = ColType.VARCHAR,width = 32)
@Comment("形象照片")
private String photo;
@Column
@ColDefine(type = ColType.VARCHAR, width = 10)
@Comment("婚姻状况")
private String maritalStatus;
@Column
@ColDefine(type = ColType.TEXT)
@Comment("交友意向")
private String intentionFriends;
@Column
@ColDefine(type = ColType.TEXT)
@Comment("个人介绍")
private String personalIntroduction;
@Column
@ColDefine(type = ColType.VARCHAR,width = 32)
@Comment("申请分工会审核ID")
private String unionAuditId;
@Column
@ColDefine(type = ColType.VARCHAR,width = 32)
@Comment("申请校工会审核ID")
private String schoolAuditId;
@Column
@ColDefine(type = ColType.VARCHAR,width = 32)
@Comment("退会分工会审核ID")
private String exitUnionAuditId;
@Column
@ColDefine(type = ColType.VARCHAR,width = 32)
@Comment("退会校工会审核ID")
private String exitSchoolAuditId;
@Column
@ColDefine(type = ColType.VARCHAR,width = 10)
@Comment("状态")
private String singleState;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("申请时间")
private Date applyTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("加入时间")
private Date joinTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("退出时间")
private Date exitTime;
}
@@ -1,22 +1,22 @@
package io.v.nutz.single.service; package io.v.nutz.single.service;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.service.ViService; import io.v.nutz.service.ViService;
import io.v.nutz.sys.models.Sys_user; import io.v.nutz.single.model.SingleUser;
import org.nutz.dao.sql.Sql;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import java.util.List; import java.util.List;
public interface SingleUserService extends ViService<Sys_user> { public interface SingleUserService extends ViService<SingleUser> {
Pagination singlePageList(Integer pageNumber,Integer pageSize, String unionId, String unitId, String threeUnitId, Sql singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes,
String unionGroupId, String[] personTypes, String[] userStates, String[] userStates, String[] age, String campus, String sex, Integer memberStatus, String position,
String campus, String sex, Integer memberStatus, String position, String jobTitle, String searchName, String searchKeyWord,Boolean isJoin,String education,String maritalStatus);
String jobTitle, String searchName, String searchKeyWord);
List<NutMap> singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes,
String[] userStates, String campus, String sex, Integer memberStatus, String position,
String jobTitle, String searchName, String searchKeyWord);
List<NutMap> singleStatisticsList(String[] personTypes,String unionId,String unitId,String analyze); List<NutMap> singleStatisticsList(String[] personTypes,String unionId,String unitId,String analyze);
NutMap findOne(String id);
Object getAuditNum(String auditType,String isAudit,String unionId);
} }
@@ -1,18 +1,21 @@
package io.v.nutz.single.service.impl; package io.v.nutz.single.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.page.Pagination; import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.dao.CndPlus; import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.Audit;
import io.v.nutz.service.impl.ViServiceImpl; import io.v.nutz.service.impl.ViServiceImpl;
import io.v.nutz.single.model.SingleUser;
import io.v.nutz.single.service.SingleUserService; import io.v.nutz.single.service.SingleUserService;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
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.dao.util.cri.SqlExpressionGroup; import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
@@ -21,237 +24,224 @@ import org.nutz.lang.util.NutMap;
import java.util.List; import java.util.List;
@IocBean(args = {"refer:dao"}) @IocBean(args = {"refer:dao"})
public class SingleUserServiceImpl extends ViServiceImpl<Sys_user> implements SingleUserService { public class SingleUserServiceImpl extends ViServiceImpl<SingleUser> implements SingleUserService {
public SingleUserServiceImpl(Dao dao) { public SingleUserServiceImpl(Dao dao) {
super(dao); super(dao);
} }
@Inject
private BaseService baseService;
@Override @Override
public Pagination singlePageList(Integer pageNumber,Integer pageSize, String unionId, String unitId, String threeUnitId, public List<NutMap> singleStatisticsList(String[] personTypes, String unionId, String unitId, String analyze) {
String unionGroupId, String[] personTypes, String[] userStates,
String campus, String sex, Integer memberStatus, String position,
String jobTitle, String searchName, String searchKeyWord) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT
id,
loginname,
username,
sex,
birthday,
mobile,
idcard,
personType,
userState,
unionid,
unioncode,
unionname,
unitid,
unitname,
unitcode,
threeUnitName,
threeUnitCode,
unionGroupName,
position,
jobTitle,
campusName,
marriage,
education,
hometown,
nation
From
user
$condition
""");
CndPlus cnd = CndPlus.create();
cnd.and("marriage","=","未婚");
cnd.andEX("unionid", "=", unionId);
cnd.andEX("unitId", "=", unitId);
cnd.andEX("threeUnitId", "=", threeUnitId);
cnd.andEX("unionGroupId", "=", unionGroupId);
if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) {
cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord));
}
if (personTypes != null && personTypes.length > 0) {
cnd.andEX("personType", "in", personTypes);
}
if (userStates != null && userStates.length > 0) {
cnd.andEX("userState", "in", userStates);
}
cnd.andEX("campusName", "=", campus);
cnd.andEX("sex", "=", sex);
/*cnd.andEX("member", "=", 1);*/
cnd.andEX("memberStatus", "=", memberStatus);
if (Strings.isNotBlank(position)) {
cnd.where().andLike("position", position);
}
if (Strings.isNotBlank(jobTitle)) {
cnd.where().andLike("jobTitle", jobTitle);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
if (ShiroUtil.hasRole("H04")) {
cnd.and("unionId", "=", Vi.getUnionId());
} else if (ShiroUtil.hasRole("ghxzzz")) {
cnd.and("unionId", "=", Vi.getUnionId());
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
seg.or("unionGroupId", "is", null);
cnd.and(seg);
}
}
sql.setCondition(cnd);
return listPageMap(pageNumber,pageSize,sql);
}
@Override
public List<NutMap> singleStatisticsList(String[] personTypes,String unionId, String unitId,String analyze) {
Sql sql = null;
CndPlus cnd = CndPlus.create();
if ("0".equals(analyze)){//按分工会统计
sql = Sqls.create("""
SELECT SELECT
un.id, un.id,
un.unioncode AS unionCode, $code AS unCode,
unionName, $name AS unName,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<25 $personCnd) AS lessTwentyFive, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<25 $personCnd) AS lessTwentyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=25 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=30 $personCnd) AS thirty, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=25 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=30 $personCnd) AS thirty,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=35 $personCnd) AS thirtyFive, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd) AS forty, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=40 $personCnd) AS forty,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=45 $personCnd) AS fortyFive, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=45 $personCnd) AS fortyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd) AS fifty, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=50 $personCnd) AS fifty,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd) AS fiftyFive, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd $yearCnd) AS moreFiftyFive, ( $matchSql $singleCnd un.id = $unId AND TIMESTAMPDIFF (YEAR,su.birthday,CURDATE())>55 $personCnd $yearCnd) AS moreFiftyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and un.id = unionid $personCnd) totalNumber, ( $matchSql $singleCnd un.id = $unId $personCnd) totalNumber,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and sex = '男' AND un.id = unionid $personCnd) male, ( $matchSql $singleCnd sex = '男' AND un.id = $unId $personCnd) male,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' and sex = '女' AND un.id = unionid $personCnd) female ( $matchSql $singleCnd sex = '女' AND un.id = $unId $personCnd) female
FROM FROM
sys_union un $table un
$condition $condition
"""); """);
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) { CndPlus cnd = CndPlus.create();
cnd.and("un.id", "=", Vi.getUnionId()); sql.setVar("matchSql", " SELECT COUNT( 1 ) FROM `single_user` su left join `user` u on su.userId=u.id where ");
} sql.setVar("code", "0".equals(analyze) ? "un.unioncode" : "un.unitcode");
if(StrUtil.isNotBlank(unionId)) { sql.setVar("name", "0".equals(analyze) ? "un.unionname" : "un.`name`");
cnd.and("un.id", "=", unionId); sql.setVar("unId", "0".equals(analyze) ? "u.unionid" : "u.unitid");
} sql.setVar("table", "0".equals(analyze) ? "sys_union" : "sys_unit");
sql.setVar("singleCnd", " su.singleState in (8030,8040,8045,8050,8055) and ");
if ("0".equals(analyze)) {
//工会
cnd.andEX("un.id", "=", unionId);
cnd.asc("un.unioncode"); cnd.asc("un.unioncode");
}else if ("1".equals(analyze)){//按单位统计 } else {
sql = Sqls.create(""" //单位
SELECT if (StrUtil.isNotBlank(unitId)) {
un.id, cnd.and("un.id", "=", unitId);
un.unitcode AS unitCode, }
`name` AS unitName, cnd.and("un.unitlevel", "=", 2).and("un.unitcode", "!=", "000");
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<25 $personCnd) AS lessTwentyFive, cnd.asc("un.unitcode");
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=26 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=30 $personCnd) AS thirty, }
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=31 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=35 $personCnd) AS thirtyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=36 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=40 $personCnd) AS forty,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=41 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=45 $personCnd) AS fortyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=46 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=50 $personCnd) AS fifty,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>=51 AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())<=55 $personCnd) AS fiftyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid AND TIMESTAMPDIFF (YEAR,birthday,CURDATE())>55 $personCnd) AS moreFiftyFive,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND un.id = unitid $personCnd) totalNumber,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND sex = '男' AND un.id = unitid $personCnd) male,
( SELECT COUNT( 1 ) FROM `user` where marriage='未婚' AND sex = '女' AND un.id = unitid $personCnd) female
FROM
sys_unit un
$condition
""");
if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) { if (!ShiroUtil.hasAnyRoles(Lang.array("sysadmin", "A06", "H03"))) {
cnd.and("un.unionid", "=", Vi.getUnionId()); cnd.and("un.unionid", "=", Vi.getUnionId());
} }
if(StrUtil.isNotBlank(unitId)) {
cnd.and("un.id", "=", unitId);
}
cnd.and("unitlevel", "=", 2).and("unitcode", "!=", "000");
cnd.asc("un.unitcode");
}
if (personTypes != null && personTypes.length > 0) { if (personTypes != null && personTypes.length > 0) {
String join = StringUtils.join(personTypes, "','"); String join = StringUtils.join(personTypes, "','");
sql.setVar("personCnd", "and personType in ('" + join + "')"); sql.setVar("personCnd", "and u.personType in ('" + join + "')");
} }
assert sql != null; cnd.groupBy("un.id");
sql.setCondition(cnd); sql.setCondition(cnd);
return listMap(sql); return listMap(sql);
} }
@Override @Override
public List<NutMap> singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId, String[] personTypes, String[] userStates, String campus, String sex, Integer memberStatus, String position, String jobTitle, String searchName, String searchKeyWord) { public Sql singlePageList(String unionId, String unitId, String threeUnitId, String unionGroupId,
String[] personTypes, String[] userStates, String[] age, String campus, String sex,
Integer memberStatus, String position, String jobTitle, String searchName,
String searchKeyWord, Boolean isJoin, String education, String maritalStatus) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
id, su.*,
loginname, u.loginname,
username, u.username,
sex, u.sex,
birthday, u.idcard,
mobile, u.personType,
idcard, u.userState,
personType, u.unionname,
userState, u.unitname,
unionid, u.threeUnitName,
unioncode, u.unionGroupName
unionname, FROM
unitid, `single_user` su
unitname, LEFT JOIN `user` u ON u.id = su.userId
unitcode,
threeUnitName,
threeUnitCode,
unionGroupName,
position,
jobTitle,
campusName,
marriage,
education,
hometown,
nation
From
user
$condition $condition
"""); """);
CndPlus cnd = CndPlus.create(); CndPlus cnd = CndPlus.create();
cnd.and("marriage","=","未婚"); cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("unionid", "=", unionId); cnd.andEX("u.unitId", "=", unitId);
cnd.andEX("unitId", "=", unitId); cnd.andEX("u.threeUnitId", "=", threeUnitId);
cnd.andEX("threeUnitId", "=", threeUnitId); cnd.andEX("u.unionGroupId", "=", unionGroupId);
cnd.andEX("unionGroupId", "=", unionGroupId); cnd.andEX("su.education", "=", education);
cnd.andEX("su.maritalStatus", "=", maritalStatus);
cnd.and("su.singleState", "in", isJoin ? Lang.list(8030, 8040, 8045, 8050, 8055) : Lang.list(8060));
if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) { if (StrUtil.isNotBlank(searchName) && Strings.isNotBlank(searchKeyWord)) {
cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord)); cnd.and(new SqlExpressionGroup().andLike(searchName, searchKeyWord));
} }
if (personTypes != null && personTypes.length > 0) { if (personTypes != null && personTypes.length > 0) {
cnd.andEX("personType", "in", personTypes); cnd.andEX("u.personType", "in", personTypes);
} }
if (userStates != null && userStates.length > 0) { if (userStates != null && userStates.length > 0) {
cnd.andEX("userState", "in", userStates); cnd.andEX("u.userState", "in", userStates);
} }
cnd.andEX("campusName", "=", campus);
cnd.andEX("sex", "=", sex); if (!Lang.isEmptyArray(age)) {
if (!age[1].equals("0")) {
cnd.and("TIMESTAMPDIFF(YEAR, u.birthday, CURDATE())", "between", age);
}
}
cnd.andEX("u.campusName", "=", campus);
cnd.andEX("u.sex", "=", sex);
/*cnd.andEX("member", "=", 1);*/ /*cnd.andEX("member", "=", 1);*/
cnd.andEX("memberStatus", "=", memberStatus); cnd.andEX("u.memberStatus", "=", memberStatus);
if (Strings.isNotBlank(position)) { if (Strings.isNotBlank(position)) {
cnd.where().andLike("position", position); cnd.where().andLike("u.position", position);
} }
if (Strings.isNotBlank(jobTitle)) { if (Strings.isNotBlank(jobTitle)) {
cnd.where().andLike("jobTitle", jobTitle); cnd.where().andLike("u.jobTitle", jobTitle);
} }
if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) { if (!ShiroUtil.hasAnyRoles("sysadmin,H03,A06")) {
if (ShiroUtil.hasRole("H04")) { if (ShiroUtil.hasRole("H04")) {
cnd.and("unionId", "=", Vi.getUnionId()); cnd.and("u.unionId", "=", Vi.getUnionId());
} else if (ShiroUtil.hasRole("ghxzzz")) { } else if (ShiroUtil.hasRole("ghxzzz")) {
cnd.and("unionId", "=", Vi.getUnionId()); cnd.and("u.unionId", "=", Vi.getUnionId());
SqlExpressionGroup seg = new SqlExpressionGroup(); SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or("unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds()); seg.or("u.unionGroupId", "in", io.v.nutz.web.commons.utils.ShiroUtil.getUnionGroupIds());
seg.or("unionGroupId", "is", null); seg.or("u.unionGroupId", "is", null);
cnd.and(seg); cnd.and(seg);
} }
} }
sql.setCondition(cnd); sql.setCondition(cnd);
return listMap(sql); return sql;
}
@Override
public NutMap findOne(String id) {
Sql sql = Sqls.create("""
SELECT
su.*,
u.unionname AS unionName,
u.unitname AS unitName,
u.username,
u.sex,
u.loginname,
u.userState,
u.personType
FROM
`single_user` su
LEFT JOIN `user` u ON u.id = su.userId
where su.id=@id
""").setParam("id", id);
NutMap nutMap = (NutMap) baseService.listMap(sql).stream().findFirst().orElse(null);
if (Strings.isNotBlank(nutMap.getString("unionAuditId"))) {
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("unionAuditId")));
nutMap.setv("unionAudit", audit);
}
if (Strings.isNotBlank(nutMap.getString("schoolAuditId"))) {
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("schoolAuditId")));
nutMap.setv("schoolAudit", audit);
}
if (Strings.isNotBlank(nutMap.getString("exitUnionAuditId"))) {
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("exitUnionAuditId")));
nutMap.setv("exitUnionAudit", audit);
}
if (Strings.isNotBlank(nutMap.getString("exitSchoolAuditId"))) {
Audit audit = baseService.dao().fetch(Audit.class, Cnd.where("id", "=", nutMap.getString("exitSchoolAuditId")));
nutMap.setv("exitSchoolAudit", audit);
}
return nutMap;
}
@Override
public Object getAuditNum(String auditType, String isAudit, String unionId) {
String sqlStr = """
SELECT
COUNT(*)
FROM
`single_user` su
LEFT JOIN `user` u ON u.id = su.userId
$condition
""";
CndPlus joinCnd = CndPlus.create();
CndPlus exitCnd = CndPlus.create();
String result = "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=";
if ("union".equals(auditType)) {
joinCnd.and("su.singleState", result, 8010);
exitCnd.and("su.singleState", result, 8040);
} else if ("school".equals(auditType)) {
joinCnd.and("su.singleState", result, 8020);
exitCnd.and("su.singleState", result, 8050);
}
joinCnd.and("su.singleState", "<=", 8030);
exitCnd.and("su.singleState", ">", 8030);
if (ShiroUtil.hasAnyRoles("H04")) {
exitCnd.andEX("u.unionId", "=", Vi.getUnionId());
joinCnd.andEX("u.unionId", "=", Vi.getUnionId());
} else {
exitCnd.andEX("u.unionId", "=", unionId);
joinCnd.andEX("u.unionId", "=", unionId);
}
Sql sqlJoin = Sqls.create(sqlStr);
sqlJoin.setCondition(joinCnd);
Sql sqlExit = Sqls.create(sqlStr);
sqlExit.setCondition(exitCnd);
int joinCount = this.count(sqlJoin);
int exitCount = this.count(sqlExit);
NutMap nutMap = new NutMap();
nutMap.setv("joinCount", joinCount);
nutMap.setv("exitCount", exitCount);
return nutMap;
} }
} }
File diff suppressed because one or more lines are too long
@@ -47,6 +47,20 @@
</div> </div>
</div> </div>
<div class="search-item">
<div class="search-item-label">所属工会</div>
<div class="search-item-option">
<el-select @change="flushUnits" @clear="flushUnits"
clearable="true"
filterable="true"
placeholder="所属工会" style="width: 100%;"
v-model="pageForm.unionId">
<el-option :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</div>
</div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">所属单位</div> <div class="search-item-label">所属单位</div>
<div class="search-item-option"> <div class="search-item-option">
@@ -118,15 +132,20 @@
<el-card shadow="never" class="mt10"> <el-card shadow="never" class="mt10">
<table-tool :label="currentGroupName" :app="this"> <table-tool :label="currentGroupName" :app="this">
<template #label_end> <template #label_end>
<!-- <span class="text-danger pl5">提醒删除活动分组操作请先选择某个活动分组后再点击右边的删除按钮</span>--> <!-- <span class="text-danger pl5">提醒删除活动分组操作请先选择某个活动分组后再点击右边的删除按钮</span>-->
</template> </template>
<template #func> <template #func>
<el-button v-if="is_sysadmin||is_A06"
type="primary" size="medium" icon="el-icon-printer" @click="openImport">
导入XLSX查询
</el-button>
<el-button @click="doExportUser" icon="el-icon-printer" <el-button @click="doExportUser" icon="el-icon-printer"
size="medium" type="primary" :disabled="!pageForm.groupId"> size="medium" type="primary" :disabled="!pageForm.groupId">
导出活动分组人员xlsx 导出活动分组人员xlsx
</el-button> </el-button>
<el-button @click="doDelete(null,pageForm.groupId)" <el-button @click="doDelete(null)"
type="danger" type="danger"
size="medium" :disabled="tableData.length===0"> size="medium" :disabled="tableData.length===0">
删除{{ currentGroupName }} 删除{{ currentGroupName }}
@@ -146,7 +165,7 @@
></el-table-column> ></el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100"> <el-table-column align="center" header-align="center" label="操作" width="100">
<template scope="{row}"> <template scope="{row}">
<el-button size="mini" type="danger" @click="doDelete(row.id,null)">删除 <el-button size="mini" type="danger" @click="doDelete(row.id)">删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -164,6 +183,69 @@
</el-row> </el-row>
</el-card> </el-card>
<el-dialog title="人员导入" :visible.sync="dialogVisible" width="50%"
:close-on-click-modal="false" append-to-body>
<el-timeline>
<el-timeline-item timestamp="下载模板" placement="top">
<el-card>
<el-button size="medium" type=""
@click="window.open('/platform/activity/basic/user/downloadImport')"
icon="el-icon-download">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="上传文件" placement="top">
<el-card>
<el-upload
name="file"
ref="upload"
:on-remove="(file, fileList) => {
importData.fileList = fileHandleRemove(file, fileList)
}"
:on-change="(file, fileList) => {
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
}"
:auto-upload="false"
:limit="1"
:file-list="importData.fileList">
<el-button size="medium" type="" icon="el-icon-upload"
style="width: 200px">选择文件
</el-button>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="导入结果">
<el-card shadow="never">
<p>总记录数:{{ errorInfoData.totalCount }}</p>
<p>成功数:<span class="text-success">{{ errorInfoData.successCount }}</span></p>
<p>错误数:<span class="text-danger">{{ errorInfoData.errorCount }}</span></p>
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount>0">下载错误记录
</el-link>
</el-card>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" type="primary"
:disabled="importLoading">取 消</el-button>
<el-button type="primary" @click="clearSearchCnd"
:loading="importLoading">清空查询条件</el-button>
<el-button type="primary" @click="doImport"
:loading="importLoading">核对人员</el-button>
<el-button type="primary" @click="doImportSearch"
:loading="importLoading">查询人员</el-button>
</span>
</el-dialog>
</div> </div>
@@ -215,6 +297,7 @@ module.exports = {
memberStatus: [], memberStatus: [],
year: moment().format('YYYY') year: moment().format('YYYY')
}, },
isShowRadio: false,
tableColumns: [ tableColumns: [
{prop: 'loginName', label: '工号'}, {prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'}, {prop: 'userName', label: '姓名'},
@@ -225,18 +308,129 @@ module.exports = {
{prop: 'userState', label: '在职状态', sortable: true}, {prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true}, {prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'unionName', label: '所属工会', sortable: true}, {prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'activityUnionName', label: '活动工会', sortable: true},
{prop: 'groupName', label: '所属分组', sortable: true}, {prop: 'groupName', label: '所属分组', sortable: true},
], ],
roleData: {}, roleData: {},
errorInfoData: {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
},
currentGroupName: null, currentGroupName: null,
dialogVisible: false,
importLoading: false,
importData: {
fileList: [],
},
successUserIdList: []
} }
}, },
mixins: [initTableMixins], mixins: [initTableMixins],
components: { components: {
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0') 'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'file-import': httpVueLoader('/components/plugins/FileImport.vue')
}, },
methods: { methods: {
clearSearchCnd() {
this.importData = {
fileList: [],
}
this.errorInfoData = {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: [],
}
this.pageForm.userIds = []
this.successUserIdList = []
this.doSearch()
this.dialogVisible = false;
$.get('/platform/activity/basic/user/clearSearchCnd', {existsLoginNameRedisKey: this.pageForm.existsLoginNameRedisKey}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
},
doImportSearch() {
this.doSearch()
this.dialogVisible = false
},
exportErrors() {
const data = this.errorInfoData.errorList
// 创建工作簿
const workbook = XLSX.utils.book_new();
// 创建工作表
const worksheet = XLSX.utils.json_to_sheet(data);
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// 将工作簿转换为二进制对象
const excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
// 将二进制对象转换为Blob对象
const blob = new Blob([excelBuffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
// 创建下载链接并设置相关属性
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '核对记录.xlsx';
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
// 清理下载链接
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
doImport() {
if (this.importData.fileList.length === 0) {
this.notifyWarning("请选择文件")
return
}
const data = new FormData();
data.append("groupId", this.pageForm.groupId)
this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name);
});
this.importLoading = true
$.ajax({
url: "/platform/activity/basic/user/doImport",
type: "post",
data: data,
processData: false,
contentType: false,
success: (data) => {
this.importLoading = false
if (data.code === 0) {
this.notifySuccess("核对成功")
this.errorInfoData = data.data
} else {
this.notifyWarning("核对失败")
}
this.errorInfoData = data.data
this.pageForm.existsLoginNameRedisKey = data.data.existsLoginNameRedisKey
},
error: (data) => {
this.notifyWarning("导入失败")
this.importLoading = false
}
});
},
openImport() {
this.dialogVisible = true;
},
viewGroupName() { viewGroupName() {
if (this.pageForm.groupId) { if (this.pageForm.groupId) {
const group = this.activityGroupList.find(v => v.groupId === this.pageForm.groupId) const group = this.activityGroupList.find(v => v.groupId === this.pageForm.groupId)
@@ -248,24 +442,30 @@ module.exports = {
doExportUser() { doExportUser() {
window.open("/platform/activity/basic/user/doExportUser?groupId=" + this.pageForm.groupId) window.open("/platform/activity/basic/user/doExportUser?groupId=" + this.pageForm.groupId)
}, },
doSearch2() { async getRolesAndUnion() {
this.getActivityGroup() const {data} = await $.post("/platform/activity/basic/scope/getRolesAndUnion")
this.doSearch() this.roleData = data
}, },
async doDelete(id, groupId) { // doSearch2() {
// this.getActivityGroup()
// this.doSearch()
// },
async doDelete(id) {
const confirm = await this.$confirm('您确定要删除吗?', '提示', { const confirm = await this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
if (confirm === 'confirm') { if (confirm === 'confirm') {
const resp = await $.post('/platform/activity/basic/user/doDelete', {id, groupId}) let pageForm = clone(this.pageForm)
pageForm.id = id
const resp = await $.post('/platform/activity/basic/user/doDelete', pageForm)
if (resp.code === 0) { if (resp.code === 0) {
this.$message.success(resp.msg) this.$message.success(resp.msg)
this.$set(this.pageForm, "groupId", null) await this.getActivityGroup(this.pageForm.groupId)
this.doSearch()
await this.getActivityGroup()
this.$emit('group_change') this.$emit('group_change')
} else {
} }
} }
}, },
@@ -273,19 +473,25 @@ module.exports = {
this.$set(this.pageForm, "unitId", "") this.$set(this.pageForm, "unitId", "")
if (this.is_A06 || this.is_sysadmin || this.is_H03) { if (this.is_A06 || this.is_sysadmin || this.is_H03) {
this.units = await getUnits(this.pageForm.unionId) this.units = await getUnits(this.pageForm.unionId)
this.ActivityUnits = await getActivityUnits(this.pageForm.activityUnionId) this.ActivityUnits = await getActivityUnits(this.pageForm.unionId)
} else { } else {
this.units = await getUnits(this.unionid) this.units = await getUnits(this.unionid)
} }
}, },
async getActivityGroup() { async getActivityGroup(id) {
this.pageForm.groupId = ''
const resp = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup') const resp = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = resp.data this.activityGroupList = resp.data
if (resp.data && resp.data.length > 0) { debugger
if (id) {
if (this.activityGroupList.some(v => v.groupId === id)) {
this.$set(this.pageForm, "groupId", id)
} else {
this.$set(this.pageForm, "groupId", resp.data[0].groupId) this.$set(this.pageForm, "groupId", resp.data[0].groupId)
} }
await this.pageData() } else {
this.$set(this.pageForm, "groupId", resp.data[0].groupId)
}
await this.doSearch()
}, },
async pageData() { async pageData() {
sublime.showLoadingbar() sublime.showLoadingbar()
@@ -297,6 +503,7 @@ module.exports = {
sublime.closeLoadingbar() sublime.closeLoadingbar()
}, },
}, },
async created() { async created() {
this.unions = await getUnions(null) this.unions = await getUnions(null)
@@ -304,7 +511,7 @@ module.exports = {
await this.flushUnits() await this.flushUnits()
await this.getActivityGroup() await this.getActivityGroup()
this.viewGroupName() this.viewGroupName()
await this.getRolesAndUnion()
} }
} }
</script> </script>
@@ -17,8 +17,8 @@
</el-row> </el-row>
<el-row class="query-row" <el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true"> v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
<el-col class="query-title hidden-xs-only">员类型</el-col> <el-col class="query-title hidden-xs-only">员类型</el-col>
<el-col class="query-content"> <el-col class="query-content">
<el-tag <el-tag
:effect="pageForm.memberTypes.includes(item.name)?'dark':'plain'" :effect="pageForm.memberTypes.includes(item.name)?'dark':'plain'"
@@ -32,6 +32,21 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row class="query-row" v-if="pageForm.memberTypes.includes('单身教工')">
<el-col class="query-title hidden-xs-only">婚姻状况</el-col>
<el-col class="query-content">
<el-tag
:effect="pageForm.maritalTypes.includes(item.name)?'dark':'plain'"
:key="item.code"
:type="item.name"
@click="tagClick('maritalTypes',item.name)"
style="margin-right: 10px;cursor: pointer"
v-for="item in maritalOptions">
{{ item.name }}
</el-tag>
</el-col>
</el-row>
<el-row class="query-row"> <el-row class="query-row">
<el-col class="query-title hidden-xs-only">性别</el-col> <el-col class="query-title hidden-xs-only">性别</el-col>
<el-col class="query-content"> <el-col class="query-content">
@@ -280,6 +295,10 @@
<el-card class="mt10" shadow="never"> <el-card class="mt10" shadow="never">
<table-tool :app="this" label="筛选人员"> <table-tool :app="this" label="筛选人员">
<template #func> <template #func>
<el-button v-if="is_sysadmin||is_A06"
type="primary" size="medium" icon="el-icon-printer" @click="openImport">
导入XLSX设置分组
</el-button>
<el-button @click="doExportUser" <el-button @click="doExportUser"
size="medium" size="medium"
type="primary" icon="el-icon-download"> type="primary" icon="el-icon-download">
@@ -350,9 +369,74 @@
v-loading="settingLoading"> </el-button> v-loading="settingLoading"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="人员导入" :visible.sync="dialogVisible" width="50%" :close-on-click-modal="false" append-to-body>
<el-timeline>
<el-timeline-item timestamp="下载模板" placement="top">
<el-card>
<el-button size="medium" type=""
@click="window.open('/platform/activity/basic/user/downloadImport')"
icon="el-icon-download">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="上传文件" placement="top">
<el-card>
<el-upload
name="file"
ref="upload"
:on-remove="(file, fileList) => {
importData.fileList = fileHandleRemove(file, fileList)
}"
:on-change="(file, fileList) => {
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
}"
:auto-upload="false"
:limit="1"
:file-list="importData.fileList">
<el-button size="medium" type="" icon="el-icon-upload"
style="width: 200px">选择文件
</el-button>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="导入结果">
<el-card shadow="never">
<p>总记录数:{{ errorInfoData.totalCount }}</p>
<p>成功数:<span class="text-success">{{ errorInfoData.successCount }}</span></p>
<p>错误数:<span class="text-danger">{{ errorInfoData.errorCount }}</span></p>
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount>0">下载错误记录
</el-link>
</el-card>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" type="primary"
:disabled="importLoading">取 消</el-button>
<el-button type="primary" @click="clearSearchCnd"
:loading="importLoading">清空查询条件</el-button>
<el-button type="primary" @click="doImport" :loading="importLoading">核对人员</el-button>
<el-button type="primary" @click="doImportSearch"
:loading="importLoading">查询人员</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script src="${base!}/assets/platform/plugins/xlsx/xlsx.full.min.js"></script>
<script> <script>
module.exports = { module.exports = {
@@ -381,6 +465,22 @@ module.exports = {
}, { }, {
code: 'sickFundMember', code: 'sickFundMember',
name: '基金会员' name: '基金会员'
}, {
code: 'singleUser',
name: '单身教工'
}, {
code: 'thirtyTeacher',
name: '30教龄教工'
}],
maritalOptions: [{
code: 'unmarried',
name: '未婚',
}, {
code: 'divorce',
name: '离婚',
}, {
code: 'bereave',
name: '丧偶',
}], }],
sexTypeOptions: [ sexTypeOptions: [
{code: '男', name: '男'}, {code: '男', name: '男'},
@@ -396,6 +496,7 @@ module.exports = {
userStates: [], userStates: [],
memberStatus: [], memberStatus: [],
memberTypes: [], memberTypes: [],
maritalTypes: [],
sexTypes: [], sexTypes: [],
minAge: 0, minAge: 0,
maxAge: 0, maxAge: 0,
@@ -427,6 +528,8 @@ module.exports = {
{prop: 'userState', label: '在职状态', sortable: true}, {prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true}, {prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'unionName', label: '所属工会', sortable: true}, {prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'maritalStatus', label: '婚姻状况', sortable: true, checked: 0},
{prop: 'teachNum', label: '教龄', sortable: true, checked: 0},
// {prop: 'activityUnionName', label: '活动工会', sortable: true}, // {prop: 'activityUnionName', label: '活动工会', sortable: true},
], ],
rules: { rules: {
@@ -435,7 +538,19 @@ module.exports = {
setGroupName: [{required: true, message: '请输入分组名称', trigger: ['blur', 'change']}] setGroupName: [{required: true, message: '请输入分组名称', trigger: ['blur', 'change']}]
}, },
relatedSessionMenus: ['aca4d14498c145ceb5b24ed70776aae2', '733d7266652740a3aeac9da97ab5eeca', 'fe2d0768e26d4a80beeb159306bb8d01'], relatedSessionMenus: ['aca4d14498c145ceb5b24ed70776aae2', '733d7266652740a3aeac9da97ab5eeca', 'fe2d0768e26d4a80beeb159306bb8d01'],
roleData: {} roleData: {},
dialogVisible: false,
importLoading: false,
importData: {
fileList: [],
},
errorInfoData: {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
},
} }
}, },
computed: { computed: {
@@ -462,10 +577,109 @@ module.exports = {
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'), 'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'),
}, },
methods: { methods: {
exportErrors() {
const data = this.errorInfoData.errorList
// 创建工作簿
const workbook = XLSX.utils.book_new();
// 创建工作表
const worksheet = XLSX.utils.json_to_sheet(data);
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// 将工作簿转换为二进制对象
const excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
// 将二进制对象转换为Blob对象
const blob = new Blob([excelBuffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
// 创建下载链接并设置相关属性
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '核对记录.xlsx';
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
// 清理下载链接
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
doImportSearch() {
this.doSearch()
this.dialogVisible = false
},
doImport() {
if (this.importData.fileList.length === 0) {
this.notifyWarning("请选择文件")
return
}
const data = new FormData();
this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name);
});
this.importLoading = true
$.ajax({
url: "/platform/activity/basic/scope/doImport",
type: "post",
data: data,
processData: false,
contentType: false,
success: (data) => {
this.importLoading = false
if (data.code === 0) {
this.notifySuccess("核对成功")
this.errorInfoData = data.data
} else {
this.notifyWarning("核对失败")
}
this.errorInfoData = data.data
this.pageForm.existsLoginNameRedisKey = data.data.existsLoginNameRedisKey
},
error: (data) => {
this.notifyWarning("导入失败")
this.importLoading = false
}
});
},
clearSearchCnd() {
this.importData = {
fileList: [],
}
this.errorInfoData = {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: [],
}
this.pageForm.userIds = []
this.successUserIdList = []
this.doSearch()
this.dialogVisible = false;
$.get('/platform/activity/basic/scope/clearSearchCnd', {existsLoginNameRedisKey: this.pageForm.existsLoginNameRedisKey}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
},
openImport() {
this.dialogVisible = true;
},
doExportUser() { doExportUser() {
const { const {
userId, userId,
memberTypes, memberTypes,
maritalTypes,
sexTypes, sexTypes,
personTypes, personTypes,
userStates, userStates,
@@ -487,6 +701,7 @@ module.exports = {
window.open("/platform/activity/basic/scope/doExportUser?userId=" + JSON.stringify(userId) + window.open("/platform/activity/basic/scope/doExportUser?userId=" + JSON.stringify(userId) +
"&props=" + JSON.stringify(props) + "&props=" + JSON.stringify(props) +
"&memberTypes=" + JSON.stringify(memberTypes) + "&memberTypes=" + JSON.stringify(memberTypes) +
"&maritalTypes=" + JSON.stringify(maritalTypes) +
"&sexTypes=" + JSON.stringify(sexTypes) + "&sexTypes=" + JSON.stringify(sexTypes) +
"&personTypes=" + JSON.stringify(personTypes) + "&personTypes=" + JSON.stringify(personTypes) +
"&userStates=" + JSON.stringify(userStates) + "&userStates=" + JSON.stringify(userStates) +
@@ -504,6 +719,7 @@ module.exports = {
doReset() { doReset() {
this.pageForm.userId = [] this.pageForm.userId = []
this.pageForm.memberTypes = [] this.pageForm.memberTypes = []
this.pageForm.maritalTypes = []
this.pageForm.sexTypes = [] this.pageForm.sexTypes = []
this.pageForm.personTypes = [] this.pageForm.personTypes = []
this.pageForm.userStates = [] this.pageForm.userStates = []
@@ -549,6 +765,7 @@ module.exports = {
pageForm.userStates = JSON.stringify(pageForm.userStates) pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.memberStatus = JSON.stringify(pageForm.memberStatus) pageForm.memberStatus = JSON.stringify(pageForm.memberStatus)
pageForm.memberTypes = JSON.stringify(pageForm.memberTypes) pageForm.memberTypes = JSON.stringify(pageForm.memberTypes)
pageForm.maritalTypes = JSON.stringify(pageForm.maritalTypes)
pageForm.sexTypes = JSON.stringify(pageForm.sexTypes) pageForm.sexTypes = JSON.stringify(pageForm.sexTypes)
pageForm.roleIds = JSON.stringify(pageForm.roleIds) pageForm.roleIds = JSON.stringify(pageForm.roleIds)
pageForm.userId = JSON.stringify(pageForm.userId) pageForm.userId = JSON.stringify(pageForm.userId)
@@ -587,6 +804,7 @@ module.exports = {
pageForm.userStates = JSON.stringify(pageForm.userStates) pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.memberStatus = JSON.stringify(pageForm.memberStatus) pageForm.memberStatus = JSON.stringify(pageForm.memberStatus)
pageForm.memberTypes = JSON.stringify(pageForm.memberTypes) pageForm.memberTypes = JSON.stringify(pageForm.memberTypes)
pageForm.maritalTypes = JSON.stringify(pageForm.maritalTypes)
pageForm.sexTypes = JSON.stringify(pageForm.sexTypes) pageForm.sexTypes = JSON.stringify(pageForm.sexTypes)
pageForm.roleIds = JSON.stringify(pageForm.roleIds) pageForm.roleIds = JSON.stringify(pageForm.roleIds)
pageForm.userId = JSON.stringify(pageForm.userId) pageForm.userId = JSON.stringify(pageForm.userId)
@@ -14,12 +14,14 @@
<link rel="stylesheet" href="${base!}/assets/mobile/css/theme.css"> <link rel="stylesheet" href="${base!}/assets/mobile/css/theme.css">
<link rel="stylesheet" href="${base!}/assets/mobile/css/main.css"> <link rel="stylesheet" href="${base!}/assets/mobile/css/main.css">
<!-- <script src="https://cdn.staticfile.org/vant/2.12.25/vant.min.js"></script>--> <!-- <script src="${base!}/assets/platform/plugins/vant/vant.min.js"></script>-->
<script src="${base!}/assets/platform/plugins/vant/vant.min.js"></script>
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script> <script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
<script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script> <script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script>
<script src="${base!}/assets/mobile/js/basic.js"></script> <script src="${base!}/assets/mobile/js/basic.js"></script>
<!-- <script src="https://cdn.staticfile.org/vant/2.12.25/vant.min.js"></script>-->
<script src="${base!}/assets/platform/plugins/vant/vant.min.js"></script>
<script src="${base!}/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script> <script src="${base!}/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script>
<script src="${base!}/assets/platform/plugins/jSignature/jSignature.min.js"></script> <script src="${base!}/assets/platform/plugins/jSignature/jSignature.min.js"></script>
<script src="${base!}/assets/platform/plugins/jSignature/flashcanvas.js"></script> <script src="${base!}/assets/platform/plugins/jSignature/flashcanvas.js"></script>
@@ -310,7 +310,7 @@ layout("/mobile/platform.html"){
</div> </div>
<div class="van-card-body"> <div class="van-card-body">
<van-field label="姓名" readonly v-model="formData.userName"></van-field> <van-field label="姓名" readonly v-model="formData.userName"></van-field>
<van-field label="一卡通号" readonly v-model="formData.loginName"></van-field> <van-field label="号" readonly v-model="formData.loginName"></van-field>
<van-field label="所在单位" readonly v-model="formData.unitName"></van-field> <van-field label="所在单位" readonly v-model="formData.unitName"></van-field>
<van-field label="所属工会" readonly v-model="formData.unionName"></van-field> <van-field label="所属工会" readonly v-model="formData.unionName"></van-field>
<van-field label="性别" readonly v-model="formData.sex"></van-field> <van-field label="性别" readonly v-model="formData.sex"></van-field>
@@ -59,247 +59,20 @@ layout("/layouts/platform.html"){
mixins: [initTableMixins], mixins: [initTableMixins],
data() { data() {
return { return {
/* userList: [],
is_H04: "${@shiro.hasRole('H04')}" === 'true',
is_A06: "${@shiro.hasRole('A06')}" === 'true',
is_H10: "${@shiro.hasRole('H10')}" === 'true',
is_H02: "${@shiro.hasRole('club01')}" === 'true',
is_sysadmin: "${@shiro.hasRole('sysadmin')}" === 'true',
clubOptions: [],
settingLoading: false,
setDialogVisible: false,
setGroupType: null,
setGroupId: null,
setGroupName: null,
personTypeOptions: [],
userStateOptions: [],
activityGroupList: [],
activityGroupList2: [],
memberTypeOptions: [{
code: 'unionMember',
name: '工会会员'
}, {
code: 'welfareMember',
name: '福利会员'
}, {
code: 'sickFundMember',
name: '基金会员'
}],
sexTypeOptions: [
{code: '男', name: '男'},
{code: '女', name: '女'}
],
pageForm: {
unionId: "",
unitId: "",
searchName: "u.username",
personTypes: [],
userStates: [],
memberStatus: [],
memberTypes: [],
sexTypes: [],
minAge: 0,
maxAge: 0,
year: moment().format('YYYY'),
module: "",
teacherMeetingId: "",
roleIds: [],
userId: []
},
activityUnions: [],
unions: [],
units: [],
activityUnits: [],
menuOptions: [],
meetingOptions: [],
roleList: [],
tableHeight: '0px',
tableColumns: [
{prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'birthday', label: '出生年月', sortable: true},
{prop: 'age', label: '年龄', sortable: true},
{prop: 'mobile', label: '联系电话'},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'activityUnionName', label: '活动工会', sortable: true},
],
rules: {
setGroupType: [{required: true, message: '请选择添加方式', trigger: ['blur', 'change']}],
setGroupId: [{required: true, message: '请选择分组', trigger: ['blur', 'change']}],
setGroupName: [{required: true, message: '请输入分组名称', trigger: ['blur', 'change']}]
},
relatedSessionMenus: ['aca4d14498c145ceb5b24ed70776aae2', '733d7266652740a3aeac9da97ab5eeca', 'fe2d0768e26d4a80beeb159306bb8d01']*/
} }
}, },
components: { components: {
'user-scope': httpVueLoader('/components/plugins/UserScope.vue'), 'user-scope': httpVueLoader('/components/plugins/UserScope.vue?v=' + new Date().getTime()),
}, },
methods: { methods: {
/* doReset() {
this.pageForm.userId = []
this.pageForm.memberTypes = []
this.pageForm.sexTypes = []
this.pageForm.personTypes = []
this.pageForm.userStates = []
this.pageForm.unionId = null
this.pageForm.module = null
this.pageForm.teacherMeetingId = null
this.pageForm.roleIds = []
this.pageForm.clubId = null
this.pageForm.activityGroupId = null
this.pageForm.age = [0, 100]
this.pageForm.reverseSelection = false
},
async queryUser(val) {
const {list} = await selectUser(val, 10)
this.userList = list
},
tagClick(key, val) {
let idx = this.pageForm[key].indexOf(val)
if (idx !== -1) {
this.pageForm[key].splice(idx, 1)
} else {
this.pageForm[key].push(val)
}
this.doSearch()
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
this.activityUnits = await getActivityUnits(this.pageForm.activityUnionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
},
async pageData() {
sublime.showLoadingbar()
const pageForm = clone(this.pageForm)
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.memberStatus = JSON.stringify(pageForm.memberStatus)
pageForm.memberTypes = JSON.stringify(pageForm.memberTypes)
pageForm.sexTypes = JSON.stringify(pageForm.sexTypes)
pageForm.roleIds = JSON.stringify(pageForm.roleIds)
pageForm.userId = JSON.stringify(pageForm.userId)
pageForm.age = JSON.stringify(pageForm.age)
const resp = await $.post(loc() + '/pageData', pageForm)
if (resp.code === 0) {
this.tableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
}
sublime.closeLoadingbar()
},
async doSetActivityUser() {
const valid = await this.$refs.setForm.validate()
if (!valid) {
return
}
// const {personTypes, userState, unionId, unitId} = this.pageForm
// if (personTypes.length === 0 && userState.length === 0 && unionId === '' && unitId === '') {
// this.$message.warning('请先指定筛选条件!')
// return
// }
if (this.tableData.length === 0) {
this.$message.warning('请先指定筛选条件!')
return
}
const confirm = await this.$confirm('是否将符合搜索条件的用户设为活动人员?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === 'confirm') {
this.settingLoading = true
const pageForm = clone(this.pageForm)
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.memberStatus = JSON.stringify(pageForm.memberStatus)
pageForm.memberTypes = JSON.stringify(pageForm.memberTypes)
pageForm.sexTypes = JSON.stringify(pageForm.sexTypes)
pageForm.roleIds = JSON.stringify(pageForm.roleIds)
pageForm.userId = JSON.stringify(pageForm.userId)
pageForm.clubId = pageForm.clubId
Object.assign(pageForm, this.formData)
const resp = await $.post(loc() + '/doSetActivityUser', pageForm)
if (resp.code === 0) {
this.setDialogVisible = false
await this.getActivityGroup()
this.doSearch()
this.notifySuccess(resp.msg)
this.formData = {
setGroupType: null,
setGroupId: null,
setGroupName: null
}
}
this.settingLoading = false
}
},*/
/* async getActivityGroup() {
const resp = await $.get(loc() + '/getActivityUserScopeGroup')
this.activityGroupList = resp.data
resp.data.forEach(v => {
this.activityGroupList2.push({groupId: v.groupId, groupName: v.groupName + "范围之外人员"})
})
},
async getMenuOptions() {
const {data} = await $.get("/platform/sys/role/getMenuOptions")
this.menuOptions = data
},
async getRoleListByMenuId() {
if (['aca4d14498c145ceb5b24ed70776aae2', '733d7266652740a3aeac9da97ab5eeca'].includes(this.pageForm.module)) {
//教代会
let meets = await proposal.getOpenMeeting()
this.meetingOptions = meets.map(v => ({...v, name: v.jdhallname}))
} else if (['fe2d0768e26d4a80beeb159306bb8d01'].includes(this.pageForm.module)) {
//工代会
let meets = await getGdh(true)
this.meetingOptions = meets.map(v => ({...v, name: v.gdhAllName}))
}
this.pageForm.teacherMeetingId = ''
const {data} = await $.post(loc() + "/getRoleListByMenuId", {menuId: this.pageForm.module})
this.roleList = data
},*/
}, },
mounted() { mounted() {
setTimeout(() => {
/**
* .el-table::before 下有1px边框 故减1
*/
// this.tableHeight = window.innerHeight - (this.$refs.userTable.$el.getBoundingClientRect().top) - 20 - 50 - 10 - 1 + 'px'
// window.onresize = () => {
// this.tableHeight = window.innerHeight - (this.$refs.userTable.$el.getBoundingClientRect().top) - 20 - 50 - 10 - 1 + 'px'
// }
}, 500)
}, },
async created() { async created() {
/* this.clubOptions = await getClubsByRole()
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('club01')}" === 'false' && "${@shiro.hasRole('H04')}" === 'true') {
this.unions = await getUnionList("${@shiro.getPrincipalProperty('unit').getUnionid()}")
this.$set(this.pageForm, "unionId", this.unions[0].id)
} else {
this.unions = await getUnions(null)
this.activityUnions = await getActivityUnions()
}
if ("${@shiro.hasRole('H04')}" === 'false' && "${@shiro.hasRole('club01')}" === 'true') {
if (this.clubOptions.length > 0) {
this.$set(this.pageForm, "clubId", this.clubOptions[0].stid)
}
}
this.flushUnits()
await this.getActivityGroup()
this.personTypeOptions = await getDictOptions("UserType")
this.userStateOptions = await getDictOptions("UserState")
await this.getMenuOptions()
this.pageData()*/
} }
}) })
@@ -25,156 +25,7 @@ layout("/layouts/platform.html"){
:group_id.sync="formData.activityGroupId" :group_id.sync="formData.activityGroupId"
></user-data-scope> ></user-data-scope>
</guava> </guava>
<!--<guava>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">活动分组:</div>
<div class="search-item-option">
<el-select placeholder="活动分组" v-model="pageForm.groupId"
style="width: 100%;"
@change="doSearch"
filterable>
<el-option v-for="item in activityGroupList" :label="item.groupName"
:value="item.groupId"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
style="width: 100%"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 80px;">
<el-option label="姓名" value="username"></el-option>
<el-option label="工号" value="loginname"></el-option>
</el-select>
</el-input>
</div>
</div>
<div class="search-item"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId"
style="width: 100%;"
clearable="true"
@change="flushUnits" @clear="flushUnits"
filterable="true">
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable="true"
@change="doSearch"
filterable="true">
<el-option v-for="item in units" :label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</div>
&lt;!&ndash;<div class="search-item"
v-if="${@shiro.hasRole('sysadmin')}">
<div class="search-item-label">活动工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.activityUnionId"
style="width: 100%;"
clearable="true"
@change="flushUnits" @clear="flushUnits"
filterable="true">
<el-option v-for="item in ActivityUnions" :label="item.unionname"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item" v-if="${@shiro.hasRole('sysadmin')}">
<div class="search-item-label">活动单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.activityUnitId"
style="width: 100%;"
clearable="true"
@change="doSearch"
filterable="true">
<el-option v-for="item in ActivityUnits" :label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</div>&ndash;&gt;
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
placeholder="人员类型"
@change="doSearch"
code="UserType"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
placeholder="在职状态"
@change="doSearch"
code="UserState"></dict-select>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool :label="currentGroupName" :app="this">
<template #label_end>
<span class="text-danger pl5">提醒:删除活动分组操作,请先选择某个活动分组后,再点击右边的删除按钮。</span>
</template>
<template #func>
<el-button @click="doDelete(null,pageForm.groupId)"
type="danger"
size="medium" :disabled="tableData.length===0">
删除{{currentGroupName}}
</el-button>
</template>
</table-tool>
<el-table ref="userTable" :data="tableData" stripe border :size="tableSize">
<el-table-column type="index" label="序号" width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
></el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100">
<template scope="{row}">
<el-button size="mini" type="danger" @click="doDelete(row.id,null)">删除
</el-button>
</template>
</el-table-column>
</el-table>
&lt;!&ndash;#include("/layouts/pagination.html"){}#&ndash;&gt;
</el-card>
</guava>-->
</div> </div>
<script> <script>
@@ -183,88 +34,20 @@ layout("/layouts/platform.html"){
mixins: [initTableMixins], mixins: [initTableMixins],
components: { components: {
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'), 'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'user-data-scope': httpVueLoader('/components/plugins/UserDataScope.vue'), 'user-data-scope': httpVueLoader('/components/plugins/UserDataScope.vue?v=' + new Date().getTime()),
}, },
computed: { computed: {
currentGroupName() {
if (this.pageForm.groupId) {
const group = this.activityGroupList.find(v => v.groupId === this.pageForm.groupId)
return group.groupName + '人员'
}
return '全部人员'
}
}, },
data() { data() {
return { return {
activityGroupList: [],
ActivityUnions: [],
ActivityUnits: [],
unions: [],
units: [],
pageForm: {
unionId: "",
unitId: "",
searchName: "username",
personTypes: [],
userStates: [],
memberStatus: [],
year: moment().format('YYYY')
},
tableColumns: [
{prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'birthday', label: '出生年月'},
{prop: 'mobile', label: '联系电话'},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'activityUnionName', label: '活动工会', sortable: true},
{prop: 'groupName', label: '所属分组', sortable: true},
],
} }
}, },
methods: { methods: {
async doDelete(id, groupId) {
const confirm = await this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === 'confirm') {
this.pageForm.id = id
const resp = await $.post(loc() + '/doDelete', this.pageForm)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
}
}
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
this.ActivityUnits = await getActivityUnits(this.pageForm.activityUnionId)
} else {
this.units = await getClubUnits()
}
this.doSearch()
},
async getActivityGroup() {
const resp = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = resp.data
if (resp.data && resp.data.length > 0) {
this.$set(this.pageForm, "groupId", resp.data[0].groupId)
}
}
}, },
async created() { async created() {
this.pageData()
await this.getActivityGroup()
this.unions = await getUnions(null)
this.ActivityUnions = await getActivityUnions()
this.flushUnits()
} }
}) })
@@ -0,0 +1,330 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-form .el-select, .el-form .el-date-editor {
width: 100%;
}
.el-divider {
background-color: #1867b0;
}
.el-divider__text {
color: #1867b0;
}
.w-e-text-container {
height: 250px !important;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<template #header>
<el-row justify="space-between" type="flex">
<h3 style="color: rgb(24, 103, 176);">
{{id?'信息编辑':'申请加入'}}
</h3>
</el-row>
</template>
<el-form :model="formData" :rules="formRules" label-width="100px" ref="AddForm">
<el-divider content-position="left">基本信息</el-divider>
<el-row :gutter="20">
<el-col :lg="8" :sm="24">
<el-form-item label="姓名">
<el-input placeholder="姓名" readonly v-model="formData.username"></el-input>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="所属工会" prop="unionName">
<el-input readonly v-model="formData.unionName"></el-input>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="所属单位" prop="unitName">
<el-input readonly v-model="formData.unitName"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :lg="8" :sm="24">
<el-form-item label="联系方式" prop="mobile">
<el-input v-model="formData.mobile"></el-input>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="性别" prop="sex">
<el-input placeholder="性别" readonly v-model="formData.sex"></el-input>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="出生年月" prop="birthday">
<el-date-picker
placeholder="出生年月"
type="date"
style="width: 100%"
v-model="formData.birthday"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :lg="8" :sm="24">
<el-form-item label="籍贯" prop="hometown">
<el-input v-model="formData.hometown" placeholder="请填写籍贯"></el-input>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="学历" prop="education">
<el-input v-model="formData.education" placeholder="请填写学历"></el-input>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="身高(cm)" prop="height">
<el-input v-model="formData.height" placeholder="请填写身高" type="number"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :lg="8" :sm="24">
<el-form-item label="婚姻状况" prop="maritalStatus">
<el-select clearable v-model="formData.maritalStatus"
filterable remote placeholder="请选择婚姻状况"
style="width: 100%">
<el-option v-for="o in maritalStatusList"
:label="o"
:value="o"
:key="o"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :lg="8" :sm="24">
<el-form-item label="兴趣爱好" prop="hobby">
<el-input v-model="formData.hobby" placeholder="请填写兴趣爱好"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="子女情况" prop="childrenSituation">
<el-input v-model="formData.childrenSituation" placeholder="请填写子女情况"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="月收入" prop="monthlyIncome">
<el-input-number style="width: 100%" v-model="formData.monthlyIncome"
placeholder="请填写月收入"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="住房情况" prop="housingSituation">
<el-input maxlength="100" v-model="formData.housingSituation"
placeholder="请填写住房情况"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item required label="形象照片" prop="photo">
<image-upload ref="imageUpload" :height="100"
:width="100" :limit="1"
:file-type="['png','jpg']"
:file-size="10"
v-model="formData.photo"></image-upload>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item required label="上传照片" prop="picFiles">
<file-upload :files.sync="formData.picFiles" card :max="10"
:type="['jpg', 'png', 'jpeg']">
<template #el-upload__tip>
</template>
</file-upload>
<div class="el-upload__tip">请上传jpg、png、jpeg格式的图片,最多不超过10张</div>
</el-form-item>
</el-col>
</el-row>
<el-divider content-position="left">联谊信息</el-divider>
<el-row :gutter="20">
<el-col :lg="24" :sm="24">
<el-form-item label="交友意向" prop="intentionFriends">
<el-input type="textarea" :rows="3"
placeholder="请填写交友意向"
v-model="formData.intentionFriends"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :lg="24" :sm="24">
<el-form-item label="个人介绍" prop="personalIntroduction">
<el-input type="textarea" :rows="4"
placeholder="请填写个人介绍"
v-model="formData.personalIntroduction"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row class="mt10" justify="center" type="flex" v-if="!['8030'].includes(formData.singleState)">
<el-button :disabled="disabled" @click="doSave()" style="width: 300px" type="primary">保 存
</el-button>
<el-button :disabled="disabled" @click="doSubmit()" style="width: 300px" type="primary">提 交
</el-button>
</el-row>
<el-row class="mt10" justify="center" type="flex" v-if="['8030'].includes(formData.singleState)">
<el-button :disabled="disabled" @click="updateInfo()" style="width: 300px" type="primary">确 定
</el-button>
</el-row>
</el-card>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
formData: {},
id: null,
formRules: {
mobile: [{required: true, message: '必填', trigger: ['blur', 'change']}],
birthday: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
maritalStatusList: ["未婚", "离婚", "丧偶"],
disabled: false,
}
},
methods: {
async updateInfo() {
const resp = await $.post(loc() + '/doModifyInfo', this.formData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
setTimeout(() => {
sublime.jumpPagePjax('/platform/single/myApply')
}, 1000)
} else {
this.notifyError(resp.msg)
}
},
async doSave() {
let postUrl = ''
if (this.formData.id) {
postUrl = '/platform/single/myApply/doEdit'
} else {
postUrl = '/platform/single/apply/doSubmit'
}
this.formData.isSubmit = false
const resp = await $.post(postUrl, this.formData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
setTimeout(() => {
sublime.jumpPagePjax('/platform/single/myApply')
}, 1000)
} else {
this.notifyError(resp.msg)
}
},
async doSubmit() {
try {
const valid = await this.$refs['AddForm'].validate()
if (valid) {
let postUrl = ''
if (this.formData.id) {
postUrl = '/platform/single/myApply/doEdit'
} else {
postUrl = '/platform/single/apply/doSubmit'
}
this.formData.isSubmit = true
this.formData.singleState = '8010'
const resp = await $.post(postUrl, this.formData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
setTimeout(() => {
sublime.jumpPagePjax('/platform/single/myApply')
}, 1000)
} else {
this.notifyError(resp.msg)
}
}
} catch (e) {
console.log(e)
}
},
async isEdit() {
const id = GetQueryString("id")
this.id = id
if (id) {
await this.findOne(id)
}
},
async findOne(id) {
const resp = await $.get(loc() + '/findOneSingle', {id: id})
this.formData = resp.data
},
initFormData() {
if (this.id == null) {
this.$set(this.formData, 'birthday', "${@shiro.getPrincipalProperty('birthday')}")
this.$set(this.formData, 'mobile', "${@shiro.getPrincipalProperty('mobile')}")
this.$set(this.formData, 'username', "${@shiro.getPrincipalProperty('username')}")
this.$set(this.formData, 'sex', "${@shiro.getPrincipalProperty('sex')}")
this.$set(this.formData, 'unitName', "${@shiro.getPrincipalProperty('unit').getName()}")
this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}")
this.$set(this.formData, 'hometown', "${@shiro.getPrincipalProperty('hometown')}")
this.$set(this.formData, 'education', "${@shiro.getPrincipalProperty('education')}")
}
},
async isJoinedBeforeAndIsAudit() {
const resp = await $.get(loc() + '/isJoinedBeforeAndIsAudit')
if (resp.data.auditUser) {
this.notifyWarning("您的申请正在处理中或已加入成功,请勿重复提交!")
this.disabled = true;
return
}
if (resp.data.singleUser) {
const confirm = await this.$confirm('您之前申请加入过,是否显示以往数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === 'confirm') {
await this.findOne(resp.data.singleUser.id)
this.formData.id = null;
}
}
}
},
async mounted() {
await this.isEdit()
},
async created() {
this.initFormData();
const id = GetQueryString("id")
if (!id) {
await this.isJoinedBeforeAndIsAudit()
}
}
})
</script>
<!--#
}
#-->
+158 -130
View File
@@ -12,7 +12,7 @@ layout("/layouts/platform.html"){
} }
.query-row { .query-row {
height: 70px; height: 55px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -74,96 +74,113 @@ layout("/layouts/platform.html"){
</el-select> </el-select>
</div> </div>
</div> </div>
<template v-if="searchMore">
<div class="search-item">
<div class="search-item-label">工会小组:</div>
<div class="search-item-option">
<el-select v-model="pageForm.unionGroupId" style="width: 100%"
filterable
clearable
@change="getThreeUnits"
placeholder="请选择">
<el-option
v-for="item in unionGroups"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">组成科室:</div>
<div class="search-item-option">
<el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable
clearable
placeholder="请选择">
<el-option
v-for="item in threeUnits"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<!--<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
placeholder="人员类型"
code="UserType"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
placeholder="在职状态"
code="UserState"></dict-select>
</div>
</div>-->
<div class="search-item"> <div class="search-item">
<div class="search-item-label">&emsp;&emsp;别:</div> <div class="search-item-label">&emsp;&emsp;别:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-select v-model="pageForm.sex" style="width: 100%" clearable <el-select v-model="pageForm.sex" style="width: 100%" clearable
placeholder="请选择"> placeholder="请选择性别">
<el-option v-for="sex in sexOptions" :label="sex" :value="sex"></el-option> <el-option v-for="sex in sexOptions" :label="sex" :value="sex"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">&emsp;&emsp;</div> <div class="search-item-label">&emsp;&emsp;</div>
<div class="search-item-option"> <div class="search-item-option">
<el-input placeholder="请输入内容" clearable v-model="pageForm.position" <dict-select v-model="pageForm.education" style="width: 100%" placeholder="请选择学历" code="Education"></dict-select>
@keyup.enter.native="doSearch">
</el-input>
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">&emsp;&emsp;</div> <div class="search-item-label">单身状况</div>
<div class="search-item-option"> <div class="search-item-option">
<el-input placeholder="请输入内容" clearable v-model="pageForm.jobTitle" <el-select v-model="pageForm.maritalStatus" style="width: 100%" clearable
@keyup.enter.native="doSearch"> placeholder="请选择单身状况">
</el-input> <el-option v-for="item in maritalStatusOptions" :label="item" :value="item"></el-option>
</el-select>
</div> </div>
</div> </div>
<!-- <div class="search-item">
<div class="search-item-label">会员状态:</div> <!-- <template v-if="searchMore">-->
<div class="search-item-option"> <!-- <div class="search-item">-->
<dict-select v-model="pageForm.memberStatus" style="width: 100%" clearable <!-- <div class="search-item-label">工会小组:</div>-->
placeholder="会员状态" code="memberStatusText"></dict-select> <!-- <div class="search-item-option">-->
</div> <!-- <el-select v-model="pageForm.unionGroupId" style="width: 100%"-->
</div>--> <!-- filterable-->
</template> <!-- clearable-->
<!-- @change="getThreeUnits"-->
<!-- placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in unionGroups"-->
<!-- :key="item.id"-->
<!-- :label="item.groupName"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="search-item">-->
<!-- <div class="search-item-label">组成科室:</div>-->
<!-- <div class="search-item-option">-->
<!-- <el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable-->
<!-- clearable-->
<!-- placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in threeUnits"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </div>-->
<!-- </div>-->
<!-- &lt;!&ndash;<div class="search-item">-->
<!-- <div class="search-item-label">人员类型:</div>-->
<!-- <div class="search-item-option">-->
<!-- <dict-select v-model="pageForm.personType" style="width: 100%" clearable-->
<!-- placeholder="人员类型"-->
<!-- code="UserType"></dict-select>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="search-item">-->
<!-- <div class="search-item-label">在职状态:</div>-->
<!-- <div class="search-item-option">-->
<!-- <dict-select v-model="pageForm.userState" style="width: 100%" clearable-->
<!-- placeholder="在职状态"-->
<!-- code="UserState"></dict-select>-->
<!-- </div>-->
<!-- </div>&ndash;&gt;-->
<!-- <div class="search-item">-->
<!-- <div class="search-item-label">职&emsp;&emsp;务:</div>-->
<!-- <div class="search-item-option">-->
<!-- <el-input placeholder="请输入内容" clearable v-model="pageForm.position"-->
<!-- @keyup.enter.native="doSearch">-->
<!-- </el-input>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="search-item">-->
<!-- <div class="search-item-label">职&emsp;&emsp;称:</div>-->
<!-- <div class="search-item-option">-->
<!-- <el-input placeholder="请输入内容" clearable v-model="pageForm.jobTitle"-->
<!-- @keyup.enter.native="doSearch">-->
<!-- </el-input>-->
<!-- </div>-->
<!-- </div>-->
<!-- &lt;!&ndash; <div class="search-item">-->
<!-- <div class="search-item-label">会员状态:</div>-->
<!-- <div class="search-item-option">-->
<!-- <dict-select v-model="pageForm.memberStatus" style="width: 100%" clearable-->
<!-- placeholder="会员状态" code="memberStatusText"></dict-select>-->
<!-- </div>-->
<!-- </div>&ndash;&gt;-->
<!-- </template>-->
<div class="search-query"> <div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
<more v-model="searchMore"></more> <!-- <more v-model="searchMore"></more>-->
</div> </div>
</div> </div>
</el-card> </el-card>
@@ -206,6 +223,26 @@ layout("/layouts/platform.html"){
</el-link> </el-link>
</el-col> </el-col>
</el-row> </el-row>
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">年龄范围:</el-col>
<el-col class="query-row-content">
<el-row type="flex" style="align-items: center">
<el-col :span="15">
<el-slider
v-model="pageForm.age"
range
show-stops
:max="100">
</el-slider>
</el-col>
<el-col :span="9" class="pl20">
当前范围:{{ pageForm.age }}
</el-col>
</el-row>
</el-col>
</el-row>
<!--<el-row type="flex" align="middle" class="query-row"> <!--<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">模糊查询:</el-col> <el-col class="query-row-title">模糊查询:</el-col>
<el-col class="query-row-content"> <el-col class="query-row-content">
@@ -216,7 +253,15 @@ layout("/layouts/platform.html"){
<el-card shadow="never" class="mt10"> <el-card shadow="never" class="mt10">
<table-tool label="教工列表" :app="this"> <table-tool label="教工列表" :app="this">
<template #func> <template #func><!--el-icon-printer-->
<el-radio-group @change="doSearch" class="mr10" size="small" v-model="pageForm.isJoin">
<el-radio-button :label="true">加入</el-radio-button>
<el-radio-button :label="false">退出</el-radio-button>
</el-radio-group>
<el-button type="primary" size="small" icon="el-icon-upload2" @click="openImport">单身教工导入
</el-button>
<el-button type="primary" size="small" icon="el-icon-download" @click="exportSingle">单身教工导出 <el-button type="primary" size="small" icon="el-icon-download" @click="exportSingle">单身教工导出
</el-button> </el-button>
</template> </template>
@@ -260,12 +305,9 @@ layout("/layouts/platform.html"){
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}"
:command="{type:'edit',data:scope.row}"> :command="{type:'delete',data:scope.row}">
编辑
</el-dropdown-item>
<!--<el-dropdown-item v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" :command="{type:'delete',data:scope.row}">
删除 删除
</el-dropdown-item>--> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
@@ -276,46 +318,41 @@ layout("/layouts/platform.html"){
</template> </template>
<template #edit_func> <template #view>
<el-button type="primary" @click="$refs.member.save()">提交</el-button> <single-info ref="viewInfo"></single-info>
</template> </template>
<template #edit> <template #edit>
<member ref="member" :id="userId" @save="afterEdit"></member> <file-import ref="viewImport" :temp_url="tempUrl"
</template> :post_url="postUrl" :is_show_radio="isShowRadio"></file-import>
<template #view>
<el-tabs v-model="active">
<el-tab-pane label="个人信息" name="info">
<member ref="memberInfo" :id="userId" view></member>
</el-tab-pane>
<el-tab-pane label="变更记录" name="change">
<mem-change-records :userid="userId"></mem-change-records>
</el-tab-pane>
</el-tabs>
</template> </template>
</guava> </guava>
</div> </div>
<!--<script src="https://cdn.staticfile.org/xlsx/0.18.5/xlsx.full.min.js"></script>-->
<script> <script>
const vue = new Vue({ const vue = new Vue({
el:'#app', el: '#app',
mixins: [initTableMixins], mixins: [initTableMixins],
data(){ data() {
return{ return {
tempUrl:'/platform/single/list/downloadImport',
postUrl:'/platform/single/list/doImport',
isShowRadio:false,
labelYear: "", labelYear: "",
archiveDialogVisible: false, archiveDialogVisible: false,
archiveLoading: false, archiveLoading: false,
sexOptions: ['男', '女'], sexOptions: ['男', '女'],
maritalStatusOptions:['未婚','离异','丧偶'],
submitLoading: false, submitLoading: false,
pageForm: { pageForm: {
personTypes: [], personTypes: [],
userStates: [], userStates: [],
age: [0, 0],
searchName: "username", searchName: "username",
isJoin:true,
}, },
userId: "", userId: "",
@@ -328,21 +365,14 @@ 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: 'personType', label: '人员类型', sortable: true, checked: 0},
{prop: 'position', label: '职务', sortable: true, checked: 0}, {prop: 'userState', label: '在职状态', sortable: true, checked: 0},
{prop: 'jobTitle', label: '职称', sortable: true, checked: 0},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true}, {prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true}, {prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true}, {prop: 'education', label: '学历', sortable: true},
{prop: 'unionGroupName', label: '工会小组', sortable: true}, {prop: 'maritalStatus', label: '单身状况', sortable: true},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0}, {prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
{prop: 'marriage', label: '婚否', checked: 0}, {prop: 'unionGroupName', label: '工会小组', sortable: true, checked: 0},
{prop: 'education', label: '学历', checked: 0},
{prop: 'hometown', label: '籍贯', checked: 0},
{prop: 'nation', label: '民族', checked: 0},
{prop: 'memberNumber', label: '会员号', checked: 0},
], ],
personTypeOptions: [], personTypeOptions: [],
userStateOptions: [], userStateOptions: [],
@@ -358,7 +388,16 @@ layout("/layouts/platform.html"){
}, },
} }
}, },
methods:{ components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'single-info': httpVueLoader('/components/singleuser/SingUserInfo.vue'),
'file-import': httpVueLoader('/components/plugins/FileImport.vue')
},
methods: {
openImport() {
this.$refs.guava.edit()
},
checkUserStateType(state) { checkUserStateType(state) {
let idx = this.pageForm.userStates.indexOf(state) let idx = this.pageForm.userStates.indexOf(state)
if (idx != -1) { if (idx != -1) {
@@ -396,9 +435,10 @@ layout("/layouts/platform.html"){
type: 'warning', type: 'warning',
callback: async (a, b) => { callback: async (a, b) => {
if ("confirm" === a) {//确认后再执行 if ("confirm" === a) {//确认后再执行
const resp = await $.post(loc() + "/delete", {userId}); const resp = await $.post("/platform/single/myApply/removeById", {userId});
if (resp.code === 0) { if (resp.code === 0) {
this.pageData() this.pageData()
this.notifySuccess(resp.msg)
} else { } else {
this.notifyWarning(resp.msg) this.notifyWarning(resp.msg)
} }
@@ -406,26 +446,20 @@ layout("/layouts/platform.html"){
} }
}); });
}, },
openEdit(userId) {
this.userId = userId
this.$refs.guava.edit()
},
afterEdit() { afterEdit() {
this.userId = '' this.userId = ''
this.pageData() this.pageData()
this.$refs.guava.index() this.$refs.guava.index()
}, },
openView(userId) { openView(id) {
this.active = 'info'
this.userId = userId
this.$refs.guava.view() this.$refs.guava.view()
this.$refs.viewInfo.activeName = '1'
this.$refs.viewInfo.openView(id)
}, },
dropdownCommand(command) { dropdownCommand(command) {
const {type, data} = command const {type, data} = command
if (type == 'view') { if (type == 'view') {
this.openView(data.id) this.openView(data.id)
} else if (type == 'edit') {
this.openEdit(data.id)
} else if (type == 'delete') { } else if (type == 'delete') {
this.doDelete(data.id) this.doDelete(data.id)
} }
@@ -451,6 +485,7 @@ layout("/layouts/platform.html"){
const pageForm = clone(this.pageForm) const pageForm = clone(this.pageForm)
pageForm.personTypes = JSON.stringify(pageForm.personTypes) pageForm.personTypes = JSON.stringify(pageForm.personTypes)
pageForm.userStates = JSON.stringify(pageForm.userStates) pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.age = JSON.stringify(pageForm.age)
$.post(loc() + "/pageData", pageForm, (data) => { $.post(loc() + "/pageData", pageForm, (data) => {
sublime.closeLoadingbar(); sublime.closeLoadingbar();
@@ -475,14 +510,7 @@ layout("/layouts/platform.html"){
} }
this.personTypeOptions = await getDictOptions("UserType") this.personTypeOptions = await getDictOptions("UserType")
this.userStateOptions = await getDictOptions("UserState") this.userStateOptions = await getDictOptions("UserState")
}, }
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'),
'member-cnd': httpVueLoader('/components/member/MemberCnd.vue'),
},
}); });
</script> </script>
@@ -0,0 +1,297 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
style="width: 100%"
@keyup.enter.native="doSearch">
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId"
style="width: 100%;"
clearable="true"
@change="flushUnits" @clear="flushUnits"
filterable="true">
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId"
style="width: 100%;"
@change="getThreeUnits"
clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<template v-if="searchMore">
<template v-if="isThreeUnit">
<div class="search-item">
<div class="search-item-label">工会小组:</div>
<div class="search-item-option">
<el-select v-model="pageForm.unionGroupId" style="width: 100%"
filterable
clearable
@change="getThreeUnits"
placeholder="请选择">
<el-option
v-for="item in unionGroups"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">组成科室:</div>
<div class="search-item-option">
<el-select v-model="pageForm.threeUnitId" style="width: 100%"
filterable
clearable
placeholder="请选择">
<el-option
v-for="item in threeUnits"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.personType" style="width: 100%"
clearable
placeholder="人员类型"
code="UserType"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select v-model="pageForm.userState" style="width: 100%"
clearable
placeholder="在职状态"
code="UserState"></dict-select>
</div>
</div>
</template>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索
</el-button>
<more v-model="searchMore"></more>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="申请列表" :app="this">
<template #func>
<el-radio-group @change="doSearch" class="mr10" size="small" v-model="pageForm.isJoin">
<el-radio-button :label="true">加入</el-radio-button>
<el-radio-button :label="false">退出</el-radio-button>
</el-radio-group>
</template>
</table-tool>
<el-table ref="table" :data="tableData" style="width: 100%" row-key="id"
@sort-change="pageOrder"
v-loading="tableLoading" :size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index"
:index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center" label="操作" fixed="right">
<template scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:scope.row}">
查看
</el-dropdown-item>
<el-dropdown-item v-if="['8000','8030'].includes(scope.row.singleState)"
:command="{type:'modify',data:scope.row}">
编辑
</el-dropdown-item>
<el-dropdown-item v-if="['8030'].includes(scope.row.singleState)"
:command="{type:'exitSingle',data:scope.row}">
退出
</el-dropdown-item>
<el-dropdown-item v-if="['8000'].includes(scope.row.singleState)"
:command="{type:'remove',data:scope.row}">
删除
</el-dropdown-item>
<el-dropdown-item v-if="!['8000'].includes(scope.row.singleState) && ${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}"
:command="{type:'remove',data:scope.row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<single-info ref="viewInfo"></single-info>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
isThreeUnit: false,
pageForm:{
isJoin:true,
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名', sortable: true},
{prop: 'sex', label: '性别'},
{prop: 'mobile', label: '联系电话'},
{prop: 'personType', label: '人员类型', sortable: true},
{prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'maritalStatus', label: '婚姻状况'},
{prop: 'stateName', label: '申请状态'},
],
unions: [],
units: [],
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'single-info': httpVueLoader('/components/singleuser/SingUserInfo.vue')
},
methods: {
dropdownCommand(command) {
const {type, data} = command
if (type === 'view') {
this.openView(data.id)
} else if (type === 'modify') {
this.openEdit(data.id)
} else if (type === 'remove') {
this.doDelete(data.id)
} else if (type === 'exitSingle'){
this.exitSingle(data.id)
}
},
openView(id){
this.$refs.guava.view()
this.$refs.viewInfo.activeName = '1'
this.$refs.viewInfo.openView(id)
},
openEdit(id){
sublime.jumpPagePjax('/platform/single/apply?id=' + id)
},
async doDelete(id){
const resp = await $.get(loc() + '/removeById',{id:id})
if (resp.code === 0){
this.pageData();
this.notifySuccess(resp.msg)
}else {
this.notifyError(resp.msg)
}
},
async exitSingle(id){
const confirm = await this.$confirm('您确定要【退出】吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === 'confirm') {
const resp = await $.get(loc() + '/exitSingle',{id:id})
if (resp.code === 0){
this.pageData();
this.notifySuccess(resp.msg)
}else {
this.notifyError(resp.msg)
}
}
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
this.$set(this.pageForm, "unionGroupId", null)
this.$set(this.pageForm, "threeUnitId", null)
this.units = []
this.unionGroups = []
this.threeUnits = []
if (this.pageForm.unionId) {
this.units = await getUnits(this.pageForm.unionId)
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
}
},
},
async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
if (this.isThreeUnit) {
this.tableColumns.forEach(v => {
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
v.checked = 1
}
})
}
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false)
} else {
this.unions = await getUnions(null, true)
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)
this.flushUnits()
}
this.pageData();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,389 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
style="width: 100%"
v-model="pageForm.searchKeyword">
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="flushUnits" @clear="flushUnits"
clearable="true"
filterable="true"
placeholder="所属工会" style="width: 100%;"
v-model="pageForm.unionId">
<el-option :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="getThreeUnits" clearable="true"
filterable="true"
placeholder="所属单位"
style="width: 100%;"
v-model="pageForm.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</div>
</div>
<template v-if="searchMore">
<template v-if="isThreeUnit">
<div class="search-item">
<div class="search-item-label">工会小组:</div>
<div class="search-item-option">
<el-select @change="getThreeUnits" clearable
filterable
placeholder="请选择"
style="width: 100%"
v-model="pageForm.unionGroupId">
<el-option
:key="item.id"
:label="item.groupName"
:value="item.id"
v-for="item in unionGroups">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">组成科室:</div>
<div class="search-item-option">
<el-select clearable filterable
placeholder="请选择"
style="width: 100%"
v-model="pageForm.threeUnitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in threeUnits">
</el-option>
</el-select>
</div>
</div>
</template>
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select clearable code="UserType"
placeholder="人员类型"
style="width: 100%"
v-model="pageForm.personType"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select clearable code="UserState"
placeholder="在职状态"
style="width: 100%"
v-model="pageForm.userState"></dict-select>
</div>
</div>
</template>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
<more v-model="searchMore"></more>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="申请列表">
<template #func>
<el-radio-group @change="doSearch" class="mr10" size="small"
v-model="pageForm.isJoin">
<el-radio-button :label="true">加入({{auditNum.joinCount}})
</el-radio-button>
<el-radio-button :label="false">退出({{auditNum.exitCount}})
</el-radio-button>
</el-radio-group>
<el-radio-group @change="doSearch" class="mr10" size="small"
v-model="pageForm.isAudit">
<el-radio-button :label="null">全部</el-radio-button>
<el-radio-button :label="true">已审核</el-radio-button>
<el-radio-button :label="false">未审核</el-radio-button>
</el-radio-group>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" class="vi-table"
ref="table"
row-key="id" style="width: 100%" v-loading="tableLoading">
<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"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
<el-table-column align="center" fixed="right" header-align="center"
label="操作" prop="userOnline">
<template scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:scope.row}">
查看
</el-dropdown-item>
<el-dropdown-item
:command="{type:'audit',data:scope.row}"
v-if="['8020','8050'].includes(scope.row.singleState)">
审核
</el-dropdown-item>
<el-dropdown-item
:command="{type:'rollback',data:scope.row}"
v-if="['8025','8030','8055','8060'].includes(scope.row.singleState)">
撤回
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<single-info ref="viewInfo"></single-info>
</template>
<template #edit>
<single-info ref="auditInfo">
<template #handle>
<el-tab-pane label="校工会审核" name="schoolAudit">
<el-form :model="formData" :rules="formRules" label-position="right"
label-width="120px"
ref="form"
style="padding: 20px 0">
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="审核人员" prop="username">
<el-input disabled
value="${@shiro.getPrincipalProperty('username')}"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核时间" prop="time">
<el-input disabled v-model="formData.auditTime"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="审核意见" prop="auditOpinion">
<el-input maxlength="500" placeholder="请填写您的审核意见" rows="4"
type="textarea"
v-model="formData.auditOpinion"></el-input>
</el-form-item>
<!-- <el-form-item prop="auditSign" label="审核签字">-->
<!-- <sign :qz.sync="formData.auditSign"></sign>-->
<!-- </el-form-item>-->
</el-form>
<div style="float: right;margin: 20px 0">
<el-button @click="doReview(0)" type="danger">
拒绝
</el-button>
<el-button @click="doReview(1)" type="primary">
通过
</el-button>
</div>
</el-tab-pane>
</template>
</single-info>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
id: '',
isThreeUnit: false,
pageForm: {
isJoin: true,
isAudit: false,
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名', sortable: true},
{prop: 'sex', label: '性别'},
{prop: 'mobile', label: '联系电话'},
{prop: 'personType', label: '人员类型', sortable: true, checked: 0},
{prop: 'userState', label: '在职状态', sortable: true, checked: 0},
{prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'education', label: '学历'},
{prop: 'maritalStatus', label: '单身状况'},
{prop: 'stateName', label: '申请状态'},
],
unions: [],
units: [],
formRules: {
// auditSign: [{required: true, message: '必填', trigger: ['blur', 'change']}],
auditOpinion: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
auditNum: {}
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'single-info': httpVueLoader('/components/singleuser/SingUserInfo.vue')
},
methods: {
doReview(row) {
this.$refs['form'].validate(valid => {
if (valid) {
this.$confirm('您确定要提交吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const {code, msg} = await $.post(loc() + '/doAudit', {
audit: JSON.stringify(this.formData),
id: this.id,
isPass: row,
isJoin: this.pageForm.isJoin
})
if (code === 0) {
this.pageData()
await this.getAuditNum();
this.notifySuccess(msg)
this.$refs.guava.index()
} else {
this.notifyWarning(msg)
}
})
}
})
},
dropdownCommand(command) {
const {type, data} = command
this.id = data.id;
if (type === 'view') {
this.openView(data.id)
} else if (type === 'audit') {
this.openAudit(data.id)
} else if (type === 'rollback') {
this.doRollBack(data.id)
}
},
openView(id) {
this.$refs.guava.view()
this.$refs.viewInfo.openView(id)
},
openAudit(id) {
this.formData = {}
this.$set(this.formData, 'auditTime', moment().format('YYYY-MM-DD'))
this.$refs.guava.edit()
this.$refs.auditInfo.activeName = 'schoolAudit'
this.$refs.auditInfo.openView(id)
},
async doRollBack(id) {
const confirm = await this.$confirm('确定要撤回该记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ("confirm" === confirm) {
const resp = await $.get(loc() + '/doRollBack', {
id: id,
isJoin: this.pageForm.isJoin
})
if (resp.code === 0) {
this.pageData();
await this.getAuditNum();
this.notifySuccess(resp.msg)
} else {
this.notifyError(resp.msg)
}
}
},
async doSearch() {
this.pageData();
await this.getAuditNum();
},
async getAuditNum() {
const resp = await $.get(loc() + '/getAuditNum', {
isAudit: this.pageForm.isAudit,
unionId: this.pageForm.unionId
})
if (resp.code === 0) {
this.auditNum = resp.data
}
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
this.$set(this.pageForm, "unionGroupId", null)
this.$set(this.pageForm, "threeUnitId", null)
this.units = []
this.unionGroups = []
this.threeUnits = []
if (this.pageForm.unionId) {
this.units = await getUnits(this.pageForm.unionId)
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
}
},
},
async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
if (this.isThreeUnit) {
this.tableColumns.forEach(v => {
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
v.checked = 1
}
})
}
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false)
} else {
this.unions = await getUnions(null, true)
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)
this.flushUnits()
}
this.pageData();
await this.getAuditNum()
}
})
</script>
<!--#
}
#-->
@@ -87,13 +87,13 @@ layout("/layouts/platform.html"){
<el-table-column v-if="searchType==='按分工会统计'" align="center" header-align="center" label="分工会" <el-table-column v-if="searchType==='按分工会统计'" align="center" header-align="center" label="分工会"
width="220px"> width="220px">
<template scope="{row}"> <template scope="{row}">
<!--{{isDisPlayCode?''+row.unionCode+'':null}}-->{{row.unionName}} <!--{{isDisPlayCode?''+row.unionCode+'':null}}-->{{row.unName}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="searchType==='按单位统计'" align="center" header-align="center" label="单位" <el-table-column v-if="searchType==='按单位统计'" align="center" header-align="center" label="单位"
width="220px"> width="220px">
<template scope="{row}"> <template scope="{row}">
<!--{{isDisPlayCode?''+row.unitCode+'':null}}-->{{row.unitName}} <!--{{isDisPlayCode?''+row.unitCode+'':null}}-->{{row.unName}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="totalNumber" label="总人数" align="center" sortable></el-table-column> <el-table-column prop="totalNumber" label="总人数" align="center" sortable></el-table-column>
@@ -0,0 +1,389 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
style="width: 100%"
v-model="pageForm.searchKeyword">
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="flushUnits" @clear="flushUnits"
clearable="true"
filterable="true"
placeholder="所属工会" style="width: 100%;"
v-model="pageForm.unionId">
<el-option :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="getThreeUnits" clearable="true"
filterable="true"
placeholder="所属单位"
style="width: 100%;"
v-model="pageForm.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</div>
</div>
<template v-if="searchMore">
<template v-if="isThreeUnit">
<div class="search-item">
<div class="search-item-label">工会小组:</div>
<div class="search-item-option">
<el-select @change="getThreeUnits" clearable
filterable
placeholder="请选择"
style="width: 100%"
v-model="pageForm.unionGroupId">
<el-option
:key="item.id"
:label="item.groupName"
:value="item.id"
v-for="item in unionGroups">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">组成科室:</div>
<div class="search-item-option">
<el-select clearable filterable
placeholder="请选择"
style="width: 100%"
v-model="pageForm.threeUnitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in threeUnits">
</el-option>
</el-select>
</div>
</div>
</template>
<div class="search-item">
<div class="search-item-label">人员类型:</div>
<div class="search-item-option">
<dict-select clearable code="UserType"
placeholder="人员类型"
style="width: 100%"
v-model="pageForm.personType"></dict-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">在职状态:</div>
<div class="search-item-option">
<dict-select clearable code="UserState"
placeholder="在职状态"
style="width: 100%"
v-model="pageForm.userState"></dict-select>
</div>
</div>
</template>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
<more v-model="searchMore"></more>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="申请列表">
<template #func>
<el-radio-group @change="doSearch" class="mr10" size="small"
v-model="pageForm.isJoin">
<el-radio-button :label="true">加入({{auditNum.joinCount}})
</el-radio-button>
<el-radio-button :label="false">退出({{auditNum.exitCount}})
</el-radio-button>
</el-radio-group>
<el-radio-group @change="doSearch" class="mr10" size="small"
v-model="pageForm.isAudit">
<el-radio-button :label="null">全部</el-radio-button>
<el-radio-button :label="true">已审核</el-radio-button>
<el-radio-button :label="false">未审核</el-radio-button>
</el-radio-group>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" class="vi-table"
ref="table"
row-key="id" style="width: 100%" v-loading="tableLoading">
<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"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
<el-table-column align="center" fixed="right" header-align="center"
label="操作" prop="userOnline">
<template scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:scope.row}">
查看
</el-dropdown-item>
<el-dropdown-item
:command="{type:'audit',data:scope.row}"
v-if="['8010','8040'].includes(scope.row.singleState)">
审核
</el-dropdown-item>
<el-dropdown-item
:command="{type:'rollback',data:scope.row}"
v-if="['8015','8020','8045','8050'].includes(scope.row.singleState)">
撤回
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<single-info ref="viewInfo"></single-info>
</template>
<template #edit>
<single-info ref="auditInfo">
<template #handle>
<el-tab-pane label="分工会审核" name="unionAudit">
<el-form :model="formData" :rules="formRules" label-position="right"
label-width="120px"
ref="form"
style="padding: 20px 0">
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="审核人员" prop="username">
<el-input disabled
value="${@shiro.getPrincipalProperty('username')}"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核时间" prop="time">
<el-input disabled v-model="formData.auditTime"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="审核意见" prop="auditOpinion">
<el-input maxlength="500" placeholder="请填写您的审核意见" rows="4"
type="textarea"
v-model="formData.auditOpinion"></el-input>
</el-form-item>
<!-- <el-form-item prop="auditSign" label="审核签字">-->
<!-- <sign :qz.sync="formData.auditSign"></sign>-->
<!-- </el-form-item>-->
</el-form>
<div style="float: right;margin: 20px 0">
<el-button @click="doReview(0)" type="danger">
拒绝
</el-button>
<el-button @click="doReview(1)" type="primary">
通过
</el-button>
</div>
</el-tab-pane>
</template>
</single-info>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
id: '',
isThreeUnit: false,
pageForm: {
isJoin: true,
isAudit: false,
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名', sortable: true},
{prop: 'sex', label: '性别'},
{prop: 'mobile', label: '联系电话'},
{prop: 'personType', label: '人员类型', sortable: true, checked: 0},
{prop: 'userState', label: '在职状态', sortable: true, checked: 0},
{prop: 'unionName', label: '所属工会', sortable: true},
{prop: 'unitName', label: '所属单位', sortable: true},
{prop: 'education', label: '学历'},
{prop: 'maritalStatus', label: '单身状况'},
{prop: 'stateName', label: '申请状态'},
],
unions: [],
units: [],
formRules: {
// auditSign: [{required: true, message: '必填', trigger: ['blur', 'change']}],
auditOpinion: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
auditNum: {}
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'single-info': httpVueLoader('/components/singleuser/SingUserInfo.vue')
},
methods: {
doReview(row) {
this.$refs['form'].validate(valid => {
if (valid) {
this.$confirm('您确定要提交吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const {code, msg} = await $.post(loc() + '/doAudit', {
audit: JSON.stringify(this.formData),
id: this.id,
isPass: row,
isJoin: this.pageForm.isJoin
})
if (code === 0) {
this.pageData()
await this.getAuditNum();
this.notifySuccess(msg)
this.$refs.guava.index()
} else {
this.notifyWarning(msg)
}
})
}
})
},
dropdownCommand(command) {
const {type, data} = command
this.id = data.id;
if (type === 'view') {
this.openView(data.id)
} else if (type === 'audit') {
this.openAudit(data.id)
} else if (type === 'rollback') {
this.doRollBack(data.id)
}
},
openView(id) {
this.$refs.guava.view()
this.$refs.viewInfo.openView(id)
},
openAudit(id) {
this.formData = {}
this.$set(this.formData, 'auditTime', moment().format('YYYY-MM-DD'))
this.$refs.guava.edit()
this.$refs.auditInfo.activeName = 'unionAudit'
this.$refs.auditInfo.openView(id)
},
async doRollBack(id) {
const confirm = await this.$confirm('确定要撤回该记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ("confirm" === confirm) {
const resp = await $.get(loc() + '/doRollBack', {
id: id,
isJoin: this.pageForm.isJoin
})
if (resp.code === 0) {
this.pageData();
await this.getAuditNum();
this.notifySuccess(resp.msg)
} else {
this.notifyError(resp.msg)
}
}
},
async doSearch() {
this.pageData();
await this.getAuditNum();
},
async getAuditNum() {
const resp = await $.get(loc() + '/getAuditNum', {
isAudit: this.pageForm.isAudit,
unionId: this.pageForm.unionId
})
if (resp.code === 0) {
this.auditNum = resp.data
}
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
this.$set(this.pageForm, "unionGroupId", null)
this.$set(this.pageForm, "threeUnitId", null)
this.units = []
this.unionGroups = []
this.threeUnits = []
if (this.pageForm.unionId) {
this.units = await getUnits(this.pageForm.unionId)
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
}
},
},
async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
if (this.isThreeUnit) {
this.tableColumns.forEach(v => {
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
v.checked = 1
}
})
}
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false)
} else {
this.unions = await getUnions(null, true)
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)
this.flushUnits()
}
this.pageData();
await this.getAuditNum();
}
})
</script>
<!--#
}
#-->
@@ -109,7 +109,7 @@ layout("/layouts/platform.html"){
<el-select slot="prepend" v-model="registerForm.searchName" placeholder="查询类型" <el-select slot="prepend" v-model="registerForm.searchName" placeholder="查询类型"
style="width: 120px;"> style="width: 120px;">
<el-option label="姓名" value="u.username"></el-option> <el-option label="姓名" value="u.username"></el-option>
<el-option label="一卡通号" value="u.loginname"></el-option> <el-option label="号" value="u.loginname"></el-option>
</el-select> </el-select>
</el-input> </el-input>
</div> </div>
@@ -228,7 +228,7 @@ layout("/layouts/platform.html"){
registerUserTableData: [], registerUserTableData: [],
registerUserTableColumns: [ registerUserTableColumns: [
{label: '姓名', prop: 'username'}, {label: '姓名', prop: 'username'},
{label: '一卡通号', prop: 'loginname'}, {label: '号', prop: 'loginname'},
{label: '单位', prop: 'unitname'}, {label: '单位', prop: 'unitname'},
{label: '分工会', prop: 'unionname'}, {label: '分工会', prop: 'unionname'},
{label: '联系方式', prop: 'mobile'}, {label: '联系方式', prop: 'mobile'},
@@ -115,7 +115,7 @@ layout("/layouts/platform.html"){
<el-table-column align="center" header-align="center" prop="username" <el-table-column align="center" header-align="center" prop="username"
label="姓名"></el-table-column> label="姓名"></el-table-column>
<el-table-column align="center" header-align="center" prop="loginname" <el-table-column align="center" header-align="center" prop="loginname"
label="一卡通号"></el-table-column> label="号"></el-table-column>
<el-table-column align="center" header-align="center" prop="mobile" <el-table-column align="center" header-align="center" prop="mobile"
label="联系方式"></el-table-column> label="联系方式"></el-table-column>
<el-table-column align="center" header-align="center" prop="unitname" <el-table-column align="center" header-align="center" prop="unitname"
@@ -147,7 +147,7 @@ layout("/layouts/platform.html"){
}, },
tableColumns: [ tableColumns: [
{label: '姓名', prop: 'username'}, {label: '姓名', prop: 'username'},
{label: '一卡通号', prop: 'loginname'}, {label: '号', prop: 'loginname'},
{label: '联系方式', prop: 'mobile'}, {label: '联系方式', prop: 'mobile'},
{label: '单位', prop: 'unitname', sortable: true}, {label: '单位', prop: 'unitname', sortable: true},
{label: '分工会', prop: 'unionname', sortable: true}, {label: '分工会', prop: 'unionname', sortable: true},
@@ -160,7 +160,7 @@ layout("/layouts/platform.html"){
registerUserTableData: [], registerUserTableData: [],
registerUserTableColumns: [ registerUserTableColumns: [
{label: '姓名', prop: 'username'}, {label: '姓名', prop: 'username'},
{label: '一卡通号', prop: 'loginname'}, {label: '号', prop: 'loginname'},
{label: '联系方式', prop: 'mobile'}, {label: '联系方式', prop: 'mobile'},
{label: '单位', prop: 'unitname'}, {label: '单位', prop: 'unitname'},
{label: '分工会', prop: 'unionname'}, {label: '分工会', prop: 'unionname'},
@@ -132,7 +132,7 @@ layout("/layouts/platform.html"){
registerUserTableData: [], registerUserTableData: [],
registerUserTableColumns: [ registerUserTableColumns: [
{label: '姓名', prop: 'username'}, {label: '姓名', prop: 'username'},
{label: '一卡通号', prop: 'loginname'}, {label: '号', prop: 'loginname'},
{label: '单位', prop: 'unitname'}, {label: '单位', prop: 'unitname'},
{label: '分工会', prop: 'unionname'}, {label: '分工会', prop: 'unionname'},
{label: '联系方式', prop: 'mobile'}, {label: '联系方式', prop: 'mobile'},