Merge branch 'main' of github.com:dataease/dataease into main

This commit is contained in:
taojinlong 2021-05-24 18:07:21 +08:00
commit de3ec60cad
30 changed files with 624 additions and 143 deletions

View File

@ -21,5 +21,13 @@ public class PanelGroup implements Serializable {
private String panelType;
private String source;
private String extend1;
private String extend2;
private String remark;
private static final long serialVersionUID = 1L;
}

View File

@ -643,6 +643,286 @@ public class PanelGroupExample {
addCriterion("panel_type not between", value1, value2, "panelType");
return (Criteria) this;
}
public Criteria andSourceIsNull() {
addCriterion("`source` is null");
return (Criteria) this;
}
public Criteria andSourceIsNotNull() {
addCriterion("`source` is not null");
return (Criteria) this;
}
public Criteria andSourceEqualTo(String value) {
addCriterion("`source` =", value, "source");
return (Criteria) this;
}
public Criteria andSourceNotEqualTo(String value) {
addCriterion("`source` <>", value, "source");
return (Criteria) this;
}
public Criteria andSourceGreaterThan(String value) {
addCriterion("`source` >", value, "source");
return (Criteria) this;
}
public Criteria andSourceGreaterThanOrEqualTo(String value) {
addCriterion("`source` >=", value, "source");
return (Criteria) this;
}
public Criteria andSourceLessThan(String value) {
addCriterion("`source` <", value, "source");
return (Criteria) this;
}
public Criteria andSourceLessThanOrEqualTo(String value) {
addCriterion("`source` <=", value, "source");
return (Criteria) this;
}
public Criteria andSourceLike(String value) {
addCriterion("`source` like", value, "source");
return (Criteria) this;
}
public Criteria andSourceNotLike(String value) {
addCriterion("`source` not like", value, "source");
return (Criteria) this;
}
public Criteria andSourceIn(List<String> values) {
addCriterion("`source` in", values, "source");
return (Criteria) this;
}
public Criteria andSourceNotIn(List<String> values) {
addCriterion("`source` not in", values, "source");
return (Criteria) this;
}
public Criteria andSourceBetween(String value1, String value2) {
addCriterion("`source` between", value1, value2, "source");
return (Criteria) this;
}
public Criteria andSourceNotBetween(String value1, String value2) {
addCriterion("`source` not between", value1, value2, "source");
return (Criteria) this;
}
public Criteria andExtend1IsNull() {
addCriterion("extend1 is null");
return (Criteria) this;
}
public Criteria andExtend1IsNotNull() {
addCriterion("extend1 is not null");
return (Criteria) this;
}
public Criteria andExtend1EqualTo(String value) {
addCriterion("extend1 =", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotEqualTo(String value) {
addCriterion("extend1 <>", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1GreaterThan(String value) {
addCriterion("extend1 >", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1GreaterThanOrEqualTo(String value) {
addCriterion("extend1 >=", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1LessThan(String value) {
addCriterion("extend1 <", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1LessThanOrEqualTo(String value) {
addCriterion("extend1 <=", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1Like(String value) {
addCriterion("extend1 like", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotLike(String value) {
addCriterion("extend1 not like", value, "extend1");
return (Criteria) this;
}
public Criteria andExtend1In(List<String> values) {
addCriterion("extend1 in", values, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotIn(List<String> values) {
addCriterion("extend1 not in", values, "extend1");
return (Criteria) this;
}
public Criteria andExtend1Between(String value1, String value2) {
addCriterion("extend1 between", value1, value2, "extend1");
return (Criteria) this;
}
public Criteria andExtend1NotBetween(String value1, String value2) {
addCriterion("extend1 not between", value1, value2, "extend1");
return (Criteria) this;
}
public Criteria andExtend2IsNull() {
addCriterion("extend2 is null");
return (Criteria) this;
}
public Criteria andExtend2IsNotNull() {
addCriterion("extend2 is not null");
return (Criteria) this;
}
public Criteria andExtend2EqualTo(String value) {
addCriterion("extend2 =", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotEqualTo(String value) {
addCriterion("extend2 <>", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2GreaterThan(String value) {
addCriterion("extend2 >", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2GreaterThanOrEqualTo(String value) {
addCriterion("extend2 >=", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2LessThan(String value) {
addCriterion("extend2 <", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2LessThanOrEqualTo(String value) {
addCriterion("extend2 <=", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2Like(String value) {
addCriterion("extend2 like", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotLike(String value) {
addCriterion("extend2 not like", value, "extend2");
return (Criteria) this;
}
public Criteria andExtend2In(List<String> values) {
addCriterion("extend2 in", values, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotIn(List<String> values) {
addCriterion("extend2 not in", values, "extend2");
return (Criteria) this;
}
public Criteria andExtend2Between(String value1, String value2) {
addCriterion("extend2 between", value1, value2, "extend2");
return (Criteria) this;
}
public Criteria andExtend2NotBetween(String value1, String value2) {
addCriterion("extend2 not between", value1, value2, "extend2");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -10,6 +10,10 @@
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="panel_type" jdbcType="VARCHAR" property="panelType" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="extend1" jdbcType="VARCHAR" property="extend1" />
<result column="extend2" jdbcType="VARCHAR" property="extend2" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.PanelGroupWithBLOBs">
<result column="panel_style" jdbcType="LONGVARCHAR" property="panelStyle" />
@ -74,7 +78,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, pid, `level`, node_type, create_by, create_time, panel_type
id, `name`, pid, `level`, node_type, create_by, create_time, panel_type, `source`,
extend1, extend2, remark
</sql>
<sql id="Blob_Column_List">
panel_style, panel_data
@ -130,12 +135,14 @@
<insert id="insert" parameterType="io.dataease.base.domain.PanelGroupWithBLOBs">
insert into panel_group (id, `name`, pid,
`level`, node_type, create_by,
create_time, panel_type, panel_style,
panel_data)
create_time, panel_type, `source`,
extend1, extend2, remark,
panel_style, panel_data)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR},
#{level,jdbcType=INTEGER}, #{nodeType,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{panelType,jdbcType=VARCHAR}, #{panelStyle,jdbcType=LONGVARCHAR},
#{panelData,jdbcType=LONGVARCHAR})
#{createTime,jdbcType=BIGINT}, #{panelType,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
#{extend1,jdbcType=VARCHAR}, #{extend2,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{panelStyle,jdbcType=LONGVARCHAR}, #{panelData,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelGroupWithBLOBs">
insert into panel_group
@ -164,6 +171,18 @@
<if test="panelType != null">
panel_type,
</if>
<if test="source != null">
`source`,
</if>
<if test="extend1 != null">
extend1,
</if>
<if test="extend2 != null">
extend2,
</if>
<if test="remark != null">
remark,
</if>
<if test="panelStyle != null">
panel_style,
</if>
@ -196,6 +215,18 @@
<if test="panelType != null">
#{panelType,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="extend1 != null">
#{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
#{extend2,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="panelStyle != null">
#{panelStyle,jdbcType=LONGVARCHAR},
</if>
@ -237,6 +268,18 @@
<if test="record.panelType != null">
panel_type = #{record.panelType,jdbcType=VARCHAR},
</if>
<if test="record.source != null">
`source` = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.extend1 != null">
extend1 = #{record.extend1,jdbcType=VARCHAR},
</if>
<if test="record.extend2 != null">
extend2 = #{record.extend2,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.panelStyle != null">
panel_style = #{record.panelStyle,jdbcType=LONGVARCHAR},
</if>
@ -258,6 +301,10 @@
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
panel_type = #{record.panelType,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=VARCHAR},
extend1 = #{record.extend1,jdbcType=VARCHAR},
extend2 = #{record.extend2,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
panel_style = #{record.panelStyle,jdbcType=LONGVARCHAR},
panel_data = #{record.panelData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -273,7 +320,11 @@
node_type = #{record.nodeType,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
panel_type = #{record.panelType,jdbcType=VARCHAR}
panel_type = #{record.panelType,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=VARCHAR},
extend1 = #{record.extend1,jdbcType=VARCHAR},
extend2 = #{record.extend2,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -302,6 +353,18 @@
<if test="panelType != null">
panel_type = #{panelType,jdbcType=VARCHAR},
</if>
<if test="source != null">
`source` = #{source,jdbcType=VARCHAR},
</if>
<if test="extend1 != null">
extend1 = #{extend1,jdbcType=VARCHAR},
</if>
<if test="extend2 != null">
extend2 = #{extend2,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="panelStyle != null">
panel_style = #{panelStyle,jdbcType=LONGVARCHAR},
</if>
@ -320,6 +383,10 @@
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
panel_type = #{panelType,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR},
extend1 = #{extend1,jdbcType=VARCHAR},
extend2 = #{extend2,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
panel_style = #{panelStyle,jdbcType=LONGVARCHAR},
panel_data = #{panelData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -332,7 +399,11 @@
node_type = #{nodeType,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
panel_type = #{panelType,jdbcType=VARCHAR}
panel_type = #{panelType,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR},
extend1 = #{extend1,jdbcType=VARCHAR},
extend2 = #{extend2,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -11,7 +11,7 @@
<select id="search" resultMap="BaseResultMapDTO">
select
id, `name`, pid, `level`, `type`, create_by, create_time,`name` as label,
id, `name`, ifnull(pid,0) as pid, `level`, `type`, create_by, create_time,`name` as label,
get_auths(id,'chart',#{userId}) as `privileges`
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'chart') cids) t,chart_group
<where>

View File

@ -11,7 +11,7 @@
<select id="search" resultMap="BaseResultMapDTO">
select
id, `name`, pid, `level`, `type`, create_by, create_time,`name` as label,
id, `name`, ifnull(pid,0) as pid, `level`, `type`, create_by, create_time,`name` as label,
get_auths(id,'dataset',#{userId}) as `privileges`
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'dataset') cids) t,dataset_group
<where>

View File

@ -24,5 +24,14 @@ public class PanelConstants {
public final static String PANEL_NODE_TYPE_PANEL = "panel";
public final static String OPT_TYPE_INSERT="insert";
public final static String OPT_TYPE_UPDATE="update";
public final static String PANEL_GATHER_DEFAULT_PANEL = "default_panel";
public final static String PANEL_GATHER_PANEL_LIST = "panel_list";
}

View File

@ -0,0 +1,23 @@
package io.dataease.commons.model;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2021-05-24
* Description:
*/
public interface ITreeBase<T> {
String getId();
void setId(String id);
String getPid();
void setPid(String pid);
List<T> getChildren();
void setChildren(List<T> children);
}

View File

@ -0,0 +1,53 @@
package io.dataease.commons.utils;
import io.dataease.commons.model.ITreeBase;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.Assert;
import java.util.*;
import java.util.stream.Collectors;
/**
* Author: wangjiahao
* Date: 2021-05-24
* Description:树构建工具
*/
public class TreeUtils{
/**
* Description: rootPid 是根节点PID
*/
public static<T extends ITreeBase> List<T> mergeTree(List<T> tree,String ... rootPid) {
Assert.notNull(rootPid, "Root Pid cannot be null");
List<T> result = new ArrayList<>();
// 构建id-节点map映射
Map<String, T> treePidMap = tree.stream().collect(Collectors.toMap(T::getId, t -> t));
tree.stream().forEach(node -> {
// 判断根节点
if (Arrays.asList(rootPid).contains(node.getPid())) {
result.add(node);
} else {
//找到父元素
T parentNode = treePidMap.get(node.getPid());
if(parentNode==null){
// 可能出现 rootPid 更高的节点 这个操作相当于截断
return;
}
if (parentNode.getChildren() == null) {
parentNode.setChildren(new ArrayList());
}
parentNode.getChildren().add(node);
}
});
return result;
}
/**
* Description: rootPid 是根节点PID 档期那默认是0
*/
public static<T extends ITreeBase> List<T> mergeTree(List<T> tree) {
return mergeTree(tree,"0");
}
}

View File

@ -1,7 +1,9 @@
package io.dataease.controller.panel;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.base.domain.PanelGroup;
import io.dataease.base.domain.PanelGroupWithBLOBs;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
@ -28,18 +30,18 @@ public class PanelGroupController {
@PostMapping("/tree")
public List<PanelGroupDTO> tree(@RequestBody PanelGroupRequest request) {
request.setLevel(0);
return panelGroupService.tree(request);
}
@PostMapping("/defaultTree")
public List<PanelGroupDTO> defaultTree(@RequestBody PanelGroupRequest request) {
return panelGroupService.getDefaultTree(request);
return panelGroupService.defaultTree(request);
}
@PostMapping("/save")
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) {
return panelGroupService.save(request);
@I18n
public PanelGroup saveOrUpdate(@RequestBody PanelGroupRequest request) {
return panelGroupService.saveOrUpdate(request);
}
@PostMapping("/deleteCircle/{id}")

View File

@ -36,6 +36,7 @@ public class SysAuthController {
@ApiOperation("查询视图")
@PostMapping("/authModels")
@I18n
public List<VAuthModelDTO> authModels(@RequestBody BaseTreeRequest request){
return sysAuthService.searchAuthModelTree(request);
}

View File

@ -1,13 +1,14 @@
package io.dataease.dto.chart;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.commons.model.ITreeBase;
import lombok.Data;
import java.util.List;
@Data
public class ChartGroupDTO extends DatasetGroup {
public class ChartGroupDTO extends DatasetGroup implements ITreeBase<ChartGroupDTO> {
private String label;
private List<ChartGroupDTO> children;

View File

@ -1,6 +1,7 @@
package io.dataease.dto.dataset;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.commons.model.ITreeBase;
import lombok.Data;
import java.util.List;
@ -10,7 +11,7 @@ import java.util.List;
* @Date 2021/2/20 8:17 下午
*/
@Data
public class DataSetGroupDTO extends DatasetGroup {
public class DataSetGroupDTO extends DatasetGroup implements ITreeBase<DataSetGroupDTO> {
private String label;
private List<DataSetGroupDTO> children;

View File

@ -1,8 +1,7 @@
package io.dataease.dto.panel;
import io.dataease.base.domain.PanelGroup;
import io.dataease.base.domain.PanelGroupWithBLOBs;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.commons.model.ITreeBase;
import lombok.Data;
import java.util.ArrayList;
@ -14,14 +13,15 @@ import java.util.List;
* Description:
*/
@Data
public class PanelGroupDTO extends PanelGroupWithBLOBs {
public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase<PanelGroupDTO> {
private String label;
private List<PanelGroupDTO> children;
private Boolean leaf;
private String privileges;
private List<PanelGroupDTO> children = new ArrayList<>();
}

View File

@ -5,6 +5,7 @@ import io.dataease.base.mapper.ChartGroupMapper;
import io.dataease.base.mapper.ext.ExtChartGroupMapper;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.chart.ChartGroupDTO;
@ -71,29 +72,11 @@ public class ChartGroupService {
}
public List<ChartGroupDTO> tree(ChartGroupRequest chartGroup) {
chartGroup.setLevel(null);
chartGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
if (chartGroup.getLevel() == null) {
chartGroup.setLevel(0);
}
List<ChartGroupDTO> treeInfo = extChartGroupMapper.search(chartGroup);
getAll(treeInfo, chartGroup);
return treeInfo;
}
public void getAll(List<ChartGroupDTO> list, ChartGroupRequest chartGroup) {
for (ChartGroupDTO obj : list) {
ChartGroupRequest newChartGroup = new ChartGroupRequest();
newChartGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
newChartGroup.setName(chartGroup.getName());
newChartGroup.setType(chartGroup.getType());
newChartGroup.setPid(obj.getId());
newChartGroup.setSort(chartGroup.getSort());
List<ChartGroupDTO> treeInfo = extChartGroupMapper.search(newChartGroup);
obj.setChildren(treeInfo);
if (CollectionUtils.isNotEmpty(treeInfo)) {
getAll(treeInfo, chartGroup);
}
}
List<ChartGroupDTO> result = TreeUtils.mergeTree(treeInfo);
return result;
}
public List<String> getAllId(List<ChartGroupDTO> list, List<String> ids) {

View File

@ -7,6 +7,7 @@ import io.dataease.base.mapper.DatasetGroupMapper;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
@ -84,29 +85,11 @@ public class DataSetGroupService {
}
public List<DataSetGroupDTO> tree(DataSetGroupRequest datasetGroup) {
datasetGroup.setLevel(null);
datasetGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
if (datasetGroup.getLevel() == null) {
datasetGroup.setLevel(0);
}
List<DataSetGroupDTO> treeInfo = extDataSetGroupMapper.search(datasetGroup);
getAll(treeInfo, datasetGroup);
return treeInfo;
}
public void getAll(List<DataSetGroupDTO> list, DataSetGroupRequest datasetGroup) {
for (DataSetGroupDTO obj : list) {
DataSetGroupRequest newDataSetGroup = new DataSetGroupRequest();
newDataSetGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
newDataSetGroup.setName(datasetGroup.getName());
newDataSetGroup.setType(datasetGroup.getType());
newDataSetGroup.setPid(obj.getId());
newDataSetGroup.setSort(datasetGroup.getSort());
List<DataSetGroupDTO> treeInfo = extDataSetGroupMapper.search(newDataSetGroup);
obj.setChildren(treeInfo);
if (CollectionUtils.isNotEmpty(treeInfo)) {
getAll(treeInfo, datasetGroup);
}
}
List<DataSetGroupDTO> result = TreeUtils.mergeTree(treeInfo);
return result;
}
public List<String> getAllId(List<DataSetGroupDTO> list, List<String> ids) {

View File

@ -9,11 +9,13 @@ import io.dataease.base.mapper.ext.ExtPanelGroupMapper;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.panel.PanelDesignDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.i18n.Translator;
import io.dataease.service.chart.ChartViewService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -55,52 +57,69 @@ public class PanelGroupService {
private ShareService shareService;
@Resource
private PanelLinkService panelLinkService;
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
panelGroupRequest.setUserId(userId);
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupList(panelGroupRequest);
getTreeChildren(panelGroupDTOList,userId);
return panelGroupDTOList;
List<PanelGroupDTO> result = TreeUtils.mergeTree(panelGroupDTOList,"panel_list");
return result;
}
public void getTreeChildren(List<PanelGroupDTO> parentPanelGroupDTO,String userId) {
Optional.ofNullable(parentPanelGroupDTO).ifPresent(parent -> parent.forEach(panelGroupDTO -> {
List<PanelGroupDTO> panelGroupDTOChildren = extPanelGroupMapper.panelGroupList(new PanelGroupRequest(panelGroupDTO.getId(),userId));
panelGroupDTO.setChildren(panelGroupDTOChildren);
getTreeChildren(panelGroupDTOChildren,userId);
}));
public List<PanelGroupDTO> defaultTree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
panelGroupRequest.setUserId(userId);
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupList(panelGroupRequest);
List<PanelGroupDTO> result = TreeUtils.mergeTree(panelGroupDTOList,"default_panel");
return result;
}
public List<PanelGroupDTO> getDefaultTree(PanelGroupRequest panelGroupRequest) {
return extPanelGroupMapper.panelGroupListDefault(panelGroupRequest);
}
public PanelGroupDTO save(PanelGroupRequest request) {
if (StringUtils.isEmpty(request.getId())) {
request.setId(UUID.randomUUID().toString());
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
String panelId = request.getId();
if (StringUtils.isEmpty(panelId)) {
// 新建
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null);
panelId = UUID.randomUUID().toString();
request.setId(panelId);
request.setCreateTime(System.currentTimeMillis());
request.setCreateBy(AuthUtils.getUser().getUsername());
panelGroupMapper.insert(request);
} else {
// 复制为默认仪表盘
if("toDefaultPanel".equals(request.getOptType())){
} else if ("toDefaultPanel".equals(request.getOptType())) {
panelId = UUID.randomUUID().toString();
// 转存为默认仪表盘
PanelGroupWithBLOBs newDefaultPanel = panelGroupMapper.selectByPrimaryKey(request.getId());
newDefaultPanel.setPanelType(PanelConstants.PANEL_TYPE_SYSTEM);
newDefaultPanel.setNodeType(PanelConstants.PANEL_NODE_TYPE_PANEL);
newDefaultPanel.setName(request.getName());
newDefaultPanel.setId(UUID.randomUUID().toString());
newDefaultPanel.setPid(null);
newDefaultPanel.setId(panelId);
newDefaultPanel.setPid(PanelConstants.PANEL_GATHER_DEFAULT_PANEL);
newDefaultPanel.setLevel(0);
newDefaultPanel.setSource(request.getId());
checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId());
panelGroupMapper.insertSelective(newDefaultPanel);
}else{
} else {
// 更新
if (StringUtils.isNotEmpty(request.getName())) {
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_UPDATE, request.getId());
}
panelGroupMapper.updateByPrimaryKeySelective(request);
}
return panelGroupMapper.selectByPrimaryKey(panelId);
}
private void checkPanelName(String name, String pid, String optType, String id) {
PanelGroupExample groupExample = new PanelGroupExample();
if (PanelConstants.OPT_TYPE_INSERT.equalsIgnoreCase(optType)) {
groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name);
} else if (PanelConstants.OPT_TYPE_UPDATE.equalsIgnoreCase(optType)) {
groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name).andIdNotEqualTo(id);
}
List<PanelGroup> checkResult = panelGroupMapper.selectByExample(groupExample);
if (CollectionUtils.isNotEmpty(checkResult)) {
throw new RuntimeException(Translator.get("i18n_same_folder_can_not_repeat"));
}
PanelGroupDTO panelGroupDTO = new PanelGroupDTO();
BeanUtils.copyBean(panelGroupDTO, request);
panelGroupDTO.setLabel(request.getName());
return panelGroupDTO;
}
@ -118,7 +137,6 @@ public class PanelGroupService {
}
public List<ChartViewDTO> getUsableViews(String panelId) throws Exception {
List<ChartViewDTO> chartViewDTOList = new ArrayList<>();
List<ChartView> allChartView = chartViewMapper.selectByExample(null);

View File

@ -311,18 +311,23 @@ CREATE TABLE `panel_design` (
DROP TABLE IF EXISTS `panel_group`;
CREATE TABLE `panel_group` (
`id` varchar(50) NOT NULL,
`name` varchar(255) DEFAULT NULL COMMENT '名称',
`pid` varchar(255) DEFAULT NULL COMMENT '父级id',
`level` int(10) DEFAULT NULL COMMENT '层级',
`node_type` varchar(255) DEFAULT NULL COMMENT '节点类型 folder or panel 目录或者文件夹',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`create_time` bigint(13) DEFAULT NULL COMMENT '创建时间',
`panel_type` varchar(255) DEFAULT NULL COMMENT '仪表盘类型 system 系统内置 self 用户自建 ',
`panel_style` longtext COMMENT 'panel 样式',
`panel_data` longtext COMMENT 'panel 数据',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
`id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
`pid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '父级id',
`level` int(10) NULL DEFAULT NULL COMMENT '层级',
`node_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '节点类型 folder or panel 目录或者文件夹',
`create_by` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
`panel_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仪表盘类型 system 系统内置 self 用户自建 ',
`panel_style` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'panel 样式',
`panel_data` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'panel 数据',
`source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据来源 导入 或者 其他仪表盘另存',
`extend1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`extend2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
DROP TABLE IF EXISTS `panel_view`;
CREATE TABLE `panel_view` (

View File

@ -108,12 +108,8 @@ INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUE
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.title', '', 'text', 5);
BEGIN;
INSERT INTO `panel_group` VALUES ('1001', '飞致云', NULL, 0, 'folder', NULL, NULL, 'self', NULL, NULL);
INSERT INTO `panel_group` VALUES ('1c78bc65-ea38-40bc-ad73-738a9b386379', '测试仪表盘1', '1001', 1, 'panel', NULL, 1615961778552, NULL, NULL, NULL);
INSERT INTO `panel_group` VALUES ('2003', '默认仪表盘1', NULL, NULL, 'panel', NULL, NULL, 'system', NULL, NULL);
INSERT INTO `panel_group` VALUES ('2004', '默认仪表盘2', NULL, NULL, 'panel', NULL, NULL, 'system', NULL, NULL);
INSERT INTO `panel_group` VALUES ('8ff64eb1-a96a-4218-85cd-01b437d21f2e', '测试仪表盘2', '1001', 1, 'panel', NULL, 1615200099827, NULL, NULL, NULL);
INSERT INTO `panel_group` VALUES ('d15f816d-46b7-4859-8ec8-2b19918dc772', 'TSEE', '1001', 1, 'folder', NULL, 1616403978419, NULL, NULL, NULL);
INSERT INTO `panel_group`(`id`, `name`, `pid`, `level`, `node_type`, `create_by`, `create_time`, `panel_type`, `panel_style`, `panel_data`, `source`, `extend1`, `extend2`, `remark`) VALUES ('default_panel', 'i18n_default_panel', '0', -1, 'folder', 'admin', NULL, 'system', NULL, NULL, NULL, NULL, NULL, '系统内置 默认仪表盘');
INSERT INTO `panel_group`(`id`, `name`, `pid`, `level`, `node_type`, `create_by`, `create_time`, `panel_type`, `panel_style`, `panel_data`, `source`, `extend1`, `extend2`, `remark`) VALUES ('panel_list', 'i18n_panel_list', '0', -1, 'folder', 'admin', NULL, 'self', NULL, NULL, NULL, NULL, NULL, '系统内置 仪表盘列表');
COMMIT;

View File

@ -63,7 +63,7 @@ COMMIT;
-- View structure for v_auth_model
-- ----------------------------
DROP VIEW IF EXISTS `v_auth_model`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_model` AS select `sys_user`.`user_id` AS `id`,`sys_user`.`username` AS `name`,`sys_user`.`username` AS `label`,'0' AS `pid`,'leaf' AS `node_type`,'user' AS `model_type`,'user' AS `model_inner_type`,'target' AS `auth_type`,`sys_user`.`create_by` AS `create_by` from `sys_user` union all select `sys_role`.`role_id` AS `id`,`sys_role`.`name` AS `name`,`sys_role`.`name` AS `label`,'0' AS `pid`,'leaf' AS `node_type`,'role' AS `model_type`,'role' AS `model_inner_type`,'target' AS `auth_type`,`sys_role`.`create_by` AS `create_by` from `sys_role` union all select `sys_dept`.`dept_id` AS `id`,`sys_dept`.`name` AS `name`,`sys_dept`.`name` AS `lable`,cast(`sys_dept`.`pid` as char charset utf8mb4) AS `pid`,if((`sys_dept`.`sub_count` = 0),'leaf','spine') AS `node_type`,'dept' AS `model_type`,'dept' AS `model_inner_type`,'target' AS `auth_type`,`sys_dept`.`create_by` AS `create_by` from `sys_dept` union all select `datasource`.`id` AS `id`,`datasource`.`name` AS `NAME`,`datasource`.`name` AS `label`,'0' AS `pid`,'leaf' AS `node_type`,'link' AS `model_type`,`datasource`.`type` AS `model_inner_type`,'source' AS `auth_type`,`datasource`.`create_by` AS `create_by` from `datasource` union all select `dataset_group`.`id` AS `id`,`dataset_group`.`name` AS `NAME`,`dataset_group`.`name` AS `lable`,if(isnull(`dataset_group`.`pid`),'0',`dataset_group`.`pid`) AS `pid`,'spine' AS `node_type`,'dataset' AS `model_type`,`dataset_group`.`type` AS `model_inner_type`,'source' AS `auth_type`,`dataset_group`.`create_by` AS `create_by` from `dataset_group` union all select `dataset_table`.`id` AS `id`,`dataset_table`.`name` AS `NAME`,`dataset_table`.`name` AS `lable`,`dataset_table`.`scene_id` AS `pid`,'leaf' AS `node_type`,'dataset' AS `model_type`,`dataset_table`.`type` AS `model_inner_type`,'source' AS `auth_type`,`dataset_table`.`create_by` AS `create_by` from `dataset_table` union all select `chart_group`.`id` AS `id`,`chart_group`.`name` AS `name`,`chart_group`.`name` AS `label`,if(isnull(`chart_group`.`pid`),'0',`chart_group`.`pid`) AS `pid`,'spine' AS `node_type`,'chart' AS `model_type`,`chart_group`.`type` AS `model_inner_type`,'source' AS `auth_type`,`chart_group`.`create_by` AS `create_by` from `chart_group` union all select `chart_view`.`id` AS `id`,`chart_view`.`name` AS `name`,`chart_view`.`name` AS `label`,`chart_view`.`scene_id` AS `pid`,'leaf' AS `node_type`,'chart' AS `model_type`,`chart_view`.`type` AS `model_inner_type`,'source' AS `auth_type`,`chart_view`.`create_by` AS `create_by` from `chart_view` union all select `panel_group`.`id` AS `id`,`panel_group`.`name` AS `NAME`,`panel_group`.`name` AS `label`,if(isnull(`panel_group`.`pid`),'0',`panel_group`.`pid`) AS `pid`,if((`panel_group`.`node_type` = 'folder'),'spine','leaf') AS `node_type`,'panel' AS `model_type`,`panel_group`.`panel_type` AS `model_inner_type`,'source' AS `auth_type`,`panel_group`.`create_by` AS `create_by` from `panel_group` where (`panel_group`.`panel_type` = 'self');
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_model` AS select `sys_user`.`user_id` AS `id`,`sys_user`.`username` AS `name`,`sys_user`.`username` AS `label`,'0' AS `pid`,'leaf' AS `node_type`,'user' AS `model_type`,'user' AS `model_inner_type`,'target' AS `auth_type`,`sys_user`.`create_by` AS `create_by` from `sys_user` union all select `sys_role`.`role_id` AS `id`,`sys_role`.`name` AS `name`,`sys_role`.`name` AS `label`,'0' AS `pid`,'leaf' AS `node_type`,'role' AS `model_type`,'role' AS `model_inner_type`,'target' AS `auth_type`,`sys_role`.`create_by` AS `create_by` from `sys_role` union all select `sys_dept`.`dept_id` AS `id`,`sys_dept`.`name` AS `name`,`sys_dept`.`name` AS `lable`,cast(`sys_dept`.`pid` as char charset utf8mb4) AS `pid`,if((`sys_dept`.`sub_count` = 0),'leaf','spine') AS `node_type`,'dept' AS `model_type`,'dept' AS `model_inner_type`,'target' AS `auth_type`,`sys_dept`.`create_by` AS `create_by` from `sys_dept` union all select `datasource`.`id` AS `id`,`datasource`.`name` AS `NAME`,`datasource`.`name` AS `label`,'0' AS `pid`,'leaf' AS `node_type`,'link' AS `model_type`,`datasource`.`type` AS `model_inner_type`,'source' AS `auth_type`,`datasource`.`create_by` AS `create_by` from `datasource` union all select `dataset_group`.`id` AS `id`,`dataset_group`.`name` AS `NAME`,`dataset_group`.`name` AS `lable`,if(isnull(`dataset_group`.`pid`),'0',`dataset_group`.`pid`) AS `pid`,'spine' AS `node_type`,'dataset' AS `model_type`,`dataset_group`.`type` AS `model_inner_type`,'source' AS `auth_type`,`dataset_group`.`create_by` AS `create_by` from `dataset_group` union all select `dataset_table`.`id` AS `id`,`dataset_table`.`name` AS `NAME`,`dataset_table`.`name` AS `lable`,`dataset_table`.`scene_id` AS `pid`,'leaf' AS `node_type`,'dataset' AS `model_type`,`dataset_table`.`type` AS `model_inner_type`,'source' AS `auth_type`,`dataset_table`.`create_by` AS `create_by` from `dataset_table` union all select `chart_group`.`id` AS `id`,`chart_group`.`name` AS `name`,`chart_group`.`name` AS `label`,if(isnull(`chart_group`.`pid`),'0',`chart_group`.`pid`) AS `pid`,'spine' AS `node_type`,'chart' AS `model_type`,`chart_group`.`type` AS `model_inner_type`,'source' AS `auth_type`,`chart_group`.`create_by` AS `create_by` from `chart_group` union all select `chart_view`.`id` AS `id`,`chart_view`.`name` AS `name`,`chart_view`.`name` AS `label`,`chart_view`.`scene_id` AS `pid`,'leaf' AS `node_type`,'chart' AS `model_type`,`chart_view`.`type` AS `model_inner_type`,'source' AS `auth_type`,`chart_view`.`create_by` AS `create_by` from `chart_view` union all select `panel_group`.`id` AS `id`,`panel_group`.`name` AS `NAME`,`panel_group`.`name` AS `label`,(case `panel_group`.`id` when 'panel_list' then '0' when 'default_panel' then '0' else `panel_group`.`pid` end) AS `pid`,if((`panel_group`.`node_type` = 'folder'),'spine','leaf') AS `node_type`,'panel' AS `model_type`,`panel_group`.`panel_type` AS `model_inner_type`,'source' AS `auth_type`,`panel_group`.`create_by` AS `create_by` from `panel_group`;
-- ----------------------------
-- View structure for v_auth_privilege

View File

@ -64,7 +64,7 @@
<!--要生成的数据库表 -->
<table tableName="datasource"/>
<!-- <table tableName="datasource"/>-->
<!-- <table tableName="sys_dict"/>-->
<!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>-->
@ -74,6 +74,7 @@
<!-- </table>-->
<!-- <table tableName="v_dataset"/>-->
<!-- <table tableName="sys_auth_detail"/>-->
<table tableName="panel_group"/>
</context>

View File

@ -232,3 +232,6 @@ i18n_name_cant_repeat_same_group=Name is already exists in the same group
i18n_chart_count=Count*
i18n_excel_have_merge_region=Excel has merged region
i18n_cron_expression_error=Cron expression error
i18n_same_folder_can_not_repeat=Same Folder Can Not Repeat
i18n_default_panel=Default Panel
i18n_panel_list=Panel List

View File

@ -233,3 +233,6 @@ i18n_name_cant_repeat_same_group=同一分组下名称不能重复
i18n_chart_count=记录数*
i18n_excel_have_merge_region=Excel存在合并单元格
i18n_cron_expression_error=Cron表达式校验错误
i18n_same_folder_can_not_repeat=相同的目录下名称不能重复
i18n_default_panel=默认仪表盘
i18n_panel_list=仪表盘列表

View File

@ -233,3 +233,6 @@ i18n_name_cant_repeat_same_group=同一分組下名稱不能重復
i18n_chart_count=記錄數*
i18n_excel_have_merge_region=Excel存在合並單元格
i18n_cron_expression_error=Cron表達式校驗錯誤
i18n_same_folder_can_not_repeat=相同的目录下名称不能重复
i18n_default_panel=默认仪表盘
i18n_panel_list=仪表盘列表

View File

@ -69,6 +69,13 @@ export function panelSave(data) {
data
})
}
export function findOne(id) {
return request({
url: 'panel/group/findOne/' + id,
method: 'get',
loading: true
})
}
export function getTable(id) {
return request({

View File

@ -160,7 +160,7 @@ export default {
handleFileChange(e) {
const file = e.target.files[0]
if (!file.type.includes('image')) {
toast(this.$t('panel.picture_limit'))
toast('只能插入图片')
return
}
@ -209,7 +209,7 @@ export default {
panelData: JSON.stringify(this.componentData)
}
post('panel/group/save', requestInfo, () => {})
this.$message.success(this.$t('commons.save_success'))
this.$message.success('保存成功')
},
clearCanvas() {
this.$store.commit('setComponentData', [])

View File

@ -8,7 +8,8 @@ const getDefaultState = () => {
preStyle: null
},
canvasStyleDataTemp: null, // 页面全局临时存储数据
componentDataTemp: null // 画布组件临时存储数据
componentDataTemp: null, // 画布组件临时存储数据
mainActiveName: 'PanelMain'
}
}
@ -18,6 +19,9 @@ const mutations = {
setPanelName: (state, panelName) => {
state.panelName = panelName
},
setMainActiveName: (state, mainActiveName) => {
state.mainActiveName = mainActiveName
},
setPanelInfo: (state, panelInfo) => {
state.panelInfo = panelInfo
},
@ -33,6 +37,9 @@ const actions = {
setPanelName({ commit }, panelName) {
commit('setPanelName', panelName)
},
setMainActiveName({ commit }, mainActiveName) {
commit('setMainActiveName', mainActiveName)
},
setPanelInfo({ commit }, panelInfo) {
commit('setPanelInfo', panelInfo)
},

View File

@ -140,6 +140,7 @@ import { uuid } from 'vue-uuid'
import Toolbar from '@/components/canvas/components/Toolbar'
import { get } from '@/api/panel/panel'
import PreviewFullScreen from '@/components/canvas/components/Editor/PreviewFullScreen'
import Preview from '@/components/canvas/components/Editor/Preview'
//
import '@/components/canvas/assets/iconfont/iconfont.css'
@ -160,7 +161,8 @@ export default {
Toolbar,
FilterDialog,
SubjectSetting,
PreviewFullScreen
PreviewFullScreen,
Preview
},
data() {
return {
@ -350,8 +352,6 @@ export default {
},
deselectCurComponent(e) {
console.log('deselectCurComponent123')
if (!this.isClickComponent) {
this.$store.commit('setCurComponent', { component: null, index: null })
}

View File

@ -1,7 +1,10 @@
<template>
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa">
<de-main-container>
<component :is="component" :param="param" />
<panel-main v-show="componentName==='PanelMain'" />
<chart-edit v-if="componentName==='ChartEdit'" />
<panel-edit v-if="componentName==='PanelEdit'" />
<!-- <component :is="component" :param="param" />-->
</de-main-container>
</de-container>
</template>
@ -20,23 +23,29 @@ export default {
data() {
return {
component: PanelMain,
componentName: 'PanelMain',
param: {}
}
},
mounted() {
bus.$on('PanelSwitchComponent', (c) => {
this.param = c.param
switch (c.name) {
case 'PanelEdit':
this.component = PanelEdit
break
case 'ChartEdit':
this.component = ChartEdit
break
default:
this.component = PanelMain
break
}
this.componentName = c.name
this.$store.dispatch('panel/setMainActiveName', c.name)
// switch (c.name) {
// case 'PanelEdit':
// this.component = PanelEdit
// this.componentName = 'PanelEdit'
// break
// case 'ChartEdit':
// this.component = ChartEdit
// this.componentName = 'ChartEdit'
// break
// default:
// this.component = PanelMain
// this.componentName = 'PanelMain'
// break
// }
})
},
methods: {

View File

@ -8,6 +8,7 @@
:default-expanded-keys="expandedArray"
:data="defaultData"
node-key="id"
highlight-current
:expand-on-click-node="true"
@node-click="nodeClick"
>
@ -19,7 +20,7 @@
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
</span>
<span style="margin-left: 12px;" @click.stop>
<el-dropdown trigger="click" size="small" @command="clickMore">
<el-dropdown v-if="hasDataPermission('manage',data.privileges)" trigger="click" size="small" @command="clickMore">
<span class="el-dropdown-link">
<el-button
icon="el-icon-more"
@ -57,6 +58,7 @@
:default-expanded-keys="expandedArray"
:data="tData"
node-key="id"
highlight-current
:expand-on-click-node="true"
@node-click="nodeClick"
>
@ -158,7 +160,7 @@
</el-dialog>
<!--新建仪表盘dialog-->
<el-dialog :title="panelDialogTitle" :visible.sync="editPanel.visible" :show-close="true" width="600px">
<edit-panel v-if="editPanel.visible" :edit-panel="editPanel" @closeEditPanelDialog="closeEditPanelDialog" />
<edit-panel v-if="editPanel.visible" :edit-panel="editPanel" @closeEditPanelDialog="closeEditPanelDialog" @newPanelSave="newPanelSave" />
</el-dialog>
</el-col>
</el-col>
@ -170,7 +172,7 @@ import LinkGenerate from '@/views/link/generate'
import { uuid } from 'vue-uuid'
import bus from '@/utils/bus'
import EditPanel from './EditPanel'
import { addGroup, delGroup, groupTree, defaultTree, get } from '@/api/panel/panel'
import { addGroup, delGroup, groupTree, defaultTree, findOne } from '@/api/panel/panel'
import {
DEFAULT_COLOR_CASE,
DEFAULT_SIZE,
@ -299,7 +301,7 @@ export default {
groupForm: {
name: null,
pid: null,
level: 0,
panelType: 'self',
nodeType: null,
children: [],
sort: 'node_type desc,name asc'
@ -350,7 +352,11 @@ export default {
switch (param.optType) {
case 'new':
this.editPanel.titlePre = this.$t('commons.create')
if (param.type === 'folder') {
this.editPanel.panelInfo.name = this.$t('panel.groupAdd')
} else {
this.editPanel.panelInfo.name = this.$t('panel.panelAdd')
}
this.editPanel.panelInfo.pid = param.data.id
this.editPanel.panelInfo.level = param.data.level + 1
this.editPanel.panelInfo.panelType = 'self'
@ -358,7 +364,7 @@ export default {
case 'newFirstFolder':
this.editPanel.titlePre = this.$t('commons.create')
this.editPanel.panelInfo.name = ''
this.editPanel.panelInfo.pid = null
this.editPanel.panelInfo.pid = 'panel_list'
this.editPanel.panelInfo.level = 0
this.editPanel.panelInfo.panelType = 'self'
break
@ -369,6 +375,7 @@ export default {
titlePre: this.$t('commons.edit'),
panelInfo: {
id: param.data.id,
pid: param.data.pid,
name: param.data.name
}
}
@ -497,7 +504,7 @@ export default {
this.groupForm = {
name: null,
pid: null,
level: 0,
panelType: 'self',
nodeType: null,
children: [],
sort: 'node_type desc,name asc'
@ -520,7 +527,7 @@ export default {
nodeClick(data, node) {
if (data.nodeType === 'panel') {
//
get('panel/group/findOne/' + data.id).then(response => {
findOne(data.id).then(response => {
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
// this.$store.commit('setComponentData', sourceInfo.type === 'custom' ? sourceInfo : this.resetID(sourceInfo))
const temp = JSON.parse(response.data.panelStyle)
@ -558,6 +565,7 @@ export default {
this.authVisible = false
},
edit(data) {
debugger
this.$store.dispatch('panel/setPanelInfo', data)
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
},
@ -576,6 +584,9 @@ export default {
})
}
return data
},
newPanelSave(id) {
}
}
}

View File

@ -40,7 +40,7 @@
<!--TODO 仪表盘预览区域-->
<el-row class="panel-design-preview">
<div ref="imageWrapper" style="width: 100%;height: 100%">
<Preview v-if="showMain" />
<Preview v-if="mainActiveName==='PanelMain'&&showMain" />
</div>
</el-row>
</el-col>
@ -84,6 +84,9 @@ export default {
panelInfo() {
return this.$store.state.panel.panelInfo
},
mainActiveName() {
return this.$store.state.panel.mainActiveName
},
...mapState([
'componentData',
'canvasStyleData'