refactor: 解决冲突

This commit is contained in:
taojinlong 2022-02-18 18:03:21 +08:00
commit 7fdbe4082a
163 changed files with 7160 additions and 1653 deletions

View File

@ -1,13 +1,9 @@
FROM registry.cn-qingdao.aliyuncs.com/dataease/fabric8-java-alpine-openjdk8-jre:edge
RUN echo -e 'http://mirrors.aliyun.com/alpine/edge/main/\nhttp://mirrors.aliyun.com/alpine/edge/community/' > /etc/apk/repositories
RUN echo -e 'https://dl-cdn.alpinelinux.org/alpine/edge/main/\nhttps://dl-cdn.alpinelinux.org/alpine/edge/community/' > /etc/apk/repositories
RUN apk add chromium chromium-chromedriver fontconfig --no-cache --allow-untrusted
RUN mkdir -p /usr/local/sbin/ \
&& cp /usr/bin/chromedriver /usr/local/sbin/ \
&& chmod a+x /usr/local/sbin/chromedriver
ADD simsun.ttc /usr/share/fonts/
RUN cd /usr/share/fonts/ \

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>dataease-server</artifactId>
<groupId>io.dataease</groupId>
<version>1.7.0</version>
<version>1.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -214,7 +214,12 @@
<dependency>
<groupId>io.dataease</groupId>
<artifactId>dataease-plugin-interface</artifactId>
<version>1.7</version>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>io.dataease</groupId>
<artifactId>dataease-plugin-view</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
@ -408,48 +413,74 @@
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<?m2e execute onConfiguration?>
<id>main-class-placement</id>
<phase>generate-resources</phase>
<configuration>
<target>
<move todir="src/main/resources/static">
<fileset dir="../frontend/dist">
<exclude name="*.html"/>
</fileset>
</move>
<move todir="src/main/resources/templates">
<fileset dir="../frontend/dist">
<include name="*.html"/>
</fileset>
</move>
<copy todir="src/main/resources/static/de-app">
<fileset dir="../mobile/dist">
<exclude name="*.html"/>
</fileset>
</copy>
<copy file="../mobile/dist/index.html" tofile="src/main/resources/templates/app.html" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>whole</id>
<properties>
<profiles.active>whole</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<?m2e execute onConfiguration?>
<id>main-class-placement</id>
<phase>generate-resources</phase>
<configuration>
<target>
<move todir="src/main/resources/static">
<fileset dir="../frontend/dist">
<exclude name="*.html"/>
</fileset>
</move>
<move todir="src/main/resources/templates">
<fileset dir="../frontend/dist">
<include name="*.html"/>
</fileset>
</move>
<copy todir="src/main/resources/static/de-app">
<fileset dir="../mobile/dist">
<exclude name="*.html"/>
</fileset>
</copy>
<copy file="../mobile/dist/index.html" tofile="src/main/resources/templates/app.html" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>stage</id>
<properties>
<profiles.active>stage</profiles.active>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>pentaho-public</id>

View File

@ -0,0 +1,14 @@
package io.dataease.auth.annotation;
import io.dataease.commons.constants.DePermissionType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DeCleaner {
DePermissionType value();
}

View File

@ -0,0 +1,74 @@
package io.dataease.auth.aop;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.listener.util.CacheUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
@Aspect
@Component
public class DeCleanerAnnotationHandler {
@Around(value = "@annotation(io.dataease.auth.annotation.DeCleaner)")
public Object CleanerAround(ProceedingJoinPoint point) {
try {
CurrentUserDto user = AuthUtils.getUser();
MethodSignature ms = (MethodSignature) point.getSignature();
Method method = ms.getMethod();
DeCleaner deCleaner = method.getAnnotation(DeCleaner.class);
DePermissionType type = deCleaner.value();
switch (type.name()) {
case "DATASOURCE":
cleanDataSource();
break;
case "DATASET":
cleanDataSet();
break;
default:
cleanPanel();
break;
}
return point.proceed(point.getArgs());
}catch (Throwable e) {
LogUtil.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
public void cleanPanel() {
CurrentUserDto user = AuthUtils.getUser();
CacheUtils.remove(AuthConstants.USER_PANEL_NAME, "user" + user.getUserId());
CacheUtils.remove(AuthConstants.DEPT_PANEL_NAME, "dept" + user.getDeptId());
user.getRoles().forEach(role -> {
CacheUtils.remove(AuthConstants.ROLE_PANEL_NAME, "role" + role.getId());
});
}
public void cleanDataSet() {
CurrentUserDto user = AuthUtils.getUser();
CacheUtils.remove(AuthConstants.USER_DATASET_NAME, "user" + user.getUserId());
CacheUtils.remove(AuthConstants.DEPT_DATASET_NAME, "dept" + user.getDeptId());
user.getRoles().forEach(role -> {
CacheUtils.remove(AuthConstants.ROLE_DATASET_NAME, "role" + role.getId());
});
}
public void cleanDataSource() {
CurrentUserDto user = AuthUtils.getUser();
CacheUtils.remove(AuthConstants.USER_LINK_NAME, "user" + user.getUserId());
CacheUtils.remove(AuthConstants.DEPT_LINK_NAME, "dept" + user.getDeptId());
user.getRoles().forEach(role -> {
CacheUtils.remove(AuthConstants.ROLE_LINK_NAME, "role" + role.getId());
});
}
}

View File

@ -27,7 +27,11 @@ public class DePermissionAnnotationHandler {
@Around(value = "@annotation(io.dataease.auth.annotation.DePermissions)")
public Object PermissionsAround(ProceedingJoinPoint point) {
try {
if (AuthUtils.getUser().getIsAdmin()) {
return point.proceed(point.getArgs());
}
MethodSignature ms = (MethodSignature) point.getSignature();
Method method = ms.getMethod();
DePermissions annotation = method.getAnnotation(DePermissions.class);
@ -47,13 +51,13 @@ public class DePermissionAnnotationHandler {
Boolean someAccess = false;
for (int i = 0; i < dePermissions.length; i++) {
DePermission permission = dePermissions[i];
try{
try {
boolean currentAccess = access(args[permission.paramIndex()], permission, 0);
if (currentAccess) {
someAccess = true;
break;
}
}catch (Exception e) {
} catch (Exception e) {
exceptions.add(e);
}
}
@ -71,6 +75,9 @@ public class DePermissionAnnotationHandler {
@Around(value = "@annotation(io.dataease.auth.annotation.DePermission)")
public Object PermissionAround(ProceedingJoinPoint point) {
try {
if (AuthUtils.getUser().getIsAdmin()) {
return point.proceed(point.getArgs());
}
MethodSignature ms = (MethodSignature) point.getSignature();
Method method = ms.getMethod();
@ -88,20 +95,22 @@ public class DePermissionAnnotationHandler {
}
private Boolean access(Object arg, DePermission annotation, int layer) throws Exception {
if (ObjectUtils.isEmpty(arg)) return true;
if (ObjectUtils.isEmpty(arg))
return true;
String type = annotation.type().name().toLowerCase();
String value = annotation.value();
Integer requireLevel = annotation.level().getLevel();
Set<String> resourceIds = AuthUtils.permissionByType(type).stream().filter(
item -> item.getLevel() >= requireLevel
).map(AuthItem::getAuthSource).collect(Collectors.toSet());
item -> item.getLevel() >= requireLevel).map(AuthItem::getAuthSource).collect(Collectors.toSet());
Class<?> parameterType = arg.getClass();
if (parameterType.isPrimitive() || isWrapClass(parameterType) || isString(parameterType)) {
boolean permissionValid = resourceIds.contains(arg);
if (permissionValid) return true;
throw new UnauthorizedException("Subject does not have permission[" + annotation.level().name() +":"+ annotation.type() + ":" + arg + "]");
if (permissionValid)
return true;
throw new UnauthorizedException("Subject does not have permission[" + annotation.level().name() + ":"
+ annotation.type() + ":" + arg + "]");
} else if (isArray(parameterType)) {
for (int i = 0; i < Array.getLength(arg); i++) {
Object o = Array.get(arg, i);
@ -124,7 +133,7 @@ public class DePermissionAnnotationHandler {
Object o = argMap.get(values[layer]);
return access(o, annotation, ++layer);
} else {
//当作自定义类处理
// 当作自定义类处理
String[] values = value.split("u002E");
String fieldName = values[layer];
@ -135,7 +144,7 @@ public class DePermissionAnnotationHandler {
return true;
}
private Object getFieldValue(Object o, String fieldName) throws Exception{
private Object getFieldValue(Object o, String fieldName) throws Exception {
Class<?> aClass = o.getClass();
while (null != aClass.getSuperclass()) {
Field[] declaredFields = aClass.getDeclaredFields();
@ -183,5 +192,4 @@ public class DePermissionAnnotationHandler {
return Arrays.stream(wrapClasies).anyMatch(item -> StringUtils.equals(item, clz.getName()));
}
}

View File

@ -1,12 +1,15 @@
package io.dataease.auth.service.impl;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.entity.AuthItem;
import io.dataease.auth.service.ExtAuthService;
import io.dataease.base.domain.SysAuth;
import io.dataease.base.mapper.ext.ExtAuthMapper;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.listener.util.CacheUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@ -146,4 +149,7 @@ public class ExtAuthServiceImpl implements ExtAuthService {
public void clearRoleResource(Long roleId) {
LogUtil.info("all permission resource of role {} is cleanning...", roleId);
}
}

View File

@ -45,6 +45,7 @@ public class ShiroServiceImpl implements ShiroService {
// 获取主题信息
filterChainDefinitionMap.put("/plugin/theme/themes", ANON);
filterChainDefinitionMap.put("/plugin/theme/items/**", ANON);
filterChainDefinitionMap.put("/plugin/view/types", ANON);
// 验证链接
filterChainDefinitionMap.put("/api/link/validate**", ANON);

View File

@ -1,38 +1,39 @@
package io.dataease.base.domain;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ChartView implements Serializable {
@ApiModelProperty("ID")
private String id;
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("分组ID")
private String sceneId;
@ApiModelProperty("数据集ID")
private String tableId;
@ApiModelProperty("图表类型")
private String type;
@ApiModelProperty("chart渲染方式")
private String render;
@ApiModelProperty("展示结果")
private Integer resultCount;
@ApiModelProperty("展示模式")
private String resultMode;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("创建人")
private String sceneId;
private String tableId;
private String type;
private String render;
private Integer resultCount;
private String resultMode;
private String createBy;
@ApiModelProperty("创建时间")
private Long createTime;
@ApiModelProperty("更新时间")
private Long updateTime;
@ApiModelProperty("样式优先级")
private String stylePriority;
private String chartType;
private Boolean isPlugin;
private static final long serialVersionUID = 1L;
}

View File

@ -244,6 +244,76 @@ public class ChartViewExample {
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andSceneIdIsNull() {
addCriterion("scene_id is null");
return (Criteria) this;
@ -654,76 +724,6 @@ public class ChartViewExample {
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
return (Criteria) this;
@ -983,6 +983,136 @@ public class ChartViewExample {
addCriterion("style_priority not between", value1, value2, "stylePriority");
return (Criteria) this;
}
public Criteria andChartTypeIsNull() {
addCriterion("chart_type is null");
return (Criteria) this;
}
public Criteria andChartTypeIsNotNull() {
addCriterion("chart_type is not null");
return (Criteria) this;
}
public Criteria andChartTypeEqualTo(String value) {
addCriterion("chart_type =", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeNotEqualTo(String value) {
addCriterion("chart_type <>", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeGreaterThan(String value) {
addCriterion("chart_type >", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeGreaterThanOrEqualTo(String value) {
addCriterion("chart_type >=", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeLessThan(String value) {
addCriterion("chart_type <", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeLessThanOrEqualTo(String value) {
addCriterion("chart_type <=", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeLike(String value) {
addCriterion("chart_type like", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeNotLike(String value) {
addCriterion("chart_type not like", value, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeIn(List<String> values) {
addCriterion("chart_type in", values, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeNotIn(List<String> values) {
addCriterion("chart_type not in", values, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeBetween(String value1, String value2) {
addCriterion("chart_type between", value1, value2, "chartType");
return (Criteria) this;
}
public Criteria andChartTypeNotBetween(String value1, String value2) {
addCriterion("chart_type not between", value1, value2, "chartType");
return (Criteria) this;
}
public Criteria andIsPluginIsNull() {
addCriterion("is_plugin is null");
return (Criteria) this;
}
public Criteria andIsPluginIsNotNull() {
addCriterion("is_plugin is not null");
return (Criteria) this;
}
public Criteria andIsPluginEqualTo(Boolean value) {
addCriterion("is_plugin =", value, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginNotEqualTo(Boolean value) {
addCriterion("is_plugin <>", value, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginGreaterThan(Boolean value) {
addCriterion("is_plugin >", value, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_plugin >=", value, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginLessThan(Boolean value) {
addCriterion("is_plugin <", value, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginLessThanOrEqualTo(Boolean value) {
addCriterion("is_plugin <=", value, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginIn(List<Boolean> values) {
addCriterion("is_plugin in", values, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginNotIn(List<Boolean> values) {
addCriterion("is_plugin not in", values, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginBetween(Boolean value1, Boolean value2) {
addCriterion("is_plugin between", value1, value2, "isPlugin");
return (Criteria) this;
}
public Criteria andIsPluginNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_plugin not between", value1, value2, "isPlugin");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,6 @@
package io.dataease.base.domain;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ -11,25 +9,26 @@ import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ChartViewWithBLOBs extends ChartView implements Serializable {
@ApiModelProperty("x轴")
private String xAxis;
@ApiModelProperty("y轴")
private String xAxisExt;
private String yAxis;
@ApiModelProperty("副y轴")
private String yAxisExt;
@ApiModelProperty("堆叠")
private String extStack;
@ApiModelProperty("气泡")
private String extBubble;
@ApiModelProperty("图形属性")
private String customAttr;
@ApiModelProperty("组件样式")
private String customStyle;
@ApiModelProperty("过滤条件")
private String customFilter;
@ApiModelProperty("下钻字段")
private String drillFields;
@ApiModelProperty("快照")
private String snapshot;
private static final long serialVersionUID = 1L;

View File

@ -11,5 +11,7 @@ public class PanelLinkMapping implements Serializable {
private Long userId;
private String uuid;
private static final long serialVersionUID = 1L;
}

View File

@ -293,6 +293,76 @@ public class PanelLinkMappingExample {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUuidIsNull() {
addCriterion("uuid is null");
return (Criteria) this;
}
public Criteria andUuidIsNotNull() {
addCriterion("uuid is not null");
return (Criteria) this;
}
public Criteria andUuidEqualTo(String value) {
addCriterion("uuid =", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotEqualTo(String value) {
addCriterion("uuid <>", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidGreaterThan(String value) {
addCriterion("uuid >", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidGreaterThanOrEqualTo(String value) {
addCriterion("uuid >=", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLessThan(String value) {
addCriterion("uuid <", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLessThanOrEqualTo(String value) {
addCriterion("uuid <=", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLike(String value) {
addCriterion("uuid like", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotLike(String value) {
addCriterion("uuid not like", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidIn(List<String> values) {
addCriterion("uuid in", values, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotIn(List<String> values) {
addCriterion("uuid not in", values, "uuid");
return (Criteria) this;
}
public Criteria andUuidBetween(String value1, String value2) {
addCriterion("uuid between", value1, value2, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotBetween(String value1, String value2) {
addCriterion("uuid not between", value1, value2, "uuid");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -4,20 +4,23 @@
<resultMap id="BaseResultMap" type="io.dataease.base.domain.ChartView">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="scene_id" jdbcType="VARCHAR" property="sceneId" />
<result column="table_id" jdbcType="VARCHAR" property="tableId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="render" jdbcType="VARCHAR" property="render" />
<result column="result_count" jdbcType="INTEGER" property="resultCount" />
<result column="result_mode" jdbcType="VARCHAR" property="resultMode" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="style_priority" jdbcType="VARCHAR" property="stylePriority" />
<result column="chart_type" jdbcType="VARCHAR" property="chartType" />
<result column="is_plugin" jdbcType="BIT" property="isPlugin" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.ChartViewWithBLOBs">
<result column="x_axis" jdbcType="LONGVARCHAR" property="xAxis" />
<result column="x_axis_ext" jdbcType="LONGVARCHAR" property="xAxisExt" />
<result column="y_axis" jdbcType="LONGVARCHAR" property="yAxis" />
<result column="y_axis_ext" jdbcType="LONGVARCHAR" property="yAxisExt" />
<result column="ext_stack" jdbcType="LONGVARCHAR" property="extStack" />
@ -87,12 +90,12 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, scene_id, table_id, `type`, render, result_count, result_mode, title,
create_by, create_time, update_time, style_priority
id, `name`, title, scene_id, table_id, `type`, render, result_count, result_mode,
create_by, create_time, update_time, style_priority, chart_type, is_plugin
</sql>
<sql id="Blob_Column_List">
x_axis, y_axis, y_axis_ext, ext_stack, ext_bubble, custom_attr, custom_style, custom_filter,
drill_fields, snapshot
x_axis, x_axis_ext, y_axis, y_axis_ext, ext_stack, ext_bubble, custom_attr, custom_style,
custom_filter, drill_fields, snapshot
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.ChartViewExample" resultMap="ResultMapWithBLOBs">
select
@ -143,19 +146,21 @@
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
insert into chart_view (id, `name`, scene_id,
table_id, `type`, render,
result_count, result_mode, title,
insert into chart_view (id, `name`, title,
scene_id, table_id, `type`,
render, result_count, result_mode,
create_by, create_time, update_time,
style_priority, x_axis, y_axis,
style_priority, chart_type, is_plugin,
x_axis, x_axis_ext, y_axis,
y_axis_ext, ext_stack, ext_bubble,
custom_attr, custom_style, custom_filter,
drill_fields, snapshot)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{tableId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{render,jdbcType=VARCHAR},
#{resultCount,jdbcType=INTEGER}, #{resultMode,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{sceneId,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{render,jdbcType=VARCHAR}, #{resultCount,jdbcType=INTEGER}, #{resultMode,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{stylePriority,jdbcType=VARCHAR}, #{xAxis,jdbcType=LONGVARCHAR}, #{yAxis,jdbcType=LONGVARCHAR},
#{stylePriority,jdbcType=VARCHAR}, #{chartType,jdbcType=VARCHAR}, #{isPlugin,jdbcType=BIT},
#{xAxis,jdbcType=LONGVARCHAR}, #{xAxisExt,jdbcType=LONGVARCHAR}, #{yAxis,jdbcType=LONGVARCHAR},
#{yAxisExt,jdbcType=LONGVARCHAR}, #{extStack,jdbcType=LONGVARCHAR}, #{extBubble,jdbcType=LONGVARCHAR},
#{customAttr,jdbcType=LONGVARCHAR}, #{customStyle,jdbcType=LONGVARCHAR}, #{customFilter,jdbcType=LONGVARCHAR},
#{drillFields,jdbcType=LONGVARCHAR}, #{snapshot,jdbcType=LONGVARCHAR})
@ -169,6 +174,9 @@
<if test="name != null">
`name`,
</if>
<if test="title != null">
title,
</if>
<if test="sceneId != null">
scene_id,
</if>
@ -187,9 +195,6 @@
<if test="resultMode != null">
result_mode,
</if>
<if test="title != null">
title,
</if>
<if test="createBy != null">
create_by,
</if>
@ -202,9 +207,18 @@
<if test="stylePriority != null">
style_priority,
</if>
<if test="chartType != null">
chart_type,
</if>
<if test="isPlugin != null">
is_plugin,
</if>
<if test="xAxis != null">
x_axis,
</if>
<if test="xAxisExt != null">
x_axis_ext,
</if>
<if test="yAxis != null">
y_axis,
</if>
@ -240,6 +254,9 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
#{sceneId,jdbcType=VARCHAR},
</if>
@ -258,9 +275,6 @@
<if test="resultMode != null">
#{resultMode,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@ -273,9 +287,18 @@
<if test="stylePriority != null">
#{stylePriority,jdbcType=VARCHAR},
</if>
<if test="chartType != null">
#{chartType,jdbcType=VARCHAR},
</if>
<if test="isPlugin != null">
#{isPlugin,jdbcType=BIT},
</if>
<if test="xAxis != null">
#{xAxis,jdbcType=LONGVARCHAR},
</if>
<if test="xAxisExt != null">
#{xAxisExt,jdbcType=LONGVARCHAR},
</if>
<if test="yAxis != null">
#{yAxis,jdbcType=LONGVARCHAR},
</if>
@ -320,6 +343,9 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.sceneId != null">
scene_id = #{record.sceneId,jdbcType=VARCHAR},
</if>
@ -338,9 +364,6 @@
<if test="record.resultMode != null">
result_mode = #{record.resultMode,jdbcType=VARCHAR},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
@ -353,9 +376,18 @@
<if test="record.stylePriority != null">
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
</if>
<if test="record.chartType != null">
chart_type = #{record.chartType,jdbcType=VARCHAR},
</if>
<if test="record.isPlugin != null">
is_plugin = #{record.isPlugin,jdbcType=BIT},
</if>
<if test="record.xAxis != null">
x_axis = #{record.xAxis,jdbcType=LONGVARCHAR},
</if>
<if test="record.xAxisExt != null">
x_axis_ext = #{record.xAxisExt,jdbcType=LONGVARCHAR},
</if>
<if test="record.yAxis != null">
y_axis = #{record.yAxis,jdbcType=LONGVARCHAR},
</if>
@ -392,18 +424,21 @@
update chart_view
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
table_id = #{record.tableId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
render = #{record.render,jdbcType=VARCHAR},
result_count = #{record.resultCount,jdbcType=INTEGER},
result_mode = #{record.resultMode,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
chart_type = #{record.chartType,jdbcType=VARCHAR},
is_plugin = #{record.isPlugin,jdbcType=BIT},
x_axis = #{record.xAxis,jdbcType=LONGVARCHAR},
x_axis_ext = #{record.xAxisExt,jdbcType=LONGVARCHAR},
y_axis = #{record.yAxis,jdbcType=LONGVARCHAR},
y_axis_ext = #{record.yAxisExt,jdbcType=LONGVARCHAR},
ext_stack = #{record.extStack,jdbcType=LONGVARCHAR},
@ -421,17 +456,19 @@
update chart_view
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
table_id = #{record.tableId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
render = #{record.render,jdbcType=VARCHAR},
result_count = #{record.resultCount,jdbcType=INTEGER},
result_mode = #{record.resultMode,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
style_priority = #{record.stylePriority,jdbcType=VARCHAR}
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
chart_type = #{record.chartType,jdbcType=VARCHAR},
is_plugin = #{record.isPlugin,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -442,6 +479,9 @@
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
scene_id = #{sceneId,jdbcType=VARCHAR},
</if>
@ -460,9 +500,6 @@
<if test="resultMode != null">
result_mode = #{resultMode,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
@ -475,9 +512,18 @@
<if test="stylePriority != null">
style_priority = #{stylePriority,jdbcType=VARCHAR},
</if>
<if test="chartType != null">
chart_type = #{chartType,jdbcType=VARCHAR},
</if>
<if test="isPlugin != null">
is_plugin = #{isPlugin,jdbcType=BIT},
</if>
<if test="xAxis != null">
x_axis = #{xAxis,jdbcType=LONGVARCHAR},
</if>
<if test="xAxisExt != null">
x_axis_ext = #{xAxisExt,jdbcType=LONGVARCHAR},
</if>
<if test="yAxis != null">
y_axis = #{yAxis,jdbcType=LONGVARCHAR},
</if>
@ -511,18 +557,21 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
update chart_view
set `name` = #{name,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
scene_id = #{sceneId,jdbcType=VARCHAR},
table_id = #{tableId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
render = #{render,jdbcType=VARCHAR},
result_count = #{resultCount,jdbcType=INTEGER},
result_mode = #{resultMode,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
style_priority = #{stylePriority,jdbcType=VARCHAR},
chart_type = #{chartType,jdbcType=VARCHAR},
is_plugin = #{isPlugin,jdbcType=BIT},
x_axis = #{xAxis,jdbcType=LONGVARCHAR},
x_axis_ext = #{xAxisExt,jdbcType=LONGVARCHAR},
y_axis = #{yAxis,jdbcType=LONGVARCHAR},
y_axis_ext = #{yAxisExt,jdbcType=LONGVARCHAR},
ext_stack = #{extStack,jdbcType=LONGVARCHAR},
@ -537,17 +586,19 @@
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.ChartView">
update chart_view
set `name` = #{name,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
scene_id = #{sceneId,jdbcType=VARCHAR},
table_id = #{tableId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
render = #{render,jdbcType=VARCHAR},
result_count = #{resultCount,jdbcType=INTEGER},
result_mode = #{resultMode,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
style_priority = #{stylePriority,jdbcType=VARCHAR}
style_priority = #{stylePriority,jdbcType=VARCHAR},
chart_type = #{chartType,jdbcType=VARCHAR},
is_plugin = #{isPlugin,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="uuid" jdbcType="VARCHAR" property="uuid" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -65,7 +66,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, resource_id, user_id
id, resource_id, user_id, uuid
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.PanelLinkMappingExample" resultMap="BaseResultMap">
select
@ -98,10 +99,10 @@
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.PanelLinkMapping">
insert into panel_link_mapping (id, resource_id, user_id
)
values (#{id,jdbcType=BIGINT}, #{resourceId,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}
)
insert into panel_link_mapping (id, resource_id, user_id,
uuid)
values (#{id,jdbcType=BIGINT}, #{resourceId,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT},
#{uuid,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelLinkMapping">
insert into panel_link_mapping
@ -115,6 +116,9 @@
<if test="userId != null">
user_id,
</if>
<if test="uuid != null">
uuid,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -126,6 +130,9 @@
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="uuid != null">
#{uuid,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.PanelLinkMappingExample" resultType="java.lang.Long">
@ -146,6 +153,9 @@
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.uuid != null">
uuid = #{record.uuid,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -155,7 +165,8 @@
update panel_link_mapping
set id = #{record.id,jdbcType=BIGINT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=BIGINT}
user_id = #{record.userId,jdbcType=BIGINT},
uuid = #{record.uuid,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -169,13 +180,17 @@
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="uuid != null">
uuid = #{uuid,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelLinkMapping">
update panel_link_mapping
set resource_id = #{resourceId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=BIGINT}
user_id = #{userId,jdbcType=BIGINT},
uuid = #{uuid,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -40,7 +40,7 @@
sys_auth a
LEFT JOIN sys_auth_detail d on d.auth_id = a.id
WHERE
auth_source_type = 'datasource'
auth_source_type = 'link'
AND auth_target_type = 'user'
AND auth_target = #{userId}
AND d.privilege_value = 1
@ -80,7 +80,7 @@
sys_auth a
LEFT JOIN sys_auth_detail d on d.auth_id = a.id
WHERE
auth_source_type = 'datasource'
auth_source_type = 'link'
AND auth_target_type = 'role'
AND auth_target = #{roleId}
AND d.privilege_value = 1
@ -119,7 +119,7 @@
sys_auth a
LEFT JOIN sys_auth_detail d on d.auth_id = a.id
WHERE
auth_source_type = 'datasource'
auth_source_type = 'link'
AND auth_target_type = 'dept'
AND auth_target = #{deptId}
AND d.privilege_value = 1

View File

@ -14,7 +14,7 @@ public interface ExtChartViewMapper {
ChartViewDTO searchOne(ChartViewRequest request);
void chartCopy(@Param("newChartId")String newChartId,@Param("oldChartId")String oldChartId);
void chartCopy(@Param("newChartId")String newChartId,@Param("oldChartId")String oldChartId,@Param("panelId")String panelId);
@Select("select id from chart_view where table_id = #{tableId}")
List<String> allViewIds(@Param("tableId") String tableId);

View File

@ -109,11 +109,12 @@
`y_axis_ext`,
`render`,
`result_count`,
`result_mode`
`result_mode`,
`chart_type`
) SELECT
#{newChartId},
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
`scene_id`,
#{panelId},
`table_id`,
`type`,
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
@ -133,7 +134,8 @@
`y_axis_ext`,
`render`,
`result_count`,
`result_mode`
`result_mode`,
'private'
FROM
chart_view
WHERE

View File

@ -19,5 +19,7 @@ public interface ExtPanelGroupMapper {
void copyPanelView(@Param("pid") String panelId);
//移除未使用的视图
void removeUselessViews(@Param("panelId") String panelId);
}

View File

@ -178,4 +178,21 @@
panel_id = #{panelId}
</insert>
<delete id="removeUselessViews">
DELETE
FROM
chart_view
WHERE
chart_view.chart_type = 'private'
AND chart_view.scene_id = #{panelId}
AND id NOT IN (
SELECT
panel_view.chart_view_id
FROM
panel_view
WHERE
panel_view.panel_id = #{panelId}
)
</delete>
</mapper>

View File

@ -34,9 +34,10 @@
</delete>
<select id="query" resultMap="treeNodeMap">
select distinct s.panel_group_id as id, IFNULL(s.granter,g.create_by) as creator, g.name
select distinct s.panel_group_id as id, u.nick_name as creator, g.name
from panel_share s
left join panel_group g on g.id = s.panel_group_id
left join sys_user u on u.username = IFNULL(s.granter,g.create_by)
where
( s.target_id = #{userId} and s.type = 0 ) or
( s.target_id = #{deptId} and s.type = 2 ) or

View File

@ -8,6 +8,9 @@ import java.util.List;
public interface ExtVAuthModelMapper {
List<VAuthModelDTO> queryAuthModel (@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthModel(@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthModelViews (@Param("record") VAuthModelRequest record);
List<VAuthModelDTO> queryAuthViewsOriginal (@Param("record") VAuthModelRequest record);
}

View File

@ -4,106 +4,176 @@
<resultMap extends="io.dataease.base.mapper.VAuthModelMapper.ResultMapWithBLOBs" id="ExtResultMap"
type="io.dataease.dto.authModel.VAuthModelDTO">
<result column="privileges" jdbcType="VARCHAR" property="privileges"/>
<result column="inner_id" jdbcType="VARCHAR" property="innerId"/>
</resultMap>
<select id="queryAuthModel" resultMap="ExtResultMap">
SELECT
v_auth_model.id,
v_auth_model.name,
v_auth_model.label,
v_auth_model.pid,
v_auth_model.node_type,
v_auth_model.model_type,
v_auth_model.model_inner_type,
v_auth_model.auth_type,
v_auth_model.create_by,
v_auth_model.level,
v_auth_model.mode,
v_auth_model.data_source_id,
authInfo.PRIVILEGES AS `privileges`
FROM
( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{record.userId}, #{record.modelType} ) cids ) t,
v_auth_model
LEFT JOIN (
SELECT
auth_source,
group_concat( DISTINCT sys_auth_detail.privilege_extend ) AS `privileges`
FROM
(
`sys_auth`
LEFT JOIN `sys_auth_detail` ON ((
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
)))
WHERE
sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = #{record.modelType}
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{record.userId} )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{record.userId}
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{record.userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`
) authInfo ON v_auth_model.id = authInfo.auth_source
WHERE
FIND_IN_SET( v_auth_model.id, cids )
<if test="record.id != null">
and v_auth_model.id = #{record.id,jdbcType=VARCHAR}
</if>
<if test="record.pid != null">
and v_auth_model.pid = #{record.pid,jdbcType=VARCHAR}
</if>
<if test="record.nodeType != null">
and v_auth_model.node_type = #{record.nodeType,jdbcType=VARCHAR}
</if>
<if test="record.modelType != null">
and v_auth_model.model_type = #{record.modelType,jdbcType=VARCHAR}
</if>
<if test="record.modelInnerType != null">
and v_auth_model.model_inner_type = #{record.modelInnerType,jdbcType=VARCHAR}
</if>
<if test="record.authType != null">
and v_auth_model.auth_type = #{record.authType,jdbcType=VARCHAR}
</if>
<if test="record.createBy != null">
and v_auth_model.create_by = #{record.createBy,jdbcType=VARCHAR}
</if>
<if test="record.level != null">
and v_auth_model.`level` = #{record.level,jdbcType=BIGINT}
</if>
<if test="record.mode != null">
<if test="record.mode == 0">
and v_auth_model.`mode` = 0
</if>
<if test='record.mode == 1 and record.modelType != null and record.modelType == "dataset"'>
and (v_auth_model.`mode` = 1 or (v_auth_model.`model_inner_type` = 'group' and v_auth_model.model_type = 'dataset'))
</if>
</if>
<if test="record.dataSourceId != null">
and v_auth_model.data_source_id = #{record.dataSourceId,jdbcType=VARCHAR}
</if>
<if test="record.name != null">
and v_auth_model.`name` = #{record.name,jdbcType=LONGVARCHAR}
</if>
<if test="record.label != null">
and v_auth_model.`label` = #{record.label,jdbcType=LONGVARCHAR}
</if>
<if test="record.modelInnerTypeArray != null and record.modelInnerTypeArray.size() > 0">
and v_auth_model.model_inner_type in
<foreach collection="record.modelInnerTypeArray" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
ORDER BY v_auth_model.node_type desc, CONVERT(v_auth_model.label using gbk) asc
</select>
SELECT
v_auth_model.id,
v_auth_model.name,
v_auth_model.label,
v_auth_model.pid,
v_auth_model.node_type,
v_auth_model.model_type,
v_auth_model.model_inner_type,
v_auth_model.auth_type,
v_auth_model.create_by,
v_auth_model.level,
v_auth_model.mode,
v_auth_model.data_source_id,
authInfo.PRIVILEGES AS `privileges`
FROM
( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{record.userId}, #{record.modelType} ) cids ) t,
v_auth_model
LEFT JOIN (
SELECT
auth_source,
group_concat( DISTINCT sys_auth_detail.privilege_extend ) AS `privileges`
FROM
(
`sys_auth`
LEFT JOIN `sys_auth_detail` ON ((
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
)))
WHERE
sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = #{record.modelType}
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{record.userId} )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{record.userId}
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{record.userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`
) authInfo ON v_auth_model.id = authInfo.auth_source
WHERE
FIND_IN_SET( v_auth_model.id, cids )
<if test="record.id != null">
and v_auth_model.id = #{record.id,jdbcType=VARCHAR}
</if>
<if test="record.pid != null">
and v_auth_model.pid = #{record.pid,jdbcType=VARCHAR}
</if>
<if test="record.nodeType != null">
and v_auth_model.node_type = #{record.nodeType,jdbcType=VARCHAR}
</if>
<if test="record.modelType != null">
and v_auth_model.model_type = #{record.modelType,jdbcType=VARCHAR}
</if>
<if test="record.modelInnerType != null">
and v_auth_model.model_inner_type = #{record.modelInnerType,jdbcType=VARCHAR}
</if>
<if test="record.authType != null">
and v_auth_model.auth_type = #{record.authType,jdbcType=VARCHAR}
</if>
<if test="record.createBy != null">
and v_auth_model.create_by = #{record.createBy,jdbcType=VARCHAR}
</if>
<if test="record.level != null">
and v_auth_model.`level` = #{record.level,jdbcType=BIGINT}
</if>
<if test="record.mode != null">
<if test="record.mode == 0">
and v_auth_model.`mode` = 0
</if>
<if test='record.mode == 1 and record.modelType != null and record.modelType == "dataset"'>
and (v_auth_model.`mode` = 1 or (v_auth_model.`model_inner_type` = 'group' and v_auth_model.model_type =
'dataset'))
</if>
</if>
<if test="record.dataSourceId != null">
and v_auth_model.data_source_id = #{record.dataSourceId,jdbcType=VARCHAR}
</if>
<if test="record.name != null">
and v_auth_model.`name` = #{record.name,jdbcType=LONGVARCHAR}
</if>
<if test="record.label != null">
and v_auth_model.`label` = #{record.label,jdbcType=LONGVARCHAR}
</if>
<if test="record.modelInnerTypeArray != null and record.modelInnerTypeArray.size() > 0">
and v_auth_model.model_inner_type in
<foreach collection="record.modelInnerTypeArray" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
ORDER BY v_auth_model.node_type desc, CONVERT(v_auth_model.label using gbk) asc
</select>
<select id="queryAuthModelViews" resultMap="ExtResultMap">
SELECT
panel_view.id,
chart_view.id as 'inner_id',
chart_view.NAME,
chart_view.NAME AS 'label',
panel_view.panel_id AS pid,
chart_view.type as 'model_inner_type',
'leaf' AS node_type,
'view' AS model_type
FROM
chart_view
LEFT JOIN panel_view ON panel_view.chart_view_id = chart_view.id
<where>
<if test="record.pids != null and record.pids.size() > 0">
and panel_view.panel_id in
<foreach collection="record.pids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
ORDER BY CONVERT(chart_view.name using gbk) asc
</select>
<select id="queryAuthViewsOriginal" resultMap="ExtResultMap">
select * from (
SELECT
chart_group.id,
chart_group.id AS 'inner_id',
chart_group.NAME,
chart_group.NAME AS 'label',
chart_group.pid AS pid,
chart_group.type AS 'model_inner_type',
'spine' AS node_type,
'view' AS model_type
FROM
chart_group
UNION ALL
SELECT
distinct
chart_view.id,
chart_view.id AS 'inner_id',
chart_view.NAME,
chart_view.NAME AS 'label',
chart_view.scene_id AS pid,
chart_view.type AS 'model_inner_type',
'leaf' AS node_type,
'view' AS model_type
FROM
chart_view
LEFT JOIN panel_view ON panel_view.chart_view_id = chart_view.id
<where>
chart_view.chart_type ='public'
<if test="record.pids != null and record.pids.size() > 0">
and panel_view.panel_id in
<foreach collection="record.pids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
) viewsOriginal
ORDER BY viewsOriginal.node_type desc, CONVERT(viewsOriginal.label using gbk) asc
</select>
</mapper>

View File

@ -4,6 +4,7 @@ import io.dataease.auth.api.dto.CurrentRoleDto;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.entity.AuthItem;
import io.dataease.auth.service.ExtAuthService;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.model.AuthURD;
import org.apache.commons.lang3.StringUtils;
@ -56,7 +57,7 @@ public class AuthUtils {
Long deptId = user.getDeptId();
List<CurrentRoleDto> roles = user.getRoles();
Set<AuthItem> result = new HashSet<>();
if (StringUtils.equals("link", type)) {
if (StringUtils.equals(DePermissionType.DATASOURCE.name().toLowerCase(), type)) {
Set<AuthItem> userSet = extAuthService.dataSourceIdByUser(userId).stream().collect(Collectors.toSet());
Set<AuthItem> roleSet = roles.stream().map(role -> extAuthService.dataSourceIdByRole(role.getId())).flatMap(Collection::stream).collect(Collectors.toSet());
Set<AuthItem> deptSet = extAuthService.dataSourceIdByDept(deptId).stream().collect(Collectors.toSet());
@ -69,7 +70,7 @@ public class AuthUtils {
return result;
}
else if (StringUtils.equals("dataset", type)) {
else if (StringUtils.equals(DePermissionType.DATASET.name().toLowerCase(), type)) {
Set<AuthItem> userSet = extAuthService.dataSetIdByUser(userId).stream().collect(Collectors.toSet());
Set<AuthItem> roleSet = roles.stream().map(role -> extAuthService.dataSetIdByRole(role.getId())).flatMap(Collection::stream).collect(Collectors.toSet());
Set<AuthItem> deptSet = extAuthService.dataSetIdByDept(deptId).stream().collect(Collectors.toSet());
@ -81,7 +82,7 @@ public class AuthUtils {
});
return result;
}
else if (StringUtils.equals("panel", type)) {
else if (StringUtils.equals(DePermissionType.PANEL.name().toLowerCase(), type)) {
Set<AuthItem> userSet = extAuthService.panelIdByUser(userId).stream().collect(Collectors.toSet());
Set<AuthItem> roleSet = roles.stream().map(role -> extAuthService.panelIdByRole(role.getId())).flatMap(Collection::stream).collect(Collectors.toSet());
Set<AuthItem> deptSet = extAuthService.panelIdByDept(deptId).stream().collect(Collectors.toSet());

View File

@ -7,6 +7,7 @@ import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.util.UUID;
/**
* 加密解密工具
@ -19,6 +20,13 @@ public class CodingUtil {
private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
public static String[] chars = new String[] { "a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z" };
/**
* MD5加密
*
@ -165,4 +173,26 @@ public class CodingUtil {
}
}
public static boolean isNumeric(String str){
for (int i = str.length();--i>=0;){
if (!Character.isDigit(str.charAt(i))){
return false;
}
}
return true;
}
public static String shortUuid() {
StringBuffer shortBuffer = new StringBuffer();
String uuid = UUID.randomUUID().toString().replace("-", "");
for (int i = 0; i < 8; i++) {
String str = uuid.substring(i * 4, i * 4 + 4);
int x = Integer.parseInt(str, 16);
shortBuffer.append(chars[x % 0x3E]);
}
return shortBuffer.toString();
}
}

View File

@ -2,6 +2,7 @@ package io.dataease.commons.utils;
import io.dataease.commons.model.ITreeBase;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@ -18,6 +19,9 @@ public class TreeUtils{
*/
public static<T extends ITreeBase> List<T> mergeTree(List<T> tree,String ... rootPid) {
Assert.notNull(rootPid, "Root Pid cannot be null");
if(CollectionUtils.isEmpty(tree)){
return null;
}
List<T> result = new ArrayList<>();
// 构建id-节点map映射
Map<String, T> treePidMap = tree.stream().collect(Collectors.toMap(T::getId, t -> t));

View File

@ -3,6 +3,7 @@ package io.dataease.controller;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.service.panel.PanelLinkService;
@ -48,8 +49,13 @@ public class IndexController {
}
@GetMapping("/link/{index}")
public void link(@PathVariable(value = "index", required = true) Long index) {
String url = panelLinkService.getUrlByIndex(index);
public void link(@PathVariable(value = "index", required = true) String index) {
String url;
if (CodingUtil.isNumeric(index)) {
url = panelLinkService.getUrlByIndex(Long.parseLong(index));
} else {
url = panelLinkService.getUrlByUuid(index);
}
HttpServletResponse response = ServletUtils.response();
try {
response.sendRedirect(url);

View File

@ -72,9 +72,9 @@ public class ChartViewController {
}
@ApiOperation("复制")
@PostMapping("chartCopy/{id}")
public String chartCopy(@PathVariable String id) {
return chartViewService.chartCopy(id);
@PostMapping("chartCopy/{id}/{panelId}")
public String chartCopy(@PathVariable String id, @PathVariable String panelId) {
return chartViewService.chartCopy(id,panelId);
}
@ApiIgnore

View File

@ -1,13 +1,19 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.ExtractDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -28,12 +34,18 @@ public class DataSetGroupController {
@Resource
private ExtractDataService extractDataService;
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id"),
@DePermission(type = DePermissionType.DATASET, value = "pid", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
}, logical = Logical.AND)
@ApiOperation("保存")
@PostMapping("/save")
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
return dataSetGroupService.save(datasetGroup);
}
@RequiresPermissions("data:read")
@ApiOperation("查询树")
@PostMapping("/tree")
public List<DataSetGroupDTO> tree(@RequestBody DataSetGroupRequest datasetGroup) {
@ -46,6 +58,8 @@ public class DataSetGroupController {
return dataSetGroupService.treeNode(datasetGroup);
}
@RequiresPermissions("data:read")
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void tree(@PathVariable String id) throws Exception {

View File

@ -1,9 +1,13 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.base.domain.DatasetTable;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.DatasetTableIncrementalConfig;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.response.DataSetDetail;
import io.dataease.dto.datasource.TableField;
@ -11,6 +15,8 @@ import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.ExcelFileData;
import io.dataease.service.dataset.DataSetTableService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -30,12 +36,24 @@ public class DataSetTableController {
@Resource
private DataSetTableService dataSetTableService;
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id"),
@DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASET_LEVEL_USE)
}, logical = Logical.AND)
@ApiOperation("批量保存")
@PostMapping("batchAdd")
public void batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
dataSetTableService.batchInsert(datasetTable);
}
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASET_LEVEL_USE)
}, logical = Logical.AND)
@ApiOperation("更新")
@PostMapping("update")
public void save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
@ -46,12 +64,19 @@ public class DataSetTableController {
}
}
@RequiresPermissions("data:read")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASET, value = "sceneId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASET_LEVEL_USE)
}, logical = Logical.AND)
@ApiOperation("修改")
@PostMapping("alter")
public void alter(@RequestBody DataSetTableRequest request) throws Exception {
dataSetTableService.alter(request);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@ApiParam(name = "id", value = "数据集ID", required = true) @PathVariable String id) throws Exception {
@ -70,6 +95,7 @@ public class DataSetTableController {
return dataSetTableService.listAndGroup(dataSetTableRequest);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_USE)
@ApiOperation("详息")
@PostMapping("get/{id}")
public DatasetTable get(@ApiParam(name = "id", value = "数据集ID", required = true) @PathVariable String id) {

View File

@ -3,7 +3,11 @@ package io.dataease.controller.datasource;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.base.domain.Datasource;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -16,6 +20,8 @@ import io.dataease.service.datasource.DatasourceService;
import io.dataease.dto.DatasourceDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -32,18 +38,24 @@ public class DatasourceController {
@Resource
private DatasourceService datasourceService;
@RequiresPermissions("datasource:add")
@DePermission(type = DePermissionType.DATASOURCE, value = "id")
@ApiOperation("新增数据源")
@PostMapping("/add")
public Datasource addDatasource(@RequestBody Datasource datasource) throws Exception{
return datasourceService.addDatasource(datasource);
}
@RequiresPermissions("datasource:read")
@DePermission(type = DePermissionType.DATASOURCE, value = "id")
@ApiOperation("验证数据源")
@PostMapping("/validate")
public ResultHolder validate(@RequestBody Datasource datasource) throws Exception {
return datasourceService.validate(datasource);
}
@RequiresPermissions("datasource:read")
@DePermission(type = DePermissionType.DATASOURCE)
@ApiOperation("验证数据源")
@GetMapping("/validate/{datasourceId}")
public ResultHolder validate(@PathVariable String datasourceId) {
@ -65,6 +77,7 @@ public class DatasourceController {
return getDatasourceList().stream().filter(datasourceDTO -> datasourceDTO.getType().equalsIgnoreCase(type)).collect(Collectors.toList());
}
@RequiresPermissions("datasource:read")
@ApiIgnore
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<DatasourceDTO>> getDatasourceList(@RequestBody BaseGridRequest request, @PathVariable int goPage, @PathVariable int pageSize) throws Exception {
@ -72,12 +85,15 @@ public class DatasourceController {
return PageUtils.setPageInfo(page, datasourceService.gridQuery(request));
}
@DePermission(type = DePermissionType.DATASOURCE, level = ResourceAuthLevel.LINK_LEVEL_MANAGE)
@ApiOperation("删除数据源")
@PostMapping("/delete/{datasourceID}")
public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) throws Exception {
datasourceService.deleteDatasource(datasourceID);
}
@RequiresPermissions("datasource:add")
@DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.LINK_LEVEL_MANAGE)
@ApiOperation("更新数据源")
@PostMapping("/update")
public void updateDatasource(@RequestBody Datasource Datasource) {

View File

@ -9,6 +9,7 @@ import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
@ -70,5 +71,11 @@ public class PanelGroupController {
return panelGroupService.findOne(id);
}
@ApiOperation("仪表板视图信息")
@PostMapping("/queryPanelViewTree")
@I18n
public List<VAuthModelDTO> queryPanelViewTree(){
return panelGroupService.queryPanelViewTree();
}
}

View File

@ -14,9 +14,15 @@ import java.util.List;
public class VAuthModelRequest extends VAuthModelDTO {
private String userId;
private String privileges;
private Integer datasetMode;
private boolean clearEmptyDir;
private List<String> modelInnerTypeArray;
private List<String> pids;
}

View File

@ -11,6 +11,7 @@ import io.dataease.service.FileService;
import io.dataease.service.system.EmailService;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -39,11 +40,13 @@ public class SystemParameterController {
private EmailService emailService;
@RequiresPermissions("sysparam:read")
@GetMapping("/mail/info")
public MailInfo mailInfo() {
return emailService.mailInfo();
}
@RequiresPermissions("sysparam:read")
@GetMapping("/basic/info")
public BasicInfo basicInfo() {
return systemParameterService.basicInfo();
@ -55,11 +58,13 @@ public class SystemParameterController {
return StringUtils.isNotBlank(basicInfo.getFrontTimeOut()) ? Integer.parseInt(basicInfo.getFrontTimeOut()) : 10;
}
@RequiresPermissions("sysparam:read")
@PostMapping("/edit/email")
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
emailService.editMail(systemParameter);
}
@RequiresPermissions("sysparam:read")
@PostMapping("/edit/basic")
public void editBasic(@RequestBody List<SystemParameter> systemParameter) {
systemParameterService.editBasic(systemParameter);
@ -76,6 +81,7 @@ public class SystemParameterController {
}
@RequiresPermissions("sysparam:read")
@GetMapping("/base/info")
public List<SystemParameterDTO> getBaseInfo() {
return systemParameterService.getSystemParameterInfo(ParamConstants.Classify.BASE.getValue());

View File

@ -17,5 +17,13 @@ public class VAuthModelDTO extends VAuthModelWithBLOBs implements ITreeBase<VAu
private String privileges;
private List<VAuthModelDTO> children;
private long allLeafs = 0l;
private String innerId;
public String toString(){
return this.getName();
}
}

View File

@ -3,6 +3,7 @@ package io.dataease.plugins.server;
import java.util.List;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -36,6 +37,7 @@ public class ThemeServer {
return themeXpackService.queryItems(themeId);
}
@RequiresPermissions("sysparam:read")
@PostMapping("/save")
public void save(@RequestPart("request") ThemeRequest request,
@RequestPart(value = "file", required = false) MultipartFile bodyFile) {
@ -55,6 +57,7 @@ public class ThemeServer {
}
@RequiresPermissions("sysparam:read")
@PostMapping("/delete/{themeId}")
public void delete(@PathVariable("themeId") int themeId) {
ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class);

View File

@ -14,6 +14,7 @@ import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO;
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
@ -25,37 +26,41 @@ public class XAuthServer {
private static final Set<String> cacheTypes = new HashSet<>();
@RequiresPermissions("auth:read")
@PostMapping("/authModels")
@I18n
public List<XpackVAuthModelDTO> authModels(@RequestBody XpackBaseTreeRequest request){
public List<XpackVAuthModelDTO> authModels(@RequestBody XpackBaseTreeRequest request) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
CurrentUserDto user = AuthUtils.getUser();
return sysAuthService.searchAuthModelTree(request, user.getUserId(), user.getIsAdmin());
}
@RequiresPermissions("auth:read")
@PostMapping("/authDetails")
public Map<String,List<XpackSysAuthDetailDTO>> authDetails(@RequestBody XpackSysAuthRequest request){
public Map<String, List<XpackSysAuthDetailDTO>> authDetails(@RequestBody XpackSysAuthRequest request) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
return sysAuthService.searchAuthDetails(request);
}
@GetMapping("/authDetailsModel/{authType}")
@RequiresPermissions("auth:read")
@GetMapping("/authDetailsModel/{authType}/{direction}")
@I18n
public List<XpackSysAuthDetail>authDetailsModel(@PathVariable String authType){
public List<XpackSysAuthDetail> authDetailsModel(@PathVariable String authType, @PathVariable String direction) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
List<XpackSysAuthDetail> authDetails = sysAuthService.searchAuthDetailsModel(authType);
if(authType.equalsIgnoreCase("dataset")){
List<XpackSysAuthDetail> authDetails = sysAuthService.searchAuthDetailsModel(authType);
if (authType.equalsIgnoreCase("dataset")) {
XpackSysAuthDetail xpackSysAuthDetail = new XpackSysAuthDetail();
xpackSysAuthDetail.setPrivilegeName("i18n_auth_row_permission");
xpackSysAuthDetail.setPrivilegeType(20);
xpackSysAuthDetail.setPrivilegeValue(1);
authDetails.add(0,xpackSysAuthDetail);
authDetails.add(0, xpackSysAuthDetail);
}
return authDetails;
}
@RequiresPermissions("auth:read")
@PostMapping("/authChange")
public void authChange(@RequestBody XpackSysAuthRequest request){
public void authChange(@RequestBody XpackSysAuthRequest request) {
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
CurrentUserDto user = AuthUtils.getUser();
sysAuthService.authChange(request, user.getUserId(), user.getUsername(), user.getIsAdmin());

View File

@ -14,6 +14,7 @@ import io.dataease.plugins.xpack.dept.dto.response.XpackSysDept;
import io.dataease.plugins.xpack.dept.service.DeptXpackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -66,6 +67,7 @@ public class XDeptServer {
return nodes;
}
@RequiresPermissions("dept:add")
@ApiOperation("创建")
@PostMapping("/create")
public int create(@RequestBody XpackCreateDept dept){
@ -73,6 +75,7 @@ public class XDeptServer {
return deptService.add(dept);
}
@RequiresPermissions("dept:del")
@ApiOperation("删除")
@PostMapping("/delete")
public void delete(@RequestBody List<XpackDeleteDept> requests){
@ -83,6 +86,7 @@ public class XDeptServer {
deptService.batchDelete(requests);
}
@RequiresPermissions("dept:edit")
@ApiOperation("更新")
@PostMapping("/update")
public int update(@RequestBody XpackCreateDept dept){
@ -91,6 +95,7 @@ public class XDeptServer {
}
@RequiresPermissions("dept:del")
@ApiIgnore
@ApiOperation("删除")
@PostMapping("/nodesByDeptId/{deptId}")

View File

@ -4,6 +4,7 @@ package io.dataease.plugins.server;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisplayXpackService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -22,6 +23,7 @@ public class XDisplayServer {
return disPlayXpackService.systemSettings();
}
@RequiresPermissions("sysparam:read")
@PostMapping(value="/save", consumes = {"multipart/form-data"})
public void saveUIInfo(@RequestPart("request") Map<String,List<SysSettingDto>> systemParameterMap, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
DisplayXpackService disPlayXpackService = SpringContextUtil.getBean(DisplayXpackService.class);

View File

@ -20,6 +20,7 @@ import io.dataease.service.ScheduleService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -39,6 +40,7 @@ public class XEmailTaskServer {
@Resource
private PriorityThreadPoolExecutor priorityExecutor;
@RequiresPermissions("task-email:read")
@PostMapping("/queryTasks/{goPage}/{pageSize}")
public Pager<List<XpackTaskGridDTO>> queryTask(@PathVariable int goPage, @PathVariable int pageSize,
@RequestBody XpackGridRequest request) {
@ -71,6 +73,7 @@ public class XEmailTaskServer {
return listPager;
}
@RequiresPermissions("task-email:add")
@PostMapping("/save")
public void save(@RequestBody XpackEmailCreate param) throws Exception {
XpackEmailTaskRequest request = param.fillContent();
@ -81,6 +84,7 @@ public class XEmailTaskServer {
scheduleService.addSchedule(globalTask);
}
@RequiresPermissions("task-email:read")
@PostMapping("/queryForm/{taskId}")
public XpackEmailCreate queryForm(@PathVariable Long taskId) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
@ -141,6 +145,7 @@ public class XEmailTaskServer {
}
@RequiresPermissions("task-email:del")
@PostMapping("/delete/{taskId}")
public void delete(@PathVariable Long taskId) {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);

View File

@ -6,6 +6,7 @@ import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.ldap.dto.response.LdapInfo;
import io.dataease.plugins.xpack.ldap.service.LdapXpackService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -21,6 +22,7 @@ public class XLdapServer {
return ldapXpackService.info();
}
@RequiresPermissions("sysparam:read")
@PostMapping("/save")
public void save(@RequestBody List<SysSettingDto> settings) {
LdapXpackService ldapXpackService = SpringContextUtil.getBean(LdapXpackService.class);

View File

@ -5,6 +5,7 @@ import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.oidc.service.OidcXpackService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
@ -21,6 +22,7 @@ public class XOidcServer {
return oidcXpackService.oidcSettings();
}
@RequiresPermissions("sysparam:read")
@PostMapping("/save")
public void save(@RequestBody List<SysSettingDto> settings) {
OidcXpackService oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class);

View File

@ -13,6 +13,7 @@ import io.dataease.plugins.xpack.role.dto.response.XpackRoleItemDto;
import io.dataease.plugins.xpack.role.service.RoleXpackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -26,6 +27,7 @@ public class XRoleServer {
@Autowired
private ExtAuthService extAuthService;
@RequiresPermissions("role:add")
@ApiOperation("新增角色")
@PostMapping("/create")
public void create(@RequestBody XpackRoleDto role){
@ -34,6 +36,7 @@ public class XRoleServer {
}
@RequiresPermissions("role:del")
@ApiOperation("删除角色")
@PostMapping("/delete/{roleId}")
public void delete(@PathVariable("roleId") Long roleId){
@ -43,6 +46,7 @@ public class XRoleServer {
}
@RequiresPermissions("role:edit")
@ApiOperation("更新角色")
@PostMapping("/update")
public void update(@RequestBody XpackRoleDto role){
@ -50,6 +54,7 @@ public class XRoleServer {
roleXpackService.update(role);
}
@RequiresPermissions("role:read")
@ApiOperation("分页查询")
@PostMapping("/roleGrid/{goPage}/{pageSize}")
public Pager<List<XpackRoleDto>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackGridRequest request) {

View File

@ -0,0 +1,33 @@
package io.dataease.plugins.server.view;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.view.entity.PluginViewType;
import io.dataease.plugins.view.service.ViewPluginService;
@RequestMapping("/plugin/view")
@RestController
public class PluginViewServer {
@PostMapping("/types")
public List<PluginViewType> types() {
List<PluginViewType> result = new ArrayList<>();
Map<String, ViewPluginService> beanMap = SpringContextUtil.getApplicationContext()
.getBeansOfType(ViewPluginService.class);
if (beanMap.keySet().size() == 0) {
return result;
}
for (Entry<String, ViewPluginService> entry : beanMap.entrySet()) {
result.add(entry.getValue().viewType());
}
return result;
}
}

View File

@ -76,7 +76,7 @@ public class DorisQueryProvider extends QueryProvider {
@Override
public String createSQLPreview(String sql, String orderBy) {
return "SELECT * FROM (" + sql + ") AS tmp ORDER BY " + orderBy + " LIMIT 0,1000";
return "SELECT * FROM (" + sqlFix(sql) + ") AS tmp LIMIT 0,1000";
}
@Override
@ -147,14 +147,6 @@ public class DorisQueryProvider extends QueryProvider {
if (customWheres != null) wheres.add(customWheres);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if ((fields.size() > 0)) {
xOrders.add(SQLObj.builder()
.orderDirection("asc")
.orderField(fields.get(0).getDataeaseName())
.orderAlias(String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, "0"))
.build());
st_sql.add("orders", xOrders);
}
return st_sql.render();
}

View File

@ -219,6 +219,11 @@ public class ChartViewService {
}
List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
}.getType());
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot")) {
List<ChartViewFieldDTO> xAxisExt = new Gson().fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
}.getType());
xAxis.addAll(xAxisExt);
}
List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
}.getType());
if (StringUtils.equalsIgnoreCase(view.getType(), "chart-mix")) {
@ -1679,9 +1684,9 @@ public class ChartViewService {
return chartViewMapper.selectByPrimaryKey(id);
}
public String chartCopy(String id) {
public String chartCopy(String id,String panelId) {
String newChartId = UUID.randomUUID().toString();
extChartViewMapper.chartCopy(newChartId, id);
extChartViewMapper.chartCopy(newChartId, id,panelId);
return newChartId;
}

View File

@ -1,9 +1,11 @@
package io.dataease.service.dataset;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.base.domain.DatasetGroupExample;
import io.dataease.base.mapper.DatasetGroupMapper;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TreeUtils;
@ -39,6 +41,7 @@ public class DataSetGroupService {
@Resource
private SysAuthService sysAuthService;
@DeCleaner(DePermissionType.DATASET)
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
checkName(datasetGroup);
if (StringUtils.isEmpty(datasetGroup.getId())) {

View File

@ -1,18 +1,18 @@
package io.dataease.service.datasource;
import cn.hutool.json.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.jayway.jsonpath.JsonPath;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.ExtDataSourceMapper;
import io.dataease.base.mapper.ext.query.GridExample;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CommonThreadPool;
import io.dataease.commons.utils.HttpClientUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.controller.ResultHolder;
import io.dataease.controller.request.DatasourceUnionRequest;
@ -20,7 +20,6 @@ import io.dataease.controller.request.datasource.ApiDefinition;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.base.ConditionEntity;
import io.dataease.commons.constants.DatasourceTypes;
import io.dataease.exception.ExcelException;
import io.dataease.provider.datasource.ApiProvider;
import io.dataease.provider.datasource.DatasourceProvider;
import io.dataease.provider.ProviderFactory;
@ -57,6 +56,7 @@ public class DatasourceService {
@Resource
private CommonThreadPool commonThreadPool;
@DeCleaner(DePermissionType.DATASOURCE)
public Datasource addDatasource(Datasource datasource) throws Exception{
checkName(datasource);
long currentTimeMillis = System.currentTimeMillis();

View File

@ -1,14 +1,20 @@
package io.dataease.service.panel;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.ChartViewMapper;
import io.dataease.base.mapper.PanelGroupMapper;
import io.dataease.base.mapper.VAuthModelMapper;
import io.dataease.base.mapper.ext.ExtPanelGroupMapper;
import io.dataease.base.mapper.ext.ExtPanelLinkJumpMapper;
import io.dataease.base.mapper.ext.ExtVAuthModelMapper;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.authModel.VAuthModelRequest;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.exception.DataEaseException;
@ -28,6 +34,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Author: wangjiahao
@ -59,7 +66,10 @@ public class PanelGroupService {
private PanelViewService panelViewService;
@Resource
private ExtPanelLinkJumpMapper extPanelLinkJumpMapper;
@Resource
private ExtVAuthModelMapper extVAuthModelMapper;
@Resource
private VAuthModelMapper vAuthModelMapper;
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
@ -75,6 +85,7 @@ public class PanelGroupService {
return TreeUtils.mergeTree(panelGroupDTOList, "default_panel");
}
@DeCleaner(DePermissionType.PANEL)
@Transactional
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
try {
@ -157,6 +168,9 @@ public class PanelGroupService {
if (!CollectionUtils.isNotEmpty(panelGroupDTOList)) {
DataEaseException.throwException("未查询到用户对应的资源权限,请尝试刷新重新保存");
}
//移除没有用到的仪表板私有视图
extPanelGroupMapper.removeUselessViews(panelId);
return panelGroupDTOList.get(0);
}
@ -214,4 +228,31 @@ public class PanelGroupService {
return chartViewDTOList;
}
public List<VAuthModelDTO> queryPanelViewTree(){
List<VAuthModelDTO> result = new ArrayList<>();
VAuthModelRequest panelRequest = new VAuthModelRequest();
panelRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
panelRequest.setModelType("panel");
List<VAuthModelDTO> panelResult = extVAuthModelMapper.queryAuthModel(panelRequest);
// 获取仪表板下面的视图
if(CollectionUtils.isNotEmpty(panelResult)){
result.addAll(panelResult);
List<String> panelIds = panelResult.stream().map(VAuthModelDTO::getId).collect(Collectors.toList());
VAuthModelRequest viewRequest = new VAuthModelRequest();
viewRequest.setPids(panelIds);
List<VAuthModelDTO> viewResult = extVAuthModelMapper.queryAuthModelViews(viewRequest);
if(CollectionUtils.isNotEmpty(viewResult)){
result.addAll(viewResult);
}
result = TreeUtils.mergeTree(result,"panel_list");
// 原有视图的目录结构
List<VAuthModelDTO> viewOriginal = extVAuthModelMapper.queryAuthViewsOriginal(viewRequest);
if(CollectionUtils.isNotEmpty(viewOriginal) && viewOriginal.size()>1){
result.addAll(TreeUtils.mergeTree(viewOriginal,"public_chart"));
}
}
return result;
}
}

View File

@ -9,6 +9,7 @@ import io.dataease.base.mapper.PanelLinkMapper;
import io.dataease.base.mapper.PanelLinkMappingMapper;
import io.dataease.base.mapper.ext.ExtPanelLinkMapper;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.controller.request.panel.link.EnablePwdRequest;
import io.dataease.controller.request.panel.link.LinkRequest;
@ -18,6 +19,7 @@ import io.dataease.dto.panel.link.GenerateDto;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -25,7 +27,6 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Optional;
@Service
public class PanelLinkService {
@ -34,6 +35,9 @@ public class PanelLinkService {
private static final String USERPARAM = "&user=";
private static final String SHORT_URL_PREFIX = "/link/";
@Value("${server.servlet.context-path}")
private String contextPath;
@Resource
private PanelLinkMapper mapper;
@Resource
@ -43,14 +47,22 @@ public class PanelLinkService {
@Resource
private PanelLinkMappingMapper panelLinkMappingMapper;
@Transactional
public void changeValid(LinkRequest request) {
PanelLink po = new PanelLink();
po.setResourceId(request.getResourceId());
po.setValid(request.isValid());
mapper.updateByExampleSelective(po, example(request.getResourceId(), AuthUtils.getUser().getUserId()));
Long userId = AuthUtils.getUser().getUserId();
mapper.updateByExampleSelective(po, example(request.getResourceId(), userId));
PanelLinkMappingExample example = new PanelLinkMappingExample();
example.createCriteria().andResourceIdEqualTo(request.getResourceId()).andUserIdEqualTo(userId);
PanelLinkMapping mapping = new PanelLinkMapping();
mapping.setUuid(CodingUtil.shortUuid());
panelLinkMappingMapper.updateByExampleSelective(mapping, example);
}
private PanelLinkExample example(String panelLinkId, Long userId){
private PanelLinkExample example(String panelLinkId, Long userId) {
PanelLinkExample example = new PanelLinkExample();
example.createCriteria().andResourceIdEqualTo(panelLinkId).andUserIdEqualTo(userId);
return example;
@ -78,18 +90,18 @@ public class PanelLinkService {
private PanelLink findOne(String resourceId) {
PanelLinkExample example = new PanelLinkExample();
example.createCriteria().andResourceIdEqualTo(resourceId).andUserIdIsNull();
List<PanelLink> list = mapper.selectByExample(example);
List<PanelLink> list = mapper.selectByExample(example);
return CollectionUtils.isNotEmpty(list) ? list.get(0) : null;
}
public PanelLink findOne(String resourceId, Long userId) {
if(userId == null){
if (userId == null) {
return findOne(resourceId);
}
List<PanelLink> panelLinks = mapper.selectByExample(example(resourceId, userId));
if(CollectionUtils.isNotEmpty(panelLinks)){
if (CollectionUtils.isNotEmpty(panelLinks)) {
return panelLinks.get(0);
}else {
} else {
return null;
}
}
@ -114,6 +126,7 @@ public class PanelLinkService {
PanelLinkMapping mapping = new PanelLinkMapping();
mapping.setResourceId(resourceId);
mapping.setUserId(AuthUtils.getUser().getUserId());
mapping.setUuid(CodingUtil.shortUuid());
panelLinkMappingMapper.insert(mapping);
}
return convertDto(one);
@ -141,8 +154,8 @@ public class PanelLinkService {
private String buildLinkParam(PanelLink link) {
String linkParam = encrypt(link.getResourceId());
if(link.getUserId() != null){
linkParam = linkParam+ USERPARAM + link.getUserId().toString();
if (link.getUserId() != null) {
linkParam = linkParam + USERPARAM + link.getUserId().toString();
}
return linkParam;
}
@ -161,7 +174,8 @@ public class PanelLinkService {
public Boolean validateHeads(PanelLink panelLink) throws Exception {
HttpServletRequest request = ServletUtils.request();
String token = request.getHeader("LINK-PWD-TOKEN");
if (!panelLink.getEnablePwd() || StringUtils.isEmpty(token) || StringUtils.equals("undefined", token) || StringUtils.equals("null", token)) {
if (!panelLink.getEnablePwd() || StringUtils.isEmpty(token) || StringUtils.equals("undefined", token)
|| StringUtils.equals("null", token)) {
String resourceId = panelLink.getResourceId();
String pwd = "dataease";
String tk = JWTUtils.signLink(resourceId, panelLink.getUserId(), pwd);
@ -170,7 +184,8 @@ public class PanelLinkService {
httpServletResponse.setHeader("LINK-PWD-TOKEN", tk);
return false;
}
if (StringUtils.isEmpty(panelLink.getPwd())) return false;
if (StringUtils.isEmpty(panelLink.getPwd()))
return false;
return JWTUtils.verifyLink(token, panelLink.getResourceId(), panelLink.getUserId(), panelLink.getPwd());
}
@ -206,11 +221,32 @@ public class PanelLinkService {
example.createCriteria().andResourceIdEqualTo(resourceId).andUserIdEqualTo(AuthUtils.getUser().getUserId());
List<PanelLinkMapping> mappings = panelLinkMappingMapper.selectByExample(example);
PanelLinkMapping mapping = mappings.get(0);
return SHORT_URL_PREFIX + mapping.getId();
String uuid = mapping.getUuid();
return contextPath + SHORT_URL_PREFIX + (StringUtils.isBlank(uuid) ? mapping.getId() : uuid);
}
public String getUrlByIndex(Long index) {
PanelLinkMapping mapping = panelLinkMappingMapper.selectByPrimaryKey(index);
String resourceId = mapping.getResourceId();
Long userId = mapping.getUserId();
PanelLink one = findOne(resourceId, userId);
if (StringUtils.isNotBlank(mapping.getUuid())) {
one.setResourceId("error-resource-id");
}
return convertDto(one).getUri();
}
public String getUrlByUuid(String uuid) {
PanelLinkMappingExample example = new PanelLinkMappingExample();
example.createCriteria().andUuidEqualTo(uuid);
List<PanelLinkMapping> mappings = panelLinkMappingMapper.selectByExample(example);
if (CollectionUtils.isEmpty(mappings)) {
PanelLink panelLink = new PanelLink();
panelLink.setResourceId("error-resource-id");
return BASEURL + buildLinkParam(panelLink);
}
PanelLinkMapping mapping = mappings.get(0);
String resourceId = mapping.getResourceId();
Long userId = mapping.getUserId();
PanelLink one = findOne(resourceId, userId);

View File

@ -0,0 +1 @@
server.servlet.context-path=/de-api

View File

@ -0,0 +1 @@
server.servlet.context-path=

View File

@ -1,3 +1,4 @@
spring.profiles.active=@profiles.active@
spring.application.name=dataease
server.port=8081

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,6 @@
</javaClientGenerator>
<!--要生成的数据库表 -->
<table tableName="dataset_column_permissions"/>
<table tableName="chart_view"/>
</context>
</generatorConfiguration>

View File

@ -118,4 +118,5 @@ i18n_calc_field_error=Field expression error
i18n_cp_exist=Column permission of the same type already exists
connection_failed=Connection Failed
theme_name_repeat=name of theme has been existed
theme_name_empty=name can not be empty
theme_name_empty=name can not be empty
i18n_public_chart=【Public Chart】

View File

@ -118,3 +118,4 @@ i18n_cp_exist=已有同类型的列权限存在
connection_failed=连接失败
theme_name_repeat=名称已存在
theme_name_empty=名称不能为空
i18n_public_chart=【存量视图】

View File

@ -119,3 +119,4 @@ i18n_cp_exist=已有同類型的列權限存在
connection_failed=連接失敗
theme_name_repeat=名稱已存在
theme_name_empty=名稱不能為空
i18n_public_chart=【存量视图】

View File

@ -4,5 +4,5 @@ NODE_ENV = production
ENV = 'staging'
# base api
VUE_APP_BASE_API = '/stage-api'
VUE_APP_BASE_API = '/de-api/'

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>dataease-server</artifactId>
<groupId>io.dataease</groupId>
<version>1.7.0</version>
<version>1.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -28,11 +28,11 @@ export function getChartTree(data) {
})
}
export function chartCopy(id) {
export function chartCopy(id, panelId) {
return request({
url: '/chart/view/chartCopy/' + id,
url: '/chart/view/chartCopy/' + id + '/' + panelId,
method: 'post',
loading: true
loading: false
})
}
export function chartGroupTree(data) {
@ -69,3 +69,10 @@ export function ajaxGetDataOnly(id, data) {
data
})
}
export function pluginTypes() {
return request({
url: '/plugin/view/types',
method: 'post'
})
}

View File

@ -154,3 +154,11 @@ export function initPanelData(panelId, callback) {
callback(response)
})
}
export function queryPanelViewTree() {
return request({
url: '/panel/group/queryPanelViewTree',
method: 'post'
})
}

View File

@ -1,14 +1,15 @@
<template>
<component
:is="mode"
:ref="refId"
:obj="obj"
v-bind="$attrs"
v-on="$listeners"
:obj="obj"
/>
</template>
<script>
import { uuid } from 'vue-uuid'
import { get } from '@/api/system/dynamic'
export default {
@ -28,7 +29,8 @@ export default {
data() {
return {
resData: '',
mode: ''
mode: '',
refId: null
}
},
watch: {
@ -59,8 +61,17 @@ export default {
}
}
},
created() {
this.refId = uuid.v1
},
methods: {
/* chartResize() {
this.$refs[this.refId] && this.$refs[this.refId].chartResize && this.$refs[this.refId].chartResize()
}, */
callPluginInner(param) {
const { methodName, methodParam } = param
this.$refs[this.refId] && this.$refs[this.refId][methodName] && this.$refs[this.refId][methodName](methodParam)
}
}
}
</script>

View File

@ -53,7 +53,7 @@ export default {
}
//
initPanelData(this.panelId, function() {
this.dataLoading = false
_this.dataLoading = false
//
const tempParam = localStorage.getItem('jumpInfoParam')
if (tempParam) {

View File

@ -16,8 +16,15 @@
{{ $t('chart.chart_error_tips') }}
</div>
</div>
<plugin-com
v-if="chart.isPlugin"
:ref="element.propValue.id"
:component-name="chart.type + '-view'"
:obj="{chart, trackMenu, searchCount, terminalType: scaleCoefficientType}"
class="chart-class"
/>
<chart-component
v-if="charViewShowFlag"
v-else-if="charViewShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
@ -28,7 +35,7 @@
@onJumpClick="jumpClick"
/>
<chart-component-g2
v-if="charViewG2ShowFlag"
v-else-if="charViewG2ShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
@ -38,7 +45,7 @@
@onJumpClick="jumpClick"
/>
<chart-component-s2
v-if="charViewS2ShowFlag"
v-else-if="charViewS2ShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
@ -48,13 +55,13 @@
@onJumpClick="jumpClick"
/>
<table-normal
v-if="tableShowFlag"
v-else-if="tableShowFlag"
:ref="element.propValue.id"
:show-summary="chart.type === 'table-normal'"
:chart="chart"
class="table-class"
/>
<label-normal v-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
<label-normal v-else-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
<div style="position: absolute;left: 8px;bottom:8px;">
<drill-path :drill-filters="drillFilters" @onDrillJump="drillJump" />
</div>
@ -69,7 +76,7 @@ import ChartComponent from '@/views/chart/components/ChartComponent.vue'
import TableNormal from '@/views/chart/components/table/TableNormal'
import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
import { uuid } from 'vue-uuid'
import bus from '@/utils/bus'
import { mapState } from 'vuex'
import { isChange } from '@/utils/conditionUtil'
import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
@ -82,10 +89,10 @@ import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
import EditBarView from '@/components/canvas/components/Editor/EditBarView'
import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import PluginCom from '@/views/system/plugin/PluginCom'
export default {
name: 'UserView',
components: { ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
components: { PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
props: {
element: {
type: Object,
@ -108,6 +115,7 @@ export default {
required: false,
default: false
},
// eslint-disable-next-line vue/require-default-prop
componentIndex: {
type: Number,
required: false
@ -156,6 +164,9 @@ export default {
sourceCustomStyleStr: null
}
},
mounted() {
this.bindPluginEvent()
},
computed: {
scaleCoefficient() {
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
@ -260,6 +271,7 @@ export default {
},
watch: {
'cfilters': {
handler: function(val1, val2) {
if (isChange(val1, val2) && !this.isFirstLoad) {
@ -286,7 +298,9 @@ export default {
}
// gap
if (this.preCanvasPanel && this.preCanvasPanel.gap !== newVal.panel.gap) {
this.$refs[this.element.propValue.id].chartResize()
this.chart.isPlugin
? this.$refs[this.element.propValue.id].callPluginInner({ methodName: 'chartResize' })
: this.$refs[this.element.propValue.id].chartResize()
}
this.preCanvasPanel = deepCopy(newVal.panel)
},
@ -301,7 +315,9 @@ export default {
this.changeIndex++
this.chartResize(this.changeIndex)
} else {
this.$refs[this.element.propValue.id].chartResize()
this.chart.isPlugin
? this.$refs[this.element.propValue.id].callPluginInner({ methodName: 'chartResize' })
: this.$refs[this.element.propValue.id].chartResize()
}
}
},
@ -320,7 +336,8 @@ export default {
}
},
'chartType': function(newVal, oldVal) {
if (newVal === 'map' && newVal !== oldVal) {
// this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
if ((newVal === 'map' || newVal === 'buddle-map') && newVal !== oldVal) {
this.initAreas()
}
},
@ -334,6 +351,7 @@ export default {
deep: true
}
},
created() {
this.refId = uuid.v1
if (this.element && this.element.propValue && this.element.propValue.viewId) {
@ -343,6 +361,14 @@ export default {
}
},
methods: {
bindPluginEvent() {
bus.$on('plugin-chart-click', this.chartClick)
bus.$on('plugin-jump-click', this.jumpClick)
bus.$on('plugin-add-view-track-filter', this.addViewTrackFilter)
},
addViewTrackFilter(linkageParam) {
this.$store.commit('addViewTrackFilter', linkageParam)
},
//
mergeScale() {
const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
@ -459,7 +485,7 @@ export default {
chartClick(param) {
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
this.chart.type === 'map' && this.sendToChildren(param)
(this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param)
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
this.getData(this.element.propValue.viewId)
} else if (this.chart.drillFields.length > 0) {
@ -529,17 +555,22 @@ export default {
resetDrill() {
const length = this.drillClickDimensionList.length
this.drillClickDimensionList = []
if (this.chart.type === 'map') {
if (this.chart.type === 'map' || this.chart.type === 'buddle-map') {
this.backToParent(0, length)
const current = this.$refs[this.element.propValue.id]
current && current.registerDynamicMap && current.registerDynamicMap(null)
if (this.chart.isPlugin) {
current && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: null })
} else {
current && current.registerDynamicMap && current.registerDynamicMap(null)
}
}
},
drillJump(index) {
const length = this.drillClickDimensionList.length
this.drillClickDimensionList = this.drillClickDimensionList.slice(0, index)
if (this.chart.type === 'map') {
if (this.chart.type === 'map' || this.chart.type === 'buddle-map') {
this.backToParent(index, length)
}
this.getData(this.element.propValue.viewId)
@ -558,7 +589,11 @@ export default {
this.currentAcreaNode = tempNode
const current = this.$refs[this.element.propValue.id]
current && current.registerDynamicMap && current.registerDynamicMap(this.currentAcreaNode.code)
if (this.chart.isPlugin) {
current && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: this.currentAcreaNode.code })
} else {
current && current.registerDynamicMap && current.registerDynamicMap(this.currentAcreaNode.code)
}
},
//
@ -575,7 +610,11 @@ export default {
const nextNode = currentNode.children.find(item => item.name === name)
this.currentAcreaNode = nextNode
const current = this.$refs[this.element.propValue.id]
nextNode && current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
if (this.chart.isPlugin) {
nextNode && current && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: nextNode.code })
} else {
nextNode && current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
}
}
},
@ -604,7 +643,12 @@ export default {
const areaNode = this.findEntityByname(name, [])
if (!areaNode) return
const current = this.$refs[this.element.propValue.id]
current && current.registerDynamicMap && current.registerDynamicMap(areaNode.code)
if (this.chart.isPlugin) {
current && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: areaNode.code })
} else {
current && current.registerDynamicMap && current.registerDynamicMap(areaNode.code)
}
},
// areaCode
findEntityByname(name, array) {
@ -632,7 +676,9 @@ export default {
if (this.$refs[this.element.propValue.id]) {
this.timeMachine = setTimeout(() => {
if (index === this.changeIndex) {
this.$refs[this.element.propValue.id].chartResize()
this.chart.isPlugin
? this.$refs[this.element.propValue.id].callPluginInner({ methodName: 'chartResize' })
: this.$refs[this.element.propValue.id].chartResize()
}
this.destroyTimeMachine()
}, 50)

View File

@ -47,7 +47,7 @@ export default {
// 如果是用户视图 测先进行底层复制
if (data.type === 'view') {
chartCopy(data.propValue.viewId).then(res => {
chartCopy(data.propValue.viewId, state.panel.panelInfo.id).then(res => {
const newView = deepCopy(data)
newView.id = uuid.v1()
newView.propValue.viewId = res.data

View File

@ -227,7 +227,7 @@ class TimeDateRangeServiceImpl extends WidgetService {
}
getParam(element) {
let timeArr = []
if (element.options.attrs.default.isDynamic) {
if (element.options.attrs.default && element.options.attrs.default.isDynamic) {
let value = this.dynamicDateFormNow(element)
value = this.formatFilterValue(value)
timeArr = this.formatValues(value, element)

View File

@ -157,7 +157,7 @@ class TimeDateServiceImpl extends WidgetService {
}
getParam(element) {
let timeArr = []
if (element.options.attrs.default.isDynamic) {
if (element.options.attrs.default && element.options.attrs.default.isDynamic) {
let value = this.dynamicDateFormNow(element)
value = this.formatFilterValue(value)
timeArr = this.formatValues(value, element)

View File

@ -123,7 +123,7 @@ class TimeMonthServiceImpl extends WidgetService {
}
getParam(element) {
let timeArr = []
if (element.options.attrs.default.isDynamic) {
if (element.options.attrs.default && element.options.attrs.default.isDynamic) {
let value = this.dynamicDateFormNow(element)
value = this.formatFilterValue(value)
timeArr = this.formatValues(value, element)

View File

@ -114,7 +114,7 @@ class TimeYearServiceImpl extends WidgetService {
}
getParam(element) {
let timeArr = []
if (element.options.attrs.default.isDynamic) {
if (element.options.attrs.default && element.options.attrs.default.isDynamic) {
let value = this.dynamicDateFormNow(element)
value = this.formatFilterValue(value)
timeArr = this.formatValues(value, element)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -1 +1 @@
<svg t="1630896178915" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1969" width="200" height="200"><path d="M85.333333 170.666667h853.333334v170.666666H85.333333zM85.333333 384h170.666667v469.333333H85.333333z" p-id="1970"></path><path d="M298.666667 384h640v128H298.666667z" opacity=".6" p-id="1971"></path><path d="M298.666667 554.666667h298.666666v128H298.666667zM640 554.666667h298.666667v128H640z" p-id="1972"></path><path d="M298.666667 725.333333h298.666666v128H298.666667zM640 725.333333h298.666667v128H640z" opacity=".6" p-id="1973"></path></svg>
<svg t="1644288854112" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1947" width="200" height="200"><path d="M85.333333 170.666667h853.333334v170.666666H85.333333zM85.333333 384h170.666667v469.333333H85.333333z" p-id="1948"></path><path d="M298.666667 384h640v128H298.666667z" opacity=".6" p-id="1949"></path><path d="M298.666667 554.666667h640v128H298.666667z" p-id="1950"></path><path d="M298.666667 725.333333h640v128H298.666667z" opacity=".6" p-id="1951"></path></svg>

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 519 B

View File

@ -0,0 +1 @@
<svg t="1630896178915" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1969" width="200" height="200"><path d="M85.333333 170.666667h853.333334v170.666666H85.333333zM85.333333 384h170.666667v469.333333H85.333333z" p-id="1970"></path><path d="M298.666667 384h640v128H298.666667z" opacity=".6" p-id="1971"></path><path d="M298.666667 554.666667h298.666666v128H298.666667zM640 554.666667h298.666667v128H640z" p-id="1972"></path><path d="M298.666667 725.333333h298.666666v128H298.666667zM640 725.333333h298.666667v128H640z" opacity=".6" p-id="1973"></path></svg>

After

Width:  |  Height:  |  Size: 603 B

View File

@ -1020,7 +1020,16 @@ export default {
table_config: 'Table Config',
table_column_width_config: 'Column Width',
table_column_adapt: 'Adapt',
table_column_custom: 'Custom'
table_column_custom: 'Custom',
chart_table_pivot: 'Pivot Table',
table_pivot_row: 'Data Row',
field_error_tips: 'This field is changed(Include dimension、quotafield typedeleted),please edit again.',
table_border_color: 'Border Color',
table_header_align: 'Header Align',
table_item_align: 'Body Align',
table_align_left: 'Left',
table_align_center: 'Center',
table_align_right: 'Right'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
@ -1577,16 +1586,17 @@ export default {
},
auth: {
authConfig: 'Auth Config',
authConfig: 'Configure Permissions By User',
sourceConfig: 'Configure Permissions By Source',
authQuickConfig: 'Auth Quick Config',
dept: 'Dept',
role: 'Role',
user: 'User',
linkAuth: 'Datasource Permissions',
datasetAuth: 'Dataset Permissions',
chartAuth: 'Chart Permissions',
panelAuth: 'Dashboard Permissions',
menuAuth: 'Menu and operation permission',
linkAuth: 'Datasource',
datasetAuth: 'Dataset',
chartAuth: 'Chart',
panelAuth: 'Panel',
menuAuth: 'Menu And Operation',
deptHead: 'All Dept',
roleHead: 'All Role',
userHead: 'All User',

View File

@ -1020,7 +1020,16 @@ export default {
table_config: '表格配置',
table_column_width_config: '列寬調整',
table_column_adapt: '自適應',
table_column_custom: '自定義'
table_column_custom: '自定義',
chart_table_pivot: '透視表',
table_pivot_row: '數據行',
field_error_tips: '該字段所對應的數據集原始字段發生變更(包括維度、指標,字段類型,字段被刪除等),建議重新編輯',
table_border_color: '邊框顏色',
table_header_align: '表頭對齊方式',
table_item_align: '表格對齊方式',
table_align_left: '左對齊',
table_align_center: '居中',
table_align_right: '右對齊'
},
dataset: {
sheet_warn: '有多個 Sheet 頁,默認抽取第一個',
@ -1586,16 +1595,17 @@ export default {
},
auth: {
authConfig: '權限配置',
authConfig: '按用户配置權限',
sourceConfig: '按资源配置權限',
authQuickConfig: '權限快捷配置',
dept: '組織',
role: '角色',
user: '用戶',
linkAuth: '數據源權限',
datasetAuth: '數據集權限',
chartAuth: '視圖權限',
panelAuth: '儀錶闆權限',
menuAuth: '菜單和操作權限',
linkAuth: '數據源',
datasetAuth: '數據集',
chartAuth: '視圖',
panelAuth: '儀錶闆',
menuAuth: '菜單和操作',
deptHead: '所有組織',
roleHead: '所有角色',
userHead: '所有用戶',

View File

@ -1023,7 +1023,16 @@ export default {
table_config: '表格配置',
table_column_width_config: '列宽调整',
table_column_adapt: '自适应',
table_column_custom: '自定义'
table_column_custom: '自定义',
chart_table_pivot: '透视表',
table_pivot_row: '数据行',
field_error_tips: '该字段所对应的数据集原始字段发生变更(包括维度、指标,字段类型,字段被删除等),建议重新编辑',
table_border_color: '边框颜色',
table_header_align: '表头对齐方式',
table_item_align: '表格对齐方式',
table_align_left: '左对齐',
table_align_center: '居中',
table_align_right: '右对齐'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
@ -1595,16 +1604,17 @@ export default {
},
auth: {
authConfig: '权限配置',
authConfig: '按用户配置权限',
sourceConfig: '按资源配置权限',
authQuickConfig: '权限快捷配置',
dept: '组织',
role: '角色',
user: '用户',
linkAuth: '数据源权限',
datasetAuth: '数据集权限',
chartAuth: '视图权限',
panelAuth: '仪表板权限',
menuAuth: '菜单和操作权限',
linkAuth: '数据源',
datasetAuth: '数据集',
chartAuth: '视图',
panelAuth: '仪表板',
menuAuth: '菜单和操作',
deptHead: '所有组织',
roleHead: '所有角色',
userHead: '所有用户',

View File

@ -24,9 +24,11 @@ import DeComplexSelect from '@/components/business/condition-table/DeComplexSele
import '@/components/canvas/custom-component' // 注册自定义组件
import '@/utils/DateUtil'
import draggable from 'vuedraggable'
Vue.config.productionTip = false
Vue.use(VueClipboard)
Vue.use(widgets)
Vue.component('draggable', draggable)
Vue.prototype.$api = api
import * as echarts from 'echarts'

View File

@ -14,7 +14,7 @@ import Cookies from 'js-cookie'
const getTimeOut = () => {
let time = 10
const url = '/system/requestTimeOut'
const url = process.env.VUE_APP_BASE_API + 'system/requestTimeOut'
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {

View File

@ -2,12 +2,13 @@ export const DEFAULT_COLOR_CASE = {
value: 'default',
colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
alpha: 100,
tableHeaderBgColor: '#4e81bb',
tableItemBgColor: '#c6d9f0',
tableHeaderBgColor: '#e1eaff',
tableItemBgColor: '#ffffff',
tableFontColor: '#000000',
tableStripe: true,
dimensionColor: '#000000',
quotaColor: '#000000'
quotaColor: '#000000',
tableBorderColor: '#cfdaf4'
}
export const DEFAULT_SIZE = {
barDefault: true,
@ -31,8 +32,10 @@ export const DEFAULT_SIZE = {
tableTitleHeight: 36,
tableItemHeight: 36,
tablePageSize: '20',
tableColumnMode: 'adapt',
tableColumnMode: 'custom',
tableColumnWidth: 100,
tableHeaderAlign: 'left',
tableItemAlign: 'right',
gaugeMin: 0,
gaugeMax: 100,
gaugeStartAngle: 225,

View File

@ -2,26 +2,81 @@ import { hexColorToRGBA } from '@/views/chart/chart/util'
import { DEFAULT_COLOR_CASE, DEFAULT_SIZE } from '@/views/chart/chart/chart'
export function getCustomTheme(chart) {
const headerColor = hexColorToRGBA(DEFAULT_COLOR_CASE.tableHeaderBgColor, DEFAULT_COLOR_CASE.alpha)
const itemColor = hexColorToRGBA(DEFAULT_COLOR_CASE.tableItemBgColor, DEFAULT_COLOR_CASE.alpha)
const borderColor = hexColorToRGBA(DEFAULT_COLOR_CASE.tableBorderColor, DEFAULT_COLOR_CASE.alpha)
const headerAlign = DEFAULT_SIZE.tableHeaderAlign
const itemAlign = DEFAULT_SIZE.tableItemAlign
const theme = {
background: {
color: '#00000000'
},
colCell: {
splitLine: {
horizontalBorderColor: borderColor,
verticalBorderColor: borderColor
},
cornerCell: {
cell: {
backgroundColor: hexColorToRGBA(DEFAULT_COLOR_CASE.tableHeaderBgColor, DEFAULT_COLOR_CASE.alpha)
backgroundColor: headerColor,
horizontalBorderColor: borderColor,
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
}
},
rowCell: {
cell: {
backgroundColor: headerColor,
horizontalBorderColor: borderColor,
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
}
},
colCell: {
cell: {
backgroundColor: headerColor,
horizontalBorderColor: borderColor,
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
}
},
dataCell: {
cell: {
backgroundColor: hexColorToRGBA(DEFAULT_COLOR_CASE.tableItemBgColor, DEFAULT_COLOR_CASE.alpha)
backgroundColor: itemColor,
horizontalBorderColor: borderColor,
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableItemFontSize
fontSize: DEFAULT_SIZE.tableItemFontSize,
textAlign: itemAlign
}
}
}
@ -32,16 +87,58 @@ export function getCustomTheme(chart) {
// color
if (customAttr.color) {
const c = JSON.parse(JSON.stringify(customAttr.color))
theme.colCell.cell.backgroundColor = hexColorToRGBA(c.tableHeaderBgColor, c.alpha)
const h_c = hexColorToRGBA(c.tableHeaderBgColor, c.alpha)
const i_c = hexColorToRGBA(c.tableItemBgColor, c.alpha)
const b_c = c.tableBorderColor ? hexColorToRGBA(c.tableBorderColor, c.alpha) : hexColorToRGBA(DEFAULT_COLOR_CASE.tableBorderColor, c.alpha)
theme.splitLine.horizontalBorderColor = b_c
theme.splitLine.verticalBorderColor = b_c
theme.cornerCell.cell.backgroundColor = h_c
theme.cornerCell.cell.horizontalBorderColor = b_c
theme.cornerCell.cell.verticalBorderColor = b_c
theme.cornerCell.bolderText.fill = c.tableFontColor
theme.cornerCell.text.fill = c.tableFontColor
theme.rowCell.cell.backgroundColor = h_c
theme.rowCell.cell.horizontalBorderColor = b_c
theme.rowCell.cell.verticalBorderColor = b_c
theme.rowCell.bolderText.fill = c.tableFontColor
theme.rowCell.text.fill = c.tableFontColor
theme.colCell.cell.backgroundColor = h_c
theme.colCell.cell.horizontalBorderColor = b_c
theme.colCell.cell.verticalBorderColor = b_c
theme.colCell.bolderText.fill = c.tableFontColor
theme.dataCell.cell.backgroundColor = hexColorToRGBA(c.tableItemBgColor, c.alpha)
theme.colCell.text.fill = c.tableFontColor
theme.dataCell.cell.backgroundColor = i_c
theme.dataCell.cell.horizontalBorderColor = b_c
theme.dataCell.cell.verticalBorderColor = b_c
theme.dataCell.text.fill = c.tableFontColor
}
// size
if (customAttr.size) {
const s = JSON.parse(JSON.stringify(customAttr.size))
const h_a = s.tableHeaderAlign ? s.tableHeaderAlign : DEFAULT_SIZE.tableHeaderAlign
const i_a = s.tableItemAlign ? s.tableItemAlign : DEFAULT_SIZE.tableItemAlign
theme.cornerCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.cornerCell.bolderText.textAlign = h_a
theme.cornerCell.text.fontSize = parseInt(s.tableTitleFontSize)
theme.cornerCell.text.textAlign = h_a
theme.rowCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.bolderText.textAlign = h_a
theme.rowCell.text.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.text.textAlign = h_a
theme.colCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.colCell.bolderText.textAlign = h_a
theme.colCell.text.fontSize = parseInt(s.tableTitleFontSize)
theme.colCell.text.textAlign = h_a
theme.dataCell.text.fontSize = parseInt(s.tableItemFontSize)
theme.dataCell.text.textAlign = i_a
}
}
@ -62,7 +159,7 @@ export function getSize(chart) {
size.cellCfg = {
height: s.tableItemHeight
}
if (!s.tableColumnMode || s.tableColumnMode === 'adapt') {
if (s.tableColumnMode && s.tableColumnMode === 'adapt') {
delete size.cellCfg.width
size.layoutWidthType = 'compact'
} else {

View File

@ -1,10 +1,10 @@
import { TableSheet, S2Event } from '@antv/s2'
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
export function baseTableInfo(s2, container, chart, action, tableData) {
const containerDom = document.getElementById(container)
// data
// fields
const fields = chart.data.fields
if (!fields || fields.length === 0) {
if (s2) {
@ -102,7 +102,7 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
export function baseTableNormal(s2, container, chart, action, tableData) {
const containerDom = document.getElementById(container)
// data
// fields
const fields = chart.data.fields
if (!fields || fields.length === 0) {
if (s2) {
@ -190,3 +190,111 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
return s2
}
export function baseTablePivot(s2, container, chart, action, tableData) {
const containerDom = document.getElementById(container)
// row and column
const columnFields = JSON.parse(chart.xaxis)
const rowFields = JSON.parse(chart.xaxisExt)
const valueFields = JSON.parse(chart.yaxis)
const c = []; const r = []; const v = []
columnFields.forEach(ele => {
c.push(ele.dataeaseName)
})
rowFields.forEach(ele => {
r.push(ele.dataeaseName)
})
valueFields.forEach(ele => {
v.push(ele.dataeaseName)
})
// fields
const fields = chart.data.fields
if (!fields || fields.length === 0) {
if (s2) {
s2.destroy()
}
return
}
const columns = []
const meta = []
// add drill list
if (chart.drill) {
const drillFields = JSON.parse(chart.drillFields)
const drillField = drillFields[chart.drillFilters.length]
const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters))
const drillExp = drillFilters[drillFilters.length - 1].datasetTableField
// 移除所有下钻字段
const removeField = []
for (let i = 0; i < chart.drillFilters.length; i++) {
const ele = chart.drillFilters[i].datasetTableField
removeField.push(ele.dataeaseName)
}
// build field
fields.forEach(ele => {
if (removeField.indexOf(ele.dataeaseName) < 0) {
// 用下钻字段替换当前字段
if (drillExp.dataeaseName === ele.dataeaseName) {
columns.push(drillField.dataeaseName)
meta.push({
field: drillField.dataeaseName,
name: drillField.name
})
} else {
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
})
}
}
})
} else {
fields.forEach(ele => {
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
name: ele.name
})
})
}
// data config
const s2DataConfig = {
fields: {
rows: r,
columns: c,
values: v
},
meta: meta,
data: tableData
}
// options
const s2Options = {
width: containerDom.offsetWidth,
height: containerDom.offsetHeight,
style: getSize(chart)
}
// 开始渲染
if (s2) {
s2.destroy()
}
s2 = new PivotSheet(containerDom, s2DataConfig, s2Options)
// click
s2.on(S2Event.DATA_CELL_CLICK, action)
// theme
const customTheme = getCustomTheme(chart)
s2.setThemeCfg({ theme: customTheme })
return s2
}

View File

@ -26,3 +26,284 @@ export function digToHex(dig) {
}
return prefix.concat(num.toString(16).toUpperCase())
}
export const TYPE_CONFIGS = [
{
render: 'antv',
category: 'chart.chart_type_table',
value: 'table-normal',
title: 'chart.chart_table_normal',
icon: 'table-normal'
},
{
render: 'antv',
category: 'chart.chart_type_table',
value: 'table-info',
title: 'chart.chart_table_info',
icon: 'table-info'
},
{
render: 'antv',
category: 'chart.chart_type_table',
value: 'table-pivot',
title: 'chart.chart_table_pivot',
icon: 'table-pivot'
},
{
render: 'antv',
category: 'chart.chart_type_quota',
value: 'text',
title: 'chart.chart_card',
icon: 'text'
},
{
render: 'antv',
category: 'chart.chart_type_quota',
value: 'gauge',
title: 'chart.chart_gauge',
icon: 'gauge'
},
{
render: 'antv',
category: 'chart.chart_type_quota',
value: 'liquid',
title: 'chart.chart_liquid',
icon: 'liquid'
},
{
render: 'antv',
category: 'chart.chart_type_trend',
value: 'line',
title: 'chart.chart_line',
icon: 'line'
},
{
render: 'antv',
category: 'chart.chart_type_trend',
value: 'line-stack',
title: 'chart.chart_line_stack',
icon: 'line-stack'
},
{
render: 'antv',
category: 'chart.chart_type_compare',
value: 'bar',
title: 'chart.chart_bar',
icon: 'bar'
},
{
render: 'antv',
category: 'chart.chart_type_compare',
value: 'bar-stack',
title: 'chart.chart_bar_stack',
icon: 'bar-stack'
},
{
render: 'antv',
category: 'chart.chart_type_compare',
value: 'waterfall',
title: 'chart.chart_waterfall',
icon: 'waterfall'
},
{
render: 'antv',
category: 'chart.chart_type_compare',
value: 'bar-horizontal',
title: 'chart.chart_bar_horizontal',
icon: 'bar-horizontal'
},
{
render: 'antv',
category: 'chart.chart_type_compare',
value: 'bar-stack-horizontal',
title: 'chart.chart_bar_stack_horizontal',
icon: 'bar-stack-horizontal'
},
{
render: 'antv',
category: 'chart.chart_type_distribute',
value: 'pie',
title: 'chart.chart_pie',
icon: 'pie'
},
{
render: 'antv',
category: 'chart.chart_type_distribute',
value: 'pie-rose',
title: 'chart.chart_pie_rose',
icon: 'pie-rose'
},
{
render: 'antv',
category: 'chart.chart_type_distribute',
value: 'radar',
title: 'chart.chart_radar',
icon: 'radar'
},
{
render: 'antv',
category: 'chart.chart_type_distribute',
value: 'treemap',
title: 'chart.chart_treemap',
icon: 'treemap'
},
{
render: 'antv',
category: 'chart.chart_type_distribute',
value: 'word-cloud',
title: 'chart.chart_word_cloud',
icon: 'word-cloud'
},
{
render: 'antv',
category: 'chart.chart_type_relation',
value: 'scatter',
title: 'chart.chart_scatter',
icon: 'scatter'
},
{
render: 'antv',
category: 'chart.chart_type_relation',
value: 'funnel',
title: 'chart.chart_funnel',
icon: 'funnel'
},
/* 下面是echarts图表类型 */
{
render: 'echarts',
category: 'chart.chart_type_table',
value: 'table-normal',
title: 'chart.chart_table_normal',
icon: 'table-normal'
},
{
render: 'echarts',
category: 'chart.chart_type_table',
value: 'table-info',
title: 'chart.chart_table_info',
icon: 'table-info'
},
{
render: 'echarts',
category: 'chart.chart_type_quota',
value: 'text',
title: 'chart.chart_card',
icon: 'text'
},
{
render: 'echarts',
category: 'chart.chart_type_quota',
value: 'gauge',
title: 'chart.chart_gauge',
icon: 'gauge'
},
{
render: 'echarts',
category: 'chart.chart_type_trend',
value: 'line',
title: 'chart.chart_line',
icon: 'line'
},
{
render: 'echarts',
category: 'chart.chart_type_trend',
value: 'line-stack',
title: 'chart.chart_line_stack',
icon: 'line-stack'
},
{
render: 'echarts',
category: 'chart.chart_type_trend',
value: 'chart-mix',
title: 'chart.chart_mix',
icon: 'chart-mix'
},
{
render: 'echarts',
category: 'chart.chart_type_compare',
value: 'bar',
title: 'chart.chart_bar',
icon: 'bar'
},
{
render: 'echarts',
category: 'chart.chart_type_compare',
value: 'bar-stack',
title: 'chart.chart_bar_stack',
icon: 'bar-stack'
},
{
render: 'echarts',
category: 'chart.chart_type_compare',
value: 'bar-horizontal',
title: 'chart.chart_bar_horizontal',
icon: 'bar-horizontal'
},
{
render: 'echarts',
category: 'chart.chart_type_compare',
value: 'bar-stack-horizontal',
title: 'chart.chart_bar_stack_horizontal',
icon: 'bar-stack-horizontal'
},
{
render: 'echarts',
category: 'chart.chart_type_distribute',
value: 'pie',
title: 'chart.chart_pie',
icon: 'pie'
},
{
render: 'echarts',
category: 'chart.chart_type_distribute',
value: 'pie-rose',
title: 'chart.chart_pie_rose',
icon: 'pie-rose'
},
{
render: 'echarts',
category: 'chart.chart_type_distribute',
value: 'radar',
title: 'chart.chart_radar',
icon: 'radar'
},
{
render: 'echarts',
category: 'chart.chart_type_distribute',
value: 'treemap',
title: 'chart.chart_treemap',
icon: 'treemap'
},
{
render: 'echarts',
category: 'chart.chart_type_relation',
value: 'scatter',
title: 'chart.chart_scatter',
icon: 'scatter'
},
{
render: 'echarts',
category: 'chart.chart_type_relation',
value: 'funnel',
title: 'chart.chart_funnel',
icon: 'funnel'
},
{
render: 'echarts',
category: 'chart.chart_type_space',
value: 'map',
title: 'chart.chart_map',
icon: 'map'
}
]

View File

@ -4,9 +4,10 @@
<span v-if="chart.type" v-show="title_show" ref="title" :style="title_class" style="cursor: default;display: block;">
<p style="padding:6px 10px 0 10px;margin: 0;overflow: hidden;white-space: pre;text-overflow: ellipsis;">{{ chart.title }}</p>
</span>
<div style="width: 100%;overflow: hidden;padding: 8px;" :style="{height:chartHeight,background:container_bg_class.background}">
<div ref="tableContainer" style="width: 100%;overflow: hidden;padding: 8px;" :style="{background:container_bg_class.background}">
<div v-if="chart.type === 'table-normal'" :id="chartId" style="width: 100%;overflow: hidden;" :class="chart.drill ? 'table-dom-normal-drill' : 'table-dom-normal'" />
<div v-if="chart.type === 'table-info'" :id="chartId" style="width: 100%;overflow: hidden;" :class="chart.drill ? 'table-dom-info-drill' : 'table-dom-info'" />
<div v-if="chart.type === 'table-pivot'" :id="chartId" style="width: 100%;overflow: hidden;" class="table-dom-normal" />
<el-row v-show="chart.type === 'table-info'" class="table-page">
<span class="total-style">
{{ $t('chart.total') }}
@ -34,7 +35,7 @@
import { uuid } from 'vue-uuid'
import ViewTrackBar from '@/components/canvas/components/Editor/ViewTrackBar'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { baseTableInfo, baseTableNormal } from '@/views/chart/chart/table/table-info'
import { baseTableInfo, baseTableNormal, baseTablePivot } from '@/views/chart/chart/table/table-info'
export default {
name: 'ChartComponentS2',
@ -134,7 +135,7 @@ export default {
methods: {
initData() {
let datas = []
if (this.chart.data) {
if (this.chart.data && this.chart.data.fields) {
this.fields = JSON.parse(JSON.stringify(this.chart.data.fields))
const attr = JSON.parse(this.chart.customAttr)
this.currentPage.pageSize = parseInt(attr.size.tablePageSize ? attr.size.tablePageSize : 20)
@ -189,6 +190,8 @@ export default {
this.myChart = baseTableInfo(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else if (chart.type === 'table-normal') {
this.myChart = baseTableNormal(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else if (chart.type === 'table-pivot') {
this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else {
if (this.myChart) {
this.antVRenderStatus = false
@ -338,6 +341,7 @@ export default {
if (this.$refs.title) {
const titleHeight = this.$refs.title.offsetHeight
this.chartHeight = (currentHeight - titleHeight) + 'px'
this.$refs.tableContainer.style.height = this.chartHeight
}
}
})

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="colorForm" :model="colorForm" label-width="80px" size="mini" :disabled="param && !hasDataPermission('manage',param.privileges)">
<el-form ref="colorForm" :model="colorForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.color')" class="form-item">
<el-color-picker v-model="colorForm.color" class="color-picker-style" :predefine="predefineColors" @change="changeBackgroundStyle" />
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="legendForm" :model="legendForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="legendForm" :model="legendForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="legendForm.show" @change="changeLegendStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="legendForm" :model="legendForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="legendForm" :model="legendForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="legendForm.show" @change="changeLegendStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="splitForm" :model="splitForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="splitForm" :model="splitForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.name')" class="form-item">
<el-checkbox v-model="splitForm.name.show" @change="changeSplitStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="splitForm" :model="splitForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="splitForm" :model="splitForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.name')" class="form-item">
<el-checkbox v-model="splitForm.name.show" @change="changeSplitStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="titleForm" :model="titleForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="titleForm" :model="titleForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="titleForm.show" @change="changeTitleStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="titleForm" :model="titleForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="titleForm" :model="titleForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="titleForm.show" @change="changeTitleStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="axisForm.show" @change="changeXAxisStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="axisForm.show" @change="changeXAxisStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="axisForm.show" @change="changeYAxisStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="axisForm.show" @change="changeYAxisStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="axisForm.show" @change="changeYAxisStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini" :disabled="!hasDataPermission('manage',param.privileges)">
<el-form ref="axisForm" :model="axisForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.show')" class="form-item">
<el-checkbox v-model="axisForm.show" @change="changeYAxisStyle">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>

View File

@ -1,23 +1,8 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
<svg-icon v-if="item.sort === 'asc'" icon-class="sort-asc" class-name="field-icon-sort" />
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<el-dropdown trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -27,6 +12,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.summary" class="summary-span">{{ $t('chart.'+item.summary) }}</span>
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
@ -120,8 +106,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'ChartDragItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -138,10 +128,30 @@ export default {
conf: {
type: String,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -208,6 +218,9 @@ export default {
return {
type: type
}
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -0,0 +1,256 @@
<template>
<span>
<el-dropdown trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
<svg-icon v-if="item.sort === 'asc'" icon-class="sort-asc" class-name="field-icon-sort" />
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="sort">
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-sort" />
<span>{{ $t('chart.sort') }}</span>
<span class="summary-span-item">({{ $t('chart.'+item.sort) }})</span>
</span>
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSort('asc')">{{ $t('chart.asc') }}</el-dropdown-item>
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item v-show="item.deType === 1" divided>
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="dateStyle">
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-c-scale-to-original" />
<span>{{ $t('chart.dateStyle') }}</span>
<span class="summary-span-item">({{ $t('chart.'+item.dateStyle) }})</span>
</span>
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeDateStyle('y')">{{ $t('chart.y') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M')">{{ $t('chart.y_M') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d')">{{ $t('chart.y_M_d') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('H_m_s')" divided>{{ $t('chart.H_m_s') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m')">{{ $t('chart.y_M_d_H_m') }}</el-dropdown-item>
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m_s')">{{ $t('chart.y_M_d_H_m_s') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item v-show="item.deType === 1">
<el-dropdown placement="right-start" size="mini" style="width: 100%" @command="datePattern">
<span class="el-dropdown-link inner-dropdown-menu">
<span>
<i class="el-icon-timer" />
<span>{{ $t('chart.datePattern') }}</span>
<span class="summary-span-item">({{ $t('chart.'+item.datePattern) }})</span>
</span>
<i class="el-icon-arrow-right el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeDatePattern('date_sub')">{{ $t('chart.date_sub') }}(1990-01-01)</el-dropdown-item>
<el-dropdown-item :command="beforeDatePattern('date_split')">{{ $t('chart.date_split') }}(1990/01/01)</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
<span>{{ $t('chart.show_name_set') }}</span>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-delete" divided :command="beforeClickItem('remove')">
<span>{{ $t('chart.delete') }}</span>
</el-dropdown-item>
</el-dropdown-menu>
</span>
</el-dropdown>
</span>
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'DimensionExtItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
required: true
},
item: {
type: Object,
required: true
},
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
},
methods: {
clickItem(param) {
if (!param) {
return
}
switch (param.type) {
case 'rename':
this.showRename()
break
case 'remove':
this.removeItem()
break
case 'filter':
this.editFilter()
break
default:
break
}
},
beforeClickItem(type) {
return {
type: type
}
},
sort(param) {
// console.log(param)
this.item.sort = param.type
this.$emit('onDimensionItemChange', this.item)
},
beforeSort(type) {
return {
type: type
}
},
dateStyle(param) {
// console.log(param)
this.item.dateStyle = param.type
this.$emit('onDimensionItemChange', this.item)
},
beforeDateStyle(type) {
return {
type: type
}
},
datePattern(param) {
this.item.datePattern = param.type
this.$emit('onDimensionItemChange', this.item)
},
beforeDatePattern(type) {
return {
type: type
}
},
editFilter() {
this.item.index = this.index
this.$emit('editItemFilter', this.item)
},
showRename() {
this.item.index = this.index
this.item.renameType = 'dimensionExt'
this.$emit('onNameEdit', this.item)
},
removeItem() {
this.item.index = this.index
this.item.removeType = 'dimensionExt'
this.$emit('onDimensionItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}
</script>
<style scoped>
.item-axis {
padding: 1px 6px;
margin: 0 3px 2px 3px;
text-align: left;
height: 24px;
line-height: 22px;
display: flex;
border-radius: 4px;
box-sizing: border-box;
white-space: nowrap;
width: 159px;
}
.item-axis:hover {
background-color: #fdfdfd;
cursor: pointer;
}
span {
font-size: 12px;
}
.summary-span{
margin-left: 4px;
color: #878d9f;
position: absolute;
right: 25px;
}
.inner-dropdown-menu{
display: flex;
justify-content: space-between;
align-items: center;
width: 100%
}
.item-span-style{
display: inline-block;
width: 70px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.summary-span-item{
margin-left: 4px;
color: #878d9f;
}
</style>

View File

@ -1,22 +1,8 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
<svg-icon v-if="item.sort === 'asc'" icon-class="sort-asc" class-name="field-icon-sort" />
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<el-dropdown trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -26,6 +12,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
@ -103,8 +90,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'DimensionItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -117,10 +108,27 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -190,7 +198,11 @@ export default {
},
removeItem() {
this.item.index = this.index
this.item.removeType = 'dimension'
this.$emit('onDimensionItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,19 +1,8 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
<svg-icon v-if="item.sort === 'asc'" icon-class="sort-asc" class-name="field-icon-sort" />
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<el-dropdown trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -23,6 +12,7 @@
<svg-icon v-if="item.sort === 'desc'" icon-class="sort-desc" class-name="field-icon-sort" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
<el-dropdown-menu slot="dropdown">
@ -36,8 +26,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'DrillItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -50,10 +44,30 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -79,6 +93,9 @@ export default {
removeItem() {
this.item.index = this.index
this.$emit('onDimensionItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

View File

@ -1,17 +1,8 @@
<template>
<span>
<el-tag v-if="!hasDataPermission('manage',param.privileges)" size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
</el-tag>
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
<el-dropdown trigger="click" size="mini" @command="clickItem">
<span class="el-dropdown-link">
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
<el-tag size="small" class="item-axis" :type="tagType">
<span style="float: left">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
@ -19,6 +10,7 @@
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
<el-dropdown-menu slot="dropdown">
@ -35,8 +27,12 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/drag-item/utils'
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
export default {
name: 'FilterItem',
components: { FieldErrorTips },
props: {
param: {
type: Object,
@ -49,10 +45,30 @@ export default {
index: {
type: Number,
required: true
},
dimensionData: {
type: Array,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
tagType: getItemType(this.dimensionData, this.quotaData, this.item)
}
},
watch: {
dimensionData: function() {
this.getItemTagType()
},
quotaData: function() {
this.getItemTagType()
},
item: function() {
this.getItemTagType()
}
},
mounted() {
@ -85,6 +101,9 @@ export default {
removeItem() {
this.item.index = this.index
this.$emit('onFilterItemRemove', this.item)
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
}
}
}

Some files were not shown because too many files have changed in this diff Show More