refactor: 仪表板兼容插件视图

This commit is contained in:
fit2cloud-chenyw 2022-02-17 14:22:30 +08:00
parent 09188e9dfe
commit e1ed447063
9 changed files with 355 additions and 178 deletions

View File

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

View File

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

View File

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

View File

@ -4,17 +4,19 @@
<resultMap id="BaseResultMap" type="io.dataease.base.domain.ChartView">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="scene_id" jdbcType="VARCHAR" property="sceneId" />
<result column="table_id" jdbcType="VARCHAR" property="tableId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="render" jdbcType="VARCHAR" property="render" />
<result column="result_count" jdbcType="INTEGER" property="resultCount" />
<result column="result_mode" jdbcType="VARCHAR" property="resultMode" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="style_priority" jdbcType="VARCHAR" property="stylePriority" />
<result column="chart_type" jdbcType="VARCHAR" property="chartType" />
<result column="is_plugin" jdbcType="BIT" property="isPlugin" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.ChartViewWithBLOBs">
<result column="x_axis" jdbcType="LONGVARCHAR" property="xAxis" />
@ -88,8 +90,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, scene_id, table_id, `type`, render, result_count, result_mode, title,
create_by, create_time, update_time, style_priority
id, `name`, title, scene_id, table_id, `type`, render, result_count, result_mode,
create_by, create_time, update_time, style_priority, chart_type, is_plugin
</sql>
<sql id="Blob_Column_List">
x_axis, x_axis_ext, y_axis, y_axis_ext, ext_stack, ext_bubble, custom_attr, custom_style,
@ -144,24 +146,24 @@
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
insert into chart_view (id, `name`, scene_id,
table_id, `type`, render,
result_count, result_mode, title,
insert into chart_view (id, `name`, title,
scene_id, table_id, `type`,
render, result_count, result_mode,
create_by, create_time, update_time,
style_priority, x_axis, x_axis_ext,
y_axis, y_axis_ext, ext_stack,
ext_bubble, custom_attr, custom_style,
custom_filter, drill_fields, snapshot
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{tableId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{render,jdbcType=VARCHAR},
#{resultCount,jdbcType=INTEGER}, #{resultMode,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
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}, #{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}
)
#{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>
<insert id="insertSelective" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
insert into chart_view
@ -172,6 +174,9 @@
<if test="name != null">
`name`,
</if>
<if test="title != null">
title,
</if>
<if test="sceneId != null">
scene_id,
</if>
@ -190,9 +195,6 @@
<if test="resultMode != null">
result_mode,
</if>
<if test="title != null">
title,
</if>
<if test="createBy != null">
create_by,
</if>
@ -205,6 +207,12 @@
<if test="stylePriority != null">
style_priority,
</if>
<if test="chartType != null">
chart_type,
</if>
<if test="isPlugin != null">
is_plugin,
</if>
<if test="xAxis != null">
x_axis,
</if>
@ -246,6 +254,9 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
#{sceneId,jdbcType=VARCHAR},
</if>
@ -264,9 +275,6 @@
<if test="resultMode != null">
#{resultMode,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@ -279,6 +287,12 @@
<if test="stylePriority != null">
#{stylePriority,jdbcType=VARCHAR},
</if>
<if test="chartType != null">
#{chartType,jdbcType=VARCHAR},
</if>
<if test="isPlugin != null">
#{isPlugin,jdbcType=BIT},
</if>
<if test="xAxis != null">
#{xAxis,jdbcType=LONGVARCHAR},
</if>
@ -329,6 +343,9 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.sceneId != null">
scene_id = #{record.sceneId,jdbcType=VARCHAR},
</if>
@ -347,9 +364,6 @@
<if test="record.resultMode != null">
result_mode = #{record.resultMode,jdbcType=VARCHAR},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
@ -362,6 +376,12 @@
<if test="record.stylePriority != null">
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
</if>
<if test="record.chartType != null">
chart_type = #{record.chartType,jdbcType=VARCHAR},
</if>
<if test="record.isPlugin != null">
is_plugin = #{record.isPlugin,jdbcType=BIT},
</if>
<if test="record.xAxis != null">
x_axis = #{record.xAxis,jdbcType=LONGVARCHAR},
</if>
@ -404,17 +424,19 @@
update chart_view
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
table_id = #{record.tableId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
render = #{record.render,jdbcType=VARCHAR},
result_count = #{record.resultCount,jdbcType=INTEGER},
result_mode = #{record.resultMode,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
chart_type = #{record.chartType,jdbcType=VARCHAR},
is_plugin = #{record.isPlugin,jdbcType=BIT},
x_axis = #{record.xAxis,jdbcType=LONGVARCHAR},
x_axis_ext = #{record.xAxisExt,jdbcType=LONGVARCHAR},
y_axis = #{record.yAxis,jdbcType=LONGVARCHAR},
@ -434,17 +456,19 @@
update chart_view
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
table_id = #{record.tableId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
render = #{record.render,jdbcType=VARCHAR},
result_count = #{record.resultCount,jdbcType=INTEGER},
result_mode = #{record.resultMode,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
style_priority = #{record.stylePriority,jdbcType=VARCHAR}
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
chart_type = #{record.chartType,jdbcType=VARCHAR},
is_plugin = #{record.isPlugin,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -455,6 +479,9 @@
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="sceneId != null">
scene_id = #{sceneId,jdbcType=VARCHAR},
</if>
@ -473,9 +500,6 @@
<if test="resultMode != null">
result_mode = #{resultMode,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
@ -488,6 +512,12 @@
<if test="stylePriority != null">
style_priority = #{stylePriority,jdbcType=VARCHAR},
</if>
<if test="chartType != null">
chart_type = #{chartType,jdbcType=VARCHAR},
</if>
<if test="isPlugin != null">
is_plugin = #{isPlugin,jdbcType=BIT},
</if>
<if test="xAxis != null">
x_axis = #{xAxis,jdbcType=LONGVARCHAR},
</if>
@ -527,17 +557,19 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.ChartViewWithBLOBs">
update chart_view
set `name` = #{name,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
scene_id = #{sceneId,jdbcType=VARCHAR},
table_id = #{tableId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
render = #{render,jdbcType=VARCHAR},
result_count = #{resultCount,jdbcType=INTEGER},
result_mode = #{resultMode,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
style_priority = #{stylePriority,jdbcType=VARCHAR},
chart_type = #{chartType,jdbcType=VARCHAR},
is_plugin = #{isPlugin,jdbcType=BIT},
x_axis = #{xAxis,jdbcType=LONGVARCHAR},
x_axis_ext = #{xAxisExt,jdbcType=LONGVARCHAR},
y_axis = #{yAxis,jdbcType=LONGVARCHAR},
@ -554,17 +586,19 @@
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.ChartView">
update chart_view
set `name` = #{name,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
scene_id = #{sceneId,jdbcType=VARCHAR},
table_id = #{tableId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
render = #{render,jdbcType=VARCHAR},
result_count = #{resultCount,jdbcType=INTEGER},
result_mode = #{resultMode,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
style_priority = #{stylePriority,jdbcType=VARCHAR}
style_priority = #{stylePriority,jdbcType=VARCHAR},
chart_type = #{chartType,jdbcType=VARCHAR},
is_plugin = #{isPlugin,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -310,3 +310,6 @@ delete from chart_group where id in (
ALTER TABLE `panel_link_mapping`
ADD COLUMN `uuid` varchar(8) NULL COMMENT 'uuid' AFTER `user_id`;
ALTER TABLE `chart_view`
ADD COLUMN `is_plugin` bit(1) NULL COMMENT '是否插件' AFTER `chart_type`;

View File

@ -17,7 +17,7 @@
</div>
</div>
<plugin-com
v-if="isPlugin"
v-if="chart.isPlugin"
:ref="element.propValue.id"
:component-name="chart.type + '-view'"
:obj="{chart, trackMenu, searchCount, terminalType: scaleCoefficientType}"
@ -89,7 +89,6 @@ import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
import EditBarView from '@/components/canvas/components/Editor/EditBarView'
import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import { pluginTypes } from '@/api/chart/chart'
import PluginCom from '@/views/system/plugin/PluginCom'
export default {
name: 'UserView',
@ -162,9 +161,7 @@ export default {
pre: null,
preCanvasPanel: null,
sourceCustomAttrStr: null,
sourceCustomStyleStr: null,
isPlugin: false,
plugins: []
sourceCustomStyleStr: null
}
},
computed: {
@ -332,7 +329,7 @@ export default {
}
},
'chartType': function(newVal, oldVal) {
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
// this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
if (newVal === 'map' && newVal !== oldVal) {
this.initAreas()
}
@ -347,12 +344,7 @@ export default {
deep: true
}
},
beforeCreate() {
pluginTypes().then(res => {
this.plugins = res.data
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
})
},
created() {
this.refId = uuid.v1
if (this.element && this.element.propValue && this.element.propValue.viewId) {

View File

@ -218,7 +218,7 @@
v-model="view.type"
style="width: 100%"
>
<chart-type :chart="view" style="height: 350px;" />
<chart-type ref="cu-chart-type" :chart="view" style="height: 350px;" />
</el-radio-group>
</div>
</el-row>
@ -420,6 +420,11 @@ export default {
currentKey: null
}
},
computed: {
chartType() {
return this.view.type
}
},
watch: {
saveStatus() {
},
@ -436,6 +441,9 @@ export default {
searchType(val) {
this.searchPids = []
this.$refs.chartTreeRef.filter(this.filterText)
},
chartType(val) {
this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
}
},
@ -733,6 +741,7 @@ export default {
view.sceneId = this.currGroup.id
view.tableId = this.table.id
view.type = this.view.type
view.isPlugin = this.view.isPlugin
view.render = this.view.render
view.resultMode = 'custom'
view.resultCount = 1000

View File

@ -160,7 +160,7 @@
:disabled="!hasDataPermission('manage',param.privileges)"
@change="changeChartType()"
>
<chart-type :chart="view" style="height: 480px" />
<chart-type ref="cu-chart-type" :chart="view" style="height: 480px" />
</el-radio-group>
</div>
</el-row>
@ -220,7 +220,7 @@
</el-row>
</el-row>
<plugin-com v-if="isPlugin" :component-name="view.type + '-data'" :obj="{view, param, chart}" />
<plugin-com v-if="view.isPlugin" :component-name="view.type + '-data'" :obj="{view, param, chart}" />
<div v-else>
<el-row v-if="view.type ==='map'" class="padding-lr">
@ -820,7 +820,7 @@
<el-row style="width: 100%;height: 100%;" class="padding-lr">
<div ref="imageWrapper" style="height: 100%">
<plugin-com
v-if="httpRequest.status && chart.type && isPlugin"
v-if="httpRequest.status && chart.type && view.isPlugin"
:component-name="chart.type + '-view'"
:obj="{chart}"
class="chart-class"
@ -1055,7 +1055,6 @@ import { compareItem } from '@/views/chart/chart/compare'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import DimensionExtItem from '@/views/chart/components/drag-item/DimensionExtItem'
import PluginCom from '@/views/system/plugin/PluginCom'
import { pluginTypes } from '@/api/chart/chart'
export default {
name: 'ChartEdit',
components: {
@ -1143,7 +1142,8 @@ export default {
split: DEFAULT_SPLIT
},
customFilter: [],
render: 'antv'
render: 'antv',
isPlugin: false
},
moveId: -1,
chart: {
@ -1190,9 +1190,8 @@ export default {
drill: false,
hasEdit: false,
quotaItemCompare: {},
showEditQuotaCompare: false,
plugins: [],
isPlugin: false
showEditQuotaCompare: false
}
},
computed: {
@ -1213,7 +1212,7 @@ export default {
this.fieldFilter(val)
},
'chartType': function(newVal, oldVal) {
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal)
if (newVal === 'map' && newVal !== oldVal) {
this.initAreas()
}
@ -1232,12 +1231,7 @@ export default {
},
activated() {
},
beforeCreate() {
pluginTypes().then(res => {
this.plugins = res.data
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
})
},
methods: {
bindPluginEvent() {
bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter)

View File

@ -1,5 +1,5 @@
<template>
<div class="chart-type">
<div v-if="loadFinish" class="chart-type">
<div v-for="(renderItem, category) in renderMap[chart.render]" :key="category">
<el-divider class="chart-type-divider">{{ $t(category) }}</el-divider>
@ -38,21 +38,38 @@ export default {
data() {
return {
defaultTypes: TYPE_CONFIGS,
allTypes: [],
renderMap: {}
renderMap: {},
loadFinish: false
}
},
beforeCreate() {
pluginTypes().then(res => {
const plugins = res.data
created() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views'))
if (plugins) {
this.initTypes(plugins)
} else {
pluginTypes().then(res => {
const plugins = res.data
localStorage.setItem('plugin-views', JSON.stringify(plugins))
this.initTypes(plugins)
}).catch(e => {
localStorage.setItem('plugin-views', null)
this.initTypes([])
})
}
},
methods: {
currentIsPlugin(type) {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
return plugins.some(plugin => plugin.value === type)
},
initTypes(plugins) {
plugins.forEach(plugin => {
plugin.isPlugin = true
})
this.pluginTypes = [...this.defaultTypes, ...plugins]
this.formatTypes()
})
},
methods: {
this.loadFinish = true
},
formatTypes() {
this.pluginTypes.forEach(item => {
const { render, category } = item