forked from github/dataease
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
fa807521b9
@ -19,6 +19,8 @@ public class PanelView implements Serializable {
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private String position;
|
||||
|
||||
private byte[] content;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -573,6 +573,76 @@ public class PanelViewExample {
|
||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionIsNull() {
|
||||
addCriterion("`position` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionIsNotNull() {
|
||||
addCriterion("`position` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionEqualTo(String value) {
|
||||
addCriterion("`position` =", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionNotEqualTo(String value) {
|
||||
addCriterion("`position` <>", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionGreaterThan(String value) {
|
||||
addCriterion("`position` >", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`position` >=", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionLessThan(String value) {
|
||||
addCriterion("`position` <", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionLessThanOrEqualTo(String value) {
|
||||
addCriterion("`position` <=", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionLike(String value) {
|
||||
addCriterion("`position` like", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionNotLike(String value) {
|
||||
addCriterion("`position` not like", value, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionIn(List<String> values) {
|
||||
addCriterion("`position` in", values, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionNotIn(List<String> values) {
|
||||
addCriterion("`position` not in", values, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionBetween(String value1, String value2) {
|
||||
addCriterion("`position` between", value1, value2, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPositionNotBetween(String value1, String value2) {
|
||||
addCriterion("`position` not between", value1, value2, "position");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
@ -9,6 +9,7 @@
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="position" jdbcType="VARCHAR" property="position" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.PanelView">
|
||||
<result column="content" jdbcType="LONGVARBINARY" property="content" />
|
||||
@ -72,7 +73,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, panel_id, chart_view_id, create_by, create_time, update_by, update_time
|
||||
id, panel_id, chart_view_id, create_by, create_time, update_by, update_time, `position`
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
content
|
||||
@ -128,10 +129,12 @@
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.PanelView">
|
||||
insert into panel_view (id, panel_id, chart_view_id,
|
||||
create_by, create_time, update_by,
|
||||
update_time, content)
|
||||
update_time, `position`, content
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{panelId,jdbcType=VARCHAR}, #{chartViewId,jdbcType=VARCHAR},
|
||||
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateBy,jdbcType=VARCHAR},
|
||||
#{updateTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARBINARY})
|
||||
#{updateTime,jdbcType=BIGINT}, #{position,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARBINARY}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelView">
|
||||
insert into panel_view
|
||||
@ -157,6 +160,9 @@
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="position != null">
|
||||
`position`,
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content,
|
||||
</if>
|
||||
@ -183,6 +189,9 @@
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="position != null">
|
||||
#{position,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
#{content,jdbcType=LONGVARBINARY},
|
||||
</if>
|
||||
@ -218,6 +227,9 @@
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.position != null">
|
||||
`position` = #{record.position,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.content != null">
|
||||
content = #{record.content,jdbcType=LONGVARBINARY},
|
||||
</if>
|
||||
@ -235,6 +247,7 @@
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_by = #{record.updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
`position` = #{record.position,jdbcType=VARCHAR},
|
||||
content = #{record.content,jdbcType=LONGVARBINARY}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -248,7 +261,8 @@
|
||||
create_by = #{record.createBy,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_by = #{record.updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
`position` = #{record.position,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -274,6 +288,9 @@
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="position != null">
|
||||
`position` = #{position,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content = #{content,jdbcType=LONGVARBINARY},
|
||||
</if>
|
||||
@ -288,6 +305,7 @@
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
`position` = #{position,jdbcType=VARCHAR},
|
||||
content = #{content,jdbcType=LONGVARBINARY}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
@ -298,7 +316,8 @@
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
`position` = #{position,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
@ -16,6 +16,13 @@ public class PanelViewInsertDTO extends PanelView {
|
||||
super();
|
||||
super.setChartViewId(chartViewId);
|
||||
super.setPanelId(panelGroupId);
|
||||
super.setPosition("panel");
|
||||
}
|
||||
public PanelViewInsertDTO(String chartViewId,String panelGroupId,String position) {
|
||||
super();
|
||||
super.setChartViewId(chartViewId);
|
||||
super.setPanelId(panelGroupId);
|
||||
super.setPosition(position);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,27 +34,27 @@ public class PanelViewService {
|
||||
|
||||
private final static String SCENE_TYPE = "scene";
|
||||
|
||||
public List<PanelViewDto> groups(){
|
||||
public List<PanelViewDto> groups() {
|
||||
return extPanelViewMapper.groups(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
}
|
||||
|
||||
public List<PanelViewDto> views(){
|
||||
public List<PanelViewDto> views() {
|
||||
return extPanelViewMapper.views(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
}
|
||||
|
||||
public List<PanelViewDto> buildTree(List<PanelViewPo> groups, List<PanelViewPo> views){
|
||||
public List<PanelViewDto> buildTree(List<PanelViewPo> groups, List<PanelViewPo> views) {
|
||||
if (CollectionUtils.isEmpty(groups) || CollectionUtils.isEmpty(views)) return null;
|
||||
Map<String, List<PanelViewPo>> viewsMap = views.stream().collect(Collectors.groupingBy(PanelViewPo::getPid));
|
||||
List<PanelViewDto> dtos = groups.stream().map(group -> BeanUtils.copyBean(new PanelViewDto(), group)).collect(Collectors.toList());
|
||||
List<PanelViewDto> roots = new ArrayList<>();
|
||||
dtos.forEach(group -> {
|
||||
// 查找跟节点
|
||||
if (ObjectUtils.isEmpty(group.getPid())){
|
||||
if (ObjectUtils.isEmpty(group.getPid())) {
|
||||
roots.add(group);
|
||||
}
|
||||
// 查找当前节点的子节点
|
||||
// 当前group是场景
|
||||
if (StringUtils.equals(group.getType(), SCENE_TYPE)){
|
||||
if (StringUtils.equals(group.getType(), SCENE_TYPE)) {
|
||||
Optional.ofNullable(viewsMap.get(group.getId())).ifPresent(lists -> lists.forEach(view -> {
|
||||
PanelViewDto dto = BeanUtils.copyBean(new PanelViewDto(), view);
|
||||
group.addChild(dto);
|
||||
@ -63,7 +63,7 @@ public class PanelViewService {
|
||||
}
|
||||
// 当前group是分组
|
||||
dtos.forEach(item -> {
|
||||
if (StringUtils.equals(item.getPid(), group.getId())){
|
||||
if (StringUtils.equals(item.getPid(), group.getId())) {
|
||||
group.addChild(item);
|
||||
}
|
||||
});
|
||||
@ -72,34 +72,48 @@ public class PanelViewService {
|
||||
return roots.stream().filter(item -> CollectionUtils.isNotEmpty(item.getChildren())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional(propagation=Propagation.REQUIRES_NEW)
|
||||
public Boolean syncPanelViews(PanelGroupWithBLOBs panelGroup){
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public Boolean syncPanelViews(PanelGroupWithBLOBs panelGroup) {
|
||||
Boolean mobileLayout = null;
|
||||
String panelId = panelGroup.getId();
|
||||
Assert.notNull(panelId, "panelId cannot be null");
|
||||
String panelData = panelGroup.getPanelData();
|
||||
if(StringUtils.isNotEmpty(panelData)){
|
||||
if (StringUtils.isNotEmpty(panelData)) {
|
||||
mobileLayout = false;
|
||||
JSONArray dataArray = JSON.parseArray(panelData);
|
||||
List<PanelViewInsertDTO> panelViewInsertDTOList = new ArrayList<>();
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject jsonObject = dataArray.getJSONObject(i);
|
||||
if("view".equals(jsonObject.getString("type"))){
|
||||
panelViewInsertDTOList.add(new PanelViewInsertDTO(jsonObject.getJSONObject("propValue").getString("viewId"),panelId));
|
||||
for (int i = 0; i < dataArray.size(); i++) {
|
||||
JSONObject jsonObject = dataArray.getJSONObject(i);
|
||||
if ("view".equals(jsonObject.getString("type"))) {
|
||||
panelViewInsertDTOList.add(new PanelViewInsertDTO(jsonObject.getJSONObject("propValue").getString("viewId"), panelId));
|
||||
}
|
||||
if(jsonObject.getBoolean("mobileSelected")!=null&&jsonObject.getBoolean("mobileSelected")){
|
||||
// 选项卡内部视图
|
||||
if ("de-tabs".equals(jsonObject.getString("type"))) {
|
||||
JSONObject options = jsonObject.getJSONObject("options");
|
||||
if (options != null) {
|
||||
JSONArray tabList = options.getJSONArray("tabList");
|
||||
if (CollectionUtils.isNotEmpty(tabList)) {
|
||||
for (int y = 0; y < tabList.size(); y++) {
|
||||
if(tabList.getJSONObject(y).getString("content").indexOf("viewId")>-1){
|
||||
panelViewInsertDTOList.add(new PanelViewInsertDTO(tabList.getJSONObject(y).getJSONObject("content").getJSONObject("propValue").getString("viewId"), panelId,"tab"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jsonObject.getBoolean("mobileSelected") != null && jsonObject.getBoolean("mobileSelected")) {
|
||||
mobileLayout = true;
|
||||
}
|
||||
}
|
||||
extPanelViewMapper.deleteWithPanelId(panelId);
|
||||
if(CollectionUtils.isNotEmpty(panelViewInsertDTOList)){
|
||||
if (CollectionUtils.isNotEmpty(panelViewInsertDTOList)) {
|
||||
extPanelViewMapper.savePanelView(panelViewInsertDTOList);
|
||||
}
|
||||
}
|
||||
return mobileLayout;
|
||||
}
|
||||
|
||||
public List<PanelViewTableDTO> detailList(String panelId){
|
||||
return extPanelViewMapper.getPanelViewDetails(panelId);
|
||||
public List<PanelViewTableDTO> detailList(String panelId) {
|
||||
return extPanelViewMapper.getPanelViewDetails(panelId);
|
||||
}
|
||||
}
|
||||
|
@ -350,3 +350,6 @@ INSERT INTO `sys_background_image` VALUES ('blue_5', '边框5', '蓝色调', NUL
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
ALTER TABLE `panel_view`
|
||||
ADD COLUMN `position` varchar(255) NULL DEFAULT 'panel' COMMENT '视图位置 panel 仪表板中,tab Tab页中' AFTER `update_time`;
|
||||
|
@ -60,6 +60,6 @@
|
||||
</javaClientGenerator>
|
||||
|
||||
<!--要生成的数据库表 -->
|
||||
<table tableName="sys_background_image"/>
|
||||
<table tableName="panel_view"/>
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
|
@ -1,9 +1,16 @@
|
||||
<template>
|
||||
<de-container>
|
||||
<de-aside-container v-if="!chart.type.includes('table')" :style="customStyle">
|
||||
<chart-component v-if="!chart.type.includes('text') && renderComponent() === 'echarts'" class="chart-class" :chart="chart" />
|
||||
<chart-component-g2 v-if="!chart.type.includes('text') && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
|
||||
<label-normal v-if="chart.type.includes('text')" :chart="chart" class="table-class" />
|
||||
<plugin-com
|
||||
v-if="chart.isPlugin"
|
||||
|
||||
:component-name="chart.type + '-view'"
|
||||
:obj="{chart}"
|
||||
class="chart-class"
|
||||
/>
|
||||
<chart-component v-else-if="!chart.type.includes('text') && renderComponent() === 'echarts'" class="chart-class" :chart="chart" />
|
||||
<chart-component-g2 v-else-if="!chart.type.includes('text') && renderComponent() === 'antv'" class="chart-class" :chart="chart" />
|
||||
<label-normal v-else-if="chart.type.includes('text')" :chart="chart" class="table-class" />
|
||||
</de-aside-container>
|
||||
<de-main-container>
|
||||
<table-normal :chart="chartTable" :show-summary="false" class="table-class" />
|
||||
@ -22,10 +29,10 @@ import DeAsideContainer from '@/components/dataease/DeAsideContainer'
|
||||
import { export_json_to_excel } from '@/plugins/Export2Excel'
|
||||
import { mapState } from 'vuex'
|
||||
import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
|
||||
|
||||
import PluginCom from '@/views/system/plugin/PluginCom'
|
||||
export default {
|
||||
name: 'UserView',
|
||||
components: { ChartComponentG2, DeMainContainer, DeContainer, DeAsideContainer, ChartComponent, TableNormal, LabelNormal },
|
||||
components: { ChartComponentG2, DeMainContainer, DeContainer, DeAsideContainer, ChartComponent, TableNormal, LabelNormal, PluginCom },
|
||||
props: {
|
||||
chart: {
|
||||
type: Object,
|
||||
|
@ -95,6 +95,7 @@ import { uuid } from 'vue-uuid'
|
||||
import bus from '@/utils/bus'
|
||||
import componentList from '@/components/canvas/custom-component/component-list'
|
||||
import { mapState } from 'vuex'
|
||||
import { chartCopy } from '@/api/chart/chart'
|
||||
|
||||
export default {
|
||||
name: 'DeTabls',
|
||||
@ -138,7 +139,9 @@ export default {
|
||||
dropdownShow() {
|
||||
return this.isEdit && !this.mobileLayoutStatus
|
||||
},
|
||||
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
...mapState([
|
||||
'curComponent',
|
||||
'mobileLayoutStatus'
|
||||
@ -211,11 +214,14 @@ export default {
|
||||
component.id = newComponentId
|
||||
component.style.width = '100%'
|
||||
component.style.height = '100%'
|
||||
this.curItem.content = component
|
||||
this.curItem.name = newComponentId
|
||||
this.viewDialogVisible = false
|
||||
this.activeTabName = newComponentId
|
||||
this.styleChange()
|
||||
chartCopy(node.innerId, this.panelInfo.id).then(res => {
|
||||
component.propValue.viewId = res.data
|
||||
this.curItem.content = component
|
||||
this.curItem.name = newComponentId
|
||||
this.viewDialogVisible = false
|
||||
this.activeTabName = newComponentId
|
||||
this.styleChange()
|
||||
})
|
||||
// this.setComponentInfo()
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user