mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 12:03:05 +08:00
Merge branch 'dev' into pr@dev_dataset_source
This commit is contained in:
commit
af84c4d6c5
@ -24,6 +24,7 @@ import io.dataease.controller.sys.request.SysUserStateRequest;
|
||||
import io.dataease.controller.sys.response.RoleUserItem;
|
||||
import io.dataease.controller.sys.response.SysUserGridResponse;
|
||||
import io.dataease.plugins.common.base.domain.SysUser;
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import io.dataease.service.sys.SysRoleService;
|
||||
import io.dataease.service.sys.SysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -226,4 +227,9 @@ public class SysUserController {
|
||||
authUserService.unlockAccount(username, one.getFrom());
|
||||
}
|
||||
|
||||
@PostMapping("/assistInfo/{userId}")
|
||||
public SysUserAssist assistInfo(@PathVariable("userId") Long userId) {
|
||||
return sysUserService.assistInfo(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.controller.sys.request;
|
||||
|
||||
import io.dataease.plugins.common.base.domain.SysUser;
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -14,4 +15,7 @@ public class SysUserCreateRequest extends SysUser {
|
||||
@ApiModelProperty(value = "角色ID集合", required = true, position = 7)
|
||||
private List<Long> roleIds;
|
||||
|
||||
@ApiModelProperty(value = "辅助信息", required = false, position = 8)
|
||||
private SysUserAssist sysUserAssist;
|
||||
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
package io.dataease.ext;
|
||||
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@Mapper
|
||||
public interface ExtSysUserAssistMapper {
|
||||
|
||||
@Insert("insert into sys_user_assist values(#{po.userId}, #{po.needFirstNoti})")
|
||||
void save(@Param("po") SysUserAssist po);
|
||||
|
||||
@Select("select * from sys_user_assist where user_id = #{userId}")
|
||||
SysUserAssist query(@Param("userId") Long userId);
|
||||
}
|
@ -14,6 +14,7 @@ import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.job.sechedule.ScheduleManager;
|
||||
import io.dataease.job.sechedule.strategy.TaskHandler;
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import io.dataease.plugins.common.entity.GlobalTaskEntity;
|
||||
import io.dataease.plugins.common.entity.GlobalTaskInstance;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
@ -28,6 +29,7 @@ import io.dataease.plugins.xpack.lark.service.LarkXpackService;
|
||||
import io.dataease.plugins.xpack.wecom.dto.entity.WecomMsgResult;
|
||||
import io.dataease.plugins.xpack.wecom.service.WecomXpackService;
|
||||
import io.dataease.service.chart.ViewExportExcel;
|
||||
import io.dataease.service.sys.SysUserService;
|
||||
import io.dataease.service.system.EmailService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -154,6 +156,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
|
||||
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
|
||||
AuthUserServiceImpl userService = SpringContextUtil.getBean(AuthUserServiceImpl.class);
|
||||
SysUserService sysUserService = SpringContextUtil.getBean(SysUserService.class);
|
||||
try {
|
||||
XpackEmailTaskRequest taskForm = emailXpackService.taskForm(taskInstance.getTaskId());
|
||||
if (ObjectUtils.isEmpty(taskForm) || CronUtils.taskExpire(taskForm.getEndTime())) {
|
||||
@ -215,17 +218,24 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
for (int i = 0; i < channels.size(); i++) {
|
||||
String channel = channels.get(i);
|
||||
switch (channel) {
|
||||
case "email" :
|
||||
case "email":
|
||||
if (StringUtils.isNotBlank(recipients))
|
||||
emailService.sendWithImageAndFiles(recipients, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
break;
|
||||
case "wecom" :
|
||||
case "wecom":
|
||||
if (SpringContextUtil.getBean(AuthUserService.class).supportWecom()) {
|
||||
|
||||
List<String> wecomUsers = reciLists.stream().filter(reci -> {
|
||||
List<String> wecomUsers = new ArrayList<>();
|
||||
for (int j = 0; j < reciLists.size(); j++) {
|
||||
String reci = reciLists.get(j);
|
||||
SysUserEntity userBySub = userService.getUserBySub(reci, 4);
|
||||
return ObjectUtils.isNotEmpty(userBySub);
|
||||
}).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(userBySub)) continue;
|
||||
Long userId = userBySub.getUserId();
|
||||
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);
|
||||
if (ObjectUtils.isEmpty(sysUserAssist) || StringUtils.isBlank(sysUserAssist.getLarkId()))
|
||||
continue;
|
||||
wecomUsers.add(sysUserAssist.getLarkId());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wecomUsers)) {
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
WecomMsgResult wecomMsgResult = wecomXpackService.pushOaMsg(wecomUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
@ -236,12 +246,20 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
|
||||
}
|
||||
break;
|
||||
case "dingtalk" :
|
||||
case "dingtalk":
|
||||
if (SpringContextUtil.getBean(AuthUserService.class).supportDingtalk()) {
|
||||
List<String> dingTalkUsers = reciLists.stream().filter(reci -> {
|
||||
List<String> dingTalkUsers = new ArrayList<>();
|
||||
for (int j = 0; j < reciLists.size(); j++) {
|
||||
String reci = reciLists.get(j);
|
||||
SysUserEntity userBySub = userService.getUserBySub(reci, 5);
|
||||
return ObjectUtils.isNotEmpty(userBySub);
|
||||
}).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(userBySub)) continue;
|
||||
Long userId = userBySub.getUserId();
|
||||
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);
|
||||
if (ObjectUtils.isEmpty(sysUserAssist) || StringUtils.isBlank(sysUserAssist.getLarkId()))
|
||||
continue;
|
||||
dingTalkUsers.add(sysUserAssist.getLarkId());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(dingTalkUsers)) {
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
DingtalkMsgResult dingtalkMsgResult = dingtalkXpackService.pushOaMsg(dingTalkUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
@ -252,12 +270,20 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
|
||||
}
|
||||
break;
|
||||
case "lark" :
|
||||
case "lark":
|
||||
if (SpringContextUtil.getBean(AuthUserService.class).supportLark()) {
|
||||
List<String> larkUsers = reciLists.stream().filter(reci -> {
|
||||
List<String> larkUsers = new ArrayList<>();
|
||||
for (int j = 0; j < reciLists.size(); j++) {
|
||||
String reci = reciLists.get(j);
|
||||
SysUserEntity userBySub = userService.getUserBySub(reci, 6);
|
||||
return ObjectUtils.isNotEmpty(userBySub);
|
||||
}).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(userBySub)) continue;
|
||||
Long userId = userBySub.getUserId();
|
||||
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);
|
||||
if (ObjectUtils.isEmpty(sysUserAssist) || StringUtils.isBlank(sysUserAssist.getLarkId()))
|
||||
continue;
|
||||
larkUsers.add(sysUserAssist.getLarkId());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(larkUsers)) {
|
||||
LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
|
||||
LarkMsgResult larkMsgResult = larkXpackService.pushOaMsg(larkUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
|
@ -1,13 +1,17 @@
|
||||
package io.dataease.service.message.service.strategy;
|
||||
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.dingtalk.service.DingtalkXpackService;
|
||||
import io.dataease.service.message.service.SendService;
|
||||
import io.dataease.service.sys.SysUserService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -17,12 +21,14 @@ public class SendDingtalk implements SendService {
|
||||
@Autowired
|
||||
private AuthUserService authUserService;
|
||||
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
SysUserEntity userEntity = authUserService.getUserById(userId);
|
||||
|
||||
if (userEntity.getFrom() == 5 && authUserService.supportDingtalk()) {
|
||||
String username = userEntity.getUsername();
|
||||
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);
|
||||
if (ObjectUtils.isNotEmpty(sysUserAssist) && StringUtils.isNotBlank(sysUserAssist.getDingtalkId()) && authUserService.supportDingtalk()) {
|
||||
String username = sysUserAssist.getDingtalkId();
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(username);
|
||||
|
@ -1,13 +1,17 @@
|
||||
package io.dataease.service.message.service.strategy;
|
||||
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.lark.service.LarkXpackService;
|
||||
import io.dataease.service.message.service.SendService;
|
||||
import io.dataease.service.sys.SysUserService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -17,12 +21,14 @@ public class SendLark implements SendService {
|
||||
@Autowired
|
||||
private AuthUserService authUserService;
|
||||
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
SysUserEntity userEntity = authUserService.getUserById(userId);
|
||||
|
||||
if (userEntity.getFrom() == 6 && authUserService.supportLark()) {
|
||||
String username = userEntity.getUsername();
|
||||
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);
|
||||
if (ObjectUtils.isNotEmpty(sysUserAssist) && StringUtils.isNotBlank(sysUserAssist.getLarkId()) && authUserService.supportLark()) {
|
||||
String username = sysUserAssist.getLarkId();
|
||||
LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(username);
|
||||
|
@ -1,13 +1,17 @@
|
||||
package io.dataease.service.message.service.strategy;
|
||||
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.plugins.common.base.domain.SysUserAssist;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.wecom.service.WecomXpackService;
|
||||
import io.dataease.service.message.service.SendService;
|
||||
import io.dataease.service.sys.SysUserService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -16,12 +20,16 @@ public class SendWecom implements SendService {
|
||||
|
||||
@Autowired
|
||||
private AuthUserService authUserService;
|
||||
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
SysUserEntity userEntity = authUserService.getUserById(userId);
|
||||
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);
|
||||
if (ObjectUtils.isNotEmpty(sysUserAssist) && StringUtils.isNotBlank(sysUserAssist.getWecomId()) && authUserService.supportWecom()) {
|
||||
|
||||
if (userEntity.getFrom() == 4 && authUserService.supportWecom()) {
|
||||
String username = userEntity.getUsername();
|
||||
String username = sysUserAssist.getWecomId();
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(username);
|
||||
|
@ -5,7 +5,6 @@ import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.auth.service.ExtAuthService;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.controller.sys.request.*;
|
||||
import io.dataease.ext.ExtSysUserAssistMapper;
|
||||
import io.dataease.ext.ExtSysUserMapper;
|
||||
import io.dataease.ext.query.GridExample;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
@ -16,6 +15,7 @@ import io.dataease.controller.sys.response.SysUserGridResponse;
|
||||
import io.dataease.controller.sys.response.SysUserRole;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.*;
|
||||
import io.dataease.plugins.common.base.mapper.SysUserAssistMapper;
|
||||
import io.dataease.plugins.common.base.mapper.SysUserMapper;
|
||||
import io.dataease.plugins.common.base.mapper.SysUsersRolesMapper;
|
||||
import io.dataease.plugins.common.entity.XpackLdapUserEntity;
|
||||
@ -36,6 +36,7 @@ import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@ -57,8 +58,9 @@ public class SysUserService {
|
||||
@Resource
|
||||
private ExtAuthService extAuthService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ExtSysUserAssistMapper extSysUserAssistMapper;
|
||||
private SysUserAssistMapper sysUserAssistMapper;
|
||||
|
||||
@Resource
|
||||
private AuthUserService authUserService;
|
||||
@ -99,8 +101,15 @@ public class SysUserService {
|
||||
}
|
||||
int insert = sysUserMapper.insert(user);
|
||||
SysUser dbUser = findOne(user);
|
||||
request.setUserId(dbUser.getUserId());
|
||||
saveUserRoles(dbUser.getUserId(), request.getRoleIds());//插入用户角色关联
|
||||
Long userId = dbUser.getUserId();
|
||||
request.setUserId(userId);
|
||||
saveUserRoles(userId, request.getRoleIds());//插入用户角色关联
|
||||
|
||||
SysUserAssist sysUserAssist = request.getSysUserAssist();
|
||||
if (ObjectUtils.isNotEmpty(sysUserAssist) && (StringUtils.isNotBlank(sysUserAssist.getWecomId()) || StringUtils.isNotBlank(sysUserAssist.getDingtalkId()) || StringUtils.isNotBlank(sysUserAssist.getLarkId()))) {
|
||||
saveAssist(userId, sysUserAssist.getWecomId(), sysUserAssist.getDingtalkId(), sysUserAssist.getLarkId());
|
||||
}
|
||||
|
||||
return insert;
|
||||
}
|
||||
|
||||
@ -125,12 +134,12 @@ public class SysUserService {
|
||||
// oidc默认角色是普通员工
|
||||
List<Long> roleIds = new ArrayList<Long>();
|
||||
roleIds.add(2L);
|
||||
saveUserRoles( dbUser.getUserId(), roleIds);
|
||||
saveUserRoles(dbUser.getUserId(), roleIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void saveWecomCUser(Map<String, Object> userMap , String userId, String email) {
|
||||
public void saveWecomCUser(Map<String, Object> userMap, String userId, String email) {
|
||||
long now = System.currentTimeMillis();
|
||||
SysUser sysUser = new SysUser();
|
||||
|
||||
@ -148,6 +157,7 @@ public class SysUserService {
|
||||
sysUser.setIsAdmin(false);
|
||||
sysUser.setSub(userId);
|
||||
sysUserMapper.insert(sysUser);
|
||||
Optional.ofNullable(findOne(sysUser)).ifPresent(u -> saveAssist(u.getUserId(), u.getUsername(), null, null));
|
||||
|
||||
}
|
||||
|
||||
@ -170,7 +180,7 @@ public class SysUserService {
|
||||
sysUser.setSub(dingUserEntity.getUnionid());
|
||||
sysUser.setPhone(dingUserEntity.getMobile());
|
||||
sysUserMapper.insert(sysUser);
|
||||
|
||||
Optional.ofNullable(findOne(sysUser)).ifPresent(u -> saveAssist(u.getUserId(), null, u.getUsername(), null));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ -192,7 +202,7 @@ public class SysUserService {
|
||||
sysUser.setSub(larkUserInfo.getSub());
|
||||
sysUser.setPhone(larkUserInfo.getMobile());
|
||||
sysUserMapper.insert(sysUser);
|
||||
|
||||
Optional.ofNullable(findOne(sysUser)).ifPresent(u -> saveAssist(u.getUserId(), null, null, u.getUsername()));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ -215,7 +225,7 @@ public class SysUserService {
|
||||
// oidc默认角色是普通员工
|
||||
List<Long> roleIds = new ArrayList<Long>();
|
||||
roleIds.add(2L);
|
||||
saveUserRoles( dbUser.getUserId(), roleIds);
|
||||
saveUserRoles(dbUser.getUserId(), roleIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +257,7 @@ public class SysUserService {
|
||||
sysUserMapper.insert(sysUser);
|
||||
SysUser dbUser = findOne(sysUser);
|
||||
if (null != dbUser && null != dbUser.getUserId()) {
|
||||
saveUserRoles( dbUser.getUserId(), request.getRoleIds());
|
||||
saveUserRoles(dbUser.getUserId(), request.getRoleIds());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -285,7 +295,13 @@ public class SysUserService {
|
||||
saveUserRoles(user.getUserId(), request.getRoleIds());//再插入角色关联
|
||||
if (ObjectUtils.isEmpty(user.getDeptId())) user.setDeptId(0L);
|
||||
authUserService.clearCache(user.getUserId());
|
||||
return sysUserMapper.updateByPrimaryKeySelective(user);
|
||||
int result = sysUserMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
SysUserAssist sysUserAssist = request.getSysUserAssist();
|
||||
if (ObjectUtils.isNotEmpty(sysUserAssist) && (StringUtils.isNotBlank(sysUserAssist.getWecomId()) || StringUtils.isNotBlank(sysUserAssist.getDingtalkId()) || StringUtils.isNotBlank(sysUserAssist.getLarkId()))) {
|
||||
saveAssist(user.getUserId(), sysUserAssist.getWecomId(), sysUserAssist.getDingtalkId(), sysUserAssist.getLarkId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -308,6 +324,7 @@ public class SysUserService {
|
||||
* 更新用户基本信息
|
||||
* 只允许修改 email, nickname, phone
|
||||
* 防止此接口被恶意利用更改不允许更改的信息,新建SysUser对象并只设置部分值
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ -426,33 +443,34 @@ public class SysUserService {
|
||||
SysUserExample example = new SysUserExample();
|
||||
example.createCriteria().andUsernameEqualTo(userName);
|
||||
List<SysUser> users = sysUserMapper.selectByExample(example);
|
||||
if(CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户ID【"+userName+"】已存在,请联系管理员");
|
||||
if (CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户ID【" + userName + "】已存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
public void validateExistUser(String userName, String nickName, String email) {
|
||||
SysUserExample example = new SysUserExample();
|
||||
if (StringUtils.isNotBlank(userName)) {
|
||||
example.createCriteria().andUsernameEqualTo(userName);
|
||||
List<SysUser> users = sysUserMapper.selectByExample(example);
|
||||
if(CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户ID【"+userName+"】已存在,请联系管理员");
|
||||
if (CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户ID【" + userName + "】已存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(nickName)) {
|
||||
example.createCriteria().andNickNameEqualTo(nickName);
|
||||
List<SysUser> users = sysUserMapper.selectByExample(example);
|
||||
if(CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户姓名【"+nickName+"】已存在,请联系管理员");
|
||||
if (CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户姓名【" + nickName + "】已存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
example.clear();
|
||||
if (StringUtils.isNotBlank(email)) {
|
||||
example.createCriteria().andEmailEqualTo(email);
|
||||
List<SysUser> users = sysUserMapper.selectByExample(example);
|
||||
if(CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户邮箱【"+email+"】已存在,请联系管理员");
|
||||
if (CollectionUtils.isNotEmpty(users)) {
|
||||
throw new RuntimeException("用户邮箱【" + email + "】已存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -510,16 +528,43 @@ public class SysUserService {
|
||||
}
|
||||
|
||||
public boolean needPwdNoti(Long userId) {
|
||||
SysUserAssist userAssist = extSysUserAssistMapper.query(userId);
|
||||
SysUserAssist userAssist = sysUserAssistMapper.selectByPrimaryKey(userId);
|
||||
return ObjectUtils.isEmpty(userAssist) || userAssist.getNeedFirstNoti();
|
||||
}
|
||||
|
||||
public void saveUserAssist(Boolean noti) {
|
||||
Long userId = AuthUtils.getUser().getUserId();
|
||||
SysUserAssist existAssist = sysUserAssistMapper.selectByPrimaryKey(userId);
|
||||
if (ObjectUtils.isNotEmpty(existAssist)) {
|
||||
existAssist.setNeedFirstNoti(noti);
|
||||
sysUserAssistMapper.updateByPrimaryKey(existAssist);
|
||||
return;
|
||||
}
|
||||
SysUserAssist sysUserAssist = new SysUserAssist();
|
||||
sysUserAssist.setUserId(userId);
|
||||
sysUserAssist.setNeedFirstNoti(noti);
|
||||
extSysUserAssistMapper.save(sysUserAssist);
|
||||
sysUserAssistMapper.insertSelective(sysUserAssist);
|
||||
}
|
||||
|
||||
public void saveAssist(Long userId, String wecomId, String dingtlkId, String larkId) {
|
||||
SysUserAssist existAssist = sysUserAssistMapper.selectByPrimaryKey(userId);
|
||||
if (ObjectUtils.isNotEmpty(existAssist)) {
|
||||
existAssist.setWecomId(wecomId);
|
||||
existAssist.setDingtalkId(dingtlkId);
|
||||
existAssist.setLarkId(larkId);
|
||||
sysUserAssistMapper.updateByPrimaryKey(existAssist);
|
||||
return;
|
||||
}
|
||||
SysUserAssist sysUserAssist = new SysUserAssist();
|
||||
sysUserAssist.setUserId(userId);
|
||||
sysUserAssist.setWecomId(wecomId);
|
||||
sysUserAssist.setDingtalkId(dingtlkId);
|
||||
sysUserAssist.setLarkId(larkId);
|
||||
sysUserAssistMapper.insert(sysUserAssist);
|
||||
}
|
||||
|
||||
public SysUserAssist assistInfo(Long userId) {
|
||||
return sysUserAssistMapper.selectByPrimaryKey(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -116,3 +116,8 @@ INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_typ
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('98d77463-38bb-11ed-8383-0242ac130005', 'f4e07708-26f1-4f42-9a4a-8e6dae63353c', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1663661389000, NULL, NULL, NULL);
|
||||
INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_type`, `privilege_value`, `privilege_extend`, `remark`, `create_user`, `create_time`, `update_time`, `copy_from`, `copy_id`) VALUES ('98d77856-38bb-11ed-8383-0242ac130005', 'f4e07708-26f1-4f42-9a4a-8e6dae63353c', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1663661389000, NULL, NULL, NULL);
|
||||
|
||||
ALTER TABLE `sys_user_assist`
|
||||
ADD COLUMN `wecom_id` varchar(255) NULL COMMENT '企业微信账号' AFTER `need_first_noti`,
|
||||
ADD COLUMN `dingtalk_id` varchar(255) NULL COMMENT '钉钉账号' AFTER `wecom_id`,
|
||||
ADD COLUMN `lark_id` varchar(255) NULL COMMENT '飞书账号' AFTER `dingtalk_id`;
|
||||
|
||||
|
@ -10,7 +10,8 @@ const pathMap = {
|
||||
updatePath: '/api/user/update',
|
||||
editPasswordPath: '/api/user/adminUpdatePwd',
|
||||
editStatusPath: '/api/user/updateStatus',
|
||||
unlockPath: '/api/user/unlock/'
|
||||
unlockPath: '/api/user/unlock/',
|
||||
queryAssistPath: '/api/user/assistInfo/'
|
||||
}
|
||||
export function userLists(page, size, data) {
|
||||
return request({
|
||||
@ -142,4 +143,12 @@ export function unLock(username) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { editPassword, delUser, editUser, addUser, userLists, editStatus, personInfo, updatePerson, updatePersonPwd, allRoles, roleGrid, ldapUsers, saveLdapUser, existLdapUsers, unLock }
|
||||
export function queryAssist(userId) {
|
||||
return request({
|
||||
url: pathMap.queryAssistPath + userId,
|
||||
method: 'post',
|
||||
loading: false
|
||||
})
|
||||
}
|
||||
|
||||
export default { editPassword, delUser, editUser, addUser, userLists, editStatus, personInfo, updatePerson, updatePersonPwd, allRoles, roleGrid, ldapUsers, saveLdapUser, existLdapUsers, unLock, queryAssist }
|
||||
|
@ -815,11 +815,13 @@ export default {
|
||||
e.stopPropagation()
|
||||
// 此处阻止冒泡 但是外层需要获取pageX pageY
|
||||
this.element.auxiliaryMatrix && this.$emit('elementMouseDown', e)
|
||||
this.$store.commit('setCurComponent', { component: this.element, index: this.index })
|
||||
// 移动端组件点击自动置顶
|
||||
this.mobileLayoutStatus && this.$store.commit('topComponent')
|
||||
eventsFor = events.mouse
|
||||
this.elementDown(e)
|
||||
this.$nextTick(()=>{
|
||||
this.$store.commit('setCurComponent', { component: this.element, index: this.index })
|
||||
})
|
||||
},
|
||||
// 元素按下
|
||||
elementDown(e) {
|
||||
|
@ -132,11 +132,10 @@ export default {
|
||||
},
|
||||
commons: {
|
||||
|
||||
|
||||
unlock: 'Unlock',
|
||||
unlock_success: 'Unlock success',
|
||||
|
||||
uninstall:'Uninstall',
|
||||
uninstall: 'Uninstall',
|
||||
|
||||
no_result: 'No Result',
|
||||
manage_member: 'Managing members',
|
||||
@ -674,7 +673,13 @@ export default {
|
||||
filter: 'Screen',
|
||||
list: 'List item',
|
||||
list_info: 'Please select the information to be displayed in the list',
|
||||
sure_delete: 'Are you sure to delete this user?'
|
||||
sure_delete: 'Are you sure to delete this user?',
|
||||
wecom_id: 'Wecom Account',
|
||||
dingtalk_id: 'Dingtalk Account',
|
||||
lark_id: 'Lark Account',
|
||||
input_wecom_id: 'Please input wecom account',
|
||||
input_dingtalk_id: 'Please input dingtalk account',
|
||||
input_lark_id: 'Please input lark account'
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP url',
|
||||
@ -1309,6 +1314,9 @@ export default {
|
||||
analyse_cfg: 'Analyse',
|
||||
slider: 'Slider',
|
||||
slider_range: 'Range',
|
||||
slider_bg: 'Background',
|
||||
slider_fill_bg: 'Selected Background',
|
||||
slider_text_color: 'Font Color',
|
||||
chart_no_senior: 'This chart type not support senior config,please look forward to.',
|
||||
chart_no_properties: 'This chart type not support properties config.',
|
||||
assist_line: 'Assist Line',
|
||||
|
@ -132,11 +132,10 @@ export default {
|
||||
},
|
||||
commons: {
|
||||
|
||||
|
||||
unlock: '解鎖',
|
||||
unlock_success: '解鎖成功',
|
||||
|
||||
uninstall:'卸载',
|
||||
uninstall: '卸载',
|
||||
|
||||
no_result: '没有找到相关内容',
|
||||
manage_member: '管理成員',
|
||||
@ -674,7 +673,13 @@ export default {
|
||||
filter: '篩選',
|
||||
list: '列表項',
|
||||
list_info: '請選擇列表中要展示的信息',
|
||||
sure_delete: '確定刪除該用戶嗎?'
|
||||
sure_delete: '確定刪除該用戶嗎?',
|
||||
wecom_id: '企業微信賬號',
|
||||
dingtalk_id: '釘釘賬號',
|
||||
lark_id: '飛書賬號',
|
||||
input_wecom_id: '請輸入企業微信賬號',
|
||||
input_dingtalk_id: '請輸入釘釘賬號',
|
||||
input_lark_id: '請輸入飛書賬號'
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP地址',
|
||||
@ -1309,6 +1314,9 @@ export default {
|
||||
analyse_cfg: '分析預警',
|
||||
slider: '縮略軸',
|
||||
slider_range: '默認範圍',
|
||||
slider_bg: '背景',
|
||||
slider_fill_bg: '選中背景',
|
||||
slider_text_color: '字體顏色',
|
||||
chart_no_senior: '當前圖表類型暫無高級配置,敬請期待',
|
||||
chart_no_properties: '當前圖表類型暫無样式配置.',
|
||||
assist_line: '輔助線',
|
||||
|
@ -134,7 +134,7 @@ export default {
|
||||
|
||||
unlock: '解锁',
|
||||
unlock_success: '解锁成功',
|
||||
uninstall:'卸载',
|
||||
uninstall: '卸载',
|
||||
|
||||
no_result: '没有找到相关内容',
|
||||
manage_member: '管理成员',
|
||||
@ -672,7 +672,13 @@ export default {
|
||||
filter: '筛选',
|
||||
list: '列表项',
|
||||
list_info: '请选择列表中要展示的信息',
|
||||
sure_delete: '确定删除该用户吗?'
|
||||
sure_delete: '确定删除该用户吗?',
|
||||
wecom_id: '企业微信账号',
|
||||
dingtalk_id: '钉钉账号',
|
||||
lark_id: '飞书账号',
|
||||
input_wecom_id: '请输入企业微信账号',
|
||||
input_dingtalk_id: '请输入钉钉账号',
|
||||
input_lark_id: '请输入飞书账号'
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP地址',
|
||||
@ -1307,6 +1313,9 @@ export default {
|
||||
analyse_cfg: '分析预警',
|
||||
slider: '缩略轴',
|
||||
slider_range: '默认范围',
|
||||
slider_bg: '背景',
|
||||
slider_fill_bg: '选中背景',
|
||||
slider_text_color: '字体颜色',
|
||||
chart_no_senior: '当前图表类型暂无高级配置,敬请期待',
|
||||
chart_no_properties: '当前图表类型暂无样式配置',
|
||||
assist_line: '辅助线',
|
||||
|
@ -382,7 +382,10 @@ export const DEFAULT_SPLIT = {
|
||||
}
|
||||
export const DEFAULT_FUNCTION_CFG = {
|
||||
sliderShow: false,
|
||||
sliderRange: [0, 10]
|
||||
sliderRange: [0, 10],
|
||||
sliderBg: '#FFFFFF',
|
||||
sliderFillBg: '#BCD6F1',
|
||||
sliderTextClolor: '#999999'
|
||||
}
|
||||
export const DEFAULT_THRESHOLD = {
|
||||
gaugeThreshold: '',
|
||||
|
@ -192,6 +192,16 @@ export function componentStyle(chart_option, chart) {
|
||||
}
|
||||
}
|
||||
|
||||
const hexToRgba = (hex, opacity) => {
|
||||
let rgbaColor = ''
|
||||
const reg = /^#[\da-f]{6}$/i
|
||||
if (reg.test(hex)) {
|
||||
rgbaColor = `rgba(${parseInt('0x' + hex.slice(1, 3))},${parseInt(
|
||||
'0x' + hex.slice(3, 5)
|
||||
)},${parseInt('0x' + hex.slice(5, 7))},${opacity})`
|
||||
}
|
||||
return rgbaColor
|
||||
}
|
||||
export function seniorCfg(chart_option, chart) {
|
||||
if (chart.senior && chart.type && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('mix'))) {
|
||||
const senior = JSON.parse(chart.senior)
|
||||
@ -209,6 +219,26 @@ export function seniorCfg(chart_option, chart) {
|
||||
end: parseInt(senior.functionCfg.sliderRange[1])
|
||||
}
|
||||
]
|
||||
if (senior.functionCfg.sliderBg) {
|
||||
chart_option.dataZoom[1].dataBackground = {
|
||||
lineStyle: { color: reverseColor(senior.functionCfg.sliderBg), opacity: 0.3 },
|
||||
areaStyle: { color: reverseColor(senior.functionCfg.sliderBg), opacity: 0.1 }
|
||||
}
|
||||
}
|
||||
if (senior.functionCfg.sliderFillBg) {
|
||||
chart_option.dataZoom[1].selectedDataBackground = {
|
||||
lineStyle: { color: senior.functionCfg.sliderFillBg },
|
||||
areaStyle: { color: senior.functionCfg.sliderFillBg }
|
||||
}
|
||||
const rgba = hexToRgba(senior.functionCfg.sliderFillBg, 0.5)
|
||||
chart_option.dataZoom[1].fillerColor = rgba
|
||||
}
|
||||
if (senior.functionCfg.sliderTextClolor) {
|
||||
chart_option.dataZoom[1].textStyle = { color: senior.functionCfg.sliderTextClolor }
|
||||
const rgba = hexToRgba(senior.functionCfg.sliderTextClolor, 0.5)
|
||||
chart_option.dataZoom[1].handleStyle = { color: rgba }
|
||||
}
|
||||
|
||||
if (chart.type.includes('horizontal')) {
|
||||
chart_option.dataZoom[0].yAxisIndex = [0]
|
||||
chart_option.dataZoom[1].yAxisIndex = [0]
|
||||
|
@ -636,6 +636,31 @@ export function getSlider(chart) {
|
||||
start: parseInt(senior.functionCfg.sliderRange[0]) / 100,
|
||||
end: parseInt(senior.functionCfg.sliderRange[1]) / 100
|
||||
}
|
||||
|
||||
if (senior.functionCfg.sliderBg) {
|
||||
cfg.backgroundStyle = {
|
||||
fill: senior.functionCfg.sliderBg,
|
||||
stroke: senior.functionCfg.sliderBg,
|
||||
lineWidth: 1,
|
||||
strokeOpacity: 0.5
|
||||
}
|
||||
}
|
||||
if (senior.functionCfg.sliderFillBg) {
|
||||
cfg.foregroundStyle = {
|
||||
'fill': senior.functionCfg.sliderFillBg,
|
||||
'fillOpacity': 0.5
|
||||
}
|
||||
}
|
||||
if (senior.functionCfg.sliderTextClolor) {
|
||||
cfg.textStyle = {
|
||||
'fill': senior.functionCfg.sliderTextClolor
|
||||
}
|
||||
cfg.handlerStyle = {
|
||||
'fill': senior.functionCfg.sliderTextClolor,
|
||||
'fillOpacity': 0.5,
|
||||
'highLightFill': senior.functionCfg.sliderTextClolor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -536,6 +536,13 @@ function mappingColor(value, defaultColor, field, type) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'between') {
|
||||
const min = parseFloat(t.min)
|
||||
const max = parseFloat(t.max)
|
||||
if (min <= value && value <= max) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
|
@ -243,6 +243,13 @@ export default {
|
||||
this.label_content_class.color = t.color
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'between') {
|
||||
const min = parseFloat(t.min)
|
||||
const max = parseFloat(t.max)
|
||||
if (min <= value && value <= max) {
|
||||
this.label_content_class.color = t.color
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
|
@ -8,13 +8,22 @@
|
||||
<el-form-item v-show="functionForm.sliderShow" :label="$t('chart.slider_range')+'(%)'" class="form-item form-item-slider">
|
||||
<el-slider v-model="functionForm.sliderRange" style="width: 90%" :min="0" :max="100" input-size="mini" range @change="changeFunctionCfg" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="functionForm.sliderShow" :label="$t('chart.slider_bg')" class="form-item">
|
||||
<el-color-picker v-model="functionForm.sliderBg" class="color-picker-style" :predefine="predefineColors" @change="changeFunctionCfg" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="functionForm.sliderShow" :label="$t('chart.slider_fill_bg')" class="form-item">
|
||||
<el-color-picker v-model="functionForm.sliderFillBg" class="color-picker-style" :predefine="predefineColors" @change="changeFunctionCfg" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="functionForm.sliderShow" :label="$t('chart.slider_text_color')" class="form-item">
|
||||
<el-color-picker v-model="functionForm.sliderTextClolor" class="color-picker-style" :predefine="predefineColors" @change="changeFunctionCfg" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DEFAULT_FUNCTION_CFG } from '../../chart/chart'
|
||||
import { DEFAULT_FUNCTION_CFG, COLOR_PANEL } from '../../chart/chart'
|
||||
|
||||
export default {
|
||||
name: 'FunctionCfg',
|
||||
@ -26,7 +35,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
functionForm: JSON.parse(JSON.stringify(DEFAULT_FUNCTION_CFG))
|
||||
functionForm: JSON.parse(JSON.stringify(DEFAULT_FUNCTION_CFG)),
|
||||
predefineColors: COLOR_PANEL
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -32,18 +32,22 @@
|
||||
/>
|
||||
<el-col style="padding: 0 18px;">
|
||||
<el-row v-for="(item,index) in thresholdForm.labelThreshold" :key="index" class="line-style">
|
||||
<el-col :span="8">
|
||||
<el-col :span="6">
|
||||
<span v-if="item.term === 'eq'" :title="$t('chart.filter_eq')">{{ $t('chart.filter_eq') }}</span>
|
||||
<span v-else-if="item.term === 'not_eq'" :title="$t('chart.filter_not_eq')">{{ $t('chart.filter_not_eq') }}</span>
|
||||
<span v-else-if="item.term === 'lt'" :title="$t('chart.filter_lt')">{{ $t('chart.filter_lt') }}</span>
|
||||
<span v-else-if="item.term === 'gt'" :title="$t('chart.filter_gt')">{{ $t('chart.filter_gt') }}</span>
|
||||
<span v-else-if="item.term === 'le'" :title="$t('chart.filter_le')">{{ $t('chart.filter_le') }}</span>
|
||||
<span v-else-if="item.term === 'ge'" :title="$t('chart.filter_ge')">{{ $t('chart.filter_ge') }}</span>
|
||||
<span v-else-if="item.term === 'between'" :title="$t('chart.filter_between')">{{ $t('chart.filter_between') }}</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span :title="item.value">{{ item.value }}</span>
|
||||
<el-col :span="12">
|
||||
<span v-if="item.term !== 'between'" :title="item.value">{{ item.value }}</span>
|
||||
<span v-if="item.term === 'between'">
|
||||
{{ item.min }} ≤{{ $t('chart.drag_block_label_value') }}≤ {{ item.max }}
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="6">
|
||||
<span :style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -81,6 +85,7 @@
|
||||
<span v-else-if="item.term === 'gt'" :title="$t('chart.filter_gt')">{{ $t('chart.filter_gt') }}</span>
|
||||
<span v-else-if="item.term === 'le'" :title="$t('chart.filter_le')">{{ $t('chart.filter_le') }}</span>
|
||||
<span v-else-if="item.term === 'ge'" :title="$t('chart.filter_ge')">{{ $t('chart.filter_ge') }}</span>
|
||||
<span v-else-if="item.term === 'between'" :title="$t('chart.filter_between')">{{ $t('chart.filter_between') }}</span>
|
||||
<span v-else-if="item.term === 'like'" :title="$t('chart.filter_like')">{{ $t('chart.filter_like') }}</span>
|
||||
<span v-else-if="item.term === 'not like'" :title="$t('chart.filter_not_like')">{{ $t('chart.filter_not_like') }}</span>
|
||||
<span v-else-if="item.term === 'null'" :title="$t('chart.filter_null')">{{ $t('chart.filter_null') }}</span>
|
||||
@ -88,14 +93,17 @@
|
||||
<span v-else-if="item.term === 'empty'" :title="$t('chart.filter_empty')">{{ $t('chart.filter_empty') }}</span>
|
||||
<span v-else-if="item.term === 'not_empty'" :title="$t('chart.filter_not_empty')">{{ $t('chart.filter_not_empty') }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span v-if="!item.term.includes('null') && !item.term.includes('empty')" :title="item.value">{{ item.value }}</span>
|
||||
<el-col :span="10">
|
||||
<span v-if="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'" :title="item.value">{{ item.value }}</span>
|
||||
<span v-else-if="!item.term.includes('null') && !item.term.includes('empty') && item.term === 'between'">
|
||||
{{ item.min }} ≤{{ $t('chart.drag_block_label_value') }}≤ {{ item.max }}
|
||||
</span>
|
||||
<span v-else> </span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="4">
|
||||
<span :title="$t('chart.textColor')" :style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="4">
|
||||
<span :title="$t('chart.backgroundColor')" :style="{width:'14px', height:'14px', backgroundColor: item.backgroundColor, border: 'solid 1px #e1e4e8'}" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -250,6 +258,24 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
if (ele.term === 'between') {
|
||||
if (!ele.min || !ele.max) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
if (parseFloat(ele.min).toString() === 'NaN' || parseFloat(ele.max).toString() === 'NaN') {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_error'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!ele.value) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
@ -267,6 +293,7 @@ export default {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
this.thresholdForm.labelThreshold = JSON.parse(JSON.stringify(this.thresholdArr))
|
||||
this.changeThreshold()
|
||||
this.closeLabelThreshold()
|
||||
@ -314,6 +341,24 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
if (ele.term === 'between') {
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && (!ele.min || !ele.max)) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && (parseFloat(ele.min).toString() === 'NaN' || parseFloat(ele.max).toString() === 'NaN')) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_error'),
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && !ele.value) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
@ -332,6 +377,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.thresholdForm.tableThreshold = JSON.parse(JSON.stringify(this.tableThresholdArr))
|
||||
this.changeThreshold()
|
||||
this.closeTableThreshold()
|
||||
|
@ -58,9 +58,9 @@
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="8" style="text-align: center;">
|
||||
<el-col :span="10" style="text-align: center;">
|
||||
<el-input
|
||||
v-show="!item.term.includes('null') && !item.term.includes('empty')"
|
||||
v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
|
||||
v-model="item.value"
|
||||
class="value-item"
|
||||
:placeholder="$t('chart.drag_block_label_value')"
|
||||
@ -68,6 +68,11 @@
|
||||
clearable
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
<span v-if="item.term === 'between'">
|
||||
<el-input v-model="item.min" class="between-item" :placeholder="$t('chart.axis_value_min')" size="mini" clearable @change="changeThreshold" />
|
||||
<span style="margin: 0 4px;">≤{{ $t('chart.drag_block_label_value') }}≤</span>
|
||||
<el-input v-model="item.max" class="between-item" :placeholder="$t('chart.axis_value_max')" size="mini" clearable @change="changeThreshold" />
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="4" style="display: flex;align-items: center;justify-content: center;">
|
||||
<span class="color-title">{{ $t('chart.textColor') }}</span>
|
||||
@ -89,7 +94,7 @@
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-col :span="2">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@ -134,7 +139,9 @@ export default {
|
||||
field: '0',
|
||||
value: '',
|
||||
color: '#ff0000ff',
|
||||
backgroundColor: '#ffffffff'
|
||||
backgroundColor: '#ffffffff',
|
||||
min: '0',
|
||||
max: '1'
|
||||
},
|
||||
textOptions: [
|
||||
{
|
||||
@ -230,6 +237,13 @@ export default {
|
||||
value: 'ge',
|
||||
label: this.$t('chart.filter_ge')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'between',
|
||||
label: this.$t('chart.filter_between')
|
||||
}]
|
||||
}
|
||||
],
|
||||
predefineColors: COLOR_PANEL
|
||||
@ -352,6 +366,12 @@ span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.between-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 80px !important;
|
||||
}
|
||||
|
||||
.select-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
@ -19,13 +19,18 @@
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="10" style="text-align: center;">
|
||||
<el-input v-model="item.value" class="value-item" :placeholder="$t('chart.drag_block_label_value')" size="mini" clearable @change="changeThreshold" />
|
||||
<el-col :span="14" style="text-align: center;">
|
||||
<el-input v-if="item.term !== 'between'" v-model="item.value" class="value-item" :placeholder="$t('chart.drag_block_label_value')" size="mini" clearable @change="changeThreshold" />
|
||||
<span v-if="item.term === 'between'">
|
||||
<el-input v-model="item.min" class="between-item" :placeholder="$t('chart.axis_value_min')" size="mini" clearable @change="changeThreshold" />
|
||||
<span style="margin: 0 4px;">≤{{ $t('chart.drag_block_label_value') }}≤</span>
|
||||
<el-input v-model="item.max" class="between-item" :placeholder="$t('chart.axis_value_max')" size="mini" clearable @change="changeThreshold" />
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="4" style="text-align: center;">
|
||||
<el-col :span="2" style="text-align: center;">
|
||||
<el-color-picker v-model="item.color" show-alpha class="color-picker-style" :predefine="predefineColors" @change="changeThreshold" />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-col :span="2">
|
||||
<el-button type="text" icon="el-icon-delete" circle style="float: right" @click="removeThreshold(index)" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -51,7 +56,9 @@ export default {
|
||||
term: 'eq',
|
||||
field: '0',
|
||||
value: '0',
|
||||
color: '#ff0000ff'
|
||||
color: '#ff0000ff',
|
||||
min: '0',
|
||||
max: '1'
|
||||
},
|
||||
valueOptions: [
|
||||
{
|
||||
@ -83,6 +90,13 @@ export default {
|
||||
value: 'ge',
|
||||
label: this.$t('chart.filter_ge')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'between',
|
||||
label: this.$t('chart.filter_between')
|
||||
}]
|
||||
}
|
||||
],
|
||||
predefineColors: COLOR_PANEL
|
||||
@ -137,6 +151,12 @@ span {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.between-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.select-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
@ -1817,9 +1817,9 @@ export default {
|
||||
viewEditSave(this.panelInfo.id, viewSave)
|
||||
|
||||
if (modifyName === 'color') {
|
||||
bus.$emit('view-in-cache', { type: 'styleChange', viewId: this.param.id, viewInfo: view, refreshProp: 'customAttr' })
|
||||
bus.$emit('view-in-cache', { type: 'styleChange', viewId: this.view.id, viewInfo: view, refreshProp: 'customAttr' })
|
||||
} else {
|
||||
bus.$emit('view-in-cache', { type: 'styleChange', viewId: this.param.id, viewInfo: view })
|
||||
bus.$emit('view-in-cache', { type: 'styleChange', viewId: this.view.id, viewInfo: view })
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
:before-close="reset"
|
||||
>
|
||||
<div v-if="formType === 'add'" class="editer-form-title">
|
||||
<i class="el-icon-info"></i>
|
||||
<i class="el-icon-info" />
|
||||
<span class="pwd" type="text">{{
|
||||
$t("commons.default_pwd") + ":" + defaultPWD
|
||||
}}</span>
|
||||
@ -36,16 +36,16 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.nick_name')" prop="nickName">
|
||||
<el-input
|
||||
:placeholder="$t('user.input_name')"
|
||||
v-model="form.nickName"
|
||||
:placeholder="$t('user.input_name')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="ID" prop="username">
|
||||
<el-input
|
||||
:placeholder="$t('user.input_id')"
|
||||
v-model="form.username"
|
||||
:placeholder="$t('user.input_id')"
|
||||
:disabled="formType !== 'add'"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -55,24 +55,24 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.email')" prop="email">
|
||||
<el-input
|
||||
:placeholder="$t('user.input_email')"
|
||||
v-model="form.email"
|
||||
:placeholder="$t('user.input_email')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.mobile_phone_number')" prop="phone">
|
||||
<el-input
|
||||
:placeholder="$t('commons.mobile_phone')"
|
||||
v-model="form.phone"
|
||||
:placeholder="$t('commons.mobile_phone')"
|
||||
class="input-with-select"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.phonePrefix"
|
||||
slot="prepend"
|
||||
v-model="form.phonePrefix"
|
||||
:placeholder="$t('fu.search_bar.please_select')"
|
||||
>
|
||||
<el-option label="+86" value="+86"></el-option>
|
||||
<el-option label="+86" value="+86" />
|
||||
</el-select>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -82,14 +82,13 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.gender')" prop="gender">
|
||||
<el-select
|
||||
class="form-gender-select"
|
||||
v-model="form.gender"
|
||||
class="form-gender-select"
|
||||
:placeholder="$t('user.select_gender')"
|
||||
>
|
||||
<el-option :label="$t('commons.man')" value="男"> </el-option>
|
||||
<el-option :label="$t('commons.woman')" value="女"> </el-option>
|
||||
<el-option :label="$t('commons.keep_secret')" value="保密">
|
||||
</el-option>
|
||||
<el-option :label="$t('commons.man')" value="男" />
|
||||
<el-option :label="$t('commons.woman')" value="女" />
|
||||
<el-option :label="$t('commons.keep_secret')" value="保密" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -113,13 +112,13 @@
|
||||
:data="depts"
|
||||
:props="defaultProps"
|
||||
@node-click="handleNodeClick"
|
||||
></el-tree>
|
||||
/>
|
||||
|
||||
<el-select
|
||||
ref="roleSelect"
|
||||
slot="reference"
|
||||
v-model="form.deptId"
|
||||
clearable
|
||||
slot="reference"
|
||||
class="form-gender-select"
|
||||
popper-class="tree-select"
|
||||
:placeholder="$t('commons.please_select')"
|
||||
@ -165,14 +164,24 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-show="isPluginLoaded && wecomOpen" :label="$t('user.wecom_id')">
|
||||
<el-input v-model="form.sysUserAssist.wecomId" :placeholder="$t('user.input_wecom_id')" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="isPluginLoaded && dingTalkOpen" :label="$t('user.dingtalk_id')">
|
||||
<el-input v-model="form.sysUserAssist.dingtalkId" :placeholder="$t('user.input_dingtalk_id')" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="isPluginLoaded && larkOpen" :label="$t('user.lark_id')">
|
||||
<el-input v-model="form.sysUserAssist.larkId" :placeholder="$t('user.input_lark_id')" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('commons.status')" prop="enabled">
|
||||
<el-switch
|
||||
:disabled="formType !== 'add' && form.isAdmin"
|
||||
v-model="form.enabled"
|
||||
:disabled="formType !== 'add' && form.isAdmin"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
>
|
||||
</el-switch>
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@ -187,209 +196,249 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { PHONE_REGEX } from "@/utils/validate";
|
||||
import { getDeptTree, treeByDeptId } from "@/api/system/dept";
|
||||
import { addUser, editUser, allRoles } from "@/api/system/user";
|
||||
import { pluginLoaded, defaultPwd } from "@/api/user";
|
||||
import { PHONE_REGEX } from '@/utils/validate'
|
||||
import { getDeptTree, treeByDeptId } from '@/api/system/dept'
|
||||
import { addUser, editUser, allRoles, queryAssist } from '@/api/system/user'
|
||||
import { pluginLoaded, defaultPwd, wecomStatus, dingtalkStatus, larkStatus } from '@/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label",
|
||||
isLeaf: "leaf",
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
isLeaf: 'leaf'
|
||||
},
|
||||
selectDepts: [],
|
||||
form: {
|
||||
roles: [
|
||||
{
|
||||
id: "",
|
||||
},
|
||||
id: ''
|
||||
}
|
||||
],
|
||||
sysUserAssist: {
|
||||
wecomId: null,
|
||||
dingtalkId: null,
|
||||
larkId: null
|
||||
}
|
||||
},
|
||||
rule: {
|
||||
username: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.id_mandatory"),
|
||||
trigger: "blur",
|
||||
message: this.$t('user.id_mandatory'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
min: 1,
|
||||
max: 50,
|
||||
message: this.$t("commons.input_limit", [1, 50]),
|
||||
trigger: "blur",
|
||||
message: this.$t('commons.input_limit', [1, 50]),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
pattern: "^[^\u4e00-\u9fa5]+$",
|
||||
message: this.$t("user.special_characters_are_not_supported"),
|
||||
trigger: "blur",
|
||||
},
|
||||
pattern: '^[^\u4e00-\u9fa5]+$',
|
||||
message: this.$t('user.special_characters_are_not_supported'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
nickName: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.name_mandatory"),
|
||||
trigger: "blur",
|
||||
message: this.$t('user.name_mandatory'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
min: 2,
|
||||
max: 50,
|
||||
message: this.$t("commons.input_limit", [2, 50]),
|
||||
trigger: "blur",
|
||||
message: this.$t('commons.input_limit', [2, 50]),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.special_characters_are_not_supported"),
|
||||
trigger: "blur",
|
||||
},
|
||||
message: this.$t('user.special_characters_are_not_supported'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
pattern: PHONE_REGEX,
|
||||
message: this.$t("user.phone_format"),
|
||||
trigger: "blur",
|
||||
},
|
||||
message: this.$t('user.phone_format'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
email: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.email_mandatory"),
|
||||
trigger: "blur",
|
||||
message: this.$t('user.email_mandatory'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
pattern: /^[a-zA-Z0-9_._-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
||||
message: this.$t("user.email_format_is_incorrect"),
|
||||
trigger: "blur",
|
||||
},
|
||||
message: this.$t('user.email_format_is_incorrect'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.input_password"),
|
||||
trigger: "blur",
|
||||
message: this.$t('user.input_password'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
|
||||
message: this.$t("member.password_format_is_incorrect"),
|
||||
trigger: "blur",
|
||||
},
|
||||
message: this.$t('member.password_format_is_incorrect'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
confirmPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.input_password"),
|
||||
trigger: "blur",
|
||||
message: this.$t('user.input_password'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{ required: true, validator: this.repeatValidator, trigger: "blur" },
|
||||
{ required: true, validator: this.repeatValidator, trigger: 'blur' }
|
||||
],
|
||||
newPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.input_password"),
|
||||
trigger: "blur",
|
||||
message: this.$t('user.input_password'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
|
||||
message: this.$t("member.password_format_is_incorrect"),
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
roleIds: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("user.role_mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
message: this.$t('member.password_format_is_incorrect'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
deptId: [],
|
||||
gender: [],
|
||||
enabled: [{ required: true, trigger: "change" }],
|
||||
enabled: [{ required: true, trigger: 'change' }]
|
||||
},
|
||||
defaultForm: {
|
||||
id: null,
|
||||
username: null,
|
||||
nickName: null,
|
||||
gender: "男",
|
||||
gender: '男',
|
||||
email: null,
|
||||
enabled: 1,
|
||||
deptId: null,
|
||||
phone: null,
|
||||
phonePrefix: "+86",
|
||||
phonePrefix: '+86',
|
||||
roleIds: [2],
|
||||
sysUserAssist: {
|
||||
wecomId: null,
|
||||
dingtalkId: null,
|
||||
larkId: null
|
||||
}
|
||||
},
|
||||
depts: [],
|
||||
roles: [],
|
||||
roleDatas: [],
|
||||
userRoles: [],
|
||||
formType: "add",
|
||||
formType: 'add',
|
||||
isPluginLoaded: false,
|
||||
defaultPWD: "DataEase123..",
|
||||
defaultPWD: 'DataEase123..',
|
||||
dialogVisible: false,
|
||||
};
|
||||
wecomOpen: false,
|
||||
dingTalkOpen: false,
|
||||
larkOpen: false,
|
||||
assistInfo: {}
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
pluginLoaded().then((res) => {
|
||||
this.isPluginLoaded = res.success && res.data;
|
||||
});
|
||||
this.isPluginLoaded = res.success && res.data
|
||||
})
|
||||
wecomStatus().then(res => {
|
||||
if (res.success && res.data) {
|
||||
this.wecomOpen = true
|
||||
}
|
||||
})
|
||||
|
||||
dingtalkStatus().then(res => {
|
||||
if (res.success && res.data) {
|
||||
this.dingTalkOpen = true
|
||||
}
|
||||
})
|
||||
|
||||
larkStatus().then(res => {
|
||||
if (res.success && res.data) {
|
||||
this.larkOpen = true
|
||||
}
|
||||
})
|
||||
defaultPwd().then((res) => {
|
||||
if (res && res.data) {
|
||||
this.defaultPWD = res.data;
|
||||
this.defaultPWD = res.data
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
repeatValidator(rule, value, callback) {
|
||||
if (value !== this.form.password) {
|
||||
callback(new Error(this.$t("member.inconsistent_passwords")));
|
||||
callback(new Error(this.$t('member.inconsistent_passwords')))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.formType = "add";
|
||||
this.form = Object.assign({}, this.defaultForm);
|
||||
this.formType = 'add'
|
||||
this.form = Object.assign({}, JSON.parse(JSON.stringify(this.defaultForm)))
|
||||
},
|
||||
init(row) {
|
||||
this.initRoles();
|
||||
this.dialogVisible = true;
|
||||
this.initRoles()
|
||||
|
||||
this.dialogVisible = true
|
||||
if (!row) {
|
||||
this.create();
|
||||
return;
|
||||
this.create()
|
||||
return
|
||||
}
|
||||
const { deptId:id, deptName:label } = (row.dept || {});
|
||||
this.selectDepts = [{id, label}]
|
||||
this.formType = "modify";
|
||||
this.dialogVisible = true;
|
||||
this.form = Object.assign({}, row);
|
||||
this.form.password = "";
|
||||
this.initAssistInfo(row.userId).then(res => {
|
||||
this.assistInfo = res.data
|
||||
const { deptId: id, deptName: label } = (row.dept || {})
|
||||
this.selectDepts = [{ id, label }]
|
||||
this.formType = 'modify'
|
||||
this.dialogVisible = true
|
||||
row.sysUserAssist = JSON.parse(JSON.stringify(this.defaultForm.sysUserAssist))
|
||||
this.form = Object.assign({}, row)
|
||||
this.form.password = ''
|
||||
if (this.form.deptId === 0) {
|
||||
this.form.deptId = null;
|
||||
this.form.deptId = null
|
||||
}
|
||||
|
||||
if (!this.form.phonePrefix) {
|
||||
this.form.phonePrefix = '+86';
|
||||
this.form.phonePrefix = '+86'
|
||||
}
|
||||
|
||||
if (this.assistInfo) {
|
||||
const info = JSON.parse(JSON.stringify(this.assistInfo))
|
||||
delete info.needFirstNoti
|
||||
delete info.userId
|
||||
const assist = Object.assign(JSON.parse(JSON.stringify(this.defaultForm.sysUserAssist)), info)
|
||||
this.form.sysUserAssist = assist
|
||||
}
|
||||
})
|
||||
},
|
||||
initRoles() {
|
||||
allRoles().then((res) => {
|
||||
this.roles = res.data;
|
||||
});
|
||||
this.roles = res.data
|
||||
})
|
||||
},
|
||||
initAssistInfo(userId) {
|
||||
return queryAssist(userId)
|
||||
},
|
||||
handleNodeClick({ id, label }) {
|
||||
const [ dept ] = this.selectDepts;
|
||||
const [dept] = this.selectDepts
|
||||
if (!dept || dept.id !== id) {
|
||||
this.selectDepts = [{ id, label }];
|
||||
this.selectDepts = [{ id, label }]
|
||||
this.form.deptId = id
|
||||
return
|
||||
}
|
||||
|
||||
if (dept.id === id) {
|
||||
this.selectDepts = [];
|
||||
this.selectDepts = []
|
||||
this.form.deptId = null
|
||||
}
|
||||
},
|
||||
@ -399,75 +448,76 @@ export default {
|
||||
this.depts = (res.data || []).map(ele => {
|
||||
return {
|
||||
...ele,
|
||||
leaf: !ele.hasChildren,
|
||||
leaf: !ele.hasChildren
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
},
|
||||
loadNode(node, resolve) {
|
||||
if (!this.depts.length) {
|
||||
this.treeByDeptId();
|
||||
return;
|
||||
this.treeByDeptId()
|
||||
return
|
||||
}
|
||||
getDeptTree(node.data.id).then((res) => {
|
||||
resolve(
|
||||
res.data.map((dept) => {
|
||||
return this.normalizer(dept);
|
||||
return this.normalizer(dept)
|
||||
})
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
},
|
||||
normalizer(node) {
|
||||
return {
|
||||
id: node.deptId,
|
||||
label: node.name,
|
||||
leaf: !node.hasChildren,
|
||||
};
|
||||
leaf: !node.hasChildren
|
||||
}
|
||||
},
|
||||
deleteTag(value) {
|
||||
this.userRoles.forEach(
|
||||
function (data, index) {
|
||||
function(data, index) {
|
||||
if (data.id === value) {
|
||||
this.userRoles.splice(index, value);
|
||||
this.userRoles.splice(index, value)
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
)
|
||||
},
|
||||
changeRole(value) {
|
||||
this.userRoles = [];
|
||||
this.userRoles = []
|
||||
value.forEach(
|
||||
function (data, index) {
|
||||
const role = { id: data };
|
||||
this.userRoles.push(role);
|
||||
function(data, index) {
|
||||
const role = { id: data }
|
||||
this.userRoles.push(role)
|
||||
}.bind(this)
|
||||
);
|
||||
)
|
||||
},
|
||||
reset() {
|
||||
this.depts = [];
|
||||
this.$refs.createUserForm.resetFields();
|
||||
this.dialogVisible = false;
|
||||
this.depts = []
|
||||
this.form.sysUserAssist = JSON.parse(JSON.stringify(this.defaultForm.sysUserAssist))
|
||||
this.$refs.createUserForm.resetFields()
|
||||
this.dialogVisible = false
|
||||
},
|
||||
save() {
|
||||
this.$refs.createUserForm.validate((valid) => {
|
||||
if (valid) {
|
||||
// !this.form.deptId && (this.form.deptId = 0)
|
||||
const method = this.formType === "add" ? addUser : editUser;
|
||||
const method = this.formType === 'add' ? addUser : editUser
|
||||
method(this.form).then((res) => {
|
||||
this.$success(this.$t("commons.save_success"));
|
||||
this.reset();
|
||||
this.$success(this.$t('commons.save_success'))
|
||||
this.reset()
|
||||
this.$emit('saved')
|
||||
});
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
onCopy(e) {
|
||||
this.$success(this.$t("commons.copy_success"));
|
||||
this.$success(this.$t('commons.copy_success'))
|
||||
},
|
||||
onError(e) {},
|
||||
},
|
||||
};
|
||||
onError(e) {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user