Merge pull request #650 from dataease/dev

Dev
This commit is contained in:
王嘉豪 2021-08-17 17:56:57 +08:00 committed by GitHub
commit 4641c4409e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 335 additions and 477 deletions

View File

@ -2,7 +2,6 @@ package io.dataease.auth.service.impl;
import io.dataease.auth.service.ExtAuthService;
import io.dataease.base.domain.SysAuth;
import io.dataease.base.domain.SysAuthExample;
import io.dataease.base.mapper.SysAuthMapper;
import io.dataease.base.mapper.ext.ExtAuthMapper;
import io.dataease.commons.model.AuthURD;

View File

@ -45,6 +45,8 @@ public class ShiroServiceImpl implements ShiroService {
//验证链接
filterChainDefinitionMap.put("/api/link/validate**", ANON);
filterChainDefinitionMap.put("/api/map/areaEntitys/**", ANON);
//未读消息数量
filterChainDefinitionMap.put("/api/sys_msg/unReadCount", ANON);
filterChainDefinitionMap.put("/**/*.json", ANON);
filterChainDefinitionMap.put("/system/ui/**", ANON);

View File

@ -1,4 +0,0 @@
package io.dataease.base.mapper.ext;
public interface ExtBaseMapper {
}

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.dataease.base.mapper.ext.ExtBaseMapper">
<sql id="orders">
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
${order.name} ${order.type}
</foreach>
</if>
</sql>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
</mapper>

View File

@ -7,7 +7,6 @@ import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.util.UUID;
/**
* 加密解密工具

View File

@ -1,34 +0,0 @@
package io.dataease.commons.utils;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils;
import org.aspectj.util.FileUtil;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.List;
public class FileUtils {
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
public static void createBodyFiles(List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
if (CollectionUtils.isNotEmpty(bodyUploadIds) && CollectionUtils.isNotEmpty(bodyFiles)) {
File testDir = new File(BODY_FILE_DIR);
if (!testDir.exists()) {
testDir.mkdirs();
}
for (int i = 0; i < bodyUploadIds.size(); i++) {
MultipartFile item = bodyFiles.get(i);
File file = new File(BODY_FILE_DIR + "/" + bodyUploadIds.get(i) + "_" + item.getOriginalFilename());
try (InputStream in = item.getInputStream(); OutputStream out = new FileOutputStream(file)) {
file.createNewFile();
FileUtil.copyStream(in, out);
} catch (IOException e) {
LogUtil.error(e);
DEException.throwException(Translator.get("upload_fail"));
}
}
}
}
}

View File

@ -2,7 +2,6 @@ package io.dataease.controller;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.exception.DataEaseException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -5,9 +5,7 @@ import io.dataease.base.domain.ChartViewWithBLOBs;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.service.chart.ChartViewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

View File

@ -3,7 +3,6 @@ package io.dataease.controller.request.dataset;
import io.dataease.base.domain.DatasetGroup;
import lombok.Data;
import java.util.List;
import java.util.Set;
/**

View File

@ -6,6 +6,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.SysMsgChannel;
import io.dataease.base.domain.SysMsgSetting;
import io.dataease.base.domain.SysMsgType;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -21,6 +22,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "系统:消息管理")
@ -46,6 +48,16 @@ public class MsgController {
return listPager;
}
@ApiOperation("查询未读数量")
@PostMapping("/unReadCount")
public Long unReadCount(@RequestBody Map<String, Long> request) {
if(null == request || null == request.get("userId")) {
throw new RuntimeException("缺少用户ID");
}
Long userId = request.get("userId");
return sysMsgService.queryCount(userId);
}
@ApiOperation("设置已读")
@PostMapping("/setReaded/{msgId}")
public void setReaded(@PathVariable Long msgId) {

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.base.domain.SysRole;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -116,4 +117,14 @@ public class SysUserController {
public List<RoleUserItem> all(){
return sysRoleService.allRoles();
}
@ApiOperation("查询角色")
@PostMapping("/roleGrid/{goPage}/{pageSize}")
public Pager<List<SysRole>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
Pager<List<SysRole>> listPager = PageUtils.setPageInfo(page, sysRoleService.query(request));
return listPager;
}
}

View File

@ -4,7 +4,6 @@ import io.dataease.base.domain.SysUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data

View File

@ -3,7 +3,6 @@ package io.dataease.dto.chart;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.List;
/**

View File

@ -5,7 +5,6 @@ import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.Datasource;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.datasource.dto.JdbcDTO;
import io.dataease.datasource.dto.SqlServerConfigration;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj;

View File

@ -3,7 +3,6 @@ package io.dataease.provider.doris;
import io.dataease.provider.SQLConstants;
import static io.dataease.datasource.constants.DatasourceTypes.doris;
import static io.dataease.datasource.constants.DatasourceTypes.mysql;
/**
* @Author gin

View File

@ -8,8 +8,6 @@ import io.dataease.base.mapper.DatasetTableFieldMapper;
import io.dataease.commons.constants.DeTypeConstants;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.datasource.dto.JdbcDTO;
import io.dataease.datasource.dto.PgConfigration;
import io.dataease.datasource.dto.SqlServerConfigration;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj;

View File

@ -8,7 +8,6 @@ import io.dataease.base.mapper.DatasetTableFieldMapper;
import io.dataease.commons.constants.DeTypeConstants;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.datasource.dto.JdbcDTO;
import io.dataease.datasource.dto.SqlServerConfigration;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj;

View File

@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**

View File

@ -1183,6 +1183,7 @@ public class DataSetTableService {
if (StringUtils.isNotEmpty(tableId) && editType == 1 ) {
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.getFieldsByTableId(tableId);
datasetTableFields.stream().filter(datasetTableField -> datasetTableField.getName().startsWith("C_")).collect(Collectors.toList());
datasetTableFields.sort((o1, o2) -> {
if (o1.getColumnIndex() == null) {
return -1;

View File

@ -2,9 +2,7 @@ package io.dataease.service.dataset;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.DatasetTableFunctionMapper;
import io.dataease.commons.utils.DorisTableUtils;
import io.dataease.datasource.service.DatasourceService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

View File

@ -164,6 +164,7 @@ public class ExtractDataService {
if(datasetTableFields == null){
datasetTableFields = dataSetTableFieldsService.list(DatasetTableField.builder().tableId(datasetTable.getId()).build());
}
datasetTableFields = datasetTableFields.stream().filter(datasetTableField -> datasetTableField.getName().startsWith("C_")).collect(Collectors.toList());
datasetTableFields.sort((o1, o2) -> {
if (o1.getColumnIndex() == null) {
return -1;
@ -273,6 +274,7 @@ public class ExtractDataService {
datasource.setType(datasetTable.getType());
}
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.list(DatasetTableField.builder().tableId(datasetTable.getId()).build());
datasetTableFields = datasetTableFields.stream().filter(datasetTableField -> datasetTableField.getName().startsWith("C_")).collect(Collectors.toList());
datasetTableFields.sort((o1, o2) -> {
if (o1.getColumnIndex() == null) {
return -1;

View File

@ -105,6 +105,13 @@ public class SysMsgService {
return msgGridDtos;
}
public Long queryCount(Long userId) {
SysMsgExample example = new SysMsgExample();
SysMsgExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId).andStatusEqualTo(false);
return sysMsgMapper.countByExample(example);
}
public void setReaded(Long msgId) {
SysMsg sysMsg = new SysMsg();
sysMsg.setMsgId(msgId);

View File

@ -1,7 +1,6 @@
package io.dataease.service.panel;
import io.dataease.base.domain.PanelViewLinkage;
import io.dataease.base.domain.PanelViewLinkageExample;
import io.dataease.base.domain.PanelViewLinkageField;
import io.dataease.base.mapper.PanelViewLinkageFieldMapper;
import io.dataease.base.mapper.PanelViewLinkageMapper;
@ -10,7 +9,6 @@ import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.request.panel.PanelLinkageRequest;
import io.dataease.dto.LinkageInfoDTO;
import io.dataease.dto.PanelViewLinkageDTO;
import io.dataease.dto.PanelViewLinkageFieldDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

View File

@ -8,7 +8,6 @@ import io.dataease.base.mapper.ext.query.GridExample;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.base.ConditionEntity;
import io.dataease.controller.sys.request.DeptCreateRequest;
import io.dataease.controller.sys.request.DeptDeleteRequest;
import io.dataease.controller.sys.request.DeptStatusRequest;
@ -19,7 +18,6 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;

View File

@ -5,9 +5,11 @@ package io.dataease.service.sys;
import io.dataease.base.domain.SysUsersRolesExample;
import io.dataease.base.mapper.SysRoleMapper;
import io.dataease.base.mapper.SysUsersRolesMapper;*/
import io.dataease.base.domain.SysRole;
import io.dataease.base.mapper.ext.ExtSysRoleMapper;
/*import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.request.RoleMenusRequest;*/
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.response.RoleUserItem;
import org.springframework.stereotype.Service;
/*import org.springframework.transaction.annotation.Transactional;*/
@ -55,12 +57,13 @@ public class SysRoleService {
return mapper.deleteByPrimaryKey(roleId);
}
*/
public List<SysRole> query(BaseGridRequest request){
List<SysRole> result = extSysRoleMapper.query(request.convertExample());
return result;
}
/*
public List<Long> menuIds(Long roleId){
return extSysRoleMapper.menuIds(roleId);

View File

@ -87,8 +87,6 @@ INSERT INTO `dataset_table_function` VALUES (57, 'ROUND', 'ROUND(x,y)', 'doris',
INSERT INTO `dataset_table_function` VALUES (58, 'SIGN', 'SIGN(x)', 'doris', 2, '返回参数x的符号-1表示负数0表示01表示正数');
INSERT INTO `dataset_table_function` VALUES (59, 'POW', 'POW(x,y)', 'doris', 2, '返回x的y次乘方的值');
INSERT INTO `dataset_table_function` VALUES (60, 'EXP', 'EXP(x)', 'doris', 2, '返回e的x乘方后的值');
INSERT INTO `dataset_table_function` VALUES (61, 'LOG', 'LOG(x)', 'doris', 2, '返回x的自然对数x相对于基数e的对数');
INSERT INTO `dataset_table_function` VALUES (62, 'LOG10', 'LOG10(x)', 'doris', 2, '返回x的基数为10的对数');
INSERT INTO `dataset_table_function` VALUES (63, 'RADIANS', 'RADIANS(x)', 'doris', 2, '返回x由角度转化为弧度的值');
INSERT INTO `dataset_table_function` VALUES (64, 'DEGREES', 'DEGREES(x)', 'doris', 2, '返回x由弧度转化为角度的值');
INSERT INTO `dataset_table_function` VALUES (65, 'SIN', 'SIN(x)', 'doris', 2, '返回x的正弦其中x为给定的弧度值');
@ -105,18 +103,11 @@ INSERT INTO `dataset_table_function` VALUES (75, 'RTRIM', 'RTRIM(s)', 'doris', 4
INSERT INTO `dataset_table_function` VALUES (76, 'REPLACE', 'REPLACE(s,s1,s2)', 'doris', 4, '返回一个字符串用字符串s2替代字符串s中所有的字符串s1');
INSERT INTO `dataset_table_function` VALUES (77, 'SUBSTRING', 'SUBSTRING(s,n,len)', 'doris', 4, '获取从字符串s中的第n个位置开始长度为len的字符串');
INSERT INTO `dataset_table_function` VALUES (78, 'CONCAT', 'CONCAT(s1,s2...)', 'doris', 4, '返回连接参数产生的字符串一个或多个待拼接的内容任意一个为NULL则返回值为NULL');
INSERT INTO `dataset_table_function` VALUES (79, 'INSERT', 'INSERT(s1,x,len,s2)', 'doris', 4, '返回字符串s1其子字符串起始于位置x被字符串s2取代len个字符');
INSERT INTO `dataset_table_function` VALUES (80, 'LOWER', 'LOWER(str)', 'doris', 4, '将str中的字母全部转换成小写');
INSERT INTO `dataset_table_function` VALUES (81, 'UPPER', 'UPPER(str)', 'doris', 4, '将字符串中的字母全部转换成大写');
INSERT INTO `dataset_table_function` VALUES (82, 'LEFT', 'LEFT(s,n)', 'doris', 4, '返回字符串s从最左边开始的n个字符');
INSERT INTO `dataset_table_function` VALUES (83, 'RIGHT', 'RIGHT(s,n)', 'doris', 4, '返回字符串s从最右边开始的n个字符');
INSERT INTO `dataset_table_function` VALUES (84, 'REPEAT', 'REPEAT(s,n)', 'doris', 4, '返回一个由重复字符串s组成的字符串字符串s的数目等于n');
INSERT INTO `dataset_table_function` VALUES (85, 'SPACE', 'SPACE(n)', 'doris', 4, '返回一个由n个空格组成的字符串');
INSERT INTO `dataset_table_function` VALUES (86, 'REVERSE', 'REVERSE(s)', 'doris', 4, '将字符串s反转');
INSERT INTO `dataset_table_function` VALUES (87, 'CURDATE', 'CURDATE()', 'doris', 3, '将当前日期按照\"YYYY-MM-DD\"或者\"YYYYMMDD\"格式的值返回,具体格式根据函数用在字符串或是数字语境中而定');
INSERT INTO `dataset_table_function` VALUES (88, 'CURRENT_DATE', 'CURRENT_DATE()', 'doris', 3, '将当前日期按照\"YYYY-MM-DD\"或者\"YYYYMMDD\"格式的值返回,具体格式根据函数用在字符串或是数字语境中而定');
INSERT INTO `dataset_table_function` VALUES (89, 'NOW', 'NOW()', 'doris', 3, '返回当前日期和时间值格式为\"YYYY_MM-DD HH:MM:SS\"\"YYYYMMDDHHMMSS\",具体格式根据函数用在字符串或数字语境中而定');
INSERT INTO `dataset_table_function` VALUES (90, 'SYSDATE', 'SYSDATE()', 'doris', 3, '返回当前日期和时间值格式为\"YYYY_MM-DD HH:MM:SS\"\"YYYYMMDDHHMMSS\",具体格式根据函数用在字符串或数字语境中而定');
INSERT INTO `dataset_table_function` VALUES (91, 'LOCALTIME', 'LOCALTIME()', 'doris', 3, '返回当前日期和时间值格式为\"YYYY_MM-DD HH:MM:SS\"\"YYYYMMDDHHMMSS\",具体格式根据函数用在字符串或数字语境中而定');
INSERT INTO `dataset_table_function` VALUES (92, 'CURRENT_TIMESTAMP', 'CURRENT_TIMESTAMP()', 'doris', 3, '返回当前日期和时间值格式为\"YYYY_MM-DD HH:MM:SS\"\"YYYYMMDDHHMMSS\",具体格式根据函数用在字符串或数字语境中而定');
INSERT INTO `dataset_table_function` VALUES (93, 'UNIX_TIMESTAMP', 'UNIX_TIMESTAMP()', 'doris', 3, '返回一个格林尼治标准时间1970-01-01 00:00:00到现在的秒数');
@ -135,6 +126,29 @@ INSERT INTO `dataset_table_function` VALUES (105, 'ABS', 'ABS(value)', 'oracle',
INSERT INTO `dataset_table_function` VALUES (106, 'CEIL', 'CEIL(value)', 'oracle', 2, '返回大于等于value的最小整数');
INSERT INTO `dataset_table_function` VALUES (107, 'FLOOR', 'FLOOR(value)', 'oracle', 2, '返回小于等于value的最大整数');
INSERT INTO `dataset_table_function` VALUES (108, 'ROUND', 'ROUND(value,n)', 'oracle', 2, '对value进行四舍五入保存小数点右侧的n位如果n省略的话相当于n=0的情况');
INSERT INTO `dataset_table_function` VALUES (109, 'datalength', 'datalength(s)', 'sqlServer', 4, '返回字符串包含字符数,但不包含后面的空格');
INSERT INTO `dataset_table_function` VALUES (110, 'substring', 'substring(expression,start,length)', 'sqlServer', 4, '取子串');
INSERT INTO `dataset_table_function` VALUES (111, 'ltrim', 'ltrim(expression)', 'sqlServer', 4, '把字符串头部的空格去掉');
INSERT INTO `dataset_table_function` VALUES (112, 'rtrim', 'rtrim(expression)', 'sqlServer', 4, '把字符串尾部的空格去掉');
INSERT INTO `dataset_table_function` VALUES (113, 'upper', 'substring(expression)', 'sqlServer', 4, '转为大写');
INSERT INTO `dataset_table_function` VALUES (114, 'lower', 'substring(expression)', 'sqlServer', 4, '转为小写');
INSERT INTO `dataset_table_function` VALUES (115, 'reverse', 'reverse(expression)', 'sqlServer', 4, '反转字符串');
INSERT INTO `dataset_table_function` VALUES (116, 'pi', 'pi()', 'sqlServer', 2, 'π');
INSERT INTO `dataset_table_function` VALUES (117, 'abs', 'abs(numeric_expr)', 'sqlServer', 2, '求绝对值');
INSERT INTO `dataset_table_function` VALUES (118, 'sqrt', 'sqrt(float_expr)', 'sqlServer', 2, '平方根');
INSERT INTO `dataset_table_function` VALUES (119, 'power', 'power(numeric_expr,power) ', 'sqlServer', 2, '返回power次方');
INSERT INTO `dataset_table_function` VALUES (120, 'getdate', 'getdate() ', 'sqlServer', 3, '返回日期');
INSERT INTO `dataset_table_function` VALUES (121, 'getutcdate', 'getutcdate() ', 'sqlServer', 3, '获取utc时间');
INSERT INTO `dataset_table_function` VALUES (122, 'day', 'day(getdate()) ', 'sqlServer', 3, '取出天');
INSERT INTO `dataset_table_function` VALUES (123, 'abs', 'abs(x)', 'pg', 2, '绝对值');
INSERT INTO `dataset_table_function` VALUES (124, 'sin', 'sin(x)', 'pg', 2, '正弦');
INSERT INTO `dataset_table_function` VALUES (125, 'sqrt', 'sqrt(double/numeric)', 'pg', 2, '平方根');
INSERT INTO `dataset_table_function` VALUES (126, 'lower', 'lower(string)', 'pg', 4, '把字串转化为小写');
INSERT INTO `dataset_table_function` VALUES (127, 'length', 'length(string text)', 'pg', 4, 'string中字符的数目');
INSERT INTO `dataset_table_function` VALUES (128, 'md5', 'md5(string text)', 'pg', 4, '计算给出string的MD5散列以十六进制返回结果');
INSERT INTO `dataset_table_function` VALUES (129, 'strpos', 'strpos(string, substring)', 'pg', 4, '声明的子字串的位置');
INSERT INTO `dataset_table_function` VALUES (130, 'to_char', 'to_char(timestamp, text)', 'pg', 3, '将时间戳转换为字符串');
INSERT INTO `dataset_table_function` VALUES (131, 'to_timestamp', 'to_timestamp(double precision)', 'pg', 3, '把UNIX纪元转换成时间戳');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -9,6 +9,15 @@ export function query(pageIndex, pageSize, data) {
})
}
export function unReadCount(data) {
return request({
url: '/api/sys_msg/unReadCount',
method: 'post',
loading: false,
data
})
}
export function updateStatus(msgId) {
return request({
url: '/api/sys_msg/setReaded/' + msgId,

View File

@ -89,4 +89,13 @@ export const allRoles = () => {
})
}
export default { editPassword, delUser, editUser, addUser, userLists, editStatus, persionInfo, updatePerson, updatePersonPwd, allRoles }
export function roleGrid(pageIndex, pageSize, data) {
return request({
url: '/api/user/roleGrid/' + pageIndex + '/' + pageSize,
method: 'post',
data,
loading: true
})
}
export default { editPassword, delUser, editUser, addUser, userLists, editStatus, persionInfo, updatePerson, updatePersonPwd, allRoles, roleGrid }

View File

@ -53,14 +53,14 @@
class-name="notification"
icon-class="notification"
/>
<span v-if="paginationConfig.total" class="msg-number">{{ paginationConfig.total }}</span>
<span v-if="count || paginationConfig.total" class="msg-number">{{ count || paginationConfig.total }}</span>
</div>
</div>
</el-popover>
</template>
<script>
import { query, updateStatus } from '@/api/system/msg'
import { query, updateStatus, unReadCount } from '@/api/system/msg'
import { getTypeName, loadMsgTypes } from '@/utils/webMsg'
import { mapGetters } from 'vuex'
import bus from '@/utils/bus'
@ -76,21 +76,30 @@ export default {
pageSize: 5,
total: 0
},
timer: null
timer: null,
count: 0
}
},
computed: {
...mapGetters([
'permission_routes'
'permission_routes',
'user'
])
},
watch: {
'visible': function(newV, oldV) {
if (newV && !oldV) {
this.search()
}
}
},
created() {
//
loadMsgTypes()
this.search()
this.queryCount()
// 30s
this.timer = setInterval(() => {
this.search()
this.queryCount()
}, 30000)
},
mounted() {
@ -105,19 +114,11 @@ export default {
this.timer && clearInterval(this.timer)
},
methods: {
// handClick(lang) {
// console.log(lang)
// },
showDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.visible = false
// if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
// bus.$emit('to-msg-share', param)
// } else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
// bus.$emit('to-msg-dataset', param)
// } else {
// this.$router.push({ name: row.router, params: param })
// }
if (this.$route && this.$route.name && this.$route.name === row.router) {
// 使router.push 使
row.callback && bus.$emit(row.callback, param)
@ -164,6 +165,31 @@ export default {
this.$store.commit('permission/SET_CURRENT_ROUTES', route)
// this.setSidebarHide(route)
},
queryCount() {
const token = getToken()
if (!token || token === 'null' || token === 'undefined' || !this.user || !this.user.userId) {
this.timer && clearInterval(this.timer)
const message = this.$t('login.tokenError')
this.$alert(message, {
confirmButtonText: this.$t('login.re_login'),
showClose: false,
callback: function(action, instance) {
if (action === 'confirm') {
this.$store.dispatch('user/logout').then(() => {
location.reload()
})
}
}.bind(this)
})
}
const param = {
userId: this.user.userId
}
unReadCount(param).then(res => {
this.count = res.data
})
},
search() {
const param = {
status: false,

View File

@ -76,10 +76,10 @@
<!--关闭弹框-->
<el-dialog :visible.sync="closePanelVisible" :title="$t('panel.panel_save_tips')" :show-close="false" width="30%" class="dialog-css">
<el-row style="height: 20px">
<el-col :span="6">
<el-col :span="4">
<svg-icon icon-class="warn-tre" style="width: 20px;height: 20px;float: right" />
</el-col>
<el-col :span="16">
<el-col :span="20">
<span style="font-size: 13px;margin-left: 10px;font-weight: bold;line-height: 20px">{{ $t('panel.panel_save_warn_tips') }}</span>
</el-col>
</el-row>

View File

@ -309,6 +309,12 @@ export default {
this.chart.type === 'map' && this.sendToChildren(param)
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
this.getData(this.element.propValue.viewId)
} else if (this.chart.drillFields.length > 0) {
this.$message({
type: 'error',
message: this.$t('chart.last_layer'),
showClose: true
})
}
},

View File

@ -696,6 +696,10 @@ export default {
filter: 'Filter',
none: 'None',
background: 'Background',
border: 'Corner',
border_width: 'Border width',
border_radius: 'Border radius',
alpha: 'Transparency',
add_filter: 'Add Filter',
no_limit: 'No limit',
@ -842,7 +846,8 @@ export default {
width: 'Width',
height: 'Height',
system_case: 'System',
custom_case: 'Custom'
custom_case: 'Custom',
last_layer: 'This Is The Last Layer'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
@ -1013,7 +1018,8 @@ export default {
merge: 'Merge',
no_merge: 'Dont Merge',
merge_msg: 'If the fields in the data table are consistent, merge them into one data set?',
merge_title: 'Merge data'
merge_title: 'Merge data',
field_name_less_50: 'Field name can not more 50 chars.'
},
datasource: {
datasource: 'Data Source',

View File

@ -696,6 +696,9 @@ export default {
filter: '過濾',
none: '無',
background: '背景',
border: '邊角',
border_width: '邊框寬度',
border_radius: '邊框半徑',
alpha: '透明度',
add_filter: '添加過濾',
no_limit: '無顯示',
@ -842,7 +845,8 @@ export default {
width: '寬度',
height: '高度',
system_case: '系統方案',
custom_case: '自定義'
custom_case: '自定義',
last_layer: '当前已经是最后一级'
},
dataset: {
sheet_warn: '有多個sheet頁面默認抽取第一個',
@ -1013,7 +1017,8 @@ export default {
merge: '合併',
no_merge: '不合併',
merge_msg: '數據表中存在自斷一直的情況,是否合併到一個數據集中?',
merge_title: '合併數據'
merge_title: '合併數據',
field_name_less_50: '字段名不能超過50個字符'
},
datasource: {
datasource: '數據源',

View File

@ -696,6 +696,9 @@ export default {
filter: '过滤',
none: '无',
background: '背景',
border: '边角',
border_width: '边框宽度',
border_radius: '边框半径',
alpha: '透明度',
add_filter: '添加过滤',
no_limit: '无限制',
@ -842,7 +845,8 @@ export default {
width: '宽度',
height: '高度',
system_case: '系统方案',
custom_case: '自定义'
custom_case: '自定义',
last_layer: '当前已经是最后一级'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
@ -1013,7 +1017,8 @@ export default {
merge: '合并',
no_merge: '不合并',
merge_msg: '数据表中存在字段一致的情况,是否合并到一个数据集中?',
merge_title: '合并数据'
merge_title: '合并数据',
field_name_less_50: '字段名不能超过50个字符'
},
datasource: {
datasource: '数据源',

View File

@ -10,7 +10,6 @@
@import '~umy-ui/lib/theme-chalk/index.css';
// 引入样式
@import './deicon/iconfont.css';
// @import '../metersphere/common/css/index.css';
body {

View File

@ -8,7 +8,7 @@ import i18n from '@/lang'
import { tryShowLoading, tryHideLoading } from './loading'
import { getLinkToken, setLinkToken } from '@/utils/auth'
// import router from '@/router'
const interruptTokenContineUrls = Config.interruptTokenContineUrls
// const interruptTokenContineUrls = Config.interruptTokenContineUrls
const TokenKey = Config.TokenKey
const RefreshTokenKey = Config.RefreshTokenKey
const LinkTokenKey = Config.LinkTokenKey
@ -88,7 +88,8 @@ const checkAuth = response => {
})
}
// token到期后自动续命 刷新token
if (response.headers[RefreshTokenKey] && !interruptTokenContineUrls.some(item => response.config.url.indexOf(item) >= 0)) {
// if (response.headers[RefreshTokenKey] && !interruptTokenContineUrls.some(item => response.config.url.indexOf(item) >= 0)) {
if (response.headers[RefreshTokenKey]) {
const refreshToken = response.headers[RefreshTokenKey]
store.dispatch('user/refreshToken', refreshToken)
}

View File

@ -51,7 +51,7 @@ export function componentStyle(chart_option, chart) {
chart_option.legend.icon = customStyle.legend.icon
chart_option.legend.textStyle = customStyle.legend.textStyle
}
if (customStyle.xAxis && (chart.type.includes('bar') || chart.type.includes('line'))) {
if (customStyle.xAxis && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('scatter'))) {
chart_option.xAxis.show = customStyle.xAxis.show
chart_option.xAxis.position = customStyle.xAxis.position
chart_option.xAxis.name = customStyle.xAxis.name
@ -59,7 +59,7 @@ export function componentStyle(chart_option, chart) {
chart_option.xAxis.splitLine = customStyle.xAxis.splitLine
chart_option.xAxis.nameTextStyle = customStyle.xAxis.nameTextStyle
}
if (customStyle.yAxis && (chart.type.includes('bar') || chart.type.includes('line'))) {
if (customStyle.yAxis && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('scatter'))) {
chart_option.yAxis.show = customStyle.yAxis.show
chart_option.yAxis.position = customStyle.yAxis.position
chart_option.yAxis.name = customStyle.yAxis.name

View File

@ -1,7 +1,7 @@
<template>
<div style="display: flex;">
<view-track-bar ref="viewTrack" :track-menu="trackMenu" class="track-bar" :style="trackBarStyleTime" @trackClick="trackClick" />
<div :id="chartId" style="width: 100%;height: 100%;" />
<div :id="chartId" style="width: 100%;height: 100%;overflow: hidden;" :style="{ borderRadius: borderRadius}" />
</div>
</template>
@ -56,7 +56,8 @@ export default {
},
pointParam: null,
dynamicAreaCode: null
dynamicAreaCode: null,
borderRadius: '0px'
}
},
@ -195,11 +196,20 @@ export default {
myEcharts(option) {
//
const chart = this.myChart
this.setBackGroundBorder()
setTimeout(chart.setOption(option, true), 500)
window.onresize = function() {
chart.resize()
}
},
setBackGroundBorder() {
if (this.chart.customStyle) {
const customStyle = JSON.parse(this.chart.customStyle)
if (customStyle.background) {
this.borderRadius = (customStyle.background.borderRadius || 0) + 'px'
}
}
},
chartResize() {
//
const chart = this.myChart

View File

@ -8,6 +8,10 @@
<el-form-item :label="$t('chart.not_alpha')" class="form-item form-item-slider">
<el-slider v-model="colorForm.alpha" show-input :show-input-controls="false" input-size="mini" @change="changeBackgroundStyle" />
</el-form-item>
<el-form-item :label="$t('chart.border_radius')" class="form-item form-item-slider">
<el-slider v-model="colorForm.borderRadius" show-input :show-input-controls="false" input-size="mini" @change="changeBackgroundStyle" />
</el-form-item>
</el-form>
</el-col>
</div>

View File

@ -297,6 +297,7 @@ export default {
}
.el-radio{
margin:0 2px 0 0!important;
border: 1px solid transparent;
}
.el-radio>>>.el-radio__label{
padding-left: 0;

View File

@ -447,10 +447,10 @@
<el-row>
<span class="padding-lr">{{ $t('chart.module_style') }}</span>
<el-collapse v-model="styleActiveNames" class="style-collapse">
<el-collapse-item v-show="view.type && (view.type.includes('bar') || view.type.includes('line'))" name="xAxis" :title="$t('chart.xAxis')">
<el-collapse-item v-show="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('scatter'))" name="xAxis" :title="$t('chart.xAxis')">
<x-axis-selector :param="param" class="attr-selector" :chart="chart" @onChangeXAxisForm="onChangeXAxisForm" />
</el-collapse-item>
<el-collapse-item v-show="view.type && (view.type.includes('bar') || view.type.includes('line'))" name="yAxis" :title="$t('chart.yAxis')">
<el-collapse-item v-show="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('scatter'))" name="yAxis" :title="$t('chart.yAxis')">
<y-axis-selector :param="param" class="attr-selector" :chart="chart" @onChangeYAxisForm="onChangeYAxisForm" />
</el-collapse-item>
<el-collapse-item v-show="view.type && view.type.includes('radar')" name="split" :title="$t('chart.split')">
@ -1416,6 +1416,12 @@ export default {
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
this.getData(this.param.id)
}
} else if (this.view.drillFields.length > 0) {
this.$message({
type: 'error',
message: this.$t('chart.last_layer'),
showClose: true
})
}
},

View File

@ -312,6 +312,10 @@ export default {
},
saveCalcField() {
if (this.fieldForm.name && this.fieldForm.name.length > 50) {
this.$message.error(this.$t('dataset.field_name_less_50'))
return
}
if (!this.fieldForm.id) {
this.fieldForm.type = this.fieldForm.deType
this.fieldForm.deExtractType = this.fieldForm.deType

View File

@ -327,6 +327,10 @@ export default {
// // this.closeEdit()
// this.initField()
// })
if (item.name && item.name.length > 50) {
this.$message.error(this.$t('dataset.field_name_less_50'))
return
}
post('/dataset/field/save', item).then(response => {
this.initField()

View File

@ -1,30 +1,42 @@
<template>
<div class="my_table">
<el-table
ref="table"
:data="data"
lazy
:show-header="true"
:load="loadExpandDatas"
style="width: 100%"
:row-style="{height: '35px'}"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="deptId"
>
<el-table-column :label="$t('panel.all_org')" prop="name" />
<el-table-column type="selection" fixd />
<!-- <el-table-column label="分享给" prop="deptId" width="80" fixed="right">
<template slot-scope="scope">
<el-checkbox :v-model="scope.row.deptId===0" />
</template>
</el-table-column> -->
</el-table>
</div>
<el-col>
<el-row class="tree-head">
<span style="float: left;padding-left: 10px">{{ $t('panel.all_org') }}</span>
</el-row>
<el-row style="margin-top: 5px">
<el-tree
ref="tree"
:data="data"
lazy
:load="loadTree"
style="width: 100%"
:props="defaultProps"
:default-expanded-keys="expandNodeIds"
node-key="deptId"
>
<span slot-scope="{ node, data }" class="custom-tree-node">
<span>
<span style="margin-left: 6px">{{ data.name }}</span>
</span>
<span @click.stop>
<div>
<span class="auth-span">
<el-checkbox v-model="data.checked" />
</span>
</div>
</span>
</span>
</el-tree>
</el-row>
</el-col>
</template>
<script>
import { getDeptTree, loadTable } from '@/api/system/dept'
import { saveShare, loadShares } from '@/api/panel/share'
import { loadShares } from '@/api/panel/share'
export default {
name: 'GrantDept',
props: {
@ -48,7 +60,15 @@ export default {
type: 2, // 2
shares: [],
changeIndex: 0,
timeMachine: null
timeMachine: null,
defaultProps: {
children: 'children',
label: 'name',
isLeaf: (data, node) => {
return !data.hasChildren
}
},
expandNodeIds: []
}
},
watch: {
@ -81,9 +101,9 @@ export default {
this.timeMachine && clearTimeout(this.timeMachine)
this.timeMachine = null
},
//
loadExpandDatas(row, treeNode, resolve) {
getDeptTree(row.deptId).then(res => {
loadTree(node, resolve) {
if (!node || !node.data || !node.data.deptId) return
getDeptTree(node.data.deptId).then(res => {
let data = res.data
data = data.map(obj => {
if (obj.subCount > 0) {
@ -91,17 +111,13 @@ export default {
}
return obj
})
// this.maps.set(row.deptId, { row, treeNode, resolve })
this.setCheckExpandNodes(data)
resolve && resolve(data)
this.$nextTick(() => {
this.setCheckExpandNodes(data)
})
})
},
//
search(condition) {
// this.setTableAttr()
this.data = []
let param = {}
if (condition && condition.value) {
@ -110,31 +126,41 @@ export default {
param = { conditions: [this.defaultCondition] }
}
loadTable(param).then(res => {
let data = res.data
data = data.map(obj => {
if (obj.subCount > 0) {
obj.hasChildren = true
}
return obj
})
if (condition && condition.value) {
data = data.map(node => {
delete (node.hasChildren)
return node
this.queryShareNodeIds(() => {
loadTable(param).then(res => {
let data = res.data
data = data.map(obj => {
if (obj.subCount > 0) {
obj.hasChildren = true
}
return obj
})
this.data = this.buildTree(data)
this.$nextTick(() => {
data.forEach(node => {
this.$refs.table.toggleRowExpansion(node, true)
this.setCheckExpandNodes(data)
this.expandNodeIds = []
if (condition && condition.value) {
// data = data.map(node => {
// delete (node.hasChildren)
// return node
// })
this.data = this.buildTree(data)
this.$nextTick(() => {
// this.expandNodeIds.push()
this.expandResult(this.data)
})
})
} else {
this.data = data
}
} else {
this.data = data
}
})
})
},
this.queryShareNodeIds()
expandResult(list) {
list.forEach(node => {
if (node.children && node.children.length > 0) {
this.expandNodeIds.push(node.deptId)
this.expandResult(node.children)
}
})
},
@ -159,22 +185,21 @@ export default {
},
getSelected() {
// const ids = []
// this.searchChecked(ids)
// return {
// deptIds: ids
// }
// const ids = []
const nodesMap = this.$refs.tree.store.nodesMap
const ids = Object.values(nodesMap).filter(node => node.data.checked).map(item => item.data.deptId)
return {
deptIds: this.$refs.table.store.states.selection.map(item => item.deptId)
deptIds: ids
}
},
save(msg) {
const rows = this.$refs.table.store.states.selection
const request = this.buildRequest(rows)
saveShare(request).then(res => {
this.$success(msg)
return true
}).catch(err => {
this.$error(err.message)
return false
})
},
cancel() {
},
@ -196,23 +221,23 @@ export default {
const shares = res.data
const nodeIds = shares.map(share => share.targetId)
this.shares = nodeIds
this.$nextTick(() => {
this.setCheckNodes()
})
// this.$nextTick(() => {
// this.setCheckNodes()
// })
callBack && callBack()
})
},
setCheckNodes() {
this.data.forEach(node => {
const nodeId = node.deptId
this.shares.includes(nodeId) && this.$refs.table.toggleRowSelection(node, true)
})
},
// setCheckNodes() {
// this.data.forEach(node => {
// const nodeId = node.deptId
// this.shares.includes(nodeId) && (node.checked = true)
// })
// },
setCheckExpandNodes(rows) {
rows.forEach(node => {
const nodeId = node.deptId
this.shares.includes(nodeId) && this.$refs.table.toggleRowSelection(node, true)
this.shares.includes(nodeId) && (node.checked = true)
})
}
@ -222,6 +247,37 @@ export default {
<style scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-left: 8px;
}
.tree-main{
height: calc(100vh - 210px);
border: 1px solid #e6e6e6;
overflow-y: auto;
}
.tree-head{
height: 30px;
line-height: 30px;
border-bottom: 1px solid #e6e6e6;
background-color: #f7f8fa;
font-size: 12px;
color: #3d4d66 ;
}
.auth-span{
float: right;
width:50px;
margin-right: 30px
}
.highlights-text {
color: #faaa39 !important;
}
.my_table >>> .el-table__row>td{
/* 去除表格线 */
border: none;

View File

@ -15,7 +15,7 @@
</template>
<script>
import { roleGrid } from '@/api/system/role'
import { roleGrid } from '@/api/system/user'
import { formatCondition } from '@/utils/index'
import { saveShare, loadShares } from '@/api/panel/share'
export default {

View File

@ -1,234 +0,0 @@
<template>
<div v-loading="result.loading">
<el-form ref="form" :model="form" size="small" :rules="rules" :disabled="show">
<el-form-item :label="$t('ldap.url')" prop="url">
<el-input v-model="form.url" :placeholder="$t('ldap.input_url_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.dn')" prop="dn">
<el-input v-model="form.dn" :placeholder="$t('ldap.input_dn')" />
</el-form-item>
<el-form-item :label="$t('ldap.password')" prop="password">
<el-input
v-model="form.password"
:placeholder="$t('ldap.input_password')"
show-password
auto-complete="new-password"
/>
</el-form-item>
<el-form-item :label="$t('ldap.ou')" prop="ou">
<el-input v-model="form.ou" :placeholder="$t('ldap.input_ou_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.filter')" prop="filter">
<el-input v-model="form.filter" :placeholder="$t('ldap.input_filter_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.mapping')" prop="mapping">
<el-input v-model="form.mapping" :placeholder="$t('ldap.input_mapping_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.open')" prop="open">
<el-checkbox v-model="form.open" />
</el-form-item>
</el-form>
<div>
<el-button type="primary" size="small" :disabled="!show" @click="testConnection">{{ $t('ldap.test_connect') }}
</el-button>
<el-button type="primary" size="small" :disabled="!showLogin || !show" @click="testLogin">
{{ $t('ldap.test_login') }}
</el-button>
<el-button v-if="showEdit" size="small" @click="edit">{{ $t('ldap.edit') }}</el-button>
<el-button v-if="showSave" type="success" size="small" @click="save('form')">{{ $t('commons.save') }}
</el-button>
<el-button v-if="showCancel" type="info" size="small" @click="cancel">{{ $t('commons.cancel') }}</el-button>
</div>
<el-dialog
v-loading="result.loading"
:title="$t('ldap.test_login')"
:visible.sync="loginVisible"
width="30%"
destroy-on-close
@close="close"
>
<el-form ref="loginForm" :model="loginForm" :rules="loginFormRules" label-width="90px">
<el-form-item :label="$t('commons.username')" prop="username">
<el-input v-model="loginForm.username" autocomplete="off" :placeholder="$t('ldap.input_username')" />
</el-form-item>
<el-form-item :label="$t('commons.password')" prop="password">
<el-input
v-model="loginForm.password"
autocomplete="new-password"
:placeholder="$t('ldap.input_password')"
show-password
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="loginVisible = false">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" @click="login('loginForm')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import MsDialogFooter from '@/metersphere/common/components/MsDialogFooter'
// import { listenGoBack, removeGoBackListener } from '@/metersphere/common/js/utils'
export default {
name: 'LdapSetting',
components: {
},
data() {
return {
form: { open: false },
loginForm: {},
result: {},
show: true,
showEdit: true,
showSave: false,
showCancel: false,
showLogin: false,
loginVisible: false,
rules: {
url: { required: true, message: this.$t('ldap.input_url'), trigger: ['change', 'blur'] },
dn: { required: true, message: this.$t('ldap.input_dn'), trigger: ['change', 'blur'] },
password: { required: true, message: this.$t('ldap.input_password'), trigger: ['change', 'blur'] },
ou: { required: true, message: this.$t('ldap.input_ou'), trigger: ['change', 'blur'] },
filter: { required: true, message: this.$t('ldap.input_filter'), trigger: ['change', 'blur'] },
mapping: { required: true, message: this.$t('ldap.input_mapping'), trigger: ['change', 'blur'] }
},
loginFormRules: {
username: { required: true, message: this.$t('ldap.input_username'), trigger: 'blur' },
password: { required: true, message: this.$t('ldap.input_password'), trigger: 'blur' }
}
}
},
created() {
this.init()
},
methods: {
init() {
this.result = this.$get('/system/ldap/info', response => {
this.form = response.data
this.form.open = this.form.open === 'true'
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
})
},
edit() {
this.show = false
this.showEdit = false
this.showSave = true
this.showCancel = true
},
cancel() {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.init()
},
close() {
this.loginVisible = false
},
testConnection() {
if (!this.checkParam()) {
return false
}
this.result = this.$post('/ldap/test/connect', this.form, () => {
this.$success(this.$t('commons.connection_successful'))
this.showLogin = true
}, () => {
this.showLogin = false
})
},
testLogin() {
if (!this.checkParam()) {
return false
}
if (!this.form.ou) {
this.$warning(this.$t('ldap.ou_cannot_be_empty'))
return false
}
if (!this.form.filter) {
this.$warning(this.$t('ldap.filter_cannot_be_empty'))
return false
}
if (!this.form.mapping) {
this.$warning(this.$t('ldap.mapping_cannot_be_empty'))
return false
}
this.loginForm = {}
this.loginVisible = true
},
checkParam() {
if (!this.form.url) {
this.$warning(this.$t('ldap.url_cannot_be_empty'))
return false
}
if (!this.form.dn) {
this.$warning(this.$t('ldap.dn_cannot_be_empty'))
return false
}
if (!this.form.password) {
this.$warning(this.$t('ldap.password_cannot_be_empty'))
return false
}
return true
},
save(form) {
const param = [
{ paramKey: 'ldap.url', paramValue: this.form.url, type: 'text', sort: 1 },
{ paramKey: 'ldap.dn', paramValue: this.form.dn, type: 'text', sort: 2 },
{ paramKey: 'ldap.password', paramValue: this.form.password, type: 'password', sort: 3 },
{ paramKey: 'ldap.ou', paramValue: this.form.ou, type: 'text', sort: 4 },
{ paramKey: 'ldap.filter', paramValue: this.form.filter, type: 'text', sort: 5 },
{ paramKey: 'ldap.mapping', paramValue: this.form.mapping, type: 'text', sort: 6 },
{ paramKey: 'ldap.open', paramValue: this.form.open, type: 'text', sort: 7 }
]
this.$refs[form].validate(valid => {
if (valid) {
this.result = this.$post('/system/save/ldap', param, () => {
this.show = true
this.showEdit = true
this.showSave = false
this.showCancel = false
this.showLogin = false
this.$success(this.$t('commons.save_success'))
this.init()
})
} else {
return false
}
})
},
login(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.result = this.$post('/ldap/test/login', this.loginForm, () => {
this.$success(this.$t('ldap.login_success'))
})
} else {
return false
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -15,10 +15,10 @@
</template>
<el-table-column prop="username" label="ID" />
<el-table-column prop="nickName" sortable="custom" :label="$t('commons.nick_name')" />
<el-table-column prop="gender" :label="$t('commons.gender')" />
<el-table-column :show-overflow-tooltip="true" prop="nickName" sortable="custom" :label="$t('commons.nick_name')" />
<el-table-column prop="gender" :label="$t('commons.gender')" width="60" />
<el-table-column :show-overflow-tooltip="true" prop="phone" :label="$t('commons.phone')" />
<!-- <el-table-column :show-overflow-tooltip="true" prop="phone" :label="$t('commons.phone')" /> -->
<el-table-column :show-overflow-tooltip="true" prop="email" :label="$t('commons.email')" />
<el-table-column :show-overflow-tooltip="true" prop="dept" sortable="custom" :label="$t('commons.organization')">
<template slot-scope="scope">
@ -43,12 +43,12 @@
</div>
</template>
</el-table-column>
<el-table-column prop="status" sortable="custom" :label="$t('commons.status')">
<el-table-column prop="status" sortable="custom" :label="$t('commons.status')" width="80">
<template v-slot:default="scope">
<el-switch v-model="scope.row.enabled" :active-value="1" :inactive-value="0" :disabled="!checkPermission(['user:edit']) || scope.row.isAdmin" inactive-color="#DCDFE6" @change="changeSwitch(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="createTime" sortable="custom" :label="$t('commons.create_time')">
<el-table-column :show-overflow-tooltip="true" prop="createTime" sortable="custom" :label="$t('commons.create_time')" width="180">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
@ -191,6 +191,9 @@ export default {
}, {
label: this.$t('member.edit_password'), icon: 'el-icon-s-tools', type: 'success', click: this.editPassword,
show: this.checkPermission(['user:editPwd'])
}, {
label: '权限查看', icon: 'el-icon-lock', type: 'warning', click: this.showAuth,
show: this.checkPermission(['user:editPwd'])
}
],
searchConfig: {
@ -352,6 +355,9 @@ export default {
edit(row) {
this.$router.push({ name: 'system-user-form', params: row })
},
showAuth(row) {
this.$router.push({ name: 'system-user-form', params: row })
},
// edit(row) {
// this.depts = null
// this.formType = 'modify'