commit
342f22b6dd
6
.gitignore
vendored
6
.gitignore
vendored
@ -59,3 +59,9 @@ pnpm-debug.log*
|
||||
.flattened-pom.xml
|
||||
|
||||
package-lock.json
|
||||
/core/core-frontend/
|
||||
/core/core-backend/
|
||||
/sdk/common/
|
||||
/sdk/distributed/
|
||||
/sdk/api/
|
||||
/de-xpack/
|
||||
@ -132,6 +132,7 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/dataset/field/linkMultFieldValues", "link");
|
||||
filterChainDefinitionMap.put("/dataset/field/linkMappingFieldValues", "link");
|
||||
filterChainDefinitionMap.put("/systemInfo/proxyUserLoginInfo", ANON);
|
||||
filterChainDefinitionMap.put("/system/onlineMapKey", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/**", "authc");
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.service.panel.PanelLinkService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -29,6 +30,9 @@ public class IndexController {
|
||||
@Resource
|
||||
private PanelLinkService panelLinkService;
|
||||
|
||||
@Value("${server.servlet.context-path:#{null}}")
|
||||
private String contextPath;
|
||||
|
||||
@GetMapping(value = "/")
|
||||
public String index() {
|
||||
return "index.html";
|
||||
@ -52,6 +56,9 @@ public class IndexController {
|
||||
} else {
|
||||
url = panelLinkService.getUrlByUuid(index);
|
||||
}
|
||||
if (StringUtils.isNotBlank(contextPath)) {
|
||||
url = contextPath + url;
|
||||
}
|
||||
HttpServletResponse response = ServletUtils.response();
|
||||
try {
|
||||
// TODO 增加仪表板外部参数
|
||||
|
||||
@ -4,6 +4,7 @@ package io.dataease.controller.sys;
|
||||
import io.dataease.commons.constants.ParamConstants;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
import io.dataease.controller.sys.request.OnlineMapKeyRequest;
|
||||
import io.dataease.controller.sys.response.BasicInfo;
|
||||
import io.dataease.controller.sys.response.MailInfo;
|
||||
import io.dataease.dto.SystemParameterDTO;
|
||||
@ -165,4 +166,13 @@ public class SystemParameterController {
|
||||
return systemParameterService.defaultLoginType();
|
||||
}
|
||||
|
||||
@GetMapping("/onlineMapKey")
|
||||
public String onlineMapKey() {
|
||||
return systemParameterService.onlineMapKey();
|
||||
}
|
||||
|
||||
@PostMapping("/saveMapKey")
|
||||
public void saveOnlineKey(@RequestBody OnlineMapKeyRequest request) {
|
||||
systemParameterService.saveMapKey(request.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package io.dataease.controller.sys.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OnlineMapKeyRequest implements Serializable {
|
||||
public String key;
|
||||
}
|
||||
@ -20,4 +20,6 @@ public class AxisChartDataAntVDTO {
|
||||
private BigDecimal popSize;
|
||||
private String group;
|
||||
private BigDecimal extValue;
|
||||
|
||||
private Object x;
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package io.dataease.dto.chart;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author LBOO
|
||||
*/
|
||||
@Data
|
||||
public class ChartSeniorThresholdDTO {
|
||||
private String field;
|
||||
private String term;
|
||||
private ChartSeniorAssistDTO targetField;
|
||||
private ChartSeniorAssistDTO maxField;
|
||||
private ChartSeniorAssistDTO minField;
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -14,26 +15,27 @@ public class MysqlConfiguration extends JdbcConfiguration {
|
||||
|
||||
private String driver = "com.mysql.jdbc.Driver";
|
||||
private String extraParams = "characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull";
|
||||
private List<String> illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations");
|
||||
private List<String> illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations", "allowloadlocalinfile", "allowUrlInLocalInfile", "allowLoadLocalInfileInPath");
|
||||
|
||||
public String getJdbc() {
|
||||
if (StringUtils.isEmpty(extraParams.trim())) {
|
||||
return "jdbc:mysql://HOSTNAME:PORT/DATABASE"
|
||||
.replace("HOSTNAME", getHost().trim())
|
||||
.replace("PORT", getPort().toString().trim())
|
||||
.replace("DATABASE", getDataBase().trim());
|
||||
return "jdbc:mysql://HOSTNAME:PORT/DATABASE".replace("HOSTNAME", getHost().trim()).replace("PORT", getPort().toString().trim()).replace("DATABASE", getDataBase().trim());
|
||||
} else {
|
||||
for (String illegalParameter : illegalParameters) {
|
||||
if (getExtraParams().contains(illegalParameter)) {
|
||||
for (String illegalParameter : getIllegalParameters()) {
|
||||
if (getExtraParams().toLowerCase().contains(illegalParameter.toLowerCase())) {
|
||||
throw new RuntimeException("Illegal parameter: " + illegalParameter);
|
||||
}
|
||||
}
|
||||
|
||||
return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
|
||||
.replace("HOSTNAME", getHost().trim())
|
||||
.replace("PORT", getPort().toString().trim())
|
||||
.replace("DATABASE", getDataBase().trim())
|
||||
.replace("EXTRA_PARAMS", getExtraParams().trim());
|
||||
return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS".replace("HOSTNAME", getHost().trim()).replace("PORT", getPort().toString().trim()).replace("DATABASE", getDataBase().trim()).replace("EXTRA_PARAMS", getExtraParams().trim());
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getIllegalParameters(){
|
||||
List<String> newIllegalParameters = new ArrayList<>();
|
||||
newIllegalParameters.addAll(illegalParameters);
|
||||
newIllegalParameters.addAll(Arrays.asList("allowloadlocalinfile", "allowUrlInLocalInfile", "allowLoadLocalInfileInPath"));
|
||||
return newIllegalParameters;
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,7 +3,6 @@ package io.dataease.map.service;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import io.dataease.plugins.common.base.domain.ChartView;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewExample;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
@ -40,17 +39,20 @@ public class MapTransferService {
|
||||
|
||||
private static final String FULL_FILE_SUFFIX = "_full.json";
|
||||
|
||||
private static final List<String> coverFileNameList = new ArrayList<>();
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
MATCH_TYPES.add("map");
|
||||
MATCH_TYPES.add("buddle-map");
|
||||
coverFileNameList.add("350200_full.json");
|
||||
}
|
||||
|
||||
@Resource
|
||||
private ChartViewMapper chartViewMapper;
|
||||
|
||||
|
||||
|
||||
public void execute() {
|
||||
ChartViewExample example = new ChartViewExample();
|
||||
List<ChartViewWithBLOBs> chartViews = chartViewMapper.selectByExampleWithBLOBs(example);
|
||||
@ -70,7 +72,7 @@ public class MapTransferService {
|
||||
String chinaRootPath = geoPath + FULL_KEY + FILE_SEPARATOR;
|
||||
File chinaRootDir = new File(chinaRootPath);
|
||||
File[] files = chinaRootDir.listFiles();
|
||||
if(ArrayUtil.isEmpty(files)) return;
|
||||
if (ArrayUtil.isEmpty(files)) return;
|
||||
Map<String, List<File>> listMap = Arrays.stream(files).filter(FileUtil::isFile).collect(Collectors.groupingBy(this::fileType));
|
||||
if (ObjectUtils.isEmpty(listMap)) return;
|
||||
moveFiles(listMap, BORDER_KEY);
|
||||
@ -86,7 +88,7 @@ public class MapTransferService {
|
||||
String fileName = file.getName();
|
||||
String newFilePath = dirPath + GLOBAL_CHINA_PREFIX + FILE_SEPARATOR + GLOBAL_CHINA_PREFIX + fileName;
|
||||
File target = new File(newFilePath);
|
||||
if(!target.exists()) {
|
||||
if (coverFileNameList.contains(fileName) || !target.exists()) {
|
||||
FileUtil.move(file, target, true);
|
||||
}
|
||||
});
|
||||
@ -128,7 +130,7 @@ public class MapTransferService {
|
||||
|
||||
private Boolean customMatch(Map<String, Object> customAttrMap) {
|
||||
Object codeObj = null;
|
||||
if((codeObj = customAttrMap.get(AREA_CODE_KEY)) != null) {
|
||||
if ((codeObj = customAttrMap.get(AREA_CODE_KEY)) != null) {
|
||||
String code = codeObj.toString();
|
||||
boolean matych = code.length() == 6;
|
||||
customAttrMap.put(AREA_CODE_KEY, GLOBAL_CHINA_PREFIX + code);
|
||||
|
||||
@ -281,7 +281,7 @@ public class ApiProvider extends Provider {
|
||||
JSONArray jsonArray = jsonObject.getJSONArray(s);
|
||||
List<JSONObject> childrenField = new ArrayList<>();
|
||||
for (Object object : jsonArray) {
|
||||
handleStr(apiDefinition, JSON.toJSONString(object, SerializerFeature.WriteMapNullValue), childrenField, rootPath + "." + s + "[*]");
|
||||
handleStr(apiDefinition, JSON.toJSONString(object, SerializerFeature.WriteMapNullValue), childrenField, rootPath + "." + String.format(path, s) + "[*]");
|
||||
}
|
||||
o.put("children", childrenField);
|
||||
o.put("childrenDataType", "LIST");
|
||||
|
||||
@ -102,6 +102,18 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
int originSize = fields.size();
|
||||
List<String> fieldList = fields.stream().map(DatasetTableField::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
sortFields.forEach(item -> {
|
||||
int indexOf = fieldList.indexOf(item.getId());
|
||||
if (indexOf == -1) {
|
||||
fields.add(item);
|
||||
} else {
|
||||
fields.set(indexOf, item);
|
||||
}
|
||||
});
|
||||
}
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(fields)) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
@ -113,7 +125,15 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
|
||||
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
|
||||
} else {
|
||||
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
|
||||
if (f.getDeType() == 2 || f.getDeType() == 3) {
|
||||
if (f.getDeExtractType() == 1) {
|
||||
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
|
||||
} else {
|
||||
originField = String.format(DorisConstants.CAST, String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName()), DorisConstants.DEFAULT_FLOAT_FORMAT);
|
||||
}
|
||||
} else {
|
||||
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
|
||||
}
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
String fieldName = "";
|
||||
@ -151,6 +171,14 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
.fieldName(fieldName)
|
||||
.fieldAlias(fieldAlias)
|
||||
.build());
|
||||
if (f instanceof DeSortField) {
|
||||
DeSortField x = (DeSortField) f;
|
||||
xOrders.add(SQLObj.builder()
|
||||
.orderField(originField)
|
||||
.orderAlias(fieldAlias)
|
||||
.orderDirection(x.getOrderDirection())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,19 +198,27 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
int step = fields.size();
|
||||
for (int i = step; i < (step + sortFields.size()); i++) {
|
||||
DeSortField deSortField = sortFields.get(i - step);
|
||||
SQLObj order = buildSortField(deSortField, tableObj, i);
|
||||
xOrders.add(order);
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(xOrders)) {
|
||||
st_sql.add("orders", xOrders);
|
||||
}
|
||||
String sql = st_sql.render();
|
||||
ST st = stg.getInstanceOf("previewSql");
|
||||
st.add("isGroup", false);
|
||||
SQLObj tableSQL = SQLObj.builder()
|
||||
.tableName(String.format(DorisConstants.BRACKETS, sql))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
|
||||
.build();
|
||||
st.add("table", tableSQL);
|
||||
|
||||
return st_sql.render();
|
||||
List<SQLObj> outFieldList = new ArrayList<>();
|
||||
for (int i = 0; i < originSize; i++) {
|
||||
SQLObj fieldObj = xFields.get(i);
|
||||
String outFieldAlias = tableSQL.getTableAlias() + "." + fieldObj.getFieldAlias();
|
||||
outFieldList.add(SQLObj.builder().fieldName(outFieldAlias).fieldAlias(fieldObj.getFieldAlias()).build());
|
||||
}
|
||||
st.add("groups", outFieldList);
|
||||
if (CollectionUtils.isNotEmpty(xOrders)) {
|
||||
st.add("orders", xOrders);
|
||||
return st.render() + " LIMIT 0, 10000000";
|
||||
}
|
||||
return st.render();
|
||||
}
|
||||
|
||||
private SQLObj buildSortField(DeSortField f, SQLObj tableObj, int i) {
|
||||
@ -595,16 +631,34 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(DorisConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -632,6 +686,9 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -707,8 +764,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + table + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + table + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -580,16 +580,34 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MysqlConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -617,6 +635,9 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -689,8 +710,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + table + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + table + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -111,12 +111,12 @@ public class ApiProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String s, List<ChartViewFieldDTO> list, List<ChartViewFieldDTO> list1, List<ChartFieldCustomFilterDTO> list2, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> list3, List<ChartViewFieldDTO> list4, Datasource datasource, ChartViewWithBLOBs chartViewWithBLOBs) {
|
||||
public String getSQLScatter(String s, List<ChartViewFieldDTO> list, List<ChartViewFieldDTO> list1, List<ChartFieldCustomFilterDTO> list2, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> list3, List<ChartViewFieldDTO> list4, List<ChartViewFieldDTO> extGroup, Datasource datasource, ChartViewWithBLOBs chartViewWithBLOBs) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String s, List<ChartViewFieldDTO> list, List<ChartViewFieldDTO> list1, List<ChartFieldCustomFilterDTO> list2, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> list3, List<ChartViewFieldDTO> list4, ChartViewWithBLOBs chartViewWithBLOBs) {
|
||||
public String getSQLAsTmpScatter(String s, List<ChartViewFieldDTO> list, List<ChartViewFieldDTO> list1, List<ChartFieldCustomFilterDTO> list2, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> list3, List<ChartViewFieldDTO> list4, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs chartViewWithBLOBs) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -611,16 +611,34 @@ public class CKQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(CKConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -648,6 +666,9 @@ public class CKQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -720,8 +741,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1417,7 +1438,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
|
||||
@Override
|
||||
public String sqlForPreview(String table, Datasource ds) {
|
||||
return "SELECT * FROM " + String.format(CKConstants.KEYWORD_TABLE, table);
|
||||
return "SELECT * FROM " + String.format(CKConstants.KEYWORD_TABLE, table);
|
||||
}
|
||||
|
||||
public List<Dateformat> dateformat() {
|
||||
|
||||
@ -598,7 +598,7 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(Db2Constants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -606,9 +606,27 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -636,6 +654,9 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -708,8 +729,8 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -605,16 +605,34 @@ public class EsQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(EsSqlLConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -646,6 +664,9 @@ public class EsQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -722,8 +743,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -350,13 +350,14 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
|
||||
@Override
|
||||
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
|
||||
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + " , " + pageInfo.getPageSize(): "");
|
||||
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + " , " + pageInfo.getPageSize() : "");
|
||||
if (isTable) {
|
||||
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
|
||||
} else {
|
||||
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
|
||||
}
|
||||
}
|
||||
|
||||
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(HiveConstants.KEYWORD_TABLE, table))
|
||||
@ -431,9 +432,10 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
|
||||
return st.render();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -562,16 +564,34 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(HiveConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -599,6 +619,9 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -671,8 +694,8 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -771,9 +794,9 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
|
||||
if(isTable){
|
||||
if (isTable) {
|
||||
return "SELECT COUNT(*) from " + String.format(HiveConstants.KEYWORD_TABLE, sql);
|
||||
}else {
|
||||
} else {
|
||||
return "SELECT COUNT(*) from ( " + sqlFix(sql) + " ) DE_COUNT_TEMP";
|
||||
}
|
||||
}
|
||||
@ -1039,17 +1062,17 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
if (field.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
|
||||
String date = String.format(HiveConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT);
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = date;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(HiveConstants.DATE_FORMAT, date, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
String cast = String.format(HiveConstants.CAST, originName, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
whereName = String.format(HiveConstants.FROM_UNIXTIME, cast, HiveConstants.DEFAULT_DATE_FORMAT);
|
||||
}else {
|
||||
} else {
|
||||
String cast = String.format(HiveConstants.CAST, originName, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
whereName = String.format(HiveConstants.FROM_UNIXTIME, cast, format);
|
||||
}
|
||||
@ -1057,9 +1080,9 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
whereName = String.format(HiveConstants.FROM_UNIXTIME, cast, format);
|
||||
}
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_TIME) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = originName;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(HiveConstants.DATE_FORMAT, originName, format);
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
|
||||
fieldName = String.format(ImpalaConstants.CAST, originField, ImpalaConstants.DEFAULT_FLOAT_FORMAT);
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
} else {
|
||||
fieldName = originField;
|
||||
}
|
||||
@ -201,7 +201,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
|
||||
fieldName = String.format(ImpalaConstants.CAST, originField, ImpalaConstants.DEFAULT_FLOAT_FORMAT);
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
} else {
|
||||
fieldName = originField;
|
||||
}
|
||||
@ -419,7 +419,8 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
|
||||
return st.render();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
}
|
||||
@ -550,16 +551,34 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(ImpalaConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -587,6 +606,9 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -659,8 +681,8 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -759,9 +781,9 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
|
||||
if(isTable){
|
||||
if (isTable) {
|
||||
return "SELECT COUNT(*) from " + String.format(ImpalaConstants.KEYWORD_TABLE, sql);
|
||||
}else {
|
||||
} else {
|
||||
return "SELECT COUNT(*) from ( " + sqlFix(sql) + " ) DE_COUNT_TEMP";
|
||||
}
|
||||
}
|
||||
@ -804,7 +826,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (field.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
@ -931,7 +953,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (field.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
@ -1035,25 +1057,25 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
String format = transDateFormat(request.getDateStyle(), request.getDatePattern());
|
||||
if (field.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
whereName = String.format(ImpalaConstants.FROM_UNIXTIME, cast, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
}else {
|
||||
} else {
|
||||
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
whereName = String.format(ImpalaConstants.FROM_UNIXTIME, cast, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == DeTypeConstants.DE_TIME) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = originName;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(ImpalaConstants.DATE_FORMAT, originName, format);
|
||||
}
|
||||
}
|
||||
@ -1096,7 +1118,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if(request.getDatasetTableField().getDeExtractType() == DeTypeConstants.DE_TIME){
|
||||
if (request.getDatasetTableField().getDeExtractType() == DeTypeConstants.DE_TIME) {
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
}
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
@ -1179,7 +1201,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
if (x.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
|
||||
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT, ImpalaConstants.DEFAULT_DATE_FORMAT);
|
||||
fieldName = String.format(ImpalaConstants.DATE_FORMAT, fieldName, format);
|
||||
} else {
|
||||
String cast = String.format(ImpalaConstants.CAST, originField, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
|
||||
@ -315,7 +315,7 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
|
||||
@Override
|
||||
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
|
||||
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + " , " + pageInfo.getPageSize() : "");
|
||||
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + " , " + pageInfo.getPageSize() : "");
|
||||
if (isTable) {
|
||||
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
|
||||
} else {
|
||||
@ -535,16 +535,34 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MongoConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == DeTypeConstants.DE_INT) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -571,6 +589,9 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -648,8 +669,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -589,16 +589,34 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -625,6 +643,9 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -679,7 +700,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (CollectionUtils.isNotEmpty(groups)) st_sql.add("groups", groups);
|
||||
if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
@ -697,8 +718,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -653,7 +653,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(OracleConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(OracleConstants.ALIAS_FIX, String.format(TABLE_ALIAS_PREFIX, 0)))
|
||||
@ -661,9 +661,27 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -690,6 +708,9 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -762,8 +783,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -918,7 +939,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
continue;
|
||||
}
|
||||
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
if(xAxis.get(i).getType().equals("DATE")){
|
||||
if (xAxis.get(i).getType().equals("DATE")) {
|
||||
originField = String.format(OracleConstants.TO_CHAR, originField, OracleConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
String fieldAlias = String.format(OracleConstants.KEYWORD_TABLE, x.getOriginName());
|
||||
@ -1210,14 +1231,14 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String format = transDateFormat(request.getDateStyle(), request.getDatePattern());
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
if(!request.getOperator().equals("between")){
|
||||
if (!request.getOperator().equals("between")) {
|
||||
whereName = String.format(OracleConstants.TO_CHAR, String.format(OracleConstants.TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT), format);
|
||||
} else {
|
||||
whereName = String.format(OracleConstants.TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
if(!request.getOperator().equals("between")){
|
||||
if (!request.getOperator().equals("between")) {
|
||||
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, format);
|
||||
} else {
|
||||
@ -1226,7 +1247,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == 1) {
|
||||
if(!request.getOperator().equals("between")){
|
||||
if (!request.getOperator().equals("between")) {
|
||||
whereName = String.format(OracleConstants.TO_CHAR, originName, format);
|
||||
} else {
|
||||
whereName = originName;
|
||||
|
||||
@ -591,7 +591,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -599,9 +599,27 @@ public class PgQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -628,6 +646,9 @@ public class PgQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -700,8 +721,8 @@ public class PgQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1075,25 +1096,25 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String format = transDateFormat(request.getDateStyle(), request.getDatePattern());
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
|
||||
String timestamp = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = timestamp;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(PgConstants.DATE_FORMAT, timestamp, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(PgConstants.CAST, originName, "bigint");
|
||||
String timestamp = String.format(PgConstants.FROM_UNIXTIME, cast);
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = timestamp;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(PgConstants.DATE_FORMAT, timestamp, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == 1) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = originName;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(PgConstants.DATE_FORMAT, originName, format);
|
||||
}
|
||||
|
||||
|
||||
@ -598,7 +598,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -606,9 +606,27 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -635,6 +653,9 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -707,8 +728,8 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -808,11 +829,11 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
|
||||
if(isTable){
|
||||
if (isTable) {
|
||||
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
|
||||
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, sql);
|
||||
return "SELECT COUNT(*) from " + String.format(ImpalaConstants.KEYWORD_TABLE, tableWithSchema);
|
||||
}else {
|
||||
} else {
|
||||
return "SELECT COUNT(*) from ( " + sqlFix(sql) + " ) DE_COUNT_TEMP";
|
||||
}
|
||||
}
|
||||
@ -1069,26 +1090,26 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
if (field.getDeType() == 1) {
|
||||
String format = transDateFormat(request.getDateStyle(), request.getDatePattern());
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
String timestamp = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
if(request.getOperator().equals("between")){
|
||||
String timestamp = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = timestamp;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(PgConstants.DATE_FORMAT, timestamp, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(PgConstants.CAST, originName, "bigint");
|
||||
String timestamp = String.format(PgConstants.FROM_UNIXTIME, cast);
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = timestamp;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(PgConstants.DATE_FORMAT, timestamp, format);
|
||||
}
|
||||
}
|
||||
if (field.getDeExtractType() == 1) {
|
||||
if(request.getOperator().equals("between")){
|
||||
if (request.getOperator().equals("between")) {
|
||||
whereName = originName;
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(PgConstants.DATE_FORMAT, originName, format);
|
||||
}
|
||||
}
|
||||
|
||||
@ -600,7 +600,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -608,9 +608,27 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -637,6 +655,9 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -713,8 +734,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -898,19 +919,19 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.equalsIgnoreCase(item.getTerm(), "not_empty")) {
|
||||
whereValue = "''";
|
||||
} else if (StringUtils.containsIgnoreCase(item.getTerm(), "in") || StringUtils.containsIgnoreCase(item.getTerm(), "not in")) {
|
||||
if(field.getType().equalsIgnoreCase("NVARCHAR")){
|
||||
whereValue ="(" + Arrays.asList(value.split(",")).stream().map(str -> {
|
||||
if (field.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = "(" + Arrays.asList(value.split(",")).stream().map(str -> {
|
||||
return "N" + "'" + str + "'";
|
||||
}).collect(Collectors.joining(",")) + ")";
|
||||
}else {
|
||||
} else {
|
||||
whereValue = "('" + String.join("','", value.split(",")) + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(item.getTerm(), "like")) {
|
||||
whereValue = "'%" + value + "%'";
|
||||
} else {
|
||||
if(field.getType().equalsIgnoreCase("NVARCHAR")){
|
||||
if (field.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value);
|
||||
}else {
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
|
||||
}
|
||||
}
|
||||
@ -1035,19 +1056,19 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "not_empty")) {
|
||||
whereValue = "''";
|
||||
} else if (StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "in") || StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "not in")) {
|
||||
if(field.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = "(" + Arrays.asList(value.split(",")).stream().map(str -> {
|
||||
if (field.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = "(" + Arrays.asList(value.split(",")).stream().map(str -> {
|
||||
return "N" + "'" + str + "'";
|
||||
}).collect(Collectors.joining(",")) + ")";
|
||||
}else {
|
||||
} else {
|
||||
whereValue = "('" + String.join("','", value.split(",")) + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "like")) {
|
||||
whereValue = "'%" + value + "%'";
|
||||
} else {
|
||||
if(field.getType().equalsIgnoreCase("NVARCHAR")){
|
||||
if (field.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value);
|
||||
}else {
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1124,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
if (!StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
whereName = transDateFormat(request.getDateStyle(), request.getDatePattern(), String.format(SqlServerSQLConstants.STRING_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT));
|
||||
}else {
|
||||
} else {
|
||||
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
}
|
||||
@ -1111,7 +1132,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (!StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
|
||||
whereName = transDateFormat(request.getDateStyle(), request.getDatePattern(), cast);
|
||||
}else {
|
||||
} else {
|
||||
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
|
||||
whereName = String.format(SqlServerSQLConstants.FROM_UNIXTIME, cast);
|
||||
}
|
||||
@ -1119,7 +1140,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (field.getDeExtractType() == 1) {
|
||||
if (!StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
whereName = transDateFormat(request.getDateStyle(), request.getDatePattern(), originName);
|
||||
}else {
|
||||
} else {
|
||||
whereName = originName;
|
||||
}
|
||||
}
|
||||
@ -1149,11 +1170,11 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
|
||||
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
|
||||
if(request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
if (request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = "(" + value.stream().map(str -> {
|
||||
return "N" + "'" + str + "'";
|
||||
}).collect(Collectors.joining(",")) + ")";
|
||||
}else {
|
||||
} else {
|
||||
whereValue = "('" + StringUtils.join(value, "','") + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
@ -1171,9 +1192,9 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
}
|
||||
} else {
|
||||
|
||||
if(request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")){
|
||||
if (request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value.get(0));
|
||||
}else {
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));
|
||||
}
|
||||
|
||||
@ -1339,19 +1360,19 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_empty")) {
|
||||
whereValue = "''";
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
if(y.getType().equalsIgnoreCase("NVARCHAR")){
|
||||
whereValue = "(" +Arrays.asList(f.getValue().split(",")).stream().map(str -> {
|
||||
if (y.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = "(" + Arrays.asList(f.getValue().split(",")).stream().map(str -> {
|
||||
return "N" + "'" + str + "'";
|
||||
}).collect(Collectors.joining(",")) + ")";
|
||||
}else {
|
||||
} else {
|
||||
whereValue = "('" + String.join("','", f.getValue().split(",")) + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
whereValue = "'%" + f.getValue() + "%'";
|
||||
} else {
|
||||
if(y.getType().equalsIgnoreCase("NVARCHAR")){
|
||||
if (y.getType().equalsIgnoreCase("NVARCHAR")) {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, f.getValue());
|
||||
}else {
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, f.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLStack(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
datasourceRequest.setQuery(qp.getSQLScatter(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, ds, view));
|
||||
datasourceRequest.setQuery(qp.getSQLScatter(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, ds, view));
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
datasourceRequest.setQuery(qp.getSQLTableInfo(dataTableInfoDTO.getTable(), xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
@ -501,7 +501,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view));
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, view));
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
@ -516,7 +516,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view));
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, view));
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
@ -532,7 +532,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view));
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, view));
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
@ -557,7 +557,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLStack(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
datasourceRequest.setQuery(qp.getSQLScatter(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, ds, view));
|
||||
datasourceRequest.setQuery(qp.getSQLScatter(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, ds, view));
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
datasourceRequest.setQuery(qp.getSQLTableInfo(tableName, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
@ -604,7 +604,7 @@ public class ChartViewService {
|
||||
List<ChartViewFieldDTO> viewFields = gson.fromJson(view.getViewFields(), tokenType);
|
||||
final Map<String, List<ChartViewFieldDTO>> extFieldsMap = new LinkedHashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(viewFields)) {
|
||||
String[] busiFlagArray = new String[] {"daxis", "locationXaxis", "locationYaxis"};
|
||||
String[] busiFlagArray = new String[]{"daxis", "locationXaxis", "locationYaxis"};
|
||||
Map<String, Boolean> flagMap = new HashMap<>();
|
||||
for (String s : busiFlagArray) {
|
||||
flagMap.put(s, false);
|
||||
@ -963,7 +963,7 @@ public class ChartViewService {
|
||||
DatasourceRequest datasourceAssistRequest = new DatasourceRequest();
|
||||
datasourceAssistRequest.setDatasource(ds);
|
||||
List<String[]> assistData = new ArrayList<>();
|
||||
List<ChartSeniorAssistDTO> dynamicAssistFields = getDynamicAssistFields(view);
|
||||
List<ChartSeniorAssistDTO> dynamicAssistFields = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> assistFields = null;
|
||||
if (StringUtils.containsIgnoreCase(view.getType(), "bar")
|
||||
|| StringUtils.containsIgnoreCase(view.getType(), "line")
|
||||
@ -971,7 +971,15 @@ public class ChartViewService {
|
||||
|| StringUtils.containsIgnoreCase(view.getType(), "scatter")
|
||||
|| StringUtils.containsIgnoreCase(view.getType(), "mix")
|
||||
) {
|
||||
assistFields = getAssistFields(dynamicAssistFields, yAxis);
|
||||
// 动态辅助线
|
||||
dynamicAssistFields = getDynamicAssistFields(view);
|
||||
assistFields = getAssistFields(dynamicAssistFields, yAxis, null);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "table-info")
|
||||
|| StringUtils.containsIgnoreCase(view.getType(), "table-normal")
|
||||
|| StringUtils.containsIgnoreCase(view.getType(), "table-pivot")) {
|
||||
// 动态阈值
|
||||
dynamicAssistFields = getDynamicThresholdFields(view);
|
||||
assistFields = getAssistFields(dynamicAssistFields, yAxis, xAxis);
|
||||
}
|
||||
|
||||
// 处理过滤条件中的单引号
|
||||
@ -1060,7 +1068,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
querySql = qp.getSQLStack(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
querySql = qp.getSQLScatter(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, ds, view);
|
||||
querySql = qp.getSQLScatter(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, ds, view);
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
querySql = qp.getSQLWithPage(true, dataTableInfoDTO.getTable(), xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
totalPageSql = qp.getResultCount(true, dataTableInfoDTO.getTable(), xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
@ -1069,7 +1077,10 @@ public class ChartViewService {
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
String resultMode = view.getResultMode();
|
||||
view.setResultMode(null);
|
||||
detailFieldSql = qp.getSQLWithPage(true, dataTableInfoDTO.getTable(), detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
view.setResultMode(resultMode);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.SQL.name())) {
|
||||
@ -1080,7 +1091,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
querySql = qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view);
|
||||
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, view);
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
querySql = qp.getSQLWithPage(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
@ -1089,7 +1100,10 @@ public class ChartViewService {
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
String resultMode = view.getResultMode();
|
||||
view.setResultMode(null);
|
||||
detailFieldSql = qp.getSQLWithPage(false, sql, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
view.setResultMode(resultMode);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.CUSTOM.name())) {
|
||||
@ -1101,7 +1115,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
querySql = qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view);
|
||||
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, view);
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
querySql = qp.getSQLWithPage(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
@ -1110,7 +1124,10 @@ public class ChartViewService {
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
String resultMode = view.getResultMode();
|
||||
view.setResultMode(null);
|
||||
detailFieldSql = qp.getSQLWithPage(false, sql, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
view.setResultMode(resultMode);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.UNION.name())) {
|
||||
@ -1122,7 +1139,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
querySql = qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, view);
|
||||
querySql = qp.getSQLAsTmpScatter(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, view);
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
querySql = qp.getSQLWithPage(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
@ -1131,7 +1148,10 @@ public class ChartViewService {
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
String resultMode = view.getResultMode();
|
||||
view.setResultMode(null);
|
||||
detailFieldSql = qp.getSQLWithPage(false, sql, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
view.setResultMode(resultMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1174,7 +1194,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLStack(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
datasourceRequest.setQuery(qp.getSQLScatter(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, ds, view));
|
||||
datasourceRequest.setQuery(qp.getSQLScatter(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extBubble, extStack, ds, view));
|
||||
} else if (StringUtils.equalsIgnoreCase("table-info", view.getType())) {
|
||||
datasourceRequest.setQuery(qp.getSQLTableInfo(tableName, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
@ -1182,7 +1202,10 @@ public class ChartViewService {
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
String resultMode = view.getResultMode();
|
||||
view.setResultMode(null);
|
||||
detailFieldSql = qp.getSQLTableInfo(tableName, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
view.setResultMode(resultMode);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(assistFields)) {
|
||||
@ -1361,7 +1384,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "line-stack")) {
|
||||
mapChart = ChartDataBuild.transStackChartDataAntV(xAxis, yAxis, view, data, extStack, isDrill);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
mapChart = ChartDataBuild.transScatterDataAntV(xAxis, yAxis, view, data, extBubble, isDrill);
|
||||
mapChart = ChartDataBuild.transScatterDataAntV(xAxis, yAxis, view, data, extBubble, extStack, isDrill);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "radar")) {
|
||||
mapChart = ChartDataBuild.transRadarChartDataAntV(xAxis, yAxis, view, data, isDrill);
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "text")
|
||||
@ -1457,7 +1480,7 @@ public class ChartViewService {
|
||||
map.put("sourceFields", sourceFields);
|
||||
// merge assist result
|
||||
mergeAssistField(dynamicAssistFields, assistData);
|
||||
map.put("dynamicAssistLines", dynamicAssistFields);
|
||||
map.put("dynamicAssistData", dynamicAssistFields);
|
||||
|
||||
ChartViewDTO dto = new ChartViewDTO();
|
||||
BeanUtils.copyBean(dto, view);
|
||||
@ -2045,28 +2068,39 @@ public class ChartViewService {
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<ChartViewFieldDTO> getAssistFields(List<ChartSeniorAssistDTO> list, List<ChartViewFieldDTO> yAxis) {
|
||||
private List<ChartViewFieldDTO> getAssistFields(List<ChartSeniorAssistDTO> list, List<ChartViewFieldDTO> yAxis, List<ChartViewFieldDTO> xAxis) {
|
||||
List<ChartViewFieldDTO> res = new ArrayList<>();
|
||||
for (ChartSeniorAssistDTO dto : list) {
|
||||
DatasetTableField curField = dto.getCurField();
|
||||
ChartViewFieldDTO yField = null;
|
||||
ChartViewFieldDTO field = null;
|
||||
String alias = "";
|
||||
for (int i = 0; i < yAxis.size(); i++) {
|
||||
ChartViewFieldDTO field = yAxis.get(i);
|
||||
if (StringUtils.equalsIgnoreCase(field.getId(), curField.getId())) {
|
||||
yField = field;
|
||||
ChartViewFieldDTO yField = yAxis.get(i);
|
||||
if (StringUtils.equalsIgnoreCase(yField.getId(), curField.getId())) {
|
||||
field = yField;
|
||||
alias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(yField)) {
|
||||
|
||||
if (ObjectUtils.isEmpty(field) && CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO xField = xAxis.get(i);
|
||||
if (StringUtils.equalsIgnoreCase(xField.getId(), curField.getId())) {
|
||||
field = xField;
|
||||
alias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO();
|
||||
BeanUtils.copyBean(chartViewFieldDTO, curField);
|
||||
chartViewFieldDTO.setSummary(dto.getSummary());
|
||||
chartViewFieldDTO.setOriginName(alias);// yAxis的字段别名,就是查找的字段名
|
||||
chartViewFieldDTO.setOriginName(alias);// 字段别名,就是查找的字段名
|
||||
res.add(chartViewFieldDTO);
|
||||
}
|
||||
return res;
|
||||
@ -2077,11 +2111,82 @@ public class ChartViewService {
|
||||
return;
|
||||
}
|
||||
String[] strings = assistData.get(0);
|
||||
for (int i = 0; i < dynamicAssistFields.size(); i++) {
|
||||
if (i < strings.length) {
|
||||
ChartSeniorAssistDTO chartSeniorAssistDTO = dynamicAssistFields.get(i);
|
||||
chartSeniorAssistDTO.setValue(strings[i]);
|
||||
}
|
||||
for (int i = 0, size = Math.min(dynamicAssistFields.size(), strings.length); i < size; i++) {
|
||||
ChartSeniorAssistDTO chartSeniorAssistDTO = dynamicAssistFields.get(i);
|
||||
chartSeniorAssistDTO.setValue(strings[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ChartSeniorAssistDTO> getDynamicThresholdFields(ChartViewDTO view) {
|
||||
String senior = view.getSenior();
|
||||
JSONObject jsonObject = JSONObject.parseObject(senior);
|
||||
List<ChartSeniorAssistDTO> list = new ArrayList<>();
|
||||
JSONObject threshold = jsonObject.getJSONObject("threshold");
|
||||
if (ObjectUtils.isEmpty(threshold) || StringUtils.isBlank(threshold.toJSONString())){
|
||||
return list;
|
||||
}
|
||||
JSONArray tableThreshold = threshold.getJSONArray("tableThreshold");
|
||||
if (ObjectUtils.isEmpty(tableThreshold) || StringUtils.isBlank(tableThreshold.toJSONString())) {
|
||||
return list;
|
||||
}
|
||||
|
||||
for (int i = 0; i < tableThreshold.size(); i++) {
|
||||
JSONObject item = tableThreshold.getJSONObject(i);
|
||||
JSONArray itemConditions = item.getJSONArray("conditions");
|
||||
if (ObjectUtils.isEmpty(itemConditions) || StringUtils.isBlank(itemConditions.toJSONString())) {
|
||||
continue;
|
||||
}
|
||||
List<ChartSeniorThresholdDTO> conditions = gson.fromJson(itemConditions.toJSONString(), new TypeToken<List<ChartSeniorThresholdDTO>>() {
|
||||
}.getType());
|
||||
for (ChartSeniorThresholdDTO condition : conditions) {
|
||||
if (StringUtils.equalsIgnoreCase(condition.getField(), "0")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ChartSeniorAssistDTO fieldDTO : getConditionFields(condition)) {
|
||||
if (solveThresholdCondition(fieldDTO, view.getTableId())) {
|
||||
list.add(fieldDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private boolean solveThresholdCondition(ChartSeniorAssistDTO fieldDTO, String tableId){
|
||||
String fieldId = fieldDTO.getFieldId();
|
||||
String summary = fieldDTO.getSummary();
|
||||
if (StringUtils.isEmpty(fieldId) || StringUtils.isEmpty(summary)) {
|
||||
return false;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andTableIdEqualTo(tableId).andIdEqualTo(fieldId);
|
||||
List<DatasetTableField> fieldList = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
if (CollectionUtils.isEmpty(fieldList)) {
|
||||
return false;
|
||||
}
|
||||
fieldDTO.setCurField(fieldList.get(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<ChartSeniorAssistDTO> getConditionFields(ChartSeniorThresholdDTO condition){
|
||||
List<ChartSeniorAssistDTO> list = new ArrayList<>();
|
||||
if (StringUtils.equalsIgnoreCase(condition.getField(), "0")) {
|
||||
return list;
|
||||
}
|
||||
if ("between".equals(condition.getTerm())) {
|
||||
if (!StringUtils.equalsIgnoreCase(condition.getMaxField().getSummary(), "value")) {
|
||||
list.add(condition.getMaxField());
|
||||
}
|
||||
if (!StringUtils.equalsIgnoreCase(condition.getMinField().getSummary(), "value")) {
|
||||
list.add(condition.getMinField());
|
||||
}
|
||||
} else {
|
||||
if (!StringUtils.equalsIgnoreCase(condition.getTargetField().getSummary(), "value")) {
|
||||
list.add(condition.getTargetField());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,19 +291,33 @@ public class ChartDataBuild {
|
||||
}
|
||||
|
||||
//AntV scatter
|
||||
public static Map<String, Object> transScatterDataAntV(List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, ChartViewWithBLOBs view, List<String[]> data, List<ChartViewFieldDTO> extBubble, boolean isDrill) {
|
||||
public static Map<String, Object> transScatterDataAntV(List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, ChartViewWithBLOBs view, List<String[]> data, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, boolean isDrill) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q")) {
|
||||
xIsNumber = true;
|
||||
}
|
||||
}
|
||||
List<ChartViewFieldDTO> extGroupList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
extGroupList.addAll(extGroup);
|
||||
}
|
||||
|
||||
|
||||
List<AxisChartDataAntVDTO> dataList = new ArrayList<>();
|
||||
for (int i1 = 0; i1 < data.size(); i1++) {
|
||||
String[] row = data.get(i1);
|
||||
|
||||
StringBuilder a = new StringBuilder();
|
||||
if (isDrill) {
|
||||
a.append(row[xAxis.size() - 1]);
|
||||
a.append(row[extGroupList.size() + xAxis.size() - 1]);
|
||||
} else {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
if (i == xAxis.size() - 1) {
|
||||
for (int i = extGroupList.size(); i < extGroupList.size() + xAxis.size(); i++) {
|
||||
if (i == extGroupList.size() + xAxis.size() - 1) {
|
||||
a.append(row[i]);
|
||||
} else {
|
||||
a.append(row[i]).append("\n");
|
||||
@ -311,8 +325,15 @@ public class ChartDataBuild {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = xAxis.size(); i < xAxis.size() + yAxis.size(); i++) {
|
||||
for (int i = xAxis.size() + extGroupList.size(); i < xAxis.size() + extGroupList.size() + yAxis.size(); i++) {
|
||||
AxisChartDataAntVDTO axisChartDataDTO = new AxisChartDataAntVDTO();
|
||||
|
||||
if (xIsNumber) {
|
||||
axisChartDataDTO.setX(new BigDecimal(a.toString()));
|
||||
} else {
|
||||
axisChartDataDTO.setX(a.toString());
|
||||
}
|
||||
|
||||
axisChartDataDTO.setField(a.toString());
|
||||
axisChartDataDTO.setName(a.toString());
|
||||
|
||||
@ -327,7 +348,7 @@ public class ChartDataBuild {
|
||||
}
|
||||
axisChartDataDTO.setDimensionList(dimensionList);
|
||||
|
||||
int j = i - xAxis.size();
|
||||
int j = i - xAxis.size() - extGroupList.size();
|
||||
ChartQuotaDTO chartQuotaDTO = new ChartQuotaDTO();
|
||||
chartQuotaDTO.setId(yAxis.get(j).getId());
|
||||
quotaList.add(chartQuotaDTO);
|
||||
@ -337,11 +358,18 @@ public class ChartDataBuild {
|
||||
} catch (Exception e) {
|
||||
axisChartDataDTO.setValue(new BigDecimal(0));
|
||||
}
|
||||
axisChartDataDTO.setCategory(yAxis.get(j).getName());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(extGroup) && xIsNumber) { //有分组时其实就是第一个
|
||||
axisChartDataDTO.setCategory(row[0]);
|
||||
} else {
|
||||
axisChartDataDTO.setCategory(yAxis.get(j).getName());
|
||||
}
|
||||
axisChartDataDTO.setGroup(yAxis.get(j).getName());
|
||||
|
||||
// pop
|
||||
if (CollectionUtils.isNotEmpty(extBubble)) {
|
||||
try {
|
||||
axisChartDataDTO.setPopSize(StringUtils.isEmpty(row[xAxis.size() + yAxis.size()]) ? null : new BigDecimal(row[xAxis.size() + yAxis.size()]));
|
||||
axisChartDataDTO.setPopSize(StringUtils.isEmpty(row[extGroupList.size() + xAxis.size() + yAxis.size()]) ? null : new BigDecimal(row[extGroupList.size() + xAxis.size() + yAxis.size()]));
|
||||
} catch (Exception e) {
|
||||
axisChartDataDTO.setPopSize(new BigDecimal(0));
|
||||
}
|
||||
@ -944,7 +972,28 @@ public class ChartDataBuild {
|
||||
// 表格
|
||||
public static Map<String, Object> transTableNormal(List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, ChartViewWithBLOBs view, List<String[]> data, List<ChartViewFieldDTO> extStack, Map<String, ColumnPermissionItem> desensitizationList) {
|
||||
List<ChartViewFieldDTO> fields = new ArrayList<>();
|
||||
if (ObjectUtils.isNotEmpty(xAxis)) {
|
||||
|
||||
// scatter start
|
||||
if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) {
|
||||
boolean xIsNumber = false;
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q")) {
|
||||
xIsNumber = true;
|
||||
}
|
||||
}
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extStack)) {
|
||||
fields.add(extStack.get(0));
|
||||
}
|
||||
|
||||
if (xIsNumber) {
|
||||
fields.add(xAxis.get(0));
|
||||
} else {
|
||||
fields.addAll(xAxis);
|
||||
}
|
||||
|
||||
// scatter end
|
||||
} else if (ObjectUtils.isNotEmpty(xAxis)) {
|
||||
fields.addAll(xAxis);
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
@ -974,15 +1023,19 @@ public class ChartDataBuild {
|
||||
tableRow.forEach(row -> {
|
||||
String key = xAxis.stream().map(x -> String.format(format, row.get(x.getDataeaseName()).toString())).collect(Collectors.joining("-de-"));
|
||||
List<String[]> detailFieldValueList = groupDataList.get(key);
|
||||
List<Map<String, Object>> detailValueMapList = detailFieldValueList.stream().map((detailArr -> {
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
for (int i = 0; i < realDetailFields.size(); i++) {
|
||||
ChartViewFieldDTO realDetailField = realDetailFields.get(i);
|
||||
temp.put(realDetailField.getDataeaseName(), detailArr[detailIndex + i]);
|
||||
}
|
||||
return temp;
|
||||
})).collect(Collectors.toList());
|
||||
row.put("details", detailValueMapList);
|
||||
if (CollectionUtils.isNotEmpty(detailFieldValueList)) {
|
||||
List<Map<String, Object>> detailValueMapList = detailFieldValueList.stream().map((detailArr -> {
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
for (int i = 0; i < realDetailFields.size(); i++) {
|
||||
ChartViewFieldDTO realDetailField = realDetailFields.get(i);
|
||||
temp.put(realDetailField.getDataeaseName(), detailArr[detailIndex + i]);
|
||||
}
|
||||
return temp;
|
||||
})).collect(Collectors.toList());
|
||||
row.put("details", detailValueMapList);
|
||||
} else {
|
||||
row.put("details", new ArrayList<>());
|
||||
}
|
||||
});
|
||||
|
||||
ChartViewFieldDTO detailFieldDTO = new ChartViewFieldDTO();
|
||||
@ -1253,7 +1306,7 @@ public class ChartDataBuild {
|
||||
quotaList.add(chartQuotaDTO);
|
||||
axisChartDataDTO.setQuotaList(quotaList);
|
||||
}
|
||||
if (yAxis.size() == 2){
|
||||
if (yAxis.size() == 2) {
|
||||
try {
|
||||
axisChartDataDTO.setValue(StringUtils.isEmpty(row[xAxis.size()]) ? null : new BigDecimal(row[xAxis.size()]));
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -159,6 +159,9 @@ public class DataSetTableService {
|
||||
@Value("${upload.file.path}")
|
||||
private String path;
|
||||
|
||||
@Value("${export.dataset.limit:100000}")
|
||||
private int limit;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
|
||||
|
||||
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
|
||||
@ -2983,7 +2986,7 @@ public class DataSetTableService {
|
||||
permissionsTreeService.getField(tree);
|
||||
}
|
||||
Datasource datasource = datasourceService.get(request.getDataSourceId());
|
||||
int pageSize = (datasource != null && StringUtils.equalsIgnoreCase(datasource.getType(), "es")) ? 10000 : 100000;
|
||||
int pageSize = (datasource != null && StringUtils.equalsIgnoreCase(datasource.getType(), "es")) ? 10000 : limit;
|
||||
request.setRow(String.valueOf(pageSize));
|
||||
Map<String, Object> previewData = getPreviewData(request, 1, pageSize, null, tree);
|
||||
List<DatasetTableField> fields = (List<DatasetTableField>) previewData.get("fields");
|
||||
|
||||
@ -440,6 +440,9 @@ public class SysUserService {
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId")
|
||||
@Transactional
|
||||
public int delete(Long userId) {
|
||||
if (userId.equals(1L)) {
|
||||
DEException.throwException(Translator.get("I18n_del_admin_tips"));
|
||||
}
|
||||
extAuthService.clearUserResource(userId);
|
||||
deleteUserRoles(userId);
|
||||
sysUserAssistMapper.deleteByPrimaryKey(userId);
|
||||
|
||||
@ -22,6 +22,7 @@ import io.dataease.service.datasource.DatasourceService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -56,6 +57,7 @@ public class SystemParameterService {
|
||||
return extSystemParameterMapper.email();
|
||||
}
|
||||
|
||||
|
||||
public BasicInfo basicInfo() {
|
||||
List<SystemParameter> paramList = this.getParamList("basic");
|
||||
List<SystemParameter> homePageList = this.getParamList("ui.openHomePage");
|
||||
@ -409,4 +411,27 @@ public class SystemParameterService {
|
||||
public void clearMultiLoginCache() {
|
||||
}
|
||||
|
||||
public String onlineMapKey() {
|
||||
return getValue("map.key");
|
||||
}
|
||||
|
||||
public void saveMapKey(String key) {
|
||||
String paramKey = "map.key";
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
example.createCriteria().andParamKeyEqualTo(paramKey);
|
||||
List<SystemParameter> systemParameters = systemParameterMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(systemParameters)) {
|
||||
SystemParameter systemParameter = systemParameters.get(0);
|
||||
systemParameter.setParamValue(key);
|
||||
systemParameterMapper.updateByExample(systemParameter, example);
|
||||
return;
|
||||
}
|
||||
SystemParameter record = new SystemParameter();
|
||||
record.setParamKey(paramKey);
|
||||
record.setParamValue(key);
|
||||
record.setType("text");
|
||||
record.setSort(1);
|
||||
systemParameterMapper.insert(record);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -274,4 +274,5 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=Default template only screenshot
|
||||
\u8FB9\u68468=Border 8
|
||||
\u8FB9\u68469=Border 9
|
||||
\u8FB9\u684610=Border 10
|
||||
I18n_name_cant_empty=Name can not be empty!
|
||||
I18n_name_cant_empty=Name can not be empty!
|
||||
I18n_del_admin_tips=Forbidden to delete the admin account
|
||||
@ -265,4 +265,5 @@ I18N_CRON_ERROR=cron\u8868\u8FBE\u5F0F\u9519\u8BEF
|
||||
I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=\u9ED8\u8BA4\u6A21\u677F(\u52A0\u4EEA\u8868\u677F\u63CF\u8FF0)
|
||||
I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8BA4\u6A21\u677F(\u53EA\u622A\u56FE)
|
||||
I18n_name_cant_empty=\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF01
|
||||
I18n_del_admin_tips=\u7981\u6B62\u5220\u9664admin\u8D26\u53F7
|
||||
|
||||
|
||||
@ -270,4 +270,5 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8A8D\u6A21\u677F(\u53EA\u622A\u5716)
|
||||
\u8FB9\u68468=\u908A\u6846 8
|
||||
\u8FB9\u68469=\u908A\u6846 9
|
||||
\u8FB9\u684610=\u908A\u6846 10
|
||||
I18n_name_cant_empty=\u540D\u7A31\u4E0D\u80FD\u70BA\u7A7A\uFF01
|
||||
I18n_name_cant_empty=\u540D\u7A31\u4E0D\u80FD\u70BA\u7A7A\uFF01
|
||||
I18n_del_admin_tips=\u7981\u6B62\u522A\u9664admin\u8CEC\u865F
|
||||
@ -5,3 +5,5 @@ ENV = 'production'
|
||||
# VUE_APP_BASE_API = 'http://localhost:8081/'
|
||||
VUE_APP_BASE_API = '/'
|
||||
|
||||
VUE_CONTEXT_PATH = '/'
|
||||
|
||||
|
||||
@ -6,3 +6,24 @@ ENV = 'staging'
|
||||
# base api
|
||||
VUE_APP_BASE_API = '/de-api/'
|
||||
|
||||
VUE_CONTEXT_PATH = '/'
|
||||
|
||||
#for nginx conf
|
||||
#location / {
|
||||
# root /Users/admin/Downloads/dist/;
|
||||
# index index.html index.htm;
|
||||
#}
|
||||
#location ~* \.(html|htm)$ {
|
||||
# if ($uri = '/de-api/link.html') {
|
||||
# rewrite ^/de-api/(.*)$ /$1 redirect;
|
||||
# }
|
||||
# root /Users/admin/Downloads/dist/;
|
||||
#}
|
||||
#location /de-api/ {
|
||||
# #rewrite ^/de-api/#/(.*)$ /$1 break;
|
||||
# proxy_pass http://localhost:8081/de-api/;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# server_name_in_redirect on;
|
||||
#}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dataease",
|
||||
"version": "1.18.11",
|
||||
"version": "1.18.12",
|
||||
"description": "dataease front",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@ -26,17 +26,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/g2plot": "^2.4.9",
|
||||
"@antv/l7": "2.15.0",
|
||||
"@antv/l7-component": "2.15.0",
|
||||
"@antv/l7-core": "2.15.0",
|
||||
"@antv/l7-layers": "2.15.0",
|
||||
"@antv/l7-maps": "2.15.0",
|
||||
"@antv/l7-renderer": "2.15.0",
|
||||
"@antv/l7-scene": "2.15.0",
|
||||
"@antv/l7-source": "2.15.0",
|
||||
"@antv/l7-utils": "2.15.0",
|
||||
"@antv/s2": "1.35.0",
|
||||
"@antv/util": "^2.0.17",
|
||||
"@antv/l7": "^2.15.0",
|
||||
"@antv/s2": "^1.49.1",
|
||||
"@riophae/vue-treeselect": "0.4.0",
|
||||
"@tinymce/tinymce-vue": "^3.2.8",
|
||||
"axios": "^0.21.3",
|
||||
|
||||
@ -33,7 +33,8 @@
|
||||
const user = getQueryVariable('user')
|
||||
const terminal = getQueryVariable('terminal')
|
||||
const attachParams = getQueryVariable('attachParams')
|
||||
let url = "/#/delink?link=" + encodeURIComponent(link)
|
||||
const baseUrl = window.location.pathname.replace('link.html', '')
|
||||
let url = baseUrl + "#/delink?link=" + encodeURIComponent(link)
|
||||
if (terminal) {
|
||||
url += '&terminal=' + terminal
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
44
core/frontend/public/vendor/vendor.dll.js
vendored
44
core/frontend/public/vendor/vendor.dll.js
vendored
File diff suppressed because one or more lines are too long
@ -42,3 +42,20 @@ export function removeMap(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function saveMapKey(data) {
|
||||
return request({
|
||||
url: '/system/saveMapKey',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function queryMapKey() {
|
||||
return request({
|
||||
url: '/system/onlineMapKey',
|
||||
method: 'get',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
:target="curComponent.hyperlinks.openMode "
|
||||
:href="curComponent.hyperlinks.content "
|
||||
>
|
||||
<i class="icon iconfont icon-com-jump"/>
|
||||
<i class="icon iconfont icon-com-jump" />
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
||||
@ -362,7 +362,7 @@ export default {
|
||||
computed: {
|
||||
// 首次加载且非编辑状态新复制的视图,使用外部filter
|
||||
initLoad() {
|
||||
return !(this.isEdit && this.currentCanvasNewId.includes(this.element.id)) && this.isFirstLoad
|
||||
return !(this.isEdit && this.currentCanvasNewId.includes(this.element.id)) && this.isFirstLoad && this.canvasId === 'canvas-main'
|
||||
},
|
||||
scaleCoefficient() {
|
||||
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
|
||||
@ -566,6 +566,9 @@ export default {
|
||||
},
|
||||
'chart.yaxis': function(newVal, oldVal) {
|
||||
this.$emit('fill-chart-2-parent', this.chart)
|
||||
},
|
||||
'chart.title': function(newVal, oldVal) {
|
||||
this.$emit('fill-chart-2-parent', this.chart)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -1007,6 +1010,12 @@ export default {
|
||||
sourceInfo = param.viewId + '#' + dimension.id
|
||||
jumpInfo = this.nowPanelJumpInfo[sourceInfo]
|
||||
}
|
||||
// 没有主维度,子维度相等
|
||||
if (!jumpInfo && dimensionItem.value === param.category) {
|
||||
dimension = dimensionItem
|
||||
sourceInfo = param.viewId + '#' + dimension.id
|
||||
jumpInfo = this.nowPanelJumpInfo[sourceInfo]
|
||||
}
|
||||
})
|
||||
} else {
|
||||
for (let i = param.dimensionList.length - 1; i >= 0; i--) {
|
||||
|
||||
@ -221,7 +221,7 @@ export function checkViewTitle(opt, id, tile) {
|
||||
}
|
||||
}
|
||||
|
||||
export function exportImg(imgName,callback) {
|
||||
export function exportImg(imgName, callback) {
|
||||
const canvasID = document.getElementById('chartCanvas')
|
||||
const a = document.createElement('a')
|
||||
html2canvas(canvasID).then(canvas => {
|
||||
@ -387,12 +387,12 @@ export function insertBatchTreeNode(nodeInfoArray, tree) {
|
||||
|
||||
export function updateCacheTree(opt, treeName, nodeInfoFull, tree) {
|
||||
const nodeInfo = deepCopy(nodeInfoFull)
|
||||
if( nodeInfo instanceof Array){
|
||||
nodeInfo.forEach(item=>{
|
||||
if (nodeInfo instanceof Array) {
|
||||
nodeInfo.forEach(item => {
|
||||
delete item.panelData
|
||||
delete item.panelStyle
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
delete nodeInfo.panelData
|
||||
delete nodeInfo.panelStyle
|
||||
}
|
||||
@ -443,7 +443,7 @@ export function exportExcelDownload(chart, snapshot, width, height, loadingWrapp
|
||||
const excelTypes = fields.map(item => item.deType)
|
||||
const excelHeaderKeys = fields.map(item => item.dataeaseName)
|
||||
let excelData = tableRow.map(item => excelHeaderKeys.map(i => item[i]))
|
||||
const excelName = chart.name
|
||||
const excelName = chart.title ? chart.title : chart.name
|
||||
let detailFields = []
|
||||
if (chart.data.detailFields?.length) {
|
||||
detailFields = chart.data.detailFields.map(item => {
|
||||
|
||||
@ -341,6 +341,7 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
.coustom-date-picker {
|
||||
right: 0px;
|
||||
border: 1px solid var(--BrDateColor, #dfe4ed) !important;
|
||||
background: var(--BgDateColor, #FFFFFF) !important;
|
||||
|
||||
|
||||
@ -1019,6 +1019,7 @@ export default {
|
||||
fast_calc: 'Fast Calculation',
|
||||
sum: 'Sum',
|
||||
count: 'Count',
|
||||
value: 'Value',
|
||||
avg: 'Avg',
|
||||
max: 'Max',
|
||||
min: 'Min',
|
||||
@ -1513,6 +1514,7 @@ export default {
|
||||
Do not modify the reference content, otherwise the reference will fail.<br/>
|
||||
If you enter content in the same format as the reference field, it will be treated as a reference field.`,
|
||||
scatter_tip: 'When this indicator is in effect, the bubble size attribute in the style size will be invalid',
|
||||
scatter_group_tip: 'This setting only active when quota value in xAxis',
|
||||
place_name_mapping: 'Place name mapping',
|
||||
axis_tip: 'The minimum value, maximum value, and interval are all numeric types; it will be regarded as automatic if left blank.<br/>Please make sure that the filled values can be calculated correctly, otherwise the axis values will not be displayed normally.',
|
||||
format_tip: `The template variables include {a}, {b}, {c}, {d}, which represent series name, data name, data value, etc. respectively.<br>
|
||||
@ -1954,8 +1956,8 @@ export default {
|
||||
jsonpath_info: 'Please fill in JsonPath',
|
||||
req_param: 'Request parameters',
|
||||
headers: 'Request header',
|
||||
query_param: "QUERY param",
|
||||
query_info: "Follow in the address bar? The following parameters, such as: updateAPI? id=112",
|
||||
query_param: 'QUERY param',
|
||||
query_info: 'Follow in the address bar? The following parameters, such as: updateAPI? id=112',
|
||||
key: 'Key',
|
||||
value: 'Value',
|
||||
data_path: 'Extract data',
|
||||
@ -2936,5 +2938,10 @@ export default {
|
||||
confirm_title: 'Forced login will cause other clients to go offline',
|
||||
confirm: 'Whether to force login?',
|
||||
forced_offline: '`The current account is logged in on the client [${ip}],and you have been pushed off the line!`'
|
||||
},
|
||||
online_map: {
|
||||
geometry: 'Geometry',
|
||||
onlinemap: 'Online map',
|
||||
empty_desc: 'No map key'
|
||||
}
|
||||
}
|
||||
|
||||
@ -1019,7 +1019,8 @@ export default {
|
||||
fast_calc: '快速計算',
|
||||
sum: '求和',
|
||||
count: '計數',
|
||||
avg: '平均',
|
||||
value: '字段值',
|
||||
avg: '平均值',
|
||||
max: '最大值',
|
||||
min: '最小值',
|
||||
stddev_pop: '標準差',
|
||||
@ -1507,6 +1508,7 @@ export default {
|
||||
table_column_width_tip: '列寬並非任何時候都能生效。<br/>容器寬度優先級高於列寬。即(表格容器寬度 / 列數 > 指定列寬),則列寬優先取(容器寬度 / 列數)',
|
||||
reference_field_tip: '引用字段以 "[" 開始,"]" 結束。請<br/>勿修改引用內容,否則將引用失敗。<br/>若輸入與引用字段相同格式的內容,將被當做引用字段處理。',
|
||||
scatter_tip: '該指標生效時,樣式大小中的氣泡大小屬性將失效',
|
||||
scatter_group_tip: '僅當橫軸內為指標時生效',
|
||||
place_name_mapping: '地名映射',
|
||||
axis_tip: '最小值、最大值、間隔均為數值類型;若不填,則該項視為自動。<br/>請確保填寫數值能正確計算,否則將無法正常顯示值軸',
|
||||
format_tip: `模板變量有 {a}, {b},{c},{d},分別表示系列名,數據名,數據值等。<br>
|
||||
@ -1948,8 +1950,8 @@ export default {
|
||||
jsonpath_info: '請輸入JsonPath',
|
||||
req_param: '請求參數',
|
||||
headers: '請求頭',
|
||||
query_param: "QUERY參數",
|
||||
query_info: "地址欄中跟在?後面的參數,如:updateapi? id=112",
|
||||
query_param: 'QUERY參數',
|
||||
query_info: '地址欄中跟在?後面的參數,如:updateapi? id=112',
|
||||
key: '鍵',
|
||||
value: '值',
|
||||
data_path: '提取數據',
|
||||
@ -2929,5 +2931,10 @@ export default {
|
||||
confirm_title: '強行登錄會導致其他客戶端掉線',
|
||||
confirm: '是否強行登錄?',
|
||||
forced_offline: '`當前賬號在客戶端【${ip}】登錄,您已被擠下線!`'
|
||||
},
|
||||
online_map: {
|
||||
geometry: '地理信息',
|
||||
onlinemap: '在線地圖',
|
||||
empty_desc: '暫無在線地圖key'
|
||||
}
|
||||
}
|
||||
|
||||
@ -1018,7 +1018,8 @@ export default {
|
||||
fast_calc: '快速计算',
|
||||
sum: '求和',
|
||||
count: '计数',
|
||||
avg: '平均',
|
||||
value: '字段值',
|
||||
avg: '平均值',
|
||||
max: '最大值',
|
||||
min: '最小值',
|
||||
stddev_pop: '标准差',
|
||||
@ -1506,6 +1507,7 @@ export default {
|
||||
table_column_width_tip: '列宽并非任何时候都能生效。<br/>容器宽度优先级高于列宽,即(表格容器宽度 / 列数 > 指定列宽),则列宽优先取(容器宽度 / 列数)。',
|
||||
reference_field_tip: '引用字段以 "[" 开始, "]" 结束。<br/>请勿修改引用内容,否则将引用失败。<br/>若输入与引用字段相同格式的内容,将被当作引用字段处理。',
|
||||
scatter_tip: '该指标生效时,样式大小中的气泡大小属性将失效',
|
||||
scatter_group_tip: '仅当横轴内为指标时生效',
|
||||
place_name_mapping: '地名映射',
|
||||
axis_tip: '最小值、最大值、间隔均为数值类型;若不填,则该项视为自动。<br/>请确保填写数值能正确计算,否则将无法正常显示轴值。',
|
||||
format_tip: `模板变量有 {a}, {b},{c},{d},分别表示系列名,数据名,数据值等。<br>
|
||||
@ -1947,8 +1949,8 @@ export default {
|
||||
jsonpath_info: '请填入JsonPath',
|
||||
req_param: '请求参数',
|
||||
headers: '请求头',
|
||||
query_param: "QUERY参数",
|
||||
query_info: "地址栏中跟在?后面的参数,如: updateapi?id=112",
|
||||
query_param: 'QUERY参数',
|
||||
query_info: '地址栏中跟在?后面的参数,如: updateapi?id=112',
|
||||
key: '键',
|
||||
value: '值',
|
||||
data_path: '提取数据',
|
||||
@ -2929,5 +2931,10 @@ export default {
|
||||
confirm_title: '强行登录会导致其他客户端掉线',
|
||||
confirm: '是否强行登录?',
|
||||
forced_offline: '`当前账号在客户端【${ip}】登录,您已被挤下线!`'
|
||||
},
|
||||
online_map: {
|
||||
geometry: '地理信息',
|
||||
onlinemap: '在线地图',
|
||||
empty_desc: '暂无在线地图key'
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,6 +481,7 @@ export const DEFAULT_FUNCTION_CFG = {
|
||||
}
|
||||
export const DEFAULT_THRESHOLD = {
|
||||
gaugeThreshold: '',
|
||||
liquidThreshold: '',
|
||||
labelThreshold: [],
|
||||
tableThreshold: [],
|
||||
textLabelThreshold: []
|
||||
|
||||
@ -336,7 +336,7 @@ export function seniorCfg(chart_option, chart) {
|
||||
}
|
||||
|
||||
const fixedLines = senior.assistLine.filter(ele => ele.field === '0')
|
||||
const dynamicLines = chart.data.dynamicAssistLines
|
||||
const dynamicLines = chart.data.dynamicAssistData
|
||||
const lines = fixedLines.concat(dynamicLines)
|
||||
|
||||
lines.forEach(ele => {
|
||||
|
||||
@ -300,21 +300,28 @@ export function getTooltip(chart) {
|
||||
const t = JSON.parse(JSON.stringify(customAttr.tooltip))
|
||||
if (t.show) {
|
||||
tooltip = {}
|
||||
let xAxis, yAxis, extStack
|
||||
|
||||
try {
|
||||
xAxis = JSON.parse(chart.xaxis)
|
||||
} catch (e) {
|
||||
xAxis = JSON.parse(JSON.stringify(chart.xaxis))
|
||||
}
|
||||
try {
|
||||
yAxis = JSON.parse(chart.yaxis)
|
||||
} catch (e) {
|
||||
yAxis = JSON.parse(JSON.stringify(chart.yaxis))
|
||||
}
|
||||
try {
|
||||
extStack = JSON.parse(chart.extStack)
|
||||
} catch (e) {
|
||||
extStack = JSON.parse(JSON.stringify(chart.extStack))
|
||||
}
|
||||
|
||||
// tooltip value formatter
|
||||
if (chart.type && chart.type !== 'waterfall') {
|
||||
tooltip.formatter = function(param) {
|
||||
let yAxis, extStack
|
||||
let res = param.value
|
||||
try {
|
||||
yAxis = JSON.parse(chart.yaxis)
|
||||
} catch (e) {
|
||||
yAxis = JSON.parse(JSON.stringify(chart.yaxis))
|
||||
}
|
||||
try {
|
||||
extStack = JSON.parse(chart.extStack)
|
||||
} catch (e) {
|
||||
extStack = JSON.parse(JSON.stringify(chart.extStack))
|
||||
}
|
||||
|
||||
let obj
|
||||
if (equalsAny(chart.type, 'bar-stack', 'line-stack',
|
||||
@ -445,6 +452,51 @@ export function getTooltip(chart) {
|
||||
obj.value = res === null ? '' : res
|
||||
return obj
|
||||
}
|
||||
//
|
||||
if (chart.type === 'scatter' && xAxis && xAxis.length > 0 && xAxis[0].groupType === 'q') {
|
||||
tooltip.fields = ['x', 'category', 'value', 'group']
|
||||
tooltip.customContent = (title, data) => {
|
||||
const key1 = xAxis[0]?.name
|
||||
let key2, v1, v2
|
||||
|
||||
if (data && data.length > 0) {
|
||||
title = data[0].data.category
|
||||
key2 = data[0].data.group
|
||||
|
||||
const fx = xAxis[0]
|
||||
if (fx.formatterCfg) {
|
||||
v1 = valueFormatter(data[0].data.x, fx.formatterCfg)
|
||||
} else {
|
||||
v1 = valueFormatter(data[0].data.x, formatterItem)
|
||||
}
|
||||
|
||||
for (let i = 0; i < yAxis.length; i++) {
|
||||
const f = yAxis[i]
|
||||
if (f.name === key2) {
|
||||
if (f.formatterCfg) {
|
||||
v2 = valueFormatter(data[0].data.value, f.formatterCfg)
|
||||
} else {
|
||||
v2 = valueFormatter(data[0].data.value, formatterItem)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return `
|
||||
<div>
|
||||
<div class="g2-tooltip-title">${title}</div>
|
||||
<div class="g2-tooltip-item">
|
||||
<span class="g2-tooltip-name">${key1}:</span><span class="g2-tooltip-value">${v1}</span>
|
||||
</div>
|
||||
<div class="g2-tooltip-item">
|
||||
<span class="g2-tooltip-name">${key2}:</span><span class="g2-tooltip-value">${v2}</span>
|
||||
</div>
|
||||
<div class="g2-tooltip-item"> </div>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 百分比堆叠柱状图隐藏 tooltip 设置 show 为 false 或者直接设置 tooltip 为 false 都无效,会变成分组显示,
|
||||
@ -952,7 +1004,7 @@ export function getAnalyse(chart) {
|
||||
}
|
||||
|
||||
const fixedLines = senior.assistLine.filter(ele => ele.field === '0')
|
||||
const dynamicLines = chart.data.dynamicAssistLines
|
||||
const dynamicLines = chart.data.dynamicAssistData
|
||||
const lines = fixedLines.concat(dynamicLines)
|
||||
|
||||
lines.forEach(ele => {
|
||||
|
||||
@ -31,6 +31,11 @@ export function baseLineOptionAntV(plot, container, chart, action) {
|
||||
const analyse = getAnalyse(chart)
|
||||
// options
|
||||
const options = {
|
||||
meta: {
|
||||
category: {
|
||||
type: 'cat'
|
||||
}
|
||||
},
|
||||
point: {},
|
||||
theme: theme,
|
||||
data: data,
|
||||
|
||||
@ -8,7 +8,7 @@ let labelFormatter = null
|
||||
export function baseLiquid(plot, container, chart) {
|
||||
let value = 0
|
||||
const colors = []
|
||||
let max, radius, bgColor, shape, labelContent
|
||||
let max, radius, bgColor, shape, labelContent, liquidStyle
|
||||
if (chart.data?.series.length > 0) {
|
||||
value = chart.data.series[0].data[0]
|
||||
}
|
||||
@ -53,6 +53,26 @@ export function baseLiquid(plot, container, chart) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// senior
|
||||
const senior = JSON.parse(chart.senior)
|
||||
if (senior?.threshold) {
|
||||
const { liquidThreshold } = senior?.threshold
|
||||
if (liquidThreshold) {
|
||||
liquidStyle = ({ percent }) => {
|
||||
const thresholdArr = liquidThreshold.split(',')
|
||||
let index = 0
|
||||
thresholdArr.forEach((v, i) => {
|
||||
if (percent > v / 100) {
|
||||
index = i + 1
|
||||
}
|
||||
})
|
||||
return {
|
||||
fill: colors[index % colors.length],
|
||||
stroke: colors[index % colors.length]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let customStyle
|
||||
if (chart.customStyle) {
|
||||
customStyle = JSON.parse(chart.customStyle)
|
||||
@ -78,7 +98,8 @@ export function baseLiquid(plot, container, chart) {
|
||||
shape: shape,
|
||||
statistic: {
|
||||
content: labelContent
|
||||
}
|
||||
},
|
||||
liquidStyle
|
||||
})
|
||||
return plot
|
||||
}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { Scene, LineLayer } from '@antv/l7'
|
||||
import { GaodeMap } from '@antv/l7-maps'
|
||||
import { getLanguage } from '@/lang'
|
||||
import { queryMapKey } from '@/api/map/map'
|
||||
|
||||
export function baseFlowMapOption(chartDom, chartId, chart, action) {
|
||||
export async function baseFlowMapOption(chartDom, chartId, chart, action) {
|
||||
const xAxis = JSON.parse(chart.xaxis)
|
||||
const xAxisExt = JSON.parse(chart.xaxisExt)
|
||||
let customAttr
|
||||
@ -20,9 +21,11 @@ export function baseFlowMapOption(chartDom, chartId, chart, action) {
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
const key = await getMapKey()
|
||||
chartDom = new Scene({
|
||||
id: chartId,
|
||||
map: new GaodeMap({
|
||||
token: key ?? undefined,
|
||||
lang: lang,
|
||||
pitch: size.mapPitch,
|
||||
style: mapStyle
|
||||
@ -85,3 +88,11 @@ export function baseFlowMapOption(chartDom, chartId, chart, action) {
|
||||
})
|
||||
return chartDom
|
||||
}
|
||||
|
||||
const getMapKey = async() => {
|
||||
const key = 'online-map-key'
|
||||
if (!localStorage.getItem(key)) {
|
||||
await queryMapKey().then(res => localStorage.setItem(key, res.data))
|
||||
}
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ export function baseScatterOptionAntV(plot, container, chart, action) {
|
||||
const options = {
|
||||
theme: theme,
|
||||
data: data,
|
||||
xField: 'field',
|
||||
xField: 'x',
|
||||
yField: 'value',
|
||||
colorField: 'category',
|
||||
appendPadding: getPadding(chart),
|
||||
|
||||
@ -551,21 +551,22 @@ function getConditions(chart) {
|
||||
}
|
||||
}
|
||||
|
||||
let filedValueMap = getFieldValueMap(chart)
|
||||
for (let i = 0; i < conditions.length; i++) {
|
||||
const field = conditions[i]
|
||||
res.text.push({
|
||||
field: field.field.dataeaseName,
|
||||
mapping(value) {
|
||||
mapping(value,rowData) {
|
||||
return {
|
||||
fill: mappingColor(value, valueColor, field, 'color')
|
||||
fill: mappingColor(value, valueColor, field, 'color', filedValueMap, rowData)
|
||||
}
|
||||
}
|
||||
})
|
||||
res.background.push({
|
||||
field: field.field.dataeaseName,
|
||||
mapping(value) {
|
||||
mapping(value,rowData) {
|
||||
return {
|
||||
fill: mappingColor(value, valueBgColor, field, 'backgroundColor')
|
||||
fill: mappingColor(value, valueBgColor, field, 'backgroundColor', filedValueMap, rowData)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -574,13 +575,37 @@ function getConditions(chart) {
|
||||
return res
|
||||
}
|
||||
|
||||
function mappingColor(value, defaultColor, field, type) {
|
||||
function getValue(field, filedValueMap, rowData){
|
||||
if (field.summary === 'value') {
|
||||
return rowData[field.curField.dataeaseName]
|
||||
} else {
|
||||
return filedValueMap[field.summary + '-' + field.fieldId]
|
||||
}
|
||||
}
|
||||
|
||||
function mappingColor(value, defaultColor, field, type, filedValueMap, rowData) {
|
||||
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)
|
||||
let tv,max,min;
|
||||
if (t.field === '1') {
|
||||
if (t.term === 'between') {
|
||||
max = parseFloat(getValue(t.maxField, filedValueMap, rowData))
|
||||
min = parseFloat(getValue(t.minField, filedValueMap, rowData))
|
||||
} else {
|
||||
tv = parseFloat(getValue(t.targetField, filedValueMap, rowData))
|
||||
}
|
||||
} else {
|
||||
if (t.term === 'between') {
|
||||
min = parseFloat(t.min)
|
||||
max = parseFloat(t.max)
|
||||
} else {
|
||||
tv = parseFloat(t.value)
|
||||
}
|
||||
}
|
||||
|
||||
if (t.term === 'eq') {
|
||||
if (value === tv) {
|
||||
color = t[type]
|
||||
@ -612,8 +637,6 @@ function mappingColor(value, defaultColor, field, type) {
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'between') {
|
||||
const min = parseFloat(t.min)
|
||||
const max = parseFloat(t.max)
|
||||
if (min <= value && value <= max) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
@ -625,7 +648,12 @@ function mappingColor(value, defaultColor, field, type) {
|
||||
color = defaultColor
|
||||
}
|
||||
} else if (field.field.deType === 0 || field.field.deType === 5) {
|
||||
const tv = t.value
|
||||
let tv;
|
||||
if (t.field === '1') {
|
||||
tv = getValue(t.targetField, filedValueMap, rowData)
|
||||
} else {
|
||||
tv = t.value
|
||||
}
|
||||
if (t.term === 'eq') {
|
||||
if (value === tv) {
|
||||
color = t[type]
|
||||
@ -664,7 +692,16 @@ function mappingColor(value, defaultColor, field, type) {
|
||||
}
|
||||
} else {
|
||||
// time
|
||||
const tv = new Date(t.value.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
let tv;
|
||||
if (t.field === '1') {
|
||||
let fieldValue = getValue(t.targetField, filedValueMap, rowData);
|
||||
if (fieldValue) {
|
||||
tv = new Date(fieldValue.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
}
|
||||
} else {
|
||||
tv = new Date(t.value.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
}
|
||||
|
||||
const v = new Date(value.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
if (t.term === 'eq') {
|
||||
if (v === tv) {
|
||||
@ -722,3 +759,13 @@ function showTooltip(s2Instance, event, fieldMap) {
|
||||
content
|
||||
})
|
||||
}
|
||||
|
||||
function getFieldValueMap(view){
|
||||
let fieldValueMap = {}
|
||||
if (view.data && view.data.dynamicAssistData && view.data.dynamicAssistData.length > 0) {
|
||||
view.data.dynamicAssistData.forEach(ele => {
|
||||
fieldValueMap[ele.summary + '-' + ele.fieldId] = ele.value
|
||||
});
|
||||
}
|
||||
return fieldValueMap;
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ export default {
|
||||
})
|
||||
window.addEventListener('resize', this.calcHeightDelay)
|
||||
},
|
||||
drawView() {
|
||||
async drawView() {
|
||||
const chart = JSON.parse(JSON.stringify(this.chart))
|
||||
// type
|
||||
// if (chart.data) {
|
||||
@ -298,7 +298,7 @@ export default {
|
||||
} else if (chart.type === 'chart-mix') {
|
||||
this.myChart = baseMixOptionAntV(this.myChart, this.chartId, chart, this.antVAction)
|
||||
} else if (chart.type === 'flow-map') {
|
||||
this.myChart = baseFlowMapOption(this.myChart, this.chartId, chart, this.antVAction)
|
||||
this.myChart = await baseFlowMapOption(this.myChart, this.chartId, chart, this.antVAction)
|
||||
} else if (chart.type === 'bidirectional-bar') {
|
||||
this.myChart = baseBidirectionalBarOptionAntV(this.myChart, this.chartId, chart, this.antVAction)
|
||||
} else {
|
||||
@ -338,7 +338,6 @@ export default {
|
||||
}
|
||||
this.setBackGroundBorder()
|
||||
},
|
||||
|
||||
antVAction(param) {
|
||||
switch (this.chart.type) {
|
||||
case 'treemap':
|
||||
@ -355,7 +354,8 @@ export default {
|
||||
}
|
||||
this.linkageActiveParam = {
|
||||
category: this.pointParam.data.category ? this.pointParam.data.category : 'NO_DATA',
|
||||
name: this.pointParam.data.name ? this.pointParam.data.name : 'NO_DATA'
|
||||
name: this.pointParam.data.name ? this.pointParam.data.name : 'NO_DATA',
|
||||
group: this.pointParam.data.group ? this.pointParam.data.group : 'NO_DATA'
|
||||
}
|
||||
if (this.trackMenu.length < 2) { // 只有一个事件直接调用
|
||||
this.trackClick(this.trackMenu[0])
|
||||
@ -392,14 +392,18 @@ export default {
|
||||
name: this.pointParam.data.name,
|
||||
viewId: this.chart.id,
|
||||
dimensionList: this.pointParam.data.dimensionList,
|
||||
quotaList: quotaList
|
||||
quotaList: quotaList,
|
||||
category: this.pointParam.data.category,
|
||||
group: this.pointParam.data.group
|
||||
}
|
||||
const jumpParam = {
|
||||
option: 'jump',
|
||||
name: this.pointParam.data.name,
|
||||
viewId: this.chart.id,
|
||||
dimensionList: this.pointParam.data.dimensionList,
|
||||
quotaList: quotaList
|
||||
quotaList: quotaList,
|
||||
category: this.pointParam.data.category,
|
||||
group: this.pointParam.data.group
|
||||
}
|
||||
|
||||
switch (trackAction) {
|
||||
|
||||
@ -275,6 +275,10 @@ export default {
|
||||
quotaData: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
specialType: {
|
||||
type: String,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -436,23 +440,35 @@ export default {
|
||||
showRename() {
|
||||
this.item.index = this.index
|
||||
this.item.renameType = 'quota'
|
||||
if (this.specialType) {
|
||||
this.item.renameType = this.specialType
|
||||
}
|
||||
this.item.dsFieldName = getOriginFieldName(this.dimensionData, this.quotaData, this.item)
|
||||
this.$emit('onNameEdit', this.item)
|
||||
},
|
||||
removeItem() {
|
||||
this.item.index = this.index
|
||||
this.item.removeType = 'quota'
|
||||
if (this.specialType) {
|
||||
this.item.removeType = this.specialType
|
||||
}
|
||||
this.$emit('onQuotaItemRemove', this.item)
|
||||
},
|
||||
editFilter() {
|
||||
this.item.index = this.index
|
||||
this.item.filterType = 'quota'
|
||||
if (this.specialType) {
|
||||
this.item.filterType = this.specialType
|
||||
}
|
||||
this.$emit('editItemFilter', this.item)
|
||||
},
|
||||
|
||||
editCompare() {
|
||||
this.item.index = this.index
|
||||
this.item.calcType = 'quota'
|
||||
if (this.specialType) {
|
||||
this.item.calcType = this.specialType
|
||||
}
|
||||
this.$emit('editItemCompare', this.item)
|
||||
},
|
||||
getItemTagType() {
|
||||
@ -462,6 +478,9 @@ export default {
|
||||
valueFormatter() {
|
||||
this.item.index = this.index
|
||||
this.item.formatterType = 'quota'
|
||||
if (this.specialType) {
|
||||
this.item.formatterType = this.specialType
|
||||
}
|
||||
this.$emit('valueFormatter', this.item)
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,6 +198,9 @@ export default {
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'null',
|
||||
label: this.$t('chart.filter_null')
|
||||
}, {
|
||||
value: 'not_null',
|
||||
label: this.$t('chart.filter_not_null')
|
||||
}]
|
||||
@ -237,6 +240,9 @@ export default {
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'null',
|
||||
label: this.$t('chart.filter_null')
|
||||
}, {
|
||||
value: 'not_null',
|
||||
label: this.$t('chart.filter_not_null')
|
||||
}]
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
placement="right"
|
||||
title=""
|
||||
width="150"
|
||||
:append-to-body="false"
|
||||
trigger="click"
|
||||
>
|
||||
<i
|
||||
|
||||
@ -40,6 +40,45 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col v-if="chart.type && chart.type === 'liquid'">
|
||||
<el-form
|
||||
ref="thresholdForm"
|
||||
:model="thresholdForm"
|
||||
label-width="80px"
|
||||
size="mini"
|
||||
>
|
||||
<el-form-item
|
||||
:label="$t('chart.threshold_range')+'(%)'"
|
||||
class="form-item"
|
||||
>
|
||||
<span>0,</span>
|
||||
<el-input
|
||||
v-model="thresholdForm.liquidThreshold"
|
||||
style="width: 100px;margin: 0 10px;"
|
||||
:placeholder="$t('chart.threshold_range')"
|
||||
size="mini"
|
||||
clearable
|
||||
@change="gaugeThresholdChange"
|
||||
/>
|
||||
<span>,100</span>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
placement="bottom"
|
||||
>
|
||||
<div slot="content">
|
||||
阈值设置,决定水波图颜色,为空则不开启阈值,范围(0-100),逐级递增
|
||||
<br>
|
||||
例如:输入 30,70;表示:分为3段,分别为[0,30],(30,70],(70,100]
|
||||
</div>
|
||||
<i
|
||||
class="el-icon-info"
|
||||
style="cursor: pointer;margin-left: 10px;font-size: 12px;"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
||||
<!--文本卡-->
|
||||
<el-col v-if="chart.type && chart.type === 'label'">
|
||||
@ -212,7 +251,7 @@
|
||||
:key="index"
|
||||
class="line-style"
|
||||
>
|
||||
<el-col :span="6">
|
||||
<el-col :span="4">
|
||||
<span
|
||||
v-if="item.term === 'eq'"
|
||||
:title="$t('chart.filter_eq')"
|
||||
@ -266,7 +305,22 @@
|
||||
:title="$t('chart.filter_not_empty')"
|
||||
>{{ $t('chart.filter_not_empty') }}</span>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
|
||||
<el-col :span="4" v-if="!item.term.includes('null') && !item.term.includes('empty')">
|
||||
<span
|
||||
v-if="item.field === '0'"
|
||||
:title="$t('chart.field_fixed')"
|
||||
>{{ $t('chart.field_fixed') }}</span>
|
||||
<span
|
||||
v-if="item.field === '1'"
|
||||
:title="$t('chart.field_dynamic')"
|
||||
>{{ $t('chart.field_dynamic') }}</span>
|
||||
</el-col>
|
||||
<el-col :span="4" v-if="item.term.includes('null') || item.term.includes('empty')">
|
||||
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10" v-if="item.field === '0'">
|
||||
<span
|
||||
v-if="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
|
||||
:title="item.value"
|
||||
@ -276,13 +330,27 @@
|
||||
</span>
|
||||
<span v-else> </span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
|
||||
<el-col :span="10" v-if="item.field === '1'">
|
||||
<span v-if="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
|
||||
:title="item.targetField.curField.name + '(' + $t('chart.' + item.targetField.summary) + ')'">{{ item.targetField.curField.name + '(' + $t('chart.' + item.targetField.summary) + ')' }}</span>
|
||||
|
||||
|
||||
<span v-else-if="!item.term.includes('null') && !item.term.includes('empty') && item.term === 'between'"
|
||||
:title="item.minField.curField.name + '(' + $t('chart.' + item.minField.summary) + ')' + ' ≤' + $t('chart.drag_block_label_value') + '≤ ' + item.maxField.curField.name + '(' + $t('chart.' + item.maxField.summary) + ')'">
|
||||
{{ item.minField.curField.name + '(' + $t('chart.' + item.minField.summary) + ')' + ' ≤' + $t('chart.drag_block_label_value') + '≤ ' + item.maxField.curField.name + '(' + $t('chart.' + item.maxField.summary) + ')' }}
|
||||
</span>
|
||||
|
||||
<span v-else> </span>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="2">
|
||||
<span
|
||||
:title="$t('chart.textColor')"
|
||||
:style="{width:'14px', height:'14px', backgroundColor: item.color, border: 'solid 1px #e1e4e8'}"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-col :span="2">
|
||||
<span
|
||||
:title="$t('chart.backgroundColor')"
|
||||
:style="{width:'14px', height:'14px', backgroundColor: item.backgroundColor, border: 'solid 1px #e1e4e8'}"
|
||||
@ -363,7 +431,7 @@
|
||||
:title="$t('chart.threshold')"
|
||||
:visible="editTableThresholdDialog"
|
||||
:show-close="false"
|
||||
width="800px"
|
||||
width="1050px"
|
||||
class="dialog-css"
|
||||
append-to-body
|
||||
>
|
||||
@ -459,10 +527,10 @@ export default {
|
||||
changeThreshold() {
|
||||
this.$emit('onThresholdChange', this.thresholdForm)
|
||||
},
|
||||
gaugeThresholdChange() {
|
||||
gaugeThresholdChange(val) {
|
||||
// check input
|
||||
if (this.thresholdForm.gaugeThreshold) {
|
||||
const arr = this.thresholdForm.gaugeThreshold.split(',')
|
||||
if (val) {
|
||||
const arr = val.split(',')
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const ele = arr[i]
|
||||
if (parseFloat(ele).toString() === 'NaN' || parseFloat(ele) <= 0 || parseFloat(ele) >= 100) {
|
||||
@ -593,6 +661,10 @@ export default {
|
||||
closeTableThreshold() {
|
||||
this.editTableThresholdDialog = false
|
||||
},
|
||||
fieldValid(field) {
|
||||
// 检查字段和聚合方式是否不为空
|
||||
return field && field.fieldId && field.summary;
|
||||
},
|
||||
changeTableThreshold() {
|
||||
// check line config
|
||||
for (let i = 0; i < this.tableThresholdArr.length; i++) {
|
||||
@ -624,7 +696,7 @@ export default {
|
||||
return
|
||||
}
|
||||
if (ele.term === 'between') {
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && (!ele.min || !ele.max)) {
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && ((ele.field === '0' && (!ele.min || !ele.max)) || (ele.field === '1' && (!this.fieldValid(ele.minField) || !this.fieldValid(ele.maxField))))) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
type: 'error',
|
||||
@ -641,7 +713,7 @@ export default {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && !ele.value) {
|
||||
if (!ele.term.includes('null') && !ele.term.includes('empty') && ((ele.field === '0' && !ele.value) || (ele.field === '1' && !this.fieldValid(ele.targetField)))) {
|
||||
this.$message({
|
||||
message: this.$t('chart.value_can_not_empty'),
|
||||
type: 'error',
|
||||
@ -649,7 +721,7 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && parseFloat(ele.value).toString() === 'NaN') {
|
||||
if (ele.field === '0' && (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',
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<el-select
|
||||
v-model="fieldItem.fieldId"
|
||||
size="mini"
|
||||
@change="addField(fieldItem)"
|
||||
@change="onFieldChange(fieldItem)"
|
||||
>
|
||||
<el-option
|
||||
v-for="fieldOption in fields"
|
||||
@ -72,11 +72,11 @@
|
||||
:key="index"
|
||||
class="line-item"
|
||||
>
|
||||
<el-col :span="4">
|
||||
<el-col :span="3">
|
||||
<el-select
|
||||
v-model="item.term"
|
||||
size="mini"
|
||||
@change="changeThreshold"
|
||||
@change="changeThresholdField(item)"
|
||||
>
|
||||
<el-option-group
|
||||
v-for="(group,idx) in fieldItem.options"
|
||||
@ -92,24 +92,41 @@
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="3">
|
||||
<el-select
|
||||
v-show="!item.term.includes('null') && !item.term.includes('empty')"
|
||||
v-model="item.field"
|
||||
size="mini"
|
||||
style="margin-left: 10px;"
|
||||
@change="changeThresholdField(item)"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in fieldTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="10"
|
||||
style="text-align: center;"
|
||||
v-if="item.field === '0'"
|
||||
:span="12"
|
||||
>
|
||||
<el-input
|
||||
v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
|
||||
v-model="item.value"
|
||||
class="value-item"
|
||||
style="margin-left: 10px;"
|
||||
:placeholder="$t('chart.drag_block_label_value')"
|
||||
size="mini"
|
||||
clearable
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
<span v-if="item.term === 'between'">
|
||||
<el-input
|
||||
v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
|
||||
v-model="item.value"
|
||||
class="value-item"
|
||||
style="margin-left: 10px;"
|
||||
:placeholder="$t('chart.drag_block_label_value')"
|
||||
size="mini"
|
||||
clearable
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
<span v-if="item.term === 'between'">
|
||||
<el-input
|
||||
v-model="item.min"
|
||||
class="between-item"
|
||||
class="item-long-between"
|
||||
:placeholder="$t('chart.axis_value_min')"
|
||||
size="mini"
|
||||
clearable
|
||||
@ -118,7 +135,7 @@
|
||||
<span style="margin: 0 4px;">≤{{ $t('chart.drag_block_label_value') }}≤</span>
|
||||
<el-input
|
||||
v-model="item.max"
|
||||
class="between-item"
|
||||
class="item-long-between"
|
||||
:placeholder="$t('chart.axis_value_max')"
|
||||
size="mini"
|
||||
clearable
|
||||
@ -127,7 +144,185 @@
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="4"
|
||||
v-if="item.field === '1'"
|
||||
:span="12"
|
||||
>
|
||||
<span v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'">
|
||||
<el-select
|
||||
v-model="item.targetField.fieldId"
|
||||
size="mini"
|
||||
style="margin-left: 10px;"
|
||||
class="item-long select-item"
|
||||
@change="changeThresholdField(item)"
|
||||
@visible-change="$forceUpdate()"
|
||||
>
|
||||
<el-option
|
||||
v-for="fieldOption in fieldItem.fieldOptions"
|
||||
: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.deType === 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-select
|
||||
v-model="item.targetField.summary"
|
||||
size="mini"
|
||||
class="item-long select-item"
|
||||
style="margin-left: 10px;"
|
||||
:placeholder="$t('chart.aggregation')"
|
||||
@change="changeThreshold"
|
||||
@visible-change="$forceUpdate()"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in getSummaryOptions(fieldItem.field.deType)"
|
||||
:key="opt.id"
|
||||
:value="opt.id"
|
||||
:label="opt.name"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
|
||||
<span v-if="item.term === 'between'">
|
||||
<el-select
|
||||
v-model="item.minField.fieldId"
|
||||
size="mini"
|
||||
style="margin-left: 10px;"
|
||||
class="select-item item-short"
|
||||
@change="changeThresholdField(item)"
|
||||
@visible-change="$forceUpdate()"
|
||||
>
|
||||
<el-option
|
||||
v-for="fieldOption in fieldItem.fieldOptions"
|
||||
: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.deType === 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-select
|
||||
v-model="item.minField.summary"
|
||||
size="mini"
|
||||
class="select-item item-short"
|
||||
style="margin-left: 10px;"
|
||||
:placeholder="$t('chart.aggregation')"
|
||||
@change="changeThreshold"
|
||||
@visible-change="$forceUpdate()"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in getSummaryOptions(fieldItem.field.deType)"
|
||||
:key="opt.id"
|
||||
:value="opt.id"
|
||||
:label="opt.name"
|
||||
/>
|
||||
</el-select>
|
||||
<span style="margin: 0 4px;">≤{{ $t('chart.drag_block_label_value') }}≤</span>
|
||||
<el-select
|
||||
v-model="item.maxField.fieldId"
|
||||
size="mini"
|
||||
class="select-item item-short"
|
||||
@change="changeThresholdField(item)"
|
||||
@visible-change="$forceUpdate()"
|
||||
>
|
||||
<el-option
|
||||
v-for="fieldOption in fieldItem.fieldOptions"
|
||||
: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.deType === 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-select
|
||||
v-model="item.maxField.summary"
|
||||
size="mini"
|
||||
class="select-item item-short"
|
||||
style="margin-left: 10px;"
|
||||
:placeholder="$t('chart.aggregation')"
|
||||
@change="changeThreshold"
|
||||
@visible-change="$forceUpdate()"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in getSummaryOptions(fieldItem.field.deType)"
|
||||
:key="opt.id"
|
||||
:value="opt.id"
|
||||
:label="opt.name"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col
|
||||
:span="3"
|
||||
style="display: flex;align-items: center;justify-content: center;"
|
||||
>
|
||||
<span class="color-title">{{ $t('chart.textColor') }}</span>
|
||||
@ -140,7 +335,7 @@
|
||||
/>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="4"
|
||||
:span="3"
|
||||
style="display: flex;align-items: center;justify-content: center;"
|
||||
>
|
||||
<span class="color-title">{{ $t('chart.backgroundColor') }}</span>
|
||||
@ -152,7 +347,7 @@
|
||||
@change="changeThreshold"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-col :span="1">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@ -187,6 +382,11 @@ export default {
|
||||
return {
|
||||
thresholdArr: [],
|
||||
fields: [],
|
||||
fieldsByType: {
|
||||
text: [],
|
||||
value: [],
|
||||
date: []
|
||||
},
|
||||
thresholdObj: {
|
||||
fieldId: '',
|
||||
field: {},
|
||||
@ -199,8 +399,24 @@ export default {
|
||||
color: '#ff0000ff',
|
||||
backgroundColor: '#ffffff00',
|
||||
min: '0',
|
||||
max: '1'
|
||||
max: '1',
|
||||
targetField:{},
|
||||
minField:{},
|
||||
maxField:{}
|
||||
},
|
||||
summaryOptions: [{
|
||||
id: 'value',
|
||||
name: this.$t('chart.value')
|
||||
}, {
|
||||
id: 'avg',
|
||||
name: this.$t('chart.avg')
|
||||
}, {
|
||||
id: 'max',
|
||||
name: this.$t('chart.max')
|
||||
}, {
|
||||
id: 'min',
|
||||
name: this.$t('chart.min')
|
||||
}],
|
||||
textOptions: [
|
||||
{
|
||||
label: '',
|
||||
@ -304,6 +520,10 @@ export default {
|
||||
}]
|
||||
}
|
||||
],
|
||||
fieldTypeOptions: [
|
||||
{ label: this.$t('chart.field_fixed'), value: '0' },
|
||||
{ label: this.$t('chart.field_dynamic'), value: '1' }
|
||||
],
|
||||
predefineColors: COLOR_PANEL
|
||||
}
|
||||
},
|
||||
@ -314,6 +534,26 @@ export default {
|
||||
init() {
|
||||
this.thresholdArr = JSON.parse(JSON.stringify(this.threshold))
|
||||
this.initFields()
|
||||
this.thresholdArr && this.thresholdArr.forEach(ele => {
|
||||
this.initOptions(ele)
|
||||
if (ele.conditions) {
|
||||
for (const item of ele.conditions) {
|
||||
this.initConditionField(item)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
initConditionField(item) {
|
||||
// 兼容旧数据
|
||||
if (!item.targetField) {
|
||||
item.targetField = {};
|
||||
}
|
||||
if (!item.minField) {
|
||||
item.minField = {};
|
||||
}
|
||||
if (!item.maxField) {
|
||||
item.maxField = {};
|
||||
}
|
||||
},
|
||||
initOptions(item) {
|
||||
if (item.field) {
|
||||
@ -324,9 +564,18 @@ export default {
|
||||
} else {
|
||||
item.options = JSON.parse(JSON.stringify(this.valueOptions))
|
||||
}
|
||||
item.conditions && item.conditions.forEach(ele => {
|
||||
ele.term = ''
|
||||
})
|
||||
this.initFieldOptions(item)
|
||||
}
|
||||
},
|
||||
initFieldOptions(item) {
|
||||
if (item.field) {
|
||||
if (item.field.deType === 0 || item.field.deType === 5) {
|
||||
item.fieldOptions = this.fieldsByType.text
|
||||
} else if (item.field.deType === 1) {
|
||||
item.fieldOptions = this.fieldsByType.date
|
||||
} else {
|
||||
item.fieldOptions = this.fieldsByType.value
|
||||
}
|
||||
}
|
||||
},
|
||||
initFields() {
|
||||
@ -355,8 +604,36 @@ export default {
|
||||
this.fields = this.fields.concat(JSON.parse(this.chart.yaxis))
|
||||
}
|
||||
}
|
||||
// 暂不支持时间
|
||||
// this.fields = this.fields.filter(ele => ele.deType !== 1)
|
||||
|
||||
// 区分文本、数值、日期字段
|
||||
this.fields.forEach(ele => {
|
||||
// 视图字段和计数字段不可用
|
||||
if (ele.chartId || ele.id === 'count') {
|
||||
return;
|
||||
}
|
||||
if (ele.deType === 0 || ele.deType === 5) {
|
||||
this.fieldsByType.text.push(ele)
|
||||
} else if (ele.deType === 1) {
|
||||
this.fieldsByType.date.push(ele)
|
||||
} else {
|
||||
this.fieldsByType.value.push(ele)
|
||||
}
|
||||
})
|
||||
},
|
||||
getSummaryOptions(deType) {
|
||||
if (deType === 1) {
|
||||
// 时间
|
||||
return this.summaryOptions.filter(ele => {
|
||||
return ele.id !== 'avg'
|
||||
})
|
||||
} else if (deType === 0 || deType === 5) {
|
||||
// 文本、地理位置
|
||||
return this.summaryOptions.filter(ele => {
|
||||
return ele.id === 'value'
|
||||
})
|
||||
} else {
|
||||
return this.summaryOptions
|
||||
}
|
||||
},
|
||||
addThreshold() {
|
||||
this.thresholdArr.push(JSON.parse(JSON.stringify(this.thresholdObj)))
|
||||
@ -366,11 +643,40 @@ export default {
|
||||
this.thresholdArr.splice(index, 1)
|
||||
this.changeThreshold()
|
||||
},
|
||||
|
||||
changeThreshold() {
|
||||
this.$emit('onTableThresholdChange', this.thresholdArr)
|
||||
},
|
||||
|
||||
changeThresholdField(item) {
|
||||
if (item.field === '1') {
|
||||
if (item.term === 'between') {
|
||||
item.minField.curField = this.getQuotaField(item.minField.fieldId)
|
||||
item.maxField.curField = this.getQuotaField(item.maxField.fieldId)
|
||||
item.targetField = {};
|
||||
} else {
|
||||
item.targetField.curField = this.getQuotaField(item.targetField.fieldId)
|
||||
item.minField = {};
|
||||
item.maxField = {};
|
||||
}
|
||||
} else {
|
||||
item.targetField = {};
|
||||
item.minField = {};
|
||||
item.maxField = {};
|
||||
}
|
||||
this.changeThreshold()
|
||||
},
|
||||
getQuotaField(id) {
|
||||
if (!id) {
|
||||
return {}
|
||||
}
|
||||
const fields = this.fields.filter(ele => {
|
||||
return ele.id === id
|
||||
})
|
||||
if (fields.length === 0) {
|
||||
return {}
|
||||
} else {
|
||||
return fields[0]
|
||||
}
|
||||
},
|
||||
addConditions(item) {
|
||||
item.conditions.push(JSON.parse(JSON.stringify(this.thresholdCondition)))
|
||||
this.changeThreshold()
|
||||
@ -379,7 +685,7 @@ export default {
|
||||
item.conditions.splice(index, 1)
|
||||
this.changeThreshold()
|
||||
},
|
||||
addField(item) {
|
||||
onFieldChange(item) {
|
||||
// get field
|
||||
if (this.fields && this.fields.length > 0) {
|
||||
this.fields.forEach(ele => {
|
||||
@ -389,6 +695,10 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
// 清空 term
|
||||
item.conditions && item.conditions.forEach(ele => {
|
||||
ele.term = ''
|
||||
})
|
||||
this.changeThreshold()
|
||||
}
|
||||
}
|
||||
@ -424,18 +734,34 @@ span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.between-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 90px !important;
|
||||
}
|
||||
|
||||
.select-item {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.item-long {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 220px !important;
|
||||
}
|
||||
|
||||
.item-long-between {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.item-long:first-child,.item-short:first-child,.item-long-between:first-child {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.item-short {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 95px !important;
|
||||
}
|
||||
|
||||
.el-select-dropdown__item {
|
||||
padding: 0 20px;
|
||||
font-size: 12px;
|
||||
|
||||
@ -631,9 +631,14 @@ export default {
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
isPlugin() {
|
||||
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
|
||||
return plugins.some(plugin => plugin.value === this.view.type && plugin.render === this.view.render)
|
||||
},
|
||||
watchChartTypeChangeObj() {
|
||||
const { type, render } = this.view
|
||||
return { type, render }
|
||||
const isPlugin = this.isPlugin
|
||||
return { type, render, isPlugin }
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -657,10 +662,11 @@ export default {
|
||||
// this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
|
||||
// },
|
||||
watchChartTypeChangeObj(newVal, oldVal) {
|
||||
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
|
||||
return
|
||||
}
|
||||
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
|
||||
this.view.isPlugin = newVal.isPlugin
|
||||
// if (newVal.type === oldVal.type && newVal.render === oldVal.render && newVal.isPlugin === oldVal.isPlugin) {
|
||||
// return
|
||||
// }
|
||||
// this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
|
||||
}
|
||||
|
||||
},
|
||||
@ -687,12 +693,22 @@ export default {
|
||||
this.getChartGroupTree()
|
||||
},
|
||||
methods: {
|
||||
distinctArray(arr, key) {
|
||||
const m = new Map()
|
||||
for (const item of arr) {
|
||||
if (!m.has(item[key])) {
|
||||
m.set(item[key], item)
|
||||
}
|
||||
}
|
||||
return [...m.values()]
|
||||
},
|
||||
loadPluginType() {
|
||||
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
|
||||
const pluginOptions = plugins.filter(plugin => !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => {
|
||||
return { name: plugin.render, value: plugin.render }
|
||||
})
|
||||
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
|
||||
const tempList = [...this.renderOptions, ...pluginOptions]
|
||||
this.pluginRenderOptions = this.distinctArray(tempList, 'value')
|
||||
},
|
||||
clickAdd(param) {
|
||||
this.currGroup = param.data
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
@hide="hideTab"
|
||||
>
|
||||
<dataset-chart-detail
|
||||
v-if="tabStatus"
|
||||
type="chart"
|
||||
:data="view"
|
||||
:tab-status="tabStatus"
|
||||
@ -558,8 +559,11 @@
|
||||
$t('chart.drag_block_table_data_column')
|
||||
}}</span>
|
||||
<span
|
||||
v-else-if="view.type && (view.type.includes('bar') || view.type.includes('line') || view.type.includes('scatter') || view.type === 'chart-mix' || view.type === 'waterfall' || view.type === 'area')"
|
||||
v-else-if="view.type && (view.type.includes('bar') || view.type.includes('line') || (view.type.includes('scatter') && view.render !== 'antv') || view.type === 'chart-mix' || view.type === 'waterfall' || view.type === 'area')"
|
||||
>{{ $t('chart.drag_block_type_axis') }}</span>
|
||||
<span
|
||||
v-else-if="view.type && (view.type.includes('scatter') && view.render === 'antv')"
|
||||
>{{ $t('chart.x_axis') }}</span>
|
||||
<span
|
||||
v-else-if="view.type && view.type.includes('pie')"
|
||||
>{{ $t('chart.drag_block_pie_label') }}</span>
|
||||
@ -579,7 +583,10 @@
|
||||
<span v-else-if="view.type && view.type === 'label'">{{ $t('chart.drag_block_label') }}</span>
|
||||
<span v-else-if="view.type === 'flow-map'">{{ $t('chart.start_point') }}</span>
|
||||
<span v-show="view.type !== 'richTextView'"> / </span>
|
||||
<span v-if="view.type && view.type !== 'table-info'">
|
||||
<span
|
||||
v-if="view.type && (view.type.includes('scatter') && view.render === 'antv')"
|
||||
>{{ $t('chart.dimension_or_quota') }}</span>
|
||||
<span v-else-if="view.type && view.type !== 'table-info'">
|
||||
{{ $t('chart.dimension') }}
|
||||
</span>
|
||||
<span
|
||||
@ -600,22 +607,41 @@
|
||||
@update="calcData(true)"
|
||||
>
|
||||
<transition-group class="draggable-group">
|
||||
<dimension-item
|
||||
v-for="(item,index) in view.xaxis"
|
||||
:key="item.id"
|
||||
:param="param"
|
||||
:index="index"
|
||||
:item="item"
|
||||
:dimension-data="dimension"
|
||||
:quota-data="quota"
|
||||
:chart="chart"
|
||||
@onDimensionItemChange="dimensionItemChange"
|
||||
@onDimensionItemRemove="dimensionItemRemove"
|
||||
@editItemFilter="showDimensionEditFilter"
|
||||
@onNameEdit="showRename"
|
||||
@valueFormatter="valueFormatter"
|
||||
@onCustomSort="onCustomSort"
|
||||
/>
|
||||
<template v-for="(item,index) in view.xaxis">
|
||||
<quota-item
|
||||
v-if="view.type === 'scatter' && item.groupType === 'q' && view.render === 'antv'"
|
||||
:key="item.id"
|
||||
:param="param"
|
||||
:index="index"
|
||||
:item="item"
|
||||
:chart="chart"
|
||||
:dimension-data="dimension"
|
||||
:quota-data="quota"
|
||||
special-type="dimension"
|
||||
@onQuotaItemChange="dimensionItemChange"
|
||||
@onQuotaItemRemove="dimensionItemRemove"
|
||||
@editItemFilter="showQuotaEditFilter"
|
||||
@onNameEdit="showRename"
|
||||
@editItemCompare="showQuotaEditCompare"
|
||||
@valueFormatter="valueFormatter"
|
||||
/>
|
||||
<dimension-item
|
||||
v-else
|
||||
:key="item.id"
|
||||
:param="param"
|
||||
:index="index"
|
||||
:item="item"
|
||||
:dimension-data="dimension"
|
||||
:quota-data="quota"
|
||||
:chart="chart"
|
||||
@onDimensionItemChange="dimensionItemChange"
|
||||
@onDimensionItemRemove="dimensionItemRemove"
|
||||
@editItemFilter="showDimensionEditFilter"
|
||||
@onNameEdit="showRename"
|
||||
@valueFormatter="valueFormatter"
|
||||
@onCustomSort="onCustomSort"
|
||||
/>
|
||||
</template>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
<div
|
||||
@ -833,14 +859,29 @@
|
||||
</el-row>
|
||||
<!--extStack-->
|
||||
<el-row
|
||||
v-if="view.type && view.type.includes('stack')"
|
||||
v-if="view.type && (view.type.includes('stack') || (view.type === 'scatter' && view.render === 'antv'))"
|
||||
class="padding-lr"
|
||||
style="margin-top: 6px;"
|
||||
>
|
||||
<span class="data-area-label">
|
||||
<span>{{ $t('chart.stack_item') }}</span>
|
||||
<span v-if="view.type.includes('stack')">{{ $t('chart.stack_item') }}</span>
|
||||
<span v-else>{{ $t('chart.form_type') }}</span>
|
||||
/
|
||||
<span>{{ $t('chart.dimension') }}</span>
|
||||
<el-tooltip
|
||||
v-if="view.type === 'scatter'"
|
||||
class="item"
|
||||
effect="dark"
|
||||
placement="bottom"
|
||||
>
|
||||
<div slot="content">
|
||||
{{ $t('chart.scatter_group_tip') }}
|
||||
</div>
|
||||
<i
|
||||
class="el-icon-info"
|
||||
style="cursor: pointer;color: #606266;"
|
||||
/>
|
||||
</el-tooltip>
|
||||
<i
|
||||
class="el-icon-arrow-down el-icon-delete data-area-clear"
|
||||
@click="clearData('extStack')"
|
||||
@ -1956,7 +1997,7 @@ export default {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
showCfg() {
|
||||
return includesAny(this.view.type, 'bar', 'line', 'area', 'gauge', 'table') && this.view.type !== 'race-bar' ||
|
||||
return includesAny(this.view.type, 'bar', 'line', 'area', 'gauge', 'table', 'liquid') && this.view.type !== 'race-bar' ||
|
||||
equalsAny(this.view.type, 'text', 'label', 'map', 'buddle-map')
|
||||
},
|
||||
showSeniorCfg() {
|
||||
@ -1974,7 +2015,7 @@ export default {
|
||||
if (this.view.type === 'bidirectional-bar') {
|
||||
return false
|
||||
}
|
||||
return includesAny(this.view.type, 'bar', 'line', 'area', 'gauge') ||
|
||||
return includesAny(this.view.type, 'bar', 'line', 'area', 'gauge', 'liquid') ||
|
||||
equalsAny(this.view.type, 'text', 'label') ||
|
||||
(this.view.render === 'antv' && this.view.type.includes('table'))
|
||||
},
|
||||
@ -1985,7 +2026,7 @@ export default {
|
||||
if (this.view.type === 'bidirectional-bar') {
|
||||
return false
|
||||
}
|
||||
return includesAny(this.view.type, 'gauge') ||
|
||||
return includesAny(this.view.type, 'gauge', 'liquid') ||
|
||||
equalsAny(this.view.type, 'text', 'label') ||
|
||||
(this.view.render === 'antv' && this.view.type.includes('table'))
|
||||
},
|
||||
@ -1996,9 +2037,15 @@ export default {
|
||||
!equalsAny(this.view.type, 'liquid', 'bidirectional-bar',
|
||||
'word-cloud', 'table-pivot', 'label', 'richTextView', 'flow-map')
|
||||
},
|
||||
isPlugin() {
|
||||
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
|
||||
return plugins.some(plugin => plugin.value === this.view.type && plugin.render === this.view.render)
|
||||
},
|
||||
watchChartTypeChangeObj() {
|
||||
const { type, render } = this.view
|
||||
return { type, render }
|
||||
const isPlugin = this.isPlugin
|
||||
const id = this.chart.id
|
||||
return { type, render, isPlugin, id }
|
||||
},
|
||||
...mapState([
|
||||
'curComponent',
|
||||
@ -2036,10 +2083,33 @@ export default {
|
||||
this.$emit('typeChange', newVal)
|
||||
},
|
||||
watchChartTypeChangeObj(newVal, oldVal) {
|
||||
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
|
||||
this.view.isPlugin = newVal.isPlugin
|
||||
if (newVal.id === oldVal.id && newVal.type !== oldVal.type && oldVal.type === 'table-info' && this.view.xaxis.length > 0) {
|
||||
// 针对明细表切换为其他图表
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: this.$t('chart.table_info_switch'),
|
||||
type: 'warning'
|
||||
})
|
||||
this.view.xaxis = []
|
||||
}
|
||||
if (newVal.id === oldVal.id && newVal.type !== oldVal.type) {
|
||||
this.view.senior.threshold = {}
|
||||
}
|
||||
if (newVal.type === oldVal.type && newVal.render === oldVal.render && newVal.isPlugin === oldVal.isPlugin) {
|
||||
return
|
||||
}
|
||||
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
|
||||
if (newVal.render === 'antv' && newVal.type === 'chart-mix') {
|
||||
// 针对antv组合图,清理自定义排序
|
||||
this.view.xaxis.forEach(x => {
|
||||
x.customSort = []
|
||||
x.sort = 'none'
|
||||
})
|
||||
}
|
||||
if (oldVal.id !== 'echart') {
|
||||
this.setChartDefaultOptions()
|
||||
this.calcData(true, 'chart', true, newVal.type !== oldVal.type, newVal.render !== oldVal.render)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -2098,7 +2168,17 @@ export default {
|
||||
const pluginOptions = plugins.filter(plugin => !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => {
|
||||
return { name: plugin.render, value: plugin.render }
|
||||
})
|
||||
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
|
||||
const tempList = [...this.renderOptions, ...pluginOptions]
|
||||
this.pluginRenderOptions = this.distinctArray(tempList, 'value')
|
||||
},
|
||||
distinctArray(arr, key) {
|
||||
const m = new Map()
|
||||
for (const item of arr) {
|
||||
if (!m.has(item[key])) {
|
||||
m.set(item[key], item)
|
||||
}
|
||||
}
|
||||
return [...m.values()]
|
||||
},
|
||||
emptyTableData(id) {
|
||||
this.table = {}
|
||||
@ -2237,17 +2317,7 @@ export default {
|
||||
parseInt(this.view.resultCount) < 1) {
|
||||
this.view.resultCount = '1000'
|
||||
}
|
||||
if (switchType) {
|
||||
this.view.senior.threshold = {}
|
||||
}
|
||||
if (switchType && (this.view.type === 'table-info' || this.chart.type === 'table-info') && this.view.xaxis.length > 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: this.$t('chart.table_info_switch'),
|
||||
type: 'warning'
|
||||
})
|
||||
this.view.xaxis = []
|
||||
}
|
||||
|
||||
const view = JSON.parse(JSON.stringify(this.view))
|
||||
view.id = this.view.id
|
||||
view.sceneId = this.view.sceneId
|
||||
@ -2273,6 +2343,20 @@ export default {
|
||||
if (!ele.filter) {
|
||||
ele.filter = []
|
||||
}
|
||||
|
||||
if (view.type === 'scatter') {
|
||||
if (ele.chartId) {
|
||||
ele.summary = ''
|
||||
} else {
|
||||
if (!ele.summary || ele.summary === '') {
|
||||
if (ele.id === 'count' || ele.deType === 0 || ele.deType === 1) {
|
||||
ele.summary = 'count'
|
||||
} else {
|
||||
ele.summary = 'sum'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
if (equalsAny(view.type, 'table-pivot', 'bar-group', 'bar-group-stack', 'flow-map', 'race-bar') ||
|
||||
(view.render === 'antv' && view.type === 'line')) {
|
||||
@ -2731,7 +2815,7 @@ export default {
|
||||
|
||||
onThresholdChange(val) {
|
||||
this.view.senior.threshold = val
|
||||
this.calcStyle()
|
||||
this.calcData()
|
||||
},
|
||||
|
||||
onScrollChange(val) {
|
||||
@ -2806,6 +2890,9 @@ export default {
|
||||
} else if (this.quotaItem.filterType === 'quotaExt') {
|
||||
this.view.yaxisExt[this.quotaItem.index].filter = this.quotaItem.filter
|
||||
this.view.yaxisExt[this.quotaItem.index].logic = this.quotaItem.logic
|
||||
} else if (this.quotaItem.filterType === 'dimension') {
|
||||
this.view.xaxis[this.quotaItem.index].filter = this.quotaItem.filter
|
||||
this.view.xaxis[this.quotaItem.index].logic = this.quotaItem.logic
|
||||
}
|
||||
this.calcData(true)
|
||||
this.closeQuotaFilter()
|
||||
@ -2907,6 +2994,8 @@ export default {
|
||||
this.view.yaxis[this.quotaItemCompare.index].compareCalc = this.quotaItemCompare.compareCalc
|
||||
} else if (this.quotaItemCompare.calcType === 'quotaExt') {
|
||||
this.view.yaxisExt[this.quotaItemCompare.index].compareCalc = this.quotaItemCompare.compareCalc
|
||||
} else if (this.quotaItemCompare.calcType === 'dimension') {
|
||||
this.view.xaxis[this.quotaItemCompare.index].compareCalc = this.quotaItemCompare.compareCalc
|
||||
}
|
||||
this.calcData(true)
|
||||
this.closeQuotaEditCompare()
|
||||
@ -3042,10 +3131,17 @@ export default {
|
||||
}
|
||||
},
|
||||
addXaxis(e) {
|
||||
if (this.view.type !== 'table-info') {
|
||||
if (this.view.type !== 'table-info' && (this.view.type !== 'scatter' && this.view.render !== 'antv')) {
|
||||
this.dragCheckType(this.view.xaxis, 'd')
|
||||
}
|
||||
this.dragMoveDuplicate(this.view.xaxis, e)
|
||||
if (this.view.type === 'scatter' && this.view.render === 'antv') {
|
||||
if (this.view.xaxis[0] && this.view.xaxis[0].groupType === 'q') {
|
||||
this.view.xaxis = [this.view.xaxis[0]]
|
||||
} else {
|
||||
this.dragCheckType(this.view.xaxis, 'd')
|
||||
}
|
||||
}
|
||||
if ((this.view.type === 'map' || this.view.type === 'word-cloud' || this.view.type === 'label') && this.view.xaxis.length > 1) {
|
||||
this.view.xaxis = [this.view.xaxis[0]]
|
||||
}
|
||||
@ -3307,12 +3403,14 @@ export default {
|
||||
this.$store.commit('recordViewEdit', { viewId: this.param.id, hasEdit: status })
|
||||
},
|
||||
changeChartRender() {
|
||||
this.setChartDefaultOptions()
|
||||
this.calcData(true, 'chart', true, false, true)
|
||||
// 调整为监听 watchChartTypeChangeObj
|
||||
// this.setChartDefaultOptions()
|
||||
// this.calcData(true, 'chart', true, false, true)
|
||||
},
|
||||
changeChartType() {
|
||||
this.setChartDefaultOptions()
|
||||
this.calcData(true, 'chart', true, true)
|
||||
// 调整为监听 watchChartTypeChangeObj
|
||||
// this.setChartDefaultOptions()
|
||||
// this.calcData(true, 'chart', true, true)
|
||||
},
|
||||
|
||||
setChartDefaultOptions() {
|
||||
|
||||
108
core/frontend/src/views/system/sysParam/MapSetting/Geometry.vue
Normal file
108
core/frontend/src/views/system/sysParam/MapSetting/Geometry.vue
Normal file
@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<de-container
|
||||
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
|
||||
class="de-earth"
|
||||
>
|
||||
<div class="de-map-tips">
|
||||
<el-alert
|
||||
:title="$t('map_setting.prohibit_prompts')"
|
||||
type="warning"
|
||||
description=""
|
||||
:closable="false"
|
||||
show-icon
|
||||
/>
|
||||
</div>
|
||||
<de-aside-container
|
||||
type="mapset"
|
||||
class="map-setting-aside"
|
||||
>
|
||||
<map-setting-left
|
||||
ref="map_setting_tree"
|
||||
:tree-data="treeData"
|
||||
@emit-add="emitAdd"
|
||||
@refresh-tree="refreshTree"
|
||||
@show-node-info="loadForm"
|
||||
/>
|
||||
</de-aside-container>
|
||||
|
||||
<de-main-container
|
||||
class="map-setting-main"
|
||||
>
|
||||
<map-setting-right
|
||||
ref="map_setting_form"
|
||||
:tree-data="treeData"
|
||||
:status="formStatus"
|
||||
@refresh-tree="refreshTree"
|
||||
/>
|
||||
</de-main-container>
|
||||
</de-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DeMainContainer from '@/components/dataease/DeMainContainer'
|
||||
import DeContainer from '@/components/dataease/DeContainer'
|
||||
import DeAsideContainer from '@/components/dataease/DeAsideContainer'
|
||||
import { areaMapping } from '@/api/map/map'
|
||||
import MapSettingLeft from './MapSettingLeft'
|
||||
import MapSettingRight from './MapSettingRight'
|
||||
export default {
|
||||
name: 'MapSetting',
|
||||
components: { DeMainContainer, DeContainer, DeAsideContainer, MapSettingLeft, MapSettingRight },
|
||||
data() {
|
||||
return {
|
||||
formStatus: 'empty',
|
||||
treeData: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadTreeData()
|
||||
},
|
||||
methods: {
|
||||
emitAdd(form) {
|
||||
this.setStatus(form.status)
|
||||
this.$refs['map_setting_form']?.emitAdd(form)
|
||||
},
|
||||
|
||||
loadForm(nodeInfo) {
|
||||
this.setStatus(nodeInfo.status)
|
||||
this.$refs['map_setting_form']?.loadForm(nodeInfo)
|
||||
},
|
||||
|
||||
setStatus(status) {
|
||||
this.formStatus = status
|
||||
},
|
||||
loadTreeData() {
|
||||
!Object.keys(this.treeData).length && areaMapping().then(res => {
|
||||
this.treeData = res.data
|
||||
})
|
||||
},
|
||||
refreshTree(node) {
|
||||
areaMapping().then(res => {
|
||||
this.treeData = res.data
|
||||
if (!node?.code) return
|
||||
this.$refs['map_setting_tree']?.showNewNode(node.code)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.de-earth {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
.de-map-tips {
|
||||
position: absolute;
|
||||
width: calc(100% - 310px);
|
||||
}
|
||||
.map-setting-aside {
|
||||
top: 50px;
|
||||
height: calc(100% - 50px) !important;
|
||||
}
|
||||
.map-setting-main {
|
||||
margin-top: 50px;
|
||||
height: calc(100% - 50px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
198
core/frontend/src/views/system/sysParam/MapSetting/OnlineMap.vue
Normal file
198
core/frontend/src/views/system/sysParam/MapSetting/OnlineMap.vue
Normal file
@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<el-container
|
||||
v-loading="loading"
|
||||
class="online-map-container"
|
||||
>
|
||||
<el-aside class="aside-form">
|
||||
<div class="form-title">
|
||||
<span>{{ $t('online_map.onlinemap') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="online-form-item">
|
||||
<span class="form-label">Key</span>
|
||||
<el-input
|
||||
v-model="key"
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="!key"
|
||||
@click="saveHandler"
|
||||
>{{ $t('commons.save') }}</el-button>
|
||||
</el-aside>
|
||||
<el-divider
|
||||
direction="vertical"
|
||||
class="online-divider"
|
||||
/>
|
||||
<el-main class="main-content">
|
||||
<div
|
||||
v-show="mapLoaded"
|
||||
v-if="!mapReloading"
|
||||
:id="domId"
|
||||
class="map-gaode-demo"
|
||||
/>
|
||||
<el-empty
|
||||
v-if="!mapLoaded"
|
||||
:description="$t('online_map.empty_desc')"
|
||||
/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
import { saveMapKey, queryMapKey } from '@/api/map/map'
|
||||
export default {
|
||||
name: 'OnlineMap',
|
||||
data() {
|
||||
return {
|
||||
key: '',
|
||||
secret: '',
|
||||
mapLoaded: false,
|
||||
mapInstance: null,
|
||||
domId: 'qwertyuiop',
|
||||
mapReloading: false,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLoad()
|
||||
},
|
||||
|
||||
methods: {
|
||||
loadMap() {
|
||||
if (!this.key) {
|
||||
return
|
||||
}
|
||||
const mykey = this.key
|
||||
const url = `https://webapi.amap.com/maps?v=2.0&key=${mykey}`
|
||||
|
||||
this.loadScript(url).then(res => {
|
||||
if (this.mapInstance) {
|
||||
this.mapInstance.destroy()
|
||||
this.mapInstance = null
|
||||
this.mapReloading = true
|
||||
setTimeout(() => {
|
||||
this.domId = this.domId + '-de-'
|
||||
this.mapReloading = false
|
||||
this.$nextTick(() => {
|
||||
this.createMapInstance()
|
||||
})
|
||||
}, 1500)
|
||||
|
||||
return
|
||||
}
|
||||
this.createMapInstance()
|
||||
}).catch(e => {
|
||||
if (this.mapInstance) {
|
||||
this.mapInstance.destroy()
|
||||
this.mapInstance = null
|
||||
}
|
||||
console.error(e)
|
||||
})
|
||||
},
|
||||
createMapInstance() {
|
||||
this.mapInstance = new window.AMap.Map(this.domId, {
|
||||
viewMode: '2D',
|
||||
zoom: 11,
|
||||
center: [116.397428, 39.90923]
|
||||
})
|
||||
this.mapLoaded = true
|
||||
},
|
||||
saveHandler() {
|
||||
this.loading = true
|
||||
saveMapKey({ key: this.key }).then(() => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.initLoad()
|
||||
}).catch(e => {
|
||||
console.error(e)
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
initLoad() {
|
||||
console.log('map load ...')
|
||||
queryMapKey().then(res => {
|
||||
this.key = res.data
|
||||
this.loadMap()
|
||||
}).catch(e => {
|
||||
console.error(e)
|
||||
})
|
||||
},
|
||||
loadScript(url) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
const scriptId = 'de-gaode-script-id'
|
||||
let dom = document.getElementById(scriptId)
|
||||
if (dom) {
|
||||
dom.parentElement.removeChild(dom)
|
||||
dom = null
|
||||
window.AMap = null
|
||||
// return resolve()
|
||||
}
|
||||
var script = document.createElement('script')
|
||||
|
||||
script.id = scriptId
|
||||
script.onload = function() {
|
||||
return resolve()
|
||||
}
|
||||
script.onerror = function() {
|
||||
return reject(new Error('Load script from '.concat(url, ' failed')))
|
||||
}
|
||||
script.src = url
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
(document.body || head).appendChild(script)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.online-map-container {
|
||||
height: 100%;
|
||||
.online-divider {
|
||||
height: calc(100% - 139px);
|
||||
position: absolute;
|
||||
top: 112px;
|
||||
margin: 0 0 0 330px;
|
||||
}
|
||||
.aside-form {
|
||||
width: 320px !important;
|
||||
padding: 0 10px;
|
||||
height: 100%;
|
||||
.form-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
color: #1F2329;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.online-form-item {
|
||||
font-size: 14px;
|
||||
.form-title {
|
||||
font-weight: 400;
|
||||
color: 1F2329;
|
||||
line-height: 22px;
|
||||
}
|
||||
height: 62px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.main-content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-left: 13px;
|
||||
.map-gaode-demo {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.de-map-iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,109 +1,88 @@
|
||||
<template>
|
||||
<de-container
|
||||
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
|
||||
class="de-earth"
|
||||
style="height: calc(100vh - 200px);"
|
||||
>
|
||||
<div class="de-map-tips">
|
||||
<el-alert
|
||||
:title="$t('map_setting.prohibit_prompts')"
|
||||
type="warning"
|
||||
description=""
|
||||
:closable="false"
|
||||
show-icon
|
||||
/>
|
||||
</div>
|
||||
<de-aside-container
|
||||
type="mapset"
|
||||
class="map-setting-aside"
|
||||
>
|
||||
<map-setting-left
|
||||
ref="map_setting_tree"
|
||||
:tree-data="treeData"
|
||||
@emit-add="emitAdd"
|
||||
@refresh-tree="refreshTree"
|
||||
@show-node-info="loadForm"
|
||||
/>
|
||||
</de-aside-container>
|
||||
<el-container class="map-setting-container">
|
||||
<el-aside class="map-setting-left">
|
||||
<div class="left-container">
|
||||
|
||||
<de-main-container
|
||||
class="map-setting-main"
|
||||
>
|
||||
<map-setting-right
|
||||
ref="map_setting_form"
|
||||
:tree-data="treeData"
|
||||
:status="formStatus"
|
||||
@refresh-tree="refreshTree"
|
||||
/>
|
||||
</de-main-container>
|
||||
</de-container>
|
||||
<div
|
||||
v-for="(item, index) in leftOptions"
|
||||
:key="item.id"
|
||||
class="left-menu-item"
|
||||
:class="{'active': activeIndex === item.id}"
|
||||
@click="selectHandler(index)"
|
||||
>
|
||||
<span>{{ $t(item.name) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-aside>
|
||||
<el-main class="map-setting-right">
|
||||
<div class="right-container">
|
||||
<OnlineMap v-if="activeIndex" />
|
||||
<geometry v-else />
|
||||
</div>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DeMainContainer from '@/components/dataease/DeMainContainer'
|
||||
import DeContainer from '@/components/dataease/DeContainer'
|
||||
import DeAsideContainer from '@/components/dataease/DeAsideContainer'
|
||||
import { areaMapping } from '@/api/map/map'
|
||||
import MapSettingLeft from './MapSettingLeft'
|
||||
import MapSettingRight from './MapSettingRight'
|
||||
import Geometry from './Geometry'
|
||||
import OnlineMap from './OnlineMap'
|
||||
export default {
|
||||
name: 'MapSetting',
|
||||
components: { DeMainContainer, DeContainer, DeAsideContainer, MapSettingLeft, MapSettingRight },
|
||||
components: { Geometry, OnlineMap },
|
||||
data() {
|
||||
return {
|
||||
formStatus: 'empty',
|
||||
treeData: []
|
||||
leftOptions: [
|
||||
{ id: 0, name: 'online_map.geometry' },
|
||||
{ id: 1, name: 'online_map.onlinemap' }
|
||||
],
|
||||
activeIndex: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadTreeData()
|
||||
},
|
||||
methods: {
|
||||
emitAdd(form) {
|
||||
this.setStatus(form.status)
|
||||
this.$refs['map_setting_form']?.emitAdd(form)
|
||||
},
|
||||
|
||||
loadForm(nodeInfo) {
|
||||
this.setStatus(nodeInfo.status)
|
||||
this.$refs['map_setting_form']?.loadForm(nodeInfo)
|
||||
},
|
||||
|
||||
setStatus(status) {
|
||||
this.formStatus = status
|
||||
},
|
||||
loadTreeData() {
|
||||
!Object.keys(this.treeData).length && areaMapping().then(res => {
|
||||
this.treeData = res.data
|
||||
})
|
||||
},
|
||||
refreshTree(node) {
|
||||
areaMapping().then(res => {
|
||||
this.treeData = res.data
|
||||
if (!node?.code) return
|
||||
this.$refs['map_setting_tree']?.showNewNode(node.code)
|
||||
})
|
||||
selectHandler(index) {
|
||||
this.activeIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.de-earth {
|
||||
padding: 24px;
|
||||
.map-setting-container {
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
.de-map-tips {
|
||||
position: absolute;
|
||||
width: calc(100% - 135px);
|
||||
height: 100%;
|
||||
padding-bottom: 0px !important;
|
||||
.map-setting-left {
|
||||
width: 200px !important;
|
||||
height: calc(100% + 20px);
|
||||
border-right: 1px solid #1f232926;
|
||||
.left-container {
|
||||
padding: 16px 16px 16px 16px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.left-menu-item {
|
||||
width: 168px;
|
||||
height: 40px;
|
||||
padding: 9px 8px;
|
||||
line-height: 22px;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background: #1f232926;
|
||||
}
|
||||
}
|
||||
.active {
|
||||
background: #3370FF1A;
|
||||
color: #3370FF;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
.map-setting-aside {
|
||||
top: 50px;
|
||||
height: calc(100% - 40px) !important;
|
||||
}
|
||||
.map-setting-main {
|
||||
margin-top: 50px;
|
||||
height: calc(100% - 50px);
|
||||
.map-setting-right {
|
||||
padding-bottom: 0 !important;
|
||||
.right-container {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -18,6 +18,7 @@ const port = process.env.port || process.env.npm_config_port || 9528 // dev port
|
||||
const parallel = process.env.NODE_ENV === 'development'
|
||||
module.exports = {
|
||||
productionSourceMap: false,
|
||||
publicPath: process.env.VUE_CONTEXT_PATH,
|
||||
parallel,
|
||||
// 使用mock-server
|
||||
devServer: {
|
||||
@ -52,7 +53,6 @@ module.exports = {
|
||||
},
|
||||
output: process.env.NODE_ENV === 'development' ? {} : {
|
||||
filename: `js/[name].[contenthash:8].${pkg.version}.js`,
|
||||
publicPath: '/',
|
||||
chunkFilename: `js/[name].[contenthash:8].${pkg.version}.js`
|
||||
},
|
||||
plugins: [
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dataease-mobile",
|
||||
"version": "1.18.11",
|
||||
"version": "1.18.12",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "npm run dev:h5",
|
||||
|
||||
@ -701,7 +701,7 @@ public class DmQueryProvider extends QueryProvider {
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis,
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList,
|
||||
List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
List<ChartViewFieldDTO> extBubble,List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table
|
||||
: String.format(OracleConstants.KEYWORD_TABLE, table))
|
||||
@ -710,9 +710,27 @@ public class DmQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -742,6 +760,9 @@ public class DmQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -829,9 +850,9 @@ public class DmQueryProvider extends QueryProvider {
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis,
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList,
|
||||
List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup,ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList,
|
||||
extBubble, null, view);
|
||||
extBubble, extGroup,null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -721,7 +721,7 @@ public class KingbaseQueryProvider extends QueryProvider {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis,
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter,
|
||||
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree,
|
||||
List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble,
|
||||
List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup,
|
||||
Datasource ds,
|
||||
ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
@ -732,9 +732,27 @@ public class KingbaseQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -763,6 +781,9 @@ public class KingbaseQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -851,10 +872,10 @@ public class KingbaseQueryProvider extends QueryProvider {
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter,
|
||||
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree,
|
||||
List<ChartExtFilterRequest> extFilterRequestList,
|
||||
List<ChartViewFieldDTO> extBubble,
|
||||
List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup,
|
||||
ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree,
|
||||
extFilterRequestList, extBubble, null, view);
|
||||
extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -554,7 +554,7 @@ public class KylinQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(KylinConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -562,9 +562,27 @@ public class KylinQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -591,6 +609,9 @@ public class KylinQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -663,8 +684,8 @@ public class KylinQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -569,7 +569,7 @@ public class MaxcomputeQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MaxConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -577,9 +577,27 @@ public class MaxcomputeQueryProvider extends QueryProvider {
|
||||
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -606,6 +624,9 @@ public class MaxcomputeQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -678,8 +699,8 @@ public class MaxcomputeQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1270,7 +1291,7 @@ public class MaxcomputeQueryProvider extends QueryProvider {
|
||||
public List<Dateformat> dateformat() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Dateformat> dateformats = new ArrayList<>();
|
||||
try{
|
||||
try {
|
||||
dateformats = objectMapper.readValue("[\n" +
|
||||
"{\"dateformat\": \"yyyymmdd\"},\n" +
|
||||
"{\"dateformat\": \"yyyy/mm/dd\"},\n" +
|
||||
@ -1278,8 +1299,10 @@ public class MaxcomputeQueryProvider extends QueryProvider {
|
||||
"{\"dateformat\": \"yyyymmdd hh:mi:s\"},\n" +
|
||||
"{\"dateformat\": \"yyyy/mm/dd hh:mi:s\"},\n" +
|
||||
"{\"dateformat\": \"yyyy-mm-dd hh:mi:s\"}\n" +
|
||||
"]", new TypeReference<List<Dateformat>>() {} );
|
||||
}catch (Exception e){}
|
||||
"]", new TypeReference<List<Dateformat>>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return dateformats;
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,7 +439,8 @@ public class MongobiQueryProvider extends QueryProvider {
|
||||
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
|
||||
return st.render();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
}
|
||||
@ -569,16 +570,34 @@ public class MongobiQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MongoConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -605,6 +624,9 @@ public class MongobiQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -677,8 +699,8 @@ public class MongobiQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1316,7 +1338,7 @@ public class MongobiQueryProvider extends QueryProvider {
|
||||
public List<Dateformat> dateformat() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Dateformat> dateformats = new ArrayList<>();
|
||||
try{
|
||||
try {
|
||||
dateformats = objectMapper.readValue("[\n" +
|
||||
"{\"dateformat\": \"%Y%m%d\"},\n" +
|
||||
"{\"dateformat\": \"%Y-%m-%d\"},\n" +
|
||||
@ -1324,8 +1346,10 @@ public class MongobiQueryProvider extends QueryProvider {
|
||||
"{\"dateformat\": \"%Y%m%d %H:%i:%S\"},\n" +
|
||||
"{\"dateformat\": \"%Y/%m/%d %H:%i:%S\"},\n" +
|
||||
"{\"dateformat\": \"%Y-%m-%d %H:%i:%S\"}\n" +
|
||||
"]", new TypeReference<List<Dateformat>>() {} );
|
||||
}catch (Exception e){}
|
||||
"]", new TypeReference<List<Dateformat>>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return dateformats;
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ public class PrestoQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PrestoConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -567,9 +567,27 @@ public class PrestoQueryProvider extends QueryProvider {
|
||||
setSchema(tableObj, ds);
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
|
||||
boolean xIsNumber = false;
|
||||
List<ChartViewFieldDTO> xAxisList = new ArrayList<>();
|
||||
|
||||
//先判断x轴内是不是数值格式的
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
if (StringUtils.equals(xAxis.get(0).getGroupType(), "q") && StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
xIsNumber = true;
|
||||
} else {
|
||||
xAxisList.addAll(xAxis);
|
||||
}
|
||||
}
|
||||
|
||||
//然后是数值格式的情况还需要传extGroup
|
||||
if (xIsNumber && CollectionUtils.isNotEmpty(extGroup)) {
|
||||
xAxisList.add(extGroup.get(0));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(xAxisList)) {
|
||||
for (int i = 0; i < xAxisList.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxisList.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -596,6 +614,9 @@ public class PrestoQueryProvider extends QueryProvider {
|
||||
List<String> yWheres = new ArrayList<>();
|
||||
List<SQLObj> yOrders = new ArrayList<>();
|
||||
List<ChartViewFieldDTO> yList = new ArrayList<>();
|
||||
if (xIsNumber) {
|
||||
yList.add(xAxis.get(0));
|
||||
}
|
||||
yList.addAll(yAxis);
|
||||
yList.addAll(extBubble);
|
||||
if (CollectionUtils.isNotEmpty(yList)) {
|
||||
@ -668,8 +689,8 @@ public class PrestoQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, null, view);
|
||||
public String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view) {
|
||||
return getSQLScatter("(" + sqlFix(table) + ")", xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, extBubble, extGroup, null, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1268,7 +1289,7 @@ public class PrestoQueryProvider extends QueryProvider {
|
||||
public List<Dateformat> dateformat() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Dateformat> dateformats = new ArrayList<>();
|
||||
try{
|
||||
try {
|
||||
dateformats = objectMapper.readValue("[\n" +
|
||||
"{\"dateformat\": \"yyyy-MM-dd\"},\n" +
|
||||
"{\"dateformat\": \"yyyy/MM/dd\"},\n" +
|
||||
@ -1276,8 +1297,10 @@ public class PrestoQueryProvider extends QueryProvider {
|
||||
"{\"dateformat\": \"yyyy-MM-dd HH:mm:s\"},\n" +
|
||||
"{\"dateformat\": \"yyyy-MM-dd HH:mm:s\"},\n" +
|
||||
"{\"dateformat\": \"yyyy-MM-dd HH:mm:s\"}\n" +
|
||||
"]", new TypeReference<List<Dateformat>>() {} );
|
||||
}catch (Exception e){}
|
||||
"]", new TypeReference<List<Dateformat>>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return dateformats;
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ module.exports = {
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
||||
include: [resolve('src'), resolve('test')]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
|
||||
@ -13,6 +13,7 @@ const portfinder = require('portfinder')
|
||||
const HOST = process.env.HOST
|
||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||
|
||||
const VueLoaderPlugin = require("vue-loader/lib/plugin");
|
||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
||||
@ -45,6 +46,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': require('../config/dev.env')
|
||||
}),
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
"vue-style-loader": "^4.1.2",
|
||||
"vue-template-compiler": "^2.5.2",
|
||||
"webpack": "^4.8.1",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-bundle-analyzer": "^3.3.2",
|
||||
"webpack-dev-server": "^3.1.11",
|
||||
"webpack-merge": "^4.1.0"
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
mvn clean package
|
||||
|
||||
cp view-chartmix-backend/target/view-chartmix-backend-1.18.11.jar .
|
||||
cp view-chartmix-backend/target/view-chartmix-backend-1.18.12.jar .
|
||||
|
||||
zip -r chartmix.zip ./view-chartmix-backend-1.18.11.jar ./plugin.json
|
||||
zip -r chartmix.zip ./view-chartmix-backend-1.18.12.jar ./plugin.json
|
||||
|
||||
rm -f ./view-chartmix-backend-1.18.11.jar
|
||||
rm -f ./view-chartmix-backend-1.18.12.jar
|
||||
|
||||
@ -89,10 +89,10 @@
|
||||
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeSort('asc')">{{ $t('chart.asc') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
<!-- <el-dropdown-item
|
||||
v-show="!item.chartId && (item.deType === 0 || item.deType === 5)"
|
||||
:command="beforeSort('custom_sort')"
|
||||
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>
|
||||
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>-->
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
|
||||
@ -29,13 +29,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Scene, PointLayer, Popup } from '@antv/l7'
|
||||
import { uuid, hexColorToRGBA} from '@/utils/symbolmap'
|
||||
import ViewTrackBar from '@/components/views/ViewTrackBar'
|
||||
import { getDefaultTemplate, reverseColor } from '@/utils/map'
|
||||
import {getRemark} from "../../../components/views/utils";
|
||||
import {PointLayer, Popup, Scene} from '@antv/l7'
|
||||
import {hexColorToRGBA, uuid} from '@/utils/symbolmap'
|
||||
import ViewTrackBar from '@/components/views/ViewTrackBar'
|
||||
import {getDefaultTemplate} from '@/utils/map'
|
||||
import {getRemark} from "../../../components/views/utils";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: 'ChartComponentG2',
|
||||
components: { ViewTrackBar },
|
||||
props: {
|
||||
@ -239,19 +239,59 @@
|
||||
window.addEventListener('resize', this.calcHeightDelay)
|
||||
|
||||
},
|
||||
initMap() {
|
||||
executeAxios(url, type, data, callBack) {
|
||||
const param = {
|
||||
url: url,
|
||||
type: type,
|
||||
data: data,
|
||||
callBack: callBack
|
||||
}
|
||||
this.$emit('execute-axios', param)
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
execute(param).then(res => {
|
||||
if (param.callBack) {
|
||||
param.callBack(res)
|
||||
}
|
||||
}).catch(e => {
|
||||
if (param.error) {
|
||||
param.error(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
getMapKey() {
|
||||
const key = 'online-map-key'
|
||||
return new Promise((resolve, reject) => {
|
||||
if (localStorage.getItem(key)) {
|
||||
resolve(localStorage.getItem(key))
|
||||
} else {
|
||||
const url = "/system/onlineMapKey"
|
||||
this.executeAxios(url, 'get', {}, res => {
|
||||
const val = res.data
|
||||
localStorage.setItem(key, val)
|
||||
resolve(val)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
async initMap() {
|
||||
if (!this.myChart) {
|
||||
let theme = this.getMapTheme(this.chart)
|
||||
const lang = this.$i18n.locale.includes('zh') ? 'zh' : 'en'
|
||||
const mapConfig = {
|
||||
lang: lang,
|
||||
pitch: 0,
|
||||
style: theme,
|
||||
center: [121.434765, 31.256735],
|
||||
zoom: 6
|
||||
}
|
||||
const key = await this.getMapKey()
|
||||
if (key) {
|
||||
mapConfig.token = key
|
||||
}
|
||||
this.myChart = new Scene({
|
||||
id: this.chartId,
|
||||
map: new this.$gaodeMap({
|
||||
lang: lang,
|
||||
pitch: 0,
|
||||
style: theme,
|
||||
center: [ 121.434765, 31.256735 ],
|
||||
zoom: 6
|
||||
}),
|
||||
map: new this.$gaodeMap(mapConfig),
|
||||
logoVisible: false
|
||||
})
|
||||
const chart = JSON.parse(JSON.stringify(this.chart))
|
||||
@ -260,7 +300,7 @@
|
||||
this.antVRenderStatus = true
|
||||
if (!chart.data || !chart.data.data) {
|
||||
chart.data = {
|
||||
data: []
|
||||
data: []
|
||||
}
|
||||
}
|
||||
this.myChart.on('loaded', () => {
|
||||
@ -268,7 +308,7 @@
|
||||
|
||||
this.drawView()
|
||||
this.myChart.on('click', ev => {
|
||||
this.$emit('trigger-edit-click', ev.originEvent)
|
||||
this.$emit('trigger-edit-click', ev.originEvent)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
@ -312,24 +352,23 @@
|
||||
const defaultTemplate = "经度:${longitude},纬度:${latitude}"
|
||||
const templateWithField = getDefaultTemplate(chart, 'labelAxis', false, false)
|
||||
const labelTemplate = customAttr.label.labelTemplate || templateWithField || defaultTemplate
|
||||
const data = originData.filter(item => item.longitude && item.latitude)
|
||||
data.forEach(item => {
|
||||
const properties = item.properties || {}
|
||||
properties.longitude = item.longitude
|
||||
properties.latitude = item.latitude
|
||||
|
||||
originData.forEach(item => {
|
||||
const properties = item.properties || {}
|
||||
properties.longitude = item.longitude
|
||||
properties.latitude = item.latitude
|
||||
try {
|
||||
item.labelResult = this.fillStrTemplate(labelTemplate, properties)
|
||||
}catch (error) {
|
||||
|
||||
|
||||
try {
|
||||
item.labelResult = this.fillStrTemplate(labelTemplate, properties)
|
||||
}catch (error) {
|
||||
|
||||
}
|
||||
item.labelResult = item.labelResult || this.fillStrTemplate(defaultTemplate, properties)
|
||||
item.labelResult = item.labelResult.replaceAll('\n', ' ')
|
||||
}
|
||||
item.labelResult = item.labelResult || this.fillStrTemplate(defaultTemplate, properties)
|
||||
item.labelResult = item.labelResult.replaceAll('\n', ' ')
|
||||
})
|
||||
|
||||
this.textLayer = new PointLayer({})
|
||||
.source(originData,
|
||||
.source(data,
|
||||
{
|
||||
parser: {
|
||||
type: 'json',
|
||||
@ -359,7 +398,6 @@
|
||||
},
|
||||
|
||||
setLayerAttr (chart) {
|
||||
|
||||
let defaultSymbol = 'marker'
|
||||
let customAttr = {}
|
||||
let layerStyle = {}
|
||||
@ -377,7 +415,8 @@
|
||||
}
|
||||
|
||||
this.myChart.removeAllLayer().then(() => {
|
||||
const data = chart.data && chart.data.data || []
|
||||
let data = chart.data && chart.data.data || []
|
||||
data = data.filter(item => item.longitude && item.latitude)
|
||||
this.pointLayer = new PointLayer({autoFit: true})
|
||||
this.pointLayer.source(data, {
|
||||
parser: {
|
||||
|
||||
@ -2,7 +2,7 @@ version: '2.1'
|
||||
services:
|
||||
|
||||
mysql:
|
||||
image: registry.cn-qingdao.aliyuncs.com/dataease/mysql:5.7.43
|
||||
image: registry.cn-qingdao.aliyuncs.com/dataease/mysql:8.1.0
|
||||
container_name: mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-u${DE_MYSQL_USER}", "-p${DE_MYSQL_PASSWORD}"]
|
||||
|
||||
@ -30,7 +30,7 @@ DE_MYSQL_USER=root
|
||||
## 数据库密码
|
||||
DE_MYSQL_PASSWORD=Password123@mysql
|
||||
## 数据库参数
|
||||
DE_MYSQL_PARAMS="autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false"
|
||||
DE_MYSQL_PARAMS="autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true"
|
||||
|
||||
# Apache Doris 配置
|
||||
## 是否使用外部 Apache Doris
|
||||
|
||||
@ -123,12 +123,22 @@ keep_doris="false"
|
||||
if [[ -f ${DE_RUN_BASE}/docker-compose-doris.yml ]]; then
|
||||
current_doris_version=$(grep '^ image:' ${DE_RUN_BASE}/docker-compose-doris.yml | head -1 | cut -d ':' -f3)
|
||||
if [[ ! $current_doris_version =~ "v1.2.4" ]]; then
|
||||
echo "不升级doris,备份 docker-compose-doris.yml 文件"
|
||||
echo "不升级doris,备份 docker-compose-doris.yml 文件" | tee -a ${CURRENT_DIR}/install.log
|
||||
keep_doris="true"
|
||||
\cp ${DE_RUN_BASE}/docker-compose-doris.yml ${DE_RUN_BASE}/docker-compose-doris.yml.bak
|
||||
fi
|
||||
fi
|
||||
|
||||
keep_mysql="false"
|
||||
if [[ -f ${DE_RUN_BASE}/docker-compose-mysql.yml ]]; then
|
||||
current_mysql_version=$(grep '^ image:' ${DE_RUN_BASE}/docker-compose-mysql.yml | head -1 | cut -d ':' -f3)
|
||||
if [[ ! $current_mysql_version =~ "8." ]]; then
|
||||
echo "不升级MySQL,备份 docker-compose-mysql.yml 文件" | tee -a ${CURRENT_DIR}/install.log
|
||||
keep_mysql="true"
|
||||
\cp ${DE_RUN_BASE}/docker-compose-mysql.yml ${DE_RUN_BASE}/docker-compose-mysql.yml.bak
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p ${DE_RUN_BASE}
|
||||
|
||||
|
||||
@ -156,6 +166,10 @@ if [ ${keep_doris} = "true" ]; then
|
||||
\mv ${DE_RUN_BASE}/docker-compose-doris.yml.bak ${DE_RUN_BASE}/docker-compose-doris.yml
|
||||
fi
|
||||
|
||||
if [ ${keep_mysql} = "true" ]; then
|
||||
\mv ${DE_RUN_BASE}/docker-compose-mysql.yml.bak ${DE_RUN_BASE}/docker-compose-mysql.yml
|
||||
fi
|
||||
|
||||
DE_MYSQL_HOST_ORIGIN=$DE_MYSQL_HOST
|
||||
DE_MYSQL_PORT_ORIGIN=$DE_MYSQL_PORT
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -9,7 +9,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<dataease.version>1.18.11</dataease.version>
|
||||
<dataease.version>1.18.12</dataease.version>
|
||||
</properties>
|
||||
|
||||
<name>dataease</name>
|
||||
|
||||
@ -22,6 +22,8 @@ public class ChartViewFieldBaseDTO implements Serializable {
|
||||
|
||||
private String type;
|
||||
|
||||
private String groupType;
|
||||
|
||||
private Boolean checked;
|
||||
|
||||
private Integer columnIndex;
|
||||
|
||||
@ -61,17 +61,17 @@ public abstract class QueryProvider {
|
||||
public abstract String getSQLAsTmpTableInfo(String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view);
|
||||
|
||||
public String getSQLWithPage(boolean isTable, String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
|
||||
if(isTable){
|
||||
if (isTable) {
|
||||
return getSQLTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view);
|
||||
}else {
|
||||
} else {
|
||||
return getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view);
|
||||
}
|
||||
}
|
||||
|
||||
public String getResultCount(boolean isTable, String sql, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
if(isTable){
|
||||
if (isTable) {
|
||||
return "SELECT COUNT(*) from (" + getSQLTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + ") COUNT_TEMP";
|
||||
}else {
|
||||
} else {
|
||||
return "SELECT COUNT(*) from (" + getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + ") COUNT_TEMP";
|
||||
}
|
||||
}
|
||||
@ -80,9 +80,9 @@ public abstract class QueryProvider {
|
||||
|
||||
public abstract String getSQLAsTmpStack(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extStack, ChartViewWithBLOBs view);
|
||||
|
||||
public abstract String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, Datasource ds, ChartViewWithBLOBs view);
|
||||
public abstract String getSQLScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, Datasource ds, ChartViewWithBLOBs view);
|
||||
|
||||
public abstract String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, ChartViewWithBLOBs view);
|
||||
public abstract String getSQLAsTmpScatter(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, List<ChartViewFieldDTO> extBubble, List<ChartViewFieldDTO> extGroup, ChartViewWithBLOBs view);
|
||||
|
||||
public abstract String searchTable(String table);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user