Merge pull request #3111 from dataease/pr@dev@feat_app-template

feat: 支持应用市场,支持应用导入导出
This commit is contained in:
xuwei-fit2cloud 2022-09-20 09:59:20 +08:00 committed by GitHub
commit 4906dcceef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 3008 additions and 1598 deletions

View File

@ -0,0 +1,44 @@
package io.dataease.controller.panel;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.sys.request.KeyGridRequest;
import io.dataease.dto.appTemplateMarket.AppLogGridDTO;
import io.dataease.service.panel.applog.AppLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@Api(tags = "应用市场:应用日志")
@ApiSupport(order = 220)
@RequestMapping("/app/log")
public class AppLogController {
@Resource
private AppLogService applogService;
@I18n
@ApiOperation("查询日志")
@PostMapping("/logGrid/{goPage}/{pageSize}")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "request", value = "查询条件", required = true)
})
public Pager<List<AppLogGridDTO>> logGrid(@PathVariable int goPage, @PathVariable int pageSize,
@RequestBody KeyGridRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, applogService.query(request));
}
}

View File

@ -3,13 +3,11 @@ package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.PanelAppTemplateRequest;
import io.dataease.plugins.common.base.domain.PanelAppTemplate;
import io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs;
import io.dataease.service.panel.PanelAppTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@ -21,18 +19,16 @@ import java.util.List;
@Api(tags = "仪表板:应该关系")
@ApiSupport(order = 170)
@RestController
@RequestMapping("templateApp")
@RequestMapping("appTemplate")
public class PanelAppTemplateController {
@Resource
private PanelAppTemplateService panelAppTemplateService;
@ApiOperation("查询")
@PostMapping("/find")
@I18n
public List<PanelAppTemplateWithBLOBs> templateAppList(@RequestBody PanelAppTemplateRequest request) {
public List<PanelAppTemplateWithBLOBs> appTemplateList(@RequestBody PanelAppTemplateRequest request) {
return panelAppTemplateService.list(request);
}
@ -50,11 +46,11 @@ public class PanelAppTemplateController {
panelAppTemplateService.update(request);
}
@ApiOperation("更新")
@DeleteMapping("/delete/{templateAppId}")
@ApiOperation("删除")
@DeleteMapping("/delete/{appTemplateId}")
@I18n
public void delete(@PathVariable String templateAppId) {
panelAppTemplateService.delete(templateAppId);
public void delete(@PathVariable String appTemplateId) {
panelAppTemplateService.delete(appTemplateId);
}
@ApiOperation("名称校验")
@ -63,4 +59,5 @@ public class PanelAppTemplateController {
public String nameCheck(@RequestBody PanelAppTemplateRequest request) {
return panelAppTemplateService.nameCheck(request);
}
}

View File

@ -6,13 +6,10 @@ import io.dataease.auth.annotation.DePermissionProxy;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.auth.service.impl.ExtAuthServiceImpl;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.controller.request.panel.PanelGroupBaseInfoRequest;
import io.dataease.controller.request.panel.PanelViewLogRequest;
import io.dataease.controller.request.panel.*;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.controller.request.panel.PanelViewDetailsRequest;
import io.dataease.dto.PermissionProxy;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.panel.PanelExport2App;
@ -196,4 +193,14 @@ public class PanelGroupController {
public PanelExport2App export2AppCheck(@PathVariable String panelId){
return panelGroupService.panelExport2AppCheck(panelId);
}
@PostMapping("/appApply")
public PanelGroupDTO appApply(@RequestBody PanelAppTemplateApplyRequest request) throws Exception{
String panelId = panelGroupService.appApply(request);
PanelGroupDTO result = findOne(panelId);
result.setParents(authService.parentResource(panelId,"panel"));
result.setRequestId(UUIDUtil.getUUIDAsString());
result.setResponseSource("appApply");
return result;
}
}

View File

@ -38,4 +38,6 @@ public class DataSetTableRequest extends DatasetTable {
@ApiModelProperty("是否合并sheet")
private boolean mergeSheet = false;
private boolean previewForTask = false;
@ApiModelProperty("操作来源")
private String optFrom;
}

View File

@ -0,0 +1,27 @@
package io.dataease.controller.request.panel;
import io.dataease.plugins.common.base.domain.Datasource;
import lombok.Data;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/9/15
* Description:
*/
@Data
public class PanelAppTemplateApplyRequest {
private String panelId;
private String panelName;
private String datasetGroupId;
private String datasetGroupName;
private String appTemplateId;
private List<Datasource> datasourceList;
}

View File

@ -0,0 +1,24 @@
package io.dataease.dto.appTemplateMarket;
import io.dataease.dto.log.FolderItem;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class AppLogDTO implements Serializable {
private Integer sourceType;
private String sourceId;
private String sourceName;
private Integer operateType;
private List<FolderItem> positions;
private List<FolderItem> remarks;
}

View File

@ -0,0 +1,19 @@
package io.dataease.dto.appTemplateMarket;
import io.dataease.plugins.common.base.domain.PanelAppTemplateLog;
import lombok.Data;
import java.io.Serializable;
@Data
public class AppLogGridDTO extends PanelAppTemplateLog implements Serializable {
private String appName;
private String datasourceName;
private String datasetGroupName;
private String panelName;
}

View File

@ -3,10 +3,7 @@ package io.dataease.dto.panel;
import com.alibaba.fastjson.JSON;
import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.plugins.common.base.domain.ChartViewField;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTable;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.*;
import lombok.Data;
import org.apache.commons.lang3.ArrayUtils;
@ -27,6 +24,7 @@ public class PanelExport2App {
private String panelInfo;
private String panelViewsInfo;
private String chartViewsInfo;
private String chartViewFieldsInfo;
@ -35,9 +33,9 @@ public class PanelExport2App {
private String datasetTableFieldsInfo;
private String dataSetTasksInfo;
private String datasetTasksInfo;
private String datasourceDTOS;
private String datasourceInfo;
public PanelExport2App() {
@ -47,7 +45,7 @@ public class PanelExport2App {
this.checkMes = checkMes;
}
public PanelExport2App(List<ChartViewWithBLOBs> chartViewsInfo, List<ChartViewField> chartViewFieldsInfo, List<DatasetTable> datasetTablesInfo, List<DatasetTableField> datasetTableFieldsInfo, List<DataSetTaskDTO> dataSetTasksInfo, List<DatasourceDTO> datasourceDTOS) {
public PanelExport2App(List<ChartViewWithBLOBs> chartViewsInfo, List<ChartViewField> chartViewFieldsInfo, List<DatasetTable> datasetTablesInfo, List<DatasetTableField> datasetTableFieldsInfo, List<DataSetTaskDTO> datasetTasksInfo, List<DatasourceDTO> datasourceInfo, List<PanelView> panelViewsInfo) {
List empty = new ArrayList();
this.checkStatus = true;
this.checkMes = "success";
@ -55,7 +53,8 @@ public class PanelExport2App {
this.chartViewFieldsInfo = JSON.toJSONString(chartViewFieldsInfo!=null?chartViewFieldsInfo:empty);
this.datasetTablesInfo = JSON.toJSONString(datasetTablesInfo!=null?datasetTablesInfo:empty);
this.datasetTableFieldsInfo = JSON.toJSONString(datasetTableFieldsInfo!=null?datasetTableFieldsInfo:empty);
this.dataSetTasksInfo = JSON.toJSONString(dataSetTasksInfo!=null?dataSetTasksInfo:empty);
this.datasourceDTOS = JSON.toJSONString(datasourceDTOS!=null?datasourceDTOS:empty);
this.datasetTasksInfo = JSON.toJSONString(datasetTasksInfo!=null?datasetTasksInfo:empty);
this.datasourceInfo = JSON.toJSONString(datasourceInfo!=null?datasourceInfo:empty);
this.panelViewsInfo = JSON.toJSONString(panelViewsInfo!=null?panelViewsInfo:empty);
}
}

View File

@ -37,4 +37,6 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase<Pane
private List<String> parents;
@ApiModelProperty("请求ID")
private String requestId;
@ApiModelProperty("数据返回来源")
private String responseSource;
}

View File

@ -0,0 +1,9 @@
package io.dataease.ext;
import io.dataease.dto.appTemplateMarket.AppLogGridDTO;
import io.dataease.service.panel.applog.AppLogQueryParam;
import java.util.List;
public interface ExtAppLogMapper {
List<AppLogGridDTO> query(AppLogQueryParam example);
}

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.dataease.ext.ExtAppLogMapper">
<resultMap id="BaseResultMapDTO" type="io.dataease.dto.appTemplateMarket.AppLogGridDTO"
extends="io.dataease.plugins.common.base.mapper.PanelAppTemplateLogMapper.BaseResultMap">
<result column="app_name" property="appName"/>
<result column="panel_name" property="panelName"/>
<result column="dataset_group_name" property="datasetGroupName"/>
<result column="datasource_name" property="datasourceName"/>
</resultMap>
<select id="query" parameterType="io.dataease.service.panel.applog.AppLogQueryParam" resultMap="BaseResultMapDTO">
select * from
(select * from
(SELECT
panel_app_template_log.*,
IFNULL(panel_app_template.name,CONCAT(panel_app_template_log.app_template_name,'(Deleted)')) as app_name,
IFNULL(panel_group.name,CONCAT(panel_app_template_log.source_panel_name,'(Deleted)')) as panel_name,
IFNULL(dataset_group.name,CONCAT(panel_app_template_log.source_dataset_group_name,'(Deleted)')) as dataset_group_name,
IFNULL(datasource.`name`,CONCAT(panel_app_template_log.source_datasource_name,'(Deleted)')) as datasource_name
FROM
panel_app_template_log
LEFT JOIN panel_group ON panel_app_template_log.panel_id = panel_group.id
left join dataset_group on panel_app_template_log.dataset_group_id = dataset_group.id
left join datasource on panel_app_template_log.datasource_id = datasource.id
left join panel_app_template on panel_app_template_log.app_template_id = panel_app_template.id
) t
where 1=1
<if test="extendCondition != null">
and
(
t.app_name like concat('%', #{extendCondition} , '%')
or
t.panel_name like concat('%', #{extendCondition} , '%')
or
t.dataset_group_name like concat('%', #{extendCondition} , '%')
or
t.datasource_name like concat('%', #{extendCondition} , '%')
)
</if>
) logInfo
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="orderByClause == null">
order by apply_time desc
</if>
</select>
</mapper>

View File

@ -1,29 +0,0 @@
package io.dataease.plugins.common.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class PanelAppTemplate implements Serializable {
private String id;
private String name;
private String nodeType;
private Integer level;
private String pid;
private String version;
private Long updateTime;
private String updateUser;
private Long createTime;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -1,870 +0,0 @@
package io.dataease.plugins.common.base.domain;
import java.util.ArrayList;
import java.util.List;
public class PanelAppTemplateExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public PanelAppTemplateExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNodeTypeIsNull() {
addCriterion("node_type is null");
return (Criteria) this;
}
public Criteria andNodeTypeIsNotNull() {
addCriterion("node_type is not null");
return (Criteria) this;
}
public Criteria andNodeTypeEqualTo(String value) {
addCriterion("node_type =", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeNotEqualTo(String value) {
addCriterion("node_type <>", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeGreaterThan(String value) {
addCriterion("node_type >", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeGreaterThanOrEqualTo(String value) {
addCriterion("node_type >=", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeLessThan(String value) {
addCriterion("node_type <", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeLessThanOrEqualTo(String value) {
addCriterion("node_type <=", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeLike(String value) {
addCriterion("node_type like", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeNotLike(String value) {
addCriterion("node_type not like", value, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeIn(List<String> values) {
addCriterion("node_type in", values, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeNotIn(List<String> values) {
addCriterion("node_type not in", values, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeBetween(String value1, String value2) {
addCriterion("node_type between", value1, value2, "nodeType");
return (Criteria) this;
}
public Criteria andNodeTypeNotBetween(String value1, String value2) {
addCriterion("node_type not between", value1, value2, "nodeType");
return (Criteria) this;
}
public Criteria andLevelIsNull() {
addCriterion("`level` is null");
return (Criteria) this;
}
public Criteria andLevelIsNotNull() {
addCriterion("`level` is not null");
return (Criteria) this;
}
public Criteria andLevelEqualTo(Integer value) {
addCriterion("`level` =", value, "level");
return (Criteria) this;
}
public Criteria andLevelNotEqualTo(Integer value) {
addCriterion("`level` <>", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThan(Integer value) {
addCriterion("`level` >", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThanOrEqualTo(Integer value) {
addCriterion("`level` >=", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThan(Integer value) {
addCriterion("`level` <", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThanOrEqualTo(Integer value) {
addCriterion("`level` <=", value, "level");
return (Criteria) this;
}
public Criteria andLevelIn(List<Integer> values) {
addCriterion("`level` in", values, "level");
return (Criteria) this;
}
public Criteria andLevelNotIn(List<Integer> values) {
addCriterion("`level` not in", values, "level");
return (Criteria) this;
}
public Criteria andLevelBetween(Integer value1, Integer value2) {
addCriterion("`level` between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andLevelNotBetween(Integer value1, Integer value2) {
addCriterion("`level` not between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andPidIsNull() {
addCriterion("pid is null");
return (Criteria) this;
}
public Criteria andPidIsNotNull() {
addCriterion("pid is not null");
return (Criteria) this;
}
public Criteria andPidEqualTo(String value) {
addCriterion("pid =", value, "pid");
return (Criteria) this;
}
public Criteria andPidNotEqualTo(String value) {
addCriterion("pid <>", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThan(String value) {
addCriterion("pid >", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThanOrEqualTo(String value) {
addCriterion("pid >=", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThan(String value) {
addCriterion("pid <", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThanOrEqualTo(String value) {
addCriterion("pid <=", value, "pid");
return (Criteria) this;
}
public Criteria andPidLike(String value) {
addCriterion("pid like", value, "pid");
return (Criteria) this;
}
public Criteria andPidNotLike(String value) {
addCriterion("pid not like", value, "pid");
return (Criteria) this;
}
public Criteria andPidIn(List<String> values) {
addCriterion("pid in", values, "pid");
return (Criteria) this;
}
public Criteria andPidNotIn(List<String> values) {
addCriterion("pid not in", values, "pid");
return (Criteria) this;
}
public Criteria andPidBetween(String value1, String value2) {
addCriterion("pid between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andPidNotBetween(String value1, String value2) {
addCriterion("pid not between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andVersionIsNull() {
addCriterion("version is null");
return (Criteria) this;
}
public Criteria andVersionIsNotNull() {
addCriterion("version is not null");
return (Criteria) this;
}
public Criteria andVersionEqualTo(String value) {
addCriterion("version =", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotEqualTo(String value) {
addCriterion("version <>", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThan(String value) {
addCriterion("version >", value, "version");
return (Criteria) this;
}
public Criteria andVersionGreaterThanOrEqualTo(String value) {
addCriterion("version >=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThan(String value) {
addCriterion("version <", value, "version");
return (Criteria) this;
}
public Criteria andVersionLessThanOrEqualTo(String value) {
addCriterion("version <=", value, "version");
return (Criteria) this;
}
public Criteria andVersionLike(String value) {
addCriterion("version like", value, "version");
return (Criteria) this;
}
public Criteria andVersionNotLike(String value) {
addCriterion("version not like", value, "version");
return (Criteria) this;
}
public Criteria andVersionIn(List<String> values) {
addCriterion("version in", values, "version");
return (Criteria) this;
}
public Criteria andVersionNotIn(List<String> values) {
addCriterion("version not in", values, "version");
return (Criteria) this;
}
public Criteria andVersionBetween(String value1, String value2) {
addCriterion("version between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andVersionNotBetween(String value1, String value2) {
addCriterion("version not between", value1, value2, "version");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateUserIsNull() {
addCriterion("update_user is null");
return (Criteria) this;
}
public Criteria andUpdateUserIsNotNull() {
addCriterion("update_user is not null");
return (Criteria) this;
}
public Criteria andUpdateUserEqualTo(String value) {
addCriterion("update_user =", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserNotEqualTo(String value) {
addCriterion("update_user <>", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserGreaterThan(String value) {
addCriterion("update_user >", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserGreaterThanOrEqualTo(String value) {
addCriterion("update_user >=", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserLessThan(String value) {
addCriterion("update_user <", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserLessThanOrEqualTo(String value) {
addCriterion("update_user <=", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserLike(String value) {
addCriterion("update_user like", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserNotLike(String value) {
addCriterion("update_user not like", value, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserIn(List<String> values) {
addCriterion("update_user in", values, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserNotIn(List<String> values) {
addCriterion("update_user not in", values, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserBetween(String value1, String value2) {
addCriterion("update_user between", value1, value2, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserNotBetween(String value1, String value2) {
addCriterion("update_user not between", value1, value2, "updateUser");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -1,29 +0,0 @@
package io.dataease.plugins.common.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PanelAppTemplateWithBLOBs extends PanelAppTemplate implements Serializable {
private String applicationInfo;
private String panelInfo;
private String viewsInfo;
private String datasetInfo;
private String datasetFieldsInfo;
private String datasetTasksInfo;
private String datasourceInfo;
private String snapshot;
private static final long serialVersionUID = 1L;
}

View File

@ -1,37 +0,0 @@
package io.dataease.plugins.common.base.mapper;
import io.dataease.plugins.common.base.domain.PanelAppTemplate;
import io.dataease.plugins.common.base.domain.PanelAppTemplateExample;
import io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface PanelAppTemplateMapper {
long countByExample(PanelAppTemplateExample example);
int deleteByExample(PanelAppTemplateExample example);
int deleteByPrimaryKey(String id);
int insert(PanelAppTemplateWithBLOBs record);
int insertSelective(PanelAppTemplateWithBLOBs record);
List<PanelAppTemplateWithBLOBs> selectByExampleWithBLOBs(PanelAppTemplateExample example);
List<PanelAppTemplate> selectByExample(PanelAppTemplateExample example);
PanelAppTemplateWithBLOBs selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") PanelAppTemplateWithBLOBs record, @Param("example") PanelAppTemplateExample example);
int updateByExampleWithBLOBs(@Param("record") PanelAppTemplateWithBLOBs record, @Param("example") PanelAppTemplateExample example);
int updateByExample(@Param("record") PanelAppTemplate record, @Param("example") PanelAppTemplateExample example);
int updateByPrimaryKeySelective(PanelAppTemplateWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(PanelAppTemplateWithBLOBs record);
int updateByPrimaryKey(PanelAppTemplate record);
}

View File

@ -1,470 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.dataease.plugins.common.base.mapper.PanelAppTemplateMapper">
<resultMap id="BaseResultMap" type="io.dataease.plugins.common.base.domain.PanelAppTemplate">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="node_type" jdbcType="VARCHAR" property="nodeType" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="version" jdbcType="VARCHAR" property="version" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs">
<result column="application_info" jdbcType="LONGVARCHAR" property="applicationInfo" />
<result column="panel_info" jdbcType="LONGVARCHAR" property="panelInfo" />
<result column="views_info" jdbcType="LONGVARCHAR" property="viewsInfo" />
<result column="dataset_info" jdbcType="LONGVARCHAR" property="datasetInfo" />
<result column="dataset_fields_info" jdbcType="LONGVARCHAR" property="datasetFieldsInfo" />
<result column="dataset_tasks_info" jdbcType="LONGVARCHAR" property="datasetTasksInfo" />
<result column="datasource_info" jdbcType="LONGVARCHAR" property="datasourceInfo" />
<result column="snapshot" jdbcType="LONGVARCHAR" property="snapshot" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, node_type, `level`, pid, version, update_time, update_user, create_time,
create_user
</sql>
<sql id="Blob_Column_List">
application_info, panel_info, views_info, dataset_info, dataset_fields_info, dataset_tasks_info,
datasource_info, snapshot
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from panel_app_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from panel_app_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from panel_app_template
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from panel_app_template
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateExample">
delete from panel_app_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs">
insert into panel_app_template (id, `name`, node_type,
`level`, pid, version,
update_time, update_user, create_time,
create_user, application_info, panel_info,
views_info, dataset_info, dataset_fields_info,
dataset_tasks_info, datasource_info,
snapshot)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{nodeType,jdbcType=VARCHAR},
#{level,jdbcType=INTEGER}, #{pid,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{applicationInfo,jdbcType=LONGVARCHAR}, #{panelInfo,jdbcType=LONGVARCHAR},
#{viewsInfo,jdbcType=LONGVARCHAR}, #{datasetInfo,jdbcType=LONGVARCHAR}, #{datasetFieldsInfo,jdbcType=LONGVARCHAR},
#{datasetTasksInfo,jdbcType=LONGVARCHAR}, #{datasourceInfo,jdbcType=LONGVARCHAR},
#{snapshot,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs">
insert into panel_app_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
`name`,
</if>
<if test="nodeType != null">
node_type,
</if>
<if test="level != null">
`level`,
</if>
<if test="pid != null">
pid,
</if>
<if test="version != null">
version,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updateUser != null">
update_user,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="applicationInfo != null">
application_info,
</if>
<if test="panelInfo != null">
panel_info,
</if>
<if test="viewsInfo != null">
views_info,
</if>
<if test="datasetInfo != null">
dataset_info,
</if>
<if test="datasetFieldsInfo != null">
dataset_fields_info,
</if>
<if test="datasetTasksInfo != null">
dataset_tasks_info,
</if>
<if test="datasourceInfo != null">
datasource_info,
</if>
<if test="snapshot != null">
snapshot,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="nodeType != null">
#{nodeType,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=INTEGER},
</if>
<if test="pid != null">
#{pid,jdbcType=VARCHAR},
</if>
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="applicationInfo != null">
#{applicationInfo,jdbcType=LONGVARCHAR},
</if>
<if test="panelInfo != null">
#{panelInfo,jdbcType=LONGVARCHAR},
</if>
<if test="viewsInfo != null">
#{viewsInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasetInfo != null">
#{datasetInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasetFieldsInfo != null">
#{datasetFieldsInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasetTasksInfo != null">
#{datasetTasksInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasourceInfo != null">
#{datasourceInfo,jdbcType=LONGVARCHAR},
</if>
<if test="snapshot != null">
#{snapshot,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateExample" resultType="java.lang.Long">
select count(*) from panel_app_template
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update panel_app_template
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.nodeType != null">
node_type = #{record.nodeType,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
`level` = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.pid != null">
pid = #{record.pid,jdbcType=VARCHAR},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.updateUser != null">
update_user = #{record.updateUser,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.applicationInfo != null">
application_info = #{record.applicationInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.panelInfo != null">
panel_info = #{record.panelInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.viewsInfo != null">
views_info = #{record.viewsInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.datasetInfo != null">
dataset_info = #{record.datasetInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.datasetFieldsInfo != null">
dataset_fields_info = #{record.datasetFieldsInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.datasetTasksInfo != null">
dataset_tasks_info = #{record.datasetTasksInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.datasourceInfo != null">
datasource_info = #{record.datasourceInfo,jdbcType=LONGVARCHAR},
</if>
<if test="record.snapshot != null">
snapshot = #{record.snapshot,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update panel_app_template
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
node_type = #{record.nodeType,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=INTEGER},
pid = #{record.pid,jdbcType=VARCHAR},
version = #{record.version,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=BIGINT},
update_user = #{record.updateUser,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
application_info = #{record.applicationInfo,jdbcType=LONGVARCHAR},
panel_info = #{record.panelInfo,jdbcType=LONGVARCHAR},
views_info = #{record.viewsInfo,jdbcType=LONGVARCHAR},
dataset_info = #{record.datasetInfo,jdbcType=LONGVARCHAR},
dataset_fields_info = #{record.datasetFieldsInfo,jdbcType=LONGVARCHAR},
dataset_tasks_info = #{record.datasetTasksInfo,jdbcType=LONGVARCHAR},
datasource_info = #{record.datasourceInfo,jdbcType=LONGVARCHAR},
snapshot = #{record.snapshot,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update panel_app_template
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
node_type = #{record.nodeType,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=INTEGER},
pid = #{record.pid,jdbcType=VARCHAR},
version = #{record.version,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=BIGINT},
update_user = #{record.updateUser,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs">
update panel_app_template
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="nodeType != null">
node_type = #{nodeType,jdbcType=VARCHAR},
</if>
<if test="level != null">
`level` = #{level,jdbcType=INTEGER},
</if>
<if test="pid != null">
pid = #{pid,jdbcType=VARCHAR},
</if>
<if test="version != null">
version = #{version,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="applicationInfo != null">
application_info = #{applicationInfo,jdbcType=LONGVARCHAR},
</if>
<if test="panelInfo != null">
panel_info = #{panelInfo,jdbcType=LONGVARCHAR},
</if>
<if test="viewsInfo != null">
views_info = #{viewsInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasetInfo != null">
dataset_info = #{datasetInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasetFieldsInfo != null">
dataset_fields_info = #{datasetFieldsInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasetTasksInfo != null">
dataset_tasks_info = #{datasetTasksInfo,jdbcType=LONGVARCHAR},
</if>
<if test="datasourceInfo != null">
datasource_info = #{datasourceInfo,jdbcType=LONGVARCHAR},
</if>
<if test="snapshot != null">
snapshot = #{snapshot,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs">
update panel_app_template
set `name` = #{name,jdbcType=VARCHAR},
node_type = #{nodeType,jdbcType=VARCHAR},
`level` = #{level,jdbcType=INTEGER},
pid = #{pid,jdbcType=VARCHAR},
version = #{version,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT},
update_user = #{updateUser,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
application_info = #{applicationInfo,jdbcType=LONGVARCHAR},
panel_info = #{panelInfo,jdbcType=LONGVARCHAR},
views_info = #{viewsInfo,jdbcType=LONGVARCHAR},
dataset_info = #{datasetInfo,jdbcType=LONGVARCHAR},
dataset_fields_info = #{datasetFieldsInfo,jdbcType=LONGVARCHAR},
dataset_tasks_info = #{datasetTasksInfo,jdbcType=LONGVARCHAR},
datasource_info = #{datasourceInfo,jdbcType=LONGVARCHAR},
snapshot = #{snapshot,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.plugins.common.base.domain.PanelAppTemplate">
update panel_app_template
set `name` = #{name,jdbcType=VARCHAR},
node_type = #{nodeType,jdbcType=VARCHAR},
`level` = #{level,jdbcType=INTEGER},
pid = #{pid,jdbcType=VARCHAR},
version = #{version,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT},
update_user = #{updateUser,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -137,7 +137,7 @@ public class DataSetGroupService {
return ids;
}
private void checkName(DatasetGroup datasetGroup) {
public void checkName(DatasetGroup datasetGroup) {
DatasetGroupExample datasetGroupExample = new DatasetGroupExample();
DatasetGroupExample.Criteria criteria = datasetGroupExample.createCriteria();
if (StringUtils.isNotEmpty(datasetGroup.getPid())) {
@ -157,7 +157,7 @@ public class DataSetGroupService {
}
List<DatasetGroup> list = datasetGroupMapper.selectByExample(datasetGroupExample);
if (list.size() > 0) {
throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
throw new RuntimeException(Translator.get("I18N_DATASET_GROUP_EXIST"));
}
}

View File

@ -299,7 +299,7 @@ public class DataSetTableService {
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
checkName(datasetTable);
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), DatasetType.SQL.name())) {
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), DatasetType.SQL.name()) && !"appApply".equalsIgnoreCase(datasetTable.getOptFrom())) {
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
BeanUtils.copyBean(dataSetTableRequest, datasetTable);
getSQLPreview(dataSetTableRequest);
@ -317,7 +317,9 @@ public class DataSetTableService {
// 添加表成功后获取当前表字段和类型抽象到dataease数据库
if (insert == 1) {
saveTableField(datasetTable);
if (datasetTable.getOptFrom() == null || !"appApply".equalsIgnoreCase(datasetTable.getOptFrom())) {
saveTableField(datasetTable);
}
extractData(datasetTable);
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.CREATE, SysLogConstants.SOURCE_TYPE.DATASET, datasetTable.getId(), datasetTable.getSceneId(), null, null);
}
@ -2868,4 +2870,19 @@ public class DataSetTableService {
static private boolean hasVarible(String sql) {
return sql.contains(SubstitutedParams);
}
public void createAppCustomDorisView(String datasetInfo, String tableId) throws Exception {
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetInfo, DataTableInfoDTO.class);
createDorisView(TableUtils.tableName(tableId), getCustomViewSQL(dataTableInfoDTO,
dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId())));
}
public void createAppUnionDorisView(String datasetInfo, String tableId) throws Exception {
// save field
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetInfo, DataTableInfoDTO.class);
Map<String, Object> sqlMap = getUnionSQLDoris(dataTableInfoDTO);
String sql = (String) sqlMap.get("sql");
// custom 创建doris视图
createDorisView(TableUtils.tableName(tableId), sql);
}
}

View File

@ -434,7 +434,7 @@ public class DatasourceService {
});
}
private void checkName(String datasourceName, String type, String id) {
public void checkName(String datasourceName, String type, String id) {
DatasourceExample example = new DatasourceExample();
DatasourceExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(datasourceName);

View File

@ -0,0 +1,27 @@
package io.dataease.service.panel;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.PanelAppTemplateLogMapper;
import org.pentaho.di.core.util.UUIDUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Author: wangjiahao
* Date: 2022/9/8
* Description:
*/
@Service
public class PanelAppTemplateLogService {
@Resource
private PanelAppTemplateLogMapper logMapper;
public void newAppApplyLog(PanelAppTemplateLog appTemplateLog){
appTemplateLog.setId(UUIDUtil.getUUIDAsString());
appTemplateLog.setApplyTime(System.currentTimeMillis());
appTemplateLog.setApplyPersion(AuthUtils.getUser().getUsername());
logMapper.insert(appTemplateLog);
}
}

View File

@ -1,19 +1,34 @@
package io.dataease.service.panel;
import com.google.gson.Gson;
import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest;
import io.dataease.controller.request.panel.PanelAppTemplateRequest;
import io.dataease.controller.request.panel.PanelTemplateRequest;
import io.dataease.dto.panel.PanelAppTemplateDTO;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.PanelAppTemplateMapper;
import io.dataease.plugins.common.constants.DatasetType;
import io.dataease.service.chart.ChartViewFieldService;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.DataSetTableFieldsService;
import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.datasource.DatasourceService;
import org.apache.commons.lang3.StringUtils;
import org.pentaho.di.core.util.UUIDUtil;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Author: wangjiahao
@ -22,36 +37,63 @@ import java.util.List;
*/
@Service
public class PanelAppTemplateService {
private static Gson gson = new Gson();
@Resource
private PanelAppTemplateMapper panelAppTemplateMapper;
@Resource
private DatasourceService datasourceService;
@Resource
private ChartViewService chartViewService;
@Resource
private ChartViewFieldService chartViewFieldService;
@Resource
private DataSetTableService dataSetTableService;
@Resource
private DataSetTableFieldsService dataSetTableFieldsService;
@Resource
@Lazy
private PanelGroupService panelGroupService;
@Resource
private PanelViewService panelViewService;
@Resource
private DataSetGroupService dataSetGroupService;
public List<PanelAppTemplateWithBLOBs> list(PanelAppTemplateRequest request){
public List<PanelAppTemplateWithBLOBs> list(PanelAppTemplateRequest request) {
PanelAppTemplateExample example = new PanelAppTemplateExample();
example.createCriteria().andPidEqualTo(request.getPid());
if (StringUtils.isNotEmpty(request.getPid())) {
example.createCriteria().andPidEqualTo(request.getPid());
}
if (StringUtils.isNotEmpty(request.getNodeType())) {
example.createCriteria().andNodeTypeEqualTo(request.getNodeType());
}
return panelAppTemplateMapper.selectByExampleWithBLOBs(example);
}
public void save(PanelAppTemplateRequest request){
public void save(PanelAppTemplateRequest request) {
request.setId(UUIDUtil.getUUIDAsString());
request.setCreateUser(AuthUtils.getUser().getUsername());
request.setCreateTime(System.currentTimeMillis());
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate,request);
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate, request);
if (StringUtils.isEmpty(requestTemplate.getNodeType())) {
requestTemplate.setNodeType("template");
}
panelAppTemplateMapper.insertSelective(requestTemplate);
}
public void update(PanelAppTemplateRequest request){
public void update(PanelAppTemplateRequest request) {
nameCheck(CommonConstants.OPT_TYPE.UPDATE, request.getName(), request.getPid(), request.getId());
request.setUpdateUser(AuthUtils.getUser().getUsername());
request.setUpdateTime(System.currentTimeMillis());
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate,request);
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate, request);
panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate);
}
public void delete(String templateAppId){
panelAppTemplateMapper.deleteByPrimaryKey(templateAppId);
public void delete(String appTemplateId) {
panelAppTemplateMapper.deleteByPrimaryKey(appTemplateId);
}
public String nameCheck(PanelAppTemplateRequest request) {
@ -76,5 +118,166 @@ public class PanelAppTemplateService {
}
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyDatasource(List<Datasource> oldDatasourceList, List<Datasource> newDatasourceList) throws Exception {
Map<String, String> datasourceRelaMap = new HashMap<>();
for (int i = 0; i < newDatasourceList.size(); i++) {
Datasource datasource = newDatasourceList.get(0);
datasource.setId(null);
Datasource newDatasource = datasourceService.addDatasource(datasource);
datasourceRelaMap.put(oldDatasourceList.get(i).getId(), newDatasource.getId());
}
return datasourceRelaMap;
}
@Transactional(rollbackFor = Exception.class)
public void applyPanelView(List<PanelView> panelViewsInfo, Map<String, String> chartViewsRelaMap, String panelId) {
Long time = System.currentTimeMillis();
String userName = AuthUtils.getUser().getUsername();
panelViewsInfo.forEach(panelView -> {
panelView.setId(UUIDUtil.getUUIDAsString());
panelView.setPanelId(panelId);
panelView.setCreateTime(time);
panelView.setCreateBy(userName);
panelView.setChartViewId(chartViewsRelaMap.get(panelView.getChartViewId()));
panelViewService.save(panelView);
});
}
@Transactional(rollbackFor = Exception.class)
public String applyPanel(PanelGroupRequest panelInfo, Map<String, String> chartViewsRelaMap, String newPanelId, String panelName, String pid) {
panelInfo.setId(newPanelId);
panelInfo.setPid(pid);
panelInfo.setName(panelName);
panelInfo.setNodeType("panel");
panelInfo.setPanelType("self");
panelInfo.setCreateBy(AuthUtils.getUser().getUsername());
panelInfo.setCreateTime(System.currentTimeMillis());
panelGroupService.newPanelFromApp(panelInfo, chartViewsRelaMap);
return newPanelId;
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyDataset(List<DatasetTable> datasetTablesInfo, Map<String, String> datasourceRelaMap, String sceneId) throws Exception {
Map<String, String> datasetsRelaMap = new HashMap<>();
for (DatasetTable datasetTable : datasetTablesInfo) {
String oldId = datasetTable.getId();
datasetTable.setId(null);
datasetTable.setSceneId(sceneId);
datasetTable.setDataSourceId(datasourceRelaMap.get(datasetTable.getDataSourceId()));
DataSetTableRequest datasetRequest = new DataSetTableRequest();
BeanUtils.copyBean(datasetRequest, datasetTable);
datasetRequest.setOptFrom("appApply");
DatasetTable newDataset = dataSetTableService.save(datasetRequest);
datasetsRelaMap.put(oldId, newDataset.getId());
}
return datasetsRelaMap;
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo, Map<String, String> datasetsRelaMap) {
Map<String, String> datasetFieldsRelaMap = new HashMap<>();
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
String oldId = datasetTableField.getId();
datasetTableField.setTableId(datasetsRelaMap.get(datasetTableField.getTableId()));
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
datasetFieldsRelaMap.put(oldId, newTableField.getId());
}
return datasetFieldsRelaMap;
}
@Transactional(rollbackFor = Exception.class)
public void resetCustomAndUnionDataset(List<DatasetTable> datasetTablesInfo, Map<String, String> datasetRelaMap, Map<String, String> datasetFieldsRelaMap) throws Exception {
for (DatasetTable datasetTable : datasetTablesInfo) {
if ((DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType()) || DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType()))) {
datasetRelaMap.forEach((k, v) -> {
datasetTable.setInfo(datasetTable.getInfo().replaceAll(k, v));
});
datasetFieldsRelaMap.forEach((k, v) -> {
datasetTable.setInfo(datasetTable.getInfo().replaceAll(k, v));
});
if (1 == datasetTable.getMode()) {
if (DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType())) {
dataSetTableService.createAppCustomDorisView(datasetTable.getInfo(), datasetTable.getId());
} else if (DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType())) {
dataSetTableService.createAppUnionDorisView(datasetTable.getInfo(), datasetTable.getId());
}
}
}
}
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo, Map<String, String> datasetsRelaMap, Map<String, String> datasetFieldsRelaMap, String sceneId) throws Exception {
Map<String, String> chartViewsRelaMap = new HashMap<>();
for (ChartViewWithBLOBs chartView : chartViewsInfo) {
String oldViewId = chartView.getId();
// 替换datasetId
chartView.setTableId(datasetsRelaMap.get(chartView.getTableId()));
datasetsRelaMap.forEach((k, v) -> {
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));
chartView.setYAxis(chartView.getYAxis().replaceAll(k, v));
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k, v));
chartView.setExtStack(chartView.getExtStack().replaceAll(k, v));
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k, v));
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k, v));
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k, v));
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
});
//替换datasetFieldId
datasetFieldsRelaMap.forEach((k, v) -> {
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));
chartView.setYAxis(chartView.getYAxis().replaceAll(k, v));
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k, v));
chartView.setExtStack(chartView.getExtStack().replaceAll(k, v));
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k, v));
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k, v));
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k, v));
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
});
chartView.setId(null);
chartView.setSceneId(sceneId);
ChartViewWithBLOBs newOne = chartViewService.newOne(chartView);
chartViewsRelaMap.put(oldViewId, newOne.getId());
}
return chartViewsRelaMap;
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyViewsField(List<ChartViewField> chartViewFieldsInfo, Map<String, String> chartViewsRelaMap, Map<String, String> datasetsRelaMap, Map<String, String> datasetFieldsRelaMap) {
Map<String, String> chartViewFieldsRelaMap = new HashMap<>();
if (!CollectionUtils.isEmpty(chartViewFieldsInfo)) {
for (ChartViewField chartViewField : chartViewFieldsInfo) {
String oldChartFieldId = chartViewField.getId();
chartViewField.setId(null);
//替换datasetId
chartViewField.setTableId(datasetsRelaMap.get(chartViewField.getTableId()));
//替换chartViewId
chartViewField.setChartId(chartViewsRelaMap.get(chartViewField.getId()));
//替换datasetFieldId
datasetFieldsRelaMap.forEach((k, v) -> {
chartViewField.setOriginName(chartViewField.getOriginName().replaceAll(k, v));
});
ChartViewField newChartViewField = chartViewFieldService.save(chartViewField);
chartViewFieldsRelaMap.put(oldChartFieldId, newChartViewField.getId());
}
}
return chartViewFieldsRelaMap;
}
public void nameCheck(PanelAppTemplateApplyRequest request) {
panelGroupService.checkPanelName(request.getPanelName(), request.getPanelId(), PanelConstants.OPT_TYPE_INSERT, null, "panel");
DatasetGroup datasetGroup = new DatasetGroup();
datasetGroup.setPid(request.getDatasetGroupId());
datasetGroup.setName(request.getDatasetGroupName());
dataSetGroupService.checkName(datasetGroup);
request.getDatasourceList().stream().forEach(datasource -> {
datasourceService.checkName(datasource.getName(), datasource.getType(), null);
});
}
}

View File

@ -3,23 +3,22 @@ package io.dataease.service.panel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.commons.constants.*;
import io.dataease.commons.utils.*;
import io.dataease.controller.request.authModel.VAuthModelRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.panel.*;
import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.PanelGroupExtendDataDTO;
import io.dataease.dto.SysLogDTO;
import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.dto.panel.PanelExport2App;
import io.dataease.dto.panel.PanelGroupAppInfo;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.PanelTemplateFileDTO;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
@ -30,7 +29,9 @@ import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.*;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.service.chart.ChartGroupService;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.staticResource.StaticResourceService;
import io.dataease.service.sys.SysAuthService;
@ -43,6 +44,7 @@ import org.pentaho.di.core.util.UUIDUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.Base64Utils;
@ -118,6 +120,16 @@ public class PanelGroupService {
private ExtDataSetTaskMapper extDataSetTaskMapper;
@Resource
private ExtDataSourceMapper extDataSourceMapper;
@Resource
private PanelAppTemplateService panelAppTemplateService;
@Resource
private PanelAppTemplateMapper panelAppTemplateMapper;
@Resource
private PanelAppTemplateLogService appTemplateLogService;
@Resource
private ChartGroupService chartGroupService;
@Resource
private DataSetGroupService dataSetGroupService;
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
@ -221,7 +233,7 @@ public class PanelGroupService {
}
private void checkPanelName(String name, String pid, String optType, String id, String nodeType) {
public void checkPanelName(String name, String pid, String optType, String id, String nodeType) {
PanelGroupExample groupExample = new PanelGroupExample();
if (PanelConstants.OPT_TYPE_INSERT.equalsIgnoreCase(optType)) {
groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name).andNodeTypeEqualTo(nodeType);
@ -231,7 +243,7 @@ public class PanelGroupService {
List<PanelGroup> checkResult = panelGroupMapper.selectByExample(groupExample);
if (CollectionUtils.isNotEmpty(checkResult)) {
DataEaseException.throwException(Translator.get("i18n_same_folder_can_not_repeat"));
DataEaseException.throwException(Translator.get("I18N_PANEL_EXIST"));
}
}
@ -360,34 +372,54 @@ public class PanelGroupService {
newPanel.setId(newPanelId);
newPanel.setCreateBy(AuthUtils.getUser().getUsername());
newPanel.setCreateTime(System.currentTimeMillis());
//TODO copy panelView
// copy panelView
extPanelViewMapper.copyFromPanel(newPanelId, sourcePanelId, copyId);
//TODO 复制视图 chart_view
// 复制视图 chart_view
extChartViewMapper.chartCopyWithPanel(copyId);
//TODO 复制视图字段 chart_view_field
// 复制视图字段 chart_view_field
extChartViewMapper.chartFiledCopyWithPanel(copyId);
//TODO 替换panel_data viewId 数据
// 替换panel_data viewId 数据
List<PanelView> panelViewList = panelViewService.findPanelViews(copyId);
//TODO 复制模板缓存数据
// 复制模板缓存数据
extPanelGroupExtendDataMapper.copyWithCopyId(copyId);
if (CollectionUtils.isNotEmpty(panelViewList)) {
String panelData = newPanel.getPanelData();
//TODO 替换panel_data viewId 数据 并保存
// 替换panel_data viewId 数据 并保存
for (PanelView panelView : panelViewList) {
panelData = panelData.replaceAll(panelView.getCopyFromView(), panelView.getChartViewId());
}
newPanel.setPanelData(panelData);
//TODO 复制跳转信息 copy panel_link_jump panel_link_jump_info panel_link_jump_target_view_info
// 复制跳转信息 copy panel_link_jump panel_link_jump_info panel_link_jump_target_view_info
extPanelLinkJumpMapper.copyLinkJump(copyId);
extPanelLinkJumpMapper.copyLinkJumpInfo(copyId);
extPanelLinkJumpMapper.copyLinkJumpTarget(copyId);
//TODO 复制联动信息 copy panel_view_linkage_field panel_view_linkage
// 复制联动信息 copy panel_view_linkage_field panel_view_linkage
extPanelViewLinkageMapper.copyViewLinkage(copyId);
extPanelViewLinkageMapper.copyViewLinkageField(copyId);
}
panelGroupMapper.insertSelective(newPanel);
return newPanelId;
}
@Transactional(rollbackFor = Exception.class)
public String newPanelFromApp(PanelGroupRequest request,Map<String,String> chartViewsRelaMap){
String newPanelId = request.getId();
String templateData = request.getPanelData();
String staticResource = request.getStaticResource();
Boolean mobileLayout = panelViewService.havaMobileLayout(templateData);
for(Map.Entry<String,String> entry:chartViewsRelaMap.entrySet()){
templateData = templateData.replaceAll(entry.getKey(),entry.getValue());
}
request.setMobileLayout(mobileLayout);
request.setPanelData(templateData);
staticResourceService.saveFilesToServe(staticResource);
panelGroupMapper.insertSelective(request);
// 清理权限缓存
clearPermissionCache();
sysAuthService.copyAuth(newPanelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL);
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.CREATE, sourceType, newPanelId, request.getPid(), null, null);
this.removePanelAllCache(newPanelId);
return newPanelId;
}
public String newPanel(PanelGroupRequest request) {
@ -442,7 +474,7 @@ public class PanelGroupService {
chartView.setId(newViewId);
chartView.setSceneId(newPanelId);
chartView.setDataFrom(CommonConstants.VIEW_DATA_FROM.TEMPLATE);
//TODO 数据处理 1.替换viewId 2.加入panelView 数据(数据来源为template) 3.加入模板view data数据
// 数据处理 1.替换viewId 2.加入panelView 数据(数据来源为template) 3.加入模板view data数据
templateData = templateData.replaceAll(originViewId, newViewId);
panelViews.add(new PanelViewInsertDTO(newViewId, newPanelId, position));
viewsData.add(new PanelGroupExtendDataDTO(newPanelId, newViewId, originViewData));
@ -737,19 +769,21 @@ public class PanelGroupService {
}
public PanelExport2App panelExport2AppCheck(String panelId) {
//TODO 1.获取所有视图信息
//1.获取所有视图信息
List<ChartViewWithBLOBs> chartViewsInfo = panelViewService.findByPanelId(panelId);
//TODO 2.获取视图扩展字段信息
//2.获取视图扩展字段信息
List<ChartViewField> chartViewFieldsInfo = extChartViewFieldMapper.findByPanelId(panelId);
//TODO 3.获取所有数据集信息
//3.获取所有数据集信息
List<DatasetTable> datasetTablesInfo = extDataSetTableMapper.findByPanelId(panelId);
//TODO 4.获取所有数据集字段信息
//4.获取所有数据集字段信息
List<DatasetTableField> datasetTableFieldsInfo = extDataSetTableFieldMapper.findByPanelId(panelId);
//TODO 5.获取所有任务信息
//5.获取所有任务信息
List<DataSetTaskDTO> dataSetTasksInfo = extDataSetTaskMapper.findByPanelId(panelId);
//TODO 6.获取所有数据源信息
//6.获取所有数据源信息
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.findByPanelId(panelId);
List<PanelView> panelViews = panelViewService.findPanelViewsByPanelId(panelId);
//校验标准 1.存在视图且所有视图的数据来源必须是dataset 2.存在数据集且没有excel数据集 3.存在数据源且是单数据源
//1.view check
if (CollectionUtils.isEmpty(chartViewsInfo)) {
@ -771,10 +805,72 @@ public class PanelGroupService {
} else if (datasourceDTOS.size() > 1) {
return new PanelExport2App("this panel should hava only one dataset");
}
return new PanelExport2App(chartViewsInfo, chartViewFieldsInfo, datasetTablesInfo, datasetTableFieldsInfo, dataSetTasksInfo, datasourceDTOS);
return new PanelExport2App(chartViewsInfo, chartViewFieldsInfo, datasetTablesInfo, datasetTableFieldsInfo, dataSetTasksInfo, datasourceDTOS,panelViews);
}
public void appApply(PanelExport2App appApplyInfo){
@Transactional(rollbackFor = Exception.class)
public String appApply(PanelAppTemplateApplyRequest request) throws Exception{
//仪表板名称校验数据集分组名称校验数据源名称校验
panelAppTemplateService.nameCheck(request);
String newPanelId = UUIDUtil.getUUIDAsString();
// 新建数据集分组
DatasetGroup newDatasetGroup = new DatasetGroup();
newDatasetGroup.setPid(request.getDatasetGroupId());
newDatasetGroup.setName(request.getDatasetGroupName());
newDatasetGroup.setType("group");
DataSetGroupDTO resultDatasetGroup = dataSetGroupService.save(newDatasetGroup);
String asideDatasetGroupId = resultDatasetGroup.getId();
//查询应用信息
PanelAppTemplateWithBLOBs appInfo = panelAppTemplateMapper.selectByPrimaryKey(request.getAppTemplateId());
//1.获取所有视图信息
List<ChartViewWithBLOBs> chartViewsInfo = gson.fromJson(appInfo.getChartViewsInfo(), new TypeToken<List<ChartViewWithBLOBs>>(){}.getType());
//2.获取视图扩展字段信息
List<ChartViewField> chartViewFieldsInfo = gson.fromJson(appInfo.getChartViewFieldsInfo(), new TypeToken<List<ChartViewField>>(){}.getType());
//3.获取所有数据集信息
List<DatasetTable> datasetTablesInfo = gson.fromJson(appInfo.getDatasetTablesInfo(), new TypeToken<List<DatasetTable>>(){}.getType());
//4.获取所有数据集字段信息
List<DatasetTableField> datasetTableFieldsInfo = gson.fromJson(appInfo.getDatasetTableFieldsInfo(), new TypeToken<List<DatasetTableField>>(){}.getType());
//5.获取所有任务信息
List<DataSetTaskDTO> dataSetTasksInfo = gson.fromJson(appInfo.getDatasetTasksInfo(), new TypeToken<List<DataSetTaskDTO>>(){}.getType());
//6.获取所有数据源信息
List<Datasource> oldDatasourceInfo = gson.fromJson(appInfo.getDatasourceInfo(), new TypeToken<List<Datasource>>(){}.getType());
//获取仪表板信息
PanelGroupRequest panelInfo = gson.fromJson(appInfo.getPanelInfo(),PanelGroupRequest.class);
//获取仪表板视图信息
List<PanelView> panelViewsInfo = gson.fromJson(appInfo.getPanelViewsInfo(), new TypeToken<List<PanelView>>(){}.getType());
Map<String,String> datasourceRelaMap = panelAppTemplateService.applyDatasource(oldDatasourceInfo,request.getDatasourceList());
Map<String,String> datasetsRelaMap = panelAppTemplateService.applyDataset(datasetTablesInfo,datasourceRelaMap,asideDatasetGroupId);
Map<String,String> datasetFieldsRelaMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo,datasetsRelaMap);
panelAppTemplateService.resetCustomAndUnionDataset(datasetTablesInfo,datasetsRelaMap,datasetFieldsRelaMap);
Map<String,String> chartViewsRelaMap = panelAppTemplateService.applyViews(chartViewsInfo,datasetsRelaMap,datasetFieldsRelaMap,newPanelId);
panelAppTemplateService.applyViewsField(chartViewFieldsInfo,chartViewsRelaMap,datasetsRelaMap,datasetFieldsRelaMap);
panelAppTemplateService.applyPanel(panelInfo,chartViewsRelaMap,newPanelId, request.getPanelName(), request.getPanelId());
panelAppTemplateService.applyPanelView(panelViewsInfo,chartViewsRelaMap,newPanelId);
String newDatasourceId =datasourceRelaMap.entrySet().stream().findFirst().get().getValue();
String newDatasourceName = request.getDatasourceList().get(0).getName();
PanelAppTemplateLog templateLog = new PanelAppTemplateLog();
templateLog.setPanelId(newPanelId);
templateLog.setSourcePanelName(request.getPanelName());
templateLog.setDatasourceId(newDatasourceId);
templateLog.setSourceDatasourceName(newDatasourceName);
templateLog.setDatasetGroupId(asideDatasetGroupId);
templateLog.setSourceDatasetGroupName(request.getDatasetGroupName());
templateLog.setAppTemplateId(appInfo.getId());
templateLog.setAppTemplateName(appInfo.getName());
appTemplateLogService.newAppApplyLog(templateLog);
return newPanelId;
}
}

View File

@ -19,6 +19,7 @@ import io.dataease.plugins.common.base.mapper.PanelViewMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.pentaho.di.core.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -44,8 +45,6 @@ public class PanelViewService {
@Resource
private ExtChartViewMapper extChartViewMapper;
private ExtPanelGroupMapper extPanelGroupMapper;
private final static String SCENE_TYPE = "scene";
public List<PanelViewDto> groups() {
@ -173,4 +172,14 @@ public class PanelViewService {
public List<ChartViewWithBLOBs> findByPanelId(String panelId) {
return extChartViewMapper.findByPanelId(panelId);
}
public List<PanelView> findPanelViewsByPanelId(String panelId){
PanelViewExample example = new PanelViewExample();
example.createCriteria().andPanelIdEqualTo(panelId);
return panelViewMapper.selectByExample(example);
}
public void save(PanelView panelView){
panelViewMapper.insertSelective(panelView);
}
}

View File

@ -0,0 +1,184 @@
package io.dataease.service.panel.applog;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.sys.request.LogTypeItem;
import io.dataease.dto.log.FolderItem;
import io.dataease.ext.ExtSysLogMapper;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.base.domain.SysLogWithBLOBs;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.service.datasource.DatasourceService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class AppLogManager {
protected static final String contentFormat = "【%s】";
protected static final String positionFormat = "在【%s】";
protected static final String format = "给%s【%s】";
protected Gson gson = new Gson();
protected Type type = new TypeToken<List<FolderItem>>() {}.getType();
@Resource
private ExtSysLogMapper extSysLogMapper;
@Resource
private DatasourceService datasourceService;
public String detailInfo(SysLogWithBLOBs vo) {
String sourceName = vo.getSourceName();
String postion = null;
String operateTypeName = SysLogConstants.operateTypeName(vo.getOperateType());
operateTypeName = Translator.get(operateTypeName);
String sourceTypeName = SysLogConstants.sourceTypeName(vo.getSourceType());
sourceTypeName = Translator.get(sourceTypeName);
String result = operateTypeName + sourceTypeName + String.format(contentFormat, sourceName) + remarkInfo(vo);
if ((postion = vo.getPosition()) != null) {
List<FolderItem> folderItems = gson.fromJson(postion, type);
String template = folderItems.stream().map(folderItem -> folderItem.getName()).collect(Collectors.joining("/"));
String postionResult = String.format(positionFormat, template);
return postionResult + result;
}
return result;
}
public String remarkInfo(SysLogWithBLOBs vo) {
String remakrk = null;
if ((remakrk = vo.getRemark()) != null) {
String targetTypeName = null;
List<FolderItem> targetInfos = gson.fromJson(remakrk, type);
if (CollectionUtils.isNotEmpty(targetInfos)) {
String template = targetInfos.stream().map(folderItem -> folderItem.getName()).collect(Collectors.joining("/"));
FolderItem item = targetInfos.get(0);
Integer targetType = item.getType();
targetTypeName = SysLogConstants.sourceTypeName(targetType);
targetTypeName = Translator.get(targetTypeName);
return String.format(format, targetTypeName, template);
}
}
return "";
}
private LogTypeItem parentIds(String id, Integer value) {
LogTypeItem result = new LogTypeItem();
String typeValue = "";
Boolean reversed = false;
switch (value) {
case 2:
typeValue = "dataset";
break;
case 3:
typeValue = "panel";
reversed = true;
break;
case 7:
typeValue = "dept";
break;
case 11:
typeValue = "menu";
break;
default:
break;
}
List<String> ids = new ArrayList<>();
if (StringUtils.isNotBlank(typeValue)) {
ids.addAll(AuthUtils.parentResources(id, typeValue));
if (reversed) {
Collections.reverse(ids);
}
}
result.setParentIds(ids);
result.setTypeValue(typeValue);
return result;
}
private List<FolderItem> parentInfos(List<String> ids, Integer value){
List<FolderItem> folderItems = extSysLogMapper.idAndName(ids, value);
if (value == 3) {
folderItems.forEach(item -> {
if (StringUtils.equals("i18n_panel_list", item.getName())) {
item.setName(Translator.get(item.getName()));
}
});
}
folderItems.forEach(item -> item.setType(value));
return folderItems;
}
public List<FolderItem> justParents(String id, SysLogConstants.SOURCE_TYPE type) {
Integer value = type.getValue();
LogTypeItem typeItem = parentIds(id, value);
List<String> ids = typeItem.getParentIds();
ids = ids.stream().filter(item -> !StringUtils.equals(id, item)).collect(Collectors.toList());
return parentInfos(ids, value);
}
public List<FolderItem> parentsAndSelf(String id, SysLogConstants.SOURCE_TYPE type) {
Integer value = type.getValue();
LogTypeItem logTypeItem = parentIds(id, value);
if (CollectionUtils.isEmpty(logTypeItem.getParentIds())) {
logTypeItem.getParentIds().add(id);
}
return parentInfos(logTypeItem.getParentIds(), value);
}
public FolderItem nameWithId(String id, Integer type) {
List<String> ids = new ArrayList<>();
ids.add(id);
List<FolderItem> folderItems = extSysLogMapper.idAndName(ids, type);
if (CollectionUtils.isNotEmpty(folderItems)) {
return folderItems.get(0);
}
return null;
}
public FolderItem dsTypeInfo(String typeId) {
ArrayList<DataSourceType> dataSourceTypes = new ArrayList<>(datasourceService.types());
String name = null;
for (int i = 0; i < dataSourceTypes.size(); i++) {
if (dataSourceTypes.get(i).getType().equals(typeId)){
name = dataSourceTypes.get(i).getName();
break;
}
}
FolderItem folderItem = new FolderItem();
folderItem.setId(typeId);
folderItem.setName(StringUtils.isNotBlank(name) ? name : typeId);
return folderItem;
}
public FolderItem dsTypeInfoById(String dsId) {
Datasource datasource = datasourceService.get(dsId);
return dsTypeInfo(datasource.getType());
}
}

View File

@ -0,0 +1,11 @@
package io.dataease.service.panel.applog;
import io.dataease.ext.query.GridExample;
import lombok.Data;
import java.util.List;
@Data
public class AppLogQueryParam extends GridExample {
}

View File

@ -0,0 +1,37 @@
package io.dataease.service.panel.applog;
import com.google.gson.Gson;
import io.dataease.controller.sys.request.KeyGridRequest;
import io.dataease.dto.SysLogDTO;
import io.dataease.dto.appTemplateMarket.AppLogGridDTO;
import io.dataease.ext.ExtAppLogMapper;
import io.dataease.ext.query.GridExample;
import io.dataease.plugins.common.base.mapper.PanelAppTemplateLogMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class AppLogService {
private Gson gson = new Gson();
@Resource
private PanelAppTemplateLogMapper appLogMapper;
@Resource
private ExtAppLogMapper extAppLogMapper;
public List<AppLogGridDTO> query(KeyGridRequest request) {
GridExample gridExample = request.convertExample();
gridExample.setExtendCondition(request.getKeyWord());
AppLogQueryParam logQueryParam = gson.fromJson(gson.toJson(gridExample), AppLogQueryParam.class);
List<AppLogGridDTO> voLogs = extAppLogMapper.query(logQueryParam);
return voLogs;
}
public void saveLog(SysLogDTO sysLogDTO) {
}
}

View File

@ -24,8 +24,13 @@ CREATE TABLE `task_instance` (
INSERT INTO `task_instance` (`task_id`) VALUES ('Datasource_check_status');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (41, 1, 1, 1, '应用管理', 'system-template-app', 'panel/templateApp/index', 13, 'display-setting', 'panel/templateApp/index', 0, 0, 0, 'template:read', NULL, NULL, NULL, 1620444227389);
update sys_menu set menu_sort=10 where menu_id=1;
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (41, 1, 1, 1, '应用管理', 'system-app-template', 'panel/appTemplate/index', 13, 'sys-param', 'panel/appTemplate/index', 0, 0, 0, NULL, NULL, NULL, NULL, 1620444227389);
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (203, 0, 0, 1, '应用市场', 'app-template-market', 'panel/appTemplateMarket/index', 6, 'dashboard', '/appTemplateMarket', 0, 0, 0, NULL, NULL, NULL, NULL, 1620444227389);
-- ----------------------------
-- Table structure for panel_app_template
-- ----------------------------
DROP TABLE IF EXISTS `panel_app_template`;
CREATE TABLE `panel_app_template` (
`id` varchar(50) NOT NULL,
@ -34,11 +39,14 @@ CREATE TABLE `panel_app_template` (
`level` int(8) DEFAULT NULL,
`pid` varchar(255) DEFAULT NULL COMMENT '父级ID',
`version` varchar(255) DEFAULT NULL COMMENT '版本',
`icon` varchar(1000) DEFAULT NULL,
`application_info` longtext COMMENT '应用信息',
`panel_info` longtext COMMENT '仪表板信息',
`views_info` longtext COMMENT '视图信息',
`dataset_info` longtext COMMENT '数据集信息',
`dataset_fields_info` longtext COMMENT '数据集字段信息',
`panel_views_info` longtext COMMENT '仪表板视图信息',
`chart_views_info` longtext COMMENT '视图信息',
`chart_view_fields_info` longtext COMMENT '视图计算字段信息',
`dataset_tables_info` longtext COMMENT '数据集信息',
`dataset_table_fields_info` longtext COMMENT '数据集字段信息',
`dataset_tasks_info` longtext COMMENT '数据集任务信息',
`datasource_info` longtext COMMENT '数据源信息',
`snapshot` longtext,
@ -47,7 +55,28 @@ CREATE TABLE `panel_app_template` (
`create_time` bigint(13) DEFAULT NULL,
`create_user` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
-- ----------------------------
-- Table structure for panel_app_template_log
-- ----------------------------
DROP TABLE IF EXISTS `panel_app_template_log`;
CREATE TABLE `panel_app_template_log` (
`id` varchar(50) NOT NULL,
`app_template_id` varchar(50) DEFAULT NULL COMMENT '应用模板id',
`app_template_name` varchar(255) DEFAULT NULL COMMENT '原仪表板名称',
`datasource_id` varchar(50) DEFAULT NULL COMMENT '数据源ID',
`source_datasource_name` varchar(255) DEFAULT NULL COMMENT '原数据源名称',
`dataset_group_id` varchar(50) DEFAULT NULL COMMENT '数据集分组ID',
`source_dataset_group_name` varchar(255) DEFAULT NULL COMMENT '原数据集分组名称',
`panel_id` varchar(50) DEFAULT NULL COMMENT '仪表板ID',
`source_panel_name` varchar(255) DEFAULT NULL COMMENT '原仪表板名称',
`apply_time` bigint(13) DEFAULT NULL COMMENT '应用时间',
`apply_persion` varchar(255) DEFAULT NULL COMMENT '应用人',
`is_success` tinyint(1) DEFAULT '1' COMMENT '是否成功',
`remark` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
INSERT INTO `sys_menu` VALUES (800, 0, 0, 1, '数据集表单', 'dataset-form', 'dataset/form', 999, NULL, '/dataset-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);

View File

@ -1,6 +1,8 @@
\u4E2A\u4EBA\u4FE1\u606F=Personal Information
\u4EEA\u8868\u677F=Dashboard
\u6A21\u677F\u5E02\u573A=Template Market
\u5E94\u7528\u5E02\u573A=App Market
\u5E94\u7528\u7BA1\u7406=Applications
\u4FEE\u6539\u5BC6\u7801=Change Password
\u521B\u5EFA\u7528\u6237=Create User
\u521B\u5EFA\u7EC4\u7EC7=Create Organization
@ -220,4 +222,7 @@ I18N_USER_SOURCE_PWD_ERROR=Source password error
I18N_USER_PWD_FORMAT_ERROR=Password format error
I18N_DS_INVALID=Datasource is invalid.
I18N_DS_INVALID_TABLE=Datasource has invalid tables
I18N_DS_INVALID_TABLE=Datasource has invalid tables
I18N_PANEL_EXIST=The current panel name already exists under this directory
I18N_DATASET_GROUP_EXIST=The current dataset grouping name already exists under this directory

View File

@ -1,6 +1,8 @@
\u4E2A\u4EBA\u4FE1\u606F=\u4E2A\u4EBA\u4FE1\u606F
\u4EEA\u8868\u677F=\u4EEA\u8868\u677F
\u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u573A
\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u573A
\u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406
\u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u7801
\u521B\u5EFA\u7528\u6237=\u521B\u5EFA\u7528\u6237
\u521B\u5EFA\u7EC4\u7EC7=\u521B\u5EFA\u7EC4\u7EC7
@ -220,4 +222,7 @@ I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u7801\u9519\u8BEF
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u7801\u683C\u5F0F\u9519\u8BEF
I18N_DS_INVALID=\u6570\u636E\u6E90\u65E0\u6548.
I18N_DS_INVALID_TABLE=\u6570\u636E\u6E90\u4E2D\u6709\u65E0\u6548\u7684\u8868
I18N_DS_INVALID_TABLE=\u6570\u636E\u6E90\u4E2D\u6709\u65E0\u6548\u7684\u8868
I18N_PANEL_EXIST=\u5F53\u524D\u4EEA\u8868\u677F\u540D\u79F0\u5728\u8BE5\u76EE\u5F55\u4E0B\u9762\u5DF2\u7ECF\u5B58\u5728
I18N_DATASET_GROUP_EXIST=\u5F53\u524D\u6570\u636E\u96C6\u5206\u7EC4\u540D\u79F0\u5728\u8BE5\u76EE\u5F55\u4E0B\u9762\u5DF2\u7ECF\u5B58\u5728

View File

@ -1,6 +1,8 @@
\u4E2A\u4EBA\u4FE1\u606F=\u500B\u4EBA\u4FE1\u606F
\u4EEA\u8868\u677F=\u5100\u8868\u677F
\u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u5834
\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u5834
\u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406
\u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u78BC
\u521B\u5EFA\u7528\u6237=\u5275\u5EFA\u7528\u6236
\u521B\u5EFA\u7EC4\u7EC7=\u5275\u5EFA\u7D44\u7E54
@ -216,4 +218,7 @@ I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u78BC\u932F\u8AA4
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u78BC\u683C\u5F0F\u932F\u8AA4
I18N_DS_INVALID=\u6578\u64DA\u6E90\u7121\u6548.
I18N_DS_INVALID_TABLE=\u6578\u64DA\u6E90\u4E2D\u6709\u7121\u6548\u7684\u8868
I18N_DS_INVALID_TABLE=\u6578\u64DA\u6E90\u4E2D\u6709\u7121\u6548\u7684\u8868
I18N_PANEL_EXIST=\u7576\u524D\u5100\u9336\u95C6\u540D\u7A31\u5728\u8A72\u76EE\u9304\u4E0B\u9762\u5DF2\u7D93\u5B58\u5728
I18N_DATASET_GROUP_EXIST=\u7576\u524D\u6578\u64DA\u96C6\u5206\u7D44\u540D\u7A31\u5728\u8A72\u76EE\u9304\u4E0B\u9762\u5DF2\u7D93\u5B58\u5728

View File

@ -0,0 +1,20 @@
import request from '@/utils/request'
export function searchAppTemplate(data) {
return request({
url: '/appTemplate/find',
method: 'post',
loading: true,
hideMsg: true,
data
})
}
export function getCategories() {
return request({
url: '/template/market/categories',
method: 'get',
hideMsg: true,
loading: true
})
}

View File

@ -0,0 +1,28 @@
import request from '@/utils/request'
export function logGrid(page, size, data) {
return request({
url: '/app/log/logGrid/' + page + '/' + size,
method: 'post',
data,
loading: true
})
}
export function opTypes() {
return request({
url: '/api/log/opTypes',
method: 'post',
loading: true
})
}
export function exportExcel(data) {
return request({
url: '/api/log/export',
method: 'post',
loading: true,
responseType: 'blob',
data
})
}

View File

@ -69,6 +69,15 @@ export function groupTree(data) {
})
}
export function dsGroupTree(data) {
return request({
url: '/dataset/group/tree',
method: 'post',
loading: true,
data
})
}
export function listDatasource() {
return request({
url: '/datasource/list',

View File

@ -307,3 +307,12 @@ export function export2AppCheck(panelId){
loading: false
})
}
export function appApply(data) {
return request({
url: 'panel/group/appApply',
method: 'post',
loading: true,
data
})
}

View File

@ -2,22 +2,32 @@ import request from '@/utils/request'
export function save(data) {
return request({
url: '/templateApp/save',
url: '/appTemplate/save',
data: data,
method: 'post',
loading: true
})
}
export function update(data) {
return request({
url: '/appTemplate/update',
data: data,
method: 'post',
loading: true
})
}
export function templateDelete(id) {
return request({
url: '/templateApp/delete/' + id,
url: '/appTemplate/delete/' + id,
method: 'delete'
})
}
export function showtemplateAppList(data) {
export function showappTemplateList(data) {
return request({
url: '/templateApp/templateAppList',
url: '/appTemplate/appTemplateList',
data: data,
method: 'post'
})
@ -25,14 +35,14 @@ export function showtemplateAppList(data) {
export function findOne(id) {
return request({
url: '/templateApp/findOne/' + id,
url: '/appTemplate/findOne/' + id,
method: 'get'
})
}
export function find(data) {
return request({
url: '/templateApp/find',
url: '/appTemplate/find',
data: data,
loading: true,
method: 'post'
@ -41,7 +51,7 @@ export function find(data) {
export function nameCheck(data) {
return request({
url: '/templateApp/nameCheck',
url: '/appTemplate/nameCheck',
data: data,
method: 'post'
})

View File

@ -43,6 +43,7 @@ export function listDriverByType(type) {
method: 'get'
})
}
export function addDs(data) {
return request({
url: 'datasource/add/',

View File

@ -11,8 +11,8 @@ export default {
customClass,
});
},
handlerConfirm(options) {
let { title, content, type = 'danger', cb, confirmButtonText = this.$t('commons.delete'), showCancelButton = true, cancelButtonText = this.$t("commons.cancel"), cancelCb = () => {} } = options;
handlerConfirm(options,confirmButtonTextInfo) {
let { title, content, type = 'danger', cb, confirmButtonText = confirmButtonTextInfo?confirmButtonTextInfo:this.$t('commons.delete'), showCancelButton = true, cancelButtonText = this.$t("commons.cancel"), cancelCb = () => {} } = options;
let text = content ? `<span>${ this.$t(title) }</span><br><span class="use-html">${ this.$t(content) }</span>` : this.$t(title);
const dangerouslyUseHTMLString = Boolean(content);
let customClass = `de-confirm de-confirm-fail ${ dangerouslyUseHTMLString && 'de-use-html'}`

View File

@ -131,6 +131,7 @@ export default {
default_login: 'Normal'
},
commons: {
uninstall:'Uninstall',
no_result: 'No Result',
manage_member: 'Managing members',
confirm_remove_cancel: 'Are you sure to delete the role?',
@ -2478,6 +2479,16 @@ export default {
please_select_map: 'Please select a range of map'
},
'I18N_USER_TEMPLATE_ERROR': 'Template file error',
'i18n_max_user_import_size': 'File size exceeds 10M'
'i18n_max_user_import_size': 'File size exceeds 10M',
app_template: {
app_manager: 'Application management',
app_upload: 'Upload app',
no_apps: 'No apps',
app_group_icon: 'Cover icon',
app_name: 'Application name',
search_by_keyword:'Search by keyword',
apply_logs:'Apply logs',
app_group_delete_tips: 'Are you sure to delete this application category?',
app_group_delete_content: 'After deletion, all application templates in this category will also be deleted.'
}
}

View File

@ -131,6 +131,7 @@ export default {
default_login: '普通登錄'
},
commons: {
uninstall:'卸载',
no_result: '没有找到相关内容',
manage_member: '管理成員',
user_confirm_remove_cancel: '確定將該用戶從角色中移除嗎?',
@ -2479,5 +2480,16 @@ export default {
please_select_map: '請先選擇地圖範圍'
},
'I18N_USER_TEMPLATE_ERROR': '模版錯誤',
'i18n_max_user_import_size': '文件最大不能超過10M'
'i18n_max_user_import_size': '文件最大不能超過10M',
app_template: {
app_manager: '應用管理',
app_upload: '上傳應用',
no_apps: '暫無應用',
app_group_icon: '封面圖標',
app_name: '應用名稱',
search_by_keyword:'通過關鍵字搜索',
apply_logs:'應用記錄',
app_group_delete_tips: '確定刪除該應用分類嗎?',
app_group_delete_content: '刪除後,該分類中所有的應用模闆也將被刪除。'
}
}

View File

@ -131,6 +131,7 @@ export default {
default_login: '普通登录'
},
commons: {
uninstall:'卸载',
no_result: '没有找到相关内容',
manage_member: '管理成员',
confirm_remove_cancel: '确定删除该角色吗?',
@ -831,11 +832,11 @@ export default {
import_succeeded: '导入成功',
name_already_exists_type: '分类名称已存在',
rename_succeeded: '重命名成功',
the_same_category: '同一分类下,该模名称已存在',
delete_this_template: '确定删除该模吗?',
also_be_deleted: '删除后,该分类中所有的模也将被删除。',
the_same_category: '同一分类下,该模名称已存在',
delete_this_template: '确定删除该模吗?',
also_be_deleted: '删除后,该分类中所有的模也将被删除。',
delete_this_category: '确定删除该分类吗?',
edit_template: '编辑模',
edit_template: '编辑模',
edit_classification: '编辑分类',
classification_name: '分类名称',
by_event_details: '通过事件详情搜索',
@ -2479,5 +2480,16 @@ export default {
please_select_map: '请先选择地图范围'
},
'I18N_USER_TEMPLATE_ERROR': '模版错误',
'i18n_max_user_import_size': '文件最大不能超过10M'
'i18n_max_user_import_size': '文件最大不能超过10M',
app_template: {
app_manager: '应用管理',
app_upload: '上传应用',
no_apps: '暂无应用',
app_group_icon: '封面图标',
app_name: '应用名称',
search_by_keyword:'通过关键字搜索',
apply_logs:'应用记录',
app_group_delete_tips: '确定删除该应用分类吗?',
app_group_delete_content: '删除后,该分类中所有的应用模板也将被删除。'
}
}

View File

@ -9,7 +9,7 @@
:model="templateInfo"
:rules="templateInfoRules"
>
<el-form-item :label="'应用名称'" prop="name">
<el-form-item :label="$t('app_template.app_name')" prop="name">
<div class="flex-template">
<el-input v-model="templateInfo.name" clearable size="small" />
<deBtn
@ -17,7 +17,9 @@
class="el-icon-upload2"
secondary
@click="goFile"
>上传应用</deBtn
>
{{$t('app_template.app_upload')}}
</deBtn
>
<input
id="input"
@ -43,7 +45,7 @@
</template>
<script>
import { save, nameCheck } from "@/api/system/templateApp";
import { save,update, nameCheck } from "@/api/system/appTemplate";
import msgCfm from "@/components/msgCfm/index";
import { find } from "@/api/system/template";
import {imgUrlTrans} from "@/components/canvas/utils/utils";
@ -55,10 +57,27 @@ export default {
type: String,
required: true,
},
optType: {
type: String,
required: false
},
appTemplateInfo: {
type: Object,
required: false,
},
},
mounted() {
if('update'===this.optType){
this.templateInfo.id = this.appTemplateInfo.id
this.templateInfo.name = this.appTemplateInfo.name
this.templateInfo.snapshot = this.appTemplateInfo.snapshot
this.templateInfo.pid = this.appTemplateInfo.pid
this.templateInfo.level = 1
}
},
data() {
return {
appResultInfo:null,
appResultInfo: {},
importTemplateInfo: {
snapshot: "",
},
@ -73,6 +92,7 @@ export default {
},
recover: false,
templateInfo: {
id:null,
level: "1",
pid: this.pid,
name: "",
@ -86,9 +106,9 @@ export default {
},
computed: {
classBackground() {
if (this.importTemplateInfo.snapshot) {
if (this.templateInfo.snapshot) {
return {
background: `url(${imgUrlTrans(this.importTemplateInfo.snapshot)}) no-repeat`,
background: `url(${imgUrlTrans(this.templateInfo.snapshot)}) no-repeat`,
};
} else {
return {};
@ -112,7 +132,7 @@ export default {
this.$warning(this.$t("chart.name_can_not_empty"));
return false;
}
if (!this.templateInfo.templateData) {
if ('update'!==this.optType && !this.templateInfo.templateData) {
this.$warning(this.$t("chart.template_can_not_empty"));
return false;
}
@ -121,28 +141,29 @@ export default {
name: this.templateInfo.name,
optType: "insert",
};
this.appResultInfo['pid'] =this.templateInfo.pid,
this.appResultInfo['name'] =this.templateInfo.name,
if('update'===this.optType){
nameCheckRequest.optType = 'update'
nameCheckRequest['id'] = this.templateInfo.id
this.appResultInfo['id'] = this.templateInfo.id
this.appResultInfo['optType'] = 'update'
}
this.appResultInfo['pid'] =this.templateInfo.pid
this.appResultInfo['level'] =this.templateInfo.level
this.appResultInfo['name'] =this.templateInfo.name,
this.appResultInfo['snapshot'] =this.templateInfo.snapshot
const method = 'update'===this.optType?update:save
const successMsg = 'update'===this.optType?'更新成功':this.$t('system_parameter_setting.import_succeeded')
const _this = this
nameCheck(nameCheckRequest).then((response) => {
if (response.data.indexOf("exist") > -1) {
const options = {
title: 'commons.prompt',
content: "system_parameter_setting.to_overwrite_them",
type: "primary",
cb: () => save(_this.appResultInfo).then((response) => {
this.openMessageSuccess("system_parameter_setting.import_succeeded");
this.$emit("refresh");
this.$emit("closeEditTemplateDialog");
}),
confirmButtonText: this.$t('template.override')
};
this.handlerConfirm(options);
this.$message({
message: '当前名称已经存在',
type: 'error',
showClose: true
})
} else {
save(_this.appResultInfo).then((response) => {
this.openMessageSuccess("system_parameter_setting.import_succeeded");
method(_this.appResultInfo).then((response) => {
this.openMessageSuccess(successMsg);
this.$emit("refresh");
this.$emit("closeEditTemplateDialog");
});

View File

@ -1,7 +1,7 @@
<template>
<div :style="classBackground" class="de-card-model">
<div class="card-img-model" :style="classImg">
<img :src="model.snapshot" alt="" />
<img :src="model.snapshot" alt=""/>
</div>
<div class="card-info">
<el-tooltip
@ -16,13 +16,13 @@
<i class="el-icon-more"></i>
<el-dropdown-menu class="de-card-dropdown" slot="dropdown">
<slot>
<!-- <el-dropdown-item command="rename">-->
<!-- <i class="el-icon-edit"></i>-->
<!-- {{ $t('chart.rename')}}-->
<!-- </el-dropdown-item>-->
<el-dropdown-item command="update">
<i class="el-icon-edit"></i>
{{ $t("commons.update") }}
</el-dropdown-item>
<el-dropdown-item command="delete">
<i class="el-icon-delete"></i>
卸载
{{ $t("commons.uninstall") }}
</el-dropdown-item>
</slot>
</el-dropdown-menu>
@ -36,7 +36,8 @@ export default {
props: {
model: {
type: Object,
default: () => {},
default: () => {
},
},
width: {
type: Number
@ -51,10 +52,8 @@ export default {
},
classImg() {
return {
width: this.width + 'px',
height: this.width * 0.576 + 'px',
// background: `url(${this.model.snapshot}) no-repeat`,
// 'background-size': `100% 100%`
width: (this.width - 2) + 'px',
height: this.width * 0.576 + 'px'
}
},
},
@ -73,6 +72,7 @@ export default {
border: 1px solid var(--deCardStrokeColor, #dee0e3);
border-radius: 4px;
margin: 0 24px 25px 0;
.card-img-model {
border-bottom: 1px solid var(--deCardStrokeColor, #dee0e3);
height: 144px;
@ -138,6 +138,7 @@ export default {
.de-card-dropdown {
margin-top: 0 !important;
.popper__arrow {
display: none !important;
}

View File

@ -39,13 +39,13 @@
</span>
<el-dropdown-menu class="de-template-dropdown" slot="dropdown">
<el-dropdown-item icon="el-icon-upload2" command="import">
{{ $t("panel.import") }}
{{$t('app_template.app_upload')}}
</el-dropdown-item>
<el-dropdown-item icon="el-icon-edit" command="edit">
{{ $t("panel.rename") }}
{{ $t("commons.edit") }}
</el-dropdown-item>
<el-dropdown-item icon="el-icon-delete" command="delete">
{{ $t("panel.delete") }}
{{ $t("commons.delete") }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -129,8 +129,8 @@ export default {
},
templateDelete(template) {
const options = {
title: "system_parameter_setting.delete_this_category",
content: "system_parameter_setting.also_be_deleted",
title: this.$('app_template.app_group_delete_tips'),
content: this.$('app_template.app_group_delete_content'),
type: "primary",
cb: () => this.$emit("templateDelete", template.id),
};

View File

@ -10,7 +10,7 @@
ref="templateList"
:template-type="currentTemplateType"
:template-list="templateList"
@templateDelete="templateDelete"
@templateDelete="templateListDelete"
@templateEdit="templateEdit"
@showCurrentTemplate="showCurrentTemplate"
@templateImport="templateImport"
@ -27,13 +27,13 @@
@click="templateImport(currentTemplateId)"
icon="el-icon-upload2"
>
上传应用
{{$t('app_template.app_upload')}}
</deBtn>
</div>
<el-empty
:image="noneImg"
v-if="!currentTemplateShowList.length"
:description="$t('components.no_template')"
:description="$t('app_template.no_apps')"
></el-empty>
<div
id="template-box"
@ -57,6 +57,7 @@
append-to-body
class="de-dialog-form"
width="600px"
destroy-on-close="true"
>
<el-form
ref="templateEditForm"
@ -65,13 +66,34 @@
:rules="templateEditFormRules"
>
<el-form-item :label="dialogTitleLabel" prop="name">
<el-input v-model="templateEditForm.name" />
<el-input v-model="templateEditForm.name"/>
</el-form-item>
<el-form-item :label="$t('app_template.app_group_icon')" prop="icon">
<el-col style="width: 148px!important;height: 148px!important;overflow: hidden">
<el-upload
action=""
accept=".jpeg,.jpg,.png,.gif,.svg"
class="avatar-uploader"
list-type="picture-card"
:class="{disabled:uploadDisabled}"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:http-request="upload"
:file-list="fileList"
>
<i class="el-icon-plus"/>
</el-upload>
<el-dialog top="25vh" width="600px" :append-to-body="true" :destroy-on-close="true"
:visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl">
</el-dialog>
</el-col>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<deBtn secondary @click="close()">{{ $t("commons.cancel") }}</deBtn>
<deBtn type="primary" @click="saveTemplateEdit(templateEditForm)"
>{{ $t("commons.confirm") }}
>{{ $t("commons.confirm") }}
</deBtn>
</div>
</el-dialog>
@ -87,6 +109,8 @@
<template-import
v-if="templateDialog.visible"
:pid="templateDialog.pid"
:opt-type="templateOptType"
:app-template-info="currentAppTemplateInfo"
@refresh="showCurrentTemplate(currentTemplateId,
currentTemplateLabel)"
@closeEditTemplateDialog="closeEditTemplateDialog"
@ -100,15 +124,24 @@ import DeLayoutContent from "@/components/business/DeLayoutContent";
import TemplateList from "./component/TemplateList";
import TemplateItem from "./component/TemplateItem";
import TemplateImport from "./component/TemplateImport";
import { save, templateDelete, find } from "@/api/system/templateApp";
import {save, update, templateDelete, find} from "@/api/system/appTemplate";
import elementResizeDetectorMaker from "element-resize-detector";
import msgCfm from "@/components/msgCfm/index";
import {uploadFileResult} from "@/api/staticResource/staticResource";
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: "TemplateApp",
name: "AppTemplate",
mixins: [msgCfm],
components: { DeLayoutContent, TemplateList, TemplateItem, TemplateImport },
components: {DeLayoutContent, TemplateList, TemplateItem, TemplateImport},
data() {
return {
templateOptType:'add',
currentAppTemplateInfo:null,
fileList: [],
dialogImageUrl: '',
dialogVisible: false,
uploadDisabled: false,
showShare: false,
currentTemplateShowList: [],
noneImg: require('@/assets/None.png'),
@ -116,7 +149,7 @@ export default {
currentTemplateType: "self",
templateEditFormRules: {
name: [
{ required: true, trigger: "blur", validator: this.roleValidator },
{required: true, trigger: "blur", validator: this.roleValidator},
{
required: true,
message: this.$t("commons.input_content"),
@ -128,6 +161,13 @@ export default {
trigger: "change",
},
],
icon: [
{
required: true,
message: '请选择文件',
trigger: "change",
},
],
},
templateEditForm: {},
editTemplate: false,
@ -149,7 +189,7 @@ export default {
},
computed: {
nameList() {
const { nodeType } = this.templateEditForm || {};
const {nodeType} = this.templateEditForm || {};
if ("template" === nodeType) {
return this.currentTemplateShowList.map((ele) => ele.name);
}
@ -179,7 +219,7 @@ export default {
methods: {
roleValidator(rule, value, callback) {
if (this.nameRepeat(value)) {
const { nodeType } = this.templateEditForm || {};
const {nodeType} = this.templateEditForm || {};
callback(
new Error(
this.$t(
@ -213,17 +253,26 @@ export default {
case "delete":
this.templateDeleteConfirm(data);
break;
case "update":
this.updateAppTemplate(data);
break;
default:
break;
}
},
updateAppTemplate(data){
this.templateOptType='update';
this.templateDialog.visible = true
this.currentAppTemplateInfo = data
this.templateDialog.pid = data.pid;
},
templateDeleteConfirm(template) {
const options = {
title: "system_parameter_setting.delete_this_template",
title: "是否卸载当前应用?",
type: "primary",
cb: () => this.templateDelete(template.id),
};
this.handlerConfirm(options);
this.handlerConfirm(options,"卸载");
},
handleClick(tab, event) {
this.getTree();
@ -232,11 +281,20 @@ export default {
this.currentTemplateId = pid;
this.currentTemplateLabel = name;
if (this.currentTemplateId) {
find({ pid: this.currentTemplateId }).then((response) => {
find({pid: this.currentTemplateId}).then((response) => {
this.currentTemplateShowList = response.data;
});
}
},
templateListDelete(id) {
if (id) {
templateDelete(id).then((response) => {
this.openMessageSuccess("commons.delete_success");
this.getTree();
});
}
},
templateDelete(id) {
if (id) {
templateDelete(id).then((response) => {
@ -249,6 +307,9 @@ export default {
this.templateEditForm = null;
this.formType = type;
if (type === "edit") {
if (templateInfo.icon) {
this.fileList.push({url: imgUrlTrans(templateInfo.icon)})
}
this.templateEditForm = JSON.parse(JSON.stringify(templateInfo));
this.dialogTitle = this.$t(
`system_parameter_setting.${
@ -259,11 +320,13 @@ export default {
);
this.originName = this.templateEditForm.label;
} else {
this.fileList = []
this.dialogTitle = this.$t("panel.add_app_category");
this.templateEditForm = {
name: "",
nodeType: "folder",
templateType: this.currentTemplateType,
icon: "",
level: 0,
pid: 0,
};
@ -282,26 +345,28 @@ export default {
},
saveTemplateEdit(templateEditForm) {
this.$refs["templateEditForm"].validate((valid) => {
if (valid) {
save(templateEditForm).then((response) => {
this.close();
this.openMessageSuccess(
`system_parameter_setting.${
this.templateEditForm.id
? "rename_succeeded"
: "added_successfully"
}`
);
this.getTree();
});
} else {
return false;
}
if (valid) {
const method = templateEditForm.id ? update : save
method(templateEditForm).then((response) => {
this.close();
this.openMessageSuccess(
`system_parameter_setting.${
this.templateEditForm.id
? "rename_succeeded"
: "added_successfully"
}`
);
this.getTree();
});
} else {
return false;
}
});
},
close() {
this.$refs["templateEditForm"].resetFields();
this.editTemplate = false;
this.handleRemove()
},
getTree() {
const request = {
@ -338,9 +403,26 @@ export default {
this.templateDialog.visible = false;
},
templateImport(pid) {
this.templateOptType='new';
this.currentAppTemplateInfo = null;
this.templateDialog.visible = true;
this.templateDialog.pid = pid;
},
handleRemove(file, fileList) {
this.uploadDisabled = false
this.templateEditForm.icon = null
this.fileList = []
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
upload(file) {
const _this = this
uploadFileResult(file.file, (fileUrl) => {
_this.templateEditForm.icon = fileUrl
})
}
},
};
</script>
@ -399,7 +481,8 @@ export default {
}
}
}
::v-deep .container-wrapper{
padding: 0px!important;
::v-deep .container-wrapper {
padding: 0px !important;
}
</style>

View File

@ -0,0 +1,102 @@
<template>
<div class="testcase-template">
<div class="template-img" :style="classBackground" @click.stop="appPreview" />
</div>
</template>
<script>
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'AppTemplateItem',
props: {
template: {
type: Object,
default() {
return {}
}
},
baseUrl: {
type: String
},
width: {
type: Number
}
},
data() {
return {
}
},
computed: {
classBackground() {
return {
width: this.width + 'px',
height: this.width * 0.58 + 'px',
background: `url(${imgUrlTrans(this.template.icon)}) no-repeat`,
'background-size': `100% 100%`
}
}
},
methods: {
appPreview() {
this.$emit('appPreview', this.template)
}
}
}
</script>
<style scoped>
.testcase-template {
position: relative;
display: inline-block;
margin: 0;
box-shadow: 0 0 2px 0 rgba(31,31,31,0.15), 0 1px 2px 0 rgba(31,31,31,0.15);
border: solid 2px #fff;
box-sizing: border-box;
border-radius: 4px;
width: 100%;
}
.demonstration {
display: block;
font-size: 16px;
text-align: left;
margin-left: 12px;
margin-top: 12px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
color: var(--TextPrimary, #1F2329);
}
.template-img {
background-size: 100% 100%;
margin: 0 auto;
border: solid 2px #fff;
box-sizing: border-box;
}
.template-img:hover {
border: solid 1px #4b8fdf;
border-radius: 4px;
color: deepskyblue;
cursor: pointer;
}
.testcase-template:hover ::v-deep .template-button{
display: inline;
}
.template-button {
display: none;
text-align: center;
position:absolute;
bottom: 5px;
left: 0px;
width: 100%;
}
.bottom-area{
height: 75px;
}
</style>

View File

@ -0,0 +1,503 @@
<template>
<el-row class="preview-outer-body market-main" v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-row style="position: absolute;left: 5px;top: 5px">
<span class="icon iconfont icon-close icon20 insert" @click="closePreview()" />
</el-row>
<el-row>
<el-col span="12">
<span class="title-left">{{currentApp.name}}</span>
</el-col>
</el-row>
<el-row v-if="currentTemplateShowList&&currentTemplateShowList.length>0" class="template-main-preview">
<el-row class="preview-slider">
<el-row class="top-list" :style="topSlideStyle">
<template-market-preview-item
v-for="(templateItem) in currentTemplateShowList"
:key="templateItem.id"
:template="templateItem"
:active="active(templateItem)"
@previewTemplate="previewTemplate"
/>
<el-row v-show="!hasResult" class="custom-position">
<div style="text-align: center">
<svg-icon icon-class="no_result" style="font-size: 75px;margin-bottom: 16px" />
<br>
<span>{{ $t('commons.no_result') }}</span>
</div>
</el-row>
</el-row>
</el-row>
<el-row style="margin-top: 24px">
<app-template-log :app-template-id="curTemplate.id" :position="'templateLog'" @applyNew="applyNew" class="log-area"></app-template-log>
</el-row>
</el-row>
<el-row v-else class="template-main-preview">
<el-empty
:image="noneImg"
:description="$t('app_template.no_apps')"
></el-empty>
</el-row>
<el-dialog
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:title="$t('panel.apply_template')"
:visible.sync="applyNewVisible"
width="80%"
height="90vh"
top="5vh"
class="market-dialog-css"
append-to-body="true"
:destroy-on-close="true"
>
<el-row class="ds-from-main">
<DsForm :params="dsParams" v-if="applyNewVisible" :t-data="this.tData" :ds-types="dsTypes" :opt-type="'appApply'" :attach-params="attachParams"></DsForm>
</el-row>
</el-dialog>
</el-row>
</template>
<script>
import { searchAppTemplate, getCategories } from '@/api/appTemplateMarket'
import { groupTree } from '@/api/panel/panel'
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
import TemplateMarketPreviewItem from '@/views/panel/appTemplateMarket/component/TemplateMarketPreviewItem'
import AppTemplateLog from "@/views/panel/appTemplateMarket/log";
import {listDatasourceType} from "@/api/system/datasource";
import DsForm from "@/views/system/datasource/DsForm";
export default {
name: 'MarketPreview',
components: {DsForm, AppTemplateLog, TemplateMarketPreviewItem },
props: {
previewId: {
type: String,
default: null
},
currentApp: {
type: Object,
default: null
}
},
data() {
return {
noneImg: require('@/assets/None.png'),
dsParams:{},
attachParams:{},
tData: [],
dsTypes: [],
applyNewVisible: false,
hasResult: true,
extFilterActive: false,
asideActive: true,
previewVisible: false,
templatePreviewUrl: null,
marketTabs: null,
marketActiveTab: null,
searchText: null,
panelForm: {
name: null,
pid: null,
nodeType: 'panel',
templateUrl: null,
newFrom: 'new_market_template',
panelType: 'self',
panelStyle: JSON.stringify(DEFAULT_COMMON_CANVAS_STYLE_STRING),
panelData: '[]'
},
panelGroupList: [],
curApplyTemplate: null,
folderSelectShow: false,
baseUrl: 'https://dataease.io/templates',
currentTemplateShowList: [],
networkStatus: true,
curTemplate: {}
}
},
computed: {
topSlideStyle(){
return {
width: (275*this.currentTemplateShowList.length +50)+'px'
}
}
},
watch: {
marketActiveTab() {
this.initTemplateShow()
},
searchText() {
this.initTemplateShow()
},
previewId(val) {
const _this = this
_this.currentTemplateShowList.forEach(template => {
if (val === template.id) {
_this.previewTemplate(template)
}
})
}
},
mounted() {
this.initMarketTemplate()
this.getGroupTree()
this.datasourceTypes()
},
methods: {
datasourceTypes() {
listDatasourceType().then(res => {
this.dsTypes = res.data
})
},
applyNew(){
this.applyNewVisible = true
this.attachParams={
appTemplateId:this.curTemplate.id,
name:this.curTemplate.name,
}
},
initMarketTemplate() {
searchAppTemplate({pid:this.previewId}).then(rsp => {
this.currentTemplateShowList = rsp.data
if(rsp.data){
this.curTemplate=rsp.data[0]
}
this.hasResult = true
}).catch(() => {
this.networkStatus = false
})
},
getGroupTree() {
groupTree({ nodeType: 'folder' }).then(res => {
this.panelGroupList = res.data
})
},
normalizer(node) {
// children=null
if (node.children === null || node.children === 'null') {
delete node.children
}
},
appTemplately(template) {
this.$emit('appTemplately', template)
},
closeDialog() {
this.$emit('closeDialog')
},
handleClick(item) {
},
initTemplateShow() {
this.hasResult = false
this.currentTemplateShowList.forEach(template => {
template.showFlag = this.templateShow(template)
if (template.showFlag) {
this.hasResult = true
}
})
},
templateShow(templateItem) {
let categoryMarch = false
let searchMarch = false
templateItem.categories.forEach(category => {
if (category.name === this.marketActiveTab) {
categoryMarch = true
}
})
if (!this.searchText || templateItem.title.indexOf(this.searchText) > -1) {
searchMarch = true
}
return categoryMarch && searchMarch
},
previewTemplate(template) {
this.curTemplate = template
if (template.thumbnail.indexOf('http') > -1) {
this.templatePreviewUrl = template.thumbnail
} else {
this.templatePreviewUrl = this.baseUrl + template.thumbnail
}
},
asideActiveChange(prop) {
this.asideActive = prop
},
extFilterActiveChange() {
this.extFilterActive = !this.extFilterActive
this.marketActiveTab = this.marketTabs[0]
},
closePreview() {
this.$emit('closePreview')
},
active(template) {
return this.curTemplate && this.curTemplate.id === template.id
}
}
}
</script>
<style lang="scss" scoped>
.top-list {
display:inline-block !important;
height: 210px;
}
.aside-list-filter-active {
height: calc(100vh - 250px);
}
.template-main-preview {
margin-top: 12px;
border-radius: 4px;
box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.15), 0 1px 2px 0 rgba(31, 31, 31, 0.15);
border: solid 2px #fff;
padding: 24px;
min-height: calc(100vh - 147px);
background-color: var(--ContentBG,#ffffff);
}
.preview-slider{
width: calc(100% - 24px);
overflow-x: auto;
overflow-y: hidden;
}
.market-main {
padding: 24px
}
.title-left {
float: left;
font-size: 20px;
font-weight: 500;
line-height: 28px;
}
.title-right {
float: right;
width: 320px;
}
.dialog-footer-self {
text-align: center;
}
.search-button-self {
text-align: left;
padding-left: 10px;
}
.topbar-icon-active {
cursor: pointer;
transition: .1s;
border-radius: 3px;
font-size: 22px;
background-color: rgb(245, 245, 245);
&:active {
color: #000;
border-color: #3a8ee6;
background-color: red;
outline: 0;
}
&:hover {
background-color: rgba(31, 35, 41, 0.1);
color: #3a8ee6;
}
}
.custom-position {
height: 70vh;
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
flex-flow: row nowrap;
color: #646A73;
font-weight: 400;
}
.aside-active {
width: 206px;
height: calc(100vh - 56px);
overflow-x: hidden;
overflow-y: auto;
background-color: var(--ContentBG,#ffffff);
}
.aside-inActive{
position: relative;
width: 0px;
}
.main-area-active {
width: calc(100% - 206px)!important;
}
.main-area {
width: 100%;
padding:24px;
text-align: center;
height: calc(100vh - 56px);
transition: 0.5s;
}
.title-name-search {
width: 140px;
float: left;
}
.icon20 {
font-size: 20px !important;
}
.main-title {
margin-left: 8px;
font-weight: 500;
font-size: 16px;
line-height: 24px;
color: var(--TextPrimary, #1F2329);
}
.insert-filter {
display: inline-block;
font-weight: 400 !important;
font-family: PingFang SC;
line-height: 1;
white-space: nowrap;
cursor: pointer;
color: var(--TextPrimary, #1F2329);
-webkit-appearance: none;
text-align: center;
box-sizing: border-box;
outline: 0;
margin: 0;
transition: .1s;
border-radius: 3px;
&:active {
color: #000;
border-color: #3a8ee6;
background-color: red;
outline: 0;
}
&:hover {
background-color: rgba(31, 35, 41, 0.1);
color: #3a8ee6;
}
}
.insert {
display: inline-block;
font-weight: 400 !important;
font-family: PingFang SC;
line-height: 1;
white-space: nowrap;
cursor: pointer;
color: #646A73;
-webkit-appearance: none;
text-align: center;
box-sizing: border-box;
outline: 0;
margin: 0;
transition: .1s;
border-radius: 3px;
&:active {
color: #000;
border-color: #3a8ee6;
background-color: red;
outline: 0;
}
&:hover {
background-color: rgba(31, 35, 41, 0.1);
color: #3a8ee6;
}
}
.template-title{
float: left;
font-weight: 500;
font-size: 20px;
line-height: 28px;
margin-bottom: 24px;
color: var(--TextPrimary, #1F2329);
}
.margin-top16 {
margin-top: 16px;
}
.img-main{
border-radius: 4px;
background: #0F1114;
overflow-x: auto;
overflow-y: hidden;
height: calc(100% - 50px)!important;
}
.open-button{
cursor: pointer;
font-size: 30px;
position: absolute;
left: 0;
top: 16px;
z-index: 2;
}
.open-button:hover{
color: #3a8ee6;
}
.filter-icon-span{
float: left;
border: 1px solid #DCDFE6;
width: 32px;
height: 32px;
border-radius: 4px;
padding: 7px;
margin-left: 8px;
}
.filter-icon-active{
border: 1px solid #3370FF;
color: #3370FF;
}
.filter-icon-active{
border: 1px solid #3370FF;
color: #3370FF;
}
.search-area{
width: 100%;
position: relative;
}
.preview-outer-body{
width: 100%;
height: calc(100vh - 56px);
background-color: var(--MainBG,#f5f6f7);
}
.market-main{
padding:24px
}
.title-left{
float: left;
font-size: 20px;
font-weight: 500;
line-height: 28px;
color: var(--TextPrimary, #1F2329);
}
.log-area{
height: calc(100vh - 420px);
}
.ds-from-main {
overflow-y: auto;
overflow-x: hidden;
border-radius: 4px;
box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.15), 0 1px 2px 0 rgba(31, 31, 31, 0.15);
border: solid 2px #fff;
height: 77vh;
background-color: var(--ContentBG,#ffffff);
}
</style>

View File

@ -0,0 +1,122 @@
<template>
<div class="testcase-template">
<div class="template-img" :style="classBackground" @click.stop="templatePreview" />
<el-row class="bottom-area">
<el-row>
<span class="demonstration">{{ template.title }}</span>
</el-row>
</el-row>
<el-row class="template-button">
<el-button size="mini" style="width: 141px" @click="templatePreview">{{ $t('panel.preview') }}</el-button>
<el-button size="mini" style="width: 141px" type="primary" @click="apply">{{ $t('panel.apply') }}</el-button>
</el-row>
</div>
</template>
<script>
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'TemplateMarketItem',
props: {
template: {
type: Object,
default() {
return {}
}
},
baseUrl: {
type: String
},
width: {
type: Number
}
},
data() {
return {
}
},
computed: {
classBackground() {
return {
width: this.width + 'px',
height: this.width * 0.58 + 'px',
background: `url(${this.template.snapshot}) no-repeat`,
'background-size': `100% 100%`
}
}
},
methods: {
init(){
},
handleDelete() {
},
apply() {
this.$emit('templateApply', this.template)
},
templatePreview() {
this.$emit('templatePreview', this.template.id)
}
}
}
</script>
<style scoped>
.testcase-template {
position: relative;
display: inline-block;
margin: 0;
box-shadow: 0 0 2px 0 rgba(31,31,31,0.15), 0 1px 2px 0 rgba(31,31,31,0.15);
border: solid 2px #fff;
box-sizing: border-box;
border-radius: 4px;
width: 100%;
}
.demonstration {
display: block;
font-size: 16px;
text-align: left;
margin-left: 12px;
margin-top: 12px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
color: var(--TextPrimary, #1F2329);
}
.template-img {
background-size: 100% 100%;
margin: 0 auto;
border: solid 2px #fff;
box-sizing: border-box;
}
.template-img:hover {
border: solid 1px #4b8fdf;
border-radius: 4px;
color: deepskyblue;
cursor: pointer;
}
.testcase-template:hover ::v-deep .template-button{
display: inline;
}
.template-button {
display: none;
text-align: center;
position:absolute;
bottom: 5px;
left: 0px;
width: 100%;
}
.bottom-area{
height: 75px;
}
</style>

View File

@ -0,0 +1,104 @@
<template>
<div
:class="[
{
['template-item-main-active']: active
},
'template-item-main'
]"
@click.stop="previewTemplate"
>
<div class="template-item-img" :style="classBackground" />
<span class="demonstration">{{ template.name }}</span>
</div>
</template>
<script>
export default {
name: 'TemplateMarketPreviewItem',
props: {
template: {
type: Object,
default() {
return {}
}
},
active: {
type: Boolean,
required: false,
default: false
}
},
data() {
return {
}
},
computed: {
classBackground() {
return {
background: `url(${this.template.snapshot}) no-repeat`,
'background-size': `100% 100%`
}
}
},
methods: {
previewTemplate() {
this.$emit('previewTemplate', this.template)
}
}
}
</script>
<style scoped>
.template-item-main {
margin: 0 24px 0 0;
float: left;
position: relative;
box-sizing: border-box;
width: 250px;
height: 180px;
background-color: var(--ContentBG,#ffffff);
border: 1px solid #DEE0E3 ;
border-radius: 4px;
flex: none;
order: 0;
flex-grow: 0;
cursor: pointer;
overflow: hidden;
}
.template-item-main-active{
border: 2px solid #3370FF!important; ;
}
.template-item-img{
position: absolute;
width: 248px;
height: 138px;
left: 0px;
top: 0px;
}
.demonstration {
position: absolute;
width: 166px;
height: 20px;
left: 8px;
top: 148px;
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 20px;
display: block;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.template-item-main:hover {
border: solid 1px #3370FF;
}
</style>

View File

@ -0,0 +1,332 @@
<template>
<el-row class="outer-body">
<!--预览模式-->
<MarketPreview v-if="previewModel" :preview-id="templatePreviewId" :current-app="currentApp" @closePreview="previewModel=false" @templateApply="templateApply" />
<!--列表模式-->
<el-row v-show="!previewModel" class="market-main">
<el-row>
<el-col span="12">
<span class="title-left">{{$t('app_template.app_manager')}}</span>
</el-col>
</el-row>
<el-row>
<el-tabs v-model="marketActiveTab" @tab-click="handleClick">
<el-tab-pane v-for="(tabItem,index) in marketTabs" :key="index" :label="tabItem.label" :name="tabItem.name" />
</el-tabs>
</el-row>
<el-row v-show="marketActiveTab==='apps'">
<el-row v-show="hasResult" id="template-main" v-loading="$store.getters.loadingMap[$store.getters.currentPath]" class="template-main">
<el-col
v-for="(templateItem) in currentAppShowList"
:key="templateItem.id"
style="text-align: center;padding: 24px 12px 0 12px"
:style="{width: templateSpan}"
>
<app-template-item
:template="templateItem"
:base-url="baseUrl"
:width="templateCurWidth"
@appPreview="appPreview"
/>
</el-col>
</el-row>
<el-row v-show="!hasResult" class="custom-position template-main">
<div style="text-align: center">
<svg-icon icon-class="no_result" style="font-size: 75px;margin-bottom: 16px" />
<br>
<span>{{ $t('commons.no_result') }}</span>
</div>
</el-row>
</el-row>
<el-row v-show="marketActiveTab==='apply_logs'" class="main-log-area template-main">
<app-template-log class="log-area"></app-template-log>
</el-row>
</el-row>
<el-dialog
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:title="$t('panel.apply_template')"
:visible.sync="folderSelectShow"
width="80%"
top="5vh"
class="market-dialog-css"
append-to-body="true"
:destroy-on-close="true"
>
<el-form ref="panelForm" :model="panelForm" :rules="rule" label-width="80px">
<el-form-item :label="$t('panel.name')" prop="name">
<el-input v-model="panelForm.name" :clearable="true" :placeholder="$t('panel.enter_name_tips')" />
</el-form-item>
<el-form-item :label="$t('commons.folder')" prop="pid">
<treeselect
v-model="panelForm.pid"
:clearable="false"
:options="panelGroupList"
:normalizer="normalizer"
:placeholder="$t('chart.select_group')"
:no-children-text="$t('commons.treeselect.no_children_text')"
:no-options-text="$t('commons.treeselect.no_options_text')"
:no-results-text="$t('commons.treeselect.no_results_text')"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer dialog-footer-self">
<el-button size="mini" @click="folderSelectShow=false">{{ $t('commons.cancel') }}</el-button>
<el-button size="mini" type="primary" :disabled="!panelForm.name || !panelForm.pid" @click="apply">{{ $t('commons.confirm') }}</el-button>
</div>
</el-dialog>
</el-row>
</template>
<script>
import { searchAppTemplate, getCategories } from '@/api/appTemplateMarket'
import TemplateMarketItem from '@/views/panel/appTemplateMarket/component/TemplateMarketItem'
import { groupTree, panelSave } from '@/api/panel/panel'
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
import MarketPreview from '@/views/panel/appTemplateMarket/component/MarketPreview'
import elementResizeDetectorMaker from 'element-resize-detector'
import AppTemplateItem from "@/views/panel/appTemplateMarket/component/AppTemplateItem";
import AppTemplateLog from "@/views/panel/appTemplateMarket/log";
export default {
name: 'appTemplateMarket',
components: {AppTemplateLog, AppTemplateItem, MarketPreview, TemplateMarketItem },
data() {
return {
hasResult: true,
templateMiniWidth: 330,
templateCurWidth: 310,
templateSpan: '25%',
previewModel: false,
previewVisible: false,
templatePreviewId: '',
currentApp:null,
marketTabs: [{label:'Apps',name:'apps'},{label:this.$t('app_template.apply_logs'),name:'apply_logs'}],
marketActiveTab: 'apps',
searchText: null,
panelForm: {
name: null,
pid: null,
nodeType: 'panel',
templateUrl: null,
newFrom: 'new_market_template',
panelType: 'self',
panelStyle: JSON.stringify(DEFAULT_COMMON_CANVAS_STYLE_STRING),
panelData: '[]'
},
panelGroupList: [],
curApplyTemplate: null,
folderSelectShow: false,
baseUrl: 'https://dataease.io/templates',
currentAppShowList: [],
networkStatus: true,
rule: {
name: [
{
required: true,
message: this.$t('panel.template_name_tips'),
trigger: 'blur'
}
],
pid: [
{
required: true,
message: '',
trigger: 'blur'
}
]
}
}
},
computed: {
},
watch: {
},
mounted() {
this.initMarketTemplate()
this.getGroupTree()
const _this = this
const erd = elementResizeDetectorMaker()
const templateMainDom = document.getElementById('template-main')
// div
erd.listenTo(templateMainDom, element => {
_this.$nextTick(() => {
const curSeparator = Math.trunc(templateMainDom.offsetWidth / _this.templateMiniWidth)
_this.templateSpan = (100 / Math.trunc(templateMainDom.offsetWidth / _this.templateMiniWidth)) + '%'
_this.templateCurWidth = Math.trunc(templateMainDom.offsetWidth / curSeparator) - 33
})
})
},
methods: {
initMarketTemplate() {
searchAppTemplate({nodeType:'folder'}).then(rsp => {
this.currentAppShowList = rsp.data
}).catch(() => {
this.networkStatus = false
})
},
getGroupTree() {
groupTree({ nodeType: 'folder' }).then(res => {
this.panelGroupList = res.data
})
},
normalizer(node) {
// children=null
if (node.children === null || node.children === 'null') {
delete node.children
}
},
templateApply(template) {
this.curApplyTemplate = template
this.panelForm.name = template.title
this.panelForm.templateUrl = this.baseUrl + template.metas.theme_repo
this.folderSelectShow = true
},
apply() {
if (this.panelForm.name.length > 50) {
this.$warning(this.$t('commons.char_can_not_more_50'))
return false
}
if (!this.panelForm.templateUrl) {
this.$warning('未获取模板下载链接请联系模板市场官方')
return false
}
panelSave(this.panelForm).then(response => {
this.$message({
message: this.$t('commons.save_success'),
type: 'success',
showClose: true
})
this.folderSelectShow = false
this.$router.push({ name: 'panel', params: response.data })
}).catch(() => {
this.loading = false
})
},
closeDialog() {
this.$emit('closeDialog')
},
handleClick(item) {
},
newPanel() {
},
appPreview(appTemplate){
this.templatePreviewId = appTemplate.id
this.currentApp = appTemplate
this.previewModel = true
}
}
}
</script>
<style lang="scss" scoped>
.template-main{
text-align: center;
border-radius: 4px;
padding: 0 12px 24px 12px;
height: calc(100vh - 190px)!important;
overflow-x: hidden;
overflow-y: auto;
background-color: var(--ContentBG,#ffffff);
}
.market-main{
padding:24px
}
.title-left{
float: left;
font-size: 20px;
font-weight: 500;
line-height: 28px;
color: var(--TextPrimary, #1F2329);
}
.title-right{
float: right;
width: 320px;
}
.dialog-footer-self{
text-align: right;
}
.search-button-self{
text-align: left;
padding-left: 10px;
}
.topbar-icon-active {
cursor: pointer;
transition: .1s;
border-radius: 3px;
font-size: 22px;
background-color: rgb(245, 245, 245);
&:active {
color: #000;
border-color: #3a8ee6;
background-color: red;
outline: 0;
}
&:hover {
background-color: rgba(31, 35, 41, 0.1);
color: #3a8ee6;
}
}
.custom-position {
height: 80vh;
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
flex-flow: row nowrap;
color: #646A73;
font-weight: 400;
}
.outer-body{
width: 100%;
height: calc(100vh - 56px);
background-color: var(--MainBG,#f5f6f7);
}
.market-dialog-css{
::v-deep .el-form-item__label {
width: 100% !important;
text-align: left;
}
::v-deep
.el-form-item.is-required:not(.is-no-asterisk)
> .el-form-item__label:before {
display: none;
}
::v-deep
.el-form-item.is-required:not(.is-no-asterisk)
> .el-form-item__label::after {
content: "*";
color: #f54a45;
margin-left: 2px;
}
::v-deep .el-form-item__content {
margin-left: 0 !important;
}
::v-deep .vue-treeselect__input{
vertical-align:middle;
}
}
.main-log-area{
position: relative;
padding: 24px;
}
.log-area{
height: calc(100vh - 240px);
}
</style>

View File

@ -0,0 +1,107 @@
<template>
<el-drawer
:title="$t('user.filter_method')"
:visible.sync="userDrawer"
custom-class="user-drawer-task"
size="680px"
v-closePress
direction="rtl"
>
<div class="el-drawer__body-cont">
<div class="filter">
<span>{{ $t("dedaterange.label") }}</span>
<div class="filter-item">
<DeDatePick v-model="dataRange"></DeDatePick>
</div>
</div>
</div>
<div class="foot">
<el-button class="btn normal" @click="reset">{{
$t("commons.reset")
}}</el-button>
<el-button type="primary" class="btn" @click="search">{{
$t("commons.adv_search.search")
}}</el-button>
</div>
</el-drawer>
</template>
<script>
import { dateFormat } from "@/views/system/task/options.js";
import { opTypes } from "@/api/system/log";
import { post } from "@/api/dataset/dataset";
import DeDatePick from '@/components/deCustomCm/deDatePick.vue'
export default {
components: {
DeDatePick
},
data() {
return {
types: [],
treeLoading: false,
filterTextMap: [],
dataRange: [],
activeType: [],
userDrawer: false,
};
},
computed: {
},
mounted() {
},
methods: {
clearFilter() {
this.dataRange = [];
this.$emit("search", [], []);
},
clearOneFilter(index) {
(this.filterTextMap[index] || []).forEach((ele) => {
this[ele] = [];
});
},
search() {
this.userDrawer = false;
this.$emit("search", this.formatCondition(), this.formatText());
},
formatText() {
this.filterTextMap = [];
const params = [];
if (this.dataRange.length) {
params.push(
`${this.$t("dedaterange.label")}:${this.dataRange
.map((ele) => {
return dateFormat("YYYY-mm-dd", ele);
})
.join("-")}`
);
this.filterTextMap.push(["dataRange"]);
}
return params;
},
formatCondition() {
const fildMap = {
};
const conditions = [];
let [min, max] = this.dataRange;
if (min && max) {
if (+min === +max) {
max = +max + 24 * 3600 * 1000;
}
conditions.push({
field: "apply_time",
operator: "between",
value: [+min, +max],
});
}
return conditions;
},
init() {
this.userDrawer = true;
},
reset() {
this.clearFilter();
this.userDrawer = false;
},
},
};
</script>

View File

@ -0,0 +1,392 @@
<template>
<el-row style="text-align: left">
<el-row class="top-operate">
<el-col :span="12">
<el-button v-show="position==='templateLog'"
class="btn"
type="primary"
icon="el-icon-plus"
@click="applyNew()"
>{{$t('commons.create')}}</el-button>
<span>&nbsp;</span>
</el-col>
<el-col :span="12" class="right-user">
<el-input
:placeholder="$t('app_template.search_by_keyword')"
prefix-icon="el-icon-search"
class="name-email-search"
size="small"
clearable
ref="search"
v-model="nikeName"
@blur="initSearch"
@clear="initSearch"
>
</el-input>
<deBtn
:secondary="!cacheCondition.length"
:plain="!!cacheCondition.length"
icon="iconfont icon-icon-filter"
@click="filterShow"
>{{ $t("user.filter")
}}<template v-if="filterTexts.length">
({{ cacheCondition.length }})
</template>
</deBtn>
</el-col>
</el-row>
<div class="filter-texts" v-if="filterTexts.length">
<span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{ $t("user.result_one") }}</span>
<el-divider direction="vertical"></el-divider>
<i
@click="scrollPre"
v-if="showScroll"
class="el-icon-arrow-left arrow-filter"
></i>
<div class="filter-texts-container">
<p class="text" v-for="(ele, index) in filterTexts" :key="ele">
{{ ele }} <i @click="clearOneFilter(index)" class="el-icon-close"></i>
</p>
</div>
<i
@click="scrollNext"
v-if="showScroll"
class="el-icon-arrow-right arrow-filter"
></i>
<el-button
type="text"
class="clear-btn"
icon="el-icon-delete"
@click="clearFilter"
>{{ $t("user.clear_filter") }}</el-button
>
</div>
<div
class="table-container"
id="resize-for-filter"
:class="[filterTexts.length ? 'table-container-filter' : '']"
>
<grid-table
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:tableData="data"
:columns="[]"
:pagination="paginationConfig"
@sort-change="sortChange"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<el-table-column
show-overflow-tooltip
prop="opType"
:label="'数据源'"
>
<template v-slot:default="{ row }">
<span>{{ row.datasourceName }}</span>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="datasetGroupName"
:label="'数据集分组'"
/>
<el-table-column
show-overflow-tooltip
prop="panelName"
:label="'仪表板'"
/>
<el-table-column
show-overflow-tooltip
prop="appName"
:label="'APPS'"
/>
<el-table-column
show-overflow-tooltip
prop="applyTime"
sortable="custom"
:label="'应用时间'"
>
<template v-slot:default="scope">
<span>{{ scope.row.applyTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</grid-table>
</div>
<keep-alive>
<filterUser ref="filterUser" @search="filterDraw"></filterUser>
</keep-alive>
</el-row>
</template>
<script>
import DeLayoutContent from "@/components/business/DeLayoutContent";
import GridTable from "@/components/gridTable/index.vue";
import filterUser from './filterUser';
import _ from 'lodash';
import keyEnter from '@/components/msgCfm/keyEnter.js'
import {
addOrder,
formatOrders,
} from "@/utils/index";
import { logGrid } from "@/api/appTemplateMarket/log";
export default {
name: 'AppTemplateLog',
components: { GridTable, DeLayoutContent, filterUser },
mixins: [keyEnter],
props: {
appTemplateId: {
type: String,
required: false
},
position: {
type: String,
required: true,
default: 'allLog'
}
},
data() {
return {
columns: [],
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0,
},
data: [],
orderConditions: [],
nikeName: "",
showScroll: false,
filterTexts: [],
cacheCondition: [],
};
},
watch: {
filterTexts: {
handler() {
this.getScrollStatus();
},
deep: true,
},
appTemplateId:{
handler() {
this.search()
},
}
},
mounted() {
this.search();
this.resizeObserver();
},
methods: {
applyNew(){
this.$emit('applyNew')
},
sortChange({ column, prop, order }) {
this.orderConditions = [];
if (!order) {
this.initSearch();
return;
}
this.orderConditions = [];
addOrder({ field: prop, value: order }, this.orderConditions);
this.initSearch();
},
getScrollStatus() {
this.$nextTick(() => {
const dom = document.querySelector(".filter-texts-container");
this.showScroll = dom && dom.scrollWidth > dom.offsetWidth;
});
},
resizeObserver() {
this.resizeForFilter = new ResizeObserver((entries) => {
if (!this.filterTexts.length) return;
this.layoutResize();
});
this.resizeForFilter.observe(
document.querySelector("#resize-for-filter")
);
},
layoutResize: _.debounce(function () {
this.getScrollStatus();
}, 200),
scrollPre() {
const dom = document.querySelector(".filter-texts-container");
dom.scrollLeft -= 10;
if (dom.scrollLeft <= 0) {
dom.scrollLeft = 0;
}
},
scrollNext() {
const dom = document.querySelector(".filter-texts-container");
dom.scrollLeft += 10;
const width = dom.scrollWidth - dom.offsetWidth;
if (dom.scrollLeft > width) {
dom.scrollLeft = width;
}
},
handleSizeChange(pageSize) {
this.paginationConfig.currentPage = 1;
this.paginationConfig.pageSize = pageSize;
this.search();
},
handleCurrentChange(currentPage) {
this.paginationConfig.currentPage = currentPage;
this.search();
},
initSearch() {
this.handleCurrentChange(1);
},
clearFilter() {
this.$refs.filterUser.clearFilter();
},
clearOneFilter(index) {
this.$refs.filterUser.clearOneFilter(index);
this.$refs.filterUser.search();
},
filterDraw(condition, filterTexts = []) {
this.cacheCondition = condition;
this.filterTexts = filterTexts;
this.initSearch();
},
filterShow() {
this.$refs.filterUser.init();
},
search() {
if(this.position==='templateLog'&&!this.appTemplateId){
return
}
const param = {
orders: formatOrders(this.orderConditions),
conditions: [...this.cacheCondition],
};
if (this.nikeName) {
param.keyWord = this.nikeName;
}
if(this.appTemplateId){
param.conditions.push({
field: "app_template_id",
operator: "eq",
value: this.appTemplateId,
})
}
const { currentPage, pageSize } = this.paginationConfig;
logGrid(currentPage, pageSize, param).then((response) => {
this.data = response.data.listObject;
this.paginationConfig.total = response.data.itemCount;
});
},
},
};
</script>
<style lang="scss" scoped>
.table-container {
height: calc(100% - 50px);
}
.table-container-filter {
height: calc(100% - 110px);
}
.filter-texts {
display: flex;
align-items: center;
margin: 17px 0;
font-family: "PingFang SC";
font-weight: 400;
.sum {
color: #1f2329;
}
.title {
color: #999999;
margin-left: 8px;
}
.text {
max-width: 280px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 1px 22px 1px 6px;
display: inline-block;
align-items: center;
color: #0c296e;
font-size: 14px;
line-height: 22px;
background: rgba(51, 112, 255, 0.1);
border-radius: 2px;
margin: 0;
margin-right: 8px;
position: relative;
i {
position: absolute;
right: 2px;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
}
}
.clear-btn {
color: #646a73;
}
.clear-btn:hover {
color: #3370ff;
}
.filter-texts-container::-webkit-scrollbar {
display: none;
}
.arrow-filter {
font-size: 16px;
width: 24px;
height: 24px;
cursor: pointer;
color: #646a73;
display: flex;
justify-content: center;
align-items: center;
}
.arrow-filter:hover {
background: rgba(31, 35, 41, 0.1);
border-radius: 4px;
}
.el-icon-arrow-right.arrow-filter {
margin-left: 5px;
}
.el-icon-arrow-left.arrow-filter {
margin-right: 5px;
}
.filter-texts-container {
flex: 1;
overflow-x: auto;
white-space: nowrap;
height: 24px;
}
}
.top-operate {
margin-bottom: 16px;
.right-user {
text-align: right;
display: flex;
align-items: center;
justify-content: flex-end;
.de-button {
margin-left: 12px;
}
.el-input--medium .el-input__icon {
line-height: 32px;
}
}
.name-email-search {
width: 240px;
}
}
</style>

View File

@ -241,6 +241,11 @@ export default {
components: { GrantAuth, LinkGenerate, EditPanel, TreeSelector },
data() {
return {
responseSource:'panelQuery',
clearLocalStorage: [
'chart-tree',
'dataset-tree'
],
historyRequestId: null,
lastActiveNode: null, //
lastActiveNodeData: null,
@ -378,7 +383,11 @@ export default {
this.defaultTree(true)
this.initCache()
const routerParam = this.$router.currentRoute.params
if (routerParam && routerParam.nodeType === 'panel' && this.historyRequestId !== routerParam.requestId) {
if(routerParam && 'appApply'===routerParam.responseSource ){
this.responseSource = routerParam.responseSource
this.lastActiveNode = routerParam
this.tree()
}else if (routerParam && routerParam.nodeType === 'panel' && this.historyRequestId !== routerParam.requestId) {
this.historyRequestId = routerParam.requestId
this.tree()
this.edit(routerParam, null)
@ -387,6 +396,13 @@ export default {
}
},
methods: {
fromAppActive(){
this.activeNodeAndClickOnly(this.lastActiveNode)
this.clearLocalStorage.forEach(item => {
localStorage.removeItem(item)
})
this.responseSource='panelQuery'
},
newPanelFromMarket(panelInfo) {
if (panelInfo) {
this.tree()
@ -637,6 +653,9 @@ export default {
if (!userCache) {
this.tData = res.data
}
if(this.responseSource==='appApply'){
this.fromAppActive()
}
if (this.filterText) {
this.$nextTick(() => {
this.$refs.panel_list_tree.filter(this.filterText)

View File

@ -1,13 +1,60 @@
<template>
<layout-content :header="formType=='add' ? $t('datasource.create') : $t('datasource.modify')">
<template v-slot:header>
<layout-content :header="headName">
<template v-if="!optType" v-slot:header>
<el-icon name="back" class="back-button" @click.native="backToList" />
{{
params && params.id && params.showModel && params.showModel === 'show' && !canEdit ? $t('datasource.show_info') : formType == 'add' ? $t('datasource.create') : $t('datasource.modify')
}}
</template>
<div>
<template v-if="optType==='appApply'">
<span>模板信息</span>
</template>
<div v-if="optType==='appApply'">
<el-form
ref="attachParamsForm"
:model="attachForm"
:rules="rule"
size="small"
label-width="180px"
label-position="right"
>
<el-form-item :label="'仪表板位置'" prop="panelId">
<treeselect
v-model="attachForm.panelId"
:clearable="false"
:options="panelGroupList"
:normalizer="normalizer"
:placeholder="$t('chart.select_group')"
:no-children-text="$t('commons.treeselect.no_children_text')"
:no-options-text="$t('commons.treeselect.no_options_text')"
:no-results-text="$t('commons.treeselect.no_results_text')"
/>
</el-form-item>
<el-form-item :label="'仪表板名称'" prop="panelName">
<el-input v-model="attachForm.panelName" />
</el-form-item>
<el-form-item :label="'数据集位置'" prop="desc">
<treeselect
v-model="attachForm.datasetGroupId"
:clearable="false"
:options="datasetGroupList"
:normalizer="normalizer"
:placeholder="$t('chart.select_group')"
:no-children-text="$t('commons.treeselect.no_children_text')"
:no-options-text="$t('commons.treeselect.no_options_text')"
:no-results-text="$t('commons.treeselect.no_results_text')"
/>
</el-form-item>
<el-form-item :label="'数据集分组名称'" prop="datasetGroupName">
<el-input v-model="attachForm.datasetGroupName" />
</el-form-item>
</el-form>
</div>
<template v-if="optType==='appApply'">
<span>数据源信息</span>
</template>
<div>
<el-form
ref="dsForm"
:model="form"
@ -111,6 +158,10 @@ import i18n from '@/lang/index'
import ApiHttpRequestForm from '@/views/system/datasource/ApiHttpRequestForm'
import DsConfiguration from '@/views/system/datasource/DsConfiguration'
import PluginCom from '@/views/system/plugin/PluginCom'
import {groupTree,appApply} from "@/api/panel/panel";
import { dsGroupTree } from '@/api/dataset/dataset'
import { deepCopy } from '@/components/canvas/utils/utils'
export default {
name: 'DsForm',
@ -132,11 +183,32 @@ export default {
dsTypes: {
type: Array,
default: null
},
attachParams: {
type: Object,
default: null
},
optType:{
type: String,
default: null
}
},
data() {
return {
disabled: false,
attachRule: {
datasetGroupId: [{ required: true, message: i18n.t('chart.select_group'), trigger: 'blur' }],
panelId: [{ required: true, message: i18n.t('chart.select_group'), trigger: 'blur' }]
},
panelGroupList: [],
datasetGroupList: [],
attachForm:{
appTemplateId:'',
panelId:'',
panelName:'',
datasetGroupId:'0',
datasetGroupName: ''
},
form: {
configuration: {
initialPoolSize: 5,
@ -268,7 +340,18 @@ export default {
driverList: []
}
},
computed: {
headName() {
if(this.optType==='appApply'){
return ''
}else if(this.formType==='add'){
return this.$t('datasource.create')
}else{
return this.$t('datasource.modify')
}
}
},
created() {
if (this.params && this.params.id) {
const row = this.params
@ -284,8 +367,42 @@ export default {
this.disabled = this.params && this.params.id && this.params.showModel && this.params.showModel === 'show' && !this.canEdit
},
mounted() {
if(this.optType==='appApply'){
this.getPanelGroupTree()
this.getDatasetGroupTree()
this.attachForm.appTemplateId = this.attachParams.appTemplateId
this.attachForm.panelName = this.attachParams.name
this.attachForm.datasetGroupName = this.attachParams.name
}
},
methods: {
normalizer(node) {
// children=null
if (node.children === null || node.children === 'null') {
delete node.children
}
},
getDatasetGroupTree() {
dsGroupTree({nodeType: 'group',}).then(res => {
this.datasetGroupList = [{
id: '0',
name: this.$t('dataset.dataset_group'),
label: this.$t('dataset.dataset_group'),
pid: '0',
privileges: 'grant,manage,use',
type: 'group',
children: res.data
}]
})
},
getPanelGroupTree() {
groupTree({ nodeType: 'folder' }).then(res => {
this.panelGroupList = res.data
if(this.panelGroupList && this.panelGroupList.length>0){
this.attachForm.panelId =this.panelGroupList[0].id
}
})
},
setType() {
this.form.type = this.params.type
this.form.configuration = {
@ -437,6 +554,15 @@ export default {
return
}
if(this.optType==='appApply'){
this.$refs.attachParamsForm.validate(valid => {
if (!valid) {
return false
}
}
)
}
this.$refs.dsForm.validate(valid => {
if (!valid) {
return false
@ -456,6 +582,18 @@ export default {
form.configuration = JSON.stringify(form.configuration)
}
if(this.optType==='appApply'){
const appApplyForm = {
...this.attachForm,
datasourceList:[deepCopy(form)]
}
appApply(appApplyForm).then(res => {
this.$success(i18n.t('commons.save_success'))
this.$router.push({ name: 'panel', params: res.data })
})
return
}
if (this.formType === 'modify' && this.originConfiguration !== form.configuration) {
if (repeat) {
$confirm(i18n.t('datasource.repeat_datasource_msg') + '[' + repeatDsName.join(',') + '], ' + i18n.t('datasource.confirm_save'), () => {