commit
This commit is contained in:
+105
-9
@@ -1,8 +1,11 @@
|
||||
package io.v.nutz.zhgh.activity.controller.basic;
|
||||
|
||||
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.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
@@ -15,31 +18,35 @@ import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_role;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.template.UserTemp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,6 +63,9 @@ public class ActivityBasicScopeController {
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
@Inject
|
||||
private ActivityBasicScopeService activityBasicScopeService;
|
||||
|
||||
@@ -105,7 +115,8 @@ public class ActivityBasicScopeController {
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@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("""
|
||||
SELECT
|
||||
DISTINCT(u.id) as id,
|
||||
@@ -127,7 +138,10 @@ public class ActivityBasicScopeController {
|
||||
""");
|
||||
try {
|
||||
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, 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);
|
||||
return simpleService.list(pageForm, sql);
|
||||
@@ -169,7 +183,8 @@ public class ActivityBasicScopeController {
|
||||
@Param(value = "userId", required = false) String[] userId,
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@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("""
|
||||
SELECT DISTINCT
|
||||
( u.id ) AS userId
|
||||
@@ -181,6 +196,11 @@ public class ActivityBasicScopeController {
|
||||
""");
|
||||
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, 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.setCallback(Sqls.callback.entities());
|
||||
sql.setEntity(dao.getEntity(ActivityUserScope.class));
|
||||
@@ -339,7 +359,9 @@ public class ActivityBasicScopeController {
|
||||
@Param(value = "clubId", required = false) String clubId,
|
||||
@Param(value = "reverseSelection") boolean reverseSelection,
|
||||
@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("""
|
||||
SELECT
|
||||
@@ -363,7 +385,10 @@ public class ActivityBasicScopeController {
|
||||
|
||||
try {
|
||||
Cnd cnd = getCnd(pageForm, unionId, unitId, personTypes, userStates, memberTypes, 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);
|
||||
|
||||
List<NutMap> map = simpleService.listMap(sql);
|
||||
@@ -461,5 +486,76 @@ public class ActivityBasicScopeController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空查询条件
|
||||
*
|
||||
* @param existsLoginNameRedisKey
|
||||
* @return java.lang.Object
|
||||
* @author zhf
|
||||
* @description
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ViReturn
|
||||
@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());
|
||||
}).collect(Collectors.toList()));
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+154
-45
@@ -1,30 +1,39 @@
|
||||
package io.v.nutz.zhgh.activity.controller.basic;
|
||||
|
||||
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.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.service.SimpleService;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.activity.template.UserTemp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
@@ -45,6 +54,9 @@ public class ActivityBasicUserController {
|
||||
@Inject
|
||||
private SimpleService simpleService;
|
||||
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/activity/basic/ActivityUser.html")
|
||||
@RequiresPermissions("activity.basic.user")
|
||||
@@ -62,7 +74,8 @@ public class ActivityBasicUserController {
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "groupId", required = false) Integer groupId,
|
||||
@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("""
|
||||
SELECT
|
||||
aus.id,
|
||||
@@ -90,6 +103,9 @@ public class ActivityBasicUserController {
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equalsIgnoreCase("ascending") ? "ASC" : "DESC");
|
||||
}
|
||||
cnd.andEX("actit.unionid", "=", activityUnionId);
|
||||
cnd.andEX("actit.id", "=", activityUnitId);
|
||||
cnd.andEX("aus.groupId", "=", groupId);
|
||||
@@ -101,6 +117,11 @@ public class ActivityBasicUserController {
|
||||
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);
|
||||
return simpleService.list(pageForm, sql);
|
||||
}
|
||||
@@ -120,46 +141,41 @@ public class ActivityBasicUserController {
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "activityUnionId", required = false) String activityUnionId,
|
||||
@Param(value = "activityUnitId", required = false) String activityUnitId,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "userState", required = false) String userState) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
cnd.and("id", "=", id);
|
||||
simpleService.dao().clear(ActivityUserScope.class, cnd);
|
||||
} else {
|
||||
List<User> users = simpleService.dao().query(User.class, Cnd.NEW());
|
||||
if (StrUtil.isNotBlank(searchKeyword) && StrUtil.isNotBlank(searchName)) {
|
||||
users = users.stream().filter(v -> v.getLoginname().equals(searchKeyword) || v.getUsername().equals(searchKeyword)).collect(Collectors.toList());
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "existsLoginNameRedisKey", required = false) String existsLoginNameRedisKey) {
|
||||
List<String> existsLoginNames = new ArrayList<>();
|
||||
if(StrUtil.isNotBlank(existsLoginNameRedisKey) && redisService.exists(existsLoginNameRedisKey)){
|
||||
existsLoginNames = redisService.lrange(existsLoginNameRedisKey, 0, -1);
|
||||
if (StrUtil.isNotBlank(existsLoginNameRedisKey)) {
|
||||
redisService.del(existsLoginNameRedisKey);
|
||||
}
|
||||
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.and("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 +")"));
|
||||
}
|
||||
simpleService.dao().clear(ActivityUserScope.class,cnd);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -178,6 +194,7 @@ public class ActivityBasicUserController {
|
||||
u.loginname AS loginName,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.idcard,
|
||||
u.unitname AS unitName,
|
||||
u.unionName AS unionName
|
||||
FROM
|
||||
@@ -198,6 +215,7 @@ public class ActivityBasicUserController {
|
||||
exportEntities.add(new ExcelExportEntity("工会", "unionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("手机号码", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("身份证号", "idcard", 20));
|
||||
|
||||
|
||||
ViTool.excelResponse(response, "活动分组人员.xls");
|
||||
@@ -209,5 +227,96 @@ 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);
|
||||
simpleService.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());
|
||||
}).collect(Collectors.toList()));
|
||||
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
|
||||
@ViReturn
|
||||
@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.zhgh.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;
|
||||
|
||||
}
|
||||
@@ -95,7 +95,7 @@
|
||||
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
|
||||
placeholder="人员类型"
|
||||
@change="doSearch"
|
||||
code="PERSON_TYPE"></dict-select>
|
||||
code="UserType"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
|
||||
placeholder="在职状态"
|
||||
@change="doSearch"
|
||||
code="USER_STATE"></dict-select>
|
||||
code="UserState"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -118,10 +118,13 @@
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool :label="currentGroupName" :app="this">
|
||||
<template #label_end>
|
||||
<!-- <span class="text-danger pl5">提醒:删除活动分组操作,请先选择某个活动分组后,再点击右边的删除按钮。</span>-->
|
||||
<!-- <span class="text-danger pl5">提醒:删除活动分组操作,请先选择某个活动分组后,再点击右边的删除按钮。</span>-->
|
||||
</template>
|
||||
<template #func>
|
||||
|
||||
<el-button v-if="is_sysadmin||is_A06"
|
||||
type="primary" size="medium" icon="el-icon-printer" @click="dialogVisible = true">
|
||||
导入XLSX查询
|
||||
</el-button>
|
||||
<el-button @click="doExportUser" icon="el-icon-printer"
|
||||
size="medium" type="primary" :disabled="!pageForm.groupId">
|
||||
导出活动分组人员xlsx
|
||||
@@ -133,7 +136,7 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table ref="userTable" :data="tableData" stripe border :size="tableSize">
|
||||
<el-table ref="userTable" :data="tableData" stripe border :size="tableSize" @sort-change="pageOrder">
|
||||
<el-table-column type="index" label="序号" width="80px"></el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
@@ -164,6 +167,68 @@
|
||||
</el-row>
|
||||
</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>
|
||||
|
||||
|
||||
@@ -218,7 +283,7 @@ module.exports = {
|
||||
tableColumns: [
|
||||
{prop: 'loginName', label: '工号'},
|
||||
{prop: 'userName', label: '姓名'},
|
||||
{prop: 'sex', label: '性别'},
|
||||
{prop: 'sex', label: '性别', sortable: true},
|
||||
{prop: 'birthday', label: '出生年月'},
|
||||
{prop: 'mobile', label: '联系电话'},
|
||||
{prop: 'personType', label: '人员类型', sortable: true},
|
||||
@@ -230,13 +295,122 @@ module.exports = {
|
||||
],
|
||||
roleData: {},
|
||||
currentGroupName: null,
|
||||
|
||||
errorInfoData: {
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
errorCount: 0,
|
||||
errorList: 0,
|
||||
},
|
||||
dialogVisible: false,
|
||||
importLoading: false,
|
||||
importData: {
|
||||
fileList: [],
|
||||
},
|
||||
successUserIdList: []
|
||||
}
|
||||
},
|
||||
mixins: [initTableMixins],
|
||||
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: {
|
||||
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
|
||||
}
|
||||
});
|
||||
},
|
||||
viewGroupName() {
|
||||
if (this.pageForm.groupId) {
|
||||
const group = this.activityGroupList.find(v => v.groupId === this.pageForm.groupId)
|
||||
@@ -259,7 +433,9 @@ module.exports = {
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post('/platform/activity/basic/user/doDelete', {id, groupId})
|
||||
this.pageForm.id=id
|
||||
this.pageForm.groupId=groupId
|
||||
const resp = await $.post('/platform/activity/basic/user/doDelete', this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.$set(this.pageForm, "groupId", null)
|
||||
@@ -271,13 +447,12 @@ module.exports = {
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", "")
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
/* 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.ActivityUnits = await getActivityUnits(this.pageForm.activityUnionId)
|
||||
} else {
|
||||
this.units = await getUnits(this.unionid)
|
||||
}*/
|
||||
}
|
||||
},
|
||||
async getActivityGroup() {
|
||||
this.pageForm.groupId = ''
|
||||
@@ -288,6 +463,11 @@ module.exports = {
|
||||
}
|
||||
await this.pageData()
|
||||
},
|
||||
pageOrder(column) {
|
||||
this.pageForm.pageOrderName = column.prop
|
||||
this.pageForm.pageOrderBy = column.order
|
||||
this.pageData()
|
||||
},
|
||||
async pageData() {
|
||||
sublime.showLoadingbar()
|
||||
const resp = await $.post('/platform/activity/basic/user/pageData', this.pageForm)
|
||||
@@ -297,14 +477,19 @@ module.exports = {
|
||||
}
|
||||
sublime.closeLoadingbar()
|
||||
},
|
||||
async getRolesAndUnion() {
|
||||
const {data} = await $.post("/platform/activity/basic/scope/getRolesAndUnion")
|
||||
this.roleData = data
|
||||
}
|
||||
|
||||
},
|
||||
async created() {
|
||||
this.unions = await getUnions(null)
|
||||
// this.ActivityUnions = await getActivityUnions()
|
||||
this.ActivityUnions = await getActivityUnions()
|
||||
await this.flushUnits()
|
||||
await this.getActivityGroup()
|
||||
this.viewGroupName()
|
||||
await this.getRolesAndUnion()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true">
|
||||
<el-col class="query-title hidden-xs-only">会员类型:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-tag
|
||||
@@ -48,7 +48,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
|
||||
<el-col class="query-title">人员类型:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-tag
|
||||
@@ -75,7 +75,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
|
||||
<el-col class="query-title">在职状态:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-tag
|
||||
@@ -101,7 +101,7 @@
|
||||
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
|
||||
<el-col class="query-title">部门查询:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-row :gutter="20">
|
||||
@@ -130,7 +130,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<template v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
<template v-if="is_H10===true||is_A06===true||is_sysadmin===true">
|
||||
|
||||
<!--<el-row class="query-row">
|
||||
<el-col class="query-title">活动部门:</el-col>
|
||||
@@ -208,11 +208,12 @@
|
||||
</template>
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true">
|
||||
<el-col class="query-title">协会:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-select v-model="pageForm.clubId" placeholder="请选择协会" @change="doSearch"
|
||||
filterable
|
||||
:clearable="is_H10===true||is_A06===true||is_sysadmin===true||(is_H04===true&&is_H02===true)"
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in clubOptions"
|
||||
@@ -237,7 +238,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
|
||||
<el-col class="query-title">年龄范围:</el-col>
|
||||
<el-col class="query-content">
|
||||
<el-row type="flex" style="align-items: center">
|
||||
@@ -258,7 +259,7 @@
|
||||
|
||||
|
||||
<el-row class="query-row"
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
|
||||
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
|
||||
<el-col class="query-title">条件匹配:</el-col>
|
||||
<el-col class="query-content">
|
||||
<user-cnd @cnd="(v)=>{this.$set(this.pageForm,'activityUserCnd',v)}"></user-cnd>
|
||||
@@ -279,6 +280,10 @@
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="筛选人员">
|
||||
<template #func>
|
||||
<el-button v-if="is_sysadmin||is_A06"
|
||||
type="primary" size="medium" icon="el-icon-printer" @click="dialogVisible = true">
|
||||
导入XLSX设置分组
|
||||
</el-button>
|
||||
<el-button @click="doExportUser"
|
||||
size="medium"
|
||||
type="primary" icon="el-icon-download">
|
||||
@@ -349,6 +354,67 @@
|
||||
v-loading="settingLoading">确 定</el-button>
|
||||
</span>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@@ -434,7 +500,19 @@ module.exports = {
|
||||
setGroupName: [{required: true, message: '请输入分组名称', trigger: ['blur', 'change']}]
|
||||
},
|
||||
relatedSessionMenus: ['aca4d14498c145ceb5b24ed70776aae2', '733d7266652740a3aeac9da97ab5eeca', 'fe2d0768e26d4a80beeb159306bb8d01'],
|
||||
roleData: {}
|
||||
roleData: {},
|
||||
|
||||
dialogVisible: false,
|
||||
importLoading: false,
|
||||
importData: {
|
||||
fileList: [],
|
||||
},
|
||||
errorInfoData: {
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
errorCount: 0,
|
||||
errorList: 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -461,6 +539,98 @@ module.exports = {
|
||||
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'),
|
||||
},
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
doExportUser() {
|
||||
const {
|
||||
userId,
|
||||
@@ -476,7 +646,8 @@ module.exports = {
|
||||
activityGroupId,
|
||||
age,
|
||||
reverseSelection,
|
||||
activityUserCnd
|
||||
activityUserCnd,
|
||||
existsLoginNameRedisKey
|
||||
} = this.pageForm
|
||||
|
||||
let props = {}
|
||||
@@ -497,7 +668,8 @@ module.exports = {
|
||||
"&activityGroupId=" + activityGroupId +
|
||||
"&teacherMeetingId=" + teacherMeetingId +
|
||||
"&unionId=" + unionId +
|
||||
"&unitId=" + unitId
|
||||
"&unitId=" + unitId+
|
||||
"&existsLoginNameRedisKey=" + existsLoginNameRedisKey
|
||||
)
|
||||
},
|
||||
doReset() {
|
||||
@@ -534,13 +706,12 @@ module.exports = {
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", "")
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
/*if (this.is_sysadmin || this.is_A06) {
|
||||
if (this.is_sysadmin || this.is_A06) {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
this.activityUnits = await getActivityUnits(this.pageForm.activityUnionId)
|
||||
} else {
|
||||
this.units = await getUnits(this.unionid)
|
||||
}*/
|
||||
}
|
||||
},
|
||||
async pageData() {
|
||||
sublime.showLoadingbar()
|
||||
@@ -562,7 +733,7 @@ module.exports = {
|
||||
this.tableData = resp.data.list
|
||||
this.pageForm.totalCount = resp.data.totalCount
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
async doSetActivityUser() {
|
||||
@@ -600,7 +771,7 @@ module.exports = {
|
||||
// this.userScopeDialog = false
|
||||
await this.getActivityGroup()
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
this.notifySuccess(resp.msg)
|
||||
this.formData = {
|
||||
setGroupType: null,
|
||||
setGroupId: null,
|
||||
@@ -649,9 +820,8 @@ module.exports = {
|
||||
async created() {
|
||||
await this.getRolesAndUnion()
|
||||
this.clubOptions = await getClubsByRole()
|
||||
this.unions = await getUnions(null)
|
||||
|
||||
/* if (((this.is_sysadmin || this.is_A06 || this.is_H02) === false) && this.is_H04 === true) {
|
||||
if (((this.is_sysadmin || this.is_A06 || this.is_H02) === false) && this.is_H04 === true) {
|
||||
this.unions = await getUnionList(this.unionid)
|
||||
this.$set(this.pageForm, "unionId", this.unions[0].id)
|
||||
} else {
|
||||
@@ -662,11 +832,11 @@ module.exports = {
|
||||
if (this.clubOptions.length > 0) {
|
||||
this.$set(this.pageForm, "clubId", this.clubOptions[0].stid)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
await this.flushUnits()
|
||||
await this.getActivityGroup()
|
||||
this.personTypeOptions = await getDictOptions("PERSON_TYPE")
|
||||
this.userStateOptions = await getDictOptions("USER_STATE")
|
||||
this.personTypeOptions = await getDictOptions("UserType")
|
||||
this.userStateOptions = await getDictOptions("UserState")
|
||||
await this.getMenuOptions()
|
||||
await this.pageData()
|
||||
},
|
||||
|
||||
@@ -3,46 +3,8 @@ layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.query-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.query-row:not(:last-child) {
|
||||
border-bottom: 1px dashed rgb(230, 230, 230);
|
||||
}
|
||||
|
||||
.query-row > .query-title {
|
||||
width: 100px;
|
||||
max-width: 100px;
|
||||
min-width: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.query-row > .query-content {
|
||||
min-width: 200px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.query-row > .query-content > .el-tag {
|
||||
margin-bottom: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 992px) {
|
||||
.query-row:nth-child(4) .query-content .el-col:not(:last-child) {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.query-title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.reverseCheckBox {
|
||||
margin: 0 10px 0 0 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -59,247 +21,20 @@ layout("/layouts/platform.html"){
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
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: {
|
||||
'user-scope': httpVueLoader('/components/plugins/UserScope.vue'),
|
||||
'user-scope': httpVueLoader('/components/plugins/UserScope.vue?v=' + new Date().getTime()),
|
||||
},
|
||||
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.$message.success(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() {
|
||||
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() {
|
||||
/* 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("PERSON_TYPE")
|
||||
this.userStateOptions = await getDictOptions("USER_STATE")
|
||||
await this.getMenuOptions()
|
||||
this.pageData()*/
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3,19 +3,6 @@ layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.query-row {
|
||||
|
||||
}
|
||||
|
||||
.query-title {
|
||||
color: rgb(100, 100, 100);
|
||||
margin-right: 10px;
|
||||
min-width: 75px;
|
||||
}
|
||||
|
||||
.query-content {
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
@@ -25,156 +12,6 @@ layout("/layouts/platform.html"){
|
||||
:group_id.sync="formData.activityGroupId"
|
||||
></user-data-scope>
|
||||
</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>
|
||||
|
||||
<!–<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>–>
|
||||
|
||||
<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="PERSON_TYPE"></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="USER_STATE"></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>
|
||||
<!–#include("/layouts/pagination.html"){}#–>
|
||||
</el-card>
|
||||
|
||||
</guava>-->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -182,89 +19,20 @@ layout("/layouts/platform.html"){
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
'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: {
|
||||
currentGroupName() {
|
||||
if (this.pageForm.groupId) {
|
||||
const group = this.activityGroupList.find(v => v.groupId === this.pageForm.groupId)
|
||||
return group.groupName + '人员'
|
||||
}
|
||||
return '全部人员'
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
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: {
|
||||
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.$message.success(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() {
|
||||
this.pageData()
|
||||
await this.getActivityGroup()
|
||||
this.unions = await getUnions(null)
|
||||
this.ActivityUnions = await getActivityUnions()
|
||||
this.flushUnits()
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user