Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	backend/src/main/resources/generatorConfig.xml
#	frontend/src/lang/en.js
#	frontend/src/lang/tw.js
#	frontend/src/lang/zh.js
#	frontend/src/views/chart/view/ChartEdit.vue
This commit is contained in:
wangjiahao 2022-03-10 10:48:18 +08:00
commit fea735fb5d
59 changed files with 1971 additions and 474 deletions

View File

@ -1,26 +1,11 @@
FROM registry.cn-qingdao.aliyuncs.com/dataease/fabric8-java-alpine-openjdk8-jre:edge-chromium
# 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
# ADD simsun.ttc /usr/share/fonts/
# RUN cd /usr/share/fonts/ \
# && mkfontscale \
# && mkfontdir \
# && fc-cache -fv
ARG IMAGE_TAG
RUN mkdir -p /opt/apps
RUN mkdir -p /opt/dataease/data/feature/full
RUN mkdir -p /opt/apps /opt/dataease/data/feature/full /opt/dataease/drivers
ADD mapFiles/* /opt/dataease/data/feature/full/
RUN mkdir -p /opt/dataease/drivers
ADD drivers/* /opt/dataease/drivers/
ADD backend/target/backend-$IMAGE_TAG.jar /opt/apps

View File

@ -106,6 +106,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
<scope>runtime</scope>
</dependency>
<dependency>
@ -279,6 +280,16 @@
<artifactId>json-path</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
</dependencies>
<build>
@ -403,7 +414,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>com.itfsw</groupId>

View File

@ -1,6 +1,5 @@
package io.dataease.auth.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -39,4 +38,7 @@ public class SysUserEntity implements Serializable {
@ApiModelProperty(hidden = true)
private Boolean isAdmin;
@ApiModelProperty(hidden = true)
private Integer from;
}

View File

@ -141,7 +141,7 @@ public class AuthServer implements AuthApi {
@Override
public Boolean useInitPwd() {
CurrentUserDto user = AuthUtils.getUser();
if (null == user) {
if (null == user || 0 != user.getFrom()) {
return false;
}
String md5 = CodingUtil.md5(DEFAULT_PWD);

View File

@ -1,39 +1,42 @@
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;
private String title;
private String sceneId;
@ApiModelProperty("数据集ID")
private String tableId;
@ApiModelProperty("图表类型")
private String type;
@ApiModelProperty("渲染方式")
private String render;
@ApiModelProperty("展示结果数量")
private Integer resultCount;
@ApiModelProperty("展示结果")
private String resultMode;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("场景ID")
private String sceneId;
@ApiModelProperty("创建人")
private String createBy;
@ApiModelProperty("创建时间")
private Long createTime;
@ApiModelProperty("更新时间")
private Long updateTime;
@ApiModelProperty("样式优先级")
private String stylePriority;
@ApiModelProperty("public or private")
private String chartType;
@ApiModelProperty("是否插件")
private Boolean isPlugin;
private static final long serialVersionUID = 1L;
}
}

View File

@ -244,146 +244,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 andSceneIdIsNull() {
addCriterion("scene_id is null");
return (Criteria) this;
}
public Criteria andSceneIdIsNotNull() {
addCriterion("scene_id is not null");
return (Criteria) this;
}
public Criteria andSceneIdEqualTo(String value) {
addCriterion("scene_id =", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotEqualTo(String value) {
addCriterion("scene_id <>", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdGreaterThan(String value) {
addCriterion("scene_id >", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdGreaterThanOrEqualTo(String value) {
addCriterion("scene_id >=", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLessThan(String value) {
addCriterion("scene_id <", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLessThanOrEqualTo(String value) {
addCriterion("scene_id <=", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLike(String value) {
addCriterion("scene_id like", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotLike(String value) {
addCriterion("scene_id not like", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdIn(List<String> values) {
addCriterion("scene_id in", values, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotIn(List<String> values) {
addCriterion("scene_id not in", values, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdBetween(String value1, String value2) {
addCriterion("scene_id between", value1, value2, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotBetween(String value1, String value2) {
addCriterion("scene_id not between", value1, value2, "sceneId");
return (Criteria) this;
}
public Criteria andTableIdIsNull() {
addCriterion("table_id is null");
return (Criteria) this;
@ -724,6 +584,146 @@ 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;
}
public Criteria andSceneIdIsNotNull() {
addCriterion("scene_id is not null");
return (Criteria) this;
}
public Criteria andSceneIdEqualTo(String value) {
addCriterion("scene_id =", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotEqualTo(String value) {
addCriterion("scene_id <>", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdGreaterThan(String value) {
addCriterion("scene_id >", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdGreaterThanOrEqualTo(String value) {
addCriterion("scene_id >=", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLessThan(String value) {
addCriterion("scene_id <", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLessThanOrEqualTo(String value) {
addCriterion("scene_id <=", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLike(String value) {
addCriterion("scene_id like", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotLike(String value) {
addCriterion("scene_id not like", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdIn(List<String> values) {
addCriterion("scene_id in", values, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotIn(List<String> values) {
addCriterion("scene_id not in", values, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdBetween(String value1, String value2) {
addCriterion("scene_id between", value1, value2, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotBetween(String value1, String value2) {
addCriterion("scene_id not between", value1, value2, "sceneId");
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
return (Criteria) this;
@ -1207,4 +1207,4 @@ public class ChartViewExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -1,6 +1,8 @@
package io.dataease.base.domain;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ -9,27 +11,30 @@ import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ChartViewWithBLOBs extends ChartView implements Serializable {
@ApiModelProperty("x轴")
private String xAxis;
@ApiModelProperty("x副轴")
private String xAxisExt;
@ApiModelProperty("y轴")
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 senior;
@ApiModelProperty("视图截图快照")
private String snapshot;
private static final long serialVersionUID = 1L;
}
}

View File

@ -4,13 +4,13 @@
<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="scene_id" jdbcType="VARCHAR" property="sceneId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
@ -29,6 +29,7 @@
<result column="custom_style" jdbcType="LONGVARCHAR" property="customStyle" />
<result column="custom_filter" jdbcType="LONGVARCHAR" property="customFilter" />
<result column="drill_fields" jdbcType="LONGVARCHAR" property="drillFields" />
<result column="senior" jdbcType="LONGVARCHAR" property="senior" />
<result column="snapshot" jdbcType="LONGVARCHAR" property="snapshot" />
</resultMap>
<sql id="Example_Where_Clause">
@ -90,12 +91,12 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, title, scene_id, table_id, `type`, render, result_count, result_mode,
id, `name`, table_id, `type`, render, result_count, result_mode, title, scene_id,
create_by, create_time, update_time, style_priority, chart_type, is_plugin
</sql>
<sql id="Blob_Column_List">
x_axis, x_axis_ext, 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, senior, snapshot
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.ChartViewExample" resultMap="ResultMapWithBLOBs">
select
@ -128,7 +129,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
@ -146,24 +147,26 @@
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
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, 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}, #{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}, #{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})
insert into chart_view (id, `name`, table_id,
`type`, render, result_count,
result_mode, title, scene_id,
create_by, create_time, update_time,
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, senior, snapshot
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{render,jdbcType=VARCHAR}, #{resultCount,jdbcType=INTEGER},
#{resultMode,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{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}, #{senior,jdbcType=LONGVARCHAR}, #{snapshot,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
insert into chart_view
@ -174,12 +177,6 @@
<if test="name != null">
`name`,
</if>
<if test="title != null">
title,
</if>
<if test="sceneId != null">
scene_id,
</if>
<if test="tableId != null">
table_id,
</if>
@ -195,6 +192,12 @@
<if test="resultMode != null">
result_mode,
</if>
<if test="title != null">
title,
</if>
<if test="sceneId != null">
scene_id,
</if>
<if test="createBy != null">
create_by,
</if>
@ -243,6 +246,9 @@
<if test="drillFields != null">
drill_fields,
</if>
<if test="senior != null">
senior,
</if>
<if test="snapshot != null">
snapshot,
</if>
@ -254,12 +260,6 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
#{sceneId,jdbcType=VARCHAR},
</if>
<if test="tableId != null">
#{tableId,jdbcType=VARCHAR},
</if>
@ -275,6 +275,12 @@
<if test="resultMode != null">
#{resultMode,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
#{sceneId,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@ -323,6 +329,9 @@
<if test="drillFields != null">
#{drillFields,jdbcType=LONGVARCHAR},
</if>
<if test="senior != null">
#{senior,jdbcType=LONGVARCHAR},
</if>
<if test="snapshot != null">
#{snapshot,jdbcType=LONGVARCHAR},
</if>
@ -343,12 +352,6 @@
<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>
<if test="record.tableId != null">
table_id = #{record.tableId,jdbcType=VARCHAR},
</if>
@ -364,6 +367,12 @@
<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.sceneId != null">
scene_id = #{record.sceneId,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
@ -412,6 +421,9 @@
<if test="record.drillFields != null">
drill_fields = #{record.drillFields,jdbcType=LONGVARCHAR},
</if>
<if test="record.senior != null">
senior = #{record.senior,jdbcType=LONGVARCHAR},
</if>
<if test="record.snapshot != null">
snapshot = #{record.snapshot,jdbcType=LONGVARCHAR},
</if>
@ -424,13 +436,13 @@
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},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
@ -447,6 +459,7 @@
custom_style = #{record.customStyle,jdbcType=LONGVARCHAR},
custom_filter = #{record.customFilter,jdbcType=LONGVARCHAR},
drill_fields = #{record.drillFields,jdbcType=LONGVARCHAR},
senior = #{record.senior,jdbcType=LONGVARCHAR},
snapshot = #{record.snapshot,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -456,13 +469,13 @@
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},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
@ -479,12 +492,6 @@
<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>
<if test="tableId != null">
table_id = #{tableId,jdbcType=VARCHAR},
</if>
@ -500,6 +507,12 @@
<if test="resultMode != null">
result_mode = #{resultMode,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
scene_id = #{sceneId,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
@ -548,6 +561,9 @@
<if test="drillFields != null">
drill_fields = #{drillFields,jdbcType=LONGVARCHAR},
</if>
<if test="senior != null">
senior = #{senior,jdbcType=LONGVARCHAR},
</if>
<if test="snapshot != null">
snapshot = #{snapshot,jdbcType=LONGVARCHAR},
</if>
@ -557,13 +573,13 @@
<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},
scene_id = #{sceneId,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
@ -580,19 +596,20 @@
custom_style = #{customStyle,jdbcType=LONGVARCHAR},
custom_filter = #{customFilter,jdbcType=LONGVARCHAR},
drill_fields = #{drillFields,jdbcType=LONGVARCHAR},
senior = #{senior,jdbcType=LONGVARCHAR},
snapshot = #{snapshot,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<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},
scene_id = #{sceneId,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
@ -601,4 +618,4 @@
is_plugin = #{isPlugin,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
</mapper>

View File

@ -12,6 +12,7 @@
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="enabled" property="enabled"/>
<result column="is_admin" jdbcType="BIT" property="isAdmin"/>
<result column="from" property="from"/>
</resultMap>
<resultMap id="roleMap" type="io.dataease.auth.api.dto.CurrentRoleDto">
@ -21,19 +22,19 @@
<select id="findUser" resultMap="baseMap">
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language,is_admin from sys_user where user_id = #{userId}
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language,is_admin, `from` from sys_user where user_id = #{userId}
</select>
<select id="findUserByName" resultMap="baseMap">
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin from sys_user where username = #{username}
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin, `from` from sys_user where username = #{username}
</select>
<select id="findLdapUserByName" resultMap="baseMap">
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin from sys_user a where username = #{username} and a.from = 1
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin, `from` from sys_user a where username = #{username} and a.from = 1
</select>
<select id="findUserBySub" resultMap="baseMap">
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin from sys_user where sub = #{sub}
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin, `from` from sys_user where sub = #{sub}
</select>
<select id="roleCodes" resultType="String">

View File

@ -9,9 +9,9 @@
</resultMap>
<select id="searchOneWithPrivileges" resultMap="BaseResultMapDTO">
select
chart_view.*
from chart_view where id = #{id}
select chart_view.*
from chart_view
where id = #{id}
</select>
<select id="searchOne" resultMap="BaseResultMapDTO">
@ -88,7 +88,7 @@
<where>
FIND_IN_SET(chart_view.id,cids)
<if test="sceneId != null">
and scene_id = #{sceneId,jdbcType=VARCHAR}
and scene_id = #{sceneId,jdbcType=VARCHAR}
</if>
<if test="name != null">
and name like CONCAT('%', #{name},'%')
@ -99,158 +99,183 @@
</select>
<insert id="chartCopy">
INSERT INTO chart_view (
`id`,
`name`,
`scene_id`,
`table_id`,
`type`,
`title`,
`x_axis`,
`x_axis_ext`,
`y_axis`,
`custom_attr`,
`custom_style`,
`custom_filter`,
`drill_fields`,
`create_by`,
`create_time`,
`update_time`,
`snapshot`,
`style_priority`,
`ext_stack`,
`ext_bubble`,
`y_axis_ext`,
`render`,
`result_count`,
`result_mode`,
`chart_type`
) SELECT
#{newChartId},
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
#{panelId},
`table_id`,
`type`,
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
`x_axis`,
`x_axis_ext`,
`y_axis`,
`custom_attr`,
`custom_style`,
`custom_filter`,
`drill_fields`,
`create_by`,
`create_time`,
`update_time`,
`snapshot`,
`style_priority`,
`ext_stack`,
`ext_bubble`,
`y_axis_ext`,
`render`,
`result_count`,
`result_mode`,
'private'
FROM
chart_view
WHERE
id = #{oldChartId}
INSERT INTO chart_view (`id`,
`name`,
`scene_id`,
`table_id`,
`type`,
`title`,
`x_axis`,
`x_axis_ext`,
`y_axis`,
`custom_attr`,
`custom_style`,
`custom_filter`,
`drill_fields`,
`create_by`,
`create_time`,
`update_time`,
`snapshot`,
`style_priority`,
`ext_stack`,
`ext_bubble`,
`y_axis_ext`,
`render`,
`result_count`,
`result_mode`,
`chart_type`,
`senior`)
SELECT #{newChartId},
GET_CHART_VIEW_COPY_NAME(#{oldChartId}),
#{panelId},
`table_id`,
`type`,
GET_CHART_VIEW_COPY_NAME(#{oldChartId}),
`x_axis`,
`x_axis_ext`,
`y_axis`,
`custom_attr`,
`custom_style`,
`custom_filter`,
`drill_fields`,
`create_by`,
`create_time`,
`update_time`,
`snapshot`,
`style_priority`,
`ext_stack`,
`ext_bubble`,
`y_axis_ext`,
`render`,
`result_count`,
`result_mode`,
'private',
`senior`
FROM chart_view
WHERE id = #{oldChartId}
</insert>
<select id="searchAdviceSceneId" resultType="String">
SELECT DISTINCT
( scene_id )
FROM
( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{userId}, 'chart' ) cids ) t,
panel_view
LEFT JOIN chart_view ON panel_view.chart_view_id = chart_view.id
LEFT JOIN chart_group ON chart_view.scene_id = chart_group.id
WHERE
FIND_IN_SET( chart_view.scene_id, cids ) and panel_view.panel_id =#{panelId}
ORDER BY
chart_group.create_time DESC
LIMIT 1
SELECT DISTINCT (scene_id)
FROM (SELECT GET_V_AUTH_MODEL_ID_P_USE(#{userId}, 'chart') cids) t,
panel_view
LEFT JOIN chart_view ON panel_view.chart_view_id = chart_view.id
LEFT JOIN chart_group ON chart_view.scene_id = chart_group.id
WHERE FIND_IN_SET(chart_view.scene_id, cids)
and panel_view.panel_id = #{panelId}
ORDER BY chart_group.create_time DESC LIMIT 1
</select>
<select id="checkSameDataSet" resultType="int">
select count(DISTINCT table_id) from chart_view where id = #{viewIdSource} or id = #{viewIdTarget}
select count(DISTINCT table_id)
from chart_view
where id = #{viewIdSource}
or id = #{viewIdTarget}
</select>
<insert id ='chartCopyWithPanel'>
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,
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
) SELECT
pv_copy.chart_view_id AS id,
`name`,
title,
pv_copy.panel_id AS scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
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
FROM
(
SELECT
panel_id,
copy_from_view,
chart_view_id
FROM
panel_view
WHERE
copy_id = #{copyId}
) pv_copy
LEFT JOIN chart_view ON chart_view.id = pv_copy.copy_from_view
<insert id='chartCopyWithPanel'>
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,
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)
SELECT pv_copy.chart_view_id AS id,
`name`,
title,
pv_copy.panel_id AS scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
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
FROM (
SELECT panel_id,
copy_from_view,
chart_view_id
FROM panel_view
WHERE copy_id = #{copyId}
) pv_copy
LEFT JOIN chart_view ON chart_view.id = pv_copy.copy_from_view
</insert>
<delete id="deleteCircleView">
delete chart_view from (select GET_CHART_GROUP_WITH_CHILDREN(#{pid}) cids) t,chart_view where FIND_IN_SET(chart_view.id,cids) and chart_type='public'
delete
chart_view from (select GET_CHART_GROUP_WITH_CHILDREN(
#{pid}
)
cids
)
t,
chart_view
where
FIND_IN_SET
(
chart_view
.
id,
cids
)
and
chart_type
=
'public'
</delete>
<delete id="deleteCircleGroup">
delete chart_group from (select GET_CHART_GROUP_WITH_CHILDREN(#{pid}) cids) t,chart_group where FIND_IN_SET(chart_group.id,cids)
delete
chart_group from (select GET_CHART_GROUP_WITH_CHILDREN(
#{pid}
)
cids
)
t,
chart_group
where
FIND_IN_SET
(
chart_group
.
id,
cids
)
</delete>

View File

@ -0,0 +1,23 @@
package io.dataease.commons.condition;
import io.dataease.commons.utils.CommonBeanFactory;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class RedisStatusCondition implements Condition {
private static final String DEFAULT_TYPE = "ehcache";
private static final String TARGET_TYPE = "redis";
private static final String TYPE_KEY = "spring.cache.type";
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
Environment environment = context.getEnvironment();
String ehcacheType = environment.getProperty(TYPE_KEY, String.class, DEFAULT_TYPE);
return StringUtils.equals(TARGET_TYPE, ehcacheType);
}
}

View File

@ -0,0 +1,27 @@
package io.dataease.config;
import io.dataease.commons.condition.RedisStatusCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
@Configuration
public class RedisConfig {
@Conditional({RedisStatusCondition.class})
@Bean
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(factory);
Jackson2JsonRedisSerializer<Object> serializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
redisTemplate.setDefaultSerializer(serializer);
return redisTemplate;
}
}

View File

@ -26,17 +26,18 @@ public class DataSetTableUnionController {
@Resource
private DataSetTableUnionService dataSetTableUnionService;
@DePermission(type = DePermissionType.DATASET, value = "sourceTableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("保存")
@PostMapping("save")
public DatasetTableUnion save(@RequestBody DatasetTableUnion datasetTableUnion) {
return dataSetTableUnionService.save(datasetTableUnion);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@DePermission(type = DePermissionType.DATASET, value = "sourceTableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) {
dataSetTableUnionService.delete(id);
@PostMapping("delete")
public void delete(@RequestBody DatasetTableUnion datasetTableUnion) {
dataSetTableUnionService.delete(datasetTableUnion.getId());
}
@DePermission(type = DePermissionType.DATASET)

View File

@ -1,30 +1,46 @@
package io.dataease.listener.util;
import io.dataease.commons.utils.CommonBeanFactory;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.context.annotation.Configuration;
import java.util.Date;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import java.util.Date;
import java.util.concurrent.TimeUnit;
@Configuration
public class CacheUtils {
private static CacheManager manager;
private static CacheManager cacheManager;
@Autowired
public void setManager(CacheManager manager) {
CacheUtils.manager = manager;
private static CacheManager getCacheManager() {
if (cacheManager == null)
cacheManager = CommonBeanFactory.getBean(CacheManager.class);
return cacheManager;
}
public static Object get(String cacheName, Object key) {
if (getCacheManager() instanceof RedisCacheManager) {
org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName);
if (null == cache) return null;
return cache.get(key);
}
Element element = cache(cacheName).get(key);
if (null == element) return null;
return element.getObjectValue();
}
public static void put(String cacheName, Object key, Object value, Integer ttl, Integer tti) {
if (getCacheManager() instanceof RedisCacheManager) {
RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate");
ValueOperations valueOperations = redisTemplate.opsForValue();
valueOperations.setIfPresent(cacheName + "::" + key , value );
return;
}
Element e = new Element(key, value);
//不设置则使用xml配置
if (ttl != null) {
@ -33,19 +49,35 @@ public class CacheUtils {
}
if (tti != null)
e.setTimeToIdle(tti);
cache(cacheName).put(e);
Cache cache = cache(cacheName);
if (null != cache)
cache.put(e);
}
public static boolean remove(String cacheName, Object key) {
if (getCacheManager() instanceof RedisCacheManager) {
org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName);
if (null == cache) return false;
return cache.evictIfPresent(key);
}
return cache(cacheName).remove(key);
}
public static void removeAll(String cacheName) {
if (getCacheManager() instanceof RedisCacheManager) {
org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName);
if (null == cache) return;
cache.clear();
return;
}
cache(cacheName).removeAll();
}
private static Cache cache(String cacheName) {
net.sf.ehcache.CacheManager cacheManager = ((EhCacheCacheManager) manager).getCacheManager();
if (getCacheManager() instanceof RedisCacheManager) {
return null;
}
net.sf.ehcache.CacheManager cacheManager = ((EhCacheCacheManager) getCacheManager()).getCacheManager();
if (!cacheManager.cacheExists(cacheName))
cacheManager.addCache(cacheName);
Cache cacheManagerCache = cacheManager.getCache(cacheName);
@ -57,6 +89,12 @@ public class CacheUtils {
long exp = (time - System.currentTimeMillis()) / 1000;
int intExp = (int)exp;
removeAll("lic_info");
if (getCacheManager() instanceof RedisCacheManager) {
RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate");
ValueOperations valueOperations = redisTemplate.opsForValue();
valueOperations.set("lic_info::lic", "lic", exp, TimeUnit.SECONDS);
return;
}
put("lic_info", "lic", "lic", intExp, intExp);
}
}

View File

@ -3,7 +3,6 @@ package io.dataease.service.dataset;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
@ -51,9 +50,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
@ -1181,6 +1181,14 @@ public class DataSetTableService {
DEException.throwException(
Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
CurrentUserDto user = AuthUtils.getUser();
if (user != null && !user.getIsAdmin()) {
DataSetTableDTO withPermission = getWithPermission(datasetTable.getId(), user.getUserId());
if (ObjectUtils.isEmpty(withPermission.getPrivileges()) || !withPermission.getPrivileges().contains("use")) {
DEException.throwException(
Translator.get("i18n_dataset_no_permission") + String.format(":table name [%s]", withPermission.getName()));
}
}
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
String[] array = fields.stream()
@ -1309,6 +1317,14 @@ public class DataSetTableService {
DEException.throwException(
Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
CurrentUserDto user = AuthUtils.getUser();
if (user != null && !user.getIsAdmin()) {
DataSetTableDTO withPermission = getWithPermission(datasetTable.getId(), user.getUserId());
if (ObjectUtils.isEmpty(withPermission.getPrivileges()) || !withPermission.getPrivileges().contains("use")) {
DEException.throwException(
Translator.get("i18n_dataset_no_permission") + String.format(":table name [%s]", withPermission.getName()));
}
}
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
String[] array = fields.stream()

View File

@ -119,9 +119,9 @@ public class ExtractDataService {
private static final String dropTableSql = "DROP TABLE IF EXISTS TABLE_NAME;";
private static final String shellScript = "result=`curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load`\n" +
"if [ $? == 0 ] ; then\n" +
"if [ $? -eq 0 ] ; then\n" +
" failstatus=$(echo $result | grep '\"Status\": \"Fail\"')\n" +
" if [[ \"$failstatus\" != \"\" ]]; then\n" +
" if [ \"x${failstatus}\" != \"x\" ];then" +
" echo $result\n" +
" exit 1\n" +
" fi\n" +
@ -342,34 +342,26 @@ public class ExtractDataService {
try {
if(datasource.getType().equalsIgnoreCase(DatasourceTypes.api.name())){
extractData(datasetTable, datasource, datasetTableFields, "incremental_add", null);
return;
}
DatasetTableIncrementalConfig datasetTableIncrementalConfig = dataSetTableService.incrementalConfig(datasetTableId);
if (datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) {
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, null);
return;
}
if (datasetTable.getLastUpdateTime() == null || datasetTable.getLastUpdateTime() == 0) {
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, null);
saveErrorLog(datasetTableId, taskId, new Exception("未进行全量同步"));
lastExecStatus = JobStatus.Error;
return;
}
}else{
DatasetTableIncrementalConfig datasetTableIncrementalConfig = dataSetTableService.incrementalConfig(datasetTableId);
if (datasetTable.getLastUpdateTime() == null || datasetTable.getLastUpdateTime() == 0) {
throw new Exception("未进行全量同步");
}
execTime = System.currentTimeMillis();
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString())
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
extractData(datasetTable, datasource, datasetTableFields, "incremental_add", sql);
}
execTime = System.currentTimeMillis();
if (datasetTableIncrementalConfig != null && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString())
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
extractData(datasetTable, datasource, datasetTableFields, "incremental_add", sql);
}
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete().replace(" ", ""))) {// 增量删除
String sql = datasetTableIncrementalConfig.getIncrementalDelete().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString())
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
extractData(datasetTable, datasource, datasetTableFields, "incremental_delete", sql);
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete().replace(" ", ""))) {// 增量删除
String sql = datasetTableIncrementalConfig.getIncrementalDelete().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString())
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
extractData(datasetTable, datasource, datasetTableFields, "incremental_delete", sql);
}
}
saveSuccessLog(datasetTableTaskLog);
msg = true;
lastExecStatus = JobStatus.Completed;
} catch (Exception e) {

View File

@ -323,11 +323,14 @@ public class DatasourceService {
public void initAllDataSourceConnectionPool() {
List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample());
datasources.forEach(datasource -> {
try {
handleConnectionPool(datasource, "add");
} catch (Exception e) {
e.printStackTrace();
}
commonThreadPool.addTask(()->{
System.out.println(System.currentTimeMillis());
try {
handleConnectionPool(datasource, "add");
} catch (Exception e) {
LogUtil.error("Failed to init datasource: " + datasource.getName(), e);
}
});
});
}

View File

@ -61,13 +61,14 @@ quartz.scheduler-name=deServerJob
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
# actuator
management.server.port=8083
management.endpoints.web.exposure.include=*
management.health.redis.enabled=false
#management.server.port=8083
#management.endpoints.web.exposure.include=*
#spring.freemarker.checkTemplateLocation=false
#RSA非对称加密参数私钥
rsa.private_key=MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
rsa.public_key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==
spring.cache.type=ehcache
#spring.cache.type=ehcache
spring.cache.ehcache.config=classpath:/ehcache/ehcache.xml
#打印URL路径
#logging.level.org.springframework.web=trace
@ -85,6 +86,32 @@ server.compression.enabled=true
server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
server.compression.min-response-size=1024
#下面的配置新增到/opt/dataease/conf/dataease/properties
#缓存类型
##spring.cache.type=redis
#spring.cache.type=ehcache
#redis公共配置
#spring.redis.timeout=10000
#spring.redis.lettuce.pool.max-active=8
#spring.redis.lettuce.pool.max-wait=-1
#spring.redis.lettuce.pool.max-idle=8
#单机模式redis配置
#spring.redis.database=0
#spring.redis.host=192.168.0.110
#spring.redis.port=6379
#spring.redis.password=DataEase_ZNB@REDIS
#哨兵模式redis配置
#spring.redis.sentinel.master=mymaster
#spring.redis.sentinel.nodes=192.168.0.110:26379,192.168.0.110:26380,192.168.0.110:26381
#spring.redis.sentinel.password=
#cluster模式redis配置
#spring.redis.cluster.nodes=192.168.0.110:7001,192.168.0.110:7002,192.168.0.110:7003,192.168.0.110:7004,192.168.0.110:7005,192.168.0.110:7006
#spring.redis.cluster.max-redirects=3
#spring.redis.password=DataEase_ZNB@REDIS

View File

@ -0,0 +1,2 @@
ALTER TABLE `chart_view` ADD COLUMN `senior` LONGTEXT COMMENT '高级' AFTER `drill_fields`;
UPDATE `chart_view` SET `senior` = '{}';

View File

@ -60,6 +60,8 @@
</javaClientGenerator>
<!--要生成的数据库表 -->
<!-- <table tableName="dataease_code_version"/>-->
<table tableName="chart_view"/>
<table tableName="chart_view_cache"/>
<!-- <table tableName="chart_view"/>-->
<!-- <table tableName="panel_view"/>-->

View File

@ -13,8 +13,9 @@
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},
"dependencies": {
"@antv/g2plot": "^2.3.32",
"@antv/s2": "^1.7.0",
"@antv/g2plot": "^2.4.9",
"@antv/s2": "^1.11.0",
"@antv/util": "^2.0.17",
"@riophae/vue-treeselect": "0.4.0",
"@tinymce/tinymce-vue": "^3.2.8",
"axios": "^0.21.1",

View File

@ -1,6 +1,6 @@
<template>
<div class="de-tabs-div">
<el-tabs v-model="activeTabName" type="card" class="de-tabs">
<el-tabs v-model="activeTabName" type="card" class="de-tabs" @tab-click="handleClick">
<el-tab-pane
v-for="(item, index) in element.options.tabList"
:key="item.name+index"
@ -295,6 +295,15 @@ export default {
},
chartResize() {
// this.$refs[this.activeTabName]
},
handleClick(tab) {
const name = tab.name
this.element.options.tabList.forEach(item => {
if (item && item.name === name && item.content && item.content.propValue && item.content.propValue.viewId) {
this.filterMap[item.content.propValue.viewId] = item.content.filters
}
})
// console.log(tab)
}
}

View File

@ -1031,6 +1031,32 @@ export default {
table_align_center: 'Center',
table_align_right: 'Right',
draw_back: 'Draw Back'
senior: 'Senior',
senior_cfg: 'Senior Config',
function_cfg: 'Function Config',
analyse_cfg: 'Analyse',
slider: 'Slider',
slider_range: 'Range',
chart_no_senior: 'This chart type not support senior config,please look forward to.',
assist_line: 'Assist Line',
field_fixed: 'Fixed',
line_type_dotted: 'Dotted',
value_can_not_empty: 'Value can not be empty',
value_error: 'Value illegal',
threshold: 'Threshold',
threshold_range: 'Range',
gauge_threshold_format_error: 'Format Error',
total_cfg: 'Total Config',
col_cfg: 'Column',
row_cfg: 'Row',
total_show: 'Total',
total_position: 'Position',
total_label: 'Alias',
sub_total_show: 'Sub Total',
total_pos_top: 'Top',
total_pos_bottom: 'Bottom',
total_pos_left: 'Left',
total_pos_right: 'Right'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',

View File

@ -1031,6 +1031,32 @@ export default {
table_align_center: '居中',
table_align_right: '右對齊',
draw_back: '收回'
senior: '高級',
senior_cfg: '高級設置',
function_cfg: '功能設置',
analyse_cfg: '分析預警',
slider: '縮略軸',
slider_range: '默認範圍',
chart_no_senior: '當前圖表類型暫無高級配置,敬請期待',
assist_line: '輔助線',
field_fixed: '固定值',
line_type_dotted: '點',
value_can_not_empty: '值不能為空',
value_error: '值必須為數值',
threshold: '閾值',
threshold_range: '閾值區間',
gauge_threshold_format_error: '格式錯誤',
total_cfg: '總計配置',
col_cfg: '列匯總',
row_cfg: '行匯總',
total_show: '總計',
total_position: '位置',
total_label: '別名',
sub_total_show: '小計',
total_pos_top: '頂部',
total_pos_bottom: '底部',
total_pos_left: '左側',
total_pos_right: '右側'
},
dataset: {
sheet_warn: '有多個 Sheet 頁,默認抽取第一個',

View File

@ -1033,7 +1033,33 @@ export default {
table_align_left: '左对齐',
table_align_center: '居中',
table_align_right: '右对齐',
draw_back: '收回'
draw_back: '收回',
senior: '高级',
senior_cfg: '高级设置',
function_cfg: '功能设置',
analyse_cfg: '分析预警',
slider: '缩略轴',
slider_range: '默认范围',
chart_no_senior: '当前图表类型暂无高级配置,敬请期待',
assist_line: '辅助线',
field_fixed: '固定值',
line_type_dotted: '点',
value_can_not_empty: '值不能为空',
value_error: '值必须为数值',
threshold: '阈值',
threshold_range: '阈值区间',
gauge_threshold_format_error: '格式错误',
total_cfg: '总计配置',
col_cfg: '列汇总',
row_cfg: '行汇总',
total_show: '总计',
total_position: '位置',
total_label: '别名',
sub_total_show: '小计',
total_pos_top: '顶部',
total_pos_bottom: '底部',
total_pos_left: '左侧',
total_pos_right: '右侧'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',

View File

@ -1,5 +1,5 @@
import { hexColorToRGBA } from '../util.js'
import { componentStyle } from '../common/common'
import { componentStyle, seniorCfg } from '../common/common'
export function baseBarOption(chart_option, chart) {
// 处理shape attr
@ -25,7 +25,7 @@ export function baseBarOption(chart_option, chart) {
const y = chart.data.series[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// size
if (customAttr.size) {
@ -48,6 +48,7 @@ export function baseBarOption(chart_option, chart) {
}
// console.log(chart_option);
componentStyle(chart_option, chart)
seniorCfg(chart_option, chart)
return chart_option
}
@ -87,7 +88,7 @@ export function horizontalBarOption(chart_option, chart) {
const y = chart.data.series[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// size
if (customAttr.size) {
@ -110,6 +111,7 @@ export function horizontalBarOption(chart_option, chart) {
}
// console.log(chart_option);
componentStyle(chart_option, chart)
seniorCfg(chart_option, chart)
return chart_option
}

View File

@ -1,5 +1,15 @@
import { Column, Bar } from '@antv/g2plot'
import { getTheme, getLabel, getTooltip, getLegend, getXAxis, getYAxis, getPadding } from '@/views/chart/chart/common/common_antv'
import {
getTheme,
getLabel,
getTooltip,
getLegend,
getXAxis,
getYAxis,
getPadding,
getSlider,
getAnalyse
} from '@/views/chart/chart/common/common_antv'
export function baseBarOptionAntV(plot, container, chart, action, isGroup, isStack) {
// theme
@ -13,6 +23,9 @@ export function baseBarOptionAntV(plot, container, chart, action, isGroup, isSta
const yAxis = getYAxis(chart)
// data
const data = chart.data.datas
// config
const slider = getSlider(chart)
const analyse = getAnalyse(chart)
// options
const options = {
theme: theme,
@ -26,6 +39,8 @@ export function baseBarOptionAntV(plot, container, chart, action, isGroup, isSta
legend: legend,
xAxis: xAxis,
yAxis: yAxis,
slider: slider,
annotations: analyse,
interactions: [
{
type: 'element-active', cfg: {
@ -108,6 +123,9 @@ export function hBaseBarOptionAntV(plot, container, chart, action, isGroup, isSt
const yAxis = getYAxis(chart)
// data
const data = chart.data.datas
// config
const slider = getSlider(chart)
const analyse = getAnalyse(chart)
// options
const options = {
theme: theme,
@ -121,6 +139,8 @@ export function hBaseBarOptionAntV(plot, container, chart, action, isGroup, isSt
legend: legend,
xAxis: xAxis,
yAxis: yAxis,
slider: slider,
annotations: analyse,
interactions: [
{
type: 'element-active', cfg: {

View File

@ -78,6 +78,38 @@ export const DEFAULT_TOOLTIP = {
},
formatter: ''
}
export const DEFAULT_TOTAL = {
row: {
showGrandTotals: true,
showSubTotals: true,
reverseLayout: false,
reverseSubLayout: false,
label: '总计',
subLabel: '小计',
subTotalsDimensions: [],
calcTotals: {
aggregation: 'SUM'
},
calcSubTotals: {
aggregation: 'SUM'
}
},
col: {
showGrandTotals: true,
showSubTotals: true,
reverseLayout: false,
reverseSubLayout: false,
label: '总计',
subLabel: '小计',
subTotalsDimensions: [],
calcTotals: {
aggregation: 'SUM'
},
calcSubTotals: {
aggregation: 'SUM'
}
}
}
export const DEFAULT_TITLE_STYLE = {
show: true,
fontSize: '18',
@ -240,6 +272,13 @@ export const DEFAULT_SPLIT = {
show: true
}
}
export const DEFAULT_FUNCTION_CFG = {
sliderShow: false,
sliderRange: [0, 10]
}
export const DEFAULT_THRESHOLD = {
gaugeThreshold: ''
}
// chart config
export const BASE_BAR = {
title: {

View File

@ -178,3 +178,79 @@ export function componentStyle(chart_option, chart) {
}
}
}
export function seniorCfg(chart_option, chart) {
if (chart.senior && chart.type && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('mix'))) {
const senior = JSON.parse(chart.senior)
if (senior.functionCfg) {
if (senior.functionCfg.sliderShow) {
chart_option.dataZoom = [
{
type: 'inside',
start: parseInt(senior.functionCfg.sliderRange[0]),
end: parseInt(senior.functionCfg.sliderRange[1])
},
{
type: 'slider',
start: parseInt(senior.functionCfg.sliderRange[0]),
end: parseInt(senior.functionCfg.sliderRange[1])
}
]
if (chart.type.includes('horizontal')) {
chart_option.dataZoom[0].yAxisIndex = [0]
chart_option.dataZoom[1].yAxisIndex = [0]
chart_option.dataZoom[1].left = '10px'
}
}
}
if (senior.assistLine && senior.assistLine.length > 0) {
if (chart_option.series && chart_option.series.length > 0) {
chart_option.series[0].markLine = {
symbol: 'none',
data: []
}
senior.assistLine.forEach(ele => {
if (chart.type.includes('horizontal')) {
chart_option.series[0].markLine.data.push({
symbol: 'none',
xAxis: parseFloat(ele.value),
name: ele.name,
lineStyle: {
color: ele.color,
type: ele.lineType
},
label: {
show: true,
color: ele.color,
fontSize: 10,
position: 'insideStartTop'
},
tooltip: {
show: false
}
})
} else {
chart_option.series[0].markLine.data.push({
symbol: 'none',
yAxis: parseFloat(ele.value),
name: ele.name,
lineStyle: {
color: ele.color,
type: ele.lineType
},
label: {
show: true,
color: ele.color,
fontSize: 10,
position: 'insideStartTop'
},
tooltip: {
show: false
}
})
}
})
}
}
}
}

View File

@ -435,3 +435,67 @@ function transAxisPosition(chart, axis) {
return axis.position
}
}
export function getSlider(chart) {
let senior = {}
let cfg = false
if (chart.senior && chart.type && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('mix'))) {
senior = JSON.parse(chart.senior)
if (senior.functionCfg) {
if (senior.functionCfg.sliderShow) {
cfg = {
start: parseInt(senior.functionCfg.sliderRange[0]) / 100,
end: parseInt(senior.functionCfg.sliderRange[1]) / 100
}
}
}
}
return cfg
}
export function getAnalyse(chart) {
let senior = {}
const assistLine = []
if (chart.senior && chart.type && (chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('mix'))) {
senior = JSON.parse(chart.senior)
if (senior.assistLine && senior.assistLine.length > 0) {
senior.assistLine.forEach(ele => {
assistLine.push({
type: 'line',
start: ['start', parseFloat(ele.value)],
end: ['end', parseFloat(ele.value)],
style: {
stroke: ele.color,
lineDash: getLineDash(ele.lineType)
}
})
assistLine.push({
type: 'text',
position: ['start', parseFloat(ele.value)],
content: parseFloat(ele.value),
offsetY: -2,
offsetX: 2,
style: {
textBaseline: 'bottom',
fill: ele.color,
fontSize: 10
}
})
})
}
}
return assistLine
}
function getLineDash(type) {
switch (type) {
case 'solid':
return [0, 0]
case 'dashed':
return [10, 8]
case 'dotted':
return [2, 2]
default:
return [0, 0]
}
}

View File

@ -77,6 +77,11 @@ export function getCustomTheme(chart) {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableItemFontSize,
textAlign: itemAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fontSize: DEFAULT_SIZE.tableItemFontSize,
textAlign: itemAlign
}
}
}
@ -114,6 +119,7 @@ export function getCustomTheme(chart) {
theme.dataCell.cell.backgroundColor = i_c
theme.dataCell.cell.horizontalBorderColor = b_c
theme.dataCell.cell.verticalBorderColor = b_c
theme.dataCell.bolderText.fill = c.tableFontColor
theme.dataCell.text.fill = c.tableFontColor
}
// size
@ -137,6 +143,8 @@ export function getCustomTheme(chart) {
theme.colCell.text.fontSize = parseInt(s.tableTitleFontSize)
theme.colCell.text.textAlign = h_a
theme.dataCell.bolderText.fontSize = parseInt(s.tableItemFontSize)
theme.dataCell.bolderText.textAlign = i_a
theme.dataCell.text.fontSize = parseInt(s.tableItemFontSize)
theme.dataCell.text.textAlign = i_a
}

View File

@ -40,7 +40,7 @@ export function baseFunnelOption(chart_option, chart) {
y.name = chart.data.x[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// y.type = 'funnel'
chart_option.series[0].data.push(y)

View File

@ -1,5 +1,6 @@
import { componentStyle } from '../common/common'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
export function baseGaugeOption(chart_option, chart) {
// 处理shape attr
@ -49,6 +50,57 @@ export function baseGaugeOption(chart_option, chart) {
value: chart.data.series[0].data[0]
}
chart_option.series[0].data.push(y)
// threshold
if (chart.senior) {
const range = []
let index = 0
let flag = false
const senior = JSON.parse(chart.senior)
const threshold = JSON.parse(JSON.stringify(senior.threshold ? senior.threshold : DEFAULT_THRESHOLD))
if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') {
const arr = threshold.gaugeThreshold.split(',')
const per = parseFloat(chart.data.series[0].data[0]) / parseFloat(chart_option.series[0].max)
for (let i = 0; i < arr.length; i++) {
const ele = arr[i]
const p = parseInt(ele) / 100
range.push([p, hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)])
if (!flag && per <= p) {
flag = true
index = i
}
}
if (!flag) {
index = arr.length
}
range.push([1, hexColorToRGBA(customAttr.color.colors[arr.length % customAttr.color.colors.length], customAttr.color.alpha)])
chart_option.series[0].axisLine = {
lineStyle: {
color: range
}
}
chart_option.series[0].itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[index], customAttr.color.alpha)
}
chart_option.series[0].progress = {
show: false
}
chart_option.series[0].axisTick = {
lineStyle: {
color: 'auto'
}
}
chart_option.series[0].splitLine = {
lineStyle: {
color: 'auto'
}
}
chart_option.series[0].axisLabel = {
color: 'auto'
}
}
}
}
}
// console.log(chart_option);

View File

@ -1,6 +1,6 @@
import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv'
import { Gauge } from '@antv/g2plot'
import { DEFAULT_SIZE } from '@/views/chart/chart/chart'
import { DEFAULT_SIZE, DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
export function baseGaugeOptionAntV(plot, container, chart, action) {
let max, labelContent, startAngel, endAngel
@ -33,11 +33,39 @@ export function baseGaugeOptionAntV(plot, container, chart, action) {
labelContent = false
}
}
const per = (parseFloat(data) / parseFloat(max))
const range = [0]
let index = 0
let flag = false
let hasThreshold = false
if (chart.senior) {
const senior = JSON.parse(chart.senior)
const threshold = JSON.parse(JSON.stringify(senior.threshold ? senior.threshold : DEFAULT_THRESHOLD))
if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') {
hasThreshold = true
const arr = threshold.gaugeThreshold.split(',')
for (let i = 0; i < arr.length; i++) {
const ele = arr[i]
const p = parseInt(ele) / 100
range.push(p)
if (!flag && per <= p) {
flag = true
index = i
}
}
if (!flag) {
index = arr.length
}
}
}
range.push(1)
// options
const options = {
theme: theme,
percent: (parseFloat(data) / parseFloat(max)),
percent: per,
startAngle: startAngel,
endAngle: endAngel,
appendPadding: getPadding(chart),
@ -52,6 +80,24 @@ export function baseGaugeOptionAntV(plot, container, chart, action) {
// lineCap: 'round'
// }
}
if (hasThreshold) {
options.range = {
color: theme.styleSheet.paletteQualitative10,
ticks: range
}
options.indicator = {
pointer: {
style: {
stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length]
}
},
pin: {
style: {
stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length]
}
}
}
}
// 开始渲染
if (plot) {

View File

@ -1,5 +1,5 @@
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common'
import { componentStyle, seniorCfg } from '../common/common'
export function baseLineOption(chart_option, chart) {
// 处理shape attr
@ -25,7 +25,7 @@ export function baseLineOption(chart_option, chart) {
const y = chart.data.series[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// size
if (customAttr.size) {
@ -55,6 +55,7 @@ export function baseLineOption(chart_option, chart) {
}
// console.log(chart_option);
componentStyle(chart_option, chart)
seniorCfg(chart_option, chart)
return chart_option
}

View File

@ -1,5 +1,15 @@
import { Line, Area } from '@antv/g2plot'
import { getTheme, getLabel, getTooltip, getLegend, getXAxis, getYAxis, getPadding } from '@/views/chart/chart/common/common_antv'
import {
getTheme,
getLabel,
getTooltip,
getLegend,
getXAxis,
getYAxis,
getPadding,
getSlider,
getAnalyse
} from '@/views/chart/chart/common/common_antv'
export function baseLineOptionAntV(plot, container, chart, action) {
// theme
@ -13,6 +23,9 @@ export function baseLineOptionAntV(plot, container, chart, action) {
const yAxis = getYAxis(chart)
// data
const data = chart.data.datas
// config
const slider = getSlider(chart)
const analyse = getAnalyse(chart)
// options
const options = {
point: {},
@ -27,6 +40,8 @@ export function baseLineOptionAntV(plot, container, chart, action) {
legend: legend,
xAxis: xAxis,
yAxis: yAxis,
slider: slider,
annotations: analyse,
interactions: [
{
type: 'element-active', cfg: {
@ -100,6 +115,9 @@ export function baseAreaOptionAntV(plot, container, chart, action) {
const yAxis = getYAxis(chart)
// data
const data = chart.data.datas
// config
const slider = getSlider(chart)
const analyse = getAnalyse(chart)
// options
const options = {
point: {},
@ -114,6 +132,8 @@ export function baseAreaOptionAntV(plot, container, chart, action) {
legend: legend,
xAxis: xAxis,
yAxis: yAxis,
slider: slider,
annotations: analyse,
interactions: [
{
type: 'element-active', cfg: {

View File

@ -73,7 +73,7 @@ export function baseMapOption(chart_option, chart) {
y.name = chart.data.x[i]
// color
// y.itemStyle = {
// color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
// color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha),
// borderRadius: 0
// }
chart_option.series[0].data.push(y)

View File

@ -1,5 +1,5 @@
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common'
import { componentStyle, seniorCfg } from '../common/common'
export function baseMixOption(chart_option, chart) {
// 处理shape attr
@ -27,7 +27,7 @@ export function baseMixOption(chart_option, chart) {
y.type = y.type ? y.type : 'bar'
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// size
if (customAttr.size) {
@ -68,5 +68,6 @@ export function baseMixOption(chart_option, chart) {
}
// console.log(chart_option);
componentStyle(chart_option, chart)
seniorCfg(chart_option, chart)
return chart_option
}

View File

@ -43,7 +43,7 @@ export function baseMixOptionAntV(plot, container, chart, action) {
const o = {
type: '',
options: {
color: colors[i % 9],
color: colors[i % colors.length],
data: d.data,
xField: 'field',
yField: 'value',

View File

@ -41,7 +41,7 @@ export function basePieOption(chart_option, chart) {
y.name = chart.data.x[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha),
borderRadius: 0
}
y.type = 'pie'
@ -94,7 +94,7 @@ export function rosePieOption(chart_option, chart) {
y.name = chart.data.x[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha),
borderRadius: customAttr.size.pieRoseRadius
}
y.type = 'pie'

View File

@ -33,7 +33,7 @@ export function baseRadarOption(chart_option, chart) {
}
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// label
if (customAttr.label) {

View File

@ -1,5 +1,5 @@
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common'
import { componentStyle, seniorCfg } from '../common/common'
let bubbleArray = []
let terminalType = 'pc'
@ -30,7 +30,7 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') {
const y = chart.data.series[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// size
if (customAttr.size) {
@ -57,6 +57,7 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') {
}
// console.log(chart_option);
componentStyle(chart_option, chart)
seniorCfg(chart_option, chart)
return chart_option
}

View File

@ -1,4 +1,14 @@
import { getTheme, getLabel, getTooltip, getLegend, getXAxis, getYAxis, getPadding } from '@/views/chart/chart/common/common_antv'
import {
getTheme,
getLabel,
getTooltip,
getLegend,
getXAxis,
getYAxis,
getPadding,
getSlider,
getAnalyse
} from '@/views/chart/chart/common/common_antv'
import { Scatter } from '@antv/g2plot'
@ -14,6 +24,9 @@ export function baseScatterOptionAntV(plot, container, chart, action) {
const yAxis = getYAxis(chart)
// data
const data = chart.data.datas
// config
const slider = getSlider(chart)
const analyse = getAnalyse(chart)
// options
const options = {
theme: theme,
@ -27,6 +40,8 @@ export function baseScatterOptionAntV(plot, container, chart, action) {
legend: legend,
xAxis: xAxis,
yAxis: yAxis,
slider: slider,
annotations: analyse,
pieStyle: {
lineWidth: 0
},

View File

@ -1,5 +1,6 @@
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_TOTAL } from '@/views/chart/chart/chart'
export function baseTableInfo(s2, container, chart, action, tableData) {
const containerDom = document.getElementById(container)
@ -281,11 +282,31 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
data: tableData
}
// total config
let totalCfg = {}
const chartObj = JSON.parse(JSON.stringify(chart))
if (chartObj.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chartObj.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chartObj.customAttr))
} else {
customAttr = JSON.parse(chartObj.customAttr)
}
if (customAttr.totalCfg) {
totalCfg = customAttr.totalCfg
} else {
totalCfg = JSON.parse(JSON.stringify(DEFAULT_TOTAL))
}
}
totalCfg.row.subTotalsDimensions = r
totalCfg.col.subTotalsDimensions = c
// options
const s2Options = {
width: containerDom.offsetWidth,
height: containerDom.offsetHeight,
style: getSize(chart)
style: getSize(chart),
totals: totalCfg
}
// 开始渲染

View File

@ -49,7 +49,7 @@ export function baseTreemapOption(chart_option, chart) {
y.name = chart.data.x[i]
// color
y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
}
// y.type = 'treemap'
chart_option.series[0].data.push(y)

View File

@ -0,0 +1,200 @@
<template>
<div style="width: 100%;padding: 0 18px;">
<el-col>
<el-button
:title="$t('chart.edit')"
icon="el-icon-edit"
type="text"
size="small"
style="width: 24px;margin-left: 4px;"
@click="editLine"
/>
<el-col>
<el-row v-for="(item,index) in assistLine" :key="index" class="line-style">
<el-col :span="8">
<span :title="item.name">{{ item.name }}</span>
</el-col>
<el-col :span="8">
<span v-if="item.field === '0'" :title="$t('chart.field_fixed')">{{ $t('chart.field_fixed') }}</span>
</el-col>
<el-col :span="8">
<span :title="item.value">{{ item.value }}</span>
</el-col>
</el-row>
</el-col>
</el-col>
<!--编辑辅助线-->
<el-dialog
v-if="editLineDialog"
v-dialogDrag
:title="$t('chart.assist_line')"
:visible="editLineDialog"
:show-close="false"
width="70%"
class="dialog-css"
>
<assist-line-edit :line="assistLine" @onAssistLineChange="lineChange" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeEditLine">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="changeLine">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import AssistLineEdit from '@/views/chart/components/senior/dialog/AssistLineEdit'
export default {
name: 'AssistLine',
components: { AssistLineEdit },
props: {
chart: {
type: Object,
required: true
}
},
data() {
return {
assistLine: [],
editLineDialog: false,
lineArr: []
}
},
watch: {
'chart': {
handler: function() {
this.initData()
}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.senior) {
let senior = null
if (Object.prototype.toString.call(chart.senior) === '[object Object]') {
senior = JSON.parse(JSON.stringify(chart.senior))
} else {
senior = JSON.parse(chart.senior)
}
if (senior.assistLine) {
this.assistLine = senior.assistLine
} else {
this.assistLine = []
}
}
},
changeAssistLine() {
this.$emit('onAssistLineChange', this.assistLine)
},
lineChange(val) {
this.lineArr = val
},
editLine() {
this.editLineDialog = true
},
closeEditLine() {
this.editLineDialog = false
},
changeLine() {
// check line config
for (let i = 0; i < this.lineArr.length; i++) {
const ele = this.lineArr[i]
if (!ele.name || ele.name === '') {
this.$message({
message: this.$t('chart.name_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (!ele.value) {
this.$message({
message: this.$t('chart.value_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (parseFloat(ele.value).toString() === 'NaN') {
this.$message({
message: this.$t('chart.value_error'),
type: 'error',
showClose: true
})
return
}
}
this.assistLine = JSON.parse(JSON.stringify(this.lineArr))
this.changeAssistLine()
this.closeEditLine()
}
}
}
</script>
<style scoped>
.shape-item{
padding: 6px;
border: none;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.form-item-slider>>>.el-form-item__label{
font-size: 12px;
line-height: 38px;
}
.form-item>>>.el-form-item__label{
font-size: 12px;
}
.el-select-dropdown__item{
padding: 0 20px;
}
span{
font-size: 12px
}
.el-form-item{
margin-bottom: 6px;
}
.switch-style{
position: absolute;
right: 10px;
margin-top: -4px;
}
.color-picker-style{
cursor: pointer;
z-index: 1003;
}
.line-style{
}
.line-style >>> span{
display: inline-block;
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding: 0 10px;
}
.dialog-css >>> .el-dialog__title {
font-size: 14px;
}
.dialog-css >>> .el-dialog__header {
padding: 20px 20px 0;
}
.dialog-css >>> .el-dialog__body {
padding: 10px 20px 20px;
}
</style>

View File

@ -0,0 +1,101 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="functionForm" :model="functionForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.slider')" class="form-item">
<el-checkbox v-model="functionForm.sliderShow" @change="changeFunctionCfg">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
<el-form-item v-show="functionForm.sliderShow" :label="$t('chart.slider_range')+'(%)'" class="form-item form-item-slider">
<el-slider v-model="functionForm.sliderRange" :min="0" :max="100" input-size="mini" range @change="changeFunctionCfg" />
</el-form-item>
</el-form>
</el-col>
</div>
</template>
<script>
import { DEFAULT_FUNCTION_CFG } from '../../chart/chart'
export default {
name: 'FunctionCfg',
props: {
chart: {
type: Object,
required: true
}
},
data() {
return {
functionForm: JSON.parse(JSON.stringify(DEFAULT_FUNCTION_CFG))
}
},
watch: {
'chart': {
handler: function() {
this.initData()
}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.senior) {
let senior = null
if (Object.prototype.toString.call(chart.senior) === '[object Object]') {
senior = JSON.parse(JSON.stringify(chart.senior))
} else {
senior = JSON.parse(chart.senior)
}
if (senior.functionCfg) {
this.functionForm = senior.functionCfg
} else {
this.functionForm = JSON.parse(JSON.stringify(DEFAULT_FUNCTION_CFG))
}
}
},
changeFunctionCfg() {
this.$emit('onFunctionCfgChange', this.functionForm)
}
}
}
</script>
<style scoped>
.shape-item{
padding: 6px;
border: none;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.form-item-slider>>>.el-form-item__label{
font-size: 12px;
line-height: 38px;
}
.form-item>>>.el-form-item__label{
font-size: 12px;
}
.el-select-dropdown__item{
padding: 0 20px;
}
span{
font-size: 12px
}
.el-form-item{
margin-bottom: 6px;
}
.switch-style{
position: absolute;
right: 10px;
margin-top: -4px;
}
.color-picker-style{
cursor: pointer;
z-index: 1003;
}
</style>

View File

@ -0,0 +1,123 @@
<template>
<div style="width: 100%">
<el-col v-if="chart.type && chart.type === 'gauge'">
<el-form ref="thresholdForm" :model="thresholdForm" label-width="80px" size="mini">
<el-form-item :label="$t('chart.threshold_range')+'(%)'" class="form-item">
<span>0,</span>
<el-input v-model="thresholdForm.gaugeThreshold" style="width: 160px;margin: 0 10px;" :placeholder="$t('chart.threshold_range')" size="mini" clearable @change="changeThreshold" />
<span>,100</span>
<el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content">
阈值设置决定仪表盘区间颜色为空则不开启阈值范围(0-100)仅限整数且逐级递增
<br>
例如输入 30,70表示分为3段分别为[0,30],(30,70],(70,100]
</div>
<i class="el-icon-info" style="cursor: pointer;margin-left: 10px;font-size: 12px;" />
</el-tooltip>
</el-form-item>
</el-form>
</el-col>
</div>
</template>
<script>
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
export default {
name: 'Threshold',
props: {
chart: {
type: Object,
required: true
}
},
data() {
return {
thresholdForm: JSON.parse(JSON.stringify(DEFAULT_THRESHOLD))
}
},
watch: {
'chart': {
handler: function() {
this.initData()
}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.senior) {
let senior = null
if (Object.prototype.toString.call(chart.senior) === '[object Object]') {
senior = JSON.parse(JSON.stringify(chart.senior))
} else {
senior = JSON.parse(chart.senior)
}
if (senior.threshold) {
this.thresholdForm = senior.threshold
} else {
this.thresholdForm = JSON.parse(JSON.stringify(DEFAULT_THRESHOLD))
}
}
},
changeThreshold() {
// check input
if (this.thresholdForm.gaugeThreshold) {
const arr = this.thresholdForm.gaugeThreshold.split(',')
for (let i = 0; i < arr.length; i++) {
const ele = arr[i]
if (ele.indexOf('.') > -1 || parseInt(ele).toString() === 'NaN' || parseInt(ele) < 1 || parseInt(ele) > 99) {
this.$message({
message: this.$t('chart.gauge_threshold_format_error'),
type: 'error',
showClose: true
})
return
}
}
}
this.$emit('onThresholdChange', this.thresholdForm)
}
}
}
</script>
<style scoped>
.shape-item{
padding: 6px;
border: none;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.form-item-slider>>>.el-form-item__label{
font-size: 12px;
line-height: 38px;
}
.form-item>>>.el-form-item__label{
font-size: 12px;
}
.el-select-dropdown__item{
padding: 0 20px;
}
span{
font-size: 12px
}
.el-form-item{
margin-bottom: 6px;
}
.switch-style{
position: absolute;
right: 10px;
margin-top: -4px;
}
.color-picker-style{
cursor: pointer;
z-index: 1003;
}
</style>

View File

@ -0,0 +1,148 @@
<template>
<el-col>
<el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addLine" />
<div style="max-height: 50vh;overflow-y: auto;">
<el-row v-for="(item,index) in lineArr" :key="index" class="line-item">
<el-col :span="6">
<el-input v-model="item.name" class="value-item" :placeholder="$t('chart.name')" size="mini" clearable @change="changeAssistLine" />
</el-col>
<el-col :span="4">
<el-select v-model="item.field" size="mini" class="select-item" @change="changeAssistLine">
<el-option
v-for="opt in fieldOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-col>
<el-col :span="6">
<el-input v-model="item.value" class="value-item" :placeholder="$t('chart.drag_block_label_value')" size="mini" clearable @change="changeAssistLine" />
</el-col>
<el-col :span="4">
<el-select v-model="item.lineType" size="mini" class="select-item" @change="changeAssistLine">
<el-option
v-for="opt in lineOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-col>
<el-col :span="2" style="text-align: center;">
<el-color-picker v-model="item.color" class="color-picker-style" :predefine="predefineColors" @change="changeAssistLine" />
</el-col>
<el-col :span="2">
<el-button type="text" icon="el-icon-delete" circle style="float: right" @click="removeLine(index)" />
</el-col>
</el-row>
</div>
</el-col>
</template>
<script>
import { COLOR_PANEL } from '@/views/chart/chart/chart'
export default {
name: 'AssistLineEdit',
props: {
line: {
type: Array,
required: true
}
},
data() {
return {
lineArr: [],
lineObj: {
name: '辅助线',
field: '0', //
axis: 'y', //
value: 0,
lineType: 'solid',
color: '#ff0000'
},
fieldOptions: [
{ label: this.$t('chart.field_fixed'), value: '0' }
],
lineOptions: [
{ label: this.$t('chart.line_type_solid'), value: 'solid' },
{ label: this.$t('chart.line_type_dashed'), value: 'dashed' },
{ label: this.$t('chart.line_type_dotted'), value: 'dotted' }
],
predefineColors: COLOR_PANEL
}
},
mounted() {
this.init()
},
methods: {
init() {
this.lineArr = JSON.parse(JSON.stringify(this.line))
},
addLine() {
this.lineArr.push(this.lineObj)
this.changeAssistLine()
},
removeLine(index) {
this.lineArr.splice(index, 1)
this.changeAssistLine()
},
changeAssistLine() {
this.$emit('onAssistLineChange', this.lineArr)
}
}
}
</script>
<style scoped>
.line-item {
width: 100%;
border-radius: 4px;
border: 1px solid #DCDFE6;
padding: 4px 14px;
margin-bottom: 10px;
display: flex;
justify-content: left;
align-items: center;
}
.form-item >>> .el-form-item__label {
font-size: 12px;
}
span {
font-size: 12px;
}
.value-item {
position: relative;
display: inline-block;
width: 120px !important;
}
.select-item {
position: relative;
display: inline-block;
width: 100px !important;
}
.el-select-dropdown__item {
padding: 0 20px;
font-size: 12px;
}
.color-picker-style{
cursor: pointer;
z-index: 1003;
width: 28px;
height: 28px;
margin-top: 6px;
}
.color-picker-style >>> .el-color-picker__trigger{
width: 28px;
height: 28px;
}
</style>

View File

@ -0,0 +1,182 @@
<template>
<div style="width: 100%">
<el-col>
<el-form ref="totalForm" :model="totalForm" label-width="80px" size="mini">
<el-divider content-position="center" class="divider-style">{{ $t('chart.row_cfg') }}</el-divider>
<el-form-item :label="$t('chart.total_show')" class="form-item">
<el-checkbox v-model="totalForm.row.showGrandTotals" @change="changeTotalCfg">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
<div v-show="totalForm.row.showGrandTotals">
<el-form-item :label="$t('chart.total_position')" class="form-item">
<el-radio-group v-model="totalForm.row.reverseLayout" @change="changeTotalCfg">
<el-radio :label="true">{{ $t('chart.total_pos_top') }}</el-radio>
<el-radio :label="false">{{ $t('chart.total_pos_bottom') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.row.label" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg" />
</el-form-item>
</div>
<el-form-item :label="$t('chart.sub_total_show')" class="form-item">
<el-checkbox v-model="totalForm.row.showSubTotals" :disabled="rowNum < 2" @change="changeTotalCfg">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
<div v-show="totalForm.row.showSubTotals">
<el-form-item :label="$t('chart.total_position')" class="form-item">
<el-radio-group v-model="totalForm.row.reverseSubLayout" :disabled="rowNum < 2" @change="changeTotalCfg">
<el-radio :label="true">{{ $t('chart.total_pos_top') }}</el-radio>
<el-radio :label="false">{{ $t('chart.total_pos_bottom') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.row.subLabel" :disabled="rowNum < 2" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg" />
</el-form-item>
</div>
<el-divider content-position="center" class="divider-style">{{ $t('chart.col_cfg') }}</el-divider>
<el-form-item :label="$t('chart.total_show')" class="form-item">
<el-checkbox v-model="totalForm.col.showGrandTotals" @change="changeTotalCfg">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
<div v-show="totalForm.col.showGrandTotals">
<el-form-item :label="$t('chart.total_position')" class="form-item">
<el-radio-group v-model="totalForm.col.reverseLayout" @change="changeTotalCfg">
<el-radio :label="true">{{ $t('chart.total_pos_left') }}</el-radio>
<el-radio :label="false">{{ $t('chart.total_pos_right') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.col.label" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg" />
</el-form-item>
</div>
<el-form-item :label="$t('chart.sub_total_show')" class="form-item">
<el-checkbox v-model="totalForm.col.showSubTotals" :disabled="colNum < 2" @change="changeTotalCfg">{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
<div v-show="totalForm.col.showSubTotals">
<el-form-item :label="$t('chart.total_position')" class="form-item">
<el-radio-group v-model="totalForm.col.reverseSubLayout" :disabled="colNum < 2" @change="changeTotalCfg">
<el-radio :label="true">{{ $t('chart.total_pos_left') }}</el-radio>
<el-radio :label="false">{{ $t('chart.total_pos_right') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.col.subLabel" :disabled="colNum < 2" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg" />
</el-form-item>
</div>
</el-form>
</el-col>
</div>
</template>
<script>
import { DEFAULT_TOTAL } from '@/views/chart/chart/chart'
export default {
name: 'TotalCfg',
props: {
chart: {
type: Object,
required: true
}
},
data() {
return {
totalForm: JSON.parse(JSON.stringify(DEFAULT_TOTAL))
}
},
computed: {
rowNum() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.xaxisExt) {
let arr = null
if (Object.prototype.toString.call(chart.xaxisExt) === '[object Object]') {
arr = JSON.parse(JSON.stringify(chart.xaxisExt))
} else {
arr = JSON.parse(chart.xaxisExt)
}
return arr.length
}
return 0
},
colNum() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.xaxis) {
let arr = null
if (Object.prototype.toString.call(chart.xaxis) === '[object Object]') {
arr = JSON.parse(JSON.stringify(chart.xaxis))
} else {
arr = JSON.parse(chart.xaxis)
}
return arr.length
}
return 0
}
},
watch: {
'chart': {
handler: function() {
this.initData()
}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.totalCfg) {
this.totalForm = customAttr.totalCfg
} else {
this.totalForm = JSON.parse(JSON.stringify(DEFAULT_TOTAL))
}
}
},
changeTotalCfg() {
this.$emit('onTotalCfgChange', this.totalForm)
}
}
}
</script>
<style scoped>
.shape-item{
padding: 6px;
border: none;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.form-item-slider>>>.el-form-item__label{
font-size: 12px;
line-height: 38px;
}
.form-item>>>.el-form-item__label{
font-size: 12px;
}
.el-select-dropdown__item{
padding: 0 20px;
}
span{font-size: 12px}
.el-form-item{
margin-bottom: 6px;
}
.el-divider--horizontal {
margin: 10px 0
}
.divider-style>>>.el-divider__text{
color: #606266;
font-size: 12px;
font-weight: 400;
padding: 0 10px;
}
</style>

View File

@ -308,7 +308,10 @@ import {
DEFAULT_YAXIS_STYLE,
DEFAULT_YAXIS_EXT_STYLE,
DEFAULT_BACKGROUND_COLOR,
DEFAULT_SPLIT
DEFAULT_SPLIT,
DEFAULT_FUNCTION_CFG,
DEFAULT_THRESHOLD,
DEFAULT_TOTAL
} from '../chart/chart'
export default {
@ -753,7 +756,8 @@ export default {
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
tooltip: DEFAULT_TOOLTIP,
totalCfg: DEFAULT_TOTAL
})
view.customStyle = JSON.stringify({
text: DEFAULT_TITLE_STYLE,
@ -764,6 +768,11 @@ export default {
background: DEFAULT_BACKGROUND_COLOR,
split: DEFAULT_SPLIT
})
view.senior = JSON.stringify({
functionCfg: DEFAULT_FUNCTION_CFG,
assistLine: [],
threshold: DEFAULT_THRESHOLD
})
view.stylePriority = 'view' //
view.xaxis = JSON.stringify([])
view.xaxisExt = JSON.stringify([])

View File

@ -695,6 +695,18 @@
@onTooltipChange="onTooltipChange"
/>
</el-collapse-item>
<el-collapse-item
v-show="view.type === 'table-pivot'"
name="totalCfg"
:title="$t('chart.total_cfg')"
>
<total-cfg
:param="param"
class="attr-selector"
:chart="chart"
@onTotalCfgChange="onTotalCfgChange"
/>
</el-collapse-item>
</el-collapse>
</el-row>
<el-row>
@ -829,6 +841,38 @@
</div>
</el-row>
</el-tab-pane>
<el-tab-pane :label="$t('chart.senior')" class="padding-tab" style="width: 360px;">
<el-row class="view-panel">
<div
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge'))"
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
class="attr-style theme-border-class"
>
<el-row v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix'))">
<span class="padding-lr">{{ $t('chart.senior_cfg') }}</span>
<el-collapse v-model="attrActiveNames" class="style-collapse">
<el-collapse-item name="function" :title="$t('chart.function_cfg')">
<function-cfg :param="param" class="attr-selector" :chart="chart" @onFunctionCfgChange="onFunctionCfgChange" />
</el-collapse-item>
</el-collapse>
</el-row>
<el-row v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge'))">
<span class="padding-lr">{{ $t('chart.analyse_cfg') }}</span>
<el-collapse v-model="styleActiveNames" class="style-collapse">
<el-collapse-item v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix'))" name="analyse" :title="$t('chart.assist_line')">
<assist-line :param="param" class="attr-selector" :chart="chart" @onAssistLineChange="onAssistLineChange" />
</el-collapse-item>
<el-collapse-item v-if="view.type && (view.type.includes('gauge'))" name="threshold" :title="$t('chart.threshold')">
<threshold :param="param" class="attr-selector" :chart="chart" @onThresholdChange="onThresholdChange" />
</el-collapse-item>
</el-collapse>
</el-row>
</div>
<div v-else class="no-senior">
{{ $t('chart.chart_no_senior') }}
</div>
</el-row>
</el-tab-pane>
</el-tabs>
<el-col v-if="editFrom==='view'" style="height: 100%;min-width: 500px;border-top: 1px solid #E6E6E6;">
@ -1032,12 +1076,15 @@ import DatasetChartDetail from '../../dataset/common/DatasetChartDetail'
import {
DEFAULT_BACKGROUND_COLOR,
DEFAULT_COLOR_CASE,
DEFAULT_FUNCTION_CFG,
DEFAULT_LABEL,
DEFAULT_LEGEND_STYLE,
DEFAULT_SIZE,
DEFAULT_SPLIT,
DEFAULT_THRESHOLD,
DEFAULT_TITLE_STYLE,
DEFAULT_TOOLTIP,
DEFAULT_TOTAL,
DEFAULT_XAXIS_STYLE,
DEFAULT_YAXIS_EXT_STYLE,
DEFAULT_YAXIS_STYLE
@ -1080,9 +1127,17 @@ import DimensionExtItem from '@/views/chart/components/drag-item/DimensionExtIte
import PluginCom from '@/views/system/plugin/PluginCom'
import { mapState } from 'vuex'
import FunctionCfg from '@/views/chart/components/senior/FunctionCfg'
import AssistLine from '@/views/chart/components/senior/AssistLine'
import Threshold from '@/views/chart/components/senior/Threshold'
import TotalCfg from '@/views/chart/components/shape-attr/TotalCfg'
export default {
name: 'ChartEdit',
components: {
TotalCfg,
Threshold,
AssistLine,
FunctionCfg,
DimensionExtItem,
ChartComponentS2,
CompareEdit,
@ -1160,7 +1215,8 @@ export default {
color: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
tooltip: DEFAULT_TOOLTIP,
totalCfg: DEFAULT_TOTAL
},
customStyle: {
text: DEFAULT_TITLE_STYLE,
@ -1171,6 +1227,11 @@ export default {
background: DEFAULT_BACKGROUND_COLOR,
split: DEFAULT_SPLIT
},
senior: {
functionCfg: DEFAULT_FUNCTION_CFG,
assistLine: [],
threshold: DEFAULT_THRESHOLD
},
customFilter: [],
render: 'antv',
isPlugin: false
@ -1489,6 +1550,7 @@ export default {
view.extStack = JSON.stringify(view.extStack)
view.drillFields = JSON.stringify(view.drillFields)
view.extBubble = JSON.stringify(view.extBubble)
view.senior = JSON.stringify(view.senior)
delete view.data
return view
},
@ -1514,7 +1576,8 @@ export default {
// this.view.customAttr = view.customAttr ? JSON.parse(view.customAttr) : {}
// this.view.customStyle = view.customStyle ? JSON.parse(view.customStyle) : {}
// this.view.customFilter = view.customFilter ? JSON.parse(view.customFilter) : {}
// // echart
// this.view.senior = view.senior ? JSON.parse(view.senior) : {}
// echart
// this.chart = response.data
// this.data = response.data.data
// // console.log(JSON.stringify(this.chart))
@ -1555,6 +1618,7 @@ export default {
view.customAttr = JSON.stringify(this.view.customAttr)
view.customStyle = JSON.stringify(this.view.customStyle)
view.customFilter = JSON.stringify(this.view.customFilter)
view.senior = JSON.stringify(this.view.senior)
// view.data = this.data
this.chart = view
@ -1617,6 +1681,7 @@ export default {
this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}
this.view.customStyle = this.view.customStyle ? JSON.parse(this.view.customStyle) : {}
this.view.customFilter = this.view.customFilter ? JSON.parse(this.view.customFilter) : {}
this.view.senior = this.view.senior ? JSON.parse(this.view.senior) : {}
// echart
this.chart = response.data
this.data = response.data.data
@ -1661,6 +1726,7 @@ export default {
this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}
this.view.customStyle = this.view.customStyle ? JSON.parse(this.view.customStyle) : {}
this.view.customFilter = this.view.customFilter ? JSON.parse(this.view.customFilter) : {}
this.view.senior = this.view.senior ? JSON.parse(this.view.senior) : {}
// echart
this.chart = response.data
@ -1739,6 +1805,11 @@ export default {
this.calcStyle()
},
onTotalCfgChange(val) {
this.view.customAttr.totalCfg = val
this.calcStyle()
},
onChangeXAxisForm(val) {
this.view.customStyle.xAxis = val
this.calcStyle()
@ -1764,6 +1835,21 @@ export default {
this.calcStyle()
},
onFunctionCfgChange(val) {
this.view.senior.functionCfg = val
this.calcStyle()
},
onAssistLineChange(val) {
this.view.senior.assistLine = val
this.calcStyle()
},
onThresholdChange(val) {
this.view.senior.threshold = val
this.calcStyle()
},
showDimensionEditFilter(item) {
this.dimensionItem = JSON.parse(JSON.stringify(item))
this.dimensionFilterEdit = true
@ -2680,4 +2766,14 @@ export default {
width: 80px !important;
}
.no-senior {
width: 100%;
text-align: center;
font-size: 12px;
padding-top: 40px;
overflow:auto;
border-right: 1px solid #e6e6e6;
height: 100%;
}
</style>

View File

@ -84,7 +84,7 @@ export default {
height: 500,
data: [],
fields: [],
customType: ['db', 'sql', 'excel']
customType: ['db', 'sql', 'excel', 'api']
}
},
watch: {

View File

@ -287,7 +287,7 @@ export default {
cancelButtonText: this.$t('dataset.cancel'),
type: 'warning'
}).then(() => {
post('dataset/union/delete/' + item.id, {}).then(response => {
post('dataset/union/delete', item).then(response => {
this.$message({
type: 'success',
message: this.$t('dataset.delete_success'),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.