Merge pull request #521 from dataease/pr@dev@feat_视图钻取

feat: 视图钻取
This commit is contained in:
XiaJunjie2020 2021-08-04 16:50:55 +08:00 committed by GitHub
commit 958cbabb6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 4 deletions

View File

@ -21,6 +21,8 @@ public class ChartViewWithBLOBs extends ChartView implements Serializable {
private String customFilter;
private String drillFields;
private String snapshot;
private static final long serialVersionUID = 1L;

View File

@ -20,6 +20,7 @@
<result column="custom_attr" jdbcType="LONGVARCHAR" property="customAttr" />
<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="snapshot" jdbcType="LONGVARCHAR" property="snapshot" />
</resultMap>
<sql id="Example_Where_Clause">
@ -85,7 +86,8 @@
style_priority
</sql>
<sql id="Blob_Column_List">
x_axis, y_axis, ext_stack, custom_attr, custom_style, custom_filter, snapshot
x_axis, y_axis, ext_stack, custom_attr, custom_style, custom_filter, drill_fields,
snapshot
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.ChartViewExample" resultMap="ResultMapWithBLOBs">
select
@ -141,13 +143,15 @@
create_by, create_time, update_time,
style_priority, x_axis, y_axis,
ext_stack, custom_attr, custom_style,
custom_filter, snapshot)
custom_filter, drill_fields, snapshot
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{tableId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{stylePriority,jdbcType=VARCHAR}, #{xAxis,jdbcType=LONGVARCHAR}, #{yAxis,jdbcType=LONGVARCHAR},
#{extStack,jdbcType=LONGVARCHAR}, #{customAttr,jdbcType=LONGVARCHAR}, #{customStyle,jdbcType=LONGVARCHAR},
#{customFilter,jdbcType=LONGVARCHAR}, #{snapshot,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
@ -200,6 +204,9 @@
<if test="customFilter != null">
custom_filter,
</if>
<if test="drillFields != null">
drill_fields,
</if>
<if test="snapshot != null">
snapshot,
</if>
@ -253,6 +260,9 @@
<if test="customFilter != null">
#{customFilter,jdbcType=LONGVARCHAR},
</if>
<if test="drillFields != null">
#{drillFields,jdbcType=LONGVARCHAR},
</if>
<if test="snapshot != null">
#{snapshot,jdbcType=LONGVARCHAR},
</if>
@ -315,6 +325,9 @@
<if test="record.customFilter != null">
custom_filter = #{record.customFilter,jdbcType=LONGVARCHAR},
</if>
<if test="record.drillFields != null">
drill_fields = #{record.drillFields,jdbcType=LONGVARCHAR},
</if>
<if test="record.snapshot != null">
snapshot = #{record.snapshot,jdbcType=LONGVARCHAR},
</if>
@ -341,6 +354,7 @@
custom_attr = #{record.customAttr,jdbcType=LONGVARCHAR},
custom_style = #{record.customStyle,jdbcType=LONGVARCHAR},
custom_filter = #{record.customFilter,jdbcType=LONGVARCHAR},
drill_fields = #{record.drillFields,jdbcType=LONGVARCHAR},
snapshot = #{record.snapshot,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -410,6 +424,9 @@
<if test="customFilter != null">
custom_filter = #{customFilter,jdbcType=LONGVARCHAR},
</if>
<if test="drillFields != null">
drill_fields = #{drillFields,jdbcType=LONGVARCHAR},
</if>
<if test="snapshot != null">
snapshot = #{snapshot,jdbcType=LONGVARCHAR},
</if>
@ -433,6 +450,7 @@
custom_attr = #{customAttr,jdbcType=LONGVARCHAR},
custom_style = #{customStyle,jdbcType=LONGVARCHAR},
custom_filter = #{customFilter,jdbcType=LONGVARCHAR},
drill_fields = #{drillFields,jdbcType=LONGVARCHAR},
snapshot = #{snapshot,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>

View File

@ -3078,3 +3078,7 @@ COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `chart_view` ADD COLUMN `drill_fields` LONGTEXT COMMENT '钻取字段' AFTER `custom_filter`;
UPDATE `chart_view` SET `drill_fields` = '[]';

View File

@ -64,7 +64,7 @@
<!--要生成的数据库表 -->
<table tableName="dataset_table_function"/>
<table tableName="chart_view"/>
<!-- <table tableName="sys_dict"/>-->
<!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>-->

View File

@ -746,6 +746,7 @@ export default {
view.yaxis = JSON.stringify([])
view.extStack = JSON.stringify([])
view.customFilter = JSON.stringify([])
view.drillFields = JSON.stringify([])
post('/chart/view/save', view).then(response => {
this.closeCreateChart()
this.$store.dispatch('chart/setTableId', null)

View File

@ -233,6 +233,29 @@
/>
</span>
</el-row>
<el-row class="padding-lr">
<span style="width: 80px;text-align: right;">
<span>钻取</span>
/
<span>{{ $t('chart.dimension') }}</span>
</span>
<draggable
v-model="view.drillFields"
:disabled="!hasDataPermission('manage',param.privileges)"
group="drag"
animation="300"
:move="onMove"
class="drag-block-style"
@add="addXaxis"
>
<transition-group class="draggable-group">
<dimension-item v-for="(item,index) in view.drillFields" :key="item.id" :param="param" :index="index" :item="item" @onDimensionItemChange="dimensionItemChange" @onDimensionItemRemove="dimensionItemRemove" @editItemFilter="showDimensionEditFilter" @onNameEdit="showRename" />
</transition-group>
</draggable>
<div v-if="!view.drillFields || view.drillFields.length === 0" class="drag-placeholder-style">
<span class="drag-placeholder-style-span">{{ $t('chart.placeholder_field') }}</span>
</div>
</el-row>
<el-row v-if="view.type !=='text' && view.type !== 'gauge'" class="padding-lr">
<span style="width: 80px;text-align: right;">
<span v-if="view.type && view.type.includes('table')">{{ $t('chart.drag_block_table_data_column') }}</span>
@ -613,6 +636,7 @@ export default {
xaxis: [],
yaxis: [],
extStack: [],
drillFields: [],
show: true,
type: 'bar',
title: '',
@ -800,6 +824,7 @@ export default {
view.customStyle = JSON.stringify(view.customStyle)
view.customFilter = JSON.stringify(view.customFilter)
view.extStack = JSON.stringify(view.extStack)
view.drillFields = JSON.stringify(view.drillFields)
post('/chart/view/save', view).then(response => {
// this.get(response.data.id);
// this.getData(response.data.id)
@ -900,6 +925,7 @@ export default {
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : []
this.view.extStack = this.view.extStack ? JSON.parse(this.view.extStack) : []
this.view.drillFields = this.view.drillFields ? JSON.parse(this.view.drillFields) : []
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) : {}
@ -932,6 +958,7 @@ export default {
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : []
this.view.extStack = this.view.extStack ? JSON.parse(this.view.extStack) : []
this.view.drillFields = this.view.drillFields ? JSON.parse(this.view.drillFields) : []
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) : {}