forked from github/dataease
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
81ac688970
@ -0,0 +1,18 @@
|
||||
package io.dataease.dto.chart;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class FilterParamTO {
|
||||
|
||||
private Map<String, Object> component;
|
||||
|
||||
private List<String> value;
|
||||
|
||||
private String operator;
|
||||
|
||||
private Boolean isTree = false;
|
||||
}
|
@ -1074,7 +1074,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(DorisConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1130,7 +1130,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(CKConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1124,7 +1124,7 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(Db2Constants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1119,7 +1119,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(EsSqlLConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1055,7 +1055,7 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(HiveConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1060,7 +1060,7 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(ImpalaConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -969,7 +969,7 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(MongoConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1060,7 +1060,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(MySQLConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1123,7 +1123,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
String st = String.format(OracleConstants.TO_DATE, "'" + startTime + "'", OracleConstants.DEFAULT_DATE_FORMAT);
|
||||
|
@ -1086,7 +1086,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(PgConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1013,7 +1013,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(PgConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -1118,7 +1118,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
|
@ -0,0 +1,187 @@
|
||||
package io.dataease.service.chart;
|
||||
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.dto.chart.FilterParamTO;
|
||||
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class FilterBuildTemplate {
|
||||
|
||||
protected abstract FilterParamTO buildParam(Map<String, Object> component);
|
||||
|
||||
public Map<String, List<ChartExtFilterRequest>> buildFilters(List<Map<String, Object>> components) {
|
||||
Map<String, Object> searchButton = components.stream().filter(item -> {
|
||||
if (ObjectUtils.isEmpty(item.get("type"))) return false;
|
||||
if (ObjectUtils.isEmpty(item.get("serviceName"))) return false;
|
||||
return StringUtils.equals("custom-button", item.get("type").toString()) && StringUtils.equals("buttonSureWidget", item.get("serviceName").toString());
|
||||
}).findFirst().orElseGet(null);
|
||||
|
||||
List<Map<String, Object>> filters = componentsFilter(components, "custom", null, null);
|
||||
|
||||
if(ObjectUtils.isNotEmpty(searchButton)) {
|
||||
Map<String, Object> options = (Map<String, Object>) searchButton.get("options");
|
||||
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
|
||||
Boolean customRange = (Boolean)attrs.get("customRange");
|
||||
Boolean autoTrigger = (Boolean) attrs.get("autoTrigger");
|
||||
List<String> filterIds = (List<String>) attrs.get("filterIds");
|
||||
if (!autoTrigger) { // 不是自动触发 // 需要过滤掉按钮关联的条件组件
|
||||
if (customRange) { // 自定义控制范围 //过滤掉被按钮关联的
|
||||
filters = filters.stream().filter(filter -> !filterIds.contains(filter.get("id"))).collect(Collectors.toList());
|
||||
} else { // 按钮控制所有 // 过滤掉所有条件
|
||||
filters = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, List<ChartExtFilterRequest>> emptyResult = buildEmpty(components);
|
||||
|
||||
emptyResult = fillFilters(emptyResult, filters);
|
||||
|
||||
return emptyResult;
|
||||
}
|
||||
|
||||
private Map<String, List<ChartExtFilterRequest>> fillFilters(Map<String, List<ChartExtFilterRequest>> emptyResult, List<Map<String, Object>> filters) {
|
||||
filters.forEach(element -> {
|
||||
FilterParamTO filterParamTO = buildParam(element);
|
||||
ChartExtFilterRequest condition = formatCondition(filterParamTO);
|
||||
Boolean vValid = valueValid(condition);
|
||||
String filterComponentId = condition.getComponentId();
|
||||
emptyResult.entrySet().forEach(entry -> {
|
||||
String viewId = entry.getKey();
|
||||
boolean vidMatch = viewIdMatch(condition.getViewIds(), viewId);
|
||||
List<ChartExtFilterRequest> viewFilters = emptyResult.get(viewId);
|
||||
int j = viewFilters.size();
|
||||
while (j-- > 0) {
|
||||
ChartExtFilterRequest filter = viewFilters.get(j);
|
||||
if (StringUtils.equals(filter.getComponentId(), filterComponentId)) {
|
||||
viewFilters.remove(j);
|
||||
}
|
||||
}
|
||||
if (vidMatch && vValid) {
|
||||
viewFilters.add(condition);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return emptyResult;
|
||||
}
|
||||
|
||||
private Boolean valueValid(ChartExtFilterRequest condition) {
|
||||
return ObjectUtils.isNotEmpty(condition) && CollectionUtils.isNotEmpty(condition.getValue()) && StringUtils.isNotBlank(condition.getValue().get(0));
|
||||
}
|
||||
|
||||
private Boolean viewIdMatch(List<String> viewIds, String viewId) {
|
||||
return CollectionUtils.isEmpty(viewIds) || viewIds.contains(viewId);
|
||||
}
|
||||
|
||||
private ChartExtFilterRequest formatCondition(FilterParamTO filterParamTO) {
|
||||
|
||||
Boolean isTree = filterParamTO.getIsTree();
|
||||
List<String> value = filterParamTO.getValue();
|
||||
Map<String, Object> component = filterParamTO.getComponent();
|
||||
Map<String, Object> attrs = (Map<String, Object>) ((Map<String, Object>) component.get("options")).get("attrs");
|
||||
String fieldId = attrs.get("fieldId").toString();
|
||||
List<String> viewIds = (List<String>)attrs.get("viewIds");
|
||||
List<String> parameters = (List<String>) attrs.get("parameters");
|
||||
Boolean multiple = ObjectUtils.isNotEmpty(attrs.get("multiple")) && (Boolean) attrs.get("multiple");
|
||||
if (isTree && !multiple && CollectionUtils.isNotEmpty(value)) {
|
||||
// 单选树
|
||||
String val = value.get(0);
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
int len = val.split(",").length;
|
||||
if (len > 0) {
|
||||
List<String> fieldIdList = Arrays.asList(fieldId.split(","));
|
||||
fieldId = fieldIdList.stream().limit(len).collect(Collectors.joining(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
ChartExtFilterRequest condition = new ChartExtFilterRequest();
|
||||
condition.setComponentId(component.get("id").toString());
|
||||
condition.setFieldId(fieldId);
|
||||
condition.setValue(value);
|
||||
condition.setOperator(filterParamTO.getOperator());
|
||||
condition.setViewIds(viewIds);
|
||||
condition.setParameters(parameters);
|
||||
condition.setIsTree(isTree);
|
||||
return condition;
|
||||
}
|
||||
|
||||
private Map<String, List<ChartExtFilterRequest>> buildEmpty(List<Map<String, Object>> components) {
|
||||
Map<String, List<ChartExtFilterRequest>> result = new HashMap<>();
|
||||
components.forEach(element -> {
|
||||
if (StringUtils.equals(element.get("type").toString(), "'view'")) {
|
||||
String viewId = ((Map<String, Object>) element.get("propValue")).get("viewId").toString();
|
||||
result.put(viewId, new ArrayList<>());
|
||||
}
|
||||
if (StringUtils.equals(element.get("type").toString(), "'de-tabs'")) {
|
||||
List<Map<String, Object>> tabs = (List<Map<String, Object>>) ((Map<String, Object>) element.get("options")).get("tabList");
|
||||
if (CollectionUtils.isNotEmpty(tabs)) {
|
||||
tabs.forEach(tab -> {
|
||||
Object contentObj = null;
|
||||
if ((contentObj = tab.get("content")) != null) {
|
||||
Map<String, Object> content = (Map<String, Object>) contentObj;
|
||||
Object propObj = null;
|
||||
if ((propObj = content.get("propValue")) != null) {
|
||||
Map<String, String> prop = (Map<String, String>) propObj;
|
||||
String viewId = prop.get("viewId");
|
||||
if (StringUtils.isNotBlank(viewId)) {
|
||||
result.put(viewId, new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> componentsFilter(List<Map<String, Object>> components, String type,
|
||||
String componentType, String serviceName) {
|
||||
return components.stream().filter(component -> {
|
||||
String ctype = Optional.ofNullable(component.get("type")).orElse("").toString();
|
||||
String cComponentType = Optional.ofNullable(component.get("component")).orElse("").toString();
|
||||
String cServiceName = Optional.ofNullable(component.get("serviceName")).orElse("").toString();
|
||||
|
||||
boolean typeMatch = true;
|
||||
boolean componentTypeMatch = true;
|
||||
boolean serviceNameMatch = true;
|
||||
|
||||
if (StringUtils.isNotBlank(type)) {
|
||||
typeMatch = StringUtils.equals(type, ctype);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(componentType)) {
|
||||
componentTypeMatch = StringUtils.equals(componentType, cComponentType);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(serviceName)) {
|
||||
serviceNameMatch = StringUtils.equals(serviceName, cServiceName);
|
||||
}
|
||||
|
||||
return typeMatch && componentTypeMatch && serviceNameMatch;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
public static FilterBuildTemplate getInstance(String serviceName) {
|
||||
Map<String, String> beanMapping = new HashMap<>();
|
||||
beanMapping.put("numberRangeWidget", "numberRangeWidget");
|
||||
beanMapping.put("textSelectTreeWidget", "textSelectTreeWidget");
|
||||
beanMapping.put("textInputWidget", "textInputWidget");
|
||||
String beanName = beanMapping.get(serviceName);
|
||||
if (StringUtils.isBlank(beanName) && StringUtils.contains(serviceName, "select")) {
|
||||
beanName = "selectWidget";
|
||||
}
|
||||
return (FilterBuildTemplate)CommonBeanFactory.getBean(beanName);
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ public class ViewExportExcel {
|
||||
PanelGroupDTO panelDto = panelGroupService.findOne(panelId);
|
||||
String componentsJson = panelDto.getPanelData();
|
||||
List<Map<String, Object>> components = gson.fromJson(componentsJson, tokenType);
|
||||
ChartExtRequest chartExtRequest = buildViewRequest(componentsFilter(components, "custom", null, null));
|
||||
ChartExtRequest chartExtRequest = buildViewRequest(FilterBuildTemplate.componentsFilter(components, "custom", null, null));
|
||||
List<File> results = new ArrayList<>();
|
||||
List<ExcelSheetModel> sheets = viewIds.stream().map(viewId -> viewFiles(viewId, chartExtRequest)).collect(Collectors.toList());
|
||||
File excelFile = ExcelUtils.exportExcel(sheets, panelDto.getName());
|
||||
@ -52,34 +52,7 @@ public class ViewExportExcel {
|
||||
return results;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> componentsFilter(List<Map<String, Object>> components, String type,
|
||||
String componentType, String serviceName) {
|
||||
return components.stream().filter(component -> {
|
||||
String ctype = Optional.ofNullable(component.get("type")).orElse("").toString();
|
||||
String cComponentType = Optional.ofNullable(component.get("component")).orElse("").toString();
|
||||
String cServiceName = Optional.ofNullable(component.get("serviceName")).orElse("").toString();
|
||||
|
||||
boolean typeMatch = true;
|
||||
boolean componentTypeMatch = true;
|
||||
boolean serviceNameMatch = true;
|
||||
|
||||
if (StringUtils.isNotBlank(type)) {
|
||||
typeMatch = StringUtils.equals(type, ctype);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(componentType)) {
|
||||
componentTypeMatch = StringUtils.equals(componentType, cComponentType);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(serviceName)) {
|
||||
serviceNameMatch = StringUtils.equals(serviceName, cServiceName);
|
||||
}
|
||||
|
||||
return typeMatch && componentTypeMatch && serviceNameMatch;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
private ChartExtRequest buildViewRequest(List<Map<String, Object>> filters) {
|
||||
ChartExtRequest chartExtRequest = new ChartExtRequest();
|
||||
@ -95,6 +68,11 @@ public class ViewExportExcel {
|
||||
return chartExtRequest;
|
||||
}
|
||||
|
||||
private List<ChartExtFilterRequest> initFilters(List<Map<String, Object>> components) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ExcelSheetModel viewFiles(String viewId, ChartExtRequest request) {
|
||||
ExcelSheetModel result = new ExcelSheetModel();
|
||||
ChartViewDTO chartViewDTO = null;
|
||||
|
@ -0,0 +1,65 @@
|
||||
package io.dataease.service.chart.build;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import io.dataease.dto.chart.FilterParamTO;
|
||||
import io.dataease.service.chart.FilterBuildTemplate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("numberRangeWidget")
|
||||
public class NumberRangeBuild extends FilterBuildTemplate {
|
||||
|
||||
@Override
|
||||
protected FilterParamTO buildParam(Map<String, Object> component) {
|
||||
FilterParamTO result = new FilterParamTO();
|
||||
result.setComponent(component);
|
||||
result.setValue(null);
|
||||
result.setOperator("eq");
|
||||
Object optionObj = null;
|
||||
Object valueObj = null;
|
||||
|
||||
Map<String, Object> options = null;
|
||||
List<String> values = null;
|
||||
if((optionObj = component.get("options")) != null && (valueObj = (options = (Map<String, Object>) optionObj).get("value")) != null && CollectionUtil.isNotEmpty((values = (List<String>) valueObj))) {
|
||||
String min = values.get(0);
|
||||
String max = null;
|
||||
|
||||
if(values.size() > 1) {
|
||||
max = values.get(1);
|
||||
}
|
||||
result.setOperator("between");
|
||||
result.getValue().set(0, min);
|
||||
result.getValue().set(1, max);
|
||||
|
||||
if (StringUtils.isNotBlank(min) && StringUtils.isNotBlank(max)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(min) && StringUtils.isBlank(max)) {
|
||||
result.setValue(null);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(min)) {
|
||||
List<String> tempValues = new ArrayList<>();
|
||||
tempValues.add(min);
|
||||
result.setValue(tempValues);
|
||||
result.setOperator("ge");
|
||||
return result;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(max)) {
|
||||
List<String> tempValues = new ArrayList<>();
|
||||
tempValues.add(max);
|
||||
result.setValue(tempValues);
|
||||
result.setOperator("le");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package io.dataease.service.chart.build;
|
||||
|
||||
import io.dataease.dto.chart.FilterParamTO;
|
||||
import io.dataease.service.chart.FilterBuildTemplate;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("selectWidget")
|
||||
public class SelectBuild extends FilterBuildTemplate {
|
||||
@Override
|
||||
protected FilterParamTO buildParam(Map<String, Object> component) {
|
||||
FilterParamTO result = new FilterParamTO();
|
||||
result.setComponent(component);
|
||||
result.setValue(null);
|
||||
result.setOperator("eq");
|
||||
Object valueObj = null;
|
||||
|
||||
List<String> realValues = null;
|
||||
if(ObjectUtils.isEmpty(component.get("options"))) return result;
|
||||
Map<String, Object> options = (Map<String, Object>)component.get("options");
|
||||
|
||||
valueObj = options.get("value");
|
||||
String defaultValue = "";
|
||||
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
|
||||
boolean multiple = (boolean) attrs.get("multiple");
|
||||
if(!ObjectUtils.isEmpty(valueObj)) {
|
||||
if(valueObj instanceof List) {
|
||||
defaultValue = "";
|
||||
}else {
|
||||
defaultValue = valueObj.toString();
|
||||
}
|
||||
}
|
||||
if(multiple) {
|
||||
if (StringUtils.isBlank(defaultValue)) {
|
||||
realValues = new ArrayList<>();
|
||||
}else {
|
||||
realValues = Arrays.asList(defaultValue.split(","));
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isBlank(defaultValue)) {
|
||||
realValues = new ArrayList<>();
|
||||
}else {
|
||||
realValues = Arrays.asList(defaultValue.split(",")).stream().limit(1).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
result.setOperator(multiple ? "in" : "eq");
|
||||
result.setValue(realValues);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package io.dataease.service.chart.build;
|
||||
|
||||
import io.dataease.dto.chart.FilterParamTO;
|
||||
import io.dataease.service.chart.FilterBuildTemplate;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("textSelectTreeWidget")
|
||||
public class SelectTreeBuild extends FilterBuildTemplate {
|
||||
@Override
|
||||
protected FilterParamTO buildParam(Map<String, Object> component) {
|
||||
FilterParamTO result = new FilterParamTO();
|
||||
result.setComponent(component);
|
||||
result.setValue(null);
|
||||
result.setOperator("eq");
|
||||
result.setIsTree(true);
|
||||
Object valueObj = null;
|
||||
|
||||
List<String> realValues = null;
|
||||
if(ObjectUtils.isEmpty(component.get("options"))) return result;
|
||||
Map<String, Object> options = (Map<String, Object>)component.get("options");
|
||||
|
||||
valueObj = options.get("value");
|
||||
String defaultValue = "";
|
||||
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
|
||||
boolean multiple = (boolean) attrs.get("multiple");
|
||||
if(!ObjectUtils.isEmpty(valueObj)) {
|
||||
if(valueObj instanceof List) {
|
||||
defaultValue = "";
|
||||
}else {
|
||||
defaultValue = valueObj.toString();
|
||||
}
|
||||
}
|
||||
if(multiple) {
|
||||
if (StringUtils.isBlank(defaultValue)) {
|
||||
realValues = new ArrayList<>();
|
||||
}else {
|
||||
realValues = Arrays.asList(defaultValue.split(","));
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isBlank(defaultValue)) {
|
||||
realValues = new ArrayList<>();
|
||||
}else {
|
||||
realValues = Arrays.asList(defaultValue.split(",")).stream().limit(1).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
result.setOperator(multiple ? "in" : "eq");
|
||||
result.setValue(realValues);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(result.getValue())) {
|
||||
result.setValue(result.getValue().stream().map(val -> val.replaceAll("-de-", ",")).collect(Collectors.toList()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package io.dataease.service.chart.build;
|
||||
|
||||
import io.dataease.dto.chart.FilterParamTO;
|
||||
import io.dataease.service.chart.FilterBuildTemplate;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("textInputWidget")
|
||||
public class TextInputBuild extends FilterBuildTemplate {
|
||||
@Override
|
||||
protected FilterParamTO buildParam(Map<String, Object> component) {
|
||||
FilterParamTO result = new FilterParamTO();
|
||||
result.setComponent(component);
|
||||
result.setValue(null);
|
||||
result.setOperator("like");
|
||||
Object valueObj = null;
|
||||
|
||||
List<String> realValues = null;
|
||||
if(ObjectUtils.isEmpty(component.get("options"))) return result;
|
||||
Map<String, Object> options = (Map<String, Object>)component.get("options");
|
||||
|
||||
valueObj = options.get("value");
|
||||
String defaultValue = "";
|
||||
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
|
||||
if(!ObjectUtils.isEmpty(valueObj)) {
|
||||
if(valueObj instanceof List) {
|
||||
defaultValue = "";
|
||||
}else {
|
||||
defaultValue = valueObj.toString();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(defaultValue)) {
|
||||
realValues = new ArrayList<>();
|
||||
}else {
|
||||
realValues = Arrays.asList(defaultValue.split(",")).stream().limit(1).collect(Collectors.toList());
|
||||
}
|
||||
result.setValue(realValues);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package io.dataease.service.chart.build;
|
||||
|
||||
import io.dataease.dto.chart.FilterParamTO;
|
||||
import io.dataease.service.chart.FilterBuildTemplate;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class TimeYearBuild extends FilterBuildTemplate {
|
||||
@Override
|
||||
protected FilterParamTO buildParam(Map<String, Object> component) {
|
||||
List<String> realVals = null;
|
||||
Object valueObj = null;
|
||||
String defaultValue = "";
|
||||
Map<String, Object> options = (Map<String, Object>) component.get("options");
|
||||
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
|
||||
Object aDefault = attrs.get("default");
|
||||
Boolean isDynamic = (Boolean) attrs.getOrDefault("isDynamic", false);
|
||||
if (ObjectUtils.isNotEmpty(aDefault) && isDynamic) {
|
||||
Long aLong = dynamicDateFormNow(component);
|
||||
realVals = new ArrayList<>();
|
||||
realVals.add(aLong.toString());
|
||||
}else {
|
||||
if(!ObjectUtils.isEmpty(valueObj)) {
|
||||
if(valueObj instanceof List) {
|
||||
defaultValue = "";
|
||||
}else {
|
||||
defaultValue = valueObj.toString();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(defaultValue)) {
|
||||
realVals = new ArrayList<>();
|
||||
}else {
|
||||
realVals = Arrays.asList(defaultValue.split(",")).stream().limit(1).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private Long dynamicDateFormNow(Map<String, Object> component) {
|
||||
Map<String, Object> attrs = (Map<String, Object>) ((Map<String, Object>) component.get("options")).get("attrs");
|
||||
Object aDefault = attrs.get("default");
|
||||
Boolean isDynamic = (Boolean) attrs.getOrDefault("isDynamic", false);
|
||||
if (ObjectUtils.isEmpty(aDefault) || !isDynamic) return null;
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
int nowYear = now.get(Calendar.YEAR);
|
||||
Map<String, Object> aDefaultMap = (Map<String, Object>) aDefault;
|
||||
if (Integer.parseInt(aDefaultMap.get("dkey").toString()) == 0){
|
||||
now.set(nowYear, 0, 1, 0, 0, 0);
|
||||
return now.getTimeInMillis();
|
||||
}
|
||||
if (Integer.parseInt(aDefaultMap.get("dkey").toString()) == 1){
|
||||
now.set(nowYear - 1, 0, 1, 0, 0, 0);
|
||||
return now.getTimeInMillis();
|
||||
}
|
||||
if (Integer.parseInt(aDefaultMap.get("dkey").toString()) == 2){
|
||||
int dynamicPrefix = Integer.parseInt(aDefaultMap.get("dynamicPrefix").toString());
|
||||
String dynamicSuffix = aDefaultMap.get("dynamicSuffix").toString();
|
||||
now.set(StringUtils.equals("before", dynamicSuffix) ? (nowYear - dynamicPrefix) : (nowYear + dynamicPrefix), 0, 1, 0, 0, 0);
|
||||
return now.getTimeInMillis();
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
}
|
@ -49,9 +49,7 @@ import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.Parenthesis;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
||||
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
||||
import net.sf.jsqlparser.expression.operators.relational.LikeExpression;
|
||||
import net.sf.jsqlparser.expression.operators.relational.*;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||
import net.sf.jsqlparser.statement.Statement;
|
||||
import net.sf.jsqlparser.statement.select.PlainSelect;
|
||||
@ -2583,6 +2581,34 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(MinorThan minorThan) {
|
||||
getBuffer().append(minorThan.getLeftExpression());
|
||||
getBuffer().append(" < ");
|
||||
getBuffer().append( minorThan.getRightExpression());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(MinorThanEquals minorThan) {
|
||||
getBuffer().append(minorThan.getLeftExpression());
|
||||
getBuffer().append(" <= ");
|
||||
getBuffer().append( minorThan.getRightExpression());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(GreaterThanEquals minorThan) {
|
||||
getBuffer().append(minorThan.getLeftExpression());
|
||||
getBuffer().append(" >= ");
|
||||
getBuffer().append( minorThan.getRightExpression());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(GreaterThan minorThan) {
|
||||
getBuffer().append(minorThan.getLeftExpression());
|
||||
getBuffer().append(" > ");
|
||||
getBuffer().append( minorThan.getRightExpression());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(ExpressionList expressionList) {
|
||||
for (Iterator<Expression> iter = expressionList.getExpressions().iterator(); iter.hasNext();) {
|
||||
|
@ -33,6 +33,7 @@
|
||||
<el-input v-if="treeParams.filterable" v-model="keywords" size="mini" class="input-with-select mb10">
|
||||
<el-button slot="append" icon="el-icon-search" @click="_searchFun" />
|
||||
</el-input>
|
||||
<p v-if="selectParams.multiple" class="tree-select-all"><el-checkbox :indeterminate="isIndeterminate" v-customStyle="customStyle" @change="selectAllChane" v-model="selectAll">{{ $t('dataset.check_all') }}</el-checkbox></p>
|
||||
<el-scrollbar tag="div" wrap-class="el-select-dropdown__wrap" view-class="el-select-dropdown__list" class="is-empty">
|
||||
<!-- 树列表 -->
|
||||
<el-tree
|
||||
@ -203,10 +204,15 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
customStyle: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectAll: false,
|
||||
guid: guid(),
|
||||
propsValue: 'flowId',
|
||||
propsLabel: 'name',
|
||||
@ -229,6 +235,10 @@ export default {
|
||||
popperClass() {
|
||||
const _c = 'el-tree-select-popper ' + this.popoverClass
|
||||
return this.disabled ? _c + ' disabled ' : _c
|
||||
},
|
||||
isIndeterminate() {
|
||||
if (!this.selectParams.multiple) return;
|
||||
return this.ids.length > 0 && this.ids.length !== this._checkSum().length
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -283,6 +293,21 @@ export default {
|
||||
off(document, 'mouseup', this._popoverHideFun)
|
||||
},
|
||||
methods: {
|
||||
selectAllChane(val) {
|
||||
if (val) {
|
||||
this.ids = this._checkSum();
|
||||
this._emitFun();
|
||||
return
|
||||
}
|
||||
this._selectClearFun()
|
||||
},
|
||||
_checkSum() {
|
||||
let arr = [];
|
||||
(this.data || []).forEach(ele => {
|
||||
arr = [...this.allKidIds(ele), ...arr]
|
||||
})
|
||||
return arr
|
||||
},
|
||||
_treeCheckChange() {
|
||||
this.$emit("treeCheckChange")
|
||||
},
|
||||
@ -494,6 +519,7 @@ export default {
|
||||
`vm:` 当前组件的vm
|
||||
*/
|
||||
node.checkedKeys = checkedNodes.map(node => node.id)
|
||||
this.selectAll = this._checkSum().length === this.ids.length;
|
||||
this.$emit('check', data, node, vm)
|
||||
this._emitFun()
|
||||
},
|
||||
@ -549,6 +575,7 @@ export default {
|
||||
this.$emit('input', multiple ? [] : '')
|
||||
// 下拉框清空,对外抛出``this.$emit('select-clear');`
|
||||
this.$emit('select-clear')
|
||||
this.selectAll = false;
|
||||
this._updatePopoverLocationFun()
|
||||
},
|
||||
// 判断类型,抛出当前选中id
|
||||
@ -625,7 +652,9 @@ export default {
|
||||
.el-tree-select .select-option {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.tree-select-all {
|
||||
padding: 10px 20px 0 24px;
|
||||
}
|
||||
[aria-disabled='true'] > .el-tree-node__content {
|
||||
color: inherit !important;
|
||||
background: transparent !important;
|
||||
|
@ -6,12 +6,14 @@
|
||||
:class="classId"
|
||||
popper-class="VisualSelects coustom-de-select"
|
||||
no-match-text=" "
|
||||
clearable
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
@change="visualChange"
|
||||
@visible-change="popChange"
|
||||
>
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.text" :value="item.id" />
|
||||
<p v-if="startIndex === 0 && $attrs.multiple" class="select-all"><el-checkbox :indeterminate="isIndeterminate" v-customStyle="customStyle" @change="selectAllChane" v-model="selectAll">{{ $t('dataset.check_all') }}</el-checkbox></p>
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.text" :value="item.id" :class="setSelect(item.id)"/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
@ -31,6 +33,10 @@ export default {
|
||||
require: true,
|
||||
default: uuid.v1()
|
||||
},
|
||||
customStyle: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
@ -60,7 +66,13 @@ export default {
|
||||
itemHeight: 34, // select组件选项高度
|
||||
maxHeightDom: null,
|
||||
defaultFirst: false,
|
||||
show: true
|
||||
show: true,
|
||||
selectAll: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isIndeterminate() {
|
||||
return Array.isArray(this.selectValue) && this.selectValue.length > 0 && this.selectValue.length !== this.list.length
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -102,6 +114,16 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
setSelect(id) {
|
||||
if (Array.isArray(this.selectValue)) {
|
||||
return this.selectValue.map( ele => ele.id ).includes(id) && 'selected'
|
||||
}
|
||||
return this.selectValue === id && 'selected';
|
||||
},
|
||||
selectAllChane(val) {
|
||||
this.visualChange(val ? [...this.list.map( ele => ele.id )] : [])
|
||||
this.$emit('handleShowNumber');
|
||||
},
|
||||
addScrollDiv(selectDom) {
|
||||
this.maxHeightDom = document.createElement('div')
|
||||
this.maxHeightDom.className = 'el-select-height'
|
||||
@ -171,6 +193,9 @@ export default {
|
||||
this.reCacularHeight()
|
||||
},
|
||||
visualChange(val) {
|
||||
if(this.$attrs.multiple) {
|
||||
this.selectAll = val.length === this.list.length;
|
||||
}
|
||||
this.$emit('visual-change', val)
|
||||
}
|
||||
}
|
||||
@ -206,4 +231,7 @@ export default {
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
.select-all {
|
||||
padding: 10px 20px 0 20px;
|
||||
}
|
||||
</style>
|
||||
|
@ -80,7 +80,7 @@ export default {
|
||||
return widget.isTimeWidget && widget.isTimeWidget()
|
||||
},
|
||||
componentType() {
|
||||
let result = 'date'
|
||||
let result = this.element.options.attrs.type || 'date'
|
||||
if (this.isTimeWidget && this.element.options.attrs.showTime) {
|
||||
result = 'datetime'
|
||||
}
|
||||
@ -91,7 +91,7 @@ export default {
|
||||
if (this.isTimeWidget && this.element.options.attrs.showTime && this.element.options.attrs.accuracy) {
|
||||
return result + ' ' + this.element.options.attrs.accuracy
|
||||
}
|
||||
return result
|
||||
return null
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -16,10 +16,12 @@
|
||||
:key-word="keyWord"
|
||||
popper-class="coustom-de-select"
|
||||
:list="datas"
|
||||
:customStyle="customStyle"
|
||||
@change="changeValue"
|
||||
@focus="setOptionWidth"
|
||||
@blur="onBlur"
|
||||
@visual-change="visualChange"
|
||||
@handleShowNumber="handleShowNumber"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in templateDatas || datas"
|
||||
@ -104,6 +106,10 @@ export default {
|
||||
},
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
customStyle() {
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style;
|
||||
return { brColor, wordColor, innerBgColor }
|
||||
}
|
||||
},
|
||||
|
||||
@ -211,7 +217,7 @@ export default {
|
||||
},
|
||||
onScroll() {
|
||||
if (this.onFocus) {
|
||||
this.$refs.deSelect.blur()
|
||||
this.$refs.deSelect.$refs.visualSelect.blur()
|
||||
}
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
@ -251,7 +257,7 @@ export default {
|
||||
}
|
||||
},
|
||||
visualChange(value) {
|
||||
this.value = value
|
||||
this.value = value;
|
||||
this.$nextTick(() => {
|
||||
if (!this.element.options.attrs.multiple) {
|
||||
return
|
||||
@ -271,18 +277,22 @@ export default {
|
||||
this.element.options.manualModify = true
|
||||
}
|
||||
this.setCondition()
|
||||
this.handleShowNumber()
|
||||
},
|
||||
handleShowNumber() {
|
||||
this.showNumber = false
|
||||
const tags = this.$refs.deSelect.$refs.visualSelect.$refs.tags
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (!this.element.options.attrs.multiple || !this.$refs.deSelect || !this.$refs.deSelect.$refs.tags) {
|
||||
if (!this.element.options.attrs.multiple || !this.$refs.deSelect || !tags) {
|
||||
return
|
||||
}
|
||||
const kids = this.$refs.deSelect.$refs.tags.children[0].children
|
||||
const kids = tags.children[0].children
|
||||
let contentWidth = 0
|
||||
kids.forEach(kid => {
|
||||
contentWidth += kid.offsetWidth
|
||||
})
|
||||
this.showNumber = contentWidth > ((this.$refs.deSelect.$refs.tags.clientWidth - 30) * 0.9)
|
||||
this.showNumber = contentWidth > ((tags.clientWidth - 30) * 0.9)
|
||||
this.handleElTagStyle()
|
||||
})
|
||||
},
|
||||
|
@ -10,6 +10,7 @@
|
||||
:tree-params="treeParams"
|
||||
:filter-node-method="_filterFun"
|
||||
:tree-render-fun="_renderFun"
|
||||
:customStyle="customStyle"
|
||||
@searchFun="_searchFun"
|
||||
@node-click="changeNode"
|
||||
@removeTag="changeNodeIds"
|
||||
@ -106,6 +107,10 @@ export default {
|
||||
},
|
||||
isSingle() {
|
||||
return this.element.options.attrs.multiple
|
||||
},
|
||||
customStyle() {
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style;
|
||||
return { brColor, wordColor, innerBgColor }
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -86,6 +86,19 @@ const btnPress = {
|
||||
},
|
||||
}
|
||||
|
||||
const customStyle = {
|
||||
inserted: function (el, binding) {
|
||||
const label = el.querySelector('.el-checkbox__label');
|
||||
if (label) {
|
||||
if (label.getAttribute("data-color") === binding.value.wordColor) {
|
||||
return
|
||||
};
|
||||
label.style.setProperty('color', binding.value.wordColor, 'important');
|
||||
label.setAttribute("data-color", binding.value.wordColor);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
install(Vue) {
|
||||
@ -96,6 +109,7 @@ export default {
|
||||
Vue.directive('bottom-to-top-drag', bottom2TopDrag)
|
||||
Vue.directive('closePress', closePress)
|
||||
Vue.directive('btnPress', btnPress)
|
||||
Vue.directive('customStyle', customStyle)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,6 +563,10 @@ export default {
|
||||
clear_filter: 'Empty condition',
|
||||
recover_pwd: 'Restore to the original password?',
|
||||
filter_method: 'Filter criteria',
|
||||
filter: 'screen',
|
||||
list: 'List item',
|
||||
list_info: 'Please select the information to be displayed in the list',
|
||||
sure_delete: 'Are you sure to delete this user?',
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP url',
|
||||
|
@ -564,6 +564,10 @@ export default {
|
||||
clear_filter: '清空條件',
|
||||
recover_pwd: '是否恢復為初始密碼?',
|
||||
filter_method: '篩選條件',
|
||||
filter: '篩選',
|
||||
list: '列表項',
|
||||
list_info: '請選擇列表中要展示的信息',
|
||||
sure_delete: '確定刪除該用戶嗎?',
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP地址',
|
||||
|
@ -565,6 +565,10 @@ export default {
|
||||
clear_filter: '清空条件',
|
||||
recover_pwd: '是否恢复为初始密码?',
|
||||
filter_method: '筛选条件',
|
||||
filter: '筛选',
|
||||
list: '列表项',
|
||||
list_info: '请选择列表中要展示的信息',
|
||||
sure_delete: '确定删除该用户吗?',
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP地址',
|
||||
|
@ -888,3 +888,91 @@ div:focus {
|
||||
}
|
||||
}
|
||||
|
||||
.el-tabs {
|
||||
.el-tabs__item.is-active {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.de-message {
|
||||
min-width: 20px !important;
|
||||
padding: 16px 20px !important;
|
||||
flex-direction: row;
|
||||
box-shadow: 0px 4px 8px 0px #1f23291a;
|
||||
span {
|
||||
font-family: PingFang SC;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 22px;
|
||||
letter-spacing: 0px;
|
||||
text-align: left;
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
i {
|
||||
height: 14.666666984558105px;
|
||||
width: 14.666669845581055px;
|
||||
margin-right: 8.67px;
|
||||
}
|
||||
}
|
||||
.de-message-fail {
|
||||
border: 1px solid #f54a45 !important;
|
||||
background: #fef1f1 !important;
|
||||
i {
|
||||
color: #f54a45;
|
||||
}
|
||||
}
|
||||
|
||||
.de-message-success {
|
||||
border: 1px solid #34c724 !important;
|
||||
background: #f0fbef !important;
|
||||
i {
|
||||
color: #34c724;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-cont {
|
||||
text-align: right;
|
||||
margin-top: 10px;
|
||||
::v-deep .el-pager li {
|
||||
background-color: #fff;
|
||||
border: 1px solid #bbbfc4;
|
||||
border-radius: 4px;
|
||||
color: #1f2329;
|
||||
box-sizing: border-box;
|
||||
line-height: 26px;
|
||||
font-family: SF Pro Text;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
::v-deep .btn-prev,
|
||||
::v-deep .btn-next {
|
||||
background: #fff;
|
||||
background-color: #fff;
|
||||
border: 1px solid #bbbfc4;
|
||||
border-radius: 4px;
|
||||
color: #bbbfc4;
|
||||
}
|
||||
|
||||
::v-deep .el-pagination__total {
|
||||
font-family: "PingFang SC";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
color: #1f2329;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
::v-deep .number.active,
|
||||
::v-deep .el-input__inner:hover {
|
||||
border-color: #3370ff;
|
||||
color: #3370ff !important;
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
::v-deep .el-icon-more {
|
||||
border: none !important;
|
||||
}
|
||||
}
|
@ -541,7 +541,7 @@ function mappingColor(value, defaultColor, field, type) {
|
||||
} else if (i === field.conditions.length - 1) {
|
||||
color = defaultColor
|
||||
}
|
||||
} else if (field.field.deType === 0) {
|
||||
} else if (field.field.deType === 0 || field.field.deType === 5) {
|
||||
const tv = t.value
|
||||
if (t.term === 'eq') {
|
||||
if (value === tv) {
|
||||
@ -564,22 +564,12 @@ function mappingColor(value, defaultColor, field, type) {
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'null') {
|
||||
if (value === null || value === undefined) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_null') {
|
||||
if (value !== null && value !== undefined) {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'empty') {
|
||||
if (value === '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_empty') {
|
||||
if (value !== '') {
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
|
@ -166,16 +166,6 @@ export default {
|
||||
value: 'not_null',
|
||||
label: this.$t('chart.filter_not_null')
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [{
|
||||
value: 'empty',
|
||||
label: this.$t('chart.filter_empty')
|
||||
}, {
|
||||
value: 'not_empty',
|
||||
label: this.$t('chart.filter_not_empty')
|
||||
}]
|
||||
}
|
||||
],
|
||||
dateOptions: [
|
||||
|
@ -2297,6 +2297,7 @@ export default {
|
||||
}
|
||||
}
|
||||
this.dragMoveDuplicate(this.view.customFilter, e)
|
||||
this.dragRemoveChartField(this.view.customFilter, e)
|
||||
this.calcData(true)
|
||||
},
|
||||
|
||||
|
@ -1039,7 +1039,7 @@ export default {
|
||||
|
||||
for (var j = 0; j < this.apiItem.fields.length; j++) {
|
||||
if(this.apiItem.fields[j].name === jsonFields[i].name){
|
||||
this.$refs.apiItemTable.toggleRowSelection(jsonFields[i]);
|
||||
jsonFields[i].checked = false;
|
||||
this.$message.error(jsonFields[i].name + ', ' + i18n.t('datasource.has_repeat_field_name'))
|
||||
return
|
||||
}
|
||||
|
@ -354,17 +354,19 @@ export default {
|
||||
|
||||
.filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 46px;
|
||||
min-height: 46px;
|
||||
> :nth-child(1) {
|
||||
margin-right: 88px;
|
||||
color: #1f2329;
|
||||
font-family: "PingFang SC";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
white-space: nowrap;
|
||||
width: 116px;
|
||||
}
|
||||
.filter-item {
|
||||
flex: 1;
|
||||
.item,
|
||||
.more {
|
||||
font-family: PingFang SC;
|
||||
@ -378,6 +380,8 @@ export default {
|
||||
background: #f5f6f7;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.active,
|
||||
|
@ -30,21 +30,21 @@
|
||||
:class="[filterTexts.length ? 'active-btn filter-not-null' : 'filter-zero']"
|
||||
icon="iconfont icon-icon-filter"
|
||||
@click="filterShow"
|
||||
>筛选<template v-if="filterTexts.length">
|
||||
>{{ $t('user.filter') }}<template v-if="filterTexts.length">
|
||||
({{ filterTexts.length }})
|
||||
</template>
|
||||
</el-button>
|
||||
<el-dropdown trigger="click" :hide-on-click="false">
|
||||
<el-button v-btnPress class="normal btn filter-zero" icon="el-icon-setting"
|
||||
>列表项</el-button
|
||||
>{{ $t('user.list') }}</el-button
|
||||
>
|
||||
<el-dropdown-menu class="list-colums-slect" slot="dropdown">
|
||||
<p class="title">请选择列表中要展示的信息</p>
|
||||
<p class="title">{{ $t('user.list_info') }}</p>
|
||||
<el-checkbox
|
||||
:indeterminate="isIndeterminate"
|
||||
v-model="checkAll"
|
||||
@change="handleCheckAllChange"
|
||||
>全选</el-checkbox
|
||||
>{{ $t('dataset.check_all')}}</el-checkbox
|
||||
>
|
||||
<el-checkbox-group
|
||||
v-model="checkedColumnNames"
|
||||
@ -483,7 +483,7 @@ export default {
|
||||
this.initSearch();
|
||||
},
|
||||
onCopy(e) {
|
||||
this.$success(this.$t("commons.copy_success"));
|
||||
this.openMessageSuccess("commons.copy_success");
|
||||
},
|
||||
onError(e) {},
|
||||
handleSizeChange(pageSize) {
|
||||
@ -531,7 +531,7 @@ export default {
|
||||
this.$refs.userEditer.init(row);
|
||||
},
|
||||
del(row) {
|
||||
this.$confirm(this.$t("确定删除该用户吗?"), "", {
|
||||
this.$confirm(this.$t("user.sure_delete"), "", {
|
||||
confirmButtonText: this.$t("commons.delete"),
|
||||
cancelButtonText: this.$t("commons.cancel"),
|
||||
cancelButtonClass: "de-confirm-fail-btn de-confirm-fail-cancel",
|
||||
@ -541,7 +541,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
delUser(encodeURIComponent(row.userId)).then((res) => {
|
||||
this.openMessageSuccess();
|
||||
this.openMessageSuccess("commons.delete_success");
|
||||
this.initSearch();
|
||||
});
|
||||
})
|
||||
@ -549,11 +549,11 @@ export default {
|
||||
this.$info(this.$t("commons.delete_cancel"));
|
||||
});
|
||||
},
|
||||
openMessageSuccess() {
|
||||
openMessageSuccess(text) {
|
||||
const h = this.$createElement;
|
||||
this.$message({
|
||||
message: h("p", null, [
|
||||
h("span", null, this.$t("commons.delete_success")),
|
||||
h("span", null, this.$t(text)),
|
||||
]),
|
||||
iconClass: "el-icon-success",
|
||||
customClass: "de-message-success de-message",
|
||||
@ -852,44 +852,6 @@ export default {
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.de-message {
|
||||
min-width: 20px !important;
|
||||
padding: 16px 20px !important;
|
||||
flex-direction: row;
|
||||
box-shadow: 0px 4px 8px 0px #1f23291a;
|
||||
span {
|
||||
font-family: PingFang SC;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 22px;
|
||||
letter-spacing: 0px;
|
||||
text-align: left;
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
i {
|
||||
height: 14.666666984558105px;
|
||||
width: 14.666669845581055px;
|
||||
margin-right: 8.67px;
|
||||
}
|
||||
}
|
||||
.de-message-fail {
|
||||
border: 1px solid #f54a45 !important;
|
||||
background: #fef1f1 !important;
|
||||
i {
|
||||
color: #f54a45;
|
||||
}
|
||||
}
|
||||
|
||||
.de-message-success {
|
||||
border: 1px solid #34c724 !important;
|
||||
background: #f0fbef !important;
|
||||
i {
|
||||
color: #34c724;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.de-confirm {
|
||||
border: none;
|
||||
.el-message-box__header {
|
||||
|
Loading…
Reference in New Issue
Block a user