Merge branch 'dev' into pr@dev@feat_global_map_setting

This commit is contained in:
fit2cloud-chenyw 2022-07-21 13:43:01 +08:00 committed by GitHub
commit 0d44ec8b74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 3039 additions and 215 deletions

View File

@ -41,6 +41,9 @@ public class PanelConstants {
// 外部模板新建
public static final String NEW_OUTER_TEMPLATE = "new_outer_template";
// 模板市场新建
public static final String NEW_MARKET_TEMPLATE = "new_market_template";
}
//仪表板类型

View File

@ -111,7 +111,9 @@ public interface ParamConstants {
FRONT_TIME_OUT("basic.frontTimeOut"),
MSG_TIME_OUT("basic.msgTimeOut"),
DEFAULT_LOGIN_TYPE("basic.loginType"),
OPEN_HOME_PAGE("ui.openHomePage");
OPEN_HOME_PAGE("ui.openHomePage"),
TEMPLATE_MARKET_ULR("basic.templateMarketUlr"),
TEMPLATE_ACCESS_KEY("basic.templateAccessKey");
private String value;

View File

@ -64,7 +64,6 @@ public class HttpClientUtil {
throw new RuntimeException("HttpClient构建失败", e);
}
}
/**
* Get http请求
*

View File

@ -4,6 +4,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
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.plugins.common.base.domain.PanelGroup;
import io.dataease.commons.constants.DePermissionType;
@ -17,6 +19,7 @@ import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.pentaho.di.core.util.UUIDUtil;
import springfox.documentation.annotations.ApiIgnore;
import org.apache.shiro.authz.annotation.Logical;
import org.springframework.web.bind.annotation.*;
@ -39,6 +42,8 @@ public class PanelGroupController {
@Resource
private PanelGroupService panelGroupService;
@Resource
private ExtAuthServiceImpl authService;
@ApiOperation("查询树")
@PostMapping("/tree")
@ -59,9 +64,15 @@ public class PanelGroupController {
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
}, logical = Logical.AND)
@I18n
public PanelGroup save(@RequestBody PanelGroupRequest request) throws Exception{
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception{
String panelId = panelGroupService.save(request);
return findOne(panelId);
PanelGroupDTO result = findOne(panelId);
// 如果新建来源来自模板市场在返回数据中加入父级ID便于跳转展开仪表板树
if(PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())){
result.setParents(authService.parentResource(panelId,"panel"));
result.setRequestId(UUIDUtil.getUUIDAsString());
}
return result;
}
@ApiOperation("更新")

View File

@ -1,7 +1,7 @@
package io.dataease.controller.request.datasource;
import com.google.gson.JsonObject;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import com.alibaba.fastjson.JSONObject;
import io.dataease.dto.dataset.DatasetTableFieldDTO;
import lombok.Data;
import java.util.ArrayList;
@ -14,9 +14,13 @@ public class ApiDefinition {
private String desc;
private String url;
private String method = "GET";
private List<DatasetTableField> fields;
private List<DatasetTableFieldDTO> fields;
private ApiDefinitionRequest request;
private String dataPath;
private String status;
private List<Map<String,String>> datas = new ArrayList<>();
private List<JSONObject> jsonFields = new ArrayList<>();
private int previewNum = 10;
private int maxPreviewNum = 10;
}

View File

@ -27,6 +27,8 @@ public class PanelGroupRequest extends PanelGroupDTO {
private String templateId;
@ApiModelProperty("静态文件")
private String staticResource;
@ApiModelProperty("模板链接")
private String templateUrl;
public PanelGroupRequest() {
}

View File

@ -0,0 +1,12 @@
package io.dataease.controller.request.templateMarket;
import io.dataease.dto.templateMarket.TemplateMarketDTO;
/**
* Author: wangjiahao
* Date: 2022/7/15
* Description:
*/
public class TemplateMarketSearchRequest extends TemplateMarketDTO {
}

View File

@ -16,5 +16,9 @@ public class BasicInfo implements Serializable {
private String openHomePage;
@ApiModelProperty("默认登录方式")
private Integer loginType = 0;
@ApiModelProperty("模板市场链接")
private String templateMarketUlr;
@ApiModelProperty("模板市场AccessKey")
private String templateAccessKey;
}

View File

@ -0,0 +1,44 @@
package io.dataease.controller.templateMarket;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.controller.request.templateMarket.TemplateMarketSearchRequest;
import io.dataease.dto.templateMarket.MarketBaseResponse;
import io.dataease.dto.templateMarket.TemplateMarketDTO;
import io.dataease.service.templateMarket.TemplateMarketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/7/15
* Description:
*/
@RestController
@Api(tags = "系统:模板市场")
@ApiSupport(order = 220)
@RequestMapping("/template/market")
public class TemplateMarketController {
@Resource
private TemplateMarketService marketService;
@ApiOperation("查询模板")
@PostMapping("/search")
private MarketBaseResponse searchTemplate(@RequestBody TemplateMarketSearchRequest request){
return marketService.searchTemplate(request);
}
@ApiOperation("查询分类")
@GetMapping("/categories")
private List<String> categories(){
return marketService.getCategories();
}
}

View File

@ -0,0 +1,9 @@
package io.dataease.dto.dataset;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import lombok.Data;
@Data
public class DatasetTableFieldDTO extends DatasetTableField {
private String jsonPath;
}

View File

@ -33,5 +33,8 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase<Pane
private List<PanelGroupDTO> children;
@ApiModelProperty("视图信息")
private List<Map<String, ChartViewDTO>> viewsInfo;
@ApiModelProperty("父级ID")
private List<String> parents;
@ApiModelProperty("请求ID")
private String requestId;
}

View File

@ -0,0 +1,20 @@
package io.dataease.dto.panel;
import io.dataease.plugins.common.base.domain.PanelTemplateWithBLOBs;
import lombok.Data;
/**
* Author: wangjiahao
* Date: 2022/7/14
* Description:
*/
@Data
public class PanelTemplateFileDTO extends PanelTemplateWithBLOBs {
private String panelStyle;
private String panelData;
private String staticResource;
}

View File

@ -0,0 +1,25 @@
package io.dataease.dto.templateMarket;
import lombok.Data;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/7/15
* Description:
*/
@Data
public class MarketBaseResponse {
private String baseUrl;
private List<TemplateMarketDTO> contents;
public MarketBaseResponse() {
}
public MarketBaseResponse(String baseUrl, List<TemplateMarketDTO> contents) {
this.baseUrl = baseUrl;
this.contents = contents;
}
}

View File

@ -0,0 +1,15 @@
package io.dataease.dto.templateMarket;
import lombok.Data;
/**
* Author: wangjiahao
* Date: 2022/7/15
* Description:
*/
@Data
public class MarketCategory {
private String id;
private String name;
private String slug;
}

View File

@ -0,0 +1,13 @@
package io.dataease.dto.templateMarket;
import lombok.Data;
/**
* Author: wangjiahao
* Date: 2022/7/15
* Description:
*/
@Data
public class MarketMetas {
private String theme_repo;
}

View File

@ -0,0 +1,17 @@
package io.dataease.dto.templateMarket;
import lombok.Data;
/**
* Author: wangjiahao
* Date: 2022/7/18
* Description:
*/
@Data
public class TemplateCategory {
private Integer id;
private String name;
private String slug;
}

View File

@ -0,0 +1,24 @@
package io.dataease.dto.templateMarket;
import lombok.Data;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/7/15
* Description:
*/
@Data
public class TemplateMarketDTO {
private String id;
private String title;
private String status;
private String slug;
private String editorType;
private String summary;
private String thumbnail;
private Boolean showFlag = true;
private List<MarketCategory> categories;
private MarketMetas metas;
}

View File

@ -0,0 +1,51 @@
package io.dataease.listener;
import io.dataease.plugins.common.base.domain.SysStartupJob;
import io.dataease.plugins.common.base.mapper.SysStartupJobMapper;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.loader.ClassloaderResponsity;
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;
/**
* @Author gin
* @Date 2022/07/10 10:01 上午
*/
@Component
public class RowPermissionMergeListener implements ApplicationListener<ApplicationReadyEvent> {
private final Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
public static final String JOB_ID = "rowPermissionsMerge";
@Resource
private SysStartupJobMapper sysStartupJobMapper;
@Override
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
Map<String, RowPermissionTreeService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((RowPermissionTreeService.class));
if (beansOfType.keySet().size() > 0) {
System.out.println("====row permissions merge [start]====");
logger.info("====row permissions merge [start]====");
SysStartupJob sysStartupJob = sysStartupJobMapper.selectByPrimaryKey(JOB_ID);
if (ObjectUtils.isNotEmpty(sysStartupJob) && StringUtils.equalsIgnoreCase(sysStartupJob.getStatus(), "ready")) {
System.out.println("====row permissions merge [doing]====");
logger.info("====row permissions merge [doing]====");
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
rowPermissionTreeService.mergeOldPermissions();
sysStartupJob.setStatus("done");
sysStartupJobMapper.updateByPrimaryKey(sysStartupJob);
}
System.out.println("====row permissions merge [end]====");
logger.info("====row permissions merge [end]====");
}
}
}

View File

@ -1,17 +1,19 @@
package io.dataease.plugins.server;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.dataease.auth.annotation.DePermission;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -56,8 +58,19 @@ public class RowPermissionsTreeController {
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("根据数据集查找行权限")
@PostMapping("getByDs")
public List<DataSetRowPermissionsTreeDTO> getByDs(@RequestBody DataSetRowPermissionsTreeDTO request) {
public List<DataSetRowPermissionsTreeDTO> getByDs(@RequestBody DatasetRowPermissionsTreeRequest request) {
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
return rowPermissionTreeService.list(request);
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("根据数据集分页查找行权限")
@PostMapping("getByDsPage/{goPage}/{pageSize}")
public Pager<List<DataSetRowPermissionsTreeDTO>> getByDs(@RequestBody DatasetRowPermissionsTreeRequest request, @PathVariable int goPage, @PathVariable int pageSize) {
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
List<DataSetRowPermissionsTreeDTO> list = rowPermissionTreeService.list(request);
Pager<List<DataSetRowPermissionsTreeDTO>> setPageInfo = PageUtils.setPageInfo(page, list);
return setPageInfo;
}
}

View File

@ -1,13 +1,17 @@
package io.dataease.provider.datasource;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import io.dataease.commons.utils.Md5Utils;
import io.dataease.dto.dataset.DatasetTableFieldDTO;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.datasource.provider.Provider;
import com.jayway.jsonpath.JsonPath;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.commons.utils.HttpClientConfig;
import io.dataease.commons.utils.HttpClientUtil;
import io.dataease.controller.request.datasource.ApiDefinition;
@ -20,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service("apiProvider")
public class ApiProvider extends Provider {
@ -68,7 +73,7 @@ public class ApiProvider extends Provider {
private List<TableField> getTableFileds(ApiDefinition apiDefinition, String response) throws Exception {
List<TableField> tableFields = new ArrayList<>();
for (DatasetTableField field : checkApiDefinition(apiDefinition, response).getFields()) {
for (DatasetTableFieldDTO field : checkApiDefinition(apiDefinition, response).getFields()) {
TableField tableField = new TableField();
tableField.setFieldName(field.getOriginName());
tableField.setRemarks(field.getName());
@ -86,7 +91,7 @@ public class ApiProvider extends Provider {
for (ApiDefinition apiDefinition : lists) {
if (datasourceRequest.getTable().equalsIgnoreCase(apiDefinition.getName())) {
String response = ApiProvider.execHttpRequest(apiDefinition);
for (DatasetTableField field : checkApiDefinition(apiDefinition, response).getFields()) {
for (DatasetTableFieldDTO field : checkApiDefinition(apiDefinition, response).getFields()) {
TableField tableField = new TableField();
tableField.setFieldName(field.getOriginName());
tableField.setRemarks(field.getName());
@ -171,77 +176,171 @@ public class ApiProvider extends Provider {
return response;
}
static public ApiDefinition checkApiDefinition(ApiDefinition apiDefinition, String response) throws Exception {
if (StringUtils.isEmpty(response)) {
throw new Exception("该请求返回数据为空");
}
List<LinkedHashMap> datas = new ArrayList<>();
try {
Object object = JsonPath.read(response, apiDefinition.getDataPath());
List<JSONObject> jsonFields = new ArrayList<>();
String rootPath;
if (response.startsWith("[")) {
rootPath = "$[*]";
JSONArray jsonArray = JSONObject.parseArray(response);
for (Object o : jsonArray) {
handleStr(apiDefinition, o.toString(), jsonFields, rootPath);
}
} else {
rootPath = "$";
handleStr(apiDefinition, response, jsonFields, rootPath);
}
apiDefinition.setJsonFields(jsonFields);
return apiDefinition;
}
static private void handleStr(ApiDefinition apiDefinition, String jsonStr, List<JSONObject> objects, String rootPath) {
if (jsonStr.startsWith("[")) {
JSONArray jsonArray = JSONObject.parseArray(jsonStr);
for (Object o : jsonArray) {
handleStr(apiDefinition, o.toString(), objects, rootPath);
}
} else {
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
for (String s : jsonObject.keySet()) {
String value = jsonObject.getString(s);
if (StringUtils.isNotEmpty(value) && value.startsWith("[")) {
rootPath = rootPath + "." + s;
JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString(s));
List<JSONObject> children = new ArrayList<>();
for (Object o : jsonArray) {
handleStr(apiDefinition, o.toString(), children, rootPath + "[*]");
}
JSONObject o = new JSONObject();
o.put("children", children);
o.put("childrenDataType", "LIST");
o.put("jsonPath", rootPath);
setProperty(apiDefinition, o, s);
if (!hasItem(objects, o, null)) {
objects.add(o);
}
} else if (StringUtils.isNotEmpty(value) && value.startsWith("{")) {
List<JSONObject> children = new ArrayList<>();
rootPath = rootPath + "." + s;
handleStr(apiDefinition, jsonObject.getString(s), children, rootPath);
JSONObject o = new JSONObject();
o.put("children", children);
o.put("childrenDataType", "OBJECT");
o.put("jsonPath", rootPath);
setProperty(apiDefinition, o, s);
if (!hasItem(objects, o, null)) {
objects.add(o);
}
} else {
JSONObject o = new JSONObject();
o.put("children", null);
o.put("jsonPath", rootPath + "." + s);
setProperty(apiDefinition, o, s);
if (!hasItem(objects, o, StringUtils.isNotEmpty(jsonObject.getString(s))? jsonObject.getString(s) : "")) {
JSONArray array = new JSONArray();
array.add(StringUtils.isNotEmpty(jsonObject.getString(s))? jsonObject.getString(s) : "");
o.put("value", array);
objects.add(o);
}
}
}
}
}
static private void setProperty(ApiDefinition apiDefinition, JSONObject o, String s) {
o.put("originName", s);
o.put("name", s);
o.put("type", "STRING");
o.put("checked", false);
o.put("size", 65535);
o.put("deExtractType", 0);
o.put("deType", 0);
o.put("extField", 0);
o.put("checked", false);
for (DatasetTableFieldDTO fieldDTO : apiDefinition.getFields()) {
if (StringUtils.isNotEmpty(o.getString("jsonPath")) && StringUtils.isNotEmpty(fieldDTO.getJsonPath()) && fieldDTO.getJsonPath().equals(o.getString("jsonPath"))) {
o.put("checked", true);
o.put("deExtractType", fieldDTO.getDeExtractType());
o.put("name", fieldDTO.getName());
}
}
}
static private boolean hasItem(List<JSONObject> objects, JSONObject o, String value) {
boolean has = false;
for (JSONObject object : objects) {
JSONObject jsonObject = JSONObject.parseObject(object.toJSONString());
jsonObject.remove("value");
jsonObject.remove("id");
if (Md5Utils.md5(jsonObject.toString()).equals(Md5Utils.md5(o.toString()))) {
has = true;
if(value != null){
JSONArray array = object.getJSONArray("value");
array.add(value);
object.put("value", array);
}
break;
}
}
return has;
}
private List<String[]> fetchResult(String result, ApiDefinition apiDefinition) {
List<String[]> dataList = new LinkedList<>();
if (StringUtils.isNotEmpty(apiDefinition.getDataPath()) && CollectionUtils.isNotEmpty(apiDefinition.getJsonFields())) {
List<LinkedHashMap> datas = new ArrayList<>();
Object object = JsonPath.read(result, apiDefinition.getDataPath());
if (object instanceof List) {
datas = (List<LinkedHashMap>) object;
} else {
datas.add((LinkedHashMap) object);
}
} catch (Exception e) {
throw new Exception("jsonPath 路径错误:" + e.getMessage());
}
List<Map<String,String>> dataList = new ArrayList<>();
List<DatasetTableField> fields = new ArrayList<>();
Set<String> fieldKeys = new HashSet<>();
//第一遍获取 field
for (LinkedHashMap data : datas) {
Set<String> keys = data.keySet();
for (String key : keys) {
if (!fieldKeys.contains(key)) {
fieldKeys.add(key);
DatasetTableField tableField = new DatasetTableField();
tableField.setOriginName(key);
tableField.setName(key);
tableField.setSize(65535);
tableField.setDeExtractType(0);
tableField.setDeType(0);
tableField.setExtField(0);
fields.add(tableField);
for (LinkedHashMap data : datas) {
String[] row = new String[apiDefinition.getFields().size()];
int i = 0;
for (DatasetTableFieldDTO field : apiDefinition.getFields()) {
row[i] = Optional.ofNullable(data.get(field.getOriginName())).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " ");
i++;
}
dataList.add(row);
}
} else {
List<String> jsonPaths = apiDefinition.getFields().stream().map(DatasetTableFieldDTO::getJsonPath).collect(Collectors.toList());
Long maxLenth = 0l;
List<List<String>> columnDataList = new ArrayList<>();
for (int i = 0; i < jsonPaths.size(); i++) {
List<String> datas = new ArrayList<>();
Object object = JsonPath.read(result, jsonPaths.get(i));
if (object instanceof List) {
datas = (List<String>) object;
} else {
datas.add((String) object);
}
maxLenth = maxLenth > datas.size() ? maxLenth : datas.size();
columnDataList.add(datas);
}
for (int i = 0; i < maxLenth; i++) {
String[] row = new String[apiDefinition.getFields().size()];
dataList.add(row);
}
for (int i = 0; i < columnDataList.size(); i++) {
for (int j = 0; j < columnDataList.get(i).size(); j++) {
dataList.get(j)[i] = String.valueOf(columnDataList.get(i).get(j));
}
}
}
//第二遍获取 data
for (LinkedHashMap data : datas) {
Map<String,String> mapData = new HashMap<>();
for (String key : fieldKeys) {
mapData.put(key, Optional.ofNullable(data.get(key)).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " "));
}
dataList.add(mapData);
}
apiDefinition.setDatas(dataList);
apiDefinition.setFields(fields);
return apiDefinition;
}
private List<String[]> fetchResult(String result, ApiDefinition apiDefinition) {
List<String[]> dataList = new LinkedList<>();
List<LinkedHashMap> datas = new ArrayList<>();
Object object = JsonPath.read(result, apiDefinition.getDataPath());
if (object instanceof List) {
datas = (List<LinkedHashMap>) object;
} else {
datas.add((LinkedHashMap) object);
}
for (LinkedHashMap data : datas) {
String[] row = new String[apiDefinition.getFields().size()];
int i = 0;
for (DatasetTableField field : apiDefinition.getFields()) {
row[i] = Optional.ofNullable(data.get(field.getOriginName())).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " ");
i++;
}
dataList.add(row);
}
return dataList;
}
private ApiDefinition checkApiDefinition(DatasourceRequest datasourceRequest) throws Exception {
List<ApiDefinition> apiDefinitionList = new ArrayList<>();
List<ApiDefinition> apiDefinitionListTemp = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), new TypeToken<List<ApiDefinition>>() {}.getType());

View File

@ -154,8 +154,11 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if (CollectionUtils.isNotEmpty(sortFields)) {
@ -316,6 +319,8 @@ public class DorisQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -323,6 +328,7 @@ public class DorisQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -393,12 +399,15 @@ public class DorisQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -505,6 +514,8 @@ public class DorisQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -512,6 +523,7 @@ public class DorisQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -616,6 +628,8 @@ public class DorisQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -623,6 +637,7 @@ public class DorisQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -702,12 +717,15 @@ public class DorisQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();
@ -1206,7 +1224,7 @@ public class DorisQueryProvider extends QueryProvider {
String cast = String.format(DorisConstants.CAST, originField, y.getDeType() == 2 ? DorisConstants.DEFAULT_INT_FORMAT : DorisConstants.DEFAULT_FLOAT_FORMAT);
String agg = String.format(DorisConstants.AGG_FIELD, y.getSummary(), cast);
String cast1 = String.format(DorisConstants.CAST, agg, DorisConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(DorisConstants.ROUND, cast1, "2");
fieldName = String.format(DorisConstants.ROUND, cast1, "8");
} else {
String cast = String.format(DorisConstants.CAST, originField, y.getDeType() == 2 ? DorisConstants.DEFAULT_INT_FORMAT : DorisConstants.DEFAULT_FLOAT_FORMAT);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {

View File

@ -155,8 +155,10 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if (CollectionUtils.isNotEmpty(sortFields)) {
@ -317,6 +319,8 @@ public class MysqlQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -324,6 +328,7 @@ public class MysqlQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -394,12 +399,15 @@ public class MysqlQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -506,6 +514,8 @@ public class MysqlQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -513,6 +523,7 @@ public class MysqlQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -617,6 +628,8 @@ public class MysqlQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -624,6 +637,7 @@ public class MysqlQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -703,12 +717,15 @@ public class MysqlQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();
@ -1212,7 +1229,7 @@ public class MysqlQueryProvider extends QueryProvider {
String cast = String.format(MysqlConstants.CAST, originField, y.getDeType() == 2 ? MysqlConstants.DEFAULT_INT_FORMAT : MysqlConstants.DEFAULT_FLOAT_FORMAT);
String agg = String.format(MysqlConstants.AGG_FIELD, y.getSummary(), cast);
String cast1 = String.format(MysqlConstants.CAST, agg, MysqlConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(MysqlConstants.ROUND, cast1, "2");
fieldName = String.format(MysqlConstants.ROUND, cast1, "8");
} else {
String cast = String.format(MysqlConstants.CAST, originField, y.getDeType() == 2 ? MysqlConstants.DEFAULT_INT_FORMAT : MysqlConstants.DEFAULT_FLOAT_FORMAT);
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {

View File

@ -183,8 +183,11 @@ public class CKQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -348,6 +351,8 @@ public class CKQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -355,6 +360,7 @@ public class CKQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -425,12 +431,15 @@ public class CKQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -538,6 +547,8 @@ public class CKQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -545,6 +556,7 @@ public class CKQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -649,6 +661,8 @@ public class CKQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -656,6 +670,7 @@ public class CKQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -735,12 +750,15 @@ public class CKQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -158,8 +158,11 @@ public class Db2QueryProvider extends QueryProvider {
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -328,6 +331,8 @@ public class Db2QueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -335,6 +340,7 @@ public class Db2QueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -407,12 +413,15 @@ public class Db2QueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -521,6 +530,8 @@ public class Db2QueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -528,6 +539,7 @@ public class Db2QueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -633,6 +645,8 @@ public class Db2QueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -640,6 +654,7 @@ public class Db2QueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -720,12 +735,15 @@ public class Db2QueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -183,8 +183,11 @@ public class EsQueryProvider extends QueryProvider {
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
@ -353,6 +356,8 @@ public class EsQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -360,6 +365,7 @@ public class EsQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -435,12 +441,15 @@ public class EsQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -550,6 +559,8 @@ public class EsQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -557,6 +568,7 @@ public class EsQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -669,6 +681,8 @@ public class EsQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -676,6 +690,7 @@ public class EsQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -759,12 +774,15 @@ public class EsQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();
@ -1213,7 +1231,7 @@ public class EsQueryProvider extends QueryProvider {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(EsSqlLConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? "bigint" : "double");
String agg = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), cast);
fieldName = String.format(EsSqlLConstants.ROUND, agg, "2");
fieldName = String.format(EsSqlLConstants.ROUND, agg, "8");
} else {
String cast = String.format(EsSqlLConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? "bigint" : "double");
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {

View File

@ -143,8 +143,11 @@ public class HiveQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -304,6 +307,8 @@ public class HiveQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -311,6 +316,7 @@ public class HiveQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -381,12 +387,15 @@ public class HiveQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -494,6 +503,8 @@ public class HiveQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -501,6 +512,7 @@ public class HiveQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -605,6 +617,8 @@ public class HiveQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -612,6 +626,7 @@ public class HiveQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -691,12 +706,15 @@ public class HiveQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -140,8 +140,11 @@ public class ImpalaQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -301,6 +304,8 @@ public class ImpalaQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -308,6 +313,7 @@ public class ImpalaQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -378,12 +384,15 @@ public class ImpalaQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -491,6 +500,8 @@ public class ImpalaQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -498,6 +509,7 @@ public class ImpalaQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -602,6 +614,8 @@ public class ImpalaQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -609,6 +623,7 @@ public class ImpalaQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -688,12 +703,15 @@ public class ImpalaQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -130,8 +130,11 @@ public class MongoQueryProvider extends QueryProvider {
}
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -264,6 +267,8 @@ public class MongoQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -271,6 +276,7 @@ public class MongoQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -346,12 +352,15 @@ public class MongoQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -461,6 +470,8 @@ public class MongoQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -468,6 +479,7 @@ public class MongoQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -577,6 +589,8 @@ public class MongoQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -584,6 +598,7 @@ public class MongoQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -669,12 +684,15 @@ public class MongoQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -117,8 +117,11 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -360,6 +363,8 @@ public class OracleQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -367,6 +372,7 @@ public class OracleQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -437,12 +443,15 @@ public class OracleQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -549,6 +558,8 @@ public class OracleQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -556,6 +567,7 @@ public class OracleQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -660,6 +672,8 @@ public class OracleQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -667,6 +681,7 @@ public class OracleQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -747,12 +762,15 @@ public class OracleQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();
orders.addAll(yOrders);

View File

@ -171,8 +171,11 @@ public class PgQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
@ -331,6 +334,8 @@ public class PgQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -338,6 +343,7 @@ public class PgQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -408,12 +414,15 @@ public class PgQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -521,6 +530,8 @@ public class PgQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -528,6 +539,7 @@ public class PgQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -632,6 +644,8 @@ public class PgQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -639,6 +653,7 @@ public class PgQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -719,12 +734,15 @@ public class PgQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -180,8 +180,11 @@ public class RedshiftQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
@ -341,6 +344,8 @@ public class RedshiftQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -348,6 +353,7 @@ public class RedshiftQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -463,6 +469,8 @@ public class RedshiftQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -470,6 +478,7 @@ public class RedshiftQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -574,6 +583,8 @@ public class RedshiftQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -581,6 +592,7 @@ public class RedshiftQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -661,12 +673,15 @@ public class RedshiftQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -170,8 +170,11 @@ public class SqlserverQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (whereTrees != null) wheres.add(whereTrees);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
List<SQLObj> xOrders = new ArrayList<>();
if (CollectionUtils.isNotEmpty(sortFields)) {
@ -323,6 +326,8 @@ public class SqlserverQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -330,6 +335,7 @@ public class SqlserverQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -404,12 +410,15 @@ public class SqlserverQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -540,6 +549,8 @@ public class SqlserverQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -547,6 +558,7 @@ public class SqlserverQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -655,6 +667,8 @@ public class SqlserverQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
@ -662,6 +676,7 @@ public class SqlserverQueryProvider extends QueryProvider {
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
@ -746,12 +761,15 @@ public class SqlserverQueryProvider extends QueryProvider {
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
// 处理仪表板字段过滤
String extWheres = transExtFilterList(tableObj, extFilterRequestList);
// row permissions tree
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<String> wheres = new ArrayList<>();
if (customWheres != null) wheres.add(customWheres);
if (extWheres != null) wheres.add(extWheres);
if (whereTrees != null) wheres.add(whereTrees);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();

View File

@ -997,9 +997,9 @@ public class ChartViewService {
item[dataIndex] = null;
} else {
item[dataIndex] = new BigDecimal(cValue)
.divide(new BigDecimal(lastValue), 2, RoundingMode.HALF_UP)
.divide(new BigDecimal(lastValue), 8, RoundingMode.HALF_UP)
.subtract(new BigDecimal(1))
.setScale(2, RoundingMode.HALF_UP)
.setScale(8, RoundingMode.HALF_UP)
.toString();
}
}

View File

@ -902,7 +902,7 @@ public class ChartDataBuild {
if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1 || chartViewFieldDTO.getDeType() == 5) {
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]);
} else if (chartViewFieldDTO.getDeType() == 2 || chartViewFieldDTO.getDeType() == 3) {
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(2, RoundingMode.HALF_UP));
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(8, RoundingMode.HALF_UP));
}
}
tableRow.add(d);

View File

@ -1196,7 +1196,8 @@ public class ExtractDataService {
targetCharset = jdbcConfiguration.getTargetCharset();
}
if (StringUtils.isNotEmpty(charset)) {
tmp_code = tmp_code.replace("handleCharset", handleCharset.replace("Datasource_Charset", charset).replace("Target_Charset", targetCharset));
String varcharFields = datasetTableFields.stream().filter(datasetTableField -> datasetTableField.getDeExtractType() == 0).map(DatasetTableField::getOriginName).collect(Collectors.joining(","));
tmp_code = tmp_code.replace("handleCharset", handleCharset.replace("Datasource_Charset", charset).replace("Target_Charset", targetCharset).replace("varcharFields", varcharFields));
}else {
tmp_code = tmp_code.replace("handleCharset", "");
}
@ -1313,7 +1314,7 @@ public class ExtractDataService {
" get(Fields.Out, filed).setValue(r, tmp);\n" +
" } \n";
private final static String handleCharset = "\tif(tmp != null){\n" +
private final static String handleCharset = "\tif(tmp != null && Arrays.asList(\"varcharFields\".split(\",\")).contains(filed)){\n" +
" \t\t\ttry {\n" +
"\t\t\t\tget(Fields.Out, filed).setValue(r, new String(tmp.getBytes(\"Datasource_Charset\"), \"Target_Charset\"));\n" +
" \t\t}catch (Exception e){}\n" +

View File

@ -11,6 +11,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeObj;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.service.RowPermissionTreeService;
import org.apache.commons.lang3.ObjectUtils;
@ -18,7 +19,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@ -60,7 +64,7 @@ public class PermissionsTreeService {
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(userId);
roleIds = currentRoleDtos.stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
DataSetRowPermissionsTreeDTO dataSetRowPermissionsDTO = new DataSetRowPermissionsTreeDTO();
DatasetRowPermissionsTreeRequest dataSetRowPermissionsDTO = new DatasetRowPermissionsTreeRequest();
dataSetRowPermissionsDTO.setDatasetId(datasetId);
dataSetRowPermissionsDTO.setEnable(true);

View File

@ -3,14 +3,12 @@ package io.dataease.service.panel;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.commons.constants.*;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.TreeUtils;
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.PanelGroupBaseInfoRequest;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.controller.request.panel.PanelTemplateRequest;
import io.dataease.controller.request.panel.PanelViewDetailsRequest;
import io.dataease.dto.PanelGroupExtendDataDTO;
import io.dataease.dto.SysLogDTO;
@ -18,6 +16,7 @@ import io.dataease.dto.authModel.VAuthModelDTO;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.PanelTemplateFileDTO;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.*;
@ -389,6 +388,16 @@ public class PanelGroupService {
dynamicData = request.getDynamicData();
staticResource = request.getStaticResource();
mobileLayout = panelViewService.havaMobileLayout(templateData);
} else if (PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(newFrom)){
PanelTemplateFileDTO templateFileInfo = getTemplateFromMarket(request.getTemplateUrl());
if(templateFileInfo == null){
DataEaseException.throwException("Can't find the template's info from market,please check");
}
templateStyle = templateFileInfo.getPanelStyle();
templateData = templateFileInfo.getPanelData();
dynamicData = templateFileInfo.getDynamicData();
staticResource = templateFileInfo.getStaticResource();
mobileLayout = panelViewService.havaMobileLayout(templateData);
}
Map<String, String> dynamicDataMap = gson.fromJson(dynamicData, Map.class);
List<PanelViewInsertDTO> panelViews = new ArrayList<>();
@ -583,4 +592,15 @@ public class PanelGroupService {
panelGroup.setStatus(request.getStatus());
panelGroupMapper.updateByPrimaryKeySelective(panelGroup);
}
public PanelTemplateFileDTO getTemplateFromMarket(String templateUrl){
if(StringUtils.isNotEmpty(templateUrl)){
Gson gson = new Gson();
String templateInfo = HttpClientUtil.get(templateUrl,null);
return gson.fromJson(templateInfo, PanelTemplateFileDTO.class);
}else{
return null;
}
}
}

View File

@ -6,6 +6,7 @@ import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.EncryptUtils;
import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.dto.SystemParameterDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.base.domain.FileMetadata;
import io.dataease.plugins.common.base.domain.SystemParameter;
import io.dataease.plugins.common.base.domain.SystemParameterExample;
@ -69,6 +70,13 @@ public class SystemParameterService {
boolean open = StringUtils.equals("true", param.getParamValue());
result.setOpenHomePage(open ? "true" : "false");
}
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) {
result.setTemplateMarketUlr(param.getParamValue());
}
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_ACCESS_KEY.getValue())) {
result.setTemplateAccessKey(param.getParamValue());
}
}
}
return result;
@ -270,5 +278,23 @@ public class SystemParameterService {
}
}
public BasicInfo templateMarketInfo(){
BasicInfo basicInfo = new BasicInfo();
List<SystemParameter> result = this.getParamList("basic.template");
if(CollectionUtils.isNotEmpty(result)){
result.stream().forEach(param -> {
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) {
basicInfo.setTemplateMarketUlr(param.getParamValue());
}
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_ACCESS_KEY.getValue())) {
basicInfo.setTemplateAccessKey(param.getParamValue());
}
});
}
if(StringUtils.isEmpty(basicInfo.getTemplateMarketUlr())|| StringUtils.isEmpty(basicInfo.getTemplateAccessKey())){
DataEaseException.throwException("Please check market setting info");
}
return basicInfo;
}
}

View File

@ -0,0 +1,85 @@
package io.dataease.service.templateMarket;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import io.dataease.commons.utils.HttpClientConfig;
import io.dataease.commons.utils.HttpClientUtil;
import io.dataease.controller.request.templateMarket.TemplateMarketSearchRequest;
import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.dto.panel.PanelTemplateFileDTO;
import io.dataease.dto.templateMarket.MarketBaseResponse;
import io.dataease.dto.templateMarket.TemplateCategory;
import io.dataease.dto.templateMarket.TemplateMarketDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* Author: wangjiahao
* Date: 2022/7/14
* Description: ${userName}
*/
@Service
public class TemplateMarketService {
private final static String POSTS_API="/api/content/posts?page=0&size=2000";
private final static String CATEGORIES_API="/api/content/categories";
@Resource
private SystemParameterService systemParameterService;
/**
* @Description Get template file from template market
* @param templateUrl template url
*/
public PanelTemplateFileDTO getTemplateFromMarket(String templateUrl){
if(StringUtils.isNotEmpty(templateUrl)){
String sufUrl = systemParameterService.templateMarketInfo().getTemplateMarketUlr();
Gson gson = new Gson();
String templateInfo = HttpClientUtil.get(sufUrl+templateUrl,null);
return gson.fromJson(templateInfo, PanelTemplateFileDTO.class);
}else{
return null;
}
}
/**
* @Description Get info from template market content api
* @param url content api url
*/
public String marketGet(String url,String accessKey){
HttpClientConfig config = new HttpClientConfig();
config.addHeader("API-Authorization",accessKey);
return HttpClientUtil.get(url,config);
}
public MarketBaseResponse searchTemplate(TemplateMarketSearchRequest request){
try{
BasicInfo basicInfo = systemParameterService.templateMarketInfo();
String result = marketGet(basicInfo.getTemplateMarketUlr()+POSTS_API,basicInfo.getTemplateAccessKey());
List<TemplateMarketDTO> postsResult = JSONObject.parseObject(result).getJSONObject("data").getJSONArray("content").toJavaList(TemplateMarketDTO.class);
return new MarketBaseResponse(basicInfo.getTemplateMarketUlr(),postsResult);
}catch (Exception e){
DataEaseException.throwException(e);
}
return null;
}
public List<String> getCategories(){
BasicInfo basicInfo = systemParameterService.templateMarketInfo();
String resultStr = marketGet(basicInfo.getTemplateMarketUlr()+CATEGORIES_API,basicInfo.getTemplateAccessKey());
List<TemplateCategory> categories = JSONObject.parseObject(resultStr).getJSONArray("data").toJavaList(TemplateCategory.class);
if(CollectionUtils.isNotEmpty(categories)){
return categories.stream().map(TemplateCategory :: getName).collect(Collectors.toList());
}else{
return null;
}
}
}

View File

@ -39,6 +39,7 @@ VALUES ('Mongo 数据源插件', 'default', '0', '0', 'datasource', 'Mongo 数
'1650765903630', 'mongo-backend', 'mongobi');
DROP TABLE IF EXISTS `area_mapping_global`;
CREATE TABLE `area_mapping_global` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
@ -63,4 +64,10 @@ update area_mapping_global set
province_code = concat('156', province_code),
city_code = concat('156', city_code),
county_code = concat('156', county_code);
COMMIT;
COMMIT;
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 (202, 0, 0, 1, '模板市场', 'template-market', 'panel/templateMarket/index', 7, 'dashboard', '/templateMarket', 0, 0, 0, null, NULL, NULL, NULL, 1620444227389);
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateAccessKey', 'dataease', 'text', NULL);
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateMarketUlr', 'https://dataease.io/templates', 'text', 4);

View File

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

View File

@ -26,6 +26,7 @@
<div v-show="!editControlButton" class="toolbar">
<div class="panel-info-area">
<!--back to panelList-->
<svg-icon
icon-class="icon_left_outlined"
class="toolbar-icon-active icon20 margin-left20"

View File

@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1658301542532" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="957" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M-15.88624103 59.48859927h301.64928058c249.87872281 0 452.47392089 202.59519808 452.4739209 452.4739209S535.64176236 964.43644107 285.76303955 964.43644107H-15.88624103V59.48859927z" fill="#e6e6e6" p-id="958"></path><path d="M285.76303955 97.19475935H-15.88624103v829.53552164h301.64928058c229.06492245 0 414.76776082-185.70283837 414.76776081-414.76776082S514.82796201 97.19475935 285.76303955 97.19475935zM-15.88624103 59.48859927v904.9478418h301.64928058c249.87872281 0 452.47392089-202.59519808 452.4739209-452.4739209S535.64176236 59.48859927 285.76303955 59.48859927H-15.88624103z" fill="#e7e3e3" p-id="959"></path><path d="M113.40818187 377.31382255l134.46016681 134.46016682-134.46016681 134.42246066a9.42654002 9.42654002 0 0 0 0 13.34798068l13.31027449 13.3102745a9.42654002 9.42654002 0 0 0 13.34798065 0l147.8081475-147.77044133a18.85308003 18.85308003 0 0 0 0-26.65825517l-147.8081475-147.8081475a9.42654002 9.42654002 0 0 0-13.34798065 0l-13.31027449 13.34798069a9.42654002 9.42654002 0 0 0 0 13.34798065z" fill="#646A73" p-id="960"></path><path d="M280.93665106 377.31382255l134.42246066 134.46016682-134.42246066 134.42246066a9.42654002 9.42654002 0 0 0 0 13.34798068l13.3102745 13.3102745a9.42654002 9.42654002 0 0 0 13.34798068 0l147.80814749-147.77044133a18.85308003 18.85308003 0 0 0 0-26.65825517l-147.80814749-147.8081475a9.42654002 9.42654002 0 0 0-13.34798068 0l-13.3102745 13.34798069a9.42654002 9.42654002 0 0 0 0 13.34798065z" fill="#646A73" p-id="961"></path></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,5 @@
<svg width="125" height="125" viewBox="0 0 125 125" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="125" height="125" rx="62.5" fill="#EFF0F1"/>
<path d="M68.6525 91.3927C67.7195 93.8379 64.2695 93.8652 63.2978 91.4358L47.0339 50.7747C46.0952 48.4287 48.424 46.0985 50.7714 47.0372L91.4296 63.3011C93.8547 64.2714 93.8346 67.7113 91.398 68.6529L74.8998 75.0253L68.6525 91.3942V91.3927ZM65.904 82.4702L69.9836 71.7809C70.1273 71.4047 70.3485 71.0629 70.6328 70.7776C70.9171 70.4923 71.2581 70.27 71.6338 70.1249L82.5042 65.926L54.864 54.8702L65.904 82.4702Z" fill="#BBBFC4"/>
<path d="M48.125 32.3125C56.7026 32.3125 63.6859 39.1421 63.9303 47.6607L57.7534 45.1896C57.2462 43.5293 56.3182 42.0284 55.0594 40.8329C53.8006 39.6373 52.2538 38.7878 50.5696 38.3669C48.8853 37.9459 47.1208 37.9679 45.4476 38.4307C43.7743 38.8934 42.2493 39.7812 41.0206 41.0077C39.792 42.2343 38.9016 43.7578 38.436 45.4302C37.9703 47.1027 37.9453 48.8672 38.3634 50.5521C38.7814 52.2371 39.6283 53.7853 40.8217 55.0461C42.0151 56.307 43.5143 57.2376 45.1738 57.7476L47.6463 63.9303C39.1334 63.6773 32.3125 56.6982 32.3125 48.125C32.3125 39.3922 39.3922 32.3125 48.125 32.3125Z" fill="#BBBFC4"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1122,9 +1122,18 @@ export default {
open: 'Open',
row: 'Row',
interval: 'Interval',
max_more_than_mix: 'Max must more than Min'
max_more_than_mix: 'Max must more than Min',
field: 'Field',
textColor: 'Text Color',
backgroundColor: 'Background Color',
field_can_not_empty: 'Field can not empty',
conditions_can_not_empty: 'Conditions can not be emptyif unnecessaryplease delete the field',
remark: 'Remark',
remark_edit: 'Edit Remark',
remark_bg_color: 'Background Fill'
},
dataset: {
field_rename: 'Rename Field',
params_work: 'Effective only when editing SQL',
sql_variable_limit_1: '1、SQL variables can only be used in where conditions',
sql_variable_limit_2: '2、Exampleselect * from table_name where column_name1=${parm_name1} and column_name2 in ${parm_name2}',
@ -1456,6 +1465,7 @@ export default {
add_api_table: 'Add API table',
edit_api_table: 'Edit API table',
base_info: 'Basic information',
column_info: 'Data structure',
request: 'Request',
path_all_info: 'Please fill in the full address',
req_param: 'Request parameters',
@ -1478,7 +1488,9 @@ export default {
api_table_not_empty: 'API data table cannot be empty',
has_repeat_name: 'Duplicate API data table name',
valid: 'Valid',
invalid: 'Invalid'
invalid: 'Invalid',
api_step_1: 'Connection API',
api_step_2: 'Extract data'
},
pblink: {
key_pwd: 'Please enter the password to open the link',
@ -1488,6 +1500,15 @@ export default {
sure_bt: 'Confirm'
},
panel: {
template_market: 'Template Market',
template_preview: 'Template Preview',
apply: 'Apply',
apply_this_template: 'Apply This Template',
market_network_tips: 'View template Market template requires server and template Market https://dataease.io/templates , please check the network... ',
enter_name_tips: 'Please enter the name of the panel',
name: 'Name',
apply_template: 'Apply Template',
enter_template_name_tips: 'Please enter the template name...',
pic_adaptation: 'Adaptation',
pic_equiratio: 'Equiratio',
pic_original: 'Original',

View File

@ -1122,9 +1122,18 @@ export default {
open: '開啟',
row: '行數',
interval: '間隔',
max_more_than_mix: '最大值必須大於最小值'
max_more_than_mix: '最大值必須大於最小值',
field: '字段',
textColor: '文字顏色',
backgroundColor: '背景顏色',
field_can_not_empty: '字段不能為空',
conditions_can_not_empty: '字段的條件不能為空,若無條件,請直接刪除該字段',
remark: '備註',
remark_edit: '編輯備註',
remark_bg_color: '背景填充'
},
dataset: {
field_rename: '字段重命名',
params_work: '僅在編輯 sql 時生效',
sql_variable_limit_1: '1、SQL變數只能在WHERE條件中使用',
sql_variable_limit_2: '2、示例select * from table_name where column_name1=${parm_name1} and column_name2 in ${parm_name2}',
@ -1457,6 +1466,7 @@ export default {
add_api_table: '添加 API 數據表',
edit_api_table: '編輯 API 數據表',
base_info: '基礎信息',
column_info: '資料結構',
request: '請求',
path_all_info: '請輸入完整地址',
req_param: '請求參數',
@ -1479,7 +1489,9 @@ export default {
api_table_not_empty: 'API 數據表不能為空',
has_repeat_name: 'API 數據表名稱重複',
valid: '有效',
invalid: '無效'
invalid: '無效',
api_step_1: '連接API',
api_step_2: '選取數據'
},
pblink: {
key_pwd: '請輸入密碼打開鏈接',
@ -1489,6 +1501,15 @@ export default {
sure_bt: '確定'
},
panel: {
template_market: '模板市场',
template_preview: '预览模板',
apply: '应用',
apply_this_template: '应用此模板',
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)联通,请检查网络...',
enter_name_tips: '请输入仪表板名称',
name: '名称',
apply_template: '应用模板',
enter_template_name_tips: '搜索模板名称',
pic_adaptation: '适应组件',
pic_equiratio: '等比适应',
pic_original: '原始尺寸',

View File

@ -1124,9 +1124,18 @@ export default {
open: '开启',
row: '行数',
interval: '间隔',
max_more_than_mix: '最大值必须大于最小值'
max_more_than_mix: '最大值必须大于最小值',
field: '字段',
textColor: '文字颜色',
backgroundColor: '背景颜色',
field_can_not_empty: '字段不能为空',
conditions_can_not_empty: '字段的条件不能为空,若无条件,请直接删除该字段',
remark: '备注',
remark_edit: '编辑备注',
remark_bg_color: '背景填充'
},
dataset: {
field_rename: '字段重命名',
params_work: '仅在编辑sql时生效',
select_year: '选择年',
sql_variable_limit_1: '1、SQL 变量只能在 WHERE 条件中使用',
@ -1465,6 +1474,7 @@ export default {
add_api_table: '添加API数据表',
edit_api_table: '编辑API数据表',
base_info: '基础信息',
column_info: '数据结构',
request: '请求',
path_all_info: '请填入完整地址',
req_param: '请求参数',
@ -1487,7 +1497,9 @@ export default {
api_table_not_empty: 'API 数据表不能为空',
has_repeat_name: 'API 数据表名称重复',
valid: '有效',
invalid: '无效'
invalid: '无效',
api_step_1: '连接API',
api_step_2: '提取数据'
},
pblink: {
key_pwd: '请输入密码打开链接',
@ -1497,6 +1509,15 @@ export default {
sure_bt: '确定'
},
panel: {
template_market: '模板市场',
template_preview: '预览模板',
apply: '应用',
apply_this_template: '应用此模板',
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)联通,请检查网络...',
enter_name_tips: '请输入仪表板名称',
name: '名称',
apply_template: '应用模板',
enter_template_name_tips: '搜索模板名称',
pic_adaptation: '适应组件',
pic_equiratio: '等比适应',
pic_original: '原始尺寸',

View File

@ -22,7 +22,6 @@
<div class="right-menu" style="color: var(--TopTextColor)">
<template>
<notification class="right-menu-item hover-effect" />
<lang-select class="right-menu-item hover-effect" />
<div style="height: 100%;padding: 0 8px;" class="right-menu-item hover-effect">
@ -43,7 +42,6 @@
trigger="click"
>
<div class="el-dropdown-link" style="display: flex;color: var(--TopTextColor);font-size: 14px; width:100%;">
<span style="max-width:80px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">{{ name }}</span>
<span><i class="el-icon-arrow-down el-icon--right" /></span>
</div>
@ -70,6 +68,16 @@
</el-dropdown>
</div>
<!--模板市场全屏显示框-->
<el-dialog
:visible="templateMarketShow"
:show-close="false"
class="dialog-css"
:fullscreen="true"
append-to-body="true"
>
<template-market v-if="templateMarketShow" style="text-align: center" @closeDialog="changeTemplateMarketShow(false)" />
</el-dialog>
</div>
</template>
@ -95,9 +103,11 @@ import {
import {
initTheme
} from '@/utils/ThemeUtil'
import TemplateMarket from '@/views/panel/templateMarket'
export default {
name: 'Topbar',
components: {
TemplateMarket,
AppLink,
Notification,
LangSelect
@ -114,7 +124,8 @@ export default {
uiInfo: null,
logoUrl: null,
axiosFinished: false,
isPluginLoaded: false
isPluginLoaded: false,
templateMarketShow: false
}
},
@ -357,6 +368,9 @@ export default {
},
setTopTextActiveInfo(val) {
this.loadUiInfo()
},
changeTemplateMarketShow(isShow) {
this.templateMarketShow = isShow
}
}
@ -387,5 +401,15 @@ export default {
background-color: var(--MainBG);
}
.template-market-item{
display: flex;
color: var(--MenuActiveBG, #409EFF);
font-size: 14px!important;
line-height: 38px!important;
}
.dialog-css ::v-deep .el-dialog__header{
display: none;
}
</style>

View File

@ -54,6 +54,42 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe635;</span>
<div class="name">button_right</div>
<div class="code-name">&amp;#xe635;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe631;</span>
<div class="name">icon-maybe</div>
<div class="code-name">&amp;#xe631;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe632;</span>
<div class="name">icon_up-left_outlined</div>
<div class="code-name">&amp;#xe632;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe633;</span>
<div class="name">close</div>
<div class="code-name">&amp;#xe633;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe634;</span>
<div class="name">Frame 3425</div>
<div class="code-name">&amp;#xe634;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe636;</span>
<div class="name">icon-filter</div>
<div class="code-name">&amp;#xe636;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe630;</span>
<div class="name">icon_Batch_outlined</div>
@ -726,9 +762,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1657078050131') format('woff2'),
url('iconfont.woff?t=1657078050131') format('woff'),
url('iconfont.ttf?t=1657078050131') format('truetype');
src: url('iconfont.woff2?t=1658301977080') format('woff2'),
url('iconfont.woff?t=1658301977080') format('woff'),
url('iconfont.ttf?t=1658301977080') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -754,6 +790,60 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-button_right"></span>
<div class="name">
button_right
</div>
<div class="code-name">.icon-button_right
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-icon-maybe"></span>
<div class="name">
icon-maybe
</div>
<div class="code-name">.icon-icon-maybe
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-icon_up-left_outlined"></span>
<div class="name">
icon_up-left_outlined
</div>
<div class="code-name">.icon-icon_up-left_outlined
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-close"></span>
<div class="name">
close
</div>
<div class="code-name">.icon-close
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-a-Frame3425"></span>
<div class="name">
Frame 3425
</div>
<div class="code-name">.icon-a-Frame3425
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-icon-filter"></span>
<div class="name">
icon-filter
</div>
<div class="code-name">.icon-icon-filter
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-icon_Batch_outlined"></span>
<div class="name">
@ -1762,6 +1852,54 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-button_right"></use>
</svg>
<div class="name">button_right</div>
<div class="code-name">#icon-button_right</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-icon-maybe"></use>
</svg>
<div class="name">icon-maybe</div>
<div class="code-name">#icon-icon-maybe</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-icon_up-left_outlined"></use>
</svg>
<div class="name">icon_up-left_outlined</div>
<div class="code-name">#icon-icon_up-left_outlined</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-close"></use>
</svg>
<div class="name">close</div>
<div class="code-name">#icon-close</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-a-Frame3425"></use>
</svg>
<div class="name">Frame 3425</div>
<div class="code-name">#icon-a-Frame3425</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-icon-filter"></use>
</svg>
<div class="name">icon-filter</div>
<div class="code-name">#icon-icon-filter</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-icon_Batch_outlined"></use>

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2459092 */
src: url('iconfont.woff2?t=1657078050131') format('woff2'),
url('iconfont.woff?t=1657078050131') format('woff'),
url('iconfont.ttf?t=1657078050131') format('truetype');
src: url('iconfont.woff2?t=1658301977080') format('woff2'),
url('iconfont.woff?t=1658301977080') format('woff'),
url('iconfont.ttf?t=1658301977080') format('truetype');
}
.iconfont {
@ -13,6 +13,30 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-button_right:before {
content: "\e635";
}
.icon-icon-maybe:before {
content: "\e631";
}
.icon-icon_up-left_outlined:before {
content: "\e632";
}
.icon-close:before {
content: "\e633";
}
.icon-a-Frame3425:before {
content: "\e634";
}
.icon-icon-filter:before {
content: "\e636";
}
.icon-icon_Batch_outlined:before {
content: "\e630";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,48 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "30729285",
"name": "button_right",
"font_class": "button_right",
"unicode": "e635",
"unicode_decimal": 58933
},
{
"icon_id": "30705847",
"name": "icon-maybe",
"font_class": "icon-maybe",
"unicode": "e631",
"unicode_decimal": 58929
},
{
"icon_id": "30725622",
"name": "icon_up-left_outlined",
"font_class": "icon_up-left_outlined",
"unicode": "e632",
"unicode_decimal": 58930
},
{
"icon_id": "30725623",
"name": "close",
"font_class": "close",
"unicode": "e633",
"unicode_decimal": 58931
},
{
"icon_id": "30725624",
"name": "Frame 3425",
"font_class": "a-Frame3425",
"unicode": "e634",
"unicode_decimal": 58932
},
{
"icon_id": "30725626",
"name": "icon-filter",
"font_class": "icon-filter",
"unicode": "e636",
"unicode_decimal": 58934
},
{
"icon_id": "30342179",
"name": "icon_Batch_outlined",

View File

@ -144,7 +144,10 @@ export const DEFAULT_TITLE_STYLE = {
hPosition: 'left',
vPosition: 'top',
isItalic: false,
isBolder: true
isBolder: true,
remarkShow: false,
remark: '',
remarkBackgroundColor: '#ffffffff'
}
export const DEFAULT_TITLE_STYLE_DARK = {
@ -337,7 +340,8 @@ export const DEFAULT_FUNCTION_CFG = {
}
export const DEFAULT_THRESHOLD = {
gaugeThreshold: '',
labelThreshold: []
labelThreshold: [],
tableThreshold: []
}
export const DEFAULT_SCROLL = {
open: false,

View File

@ -1,7 +1,8 @@
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { DEFAULT_COLOR_CASE, DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
import { hexColorToRGBA } from '@/views/chart/chart/util'
export function baseTableInfo(s2, container, chart, action, tableData) {
const containerDom = document.getElementById(container)
@ -59,6 +60,9 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.groupType === 'd') {
return value
} else {
@ -86,6 +90,9 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.groupType === 'd') {
return value
} else {
@ -116,7 +123,8 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
width: containerDom.offsetWidth,
height: containerDom.offsetHeight,
// showSeriesNumber: true
style: getSize(chart)
style: getSize(chart),
conditions: getConditions(chart)
}
// 开始渲染
@ -190,6 +198,9 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
@ -211,6 +222,9 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
@ -235,7 +249,8 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
width: containerDom.offsetWidth,
height: containerDom.offsetHeight,
// showSeriesNumber: true
style: getSize(chart)
style: getSize(chart),
conditions: getConditions(chart)
}
// 开始渲染
@ -319,6 +334,9 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
@ -340,6 +358,9 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
if (!f) {
return value
}
if (value === null || value === undefined) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {
@ -385,7 +406,8 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
width: containerDom.offsetWidth,
height: containerDom.offsetHeight,
style: getSize(chart),
totals: totalCfg
totals: totalCfg,
conditions: getConditions(chart)
}
// 开始渲染
@ -424,3 +446,190 @@ function getCurrentField(valueFieldList, field) {
return res
}
function getConditions(chart) {
const res = {
text: [],
background: []
}
let conditions
try {
const senior = JSON.parse(chart.senior)
conditions = senior.threshold ? senior.threshold.tableThreshold : null
} catch (err) {
const senior = JSON.parse(JSON.stringify(chart.senior))
conditions = senior.threshold ? senior.threshold.tableThreshold : null
}
if (conditions && conditions.length > 0) {
// table item color
let valueColor = DEFAULT_COLOR_CASE.tableFontColor
let valueBgColor = DEFAULT_COLOR_CASE.tableItemBgColor
if (chart.customAttr) {
const customAttr = JSON.parse(chart.customAttr)
// color
if (customAttr.color) {
const c = JSON.parse(JSON.stringify(customAttr.color))
valueColor = c.tableFontColor
valueBgColor = hexColorToRGBA(c.tableItemBgColor, c.alpha)
}
}
for (let i = 0; i < conditions.length; i++) {
const field = conditions[i]
res.text.push({
field: field.field.dataeaseName,
mapping(value) {
return {
fill: mappingColor(value, valueColor, field, 'color')
}
}
})
res.background.push({
field: field.field.dataeaseName,
mapping(value) {
return {
fill: mappingColor(value, valueBgColor, field, 'backgroundColor')
}
}
})
}
}
return res
}
function mappingColor(value, defaultColor, field, type) {
let color
for (let i = 0; i < field.conditions.length; i++) {
let flag = false
const t = field.conditions[i]
if (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) {
const tv = parseFloat(t.value)
if (t.term === 'eq') {
if (value === tv) {
color = t[type]
flag = true
}
} else if (t.term === 'not_eq') {
if (value !== tv) {
color = t[type]
flag = true
}
} else if (t.term === 'lt') {
if (value < tv) {
color = t[type]
flag = true
}
} else if (t.term === 'gt') {
if (value > tv) {
color = t[type]
flag = true
}
} else if (t.term === 'le') {
if (value <= tv) {
color = t[type]
flag = true
}
} else if (t.term === 'ge') {
if (value >= tv) {
color = t[type]
flag = true
}
}
if (flag) {
break
} else if (i === field.conditions.length - 1) {
color = defaultColor
}
} else if (field.field.deType === 0) {
const tv = t.value
if (t.term === 'eq') {
if (value === tv) {
color = t[type]
flag = true
}
} else if (t.term === 'not_eq') {
if (value !== tv) {
color = t[type]
flag = true
}
} else if (t.term === 'like') {
if (value.includes(tv)) {
color = t[type]
flag = true
}
} else if (t.term === 'not like') {
if (!value.includes(tv)) {
color = t[type]
flag = true
}
} else if (t.term === 'null') {
if (value === null || value === undefined) {
color = t[type]
flag = true
}
} else if (t.term === 'not_null') {
if (value !== null && value !== undefined) {
color = t[type]
flag = true
}
} else if (t.term === 'empty') {
if (value === '') {
color = t[type]
flag = true
}
} else if (t.term === 'not_empty') {
if (value !== '') {
color = t[type]
flag = true
}
}
if (flag) {
break
} else if (i === field.conditions.length - 1) {
color = defaultColor
}
} else {
// time
const tv = new Date(t.value + ' GMT+8').getTime()
const v = new Date(value + ' GMT+8').getTime()
if (t.term === 'eq') {
if (v === tv) {
color = t[type]
flag = true
}
} else if (t.term === 'not_eq') {
if (v !== tv) {
color = t[type]
flag = true
}
} else if (t.term === 'lt') {
if (v < tv) {
color = t[type]
flag = true
}
} else if (t.term === 'gt') {
if (v > tv) {
color = t[type]
flag = true
}
} else if (t.term === 'le') {
if (v <= tv) {
color = t[type]
flag = true
}
} else if (t.term === 'ge') {
if (v >= tv) {
color = t[type]
flag = true
}
}
if (flag) {
break
} else if (i === field.conditions.length - 1) {
color = defaultColor
}
}
}
return color
}

View File

@ -44,14 +44,67 @@
<span :title="item.value">{{ item.value }}</span>
</el-col>
<el-col :span="8">
<span :style="{width:'14px', height:'14px', backgroundColor: item.color}" />
<span :style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}" />
</el-col>
</el-row>
</el-col>
</el-col>
</el-col>
<!--编辑阈值-->
<!--表格-->
<el-col v-if="chart.type && (chart.render === 'antv' && chart.type.includes('table'))">
<el-col>
<el-button
:title="$t('chart.edit')"
icon="el-icon-edit"
type="text"
size="small"
style="width: 24px;margin-left: 4px;"
@click="editTableThreshold"
/>
<el-col style="padding: 0 18px;max-height: 500px;overflow-y: auto;">
<el-row v-for="(fieldItem,fieldIndex) in thresholdForm.tableThreshold" :key="fieldIndex">
<el-row class="field-style">
<span>
<svg-icon v-if="fieldItem.field.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="fieldItem.field.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="fieldItem.field.deType === 2 || fieldItem.field.value === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="fieldItem.field.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span :title="fieldItem.field.name" class="field-text">{{ fieldItem.field.name }}</span>
</el-row>
<el-row v-for="(item,index) in fieldItem.conditions" :key="index" class="line-style">
<el-col :span="6">
<span v-if="item.term === 'eq'" :title="$t('chart.filter_eq')">{{ $t('chart.filter_eq') }}</span>
<span v-else-if="item.term === 'not_eq'" :title="$t('chart.filter_not_eq')">{{ $t('chart.filter_not_eq') }}</span>
<span v-else-if="item.term === 'lt'" :title="$t('chart.filter_lt')">{{ $t('chart.filter_lt') }}</span>
<span v-else-if="item.term === 'gt'" :title="$t('chart.filter_gt')">{{ $t('chart.filter_gt') }}</span>
<span v-else-if="item.term === 'le'" :title="$t('chart.filter_le')">{{ $t('chart.filter_le') }}</span>
<span v-else-if="item.term === 'ge'" :title="$t('chart.filter_ge')">{{ $t('chart.filter_ge') }}</span>
<span v-else-if="item.term === 'like'" :title="$t('chart.filter_like')">{{ $t('chart.filter_like') }}</span>
<span v-else-if="item.term === 'not like'" :title="$t('chart.filter_not_like')">{{ $t('chart.filter_not_like') }}</span>
<span v-else-if="item.term === 'null'" :title="$t('chart.filter_null')">{{ $t('chart.filter_null') }}</span>
<span v-else-if="item.term === 'not_null'" :title="$t('chart.filter_not_null')">{{ $t('chart.filter_not_null') }}</span>
<span v-else-if="item.term === 'empty'" :title="$t('chart.filter_empty')">{{ $t('chart.filter_empty') }}</span>
<span v-else-if="item.term === 'not_empty'" :title="$t('chart.filter_not_empty')">{{ $t('chart.filter_not_empty') }}</span>
</el-col>
<el-col :span="6">
<span v-if="!item.term.includes('null') && !item.term.includes('empty')" :title="item.value">{{ item.value }}</span>
<span v-else>&nbsp;</span>
</el-col>
<el-col :span="6">
<span :title="$t('chart.textColor')" :style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}" />
</el-col>
<el-col :span="6">
<span :title="$t('chart.backgroundColor')" :style="{width:'14px', height:'14px', backgroundColor: item.backgroundColor, border: 'solid 1px #e1e4e8'}" />
</el-col>
</el-row>
</el-row>
</el-col>
</el-col>
</el-col>
<!--编辑指标卡阈值-->
<el-dialog
v-if="editLabelThresholdDialog"
v-dialogDrag
@ -60,6 +113,7 @@
:show-close="false"
width="50%"
class="dialog-css"
append-to-body
>
<text-threshold-edit :threshold="thresholdForm.labelThreshold" @onLabelThresholdChange="thresholdChange" />
<div slot="footer" class="dialog-footer">
@ -67,16 +121,36 @@
<el-button type="primary" size="mini" @click="changeLabelThreshold">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
<!--编辑表格阈值-->
<el-dialog
v-if="editTableThresholdDialog"
v-dialogDrag
:title="$t('chart.threshold')"
:visible="editTableThresholdDialog"
:show-close="false"
width="50%"
class="dialog-css"
append-to-body
>
<table-threshold-edit :threshold="thresholdForm.tableThreshold" :chart="chart" @onTableThresholdChange="tableThresholdChange" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeTableThreshold">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="changeTableThreshold">{{ $t('chart.confirm') }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart'
import TextThresholdEdit from '@/views/chart/components/senior/dialog/TextThresholdEdit'
import TableThresholdEdit from '@/views/chart/components/senior/dialog/TableThresholdEdit'
export default {
name: 'Threshold',
components: { TextThresholdEdit },
components: { TableThresholdEdit, TextThresholdEdit },
props: {
chart: {
type: Object,
@ -87,7 +161,9 @@ export default {
return {
thresholdForm: JSON.parse(JSON.stringify(DEFAULT_THRESHOLD)),
editLabelThresholdDialog: false,
thresholdArr: []
thresholdArr: [],
editTableThresholdDialog: false,
tableThresholdArr: []
}
},
watch: {
@ -115,9 +191,14 @@ export default {
if (!this.thresholdForm.labelThreshold) {
this.thresholdForm.labelThreshold = []
}
if (!this.thresholdForm.tableThreshold) {
this.thresholdForm.tableThreshold = []
}
} else {
this.thresholdForm = JSON.parse(JSON.stringify(DEFAULT_THRESHOLD))
}
this.thresholdArr = JSON.parse(JSON.stringify(this.thresholdForm.labelThreshold))
this.tableThresholdArr = JSON.parse(JSON.stringify(this.thresholdForm.tableThreshold))
}
},
changeThreshold() {
@ -192,6 +273,68 @@ export default {
},
thresholdChange(val) {
this.thresholdArr = val
},
tableThresholdChange(val) {
this.tableThresholdArr = val
},
editTableThreshold() {
this.editTableThresholdDialog = true
},
closeTableThreshold() {
this.editTableThresholdDialog = false
},
changeTableThreshold() {
// check line config
for (let i = 0; i < this.tableThresholdArr.length; i++) {
const field = this.tableThresholdArr[i]
if (!field.fieldId) {
this.$message({
message: this.$t('chart.field_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (!field.conditions || field.conditions.length === 0) {
this.$message({
message: this.$t('chart.conditions_can_not_empty'),
type: 'error',
showClose: true
})
return
}
for (let j = 0; j < field.conditions.length; j++) {
const ele = field.conditions[j]
if (!ele.term || ele.term === '') {
this.$message({
message: this.$t('chart.exp_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (!ele.term.includes('null') && !ele.term.includes('empty') && !ele.value) {
this.$message({
message: this.$t('chart.value_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && parseFloat(ele.value).toString() === 'NaN') {
this.$message({
message: this.$t('chart.value_error'),
type: 'error',
showClose: true
})
return
}
}
}
this.thresholdForm.tableThreshold = JSON.parse(JSON.stringify(this.tableThresholdArr))
this.changeThreshold()
this.closeTableThreshold()
}
}
}
@ -253,4 +396,18 @@ span{
.dialog-css >>> .el-dialog__body {
padding: 10px 20px 20px;
}
.field-style{
display: flex;
align-items: center;
justify-content: start;
}
.field-text{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #8492a6;
font-size: 12px;
}
</style>

View File

@ -0,0 +1,397 @@
<template>
<el-col>
<el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addThreshold" />
<div style="max-height: 50vh;overflow-y: auto;">
<div v-for="(fieldItem,fieldIndex) in thresholdArr" :key="fieldIndex" class="field-item">
<el-row style="margin-top: 6px;">
<span class="color-title">{{ $t('chart.field') }}</span>
<el-select v-model="fieldItem.fieldId" size="mini" @change="addField(fieldItem)">
<el-option
v-for="fieldOption in fields"
:key="fieldOption.id"
:label="fieldOption.name"
:value="fieldOption.id"
>
<span style="float: left">
<svg-icon v-if="fieldOption.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="fieldOption.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon
v-if="fieldOption.deType === 2 || fieldOption.value === 3"
icon-class="field_value"
class="field-icon-value"
/>
<svg-icon v-if="fieldOption.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span style="float: left; color: #8492a6; font-size: 12px">{{ fieldOption.name }}</span>
</el-option>
</el-select>
<el-button
type="text"
icon="el-icon-plus"
circle
size="mini"
style="margin-bottom: 10px;margin-left: 10px;"
@click="addConditions(fieldItem)"
/>
<el-button
icon="el-icon-delete"
circle
size="mini"
style="margin-bottom: 10px;float: right;"
@click="removeThreshold(fieldIndex)"
/>
</el-row>
<el-row v-for="(item,index) in fieldItem.conditions" :key="index" class="line-item">
<el-col :span="4">
<el-select v-model="item.term" size="mini" @change="changeThreshold">
<el-option-group
v-for="(group,idx) in fieldItem.options"
:key="idx"
:label="group.label"
>
<el-option
v-for="opt in group.options"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-option-group>
</el-select>
</el-col>
<el-col :span="8" style="text-align: center;">
<el-input
v-show="!item.term.includes('null') && !item.term.includes('empty')"
v-model="item.value"
class="value-item"
:placeholder="$t('chart.drag_block_label_value')"
size="mini"
clearable
@change="changeThreshold"
/>
</el-col>
<el-col :span="4" style="display: flex;align-items: center;justify-content: center;">
<span class="color-title">{{ $t('chart.textColor') }}</span>
<el-color-picker
v-model="item.color"
show-alpha
class="color-picker-style"
:predefine="predefineColors"
@change="changeThreshold"
/>
</el-col>
<el-col :span="4" style="display: flex;align-items: center;justify-content: center;">
<span class="color-title">{{ $t('chart.backgroundColor') }}</span>
<el-color-picker
v-model="item.backgroundColor"
show-alpha
class="color-picker-style"
:predefine="predefineColors"
@change="changeThreshold"
/>
</el-col>
<el-col :span="4">
<el-button
type="text"
icon="el-icon-delete"
circle
style="float: right"
@click="removeCondition(fieldItem,index)"
/>
</el-col>
</el-row>
</div>
</div>
<div class="tip">提示请勿重复选择字段若同一字段重复配置则只有最后的字段配置生效</div>
</el-col>
</template>
<script>
import { COLOR_PANEL } from '@/views/chart/chart/chart'
export default {
name: 'TableThresholdEdit',
props: {
threshold: {
type: Array,
required: true
},
chart: {
type: Object,
required: true
}
},
data() {
return {
thresholdArr: [],
fields: [],
thresholdObj: {
fieldId: '',
field: {},
conditions: []
},
thresholdCondition: {
term: 'eq',
field: '0',
value: '',
color: '#ff0000ff',
backgroundColor: '#ffffffff'
},
textOptions: [
{
label: '',
options: [{
value: 'eq',
label: this.$t('chart.filter_eq')
}, {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
},
{
label: '',
options: [{
value: 'like',
label: this.$t('chart.filter_like')
}, {
value: 'not like',
label: this.$t('chart.filter_not_like')
}]
},
{
label: '',
options: [{
value: 'null',
label: this.$t('chart.filter_null')
}, {
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
},
{
label: '',
options: [{
value: 'empty',
label: this.$t('chart.filter_empty')
}, {
value: 'not_empty',
label: this.$t('chart.filter_not_empty')
}]
}
],
dateOptions: [
{
label: '',
options: [{
value: 'eq',
label: this.$t('chart.filter_eq')
}, {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
},
{
label: '',
options: [{
value: 'lt',
label: this.$t('chart.filter_lt')
}, {
value: 'gt',
label: this.$t('chart.filter_gt')
}]
},
{
label: '',
options: [{
value: 'le',
label: this.$t('chart.filter_le')
}, {
value: 'ge',
label: this.$t('chart.filter_ge')
}]
}
],
valueOptions: [
{
label: '',
options: [{
value: 'eq',
label: this.$t('chart.filter_eq')
}, {
value: 'not_eq',
label: this.$t('chart.filter_not_eq')
}]
},
{
label: '',
options: [{
value: 'lt',
label: this.$t('chart.filter_lt')
}, {
value: 'gt',
label: this.$t('chart.filter_gt')
}]
},
{
label: '',
options: [{
value: 'le',
label: this.$t('chart.filter_le')
}, {
value: 'ge',
label: this.$t('chart.filter_ge')
}]
}
],
predefineColors: COLOR_PANEL
}
},
mounted() {
this.init()
},
methods: {
init() {
this.thresholdArr = JSON.parse(JSON.stringify(this.threshold))
this.initFields()
},
initOptions(item) {
if (item.field) {
if (item.field.deType === 0 || item.field.deType === 5) {
item.options = JSON.parse(JSON.stringify(this.textOptions))
} else if (item.field.deType === 1) {
item.options = JSON.parse(JSON.stringify(this.dateOptions))
} else {
item.options = JSON.parse(JSON.stringify(this.valueOptions))
}
item.conditions && item.conditions.forEach(ele => {
ele.term = ''
})
}
},
initFields() {
//
if (this.chart.type === 'table-info') {
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
this.fields = JSON.parse(JSON.stringify(this.chart.xaxis))
} else {
this.fields = JSON.parse(this.chart.xaxis)
}
} else if (this.chart.type === 'table-pivot') {
if (Object.prototype.toString.call(this.chart.yaxis) === '[object Array]') {
this.fields = JSON.parse(JSON.stringify(this.chart.yaxis))
} else {
this.fields = JSON.parse(this.chart.yaxis)
}
} else {
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
this.fields = this.fields.concat(JSON.parse(JSON.stringify(this.chart.xaxis)))
} else {
this.fields = this.fields.concat(JSON.parse(this.chart.xaxis))
}
if (Object.prototype.toString.call(this.chart.yaxis) === '[object Array]') {
this.fields = this.fields.concat(JSON.parse(JSON.stringify(this.chart.yaxis)))
} else {
this.fields = this.fields.concat(JSON.parse(this.chart.yaxis))
}
}
//
// this.fields = this.fields.filter(ele => ele.deType !== 1)
},
addThreshold() {
this.thresholdArr.push(JSON.parse(JSON.stringify(this.thresholdObj)))
this.changeThreshold()
},
removeThreshold(index) {
this.thresholdArr.splice(index, 1)
this.changeThreshold()
},
changeThreshold() {
this.$emit('onTableThresholdChange', this.thresholdArr)
},
addConditions(item) {
item.conditions.push(JSON.parse(JSON.stringify(this.thresholdCondition)))
this.changeThreshold()
},
removeCondition(item, index) {
item.conditions.splice(index, 1)
this.changeThreshold()
},
addField(item) {
// get field
if (this.fields && this.fields.length > 0) {
this.fields.forEach(ele => {
if (item.fieldId === ele.id) {
item.field = JSON.parse(JSON.stringify(ele))
this.initOptions(item)
}
})
}
this.changeThreshold()
}
}
}
</script>
<style scoped>
.field-item {
width: 100%;
border-radius: 4px;
border: 1px solid #DCDFE6;
padding: 4px 14px;
margin-bottom: 10px;
}
.line-item {
width: 100%;
display: flex;
justify-content: left;
align-items: center;
}
.form-item >>> .el-form-item__label {
font-size: 12px;
}
span {
font-size: 12px;
}
.value-item {
position: relative;
display: inline-block;
}
.select-item {
position: relative;
display: inline-block;
width: 100px !important;
}
.el-select-dropdown__item {
padding: 0 20px;
font-size: 12px;
}
.color-picker-style {
cursor: pointer;
z-index: 1003;
width: 28px;
height: 28px;
}
.color-picker-style >>> .el-color-picker__trigger {
width: 28px;
height: 28px;
}
.color-title {
margin-right: 6px;
color: #909399;
}
.tip {
color: #F56C6C;
font-size: 12px;
}
</style>

View File

@ -207,7 +207,7 @@
class="render-select"
style="width: 100px"
size="mini"
@change="changeChartType()"
@change="changeChartRender()"
>
<el-option
v-for="item in pluginRenderOptions"
@ -697,12 +697,12 @@
<el-tab-pane name="senior" :label="$t('chart.senior')" class="padding-tab" style="width: 350px;">
<el-row class="view-panel">
<div
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge')) || view.type === 'text' || view.type === 'table-normal' || view.type === 'table-info'"
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text' || view.type.includes('table'))"
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
class="attr-style theme-border-class"
>
<el-row
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('table'))"
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type === 'table-normal' || view.type === 'table-info')"
>
<span class="padding-lr">{{ $t('chart.senior_cfg') }}</span>
<el-collapse v-model="attrActiveNames" class="style-collapse">
@ -714,7 +714,7 @@
@onFunctionCfgChange="onFunctionCfgChange"
/>
</el-collapse-item>
<el-collapse-item v-if="view.type && (view.type.includes('table'))" name="scroll" :title="$t('chart.scroll_cfg')">
<el-collapse-item v-if="view.type && (view.type === 'table-normal' || view.type === 'table-info')" name="scroll" :title="$t('chart.scroll_cfg')">
<scroll-cfg
:param="param"
class="attr-selector"
@ -725,7 +725,7 @@
</el-collapse>
</el-row>
<el-row
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text')"
v-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('mix') || view.type.includes('gauge') || view.type === 'text' || (view.render === 'antv' && view.type.includes('table')))"
>
<span class="padding-lr">{{ $t('chart.analyse_cfg') }}</span>
<el-collapse v-model="styleActiveNames" class="style-collapse">
@ -742,7 +742,7 @@
/>
</el-collapse-item>
<el-collapse-item
v-if="view.type && (view.type.includes('gauge') || view.type === 'text')"
v-if="view.type && (view.type.includes('gauge') || view.type === 'text' || (view.render === 'antv' && view.type.includes('table')))"
name="threshold"
:title="$t('chart.threshold')"
>
@ -1469,7 +1469,7 @@ export default {
})
})
},
buildParam(getData, trigger, needRefreshGroup = false, switchType = false) {
buildParam(getData, trigger, needRefreshGroup = false, switchType = false, switchRender = false) {
if (!this.view.resultCount ||
this.view.resultCount === '' ||
isNaN(Number(this.view.resultCount)) ||
@ -1477,6 +1477,9 @@ export default {
parseInt(this.view.resultCount) < 1) {
this.view.resultCount = '1000'
}
if (switchType) {
this.view.senior.threshold.tableThreshold = []
}
if (switchType && (this.view.type === 'table-info' || this.chart.type === 'table-info') && this.view.xaxis.length > 0) {
this.$message({
showClose: true,
@ -1663,9 +1666,9 @@ export default {
delete view.data
return view
},
calcData(getData, trigger, needRefreshGroup = false, switchType = false) {
calcData(getData, trigger, needRefreshGroup = false, switchType = false, switchRender = false) {
this.changeEditStatus(true)
const view = this.buildParam(true, 'chart', false, switchType)
const view = this.buildParam(true, 'chart', false, switchType, switchRender)
if (!view) return
viewEditSave(this.panelInfo.id, view).then(() => {
// this.getData(this.param.id)
@ -2490,6 +2493,10 @@ export default {
this.hasEdit = status
this.$store.commit('recordViewEdit', { viewId: this.param.id, hasEdit: status })
},
changeChartRender() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, false, true)
},
changeChartType() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, true)

View File

@ -609,7 +609,6 @@ export default {
created() {
// Global listening for key events
listenGlobalKeyDown()
this.init(this.$store.state.panel.panelInfo.id)
},
mounted() {
this.initEvents()
@ -622,6 +621,7 @@ export default {
})
})
this.loadMultiplexingViewTree()
this.init(this.$store.state.panel.panelInfo.id)
},
beforeDestroy() {
bus.$off('component-on-drag', this.componentOnDrag)

View File

@ -41,19 +41,16 @@ export default {
}
},
watch: {
// $route(to, from) {
// }
},
mounted() {
bus.$on('to-msg-share', this.toMsgShare)
bus.$on('PanelSwitchComponent', this.panelSwitchComponent)
},
beforeDestroy() {
bus.$off('to-msg-share', this.toMsgShare)
bus.$off('PanelSwitchComponent', this.panelSwitchComponent)
},
created() {
bus.$emit('PanelSwitchComponent', { name: 'PanelMain' })
bus.$on('PanelSwitchComponent', this.panelSwitchComponent)
this.$store.dispatch('app/toggleSideBarHide', true)
const routerParam = this.$router.currentRoute.params
this.toMsgShare(routerParam)

View File

@ -241,6 +241,7 @@ export default {
components: { GrantAuth, LinkGenerate, EditPanel, TreeSelector },
data() {
return {
historyRequestId: null,
lastActiveNode: null, //
lastActiveNodeData: null,
activeTree: 'self', // self system
@ -354,7 +355,7 @@ export default {
watch: {
//
'$store.state.panel.mainActiveName': function(newVal, oldVal) {
if (newVal === 'PanelMain' && this.lastActiveNode && this.lastActiveNodeData) {
if (newVal === 'PanelMain' && this.lastActiveNodeData) {
this.activeNodeAndClickOnly(this.lastActiveNodeData)
}
},
@ -369,14 +370,30 @@ export default {
this.$refs.panel_list_tree.filter(this.filterText)
}
},
beforeDestroy() {
bus.$off('newPanelFromMarket', this.newPanelFromMarket)
},
mounted() {
this.$store.commit('setComponentData', [])
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE_STRING)
this.defaultTree(true)
this.tree(true)
this.initCache()
const routerParam = this.$router.currentRoute.params
if (routerParam && routerParam.nodeType === 'panel' && this.historyRequestId !== routerParam.requestId) {
this.historyRequestId = routerParam.requestId
this.tree()
this.edit(routerParam, null)
} else {
this.tree(true)
}
},
methods: {
newPanelFromMarket(panelInfo) {
if (panelInfo) {
this.tree()
this.edit(panelInfo, null)
}
},
initCache() {
//
this.initLocalStorage.forEach(item => {
@ -730,16 +747,17 @@ export default {
//
activeNodeAndClick(panelInfo) {
if (panelInfo) {
this.$nextTick(() => {
const _this = this
_this.$nextTick(() => {
// CurrentKey
this.$refs.panel_list_tree.setCurrentKey(panelInfo.id)
_this.$refs.panel_list_tree.setCurrentKey(panelInfo.id)
// default_tree
this.$refs.default_panel_tree.setCurrentKey(null)
this.$nextTick(() => {
_this.$refs.default_panel_tree.setCurrentKey(null)
_this.$nextTick(() => {
document.querySelector('.is-current').firstChild.click()
//
if (panelInfo.nodeType === 'panel') {
this.edit(this.lastActiveNodeData, this.lastActiveNode)
_this.edit(this.lastActiveNodeData, this.lastActiveNode)
}
})
})
@ -748,12 +766,16 @@ export default {
//
activeNodeAndClickOnly(panelInfo) {
if (panelInfo) {
this.$nextTick(() => {
const _this = this
_this.$nextTick(() => {
// CurrentKey
this.$refs.panel_list_tree.setCurrentKey(panelInfo.id)
_this.$refs.panel_list_tree.setCurrentKey(panelInfo.id)
// default_tree
this.$refs.default_panel_tree.setCurrentKey(null)
this.$nextTick(() => {
_this.$refs.default_panel_tree.setCurrentKey(null)
if (panelInfo.parents) {
_this.expandedArray = panelInfo.parents
}
_this.$nextTick(() => {
document.querySelector('.is-current').firstChild.click()
})
})

View File

@ -4,7 +4,7 @@
<el-tabs v-model="activeName" class="tab-panel" :stretch="true" @tab-click="handleClick">
<el-tab-pane name="PanelList">
<span slot="label"><i class="el-icon-document tablepanel-i" />{{ $t('panel.panel_list') }}</span>
<panel-list v-if="activeName==='PanelList'" ref="panelList" />
<panel-list v-show="activeName==='PanelList'" ref="panelList" />
</el-tab-pane>
<el-tab-pane name="panels_star" :lazy="true">
<span slot="label"><i class="el-icon-star-off tablepanel-i" />{{ $t('panel.store') }}</span>
@ -51,7 +51,7 @@ export default {
watch: {
//
'$store.state.panel.mainActiveName': function(newVal, oldVal) {
if (newVal === 'PanelMain' && this.lastActiveNode && this.lastActiveNodeData) {
if (newVal === 'PanelMain' && this.lastActiveNodeData) {
this.activeNodeAndClickOnly(this.lastActiveNodeData)
}
},
@ -70,7 +70,7 @@ export default {
localStorage.setItem('plugin-views', null)
this.$store.commit('initViewRender', [])
})
this.clear()
// this.clear()
},
methods: {
handleClick(tab, event) {

View File

@ -0,0 +1,403 @@
<template>
<el-row>
<el-col :class="asideActive?'aside-active':'aside-inActive'">
<svg-icon v-show="!asideActive" icon-class="button_right" class="open-button" @click="asideActiveChange(true)" />
<el-row v-show="asideActive" style="padding: 12px 12px 0 12px ">
<el-row>
<span class="icon iconfont icon-close icon20 insert" @click="closePreview()" />
<span class="main-title">{{$t('panel.template_preview')}}</span>
<span style="float: right" class="icon iconfont icon-icon_up-left_outlined insert icon20" @click="asideActiveChange(false)" />
</el-row>
<el-row class="margin-top16 search-area">
<el-input
v-model="searchText"
size="small"
class="title-name-search"
:placeholder="$t('panel.enter_template_name_tips')"
clearable="true"
/>
<span class="icon iconfont icon-icon-filter insert icon20 filter-icon-span" :class="extFilterActive?'filter-icon-active':''" @click="extFilterActiveChange()" />
</el-row>
<el-row v-show="extFilterActive">
<el-select v-model="marketActiveTab" class="margin-top16" size="small" placeholder="请选择">
<el-option
v-for="item in marketTabs"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-row>
<el-divider />
</el-row>
<el-row v-show="asideActive" class="aside-list" :class="extFilterActive?'aside-list-filter-active':''">
<template-market-preview-item
v-for="(templateItem) in currentMarketTemplateShowList"
v-show="templateItem.showFlag"
:key="templateItem.id"
:template="templateItem"
:base-url="baseUrl"
:active="active(templateItem)"
@previewTemplate="previewTemplate"
/>
</el-row>
</el-col>
<el-col class="main-area" :class="asideActive ? 'main-area-active': ''">
<el-row>
<span v-if="curTemplate" class="template-title">{{ curTemplate.title }}</span>
<el-button style="float: right" type="primary" size="small" @click="templateApply(curTemplate)">{{$t('panel.apply_this_template')}}</el-button>
</el-row>
<el-row class="img-main">
<img height="100%" :src="templatePreviewUrl" alt="">
</el-row>
</el-col>
</el-row>
</template>
<script>
import { searchMarket, getCategories } from '@/api/templateMarket'
import { groupTree, panelSave } from '@/api/panel/panel'
import bus from '@/utils/bus'
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
import TemplateMarketPreviewItem from '@/views/panel/templateMarket/component/TemplateMarketPreviewItem'
export default {
name: 'MarketPreview',
components: { TemplateMarketPreviewItem },
props: {
previewId: {
type: String,
default: null
}
},
data() {
return {
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',
currentMarketTemplateShowList: [],
networkStatus: true,
curTemplate: null
}
},
computed: {
},
watch: {
marketActiveTab() {
this.initTemplateShow()
},
searchText() {
this.initTemplateShow()
},
previewId(val) {
const _this = this
_this.currentMarketTemplateShowList.forEach(template => {
if (val === template.id) {
_this.previewTemplate(template)
}
})
}
},
mounted() {
this.initMarketTemplate()
this.getGroupTree()
},
methods: {
initMarketTemplate() {
searchMarket({}).then(rsp => {
this.baseUrl = rsp.data.baseUrl
this.currentMarketTemplateShowList = rsp.data.contents
}).catch(() => {
this.networkStatus = false
})
getCategories().then(rsp => {
this.marketTabs = rsp.data
this.marketActiveTab = this.marketTabs[0]
}).catch(() => {
this.networkStatus = false
})
if (this.previewId) {
const _this = this
_this.currentMarketTemplateShowList.forEach(template => {
if (_this.previewId === template.id) {
_this.previewTemplate(template)
}
})
}
},
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.$emit('templateApply', template)
},
closeDialog() {
this.$emit('closeDialog')
},
handleClick(item) {
},
initTemplateShow() {
this.currentMarketTemplateShowList.forEach(template => {
template.showFlag = this.templateShow(template)
})
},
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
},
closePreview() {
this.$emit('closePreview')
},
active(template) {
return this.curTemplate && this.curTemplate.id === template.id
}
}
}
</script>
<style lang="scss" scoped>
.aside-list {
padding: 0px 12px 12px 12px;
width: 100%;
height: calc(100vh - 200px);
overflow-x: hidden;
overflow-y: auto;
}
.aside-list-filter-active {
height: calc(100vh - 250px);
}
.template-main {
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-bottom: 24px;
min-height: calc(100vh - 190px);
}
.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: 80vh;
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
flex-flow: row nowrap;
color: #9ea6b2;
}
.aside-active {
width: 206px;
height: calc(100vh - 56px);
overflow-x: hidden;
overflow-y: auto;
border-right: 1px solid rgba(31,31,31,0.15);
}
.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;
}
.insert {
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;
}
}
.template-title{
float: left;
font-weight: 500;
font-size: 20px;
line-height: 28px;
margin-bottom: 24px;
}
.margin-top16 {
margin-top: 16px;
}
.img-main{
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: 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: 5px;
margin-left: 8px;
}
.filter-icon-active{
border: 1px solid #3370FF;
color: #3370FF;
}
.search-area{
width: 100%;
position: relative;
}
</style>

View File

@ -0,0 +1,116 @@
<template>
<div class="testcase-template">
<el-row class="template-img" :style="classBackground" />
<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>
export default {
name: 'TemplateMarketItem',
props: {
template: {
type: Object,
default() {
return {}
}
},
baseUrl: {
type: String
}
},
data() {
return {
}
},
computed: {
classBackground() {
return {
background: `url(${this.thumbnailUrl}) no-repeat`,
'background-size': `100% 100%`
}
},
thumbnailUrl() {
if (this.template.thumbnail.indexOf('http') > -1) {
return this.template.thumbnail
} else {
return this.baseUrl + this.template.thumbnail
}
}
},
methods: {
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: 24px 0 0 24px;
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;
height: 256px;
}
.demonstration {
display: block;
font-size: 16px;
text-align: left;
margin-left: 12px;
margin-top: 12px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.template-img {
background-size: 100% 100%;
height: 180px;
width: 318px;
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: 318px;
}
</style>

View File

@ -0,0 +1,112 @@
<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.title }}</span>
</div>
</template>
<script>
export default {
name: 'TemplateMarketPreviewItem',
props: {
template: {
type: Object,
default() {
return {}
}
},
baseUrl: {
type: String
},
active: {
type: Boolean,
required: false,
default: false
}
},
data() {
return {
}
},
computed: {
classBackground() {
return {
background: `url(${this.thumbnailUrl}) no-repeat`,
'background-size': `100% 100%`
}
},
thumbnailUrl() {
if (this.template.thumbnail.indexOf('http') > -1) {
return this.template.thumbnail
} else {
return this.baseUrl + this.template.thumbnail
}
}
},
methods: {
previewTemplate() {
this.$emit('previewTemplate', this.template)
}
}
}
</script>
<style scoped>
.template-item-main {
margin: 0 0 12px 0;
position: relative;
box-sizing: border-box;
width: 182px;
height: 116px;
background: #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 ;
}
.template-item-img{
position: absolute;
width: 182px;
height: 86px;
left: 0px;
top: 0px;
}
.demonstration {
position: absolute;
width: 166px;
height: 20px;
left: 8px;
top: 91px;
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 2px gray;
}
</style>

View File

@ -0,0 +1,275 @@
<template>
<el-row class="outer-body">
<!--预览模式-->
<MarketPreview v-show="previewModel" :preview-id="templatePreviewId" @closePreview="previewModel=false" @templateApply="templateApply" />
<!--列表模式-->
<el-row v-show="!previewModel" class="market-main">
<el-row>
<el-col span="12">
<span class="title-left">{{ $t('panel.template_market') }}</span>
</el-col>
<el-col span="12">
<el-input v-model="searchText" size="small" class="title-right" :placeholder="$t('panel.enter_template_name_tips')" clearable="true" />
</el-col>
</el-row>
<el-row>
<el-tabs v-model="marketActiveTab" @tab-click="handleClick">
<el-tab-pane v-for="tabItem in marketTabs" :key="tabItem" :label="tabItem" :name="tabItem" />
</el-tabs>
</el-row>
<el-row v-if="networkStatus" class="template-main">
<el-row v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<template-market-item
v-for="(templateItem) in currentMarketTemplateShowList"
v-show="templateItem.showFlag"
:key="templateItem.id"
:template="templateItem"
:base-url="baseUrl"
@templateApply="templateApply"
@templatePreview="templatePreview"
/>
</el-row>
</el-row>
<el-row v-else class="custom-position">
{{ $t('panel.market_network_tips') }}
</el-row>
</el-row>
<el-dialog
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:title="$t('panel.apply_template')"
:visible.sync="folderSelectShow"
width="500px"
class="dialog-css"
append-to-body="true"
:destroy-on-close="true"
>
<el-form ref="panelForm" :model="panelForm" label-width="80px">
<el-form-item :label="$t('panel.name')">
<el-input v-model="panelForm.name" :placeholder="$t('panel.enter_name_tips')" />
</el-form-item>
<el-form-item :label="$t('commons.folder')">
<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 { searchMarket, getCategories } from '@/api/templateMarket'
import TemplateMarketItem from '@/views/panel/templateMarket/component/TemplateMarketItem'
import { groupTree, panelSave } from '@/api/panel/panel'
import bus from '@/utils/bus'
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
import MarketPreview from '@/views/panel/templateMarket/component/MarketPreview'
export default {
name: 'TemplateMarket',
components: { MarketPreview, TemplateMarketItem },
data() {
return {
previewModel: false,
previewVisible: false,
templatePreviewId: '',
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',
currentMarketTemplateShowList: [],
networkStatus: true
}
},
computed: {
},
watch: {
marketActiveTab() {
this.initTemplateShow()
},
searchText() {
this.initTemplateShow()
}
},
mounted() {
this.initMarketTemplate()
this.getGroupTree()
},
methods: {
initMarketTemplate() {
searchMarket({}).then(rsp => {
this.baseUrl = rsp.data.baseUrl
this.currentMarketTemplateShowList = rsp.data.contents
}).catch(() => {
this.networkStatus = false
})
getCategories().then(rsp => {
this.marketTabs = rsp.data
this.marketActiveTab = this.marketTabs[0]
}).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) {
},
initTemplateShow() {
this.currentMarketTemplateShowList.forEach(template => {
template.showFlag = this.templateShow(template)
})
},
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
},
templatePreview(previewId) {
this.templatePreviewId = previewId
this.previewModel = true
},
newPanel() {
}
}
}
</script>
<style lang="scss" scoped>
.template-main{
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-bottom: 24px;
min-height: calc(100vh - 190px);
}
.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: 80vh;
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
flex-flow: row nowrap;
color: #9ea6b2;
}
.outer-body{
width: 100%;
height: calc(100vh - 56px);
}
</style>

View File

@ -3,13 +3,13 @@
<el-row>
<el-col>
<el-form
ref="DsConfig"
:model="form"
:rules="rule"
size="small"
:disabled="disabled"
label-width="180px"
label-position="right"
ref="DsConfig"
:model="form"
:rules="rule"
size="small"
:disabled="disabled"
label-width="180px"
label-position="right"
>
<el-form-item v-if="form.type == 'api'" :label="$t('datasource.data_table')">
<el-col>
@ -46,12 +46,13 @@
<el-dialog :title="api_table_title" :visible="edit_api_item" :before-close="closeEditItem" width="60%"
class="dialog-css" append-to-body>
<el-steps :active="active" align-center>
<el-step title="步骤 1"></el-step>
<el-step title="步骤 2"></el-step>
<el-step :title="$t('datasource.api_step_1')"></el-step>
<el-step :title="$t('datasource.api_step_2')"></el-step>
</el-steps>
<el-row v-show="active === 1">
<el-form ref="apiItem" size="small" :model="apiItem" label-width="100px" :rules="rule">
<el-form ref="apiItem" size="small" :model="apiItem" label-position="top" label-width="100px"
:rules="rule">
<p class="tip">{{ $t('datasource.base_info') }} </p>
<el-form-item :label="$t('commons.name')" prop="name">
@ -76,34 +77,74 @@
</el-form-item>
</div>
<el-form-item :label="$t('datasource.data_path')" prop="dataPath">
<el-input :placeholder="$t('datasource.data_path_desc')" v-model="apiItem.dataPath"
autocomplete="off"/>
</el-form-item>
</el-form>
</el-row>
<el-row v-show="active === 2">
<el-tabs v-model="api_step2_active_name">
<el-tab-pane :label="$t('dataset.data_preview')" name="first">
<ux-grid ref="plxTable" size="mini" style="width: 100%;" :height="height"
:checkbox-config="{highlight: true}" :width-resize="true">
<ux-table-column v-for="field in apiItem.fields" :key="field.originName" min-width="200px"
:field="field.originName" :resizable="true">
<template slot="header">
<svg-icon v-if="field.deExtractType === 0" icon-class="field_text" class="field-icon-text"/>
<svg-icon v-if="field.deExtractType === 1" icon-class="field_time" class="field-icon-time"/>
<svg-icon v-if="field.deExtractType === 2 || field.deExtractType === 3" icon-class="field_value"
class="field-icon-value"/>
<svg-icon v-if="field.deExtractType === 5" icon-class="field_location"
class="field-icon-location"/>
<span>{{ field.name }}</span>
</template>
</ux-table-column>
</ux-grid>
</el-tab-pane>
</el-tabs>
<el-form ref="apiItem" size="small" :model="apiItem" label-position="top" label-width="100px"
:rules="rule">
<p class="tip">{{ $t('datasource.column_info') }} </p>
<el-table :data="apiItem.jsonFields" style="width: 100%;" row-key="id">
<el-table-column prop="date" label="" width="255">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.checked" :key="scope.row.id"
@change="handleCheckAllChange(scope.row)">
{{ scope.row.originName }}
</el-checkbox>
</template>
</el-table-column>
<el-table-column prop="name" :label="$t('dataset.field_rename')">
<template slot-scope="scope">
<el-input size="mini" type="text" v-model="scope.row.name" @change="fieldNameChange(scope.row)"/>
</template>
</el-table-column>
<el-table-column prop="deExtractType" :label="$t('dataset.field_type')">
<template slot-scope="scope">
<el-select v-model="scope.row.deExtractType" size="mini"
style="display: inline-block;width: 120px;" @change="fieldTypeChange(scope.row)">
<el-option
v-for="item in fieldOptions"
:key="item.value"
:label="item.label"
:value="item.value">
<span style="float: left">
<svg-icon v-if="item.value === '0'" icon-class="field_text" class="field-icon-text"/>
<svg-icon v-if="item.value === '2' || item.value === '3'" icon-class="field_value"
class="field-icon-value"/>
</span>
<span style="float: left; color: #8492a6; font-size: 12px">{{ item.label }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
<p class="tip">{{ $t('dataset.data_preview') }} </p>
<ux-grid ref="plxTable" size="mini" style="width: 100%;" :height="height"
:checkbox-config="{highlight: true}" :width-resize="true">
<ux-table-column v-for="field in apiItem.fields" :key="field.name + field.deExtractType"
min-width="200px"
:field="field.name" :resizable="true">
<template slot="header">
<svg-icon v-if="field.deExtractType === 0" icon-class="field_text" class="field-icon-text"/>
<svg-icon v-if="field.deExtractType === 1" icon-class="field_time" class="field-icon-time"/>
<svg-icon v-if="field.deExtractType === 2 || field.deExtractType === 3" icon-class="field_value"
class="field-icon-value"/>
<svg-icon v-if="field.deExtractType === 5" icon-class="field_location"
class="field-icon-location"/>
<span>{{ field.name }}</span>
</template>
</ux-table-column>
</ux-grid>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button @click="closeEditItem">{{ $t('commons.cancel') }}</el-button>
<el-button @click="next" :disabled="disabledNext" v-show="active === 1">{{
$t('fu.steps.next')
}}
@ -143,14 +184,14 @@
<el-form-item v-if="form.type=='hive' " :label="$t('datasource.auth_method')">
<el-select
v-model="form.configuration.authMethod"
class="select-width"
v-model="form.configuration.authMethod"
class="select-width"
>
<el-option
v-for="item in authMethodList"
:key="item.id"
:label="item.label"
:value="item.id"
v-for="item in authMethodList"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select>
</el-form-item>
@ -164,7 +205,7 @@
:label="$t('datasource.keytab_Key_path')">
<el-input v-model="form.configuration.password" autocomplete="off" show-password/>
<p>
{{$t('datasource.kerbers_info')}}
{{ $t('datasource.kerbers_info') }}
</p>
</el-form-item>
@ -172,13 +213,15 @@
</span>
<el-form-item v-if="form.type !== 'es' && form.type !== 'api' && form.configuration.authMethod !== 'kerberos'"
:label="$t('datasource.user_name')">
<el-form-item
v-if="form.type !== 'es' && form.type !== 'api' && form.configuration.authMethod !== 'kerberos'"
:label="$t('datasource.user_name')">
<el-input v-model="form.configuration.username" autocomplete="off"/>
</el-form-item>
<el-form-item v-if="form.type !== 'es' && form.type !== 'api' && form.configuration.authMethod !== 'kerberos'"
:label="$t('datasource.password')">
<el-form-item
v-if="form.type !== 'es' && form.type !== 'api' && form.configuration.authMethod !== 'kerberos'"
:label="$t('datasource.password')">
<el-input v-model="form.configuration.password" autocomplete="off" show-password/>
</el-form-item>
@ -203,7 +246,7 @@
</el-form-item>
<el-form-item
v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'">
v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'">
<el-button icon="el-icon-plus" size="mini" @click="getSchema()">{{
$t('datasource.get_schema')
}}
@ -211,8 +254,8 @@
</el-form-item>
<el-form-item
v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
:label="$t('datasource.schema')">
v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
:label="$t('datasource.schema')">
<el-select v-model="form.configuration.schema" filterable
:placeholder="$t('datasource.please_choose_schema')"
class="select-width">
@ -248,7 +291,8 @@
<el-form-item :label="$t('datasource.max_pool_size')" prop="configuration.maxPoolSize">
<el-input v-model="form.configuration.maxPoolSize" autocomplete="off" type="number" min="0"/>
</el-form-item>
<el-form-item v-if="datasourceType.isJdbc" :label="$t('datasource.query_timeout')" prop="configuration.queryTimeout">
<el-form-item v-if="datasourceType.isJdbc" :label="$t('datasource.query_timeout')"
prop="configuration.queryTimeout">
<el-input v-model="form.configuration.queryTimeout" autocomplete="off" type="number" min="0"/>
</el-form-item>
</el-collapse-item>
@ -413,7 +457,9 @@ export default {
},
authManager: {}
},
fields: []
fields: [],
jsonFields: [],
maxPreviewNum: ''
},
reqOptions: [{id: 'GET', label: 'GET'}, {id: 'POST', label: 'POST'}],
loading: false,
@ -435,7 +481,12 @@ export default {
}, {
id: 'kerberos',
label: 'Kerberos'
}]
}],
fieldOptions: [
{label: this.$t('dataset.text'), value: 0},
{label: this.$t('dataset.value'), value: 2},
{label: this.$t('dataset.value') + '(' + this.$t('dataset.float') + ')', value: 3},
],
}
},
created() {
@ -488,8 +539,10 @@ export default {
this.apiItem.status = 'Success'
this.$success(i18n.t('commons.success'))
this.active++
this.apiItem.fields = res.data.fields
this.$refs.plxTable.reloadData(res.data.datas)
this.apiItem.jsonFields = res.data.jsonFields
this.apiItem.maxPreviewNum = res.data.maxPreviewNum
this.handleFiledChange();
this.previewData()
}).catch(res => {
this.loading = false
this.disabledNext = false
@ -534,30 +587,50 @@ export default {
deleteItem(item) {
this.form.apiConfiguration.splice(this.form.apiConfiguration.indexOf(item), 1)
},
validateApi(item) {
if (undefined) {
} else {
this.$refs.apiItem.validate(valid => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.apiItem))
data.request = JSON.stringify(data.request)
this.loading = true
checkApiDatasource(data).then(res => {
this.loading = false
this.$success(i18n.t('commons.success'))
this.apiItem.fields = res.data.fields
this.$refs.plxTable.reloadData(res.data.datas)
}).catch(res => {
this.loading = false
})
} else {
return false
}
})
handleCheckAllChange(row) {
this.handleCheckChange(row)
this.handleFiledChange()
this.previewData()
},
handleFiledChange(data) {
this.apiItem.fields = []
let jsonField = data === undefined ? this.apiItem.jsonFields : data;
jsonField.forEach((item) => {
if (item.checked && item.children === null) {
this.apiItem.fields.push(item)
}
if (item.children !== null) {
this.handleFiledChange(item.children)
}
})
},
previewData() {
let datas = [];
for (let i = 0; i < this.apiItem.maxPreviewNum; i++) {
datas.push({})
}
}
for (let i = 0; i < this.apiItem.fields.length; i++) {
for (let j = 0; j < this.apiItem.fields[i].value.length; j++) {
this.$set(datas[j], this.apiItem.fields[i].name , this.apiItem.fields[i].value[j]);
}
}
this.$refs.plxTable.reloadData(datas)
},
handleCheckChange(node) {
if (node.children !== null) {
node.children.forEach((item) => {
item.checked = node.checked;
this.handleCheckChange(item)
});
}
},
fieldNameChange(row) {
this.previewData()
},
fieldTypeChange(row) {
}
}
}
</script>
@ -586,4 +659,12 @@ export default {
float: right;
margin-right: 45px;
}
.tip {
padding: 3px 5px;
font-size: 16px;
border-radius: 0;
border-left: 4px solid #409EFF;
margin: 5px 5px 10px 5px;
}
</style>