Merge branch 'v1.8' of github.com:dataease/dataease into v1.8

This commit is contained in:
taojinlong 2022-02-28 21:57:45 +08:00
commit 4d0319d44c
11 changed files with 130 additions and 67 deletions

View File

@ -26,4 +26,8 @@ public interface ExtChartViewMapper {
ChartViewDTO searchOneWithPrivileges(@Param("userId") String userId,@Param("id") String id ); ChartViewDTO searchOneWithPrivileges(@Param("userId") String userId,@Param("id") String id );
void chartCopyWithPanel(@Param("copyId") String copyId); void chartCopyWithPanel(@Param("copyId") String copyId);
void deleteCircleView(@Param("pid") String pid);
void deleteCircleGroup(@Param("pid") String pid);
} }

View File

@ -228,4 +228,12 @@
) pv_copy ) pv_copy
LEFT JOIN chart_view ON chart_view.id = pv_copy.copy_from_view LEFT JOIN chart_view ON chart_view.id = pv_copy.copy_from_view
</insert> </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>
<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>
</mapper> </mapper>

View File

@ -135,43 +135,10 @@
<select id="queryAuthViewsOriginal" resultMap="ExtResultMap"> <select id="queryAuthViewsOriginal" resultMap="ExtResultMap">
select * from (
SELECT SELECT
chart_group.id, *
chart_group.id AS 'inner_id',
chart_group.NAME,
chart_group.NAME AS 'label',
chart_group.pid AS pid,
chart_group.type AS 'model_inner_type',
'spine' AS node_type,
'view' AS model_type
FROM FROM
chart_group v_history_chart_view viewsOriginal
UNION ALL
SELECT
distinct
chart_view.id,
chart_view.id AS 'inner_id',
chart_view.NAME,
chart_view.NAME AS 'label',
chart_view.scene_id AS pid,
chart_view.type AS 'model_inner_type',
'leaf' AS node_type,
'view' AS model_type
FROM
chart_view
LEFT JOIN panel_view ON panel_view.chart_view_id = chart_view.id
<where>
<if test="record.pids != null and record.pids.size() > 0">
and panel_view.panel_id in
<foreach collection="record.pids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
) viewsOriginal
ORDER BY viewsOriginal.node_type desc, CONVERT(viewsOriginal.label using gbk) asc ORDER BY viewsOriginal.node_type desc, CONVERT(viewsOriginal.label using gbk) asc
</select> </select>

View File

@ -44,9 +44,9 @@ public class ChartGroupController {
@ApiIgnore @ApiIgnore
@ApiOperation("删除") @ApiOperation("删除")
@PostMapping("/delete/{id}") @PostMapping("/deleteCircle/{id}")
public void tree(@PathVariable String id) { public void tree(@PathVariable String id) {
chartGroupService.delete(id); chartGroupService.deleteCircle(id);
} }
@ApiIgnore @ApiIgnore

View File

@ -3,6 +3,7 @@ package io.dataease.service.chart;
import io.dataease.base.domain.*; import io.dataease.base.domain.*;
import io.dataease.base.mapper.ChartGroupMapper; import io.dataease.base.mapper.ChartGroupMapper;
import io.dataease.base.mapper.ext.ExtChartGroupMapper; import io.dataease.base.mapper.ext.ExtChartGroupMapper;
import io.dataease.base.mapper.ext.ExtChartViewMapper;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper; import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils; import io.dataease.commons.utils.BeanUtils;
@ -15,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -36,6 +38,8 @@ public class ChartGroupService {
private ExtDataSetGroupMapper extDataSetGroupMapper; private ExtDataSetGroupMapper extDataSetGroupMapper;
@Resource @Resource
private SysAuthService sysAuthService; private SysAuthService sysAuthService;
@Resource
private ExtChartViewMapper extChartViewMapper;
public ChartGroupDTO save(ChartGroup chartGroup) { public ChartGroupDTO save(ChartGroup chartGroup) {
checkName(chartGroup); checkName(chartGroup);
@ -53,26 +57,13 @@ public class ChartGroupService {
return ChartGroupDTO; return ChartGroupDTO;
} }
public void delete(String id) { @Transactional
public void deleteCircle(String id) {
Assert.notNull(id, "id cannot be null"); Assert.notNull(id, "id cannot be null");
sysAuthService.checkTreeNoManageCount("chart",id); //存量视图删除
extChartViewMapper.deleteCircleView(id);
ChartGroup cg = chartGroupMapper.selectByPrimaryKey(id); //存量分组删除
ChartGroupRequest ChartGroup = new ChartGroupRequest(); extChartViewMapper.deleteCircleGroup(id);
BeanUtils.copyBean(ChartGroup, cg);
Map<String, String> stringStringMap = extDataSetGroupMapper.searchIds(id, "chart");
String[] split = stringStringMap.get("ids").split(",");
List<String> ids = new ArrayList<>();
for (String dsId : split) {
if (StringUtils.isNotEmpty(dsId)) {
ids.add(dsId);
}
}
ChartGroupExample ChartGroupExample = new ChartGroupExample();
ChartGroupExample.createCriteria().andIdIn(ids);
chartGroupMapper.deleteByExample(ChartGroupExample);
// 删除所有chart
deleteChart(ids);
} }
public void deleteChart(List<String> sceneIds) { public void deleteChart(List<String> sceneIds) {

File diff suppressed because one or more lines are too long

View File

@ -66,3 +66,12 @@ export function pluginTypes() {
method: 'post' method: 'post'
}) })
} }
export function deleteCircle(id) {
return request({
url: '/chart/group/deleteCircle/' + id,
method: 'post',
loading: true
})
}

View File

@ -4,7 +4,7 @@
<span v-if="chart.type" v-show="title_show" ref="title" :style="title_class" style="cursor: default;display: block;"> <span v-if="chart.type" v-show="title_show" ref="title" :style="title_class" style="cursor: default;display: block;">
<p style="padding:6px 10px 0 10px;margin: 0;overflow: hidden;white-space: pre;text-overflow: ellipsis;">{{ chart.title }}</p> <p style="padding:6px 10px 0 10px;margin: 0;overflow: hidden;white-space: pre;text-overflow: ellipsis;">{{ chart.title }}</p>
</span> </span>
<div ref="tableContainer" style="width: 100%;overflow: hidden;padding: 8px;" :style="{background:container_bg_class.background}"> <div ref="tableContainer" style="width: 100%;overflow: hidden;" :style="{background:container_bg_class.background}">
<div v-if="chart.type === 'table-normal'" :id="chartId" style="width: 100%;overflow: hidden;" :class="chart.drill ? 'table-dom-normal-drill' : 'table-dom-normal'" /> <div v-if="chart.type === 'table-normal'" :id="chartId" style="width: 100%;overflow: hidden;" :class="chart.drill ? 'table-dom-normal-drill' : 'table-dom-normal'" />
<div v-if="chart.type === 'table-info'" :id="chartId" style="width: 100%;overflow: hidden;" :class="chart.drill ? 'table-dom-info-drill' : 'table-dom-info'" /> <div v-if="chart.type === 'table-info'" :id="chartId" style="width: 100%;overflow: hidden;" :class="chart.drill ? 'table-dom-info-drill' : 'table-dom-info'" />
<div v-if="chart.type === 'table-pivot'" :id="chartId" style="width: 100%;overflow: hidden;" class="table-dom-normal" /> <div v-if="chart.type === 'table-pivot'" :id="chartId" style="width: 100%;overflow: hidden;" class="table-dom-normal" />

View File

@ -1519,6 +1519,7 @@ export default {
this.closeChangeChart() this.closeChangeChart()
// //
if (this.$route.path.indexOf('panel') > -1) { if (this.$route.path.indexOf('panel') > -1) {
this.$store.commit('recordSnapshot')
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' }) bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
} }
this.$success(this.$t('commons.save_success')) this.$success(this.$t('commons.save_success'))

View File

@ -1,7 +1,7 @@
<template> <template>
<de-container> <de-container>
<de-aside-container> <de-aside-container>
<dataset-group-selector-tree :privileges="privileges" :mode="mode" :clearEmptyDir="clearEmptyDir" :type="type" :custom-type="customType" :show-mode="showMode" @getTable="getTable" /> <dataset-group-selector-tree :privileges="privileges" :mode="mode" :clear-empty-dir="clearEmptyDir" :type="type" :custom-type="customType" :show-mode="showMode" @getTable="getTable" />
</de-aside-container> </de-aside-container>
<de-main-container> <de-main-container>
<dataset-table-data :table="table" /> <dataset-table-data :table="table" />
@ -54,7 +54,7 @@ export default {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
}, }
}, },
data() { data() {
return { return {
@ -69,7 +69,7 @@ export default {
methods: { methods: {
getTable(table) { getTable(table) {
// this.table = table // this.table = table
getTable(table.id).then(response => { table && table.id && getTable(table.id).then(response => {
this.table = response.data this.table = response.data
this.$emit('getTable', this.table) this.$emit('getTable', this.table)
}).catch(res => { }).catch(res => {

View File

@ -34,8 +34,8 @@
@check="checkChanged" @check="checkChanged"
@node-drag-end="dragEnd" @node-drag-end="dragEnd"
> >
<span slot-scope="{ node, data }" class="custom-tree-node"> <span slot-scope="{ node, data }" class="custom-tree-node-list father">
<span> <span style="display: flex; flex: 1 1 0%; width: 0px;">
<span v-if="data.modelInnerType==='history'"> <span v-if="data.modelInnerType==='history'">
<i class="el-icon-collection" /> <i class="el-icon-collection" />
</span> </span>
@ -48,7 +48,17 @@
<span v-else> <span v-else>
<svg-icon :icon-class="data.modelInnerType" style="width: 14px;height: 14px" /> <svg-icon :icon-class="data.modelInnerType" style="width: 14px;height: 14px" />
</span> </span>
<span style="margin-left: 6px;font-size: 14px">{{ data.name }}</span> <span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
</span>
<span v-if="data.mode===1" class="child">
<span @click.stop>
<el-button
icon="el-icon-delete"
type="text"
size="small"
@click="deleteHistory(data, node)"
/>
</span>
</span> </span>
</span> </span>
</el-tree> </el-tree>
@ -63,6 +73,8 @@ import { deepCopy } from '@/components/canvas/utils/utils'
import eventBus from '@/components/canvas/utils/eventBus' import eventBus from '@/components/canvas/utils/eventBus'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { queryPanelViewTree } from '@/api/panel/panel' import { queryPanelViewTree } from '@/api/panel/panel'
import { deleteCircle } from '@/api/chart/chart'
import { delUser } from '@/api/system/user'
export default { export default {
name: 'ViewSelect', name: 'ViewSelect',
@ -176,8 +188,20 @@ export default {
component.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix component.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix
component.moveStatus = 'start' component.moveStatus = 'start'
return component return component
},
deleteHistory(data, node) {
deleteCircle(data.id).then(() => {
this.$success(this.$t('commons.delete_success'))
this.remove(node, data)
// this.loadData()
})
},
remove(node, data) {
const parent = node.parent
const children = parent.data.children || parent.data
const index = children.findIndex(d => d.id === data.id)
children.splice(index, 1)
} }
} }
} }
</script> </script>
@ -198,4 +222,22 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.father .child {
/*display: none;*/
visibility: hidden;
}
.father:hover .child {
/*display: inline;*/
visibility: visible;
}
.custom-tree-node-list {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding:0 8px;
}
</style> </style>