Merge remote-tracking branch 'origin/main' into main
# Conflicts: # frontend/src/components/vue-drag-resize-rotate/index.vue # frontend/src/store/modules/panel.js # frontend/src/views/panel/list/PanelViewShow.vue
@ -326,6 +326,11 @@
|
||||
<artifactId>hbase-common</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.hbase</groupId>
|
||||
<artifactId>hbase-mapreduce</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
@ -347,6 +352,10 @@
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.objenesis</groupId>
|
||||
<artifactId>objenesis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
@ -1,10 +1,13 @@
|
||||
package io.dataease.auth.config;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentRoleDto;
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.auth.entity.JWTToken;
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
@ -16,6 +19,8 @@ import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -58,7 +63,7 @@ public class F2CRealm extends AuthorizingRealm {
|
||||
if (username == null) {
|
||||
throw new AuthenticationException("token invalid");
|
||||
}
|
||||
|
||||
// 使用缓存
|
||||
SysUserEntity user = authUserService.getUserById(userId);
|
||||
if (user == null) {
|
||||
throw new AuthenticationException("User didn't existed!");
|
||||
@ -72,6 +77,13 @@ public class F2CRealm extends AuthorizingRealm {
|
||||
if (! JWTUtils.verify(token, tokenInfo, pass)) {
|
||||
throw new AuthenticationException("Username or password error");
|
||||
}
|
||||
return new SimpleAuthenticationInfo(token, token, "f2cReam");
|
||||
// 使用缓存
|
||||
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(user.getUserId());
|
||||
// 使用缓存
|
||||
List<String> permissions = authUserService.permissions(user.getUserId());
|
||||
CurrentUserDto currentUserDto = BeanUtils.copyBean(new CurrentUserDto(), user);
|
||||
currentUserDto.setRoles(currentRoleDtos);
|
||||
currentUserDto.setPermissions(permissions);
|
||||
return new SimpleAuthenticationInfo(currentUserDto, token, "f2cReam");
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import io.dataease.commons.utils.CodingUtil;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -58,19 +59,26 @@ public class AuthServer implements AuthApi {
|
||||
|
||||
@Override
|
||||
public CurrentUserDto userInfo() {
|
||||
String token = ServletUtils.getToken();
|
||||
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
|
||||
SysUserEntity user = authUserService.getUserById(userId);
|
||||
CurrentUserDto currentUserDto = BeanUtils.copyBean(new CurrentUserDto(), user);
|
||||
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(user.getUserId());
|
||||
List<String> permissions = authUserService.permissions(user.getUserId());
|
||||
currentUserDto.setRoles(currentRoleDtos);
|
||||
currentUserDto.setPermissions(permissions);
|
||||
return currentUserDto;
|
||||
CurrentUserDto userDto = (CurrentUserDto)SecurityUtils.getSubject().getPrincipal();
|
||||
if (ObjectUtils.isEmpty(userDto)) {
|
||||
String token = ServletUtils.getToken();
|
||||
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
|
||||
SysUserEntity user = authUserService.getUserById(userId);
|
||||
CurrentUserDto currentUserDto = BeanUtils.copyBean(new CurrentUserDto(), user);
|
||||
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(user.getUserId());
|
||||
List<String> permissions = authUserService.permissions(user.getUserId());
|
||||
currentUserDto.setRoles(currentRoleDtos);
|
||||
currentUserDto.setPermissions(permissions);
|
||||
return currentUserDto;
|
||||
}
|
||||
return userDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String logout(){
|
||||
String token = ServletUtils.getToken();
|
||||
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
|
||||
authUserService.clearCache(userId);
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ public interface AuthUserService {
|
||||
|
||||
List<CurrentRoleDto> roleInfos(Long userId);
|
||||
|
||||
void clearCache(Long userId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,8 +4,11 @@ import io.dataease.auth.api.dto.CurrentRoleDto;
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.base.mapper.ext.AuthMapper;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -16,7 +19,6 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class AuthUserServiceImpl implements AuthUserService {
|
||||
|
||||
private final String USER_CACHE_NAME = "users_info";
|
||||
|
||||
@Resource
|
||||
private AuthMapper authMapper;
|
||||
@ -26,7 +28,7 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(value = USER_CACHE_NAME, key = "'user' + #userId" )
|
||||
@Cacheable(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId" )
|
||||
@Override
|
||||
public SysUserEntity getUserById(Long userId){
|
||||
return authMapper.findUser(userId);
|
||||
@ -41,14 +43,42 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
public List<String> roles(Long userId){
|
||||
return authMapper.roleCodes(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此处需被F2CRealm登录认证调用 也就是说每次请求都会被调用 所以最好加上缓存
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(value = AuthConstants.USER_PERMISSION_CACHE_NAME, key = "'user' + #userId" )
|
||||
@Override
|
||||
public List<String> permissions(Long userId){
|
||||
List<String> permissions = authMapper.permissions(userId);
|
||||
return permissions.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 此处需被F2CRealm登录认证调用 也就是说每次请求都会被调用 所以最好加上缓存
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(value = AuthConstants.USER_ROLE_CACHE_NAME, key = "'user' + #userId" )
|
||||
@Override
|
||||
public List<CurrentRoleDto> roleInfos(Long userId) {
|
||||
return authMapper.roles(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 一波清除3个缓存
|
||||
* @param userId
|
||||
*/
|
||||
@Caching(evict = {
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId"),
|
||||
@CacheEvict(value = AuthConstants.USER_ROLE_CACHE_NAME, key = "'user' + #userId"),
|
||||
@CacheEvict(value = AuthConstants.USER_PERMISSION_CACHE_NAME, key = "'user' + #userId")
|
||||
})
|
||||
@Override
|
||||
public void clearCache(Long userId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DatasetTableIncrementalConfig implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String tableId;
|
||||
|
||||
private String incrementalDelete;
|
||||
|
||||
private String incrementalAdd;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,480 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetTableIncrementalConfigExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public DatasetTableIncrementalConfigExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(String value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(String value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(String value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(String value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLike(String value) {
|
||||
addCriterion("id like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotLike(String value) {
|
||||
addCriterion("id not like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(String value1, String value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(String value1, String value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdIsNull() {
|
||||
addCriterion("table_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdIsNotNull() {
|
||||
addCriterion("table_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdEqualTo(String value) {
|
||||
addCriterion("table_id =", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdNotEqualTo(String value) {
|
||||
addCriterion("table_id <>", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdGreaterThan(String value) {
|
||||
addCriterion("table_id >", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("table_id >=", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdLessThan(String value) {
|
||||
addCriterion("table_id <", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("table_id <=", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdLike(String value) {
|
||||
addCriterion("table_id like", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdNotLike(String value) {
|
||||
addCriterion("table_id not like", value, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdIn(List<String> values) {
|
||||
addCriterion("table_id in", values, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdNotIn(List<String> values) {
|
||||
addCriterion("table_id not in", values, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdBetween(String value1, String value2) {
|
||||
addCriterion("table_id between", value1, value2, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTableIdNotBetween(String value1, String value2) {
|
||||
addCriterion("table_id not between", value1, value2, "tableId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteIsNull() {
|
||||
addCriterion("incremental_delete is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteIsNotNull() {
|
||||
addCriterion("incremental_delete is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteEqualTo(String value) {
|
||||
addCriterion("incremental_delete =", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteNotEqualTo(String value) {
|
||||
addCriterion("incremental_delete <>", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteGreaterThan(String value) {
|
||||
addCriterion("incremental_delete >", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("incremental_delete >=", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteLessThan(String value) {
|
||||
addCriterion("incremental_delete <", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteLessThanOrEqualTo(String value) {
|
||||
addCriterion("incremental_delete <=", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteLike(String value) {
|
||||
addCriterion("incremental_delete like", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteNotLike(String value) {
|
||||
addCriterion("incremental_delete not like", value, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteIn(List<String> values) {
|
||||
addCriterion("incremental_delete in", values, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteNotIn(List<String> values) {
|
||||
addCriterion("incremental_delete not in", values, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteBetween(String value1, String value2) {
|
||||
addCriterion("incremental_delete between", value1, value2, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalDeleteNotBetween(String value1, String value2) {
|
||||
addCriterion("incremental_delete not between", value1, value2, "incrementalDelete");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddIsNull() {
|
||||
addCriterion("incremental_add is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddIsNotNull() {
|
||||
addCriterion("incremental_add is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddEqualTo(String value) {
|
||||
addCriterion("incremental_add =", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddNotEqualTo(String value) {
|
||||
addCriterion("incremental_add <>", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddGreaterThan(String value) {
|
||||
addCriterion("incremental_add >", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("incremental_add >=", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddLessThan(String value) {
|
||||
addCriterion("incremental_add <", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddLessThanOrEqualTo(String value) {
|
||||
addCriterion("incremental_add <=", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddLike(String value) {
|
||||
addCriterion("incremental_add like", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddNotLike(String value) {
|
||||
addCriterion("incremental_add not like", value, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddIn(List<String> values) {
|
||||
addCriterion("incremental_add in", values, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddNotIn(List<String> values) {
|
||||
addCriterion("incremental_add not in", values, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddBetween(String value1, String value2) {
|
||||
addCriterion("incremental_add between", value1, value2, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIncrementalAddNotBetween(String value1, String value2) {
|
||||
addCriterion("incremental_add not between", value1, value2, "incrementalAdd");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -9,9 +9,11 @@ public class PanelShare implements Serializable {
|
||||
|
||||
private String panelGroupId;
|
||||
|
||||
private Long userId;
|
||||
private Long targetId;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -234,63 +234,63 @@ public class PanelShareExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNull() {
|
||||
addCriterion("user_id is null");
|
||||
public Criteria andTargetIdIsNull() {
|
||||
addCriterion("target_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNotNull() {
|
||||
addCriterion("user_id is not null");
|
||||
public Criteria andTargetIdIsNotNull() {
|
||||
addCriterion("target_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdEqualTo(Long value) {
|
||||
addCriterion("user_id =", value, "userId");
|
||||
public Criteria andTargetIdEqualTo(Long value) {
|
||||
addCriterion("target_id =", value, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotEqualTo(Long value) {
|
||||
addCriterion("user_id <>", value, "userId");
|
||||
public Criteria andTargetIdNotEqualTo(Long value) {
|
||||
addCriterion("target_id <>", value, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdGreaterThan(Long value) {
|
||||
addCriterion("user_id >", value, "userId");
|
||||
public Criteria andTargetIdGreaterThan(Long value) {
|
||||
addCriterion("target_id >", value, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("user_id >=", value, "userId");
|
||||
public Criteria andTargetIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("target_id >=", value, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLessThan(Long value) {
|
||||
addCriterion("user_id <", value, "userId");
|
||||
public Criteria andTargetIdLessThan(Long value) {
|
||||
addCriterion("target_id <", value, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("user_id <=", value, "userId");
|
||||
public Criteria andTargetIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("target_id <=", value, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIn(List<Long> values) {
|
||||
addCriterion("user_id in", values, "userId");
|
||||
public Criteria andTargetIdIn(List<Long> values) {
|
||||
addCriterion("target_id in", values, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotIn(List<Long> values) {
|
||||
addCriterion("user_id not in", values, "userId");
|
||||
public Criteria andTargetIdNotIn(List<Long> values) {
|
||||
addCriterion("target_id not in", values, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdBetween(Long value1, Long value2) {
|
||||
addCriterion("user_id between", value1, value2, "userId");
|
||||
public Criteria andTargetIdBetween(Long value1, Long value2) {
|
||||
addCriterion("target_id between", value1, value2, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("user_id not between", value1, value2, "userId");
|
||||
public Criteria andTargetIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("target_id not between", value1, value2, "targetId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
@ -353,6 +353,66 @@ public class PanelShareExample {
|
||||
addCriterion("create_time not between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("`type` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("`type` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(Integer value) {
|
||||
addCriterion("`type` =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(Integer value) {
|
||||
addCriterion("`type` <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(Integer value) {
|
||||
addCriterion("`type` >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("`type` >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(Integer value) {
|
||||
addCriterion("`type` <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("`type` <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<Integer> values) {
|
||||
addCriterion("`type` in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<Integer> values) {
|
||||
addCriterion("`type` not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`type` between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
@ -0,0 +1,22 @@
|
||||
package io.dataease.base.mapper;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableIncrementalConfig;
|
||||
import io.dataease.base.domain.DatasetTableIncrementalConfigExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface DatasetTableIncrementalConfigMapper {
|
||||
long countByExample(DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int deleteByExample(DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int insert(DatasetTableIncrementalConfig record);
|
||||
|
||||
int insertSelective(DatasetTableIncrementalConfig record);
|
||||
|
||||
List<DatasetTableIncrementalConfig> selectByExample(DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int updateByExampleSelective(@Param("record") DatasetTableIncrementalConfig record, @Param("example") DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int updateByExample(@Param("record") DatasetTableIncrementalConfig record, @Param("example") DatasetTableIncrementalConfigExample example);
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
<?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.DatasetTableIncrementalConfigMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.DatasetTableIncrementalConfig">
|
||||
<result column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="table_id" jdbcType="VARCHAR" property="tableId" />
|
||||
<result column="incremental_delete" jdbcType="VARCHAR" property="incrementalDelete" />
|
||||
<result column="incremental_add" jdbcType="VARCHAR" property="incrementalAdd" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, table_id, incremental_delete, incremental_add
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfigExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from dataset_table_incremental_config
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfigExample">
|
||||
delete from dataset_table_incremental_config
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfig">
|
||||
insert into dataset_table_incremental_config (id, table_id, incremental_delete,
|
||||
incremental_add)
|
||||
values (#{id,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{incrementalDelete,jdbcType=VARCHAR},
|
||||
#{incrementalAdd,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfig">
|
||||
insert into dataset_table_incremental_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="tableId != null">
|
||||
table_id,
|
||||
</if>
|
||||
<if test="incrementalDelete != null">
|
||||
incremental_delete,
|
||||
</if>
|
||||
<if test="incrementalAdd != null">
|
||||
incremental_add,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tableId != null">
|
||||
#{tableId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="incrementalDelete != null">
|
||||
#{incrementalDelete,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="incrementalAdd != null">
|
||||
#{incrementalAdd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfigExample" resultType="java.lang.Long">
|
||||
select count(*) from dataset_table_incremental_config
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update dataset_table_incremental_config
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tableId != null">
|
||||
table_id = #{record.tableId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.incrementalDelete != null">
|
||||
incremental_delete = #{record.incrementalDelete,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.incrementalAdd != null">
|
||||
incremental_add = #{record.incrementalAdd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update dataset_table_incremental_config
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
table_id = #{record.tableId,jdbcType=VARCHAR},
|
||||
incremental_delete = #{record.incrementalDelete,jdbcType=VARCHAR},
|
||||
incremental_add = #{record.incrementalAdd,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
@ -4,8 +4,9 @@
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelShare">
|
||||
<id column="share_id" jdbcType="BIGINT" property="shareId" />
|
||||
<result column="panel_group_id" jdbcType="VARCHAR" property="panelGroupId" />
|
||||
<result column="user_id" jdbcType="BIGINT" property="userId" />
|
||||
<result column="target_id" jdbcType="BIGINT" property="targetId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="type" jdbcType="INTEGER" property="type" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -66,7 +67,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
share_id, panel_group_id, user_id, create_time
|
||||
share_id, panel_group_id, target_id, create_time, `type`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.PanelShareExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -99,10 +100,10 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.PanelShare">
|
||||
insert into panel_share (share_id, panel_group_id, user_id,
|
||||
create_time)
|
||||
values (#{shareId,jdbcType=BIGINT}, #{panelGroupId,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT},
|
||||
#{createTime,jdbcType=BIGINT})
|
||||
insert into panel_share (share_id, panel_group_id, target_id,
|
||||
create_time, `type`)
|
||||
values (#{shareId,jdbcType=BIGINT}, #{panelGroupId,jdbcType=VARCHAR}, #{targetId,jdbcType=BIGINT},
|
||||
#{createTime,jdbcType=BIGINT}, #{type,jdbcType=INTEGER})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelShare">
|
||||
insert into panel_share
|
||||
@ -113,12 +114,15 @@
|
||||
<if test="panelGroupId != null">
|
||||
panel_group_id,
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
<if test="targetId != null">
|
||||
target_id,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="shareId != null">
|
||||
@ -127,12 +131,15 @@
|
||||
<if test="panelGroupId != null">
|
||||
#{panelGroupId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=BIGINT},
|
||||
<if test="targetId != null">
|
||||
#{targetId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.PanelShareExample" resultType="java.lang.Long">
|
||||
@ -150,12 +157,15 @@
|
||||
<if test="record.panelGroupId != null">
|
||||
panel_group_id = #{record.panelGroupId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userId != null">
|
||||
user_id = #{record.userId,jdbcType=BIGINT},
|
||||
<if test="record.targetId != null">
|
||||
target_id = #{record.targetId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
`type` = #{record.type,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -165,8 +175,9 @@
|
||||
update panel_share
|
||||
set share_id = #{record.shareId,jdbcType=BIGINT},
|
||||
panel_group_id = #{record.panelGroupId,jdbcType=VARCHAR},
|
||||
user_id = #{record.userId,jdbcType=BIGINT},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT}
|
||||
target_id = #{record.targetId,jdbcType=BIGINT},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
`type` = #{record.type,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -177,20 +188,24 @@
|
||||
<if test="panelGroupId != null">
|
||||
panel_group_id = #{panelGroupId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=BIGINT},
|
||||
<if test="targetId != null">
|
||||
target_id = #{targetId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type` = #{type,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where share_id = #{shareId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelShare">
|
||||
update panel_share
|
||||
set panel_group_id = #{panelGroupId,jdbcType=VARCHAR},
|
||||
user_id = #{userId,jdbcType=BIGINT},
|
||||
create_time = #{createTime,jdbcType=BIGINT}
|
||||
target_id = #{targetId,jdbcType=BIGINT},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
`type` = #{type,jdbcType=INTEGER}
|
||||
where share_id = #{shareId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
@ -3,12 +3,16 @@ package io.dataease.base.mapper.ext;
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtPanelShareMapper {
|
||||
|
||||
int batchInsert(List<PanelShare> shares);
|
||||
int batchInsert(@Param("shares") List<PanelShare> shares);
|
||||
|
||||
List<PanelShareDto> query(GridExample example);
|
||||
List<PanelSharePo> query(GridExample example);
|
||||
|
||||
List<PanelShare> queryWithResource(GridExample example);
|
||||
}
|
||||
|
@ -2,22 +2,22 @@
|
||||
<!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.ExtPanelShareMapper">
|
||||
|
||||
<resultMap id="treeNodeMap" type="io.dataease.dto.panel.PanelShareDto">
|
||||
<resultMap id="treeNodeMap" type="io.dataease.dto.panel.PanelSharePo">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="pid" property="pid" />
|
||||
<result column="creator" property="creator" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="batchInsert" parameterType="io.dataease.base.domain.PanelStore">
|
||||
INSERT INTO panel_store (panel_group_id,user_id,create_time)
|
||||
<insert id="batchInsert" parameterType="io.dataease.base.domain.PanelShare">
|
||||
INSERT INTO panel_share (panel_group_id,target_id,create_time,type)
|
||||
VALUES
|
||||
<foreach collection="list" item="store" separator=",">
|
||||
(#{store.panelGroupId}, #{store.userId}, #{store.createTime})
|
||||
<foreach collection="shares" item="share" separator=",">
|
||||
(#{share.panelGroupId}, #{share.targetId}, #{share.createTime}, #{share.type})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="query" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="treeNodeMap">
|
||||
select s.panel_group_id as id, g.create_by as pid, g.name
|
||||
select distinct s.panel_group_id as id, g.create_by as creator, g.name
|
||||
from panel_share s
|
||||
left join panel_group g on g.id = s.panel_group_id
|
||||
<if test="_parameter != null">
|
||||
@ -32,6 +32,18 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryWithResource" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="io.dataease.base.mapper.PanelShareMapper.BaseResultMap">
|
||||
select * from panel_share
|
||||
<if test="_parameter != null">
|
||||
<include refid="io.dataease.base.mapper.ext.query.GridSql.gridCondition" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3,4 +3,9 @@ package io.dataease.commons.constants;
|
||||
public class AuthConstants {
|
||||
|
||||
public final static String TOKEN_KEY = "Authorization";
|
||||
public final static String USER_CACHE_NAME = "users_info";
|
||||
public final static String USER_ROLE_CACHE_NAME = "users_roles_info";
|
||||
public final static String USER_PERMISSION_CACHE_NAME = "users_permissions_info";
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum ScheduleType {
|
||||
CRON, SIMPLE
|
||||
CRON, SIMPLE, SIMPLE_COMPLETE
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum UpdateType {
|
||||
all_scope, add_scope
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.base.domain.SysUser;
|
||||
import io.dataease.service.sys.SysUserService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -17,12 +19,18 @@ public class AuthUtils {
|
||||
AuthUtils.sysUserService = sysUserService;
|
||||
}
|
||||
|
||||
public static SysUser getUser(){
|
||||
/*public static SysUser getUser(){
|
||||
SecurityUtils.getSubject().getPrincipal()
|
||||
String token = ServletUtils.getToken();
|
||||
TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(token);
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(tokenInfo.getUserId());
|
||||
SysUser user = sysUserService.findOne(sysUser);
|
||||
return user;
|
||||
}*/
|
||||
|
||||
public static CurrentUserDto getUser(){
|
||||
CurrentUserDto userDto = (CurrentUserDto)SecurityUtils.getSubject().getPrincipal();
|
||||
return userDto;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package io.dataease.controller.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTable;
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.base.domain.DatasetTableIncrementalConfig;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.datasource.dto.TableFiled;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
@ -70,4 +71,15 @@ public class DataSetTableController {
|
||||
public Map<String, Object> getSQLPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
return dataSetTableService.getSQLPreview(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("incrementalConfig")
|
||||
public DatasetTableIncrementalConfig incrementalConfig(@RequestBody DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
|
||||
return dataSetTableService.incrementalConfig(datasetTableIncrementalConfig);
|
||||
}
|
||||
|
||||
@PostMapping("save/incrementalConfig")
|
||||
public void saveIncrementalConfig(@RequestBody DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
|
||||
dataSetTableService.saveIncrementalConfig(datasetTableIncrementalConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.dataease.controller.panel.api;
|
||||
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
@ -25,5 +26,10 @@ public interface ShareApi {
|
||||
@PostMapping("/treeList")
|
||||
List<PanelShareDto> treeList(BaseGridRequest request);
|
||||
|
||||
|
||||
@ApiOperation("根据资源查询分享")
|
||||
@PostMapping("/queryWithResourceId")
|
||||
List<PanelShare> queryWithResourceId(BaseGridRequest request);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
package io.dataease.controller.panel.server;
|
||||
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.controller.panel.api.ShareApi;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.service.panel.ShareService;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class ShareServer implements ShareApi {
|
||||
|
||||
@Resource
|
||||
@ -23,4 +27,10 @@ public class ShareServer implements ShareApi {
|
||||
public List<PanelShareDto> treeList(@RequestBody BaseGridRequest request) {
|
||||
return shareService.queryTree(request);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PanelShare> queryWithResourceId(@RequestBody BaseGridRequest request) {
|
||||
return shareService.queryWithResource(request);
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,10 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PanelShareRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty("分享目标用户集合")
|
||||
private List<Long> userIds;
|
||||
@ApiModelProperty(value = "分享目标类型", allowableValues = "0:user,1:role,2:dept")
|
||||
private Integer type;
|
||||
@ApiModelProperty("分享目标集合")
|
||||
private List<Long> targetIds;
|
||||
@ApiModelProperty("分享仪表板集合")
|
||||
private List<String> panelIds;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class SysUserController {
|
||||
sysUserService.update(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@ApiOperation("删除用户")
|
||||
@PostMapping("/delete/{userId}")
|
||||
public void delete(@PathVariable("userId") Long userId){
|
||||
sysUserService.delete(userId);
|
||||
|
@ -1,21 +1,15 @@
|
||||
package io.dataease.dto.panel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class PanelShareDto {
|
||||
@NoArgsConstructor
|
||||
public class PanelShareDto extends PanelSharePo{
|
||||
|
||||
@ApiModelProperty("节点ID")
|
||||
private String id;
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
@ApiModelProperty("节点父ID")
|
||||
private String creator;
|
||||
@ApiModelProperty("子节点")
|
||||
private List<PanelShareDto> children;
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package io.dataease.dto.panel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class PanelSharePo {
|
||||
|
||||
@ApiModelProperty("节点ID")
|
||||
private String id;
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
@ApiModelProperty("节点父ID")
|
||||
private String creator;
|
||||
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ public abstract class DeScheduleJob implements Job {
|
||||
protected String datasetTableId;
|
||||
protected String expression;
|
||||
protected String taskId;
|
||||
protected String updateType;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
@ -16,6 +17,7 @@ public abstract class DeScheduleJob implements Job {
|
||||
this.datasetTableId = jobDataMap.getString("datasetTableId");
|
||||
this.expression = jobDataMap.getString("expression");
|
||||
this.taskId = jobDataMap.getString("taskId");
|
||||
this.updateType = jobDataMap.getString("updateType");
|
||||
|
||||
LogUtil.info(jobKey.getGroup() + " Running: " + datasetTableId);
|
||||
LogUtil.info("CronExpression: " + expression);
|
||||
|
@ -16,7 +16,7 @@ public class ExtractDataJob extends DeScheduleJob{
|
||||
|
||||
@Override
|
||||
void businessExecute(JobExecutionContext context) {
|
||||
extractDataService.extractData(datasetTableId, taskId);
|
||||
extractDataService.extractData(datasetTableId, taskId, updateType);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -369,11 +369,12 @@ public class ScheduleManager {
|
||||
addOrUpdateCronJob(jobKey, triggerKey, jobClass, cron, startTime, endTime, null);
|
||||
}
|
||||
|
||||
public JobDataMap getDefaultJobDataMap(String resourceId, String expression, String taskId) {
|
||||
public JobDataMap getDefaultJobDataMap(String resourceId, String expression, String taskId, String updateType) {
|
||||
JobDataMap jobDataMap = new JobDataMap();
|
||||
jobDataMap.put("datasetTableId", resourceId);
|
||||
jobDataMap.put("taskId", taskId);
|
||||
jobDataMap.put("expression", expression);
|
||||
jobDataMap.put("updateType", updateType);
|
||||
return jobDataMap;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.dataease.notice.service;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.base.domain.MessageTask;
|
||||
import io.dataease.base.domain.MessageTaskExample;
|
||||
import io.dataease.base.domain.SysUser;
|
||||
@ -101,7 +102,7 @@ public class NoticeService {
|
||||
}
|
||||
|
||||
public List<MessageDetail> searchMessageByType(String type) {
|
||||
SysUser user = AuthUtils.getUser();
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
//String orgId = user.getLastOrganizationId();
|
||||
List<MessageDetail> messageDetails = new ArrayList<>();
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.service;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.job.sechedule.ExtractDataJob;
|
||||
import io.dataease.job.sechedule.ScheduleManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -21,12 +22,13 @@ public class ScheduleService {
|
||||
private ScheduleManager scheduleManager;
|
||||
|
||||
public void addSchedule(DatasetTableTask datasetTableTask) throws Exception {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), "0")) {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), ScheduleType.SIMPLE.toString())) {
|
||||
scheduleManager.addOrUpdateSingleJob(new JobKey(datasetTableTask.getId(), datasetTableTask.getTableId()),
|
||||
new TriggerKey(datasetTableTask.getId(), datasetTableTask.getTableId()),
|
||||
ExtractDataJob.class,
|
||||
new Date(datasetTableTask.getStartTime()), scheduleManager.getDefaultJobDataMap(datasetTableTask.getTableId(), datasetTableTask.getCron(), datasetTableTask.getId()));
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), "1")) {
|
||||
new Date(datasetTableTask.getStartTime()),
|
||||
scheduleManager.getDefaultJobDataMap(datasetTableTask.getTableId(), datasetTableTask.getCron(), datasetTableTask.getId(), datasetTableTask.getType()));
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), ScheduleType.CRON.toString())) {
|
||||
Date endTime;
|
||||
if (datasetTableTask.getEndTime() == null || datasetTableTask.getEndTime() == 0) {
|
||||
endTime = null;
|
||||
@ -38,7 +40,7 @@ public class ScheduleService {
|
||||
new TriggerKey(datasetTableTask.getId(), datasetTableTask.getTableId()),
|
||||
ExtractDataJob.class,
|
||||
datasetTableTask.getCron(), new Date(datasetTableTask.getStartTime()), endTime,
|
||||
scheduleManager.getDefaultJobDataMap(datasetTableTask.getTableId(), datasetTableTask.getCron(), datasetTableTask.getId()));
|
||||
scheduleManager.getDefaultJobDataMap(datasetTableTask.getTableId(), datasetTableTask.getCron(), datasetTableTask.getId(), datasetTableTask.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,8 @@ package io.dataease.service.dataset;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.DatasetTable;
|
||||
import io.dataease.base.domain.DatasetTableExample;
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.base.domain.Datasource;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.DatasetTableIncrementalConfigMapper;
|
||||
import io.dataease.base.mapper.DatasetTableMapper;
|
||||
import io.dataease.base.mapper.DatasourceMapper;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
@ -40,6 +38,8 @@ public class DataSetTableService {
|
||||
private DataSetTableFieldsService dataSetTableFieldsService;
|
||||
@Resource
|
||||
private DataSetTableTaskService dataSetTableTaskService;
|
||||
@Resource
|
||||
private DatasetTableIncrementalConfigMapper datasetTableIncrementalConfigMapper;
|
||||
|
||||
public void batchInsert(List<DatasetTable> datasetTable) throws Exception {
|
||||
for (DatasetTable table : datasetTable) {
|
||||
@ -261,6 +261,20 @@ public class DataSetTableService {
|
||||
return data;
|
||||
}
|
||||
|
||||
public List<String[]> getDataSetDataBySql(String datasourceId, String table, String sql) {
|
||||
List<String[]> data = new ArrayList<>();
|
||||
Datasource ds = datasourceMapper.selectByPrimaryKey(datasourceId);
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
datasourceRequest.setQuery(sql);
|
||||
try {
|
||||
return datasourceProvider.getData(datasourceRequest);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public void saveTableField(DatasetTable datasetTable) throws Exception {
|
||||
Datasource ds = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
@ -349,4 +363,35 @@ public class DataSetTableService {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public DatasetTableIncrementalConfig incrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig){
|
||||
if(StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())){return new DatasetTableIncrementalConfig();}
|
||||
DatasetTableIncrementalConfigExample example = new DatasetTableIncrementalConfigExample();
|
||||
example.createCriteria().andTableIdEqualTo(datasetTableIncrementalConfig.getTableId());
|
||||
List<DatasetTableIncrementalConfig> configs = datasetTableIncrementalConfigMapper.selectByExample(example);
|
||||
if(CollectionUtils.isNotEmpty(configs)){
|
||||
return configs.get(0);
|
||||
}else {
|
||||
return new DatasetTableIncrementalConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public DatasetTableIncrementalConfig incrementalConfig(String datasetTableId){
|
||||
DatasetTableIncrementalConfig datasetTableIncrementalConfig = new DatasetTableIncrementalConfig();
|
||||
datasetTableIncrementalConfig.setTableId(datasetTableId);
|
||||
return incrementalConfig(datasetTableIncrementalConfig);
|
||||
}
|
||||
|
||||
|
||||
public void saveIncrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig){
|
||||
if(StringUtils.isEmpty(datasetTableIncrementalConfig.getId())){
|
||||
datasetTableIncrementalConfig.setId(UUID.randomUUID().toString());
|
||||
datasetTableIncrementalConfigMapper.insertSelective(datasetTableIncrementalConfig);
|
||||
}else{
|
||||
DatasetTableIncrementalConfigExample example = new DatasetTableIncrementalConfigExample();
|
||||
example.createCriteria().andTableIdEqualTo(datasetTableIncrementalConfig.getTableId());
|
||||
datasetTableIncrementalConfigMapper.updateByExample(datasetTableIncrementalConfig, example);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -70,6 +70,10 @@ public class DataSetTableTaskService {
|
||||
return datasetTableTaskMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void update(DatasetTableTask datasetTableTask) {
|
||||
datasetTableTaskMapper.updateByPrimaryKey(datasetTableTask);
|
||||
}
|
||||
|
||||
public List<DatasetTableTask> list(DatasetTableTask datasetTableTask) {
|
||||
DatasetTableTaskExample datasetTableTaskExample = new DatasetTableTaskExample();
|
||||
DatasetTableTaskExample.Criteria criteria = datasetTableTaskExample.createCriteria();
|
||||
|
@ -1,19 +1,23 @@
|
||||
package io.dataease.service.dataset;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.DatasetTable;
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.base.domain.DatasetTableTaskLog;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.commons.constants.JobStatus;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.commons.constants.UpdateType;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.dto.dataset.DataSetTaskLogDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@ -28,54 +32,74 @@ public class ExtractDataService {
|
||||
private DataSetTableFieldsService dataSetTableFieldsService;
|
||||
@Resource
|
||||
private DataSetTableTaskLogService dataSetTableTaskLogService;
|
||||
@Resource
|
||||
private DataSetTableTaskService dataSetTableTaskService;
|
||||
private Long pageSize = 10000l;
|
||||
private static ExecutorService pool = Executors.newScheduledThreadPool(50); //设置连接池
|
||||
private Connection connection;
|
||||
private static String lastUpdateTime = "${__last_update_time__}";
|
||||
private static String currentUpdateTime = "${__current_update_time__}";
|
||||
private static String column_family = "dataease";
|
||||
|
||||
public void extractData(String datasetTableId, String taskId) {
|
||||
public void extractData(String datasetTableId, String taskId, String type) {
|
||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||
UpdateType updateType = UpdateType.valueOf(type);
|
||||
try {
|
||||
datasetTableTaskLog.setTableId(datasetTableId);
|
||||
datasetTableTaskLog.setTaskId(taskId);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
|
||||
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
Admin admin = getConnection().getAdmin();
|
||||
DatasetTable datasetTable = dataSetTableService.get(datasetTableId);
|
||||
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.list(DatasetTableField.builder().tableId(datasetTable.getId()).build());
|
||||
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
|
||||
TableName tableName = TableName.valueOf(table + "-" + datasetTable.getDataSourceId());
|
||||
if(!admin.tableExists(tableName)){
|
||||
TableDescriptorBuilder descBuilder = TableDescriptorBuilder.newBuilder(tableName);
|
||||
ColumnFamilyDescriptor hcd = ColumnFamilyDescriptorBuilder.of("cf");
|
||||
descBuilder.setColumnFamily(hcd);
|
||||
TableDescriptor desc = descBuilder.build();
|
||||
admin.createTable(desc);
|
||||
}
|
||||
admin.disableTable(tableName);
|
||||
admin.truncateTable(tableName, true);
|
||||
|
||||
Table tab = getConnection().getTable(tableName);
|
||||
Long total = dataSetTableService.getDataSetTotalData(datasetTable.getDataSourceId(), table);
|
||||
Long pageCount = total % pageSize == 0 ? total / pageSize : (total / pageSize) + 1;
|
||||
|
||||
for (Long pageIndex = 1l; pageIndex <= pageCount; pageIndex++) {
|
||||
List<String[]> data = dataSetTableService.getDataSetPageData(datasetTable.getDataSourceId(), table, datasetTableFields, pageIndex, pageSize);
|
||||
for (String[] d : data) {
|
||||
for(int i=0;i<datasetTableFields.size();i++){
|
||||
Put put = new Put(UUID.randomUUID().toString().getBytes());
|
||||
String value = d[i];
|
||||
if(value == null){
|
||||
value = "null";
|
||||
}
|
||||
put.addColumn("cf".getBytes(), datasetTableFields.get(i).getOriginName().getBytes(), value.getBytes());
|
||||
tab.put(put);
|
||||
switch (updateType){
|
||||
// 全量更新
|
||||
case all_scope:
|
||||
writeDatasetTableTaskLog(datasetTableTaskLog,datasetTableId, taskId);
|
||||
if(!admin.tableExists(tableName)){
|
||||
creatHaseTable(tableName, admin);
|
||||
}
|
||||
}
|
||||
extractAllData(admin, tableName, table, datasetTable, datasetTableFields);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Completed.name());
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
break;
|
||||
case add_scope:
|
||||
// 增量更新
|
||||
if(!admin.tableExists(tableName)){
|
||||
LogUtil.error("TableName error, dataaset: " + datasetTableId);
|
||||
return;
|
||||
}
|
||||
DatasetTableIncrementalConfig datasetTableIncrementalConfig = dataSetTableService.incrementalConfig(datasetTableId);
|
||||
if(datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())){
|
||||
return;
|
||||
}
|
||||
DatasetTableTaskLog request = new DatasetTableTaskLog();
|
||||
request.setTableId(datasetTableId);
|
||||
request.setStatus(JobStatus.Completed.name());
|
||||
List<DataSetTaskLogDTO> dataSetTaskLogDTOS = dataSetTableTaskLogService.list(request);
|
||||
if(CollectionUtils.isEmpty(dataSetTaskLogDTOS)){
|
||||
return;
|
||||
}
|
||||
writeDatasetTableTaskLog(datasetTableTaskLog,datasetTableId, taskId);
|
||||
|
||||
// 增量添加
|
||||
if(StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd())){
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, dataSetTaskLogDTOS.get(0).getStartTime().toString()
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()));
|
||||
extractIncrementalData(tableName,table,datasetTable, datasetTableFields, sql, "add");
|
||||
}
|
||||
|
||||
// 增量删除
|
||||
if( StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete())){
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalDelete().replace(lastUpdateTime, dataSetTaskLogDTOS.get(0).getStartTime().toString()
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()));
|
||||
extractIncrementalData(tableName,table,datasetTable, datasetTableFields, sql, "delete");
|
||||
}
|
||||
|
||||
datasetTableTaskLog.setStatus(JobStatus.Completed.name());
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
break;
|
||||
}
|
||||
datasetTableTaskLog.setStatus(JobStatus.Completed.name());
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error("ExtractData error, dataaset: " + datasetTableId);
|
||||
@ -84,8 +108,75 @@ public class ExtractDataService {
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
}
|
||||
finally {
|
||||
DatasetTableTask datasetTableTask = dataSetTableTaskService.get(taskId);
|
||||
if (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())){
|
||||
datasetTableTask.setRate(ScheduleType.SIMPLE_COMPLETE.toString());
|
||||
dataSetTableTaskService.update(datasetTableTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeDatasetTableTaskLog(DatasetTableTaskLog datasetTableTaskLog, String datasetTableId, String taskId){
|
||||
datasetTableTaskLog.setTableId(datasetTableId);
|
||||
datasetTableTaskLog.setTaskId(taskId);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
|
||||
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
}
|
||||
|
||||
private void creatHaseTable(TableName tableName, Admin admin)throws Exception{
|
||||
TableDescriptorBuilder descBuilder = TableDescriptorBuilder.newBuilder(tableName);
|
||||
ColumnFamilyDescriptor hcd = ColumnFamilyDescriptorBuilder.of(column_family);
|
||||
descBuilder.setColumnFamily(hcd);
|
||||
TableDescriptor desc = descBuilder.build();
|
||||
admin.createTable(desc);
|
||||
}
|
||||
|
||||
private void extractAllData(Admin admin, TableName tableName, String table, DatasetTable datasetTable, List<DatasetTableField> datasetTableFields)throws Exception{
|
||||
admin.disableTable(tableName);
|
||||
admin.truncateTable(tableName, true);
|
||||
|
||||
Table tab = getConnection().getTable(tableName);
|
||||
Long total = dataSetTableService.getDataSetTotalData(datasetTable.getDataSourceId(), table);
|
||||
Long pageCount = total % pageSize == 0 ? total / pageSize : (total / pageSize) + 1;
|
||||
|
||||
for (Long pageIndex = 1l; pageIndex <= pageCount; pageIndex++) {
|
||||
List<String[]> data = dataSetTableService.getDataSetPageData(datasetTable.getDataSourceId(), table, datasetTableFields, pageIndex, pageSize);
|
||||
insertDataToHbaseTable(data,datasetTableFields,tab);
|
||||
}
|
||||
}
|
||||
|
||||
private void extractIncrementalData(TableName tableName, String table, DatasetTable datasetTable, List<DatasetTableField> datasetTableFields, String sql, String type)throws Exception{
|
||||
Table tab = getConnection().getTable(tableName);
|
||||
List<String[]> data = dataSetTableService.getDataSetDataBySql(datasetTable.getDataSourceId(), table, sql);
|
||||
if (type.equalsIgnoreCase("add")){
|
||||
insertDataToHbaseTable(data,datasetTableFields,tab);
|
||||
}else {
|
||||
deleteDataFromHbaseTable(data,datasetTableFields,tab);
|
||||
}
|
||||
}
|
||||
|
||||
private void insertDataToHbaseTable(List<String[]> data, List<DatasetTableField> datasetTableFields, Table tab)throws Exception{
|
||||
for (String[] d : data) {
|
||||
Put put = new Put(md5(generateStr(datasetTableFields.size(), d)).getBytes());
|
||||
for(int i=0;i<datasetTableFields.size();i++){
|
||||
String value = d[i];
|
||||
if(value == null){
|
||||
value = "null";
|
||||
}
|
||||
put.addColumn(column_family.getBytes(), datasetTableFields.get(i).getOriginName().getBytes(), value.getBytes());
|
||||
}
|
||||
tab.put(put);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteDataFromHbaseTable(List<String[]> data, List<DatasetTableField> datasetTableFields, Table tab)throws Exception{
|
||||
for (String[] d : data) {
|
||||
Delete delete = new Delete(md5(generateStr(datasetTableFields.size(), d)).getBytes());
|
||||
tab.delete(delete);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized Connection getConnection() throws Exception{
|
||||
if(connection == null || connection.isClosed()){
|
||||
@ -94,4 +185,43 @@ public class ExtractDataService {
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
private static final String UTF_8 = "UTF-8";
|
||||
|
||||
public static String md5(String src) {
|
||||
return md5(src, UTF_8);
|
||||
}
|
||||
|
||||
public static String md5(String src, String charset) {
|
||||
try {
|
||||
byte[] strTemp = io.micrometer.core.instrument.util.StringUtils.isEmpty(charset) ? src.getBytes() : src.getBytes(charset);
|
||||
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
|
||||
mdTemp.update(strTemp);
|
||||
|
||||
byte[] md = mdTemp.digest();
|
||||
int j = md.length;
|
||||
char[] str = new char[j * 2];
|
||||
int k = 0;
|
||||
|
||||
for (byte byte0 : md) {
|
||||
str[k++] = HEX_DIGITS[byte0 >>> 4 & 0xf];
|
||||
str[k++] = HEX_DIGITS[byte0 & 0xf];
|
||||
}
|
||||
|
||||
return new String(str);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("MD5 encrypt error:", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String generateStr(int size, String[] d ){
|
||||
String str = null;
|
||||
for(int i=0;i<size;i++){
|
||||
str = str + d[i];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,21 @@
|
||||
package io.dataease.service.panel;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentRoleDto;
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.base.domain.PanelShareExample;
|
||||
import io.dataease.base.domain.SysUser;
|
||||
import io.dataease.base.mapper.PanelShareMapper;
|
||||
import io.dataease.base.mapper.ext.ExtPanelShareMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -36,21 +41,26 @@ public class ShareService {
|
||||
public void save(PanelShareRequest request){
|
||||
|
||||
//1.先根据仪表板删除所有已经分享的
|
||||
Integer type = request.getType();
|
||||
List<String> panelIds = request.getPanelIds();
|
||||
List<Long> userIds = request.getUserIds();
|
||||
List<Long> targetIds = request.getTargetIds();
|
||||
// 使用原生对象会导致事物失效 所以这里需要使用spring代理对象
|
||||
if (CollectionUtils.isNotEmpty(panelIds)){
|
||||
ShareService proxy = CommonBeanFactory.getBean(ShareService.class);
|
||||
panelIds.forEach(proxy::delete);
|
||||
panelIds.forEach(panelId -> {
|
||||
proxy.delete(panelId, type);
|
||||
});
|
||||
}
|
||||
if (CollectionUtils.isEmpty(userIds)) return;
|
||||
if (CollectionUtils.isEmpty(targetIds)) return;
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
List<PanelShare> shares = panelIds.stream().flatMap(panelId ->
|
||||
userIds.stream().map(userId -> {
|
||||
targetIds.stream().map(targetId -> {
|
||||
PanelShare share = new PanelShare();
|
||||
share.setCreateTime(now);
|
||||
share.setPanelGroupId(panelId);
|
||||
share.setUserId(userId);
|
||||
share.setTargetId(targetId);
|
||||
share.setType(type);
|
||||
return share;
|
||||
})
|
||||
).collect(Collectors.toList());
|
||||
@ -64,30 +74,51 @@ public class ShareService {
|
||||
* @param panel_group_id
|
||||
*/
|
||||
@Transactional
|
||||
public void delete(String panel_group_id){
|
||||
public void delete(String panel_group_id, Integer type){
|
||||
PanelShareExample example = new PanelShareExample();
|
||||
example.createCriteria().andPanelGroupIdEqualTo(panel_group_id);
|
||||
example.createCriteria().andPanelGroupIdEqualTo(panel_group_id).andTypeEqualTo(type);
|
||||
mapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
|
||||
public List<PanelShareDto> queryTree(BaseGridRequest request){
|
||||
Long userId = AuthUtils.getUser().getUserId();
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
Long userId = user.getUserId();
|
||||
Long deptId = user.getDeptId();
|
||||
List<Long> roleIds = user.getRoles().stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
|
||||
|
||||
List<Long> targetIds = new ArrayList<>();
|
||||
targetIds.add(userId);
|
||||
targetIds.add(deptId);
|
||||
targetIds.addAll(roleIds);
|
||||
|
||||
ConditionEntity condition = new ConditionEntity();
|
||||
condition.setField("s.user_id");
|
||||
condition.setOperator("eq");
|
||||
condition.setValue(userId);
|
||||
condition.setField("s.target_id");
|
||||
condition.setOperator("in");
|
||||
condition.setValue(targetIds);
|
||||
|
||||
request.setConditions(new ArrayList<ConditionEntity>(){{add(condition);}});
|
||||
|
||||
GridExample example = request.convertExample();
|
||||
List<PanelShareDto> datas = extPanelShareMapper.query(example);
|
||||
return convertTree(datas);
|
||||
List<PanelSharePo> datas = extPanelShareMapper.query(example);
|
||||
List<PanelShareDto> dtoLists = datas.stream().map(po -> BeanUtils.copyBean(new PanelShareDto(), po)).collect(Collectors.toList());
|
||||
return convertTree(dtoLists);
|
||||
}
|
||||
|
||||
//List构建Tree
|
||||
private List<PanelShareDto> convertTree(List<PanelShareDto> datas){
|
||||
Map<String, List<PanelShareDto>> map = datas.stream().collect(Collectors.groupingBy(PanelShareDto::getCreator));
|
||||
List<PanelShareDto> roots = new ArrayList<>();
|
||||
return map.entrySet().stream().map(entry -> PanelShareDto.builder().name(entry.getKey()).children(entry.getValue()).build()).collect(Collectors.toList());
|
||||
return map.entrySet().stream().map(entry -> {
|
||||
PanelShareDto panelShareDto = new PanelShareDto();
|
||||
panelShareDto.setName(entry.getKey());
|
||||
panelShareDto.setChildren(entry.getValue());
|
||||
return panelShareDto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<PanelShare> queryWithResource(BaseGridRequest request){
|
||||
GridExample example = request.convertExample();
|
||||
return extPanelShareMapper.queryWithResource(example);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ import io.dataease.controller.sys.request.DeptDeleteRequest;
|
||||
import io.dataease.controller.sys.request.DeptStatusRequest;
|
||||
import io.dataease.controller.sys.request.SimpleTreeNode;
|
||||
import io.dataease.controller.sys.response.DeptTreeNode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -134,8 +135,10 @@ public class DeptService {
|
||||
List<SimpleTreeNode> targetNodes = nodeByCondition(request);
|
||||
List<Long> ids = upTree(allNodes, targetNodes);
|
||||
SysDeptExample example = new SysDeptExample();
|
||||
SysDeptExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andDeptIdIn(ids);
|
||||
if (CollectionUtils.isNotEmpty(ids)){
|
||||
SysDeptExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andDeptIdIn(ids);
|
||||
}
|
||||
example.setOrderByClause("dept_sort");
|
||||
List<SysDept> sysDepts = sysDeptMapper.selectByExample(example);
|
||||
return sysDepts;
|
||||
|
@ -8,6 +8,7 @@ import io.dataease.base.mapper.SysUserMapper;
|
||||
import io.dataease.base.mapper.SysUsersRolesMapper;
|
||||
import io.dataease.base.mapper.ext.ExtSysUserMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CodingUtil;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
@ -30,7 +31,6 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class SysUserService {
|
||||
|
||||
private final static String USER_CACHE_NAME = "users_info";
|
||||
private final static String DEFAULT_PWD = "DataEase123..";
|
||||
|
||||
@Resource
|
||||
@ -72,6 +72,12 @@ public class SysUserService {
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户密码清楚缓存
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@Transactional
|
||||
public int update(SysUserCreateRequest request){
|
||||
SysUser user = BeanUtils.copyBean(new SysUser(), request);
|
||||
@ -95,7 +101,7 @@ public class SysUserService {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
public int updatePwd(SysUserPwdRequest request) {
|
||||
if (!StringUtils.equals(request.getPassword(), request.getRepeatPassword())){
|
||||
throw new RuntimeException("两次密码不一致");
|
||||
@ -115,7 +121,7 @@ public class SysUserService {
|
||||
return sysUserMapper.updateByPrimaryKeySelective(sysUser);
|
||||
}
|
||||
|
||||
@CacheEvict(value = USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
public int adminUpdatePwd(SysUserPwdRequest request){
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(request.getUserId());
|
||||
@ -150,7 +156,7 @@ public class SysUserService {
|
||||
});
|
||||
}
|
||||
|
||||
@CacheEvict(value = USER_CACHE_NAME, key = "'user' + #userId")
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId")
|
||||
@Transactional
|
||||
public int delete(Long userId){
|
||||
deleteUserRoles(userId);
|
||||
|
@ -58,6 +58,8 @@ spring.cache.ehcache.config=classpath:/ehcache/ehcache.xml
|
||||
logging.level.org.springframework.web=trace
|
||||
logging.level.org.springframework.boot.web=trace
|
||||
spring.mvc.log-request-details=true
|
||||
pagehelper.PageRowBounds=true
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ CREATE TABLE `panel_store` (
|
||||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||
`create_time` bigint(13) DEFAULT NULL COMMENT '创建日期',
|
||||
PRIMARY KEY (`store_id`) USING BTREE,
|
||||
UNIQUE KEY `UK_store_user_id` (`user_id`) USING BTREE
|
||||
KEY `UK_store_user_id` (`user_id`)
|
||||
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='仪表板收藏';
|
||||
|
||||
@ -86,11 +86,14 @@ DROP TABLE IF EXISTS `panel_share`;
|
||||
CREATE TABLE `panel_share` (
|
||||
`share_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分享ID',
|
||||
`panel_group_id` varchar(50) DEFAULT NULL COMMENT '仪表板ID',
|
||||
`user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
|
||||
`target_id` bigint(20) DEFAULT NULL COMMENT '目标ID',
|
||||
`create_time` bigint(13) DEFAULT NULL COMMENT '创建日期',
|
||||
`type` int(8) DEFAULT NULL COMMENT '类型0:user,1:role,2dept',
|
||||
PRIMARY KEY (`share_id`) USING BTREE,
|
||||
UNIQUE KEY `UK_share_user_id` (`user_id`) USING BTREE,
|
||||
UNIQUE KEY `UK_share_panel_group_id` (`panel_group_id`) USING BTREE
|
||||
KEY `UK_share_arget_id` (`target_id`) ,
|
||||
KEY `UK_share_panel_group_id` (`panel_group_id`) ,
|
||||
KEY `UK_share_type` (`type`)
|
||||
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='仪表板分享';
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
DROP TABLE IF EXISTS `dataset_table_incremental_config`;
|
||||
CREATE TABLE IF NOT EXISTS `dataset_table_incremental_config`
|
||||
(
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`table_id` varchar(50) NOT NULL COMMENT '表ID',
|
||||
`incremental_delete` longtext COMMENT '详细信息',
|
||||
`incremental_add` longtext COMMENT '详细信息',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
@ -46,6 +46,28 @@
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
<cache
|
||||
name="users_roles_info"
|
||||
eternal="false"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="1000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="true"
|
||||
timeToIdleSeconds="1800"
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
<cache
|
||||
name="users_permissions_info"
|
||||
eternal="false"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="1000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="true"
|
||||
timeToIdleSeconds="1800"
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
|
||||
<cache
|
||||
name="tokens_expire"
|
||||
|
@ -37,11 +37,11 @@
|
||||
</commentGenerator>
|
||||
|
||||
<!-- jdbc连接信息 --> <!-- EduLoanManage EduTestDataBase -->
|
||||
<!--<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.20.180:3306/fit2cloud"-->
|
||||
<!--userId="root" password="Fit2cloud2015!" />-->
|
||||
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
|
||||
connectionURL="${spring.datasource.url}&nullCatalogMeansCurrent=true"
|
||||
userId="${spring.datasource.username}" password="${spring.datasource.password}"/>
|
||||
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://62.234.205.170:3306/dataease"
|
||||
userId="root" password="Password123@mysql" />
|
||||
<!-- <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"-->
|
||||
<!-- connectionURL="${spring.datasource.url}&nullCatalogMeansCurrent=true"-->
|
||||
<!-- userId="${spring.datasource.username}" password="${spring.datasource.password}"/>-->
|
||||
|
||||
<!-- javaTypeResolver式类型转换的信息 -->
|
||||
<javaTypeResolver>
|
||||
@ -64,8 +64,13 @@
|
||||
|
||||
<!--要生成的数据库表 -->
|
||||
|
||||
<!-- <table tableName="datasource"/>-->
|
||||
<table tableName="panel_group"/>
|
||||
<table tableName="dataset_table_incremental_config" >
|
||||
|
||||
<!--以下为添加内容 -->
|
||||
<columnOverride column="incremental_delete" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
<columnOverride column="incremental_add" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
</context>
|
||||
|
29
frontend/src/api/panel/share.js
Normal file
@ -0,0 +1,29 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function saveShare(data) {
|
||||
return request({
|
||||
url: '/api/share/',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function loadShares(data) {
|
||||
return request({
|
||||
url: '/api/share/queryWithResourceId',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function loadTree(data) {
|
||||
return request({
|
||||
url: '/api/share/treeList',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -312,8 +312,6 @@ export default {
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
styleInit:true,
|
||||
styleCatch:{},
|
||||
left: this.x,
|
||||
top: this.y,
|
||||
right: null,
|
||||
|
1
frontend/src/icons/svg/bar-horizontal.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616054957891" class="icon" viewBox="0 0 1072 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1374" xmlns:xlink="http://www.w3.org/1999/xlink" width="209.375" height="200"><defs><style type="text/css"></style></defs><path d="M150.528 77.482667v207.286857H623.177143l2.998857-207.286857zM1023.853714 380.830476H150.528v207.286857h867.791238zM820.711619 684.178286H150.528v207.286857h665.916952z" p-id="1375"></path><path d="M115.151238 943.079619V0.146286h-41.203809v994.377143h996.10819v-51.44381H115.151238z" fill="#8a8a8a" p-id="1376"></path></svg>
|
After Width: | Height: | Size: 707 B |
1
frontend/src/icons/svg/bar-stack-horizontal.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616055514308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4523" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M1004.202667 396.168533H19.677867c-8.97024 0-16.264533 7.294293-16.264534 16.145067v199.48544c0 8.973653 7.294293 16.145067 16.264534 16.145067h984.64768c8.97024 0 16.264533-7.294293 16.264533-16.145067v-199.48544a16.366933 16.366933 0 0 0-16.387413-16.145067z m-81.926827 150.21056H369.261227c-19.131733 0-34.679467-15.547733-34.679467-34.679466s15.547733-34.686293 34.679467-34.686294h553.018026c19.131733 0 34.679467 15.55456 34.679467 34.686294 0 19.135147-15.54432 34.679467-34.68288 34.679466zM1004.202667 94.306987H19.677867A16.2816 16.2816 0 0 0 3.413333 110.574933v199.48544c0 8.97024 7.294293 16.145067 16.264534 16.145067h984.64768c8.97024 0 16.264533-7.30112 16.264533-16.145067V110.452053c-0.12288-8.850773-7.417173-16.145067-16.387413-16.145066z m-81.926827 150.575786h-205.71136c-19.12832 0-34.68288-15.55456-34.68288-34.686293s15.55456-34.679467 34.68288-34.679467h205.71136c19.131733 0 34.679467 15.547733 34.679467 34.679467s-15.540907 34.686293-34.679467 34.686293zM1004.202667 697.914027H19.677867c-8.97024 0-16.264533 7.181653-16.264534 16.145066v199.48544c0 8.966827 7.294293 16.145067 16.264534 16.145067h984.64768c8.97024 0 16.264533-7.30112 16.264533-16.145067v-199.365973c-0.12288-8.97024-7.417173-16.264533-16.387413-16.264533z m-81.926827 150.572373H547.9424c-19.135147 0-34.686293-15.547733-34.686293-34.679467s15.547733-34.686293 34.686293-34.686293h374.336853c19.131733 0 34.679467 15.55456 34.679467 34.686293 0 19.254613-15.54432 34.679467-34.68288 34.679467z" p-id="4524"></path></svg>
|
After Width: | Height: | Size: 1.9 KiB |
1
frontend/src/icons/svg/bar-stack.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616054999656" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2027" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M268.04419 302.762667H59.879619c-19.114667 0-34.694095 15.579429-34.694095 34.694095v624.469333c0 19.041524 15.60381 34.694095 34.694095 34.694095h208.164571c19.114667 0 34.694095-15.652571 34.694096-34.694095V337.456762c0-19.114667-15.60381-34.694095-34.694096-34.694095z m0 624.469333H59.879619V649.679238h208.164571v277.552762zM614.985143 163.986286h-208.164572c-19.114667 0-34.694095 15.579429-34.694095 34.694095v763.245714c0 19.041524 15.60381 34.694095 34.694095 34.694095h208.164572c19.114667 0 34.694095-15.652571 34.694095-34.694095V198.704762c0-19.114667-15.579429-34.694095-34.694095-34.694095z m0 763.245714h-208.164572v-346.940952h208.164572v346.940952zM961.950476 25.209905h-208.164571c-19.114667 0-34.718476 15.579429-34.718476 34.694095v902.022095c0 19.041524 15.60381 34.694095 34.718476 34.694095h208.164571c19.114667 0 34.694095-15.652571 34.694095-34.694095V59.904c0-19.114667-15.60381-34.694095-34.694095-34.694095z m0 902.022095h-208.164571V510.902857h208.164571v416.329143z" p-id="2028"></path></svg>
|
After Width: | Height: | Size: 1.4 KiB |
1
frontend/src/icons/svg/bar.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616054813530" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="853" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M95.743954 952.636499h914.090232a14.360374 14.360374 0 0 1 14.165326 13.775231v43.812551a14.019041 14.019041 0 0 1-14.140945 13.775231H38.521886a14.238469 14.238469 0 0 1-14.140945-14.140945V38.521886A14.360374 14.360374 0 0 1 38.156172 24.380941h43.812551c7.631234 0 13.775232 6.436568 13.775231 14.140945v914.114613zM163.839922 402.529332c0-20.284943 14.969898-36.79084 35.206078-36.790839h69.071206c19.455991 0 35.206078 16.993516 35.206078 36.81522v438.369315c0.097524 9.801138-3.535236 19.309705-10.215614 26.209511a33.840746 33.840746 0 0 1-24.990464 10.60571H199.070381c-19.382848-0.219428-35.011031-16.505897-35.206078-36.815221V402.529332z m209.212853-269.482538c0-19.6998 14.994279-35.49865 35.206078-35.49865h69.071205a35.596174 35.596174 0 0 1 35.206079 35.49865v709.192805c0.097524 9.508567-3.63276 18.627039-10.215614 25.307416A34.303984 34.303984 0 0 1 477.37882 877.713868h-69.071205c-19.358467 0-35.108555-15.920754-35.206078-35.596174V133.022413z m232.594175 415.378088c0-20.089895 14.945517-36.400745 35.157316-36.400745h69.022444c19.455991 0 35.181698 15.701326 35.181697 36.400745v292.912622c0.097524 9.801138-3.63276 19.1878-10.288757 25.990083A33.621317 33.621317 0 0 1 709.729186 877.713868h-68.998063a33.645698 33.645698 0 0 1-24.89294-10.410662 37.205316 37.205316 0 0 1-10.313138-25.990083V548.400501h0.097524z m209.115329-196.388478c0-19.334086 14.969898-35.059793 35.206078-35.059793h69.071205c19.455991 0 35.206078 16.091421 35.206079 35.059793v490.642052c0 19.334086-14.994279 35.059793-35.206079 35.059793h-69.071205a35.376745 35.376745 0 0 1-35.206078-35.059793V352.012023z" p-id="854"></path></svg>
|
After Width: | Height: | Size: 2.0 KiB |
1
frontend/src/icons/svg/funnel.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616055024589" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2204" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M904.97219 357.595429L786.041905 690.785524H262.363429L143.36 357.595429h761.58781z m29.769143-83.309715L1024 24.380952H24.380952l89.234286 249.904762h821.150476z m-178.492952 499.809524L667.014095 1024H381.366857l-89.234286-249.904762h464.091429z" p-id="2205"></path></svg>
|
After Width: | Height: | Size: 652 B |
1
frontend/src/icons/svg/line.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616054974287" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1552" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M176.664381 916.309333H1024V999.619048H24.380952V0h83.309715v869.571048l271.286857-380.781715L646.826667 616.838095 903.972571 136.533333l73.435429 39.326477-294.716952 550.521904-276.48-132.242285z" p-id="1553"></path></svg>
|
After Width: | Height: | Size: 603 B |
1
frontend/src/icons/svg/pie.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616054982578" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1729" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M549.254095 0.219429v469.430857h469.430857C1018.684952 214.211048 804.693333 0.219429 549.254095 0.219429z" p-id="1730"></path><path d="M494.031238 517.973333V48.542476c-262.339048 0-469.430857 214.016-469.430857 469.430857 0 255.439238 213.991619 469.430857 469.430857 469.430857 262.339048 0 469.430857-213.991619 469.430857-469.430857H494.031238z" fill="#8a8a8a" p-id="1731"></path></svg>
|
After Width: | Height: | Size: 769 B |
@ -614,7 +614,30 @@ export default {
|
||||
color_gentle: '柔和',
|
||||
color_elegant: '淡雅',
|
||||
color_technology: '科技',
|
||||
color_simple: '简洁'
|
||||
color_simple: '简洁',
|
||||
not_alpha: '不透明度',
|
||||
size: '大小',
|
||||
bar_width: '柱宽',
|
||||
bar_gap: '柱间隔',
|
||||
adapt: '自适应',
|
||||
line_width: '线宽',
|
||||
line_type: '线型',
|
||||
line_symbol: '折点',
|
||||
line_symbol_size: '折点大小',
|
||||
line_type_solid: '实线',
|
||||
line_type_dashed: '虚线',
|
||||
line_symbol_circle: '圆形',
|
||||
line_symbol_emptyCircle: '空心圆',
|
||||
line_symbol_rect: '矩形',
|
||||
line_symbol_roundRect: '圆角矩形',
|
||||
line_symbol_triangle: '三角形',
|
||||
line_symbol_diamond: '菱形',
|
||||
line_symbol_pin: '钉子',
|
||||
line_symbol_arrow: '箭头',
|
||||
line_symbol_none: '无',
|
||||
pie_inner_radius: '内径',
|
||||
pie_outer_radius: '外径',
|
||||
funnel_width: '宽度'
|
||||
},
|
||||
dataset: {
|
||||
datalist: '数据集',
|
||||
@ -683,7 +706,12 @@ export default {
|
||||
add_sql_table: '添加SQL',
|
||||
preview: '预览',
|
||||
pls_input_name: '请输入名称',
|
||||
connect_mode: '连接模式'
|
||||
connect_mode: '连接模式',
|
||||
incremental_update_type: '增量更新方式:',
|
||||
incremental_add: '增量添加:',
|
||||
incremental_delete: '增量删除:',
|
||||
last_update_time: '上次更新时间:',
|
||||
current_update_time: '当前更新时间:'
|
||||
},
|
||||
datasource: {
|
||||
create: '新建数据连接',
|
||||
@ -701,6 +729,7 @@ export default {
|
||||
please_input_port: '请输入端口',
|
||||
modify: '编辑数据连接',
|
||||
validate_success: '校验成功',
|
||||
validate: '校验',
|
||||
delete: '删除组织',
|
||||
delete_confirm: '删除该组织会关联删除该组织下的所有资源(如:相关工作空间,项目,测试用例等),确定要删除吗?',
|
||||
input_name: '请输入名称',
|
||||
|
@ -8,15 +8,13 @@ import i18n from './lang' // internationalization
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import router from './router'
|
||||
|
||||
import message from './utils/message'
|
||||
import '@/icons' // icon
|
||||
import '@/permission' // permission control
|
||||
import api from '@/api/index.js'
|
||||
import filter from '@/filter/filter'
|
||||
import directives from './directive'
|
||||
|
||||
import './styles/vdrr/common-temp.scss'
|
||||
|
||||
import vdrr from './components/vue-drag-resize-rotate'
|
||||
Vue.component('vdrr', vdrr)
|
||||
|
||||
@ -27,7 +25,7 @@ import * as echarts from 'echarts'
|
||||
Vue.prototype.$echarts = echarts
|
||||
|
||||
import UmyUi from 'umy-ui'
|
||||
import 'umy-ui/lib/theme-chalk/index.css'// 引入样式
|
||||
|
||||
Vue.use(UmyUi)
|
||||
|
||||
// 引入vue-UUID组件
|
||||
@ -59,6 +57,7 @@ Vue.use(Fit2CloudUI, {
|
||||
})
|
||||
Vue.use(filter)
|
||||
Vue.use(directives)
|
||||
Vue.use(message)
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
|
@ -6,6 +6,8 @@
|
||||
@import './sidebar.scss';
|
||||
@import './topbar.scss';
|
||||
@import "~fit2cloud-ui/src/styles/index.scss";
|
||||
@import './vdrr/common-temp.scss';
|
||||
@import '~umy-ui/lib/theme-chalk/index.css';// 引入样式
|
||||
|
||||
// @import '../metersphere/common/css/index.css';
|
||||
|
||||
@ -69,3 +71,42 @@ div:focus {
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.de-dialog {
|
||||
width: 30% !important;
|
||||
|
||||
.el-dialog__header{
|
||||
background-color: #f4f4f5;
|
||||
padding: 10px 20px !important;
|
||||
}
|
||||
.el-dialog__body{
|
||||
padding: 1px 20px !important;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.de-search-header {
|
||||
.el-tabs__header{
|
||||
display: none !important;;
|
||||
}
|
||||
}
|
||||
|
||||
.de-input{
|
||||
margin-bottom: 14px;
|
||||
margin-top: 10px;
|
||||
.el-input{
|
||||
.el-input__inner {
|
||||
line-height: 30px !important;
|
||||
height: 30px !important;
|
||||
border-right: none;
|
||||
|
||||
}
|
||||
}
|
||||
.el-input__inner:focus{
|
||||
border-color: #E6E6E6 !important;
|
||||
}
|
||||
.el-input-group__append {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ const RefreshTokenKey = Config.RefreshTokenKey
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
// withCredentials: true, // send cookies when cross-domain requests
|
||||
timeout: 5000 // request timeout
|
||||
timeout: 0 // request timeout
|
||||
})
|
||||
|
||||
// request interceptor
|
||||
|
103
frontend/src/views/chart/chart/bar/bar.js
Normal file
@ -0,0 +1,103 @@
|
||||
import { hexColorToRGBA } from '../util.js'
|
||||
|
||||
export function baseBarOption(chart_option, chart) {
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
chart_option.xAxis.data = chart.data.x
|
||||
for (let i = 0; i < chart.data.series.length; i++) {
|
||||
const y = chart.data.series[i]
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
}
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
if (customAttr.size.barDefault) {
|
||||
y.barWidth = null
|
||||
y.barGap = null
|
||||
} else {
|
||||
y.barWidth = customAttr.size.barWidth
|
||||
y.barGap = customAttr.size.barGap
|
||||
}
|
||||
}
|
||||
y.type = 'bar'
|
||||
chart_option.legend.data.push(y.name)
|
||||
chart_option.series.push(y)
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
return chart_option
|
||||
}
|
||||
|
||||
export function stackBarOption(chart_option, chart) {
|
||||
baseBarOption(chart_option, chart)
|
||||
|
||||
// ext
|
||||
chart_option.series.forEach(function(s) {
|
||||
s.stack = 'stack'
|
||||
s.emphasis = {
|
||||
focus: 'series'
|
||||
}
|
||||
})
|
||||
return chart_option
|
||||
}
|
||||
|
||||
export function horizontalBarOption(chart_option, chart) {
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
chart_option.yAxis.data = chart.data.x
|
||||
for (let i = 0; i < chart.data.series.length; i++) {
|
||||
const y = chart.data.series[i]
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
}
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
if (customAttr.size.barDefault) {
|
||||
y.barWidth = null
|
||||
y.barGap = null
|
||||
} else {
|
||||
y.barWidth = customAttr.size.barWidth
|
||||
y.barGap = customAttr.size.barGap
|
||||
}
|
||||
}
|
||||
y.type = 'bar'
|
||||
chart_option.legend.data.push(y.name)
|
||||
chart_option.series.push(y)
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
return chart_option
|
||||
}
|
||||
|
||||
export function horizontalStackBarOption(chart_option, chart) {
|
||||
horizontalBarOption(chart_option, chart)
|
||||
|
||||
// ext
|
||||
chart_option.series.forEach(function(s) {
|
||||
s.stack = 'stack'
|
||||
s.emphasis = {
|
||||
focus: 'series'
|
||||
}
|
||||
})
|
||||
return chart_option
|
||||
}
|
@ -1,6 +1,19 @@
|
||||
export const DEFAULT_COLOR_CASE = {
|
||||
value: 'default',
|
||||
colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc']
|
||||
colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
|
||||
alpha: 100
|
||||
}
|
||||
export const DEFAULT_SIZE = {
|
||||
barDefault: true,
|
||||
barWidth: 40,
|
||||
barGap: 0.4,
|
||||
lineWidth: 1,
|
||||
lineType: 'solid',
|
||||
lineSymbol: 'emptyCircle',
|
||||
lineSymbolSize: 4,
|
||||
pieInnerRadius: 0,
|
||||
pieOuterRadius: 60,
|
||||
funnelWidth: 80
|
||||
}
|
||||
export const BASE_BAR = {
|
||||
title: {
|
||||
@ -18,6 +31,22 @@ export const BASE_BAR = {
|
||||
},
|
||||
series: []
|
||||
}
|
||||
export const HORIZONTAL_BAR = {
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: []
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
yAxis: {
|
||||
data: []
|
||||
},
|
||||
series: []
|
||||
}
|
||||
|
||||
export const BASE_LINE = {
|
||||
title: {
|
||||
@ -36,6 +65,78 @@ export const BASE_LINE = {
|
||||
series: []
|
||||
}
|
||||
|
||||
export default {
|
||||
BASE_BAR, BASE_LINE, DEFAULT_COLOR_CASE
|
||||
export const BASE_PIE = {
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
||||
},
|
||||
legend: {},
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'pie',
|
||||
radius: ['0%', '60%'],
|
||||
avoidLabelOverlap: false,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
},
|
||||
data: []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export const BASE_FUNNEL = {
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
// data: []
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'funnel',
|
||||
left: 'center',
|
||||
top: 60,
|
||||
bottom: 60,
|
||||
width: '80%',
|
||||
min: 0,
|
||||
max: 100,
|
||||
minSize: '0%',
|
||||
maxSize: '100%',
|
||||
sort: 'descending',
|
||||
gap: 1,
|
||||
// label: {
|
||||
// show: true,
|
||||
// position: 'inside'
|
||||
// },
|
||||
labelLine: {
|
||||
length: 10,
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
borderColor: '#fff',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
fontSize: 20
|
||||
}
|
||||
},
|
||||
data: []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
41
frontend/src/views/chart/chart/funnel/funnel.js
Normal file
@ -0,0 +1,41 @@
|
||||
import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
|
||||
export function baseFunnelOption(chart_option, chart) {
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
if (chart.data.series.length > 0) {
|
||||
chart_option.series[0].name = chart.data.series[0].name
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].width = customAttr.size.funnelWidth + '%'
|
||||
}
|
||||
const valueArr = chart.data.series[0].data
|
||||
// max value
|
||||
chart_option.series[0].max = Math.max.apply(Math, valueArr)
|
||||
for (let i = 0; i < valueArr.length; i++) {
|
||||
const y = {
|
||||
name: chart.data.x[i],
|
||||
value: valueArr[i]
|
||||
}
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
}
|
||||
y.type = 'funnel'
|
||||
chart_option.series[0].data.push(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
return chart_option
|
||||
}
|
||||
|
39
frontend/src/views/chart/chart/line/line.js
Normal file
@ -0,0 +1,39 @@
|
||||
import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
|
||||
export function baseLineOption(chart_option, chart) {
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
chart_option.xAxis.data = chart.data.x
|
||||
for (let i = 0; i < chart.data.series.length; i++) {
|
||||
const y = chart.data.series[i]
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
}
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
y.symbol = customAttr.size.lineSymbol
|
||||
y.symbolSize = customAttr.size.lineSymbolSize
|
||||
y.lineStyle = {
|
||||
width: customAttr.size.lineWidth,
|
||||
type: customAttr.size.lineType
|
||||
}
|
||||
}
|
||||
y.type = 'line'
|
||||
chart_option.legend.data.push(y.name)
|
||||
chart_option.series.push(y)
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
return chart_option
|
||||
}
|
||||
|
39
frontend/src/views/chart/chart/pie/pie.js
Normal file
@ -0,0 +1,39 @@
|
||||
import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
|
||||
export function basePieOption(chart_option, chart) {
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
if (chart.data.series.length > 0) {
|
||||
chart_option.series[0].name = chart.data.series[0].name
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].radius = [customAttr.size.pieInnerRadius + '%', customAttr.size.pieOuterRadius + '%']
|
||||
}
|
||||
const valueArr = chart.data.series[0].data
|
||||
for (let i = 0; i < valueArr.length; i++) {
|
||||
const y = {
|
||||
name: chart.data.x[i],
|
||||
value: valueArr[i]
|
||||
}
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
}
|
||||
y.type = 'pie'
|
||||
chart_option.series[0].data.push(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
return chart_option
|
||||
}
|
||||
|
19
frontend/src/views/chart/chart/util.js
Normal file
@ -0,0 +1,19 @@
|
||||
export function hexColorToRGBA(hex, alpha) {
|
||||
const rgb = [] // 定义rgb数组
|
||||
if (/^\#[0-9A-F]{3}$/i.test(hex)) { // 判断传入是否为#三位十六进制数
|
||||
let sixHex = '#'
|
||||
hex.replace(/[0-9A-F]/ig, function(kw) {
|
||||
sixHex += kw + kw // 把三位16进制数转化为六位
|
||||
})
|
||||
hex = sixHex // 保存回hex
|
||||
}
|
||||
if (/^#[0-9A-F]{6}$/i.test(hex)) { // 判断传入是否为#六位十六进制数
|
||||
hex.replace(/[0-9A-F]{2}/ig, function(kw) {
|
||||
rgb.push(eval('0x' + kw)) // 十六进制转化为十进制并存如数组
|
||||
})
|
||||
return `rgba(${rgb.join(',')},${alpha / 100})` // 输出RGB格式颜色
|
||||
} else {
|
||||
console.log(`Input ${hex} is wrong!`)
|
||||
return 'rgb(0,0,0)'
|
||||
}
|
||||
}
|
@ -5,7 +5,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { BASE_BAR, BASE_LINE } from '../chart/chart'
|
||||
import { BASE_BAR, BASE_LINE, HORIZONTAL_BAR, BASE_PIE, BASE_FUNNEL } from '../chart/chart'
|
||||
import { baseBarOption, stackBarOption, horizontalBarOption, horizontalStackBarOption } from '../chart/bar/bar'
|
||||
import { baseLineOption } from '../chart/line/line'
|
||||
import { basePieOption } from '../chart/pie/pie'
|
||||
import { baseFunnelOption } from '../chart/funnel/funnel'
|
||||
|
||||
export default {
|
||||
name: 'ChartComponent',
|
||||
@ -45,27 +49,21 @@ export default {
|
||||
let chart_option = {}
|
||||
// todo type
|
||||
if (chart.type === 'bar') {
|
||||
chart_option = JSON.parse(JSON.stringify(BASE_BAR))
|
||||
chart_option = baseBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
|
||||
} else if (chart.type === 'bar-stack') {
|
||||
chart_option = stackBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
|
||||
} else if (chart.type === 'bar-horizontal') {
|
||||
chart_option = horizontalBarOption(JSON.parse(JSON.stringify(HORIZONTAL_BAR)), chart)
|
||||
} else if (chart.type === 'bar-horizontal-stack') {
|
||||
chart_option = horizontalStackBarOption(JSON.parse(JSON.stringify(HORIZONTAL_BAR)), chart)
|
||||
} else if (chart.type === 'line') {
|
||||
chart_option = JSON.parse(JSON.stringify(BASE_LINE))
|
||||
}
|
||||
// console.log(chart_option);
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
chart_option.xAxis.data = chart.data.x
|
||||
chart.data.series.forEach(function(y) {
|
||||
chart_option.legend.data.push(y.name)
|
||||
chart_option.series.push(y)
|
||||
})
|
||||
}
|
||||
// console.log(chart_option);
|
||||
// 处理shape attr
|
||||
if (chart.customAttr) {
|
||||
if (chart.customAttr.color) {
|
||||
chart_option.color = chart.customAttr.color.colors
|
||||
}
|
||||
chart_option = baseLineOption(JSON.parse(JSON.stringify(BASE_LINE)), chart)
|
||||
} else if (chart.type === 'pie') {
|
||||
chart_option = basePieOption(JSON.parse(JSON.stringify(BASE_PIE)), chart)
|
||||
} else if (chart.type === 'funnel') {
|
||||
chart_option = baseFunnelOption(JSON.parse(JSON.stringify(BASE_FUNNEL)), chart)
|
||||
}
|
||||
console.log(chart_option)
|
||||
this.myEcharts(chart_option)
|
||||
},
|
||||
myEcharts(option) {
|
||||
|
73
frontend/src/views/chart/components/ChartComponentView.vue
Normal file
@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div class="Echarts" style="height: 100%;display: flex;margin-top: 10px;">
|
||||
<div id="echart" style="width: 100%;height: 100%;" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { BASE_BAR, BASE_LINE, HORIZONTAL_BAR, BASE_PIE, BASE_FUNNEL } from '../chart/chart'
|
||||
import { baseBarOption, stackBarOption, horizontalBarOption, horizontalStackBarOption } from '../chart/bar/bar'
|
||||
import { baseLineOption } from '../chart/line/line'
|
||||
import { basePieOption } from '../chart/pie/pie'
|
||||
import { baseFunnelOption } from '../chart/funnel/funnel'
|
||||
|
||||
export default {
|
||||
name: 'ChartComponentView',
|
||||
props: {
|
||||
chart: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
myChart: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
chart() {
|
||||
this.drawEcharts()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
this.myChart = this.$echarts.init(document.getElementById('echart'))
|
||||
},
|
||||
methods: {
|
||||
drawEcharts() {
|
||||
const chart = this.chart
|
||||
let chart_option = {}
|
||||
// todo type
|
||||
if (chart.type === 'bar') {
|
||||
chart_option = baseBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
|
||||
} else if (chart.type === 'bar-stack') {
|
||||
chart_option = stackBarOption(JSON.parse(JSON.stringify(BASE_BAR)), chart)
|
||||
} else if (chart.type === 'bar-horizontal') {
|
||||
chart_option = horizontalBarOption(JSON.parse(JSON.stringify(HORIZONTAL_BAR)), chart)
|
||||
} else if (chart.type === 'bar-horizontal-stack') {
|
||||
chart_option = horizontalStackBarOption(JSON.parse(JSON.stringify(HORIZONTAL_BAR)), chart)
|
||||
} else if (chart.type === 'line') {
|
||||
chart_option = baseLineOption(JSON.parse(JSON.stringify(BASE_LINE)), chart)
|
||||
} else if (chart.type === 'pie') {
|
||||
chart_option = basePieOption(JSON.parse(JSON.stringify(BASE_PIE)), chart)
|
||||
} else if (chart.type === 'funnel') {
|
||||
chart_option = baseFunnelOption(JSON.parse(JSON.stringify(BASE_FUNNEL)), chart)
|
||||
}
|
||||
console.log(chart_option)
|
||||
this.myEcharts(chart_option)
|
||||
},
|
||||
myEcharts(option) {
|
||||
// 指定图表的配置项和数据
|
||||
const chart = this.myChart
|
||||
setTimeout(chart.setOption(option, true), 500)
|
||||
window.onresize = function() {
|
||||
chart.resize()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -24,10 +24,10 @@
|
||||
<el-dropdown-item icon="el-icon-s-grid">
|
||||
<el-dropdown placement="right-start" size="mini" @command="quickCalc">
|
||||
<span class="el-dropdown-link">
|
||||
{{ $t('chart.quick_calc') }}<span class="summary-span">(test)</span><i class="el-icon-arrow-right el-icon--right" />
|
||||
{{ $t('chart.quick_calc') }}<span class="summary-span">(无)</span><i class="el-icon-arrow-right el-icon--right" />
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeQuickCalc('none')">test</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeQuickCalc('none')">无</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
|
@ -18,8 +18,12 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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="changeColorCase" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
||||
<el-button slot="reference" size="mini" class="shape-item">{{ $t('chart.color') }}<i class="el-icon-setting el-icon--right" /></el-button>
|
||||
</el-popover>
|
||||
<!--todo other color attr-->
|
||||
@ -86,7 +90,8 @@ export default {
|
||||
}
|
||||
],
|
||||
colorForm: {
|
||||
colorCase: 'default'
|
||||
colorCase: 'default',
|
||||
alpha: 100
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -94,7 +99,13 @@ export default {
|
||||
'chart': {
|
||||
handler: function() {
|
||||
const chart = JSON.parse(JSON.stringify(this.chart))
|
||||
this.colorForm.colorCase = chart.customAttr.color.value
|
||||
if (chart.customAttr) {
|
||||
const customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.color) {
|
||||
this.colorForm.colorCase = customAttr.color.value
|
||||
this.colorForm.alpha = customAttr.color.alpha
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -108,7 +119,8 @@ export default {
|
||||
})
|
||||
this.$emit('onColorChange', {
|
||||
value: items[0].value,
|
||||
colors: items[0].colors
|
||||
colors: items[0].colors,
|
||||
alpha: this.colorForm.alpha
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -120,11 +132,20 @@ export default {
|
||||
padding: 6px;
|
||||
border: none;
|
||||
}
|
||||
.form-item-slider>>>.el-form-item__label{
|
||||
font-size: 12px;
|
||||
line-height: 38px;
|
||||
}
|
||||
.form-item>>>.el-form-item__label{
|
||||
font-size: 12px;
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
padding: 0 20px;
|
||||
}
|
||||
span{font-size: 12px}
|
||||
span{
|
||||
font-size: 12px
|
||||
}
|
||||
.el-form-item{
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
</style>
|
139
frontend/src/views/chart/components/shape_attr/SizeSelector.vue
Normal file
@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div>
|
||||
<div style="width:100%;height: 32px;margin:0;padding:0 4px;border-radius: 4px;border: 1px solid #DCDFE6;display: flex;align-items: center;">
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="400"
|
||||
trigger="click"
|
||||
>
|
||||
<el-col>
|
||||
<el-form v-if="chart.type && chart.type.includes('bar')" ref="sizeFormBar" :model="sizeForm" label-width="80px" size="mini">
|
||||
<el-form-item :label="$t('chart.adapt')" class="form-item">
|
||||
<el-checkbox v-model="sizeForm.barDefault" @change="changeBarSizeCase">{{ $t('chart.adapt') }}</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.bar_width')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.barWidth" :disabled="sizeForm.barDefault" show-input :show-input-controls="false" input-size="mini" :min="1" :max="80" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.bar_gap')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.barGap" :disabled="sizeForm.barDefault" show-input :show-input-controls="false" input-size="mini" :min="0" :max="5" :step="0.1" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-form v-if="chart.type && chart.type.includes('line')" ref="sizeFormLine" :model="sizeForm" label-width="80px" size="mini">
|
||||
<el-form-item :label="$t('chart.line_width')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.lineWidth" show-input :show-input-controls="false" input-size="mini" :min="0" :max="10" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.line_type')" class="form-item">
|
||||
<el-radio-group v-model="sizeForm.lineType" @change="changeBarSizeCase">
|
||||
<el-radio label="solid">{{ $t('chart.line_type_solid') }}</el-radio>
|
||||
<el-radio label="dashed">{{ $t('chart.line_type_dashed') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.line_symbol')" class="form-item">
|
||||
<el-select v-model="sizeForm.lineSymbol" :placeholder="$t('chart.line_symbol')" @change="changeBarSizeCase">
|
||||
<el-option
|
||||
v-for="item in lineSymbolOptions"
|
||||
:key="item.value"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.line_symbol_size')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.lineSymbolSize" show-input :show-input-controls="false" input-size="mini" :min="0" :max="20" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-form v-if="chart.type && chart.type.includes('pie')" ref="sizeFormPie" :model="sizeForm" label-width="80px" size="mini">
|
||||
<el-form-item :label="$t('chart.pie_inner_radius')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.pieInnerRadius" show-input :show-input-controls="false" input-size="mini" :min="0" :max="100" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.pie_outer_radius')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.pieOuterRadius" show-input :show-input-controls="false" input-size="mini" :min="0" :max="100" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-form v-if="chart.type && chart.type.includes('funnel')" ref="sizeFormPie" :model="sizeForm" label-width="80px" size="mini">
|
||||
<el-form-item :label="$t('chart.funnel_width')" class="form-item form-item-slider">
|
||||
<el-slider v-model="sizeForm.funnelWidth" show-input :show-input-controls="false" input-size="mini" :min="0" :max="100" @change="changeBarSizeCase" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
||||
<el-button slot="reference" size="mini" class="shape-item">{{ $t('chart.size') }}<i class="el-icon-setting el-icon--right" /></el-button>
|
||||
</el-popover>
|
||||
<!--todo other size attr-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DEFAULT_SIZE } from '../../chart/chart'
|
||||
export default {
|
||||
name: 'SizeSelector',
|
||||
props: {
|
||||
chart: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sizeForm: JSON.parse(JSON.stringify(DEFAULT_SIZE)),
|
||||
lineSymbolOptions: [
|
||||
{ name: this.$t('chart.line_symbol_none'), value: 'none' },
|
||||
{ name: this.$t('chart.line_symbol_emptyCircle'), value: 'emptyCircle' },
|
||||
{ name: this.$t('chart.line_symbol_circle'), value: 'circle' },
|
||||
{ name: this.$t('chart.line_symbol_rect'), value: 'rect' },
|
||||
{ name: this.$t('chart.line_symbol_roundRect'), value: 'roundRect' },
|
||||
{ name: this.$t('chart.line_symbol_triangle'), value: 'triangle' },
|
||||
{ name: this.$t('chart.line_symbol_diamond'), value: 'diamond' },
|
||||
{ name: this.$t('chart.line_symbol_pin'), value: 'pin' },
|
||||
{ name: this.$t('chart.line_symbol_arrow'), value: 'arrow' }
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'chart': {
|
||||
handler: function() {
|
||||
const chart = JSON.parse(JSON.stringify(this.chart))
|
||||
if (chart.customAttr) {
|
||||
const customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.size) {
|
||||
this.sizeForm = customAttr.size
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
changeBarSizeCase() {
|
||||
this.$emit('onSizeChange', this.sizeForm)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shape-item{
|
||||
padding: 6px;
|
||||
border: none;
|
||||
}
|
||||
.form-item-slider>>>.el-form-item__label{
|
||||
font-size: 12px;
|
||||
line-height: 38px;
|
||||
}
|
||||
.form-item>>>.el-form-item__label{
|
||||
font-size: 12px;
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
padding: 0 20px;
|
||||
}
|
||||
span{font-size: 12px}
|
||||
|
||||
.el-form-item{
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
</style>
|
@ -211,7 +211,7 @@
|
||||
<script>
|
||||
import { post } from '@/api/chart/chart'
|
||||
import TableSelector from '../view/TableSelector'
|
||||
import { DEFAULT_COLOR_CASE } from '../chart/chart'
|
||||
import { DEFAULT_COLOR_CASE, DEFAULT_SIZE } from '../chart/chart'
|
||||
|
||||
export default {
|
||||
name: 'Group',
|
||||
@ -506,7 +506,8 @@ export default {
|
||||
view.tableId = this.table.id
|
||||
view.type = 'bar'
|
||||
view.customAttr = JSON.stringify({
|
||||
color: DEFAULT_COLOR_CASE
|
||||
color: DEFAULT_COLOR_CASE,
|
||||
size: DEFAULT_SIZE
|
||||
})
|
||||
post('/chart/view/save', view).then(response => {
|
||||
this.selectTableFlag = false
|
||||
|
@ -78,16 +78,24 @@
|
||||
<span>{{ $t('chart.chart_type') }}</span>
|
||||
<el-row>
|
||||
<div class="chart-type">
|
||||
<!--TODO 这里要替换好看点的图标-->
|
||||
<el-radio v-model="view.type" label="bar"><i class="el-icon-platform-eleme" style="font-size: 20px" /></el-radio>
|
||||
<el-radio v-model="view.type" label="line">折线图</el-radio>
|
||||
<!--TODO 这里要替换好看点的图标,UI标签可以重新定义-->
|
||||
<el-radio-group v-model="view.type" @change="save">
|
||||
<el-radio value="bar" label="bar"><svg-icon icon-class="bar" class="chart-icon" /></el-radio>
|
||||
<el-radio value="bar-stack" label="bar-stack"><svg-icon icon-class="bar-stack" class="chart-icon" /></el-radio>
|
||||
<el-radio value="bar-horizontal" label="bar-horizontal"><svg-icon icon-class="bar-horizontal" class="chart-icon" /></el-radio>
|
||||
<el-radio value="bar-horizontal-stack" label="bar-horizontal-stack"><svg-icon icon-class="bar-stack-horizontal" class="chart-icon" /></el-radio>
|
||||
<el-radio value="line" label="line"><svg-icon icon-class="line" class="chart-icon" /></el-radio>
|
||||
<el-radio value="pie" label="pie"><svg-icon icon-class="pie" class="chart-icon" /></el-radio>
|
||||
<el-radio value="funnel" label="funnel"><svg-icon icon-class="funnel" class="chart-icon" /></el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
<div style="height: 45%;overflow:auto;border-top: 1px solid #e6e6e6">
|
||||
<el-tabs type="card" :stretch="true" class="tab-header">
|
||||
<el-tab-pane :label="$t('chart.shape_attr')" class="padding-lr">
|
||||
<color-selector :chart="chart" @onColorChange="onColorChange" />
|
||||
<color-selector class="attr-selector" :chart="chart" @onColorChange="onColorChange" />
|
||||
<size-selector class="attr-selector" :chart="chart" @onSizeChange="onSizeChange" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('chart.module_style')" class="padding-lr">TODO</el-tab-pane>
|
||||
</el-tabs>
|
||||
@ -133,7 +141,7 @@
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
||||
<chart-component :chart="chart" />
|
||||
<chart-component-view :chart="chart" style="height: 80%" />
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -145,14 +153,15 @@ import { post } from '@/api/dataset/dataset'
|
||||
import draggable from 'vuedraggable'
|
||||
import DimensionItem from '../components/DimensionItem'
|
||||
import QuotaItem from '../components/QuotaItem'
|
||||
import ChartComponent from '../components/ChartComponent'
|
||||
import ChartComponentView from '../components/ChartComponentView'
|
||||
// shape attr
|
||||
import { DEFAULT_COLOR_CASE } from '../chart/chart'
|
||||
import ColorSelector from '../components/ColorSelector'
|
||||
import { DEFAULT_COLOR_CASE, DEFAULT_SIZE } from '../chart/chart'
|
||||
import ColorSelector from '../components/shape_attr/ColorSelector'
|
||||
import SizeSelector from '../components/shape_attr/SizeSelector'
|
||||
|
||||
export default {
|
||||
name: 'ChartEdit',
|
||||
components: { ColorSelector, ChartComponent, QuotaItem, DimensionItem, draggable },
|
||||
components: { SizeSelector, ColorSelector, ChartComponentView, QuotaItem, DimensionItem, draggable },
|
||||
data() {
|
||||
return {
|
||||
table: {},
|
||||
@ -165,7 +174,8 @@ export default {
|
||||
type: 'bar',
|
||||
title: '',
|
||||
customAttr: {
|
||||
color: DEFAULT_COLOR_CASE
|
||||
color: DEFAULT_COLOR_CASE,
|
||||
size: DEFAULT_SIZE
|
||||
}
|
||||
},
|
||||
// 定义要被拖拽对象的数组
|
||||
@ -201,11 +211,6 @@ export default {
|
||||
|
||||
},
|
||||
watch: {
|
||||
'view.type': {
|
||||
handler: function() {
|
||||
this.save()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.get(this.$store.state.chart.viewId);
|
||||
@ -248,6 +253,11 @@ export default {
|
||||
ele.summary = 'sum'
|
||||
}
|
||||
})
|
||||
if (view.type.startsWith('pie') || view.type.startsWith('funnel')) {
|
||||
if (view.yaxis.length > 1) {
|
||||
view.yaxis.splice(1, view.yaxis.length)
|
||||
}
|
||||
}
|
||||
view.xaxis = JSON.stringify(view.xaxis)
|
||||
view.yaxis = JSON.stringify(view.yaxis)
|
||||
view.customAttr = JSON.stringify(view.customAttr)
|
||||
@ -264,7 +274,7 @@ export default {
|
||||
getData(id) {
|
||||
if (id) {
|
||||
post('/chart/view/getData/' + id, null).then(response => {
|
||||
this.view = response.data
|
||||
this.view = JSON.parse(JSON.stringify(response.data))
|
||||
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
|
||||
this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : []
|
||||
this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}
|
||||
@ -369,12 +379,17 @@ export default {
|
||||
onColorChange(val) {
|
||||
this.view.customAttr.color = val
|
||||
this.save()
|
||||
},
|
||||
|
||||
onSizeChange(val) {
|
||||
this.view.customAttr.size = val
|
||||
this.save()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
.padding-lr {
|
||||
padding: 0 6px;
|
||||
}
|
||||
@ -445,7 +460,31 @@ export default {
|
||||
height: calc(100% - 6px);
|
||||
}
|
||||
|
||||
.chart-type{
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.chart-icon{
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.chart-type>>>.el-radio__input{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-radio{
|
||||
margin:6px;
|
||||
}
|
||||
|
||||
.el-radio>>>.el-radio__label{
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.attr-selector{
|
||||
margin: 2px 0;
|
||||
}
|
||||
</style>
|
||||
|
@ -79,12 +79,11 @@
|
||||
<el-select v-model="taskForm.type" size="mini">
|
||||
<el-option
|
||||
:label="$t('dataset.all_scope')"
|
||||
value="0"
|
||||
value="all_scope"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('dataset.add_scope')"
|
||||
value="1"
|
||||
:disabled="true"
|
||||
value="add_scope"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -97,22 +96,22 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('dataset.execute_rate')" prop="rate">
|
||||
<el-select v-model="taskForm.rate" size="mini" @change="onRateChange">
|
||||
<el-select v-model="taskForm.rate" @change="onRateChange">
|
||||
<el-option
|
||||
:label="$t('dataset.execute_once')"
|
||||
value="0"
|
||||
value="SIMPLE"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('dataset.cron_config')"
|
||||
value="1"
|
||||
value="CRON"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="taskForm.rate === '1'" label="">
|
||||
<el-form-item v-if="taskForm.rate === 'CRON'" label="">
|
||||
<el-input v-model="taskForm.cron" size="mini" style="width: 50%" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('dataset.end_time')" prop="end">
|
||||
<el-select v-model="taskForm.end" size="mini" :disabled="taskForm.rate === '0'">
|
||||
<el-select v-model="taskForm.end" size="mini">
|
||||
<el-option
|
||||
:label="$t('dataset.no_limit')"
|
||||
value="0"
|
||||
@ -163,8 +162,9 @@
|
||||
:label="$t('dataset.execute_rate')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.rate === '0'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === '1'">{{ $t('dataset.cron_config') }}</span>
|
||||
<span v-if="scope.row.rate === 'SIMPLE'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === 'SIMPLE_COMPLETE'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === 'CRON'">{{ $t('dataset.cron_config') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -176,6 +176,7 @@
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
circle
|
||||
:disabled="scope.row.rate === 'SIMPLE_COMPLETE'"
|
||||
@click="addTask(scope.row)"
|
||||
/>
|
||||
<el-button
|
||||
@ -190,10 +191,49 @@
|
||||
</el-table>
|
||||
</el-row>
|
||||
|
||||
<el-divider />
|
||||
|
||||
<el-row style="height: 26px;">
|
||||
<el-row>
|
||||
<el-col :span="6"><div>{{ $t('dataset.incremental_update_type') }}</div></el-col>
|
||||
<el-col :span="18">
|
||||
<el-radio-group v-model="incrementalUpdateType" size="small" @change="incrementalUpdateTypeChange">
|
||||
<el-radio label="incrementalAdd" >{{ $t('dataset.incremental_add') }}</el-radio>
|
||||
<el-radio label="incrementalDelete" >{{ $t('incremental_delete.incremental_update_type') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
||||
<el-row style="height: 26px;">
|
||||
<el-row>
|
||||
<el-col :span="6" style="height: 26px;"><div style="height: 26px;">参数:</div></el-col>
|
||||
<el-col :span="18">
|
||||
<el-button type="text">{{ $t('dataset.last_update_time') }}</el-button>
|
||||
<el-button type="text">{{ $t('dataset.current_update_time') }}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col style="min-width: 200px;">
|
||||
<codemirror
|
||||
ref="myCm"
|
||||
v-model="sql"
|
||||
class="codemirror"
|
||||
:options="sqlOption"
|
||||
@ready="onCmReady"
|
||||
@focus="onCmFocus"
|
||||
@input="onCmCodeChange"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<!-- <el-button size="mini" @click="update_setting = false">{{ $t('dataset.cancel') }}</el-button>-->
|
||||
<!-- <el-button type="primary" size="mini" @click="update_setting = false">{{ $t('dataset.confirm') }}</el-button>-->
|
||||
<el-button size="mini" @click="update_setting = false">{{ $t('dataset.close') }}</el-button>
|
||||
<el-button size="mini" @click="saveIncrementalConfig">{{ $t('dataset.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
@ -201,9 +241,33 @@
|
||||
|
||||
<script>
|
||||
import { post } from '@/api/dataset/dataset'
|
||||
import { codemirror } from 'vue-codemirror'
|
||||
// 核心样式
|
||||
import 'codemirror/lib/codemirror.css'
|
||||
// 引入主题后还需要在 options 中指定主题才会生效
|
||||
import 'codemirror/theme/solarized.css'
|
||||
import 'codemirror/mode/sql/sql.js'
|
||||
// require active-line.js
|
||||
import 'codemirror/addon/selection/active-line.js'
|
||||
// closebrackets
|
||||
import 'codemirror/addon/edit/closebrackets.js'
|
||||
// keyMap
|
||||
import 'codemirror/mode/clike/clike.js'
|
||||
import 'codemirror/addon/edit/matchbrackets.js'
|
||||
import 'codemirror/addon/comment/comment.js'
|
||||
import 'codemirror/addon/dialog/dialog.js'
|
||||
import 'codemirror/addon/dialog/dialog.css'
|
||||
import 'codemirror/addon/search/searchcursor.js'
|
||||
import 'codemirror/addon/search/search.js'
|
||||
import 'codemirror/keymap/emacs.js'
|
||||
// 引入代码自动提示插件
|
||||
import 'codemirror/addon/hint/show-hint.css'
|
||||
import 'codemirror/addon/hint/sql-hint'
|
||||
import 'codemirror/addon/hint/show-hint'
|
||||
|
||||
export default {
|
||||
name: 'UpdateInfo',
|
||||
components: { codemirror },
|
||||
props: {
|
||||
table: {
|
||||
type: Object,
|
||||
@ -216,9 +280,9 @@ export default {
|
||||
update_task: false,
|
||||
taskForm: {
|
||||
name: '',
|
||||
type: '0',
|
||||
type: 'all_scope',
|
||||
startTime: '',
|
||||
rate: '0',
|
||||
rate: 'SIMPLE',
|
||||
cron: '',
|
||||
endTime: '',
|
||||
end: '0'
|
||||
@ -246,7 +310,21 @@ export default {
|
||||
end: [
|
||||
{ required: true, message: this.$t('dataset.required'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
},
|
||||
sqlOption: {
|
||||
tabSize: 2,
|
||||
styleActiveLine: true,
|
||||
lineNumbers: true,
|
||||
line: true,
|
||||
mode: 'text/x-sql',
|
||||
theme: 'solarized',
|
||||
hintOptions: { // 自定义提示选项
|
||||
completeSingle: false // 当匹配只有一项的时候是否自动补全
|
||||
}
|
||||
},
|
||||
incrementalUpdateType: 'incrementalAdd',
|
||||
sql: '',
|
||||
incrementalConfig: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -255,10 +333,49 @@ export default {
|
||||
this.listTaskLog()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
codemirror() {
|
||||
return this.$refs.myCm.codemirror
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
this.height = window.innerHeight / 2
|
||||
})()
|
||||
}
|
||||
this.height = window.innerHeight / 2
|
||||
|
||||
},
|
||||
methods: {
|
||||
incrementalUpdateTypeChange: function (){
|
||||
|
||||
if(this.incrementalUpdateType === 'incrementalAdd'){
|
||||
if(this.sql){
|
||||
this.incrementalConfig.incrementalDelete = this.sql
|
||||
}
|
||||
if(this.incrementalConfig.incrementalAdd){
|
||||
this.sql = this.incrementalConfig.incrementalAdd
|
||||
}else {
|
||||
this.sql = ''
|
||||
}
|
||||
}
|
||||
|
||||
if(this.incrementalUpdateType === 'incrementalDelete'){
|
||||
if(this.sql){
|
||||
this.incrementalConfig.incrementalAdd = this.sql
|
||||
}
|
||||
if(this.incrementalConfig.incrementalDelete){
|
||||
this.sql = this.incrementalConfig.incrementalDelete
|
||||
}else {
|
||||
this.sql = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
showConfig() {
|
||||
this.update_setting = true
|
||||
this.listTask()
|
||||
this.getIncrementalConfig()
|
||||
},
|
||||
addTask(task) {
|
||||
if (!task) {
|
||||
@ -275,6 +392,31 @@ export default {
|
||||
this.taskData = response.data
|
||||
})
|
||||
},
|
||||
getIncrementalConfig() {
|
||||
post('/dataset/table/incrementalConfig', { tableId: this.table.id }).then(response => {
|
||||
this.incrementalConfig = response.data
|
||||
this.incrementalUpdateType = 'incrementalAdd'
|
||||
if(this.incrementalConfig.incrementalAdd){
|
||||
this.sql = this.incrementalConfig.incrementalAdd
|
||||
}
|
||||
})
|
||||
},
|
||||
saveIncrementalConfig() {
|
||||
this.update_setting = false
|
||||
if(this.incrementalUpdateType === 'incrementalAdd'){
|
||||
this.incrementalConfig.incrementalAdd = this.sql
|
||||
}else {
|
||||
this.incrementalConfig.incrementalDelete = this.sql
|
||||
}
|
||||
this.incrementalConfig.tableId = this.table.id
|
||||
post('/dataset/table/save/incrementalConfig', this.incrementalConfig).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('dataset.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
},
|
||||
saveTask(task) {
|
||||
task.startTime = new Date(task.startTime).getTime()
|
||||
task.endTime = new Date(task.endTime).getTime()
|
||||
@ -289,18 +431,6 @@ export default {
|
||||
this.resetTaskForm()
|
||||
this.listTask()
|
||||
})
|
||||
// this.$refs['taskForm'].validate((valid) => {
|
||||
// if (valid) {
|
||||
//
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: this.$t('dataset.input_content'),
|
||||
// type: 'error',
|
||||
// showClose: true
|
||||
// })
|
||||
// return false
|
||||
// }
|
||||
// })
|
||||
},
|
||||
deleteTask(task) {
|
||||
this.$confirm(this.$t('dataset.confirm_delete'), this.$t('dataset.tips'), {
|
||||
@ -325,7 +455,7 @@ export default {
|
||||
this.resetTaskForm()
|
||||
},
|
||||
onRateChange() {
|
||||
if (this.taskForm.rate === '0') {
|
||||
if (this.taskForm.rate === 'SIMPLE') {
|
||||
this.taskForm.end = '0'
|
||||
this.taskForm.endTime = ''
|
||||
this.taskForm.cron = ''
|
||||
@ -346,13 +476,25 @@ export default {
|
||||
resetTaskForm() {
|
||||
this.taskForm = {
|
||||
name: '',
|
||||
type: '0',
|
||||
type: 'all_scope',
|
||||
startTime: '',
|
||||
rate: '0',
|
||||
rate: 'SIMPLE',
|
||||
endTime: '',
|
||||
end: '0'
|
||||
}
|
||||
},
|
||||
onCmReady(cm) {
|
||||
this.codemirror.setSize('-webkit-fill-available', 'auto')
|
||||
},
|
||||
onCmFocus(cm) {
|
||||
// console.log('the editor is focus!', cm)
|
||||
},
|
||||
onCmCodeChange(newCode) {
|
||||
console.log(newCode)
|
||||
this.sql = newCode
|
||||
this.$emit('codeChange', this.sql)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -369,4 +511,13 @@ export default {
|
||||
.el-form-item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.codemirror {
|
||||
height: 160px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.codemirror >>> .CodeMirror-scroll {
|
||||
height: 160px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
235
frontend/src/views/panel/GrantAuth/dept/index.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<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="所有组织" 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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDeptTree, loadTable } from '@/api/system/dept'
|
||||
import { saveShare, loadShares } from '@/api/panel/share'
|
||||
export default {
|
||||
name: 'GrantDept',
|
||||
props: {
|
||||
resourceId: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
keyWord: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
defaultCondition: {
|
||||
field: 'pid',
|
||||
operator: 'eq',
|
||||
value: 0
|
||||
},
|
||||
type: 2, // 类型2代表组织
|
||||
shares: [],
|
||||
changeIndex: 0,
|
||||
timeMachine: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
keyWord(v, o) {
|
||||
this.destryTimeMachine()
|
||||
this.changeIndex++
|
||||
this.searchWithKey(this.changeIndex)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
// 根据关键字搜索
|
||||
// 1500ms内 key不发生变化则执行查询
|
||||
searchWithKey(index) {
|
||||
this.timeMachine = setTimeout(() => {
|
||||
if (index === this.changeIndex) {
|
||||
const condition = {
|
||||
field: 'name',
|
||||
operator: 'like',
|
||||
value: this.keyWord
|
||||
}
|
||||
this.search(condition)
|
||||
console.log('start execute search')
|
||||
}
|
||||
this.destryTimeMachine()
|
||||
}, 1500)
|
||||
},
|
||||
destryTimeMachine() {
|
||||
this.timeMachine && clearTimeout(this.timeMachine)
|
||||
this.timeMachine = null
|
||||
},
|
||||
// 加载下一级子节点数据
|
||||
loadExpandDatas(row, treeNode, resolve) {
|
||||
getDeptTree(row.deptId).then(res => {
|
||||
let data = res.data
|
||||
data = data.map(obj => {
|
||||
if (obj.subCount > 0) {
|
||||
obj.hasChildren = true
|
||||
}
|
||||
return obj
|
||||
})
|
||||
// this.maps.set(row.deptId, { row, treeNode, resolve })
|
||||
resolve && resolve(data)
|
||||
this.$nextTick(() => {
|
||||
this.setCheckExpandNodes(data)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 加载表格数据
|
||||
search(condition) {
|
||||
// this.setTableAttr()
|
||||
|
||||
this.data = []
|
||||
let param = {}
|
||||
if (condition && condition.value) {
|
||||
param = { conditions: [condition] }
|
||||
} else {
|
||||
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.data = this.buildTree(data)
|
||||
this.$nextTick(() => {
|
||||
data.forEach(node => {
|
||||
this.$refs.table.toggleRowExpansion(node, true)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.data = data
|
||||
}
|
||||
|
||||
this.queryShareNodeIds()
|
||||
})
|
||||
},
|
||||
|
||||
buildTree(arrs) {
|
||||
const idMapping = arrs.reduce((acc, el, i) => {
|
||||
acc[el.deptId] = i
|
||||
return acc
|
||||
}, {})
|
||||
const roots = []
|
||||
arrs.forEach(el => {
|
||||
// 判断根节点
|
||||
if (el.pid === null || el.pid === 0) {
|
||||
roots.push(el)
|
||||
return
|
||||
}
|
||||
// 用映射表找到父元素
|
||||
const parentEl = arrs[idMapping[el.pid]]
|
||||
// 把当前元素添加到父元素的`children`数组中
|
||||
parentEl.children = [...(parentEl.children || []), el]
|
||||
})
|
||||
return roots
|
||||
},
|
||||
|
||||
save() {
|
||||
const rows = this.$refs.table.store.states.selection
|
||||
const request = this.buildRequest(rows)
|
||||
saveShare(request).then(res => {
|
||||
this.$success('保存成功')
|
||||
return true
|
||||
}).catch(err => {
|
||||
this.$error(err.message)
|
||||
return false
|
||||
})
|
||||
console.log('dept save')
|
||||
},
|
||||
cancel() {
|
||||
console.log('dept cancel')
|
||||
},
|
||||
|
||||
buildRequest(rows) {
|
||||
const targetIds = rows.map(row => row.deptId)
|
||||
const panelIds = [this.resourceId]
|
||||
return {
|
||||
targetIds: targetIds,
|
||||
panelIds: panelIds,
|
||||
type: this.type
|
||||
}
|
||||
},
|
||||
|
||||
queryShareNodeIds(callBack) {
|
||||
const conditionResourceId = { field: 'panel_group_id', operator: 'eq', value: this.resourceId }
|
||||
const conditionType = { field: 'type', operator: 'eq', value: this.type }
|
||||
const param = { conditions: [conditionResourceId, conditionType] }
|
||||
loadShares(param).then(res => {
|
||||
const shares = res.data
|
||||
const nodeIds = shares.map(share => share.targetId)
|
||||
this.shares = nodeIds
|
||||
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)
|
||||
})
|
||||
},
|
||||
setCheckExpandNodes(rows) {
|
||||
rows.forEach(node => {
|
||||
const nodeId = node.deptId
|
||||
this.shares.includes(nodeId) && this.$refs.table.toggleRowSelection(node, true)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.my_table >>> .el-table__row>td{
|
||||
/* 去除表格线 */
|
||||
border: none;
|
||||
padding: 0 0;
|
||||
}
|
||||
.my_table >>> .el-table th.is-leaf {
|
||||
/* 去除上边框 */
|
||||
border: none;
|
||||
}
|
||||
.my_table >>> .el-table::before{
|
||||
/* 去除下边框 */
|
||||
height: 0;
|
||||
}
|
||||
</style>
|
101
frontend/src/views/panel/GrantAuth/index.vue
Normal file
@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button v-show="!showSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showSearchWidget" />
|
||||
<div v-show="showSearchInput" class="de-input">
|
||||
<el-input v-model="key">
|
||||
<el-button slot="append" icon="el-icon-close" @click="closeSearchWidget" />
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activeName" :class="{'de-search-header': showSearchInput}" @tab-click="handleClick">
|
||||
<el-tab-pane :lazy="true" class="de-tab" label="部门" :name="tabNames[0]"><grant-dept :ref="tabNames[0]" :resource-id="resourceId" :key-word="key" /></el-tab-pane>
|
||||
<el-tab-pane :lazy="true" class="de-tab" label="角色" :name="tabNames[1]"><grant-role :ref="tabNames[1]" :resource-id="resourceId" :key-word="key" /></el-tab-pane>
|
||||
<el-tab-pane :lazy="true" class="de-tab" label="用户" :name="tabNames[2]"><grant-user :ref="tabNames[2]" :resource-id="resourceId" :key-word="key" /></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="auth-root-class">
|
||||
<span slot="footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GrantDept from './dept'
|
||||
import GrantRole from './role'
|
||||
import GrantUser from './user'
|
||||
export default {
|
||||
name: 'GrantAuth',
|
||||
components: { GrantDept, GrantRole, GrantUser },
|
||||
props: {
|
||||
resourceId: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabNames: ['grantDept', 'grantRole', 'grantUser'],
|
||||
activeName: null,
|
||||
showSearchInput: false,
|
||||
key: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.activeName = this.tabNames[0]
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event)
|
||||
},
|
||||
showSearchWidget() {
|
||||
this.showSearchInput = true
|
||||
},
|
||||
closeSearchWidget() {
|
||||
this.key = ''
|
||||
this.showSearchInput = false
|
||||
},
|
||||
save() {
|
||||
this.$refs[this.activeName].save()
|
||||
this.$emit('close-grant', 0)
|
||||
},
|
||||
cancel() {
|
||||
this.$refs[this.activeName].cancel()
|
||||
this.$emit('close-grant', 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.de-tab {
|
||||
border:1px solid #E6E6E6;
|
||||
min-height:200px !important;
|
||||
max-height:300px !important;
|
||||
overflow:auto;
|
||||
}
|
||||
.de-icon {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 50px;
|
||||
z-index: 99;
|
||||
}
|
||||
.el-input-group__append{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.el-input__inner{
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.auth-root-class {
|
||||
margin: 15px 0px 5px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
// ::-webkit-scrollbar {
|
||||
|
||||
// }
|
||||
</style>
|
144
frontend/src/views/panel/GrantAuth/role/index.vue
Normal file
@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div class="my_table">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="data.filter(node => !keyWord || node[fieldName].toLowerCase().includes(keyWord.toLowerCase()))"
|
||||
:show-header="true"
|
||||
style="width: 100%"
|
||||
:row-style="{height: '35px'}"
|
||||
@filter-change="filterChange"
|
||||
>
|
||||
<el-table-column :column-key="fieldName" :label="columnLabel" :prop="fieldName" filter-placement="right-start" :filters="filter_options" :filter-multiple="false" :filter-method="filterHandler" />
|
||||
<el-table-column type="selection" fixd />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { roleGrid } from '@/api/system/role'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { saveShare, loadShares } from '@/api/panel/share'
|
||||
export default {
|
||||
name: 'GrantRole',
|
||||
props: {
|
||||
resourceId: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
keyWord: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
defaultHeadName: '全部',
|
||||
columnLabel: null,
|
||||
filter_options: [{ text: '未分享角色', value: 0 }, { text: '已分享角色', value: 1 }],
|
||||
fieldName: 'name',
|
||||
type: 1, // 类型1代表角色
|
||||
shares: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initColumnLabel()
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
initColumnLabel() {
|
||||
this.columnLabel = this.defaultHeadName
|
||||
},
|
||||
|
||||
search(condition) {
|
||||
const temp = formatCondition(condition)
|
||||
const param = temp || {}
|
||||
roleGrid(1, 0, param).then(response => {
|
||||
const data = response.data
|
||||
// this.total = data.itemCount
|
||||
this.data = data.listObject
|
||||
this.queryShareNodeIds()
|
||||
})
|
||||
},
|
||||
filterHandler(value, row, column) {
|
||||
// const property = column['property']
|
||||
// return row[property] === value
|
||||
const roleId = row['roleId']
|
||||
return !(value ^ this.shares.includes(roleId))
|
||||
},
|
||||
|
||||
filterChange(obj) {
|
||||
const arr = obj[this.fieldName]
|
||||
if (arr.length === 0) {
|
||||
this.initColumnLabel()
|
||||
return
|
||||
}
|
||||
this.columnLabel = this.filter_options[arr[0]].text
|
||||
},
|
||||
save() {
|
||||
const rows = this.$refs.table.store.states.selection
|
||||
const request = this.buildRequest(rows)
|
||||
saveShare(request).then(res => {
|
||||
this.$success('保存成功')
|
||||
return true
|
||||
}).catch(err => {
|
||||
this.$error(err.message)
|
||||
return false
|
||||
})
|
||||
},
|
||||
|
||||
cancel() {
|
||||
console.log('role cancel')
|
||||
},
|
||||
buildRequest(rows) {
|
||||
const targetIds = rows.map(row => row.roleId)
|
||||
const panelIds = [this.resourceId]
|
||||
return {
|
||||
targetIds: targetIds,
|
||||
panelIds: panelIds,
|
||||
type: this.type
|
||||
}
|
||||
},
|
||||
|
||||
queryShareNodeIds(callBack) {
|
||||
const conditionResourceId = { field: 'panel_group_id', operator: 'eq', value: this.resourceId }
|
||||
const conditionType = { field: 'type', operator: 'eq', value: this.type }
|
||||
const param = { conditions: [conditionResourceId, conditionType] }
|
||||
loadShares(param).then(res => {
|
||||
const shares = res.data
|
||||
const nodeIds = shares.map(share => share.targetId)
|
||||
this.shares = nodeIds
|
||||
this.$nextTick(() => {
|
||||
this.setCheckNodes()
|
||||
})
|
||||
callBack && callBack()
|
||||
})
|
||||
},
|
||||
|
||||
setCheckNodes() {
|
||||
this.data.forEach(node => {
|
||||
const nodeId = node.roleId
|
||||
this.shares.includes(nodeId) && this.$refs.table.toggleRowSelection(node, true)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.my_table >>> .el-table__row>td{
|
||||
/* 去除表格线 */
|
||||
border: none;
|
||||
padding: 0 0;
|
||||
}
|
||||
.my_table >>> .el-table th.is-leaf {
|
||||
/* 去除上边框 */
|
||||
border: none;
|
||||
}
|
||||
.my_table >>> .el-table::before{
|
||||
/* 去除下边框 */
|
||||
height: 0;
|
||||
}
|
||||
</style>
|
48
frontend/src/views/panel/GrantAuth/shareTree.vue
Normal file
@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<el-tree :data="datas" :props="defaultProps" @node-click="handleNodeClick">
|
||||
<span slot-scope="{ data }" class="custom-tree-node">
|
||||
<span>
|
||||
<span v-if="!!data.id">
|
||||
<el-button
|
||||
icon="el-icon-picture-outline"
|
||||
type="text"
|
||||
/>
|
||||
</span>
|
||||
<span style="margin-left: 6px">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loadTree } from '@/api/panel/share'
|
||||
export default {
|
||||
name: 'ShareTree',
|
||||
data() {
|
||||
return {
|
||||
datas: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData()
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
const param = {}
|
||||
loadTree(param).then(res => {
|
||||
this.datas = res.data
|
||||
})
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
console.log(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
144
frontend/src/views/panel/GrantAuth/user/index.vue
Normal file
@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div class="my_table">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="data.filter(node => !keyWord || node[fieldName].toLowerCase().includes(keyWord.toLowerCase()))"
|
||||
:show-header="true"
|
||||
style="width: 100%"
|
||||
:row-style="{height: '35px'}"
|
||||
@filter-change="filterChange"
|
||||
>
|
||||
<el-table-column :column-key="fieldName" :label="columnLabel" :prop="fieldName" filter-placement="right-start" :filters="filter_options" :filter-multiple="false" :filter-method="filterHandler" />
|
||||
<el-table-column type="selection" fixd />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userLists } from '@/api/system/user'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { saveShare, loadShares } from '@/api/panel/share'
|
||||
export default {
|
||||
name: 'GrantUser',
|
||||
props: {
|
||||
resourceId: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
keyWord: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
defaultHeadName: '全部',
|
||||
columnLabel: null,
|
||||
filter_options: [{ text: '未分享人员', value: 0 }, { text: '已分享人员', value: 1 }],
|
||||
fieldName: 'nickName',
|
||||
type: 0, // 类型0代表用户
|
||||
shares: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initColumnLabel()
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
initColumnLabel() {
|
||||
this.columnLabel = this.defaultHeadName
|
||||
},
|
||||
search(condition) {
|
||||
const temp = formatCondition(condition)
|
||||
const param = temp || {}
|
||||
userLists(1, 0, param).then(response => {
|
||||
const data = response.data
|
||||
// this.total = data.itemCount
|
||||
this.data = data.listObject
|
||||
this.queryShareNodeIds()
|
||||
})
|
||||
},
|
||||
filterHandler(value, row, column) {
|
||||
// const property = column['property']
|
||||
// return row[property] === value
|
||||
const userId = row['userId']
|
||||
return !(value ^ this.shares.includes(userId))
|
||||
},
|
||||
|
||||
filterChange(obj) {
|
||||
const arr = obj[this.fieldName]
|
||||
if (arr.length === 0) {
|
||||
this.initColumnLabel()
|
||||
return
|
||||
}
|
||||
this.columnLabel = this.filter_options[arr[0]].text
|
||||
},
|
||||
|
||||
save() {
|
||||
const rows = this.$refs.table.store.states.selection
|
||||
const request = this.buildRequest(rows)
|
||||
saveShare(request).then(res => {
|
||||
this.$success('保存成功')
|
||||
return true
|
||||
}).catch(err => {
|
||||
this.$error(err.message)
|
||||
return false
|
||||
})
|
||||
},
|
||||
|
||||
cancel() {
|
||||
console.log('user cancel')
|
||||
},
|
||||
buildRequest(rows) {
|
||||
const targetIds = rows.map(row => row.userId)
|
||||
const panelIds = [this.resourceId]
|
||||
return {
|
||||
targetIds: targetIds,
|
||||
panelIds: panelIds,
|
||||
type: this.type
|
||||
}
|
||||
},
|
||||
|
||||
queryShareNodeIds(callBack) {
|
||||
const conditionResourceId = { field: 'panel_group_id', operator: 'eq', value: this.resourceId }
|
||||
const conditionType = { field: 'type', operator: 'eq', value: this.type }
|
||||
const param = { conditions: [conditionResourceId, conditionType] }
|
||||
loadShares(param).then(res => {
|
||||
const shares = res.data
|
||||
const nodeIds = shares.map(share => share.targetId)
|
||||
this.shares = nodeIds
|
||||
this.$nextTick(() => {
|
||||
this.setCheckNodes()
|
||||
})
|
||||
callBack && callBack()
|
||||
})
|
||||
},
|
||||
|
||||
setCheckNodes() {
|
||||
this.data.forEach(node => {
|
||||
const nodeId = node.userId
|
||||
this.shares.includes(nodeId) && this.$refs.table.toggleRowSelection(node, true)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.my_table >>> .el-table__row>td{
|
||||
/* 去除表格线 */
|
||||
border: none;
|
||||
padding: 0 0;
|
||||
}
|
||||
.my_table >>> .el-table th.is-leaf {
|
||||
/* 去除上边框 */
|
||||
border: none;
|
||||
}
|
||||
.my_table >>> .el-table::before{
|
||||
/* 去除下边框 */
|
||||
height: 0;
|
||||
}
|
||||
</style>
|
@ -11,9 +11,9 @@
|
||||
<span slot="label"><i class="el-icon-star-off" />收藏</span>
|
||||
开发中...
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="panels_share">
|
||||
<el-tab-pane name="panels_share" :lazy="true">
|
||||
<span slot="label"><i class="el-icon-share" />分享</span>
|
||||
开发中...
|
||||
<share-tree v-if="showShare" />
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane name="example">-->
|
||||
<!-- <span slot="label"><i class="el-icon-star-on"></i>示例</span>-->
|
||||
@ -38,20 +38,25 @@ import DeAsideContainer from '@/components/dataease/DeAsideContainer'
|
||||
import PanelList from './list/PanelList'
|
||||
import PanelView from './list/PanelView'
|
||||
import PanelViewShow from './list/PanelViewShow'
|
||||
import ShareTree from './GrantAuth/shareTree'
|
||||
|
||||
export default {
|
||||
name: 'Panel',
|
||||
components: { DeMainContainer, DeContainer, DeAsideContainer, PanelList, PanelView, PanelViewShow },
|
||||
components: { DeMainContainer, DeContainer, DeAsideContainer, PanelList, PanelView, PanelViewShow, ShareTree },
|
||||
data() {
|
||||
return {
|
||||
component: PanelViewShow,
|
||||
param: {},
|
||||
activeName: 'PanelList'
|
||||
activeName: 'PanelList',
|
||||
showShare: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event)
|
||||
// 点击分析面板需要刷新分享内容
|
||||
if (tab.name === 'panels_share') {
|
||||
this.refreshShare()
|
||||
}
|
||||
},
|
||||
switchComponent(c) {
|
||||
console.log(c)
|
||||
@ -61,6 +66,10 @@ export default {
|
||||
this.component = PanelViewShow
|
||||
break
|
||||
}
|
||||
},
|
||||
refreshShare() {
|
||||
this.showShare = false
|
||||
this.$nextTick(() => (this.showShare = true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,30 +111,31 @@
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
:title="$t('panel.share')"
|
||||
:title="authTitle"
|
||||
:visible.sync="authVisible"
|
||||
:show-close="false"
|
||||
top="10vh"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
custom-class="de-dialog"
|
||||
>
|
||||
<span>分享授权</span>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<grant-auth v-if="authVisible" :resource-id="authResourceId" @close-grant="closeGrant" />
|
||||
<!-- <span slot="footer" class="dialog-footer">
|
||||
<el-button @click="authVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="authVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</span> -->
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GrantAuth from '../GrantAuth'
|
||||
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, defaultTree } from '@/api/panel/panel'
|
||||
|
||||
export default {
|
||||
name: 'PanelList',
|
||||
components: { GrantAuth },
|
||||
data() {
|
||||
return {
|
||||
authTitle: null,
|
||||
authResourceId: null,
|
||||
authVisible: false,
|
||||
defaultData: [],
|
||||
dialogTitle: '',
|
||||
@ -479,11 +480,13 @@ export default {
|
||||
this.$emit('switchComponent', { name: 'PanelView' })
|
||||
},
|
||||
share(data) {
|
||||
console.log(data)
|
||||
this.authResourceId = data.id
|
||||
this.authTitle = '把[' + data.label + ']分享给'
|
||||
this.authVisible = true
|
||||
},
|
||||
handleClose(done) {
|
||||
this.handleClose = false
|
||||
closeGrant() {
|
||||
this.authResourceId = null
|
||||
this.authVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -534,4 +537,5 @@ export default {
|
||||
.title-text {
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<el-tabs v-model="ViewActiveName">
|
||||
<!--视图展示操作-->
|
||||
<el-tab-pane name="Views" class="view-list-thumbnails-outline">
|
||||
<span slot="label"><i class="el-icon-s-data"/>视图</span>
|
||||
<span slot="label"><i class="el-icon-s-data" />视图</span>
|
||||
<draggable
|
||||
v-model="panelDetails.viewsUsable"
|
||||
:options="{group:{name: 'itxst',pull:'clone'},sort: true}"
|
||||
|
@ -11,7 +11,7 @@
|
||||
@search="search"
|
||||
>
|
||||
<template #buttons>
|
||||
<fu-table-button icon="el-icon-circle-plus-outline" :label="$t('datasource.create')" @click="create" />
|
||||
<fu-table-button v-permission="['datasource:add']" icon="el-icon-circle-plus-outline" :label="$t('datasource.create')" @click="create" />
|
||||
</template>
|
||||
|
||||
<!-- <el-table-column type="selection" fix /> -->
|
||||
@ -62,7 +62,7 @@
|
||||
<el-form-item v-show="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.data_base')" prop="configuration.dataBase" :rules="{required: true, message: $t('datasource.please_input_data_base'), trigger: 'blur'}">
|
||||
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.user_name')" prop="configuration.username">
|
||||
<el-form-item v-show="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.user_name')" prop="configuration.username" :rules="{required: true, message: $t('datasource.please_input_user_name'), trigger: 'blur'}">
|
||||
<el-input v-model="form.configuration.username" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.password')" prop="configuration.password" :rules="{required: true, message: $t('datasource.please_input_password'), trigger: 'change'}">
|
||||
@ -79,7 +79,8 @@
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="dialogVisible = false">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="saveDatasource('createDatasource')">确认</el-button>
|
||||
<el-button type="primary" @click="validaDatasource('createDatasource')">{{ $t('commons.validate') }}</el-button>
|
||||
<el-button type="primary" @click="saveDatasource('createDatasource')">{{ $t('commons.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@ -198,13 +199,12 @@ export default {
|
||||
this.$success(this.$t('commons.save_success'))
|
||||
this.search()
|
||||
this.dialogVisible = false
|
||||
})
|
||||
});
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
validaDatasource(datasourceForm) {
|
||||
this.$refs[datasourceForm].validate(valid => {
|
||||
if (valid) {
|
||||
@ -230,7 +230,6 @@ export default {
|
||||
const result = {}
|
||||
if (condition && condition.quick) {
|
||||
for (const [key, value] of Object.entries(condition)) {
|
||||
// console.log(`${key}`)
|
||||
if (`${key}` === 'quick') {
|
||||
const v_new = Object.assign({}, value)
|
||||
v_new['field'] = 'name'
|
||||
|