Merge branch 'dev' into pr@dev@feat_liquid_dynamic_max

This commit is contained in:
wisonic-s 2022-10-20 18:13:44 +08:00
commit 00da4e8965
35 changed files with 714 additions and 365 deletions

View File

@ -182,7 +182,7 @@ public class AuthUserServiceImpl implements AuthUserService {
if (beansOfType.keySet().size() == 0) return false; if (beansOfType.keySet().size() == 0) return false;
OidcXpackService oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class); OidcXpackService oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class);
if (ObjectUtils.isEmpty(oidcXpackService)) return false; if (ObjectUtils.isEmpty(oidcXpackService)) return false;
return oidcXpackService.isSuuportOIDC(); return oidcXpackService.isSupportOIDC();
} }
@Override @Override
@ -191,7 +191,7 @@ public class AuthUserServiceImpl implements AuthUserService {
if (beansOfType.keySet().size() == 0) return false; if (beansOfType.keySet().size() == 0) return false;
CasXpackService casXpackService = SpringContextUtil.getBean(CasXpackService.class); CasXpackService casXpackService = SpringContextUtil.getBean(CasXpackService.class);
if (ObjectUtils.isEmpty(casXpackService)) return false; if (ObjectUtils.isEmpty(casXpackService)) return false;
return casXpackService.suuportCas(); return casXpackService.supportCas();
} }
@Override @Override

View File

@ -57,7 +57,7 @@ public class SSOServer {
DEException.throwException("缺少oidc插件"); DEException.throwException("缺少oidc插件");
} }
oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class); oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class);
Boolean suuportOIDC = oidcXpackService.isSuuportOIDC(); Boolean suuportOIDC = oidcXpackService.isSupportOIDC();
if (!suuportOIDC) { if (!suuportOIDC) {
DEException.throwException("未开启oidc"); DEException.throwException("未开启oidc");
} }

View File

@ -98,7 +98,7 @@ public class EsProvider extends Provider {
} }
@Override @Override
public List<TableField> getTableFileds(DatasourceRequest datasourceRequest) throws Exception { public List<TableField> getTableFields(DatasourceRequest datasourceRequest) throws Exception {
datasourceRequest.setQuery("desc " + String.format(EsSqlLConstants.KEYWORD_TABLE, datasourceRequest.getTable())); datasourceRequest.setQuery("desc " + String.format(EsSqlLConstants.KEYWORD_TABLE, datasourceRequest.getTable()));
List<TableField> tableFields = new ArrayList<>(); List<TableField> tableFields = new ArrayList<>();
try { try {

View File

@ -73,7 +73,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
@Override @Override
public List<TableField> getTableFileds(DatasourceRequest datasourceRequest) throws Exception { public List<TableField> getTableFields(DatasourceRequest datasourceRequest) throws Exception {
if (datasourceRequest.getDatasource().getType().equalsIgnoreCase("mongo")) { if (datasourceRequest.getDatasource().getType().equalsIgnoreCase("mongo")) {
datasourceRequest.setQuery("select * from " + datasourceRequest.getTable()); datasourceRequest.setQuery("select * from " + datasourceRequest.getTable());
return fetchResultField(datasourceRequest); return fetchResultField(datasourceRequest);

View File

@ -1193,7 +1193,7 @@ public class ChartViewService {
PluginViewParam pluginViewParam = new PluginViewParam(); PluginViewParam pluginViewParam = new PluginViewParam();
PluginViewSetImpl pluginViewSet = BeanUtils.copyBean(new PluginViewSetImpl(), table); PluginViewSetImpl pluginViewSet = BeanUtils.copyBean(new PluginViewSetImpl(), table);
pluginViewSet.setDsType(ds.getType()); pluginViewSet.setDsType(ds.getType());
pluginViewSet.setTabelId(table.getId()); pluginViewSet.setTableId(table.getId());
pluginViewSet.setDs(ds); pluginViewSet.setDs(ds);
PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view); PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view);

View File

@ -23,10 +23,10 @@ public abstract class FilterBuildTemplate {
List<Map<String, Object>> filters = componentsFilter(components, "custom", null, null); List<Map<String, Object>> filters = componentsFilter(components, "custom", null, null);
if(ObjectUtils.isNotEmpty(searchButton)) { if (ObjectUtils.isNotEmpty(searchButton)) {
Map<String, Object> options = (Map<String, Object>) searchButton.get("options"); Map<String, Object> options = (Map<String, Object>) searchButton.get("options");
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs"); Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
Boolean customRange = (Boolean)attrs.get("customRange"); Boolean customRange = (Boolean) attrs.get("customRange");
Boolean autoTrigger = (Boolean) attrs.get("autoTrigger"); Boolean autoTrigger = (Boolean) attrs.get("autoTrigger");
List<String> filterIds = (List<String>) attrs.get("filterIds"); List<String> filterIds = (List<String>) attrs.get("filterIds");
if (!autoTrigger) { // 不是自动触发 // 需要过滤掉按钮关联的条件组件 if (!autoTrigger) { // 不是自动触发 // 需要过滤掉按钮关联的条件组件
@ -77,7 +77,7 @@ public abstract class FilterBuildTemplate {
return ObjectUtils.isNotEmpty(condition) && CollectionUtils.isNotEmpty(condition.getValue()) && StringUtils.isNotBlank(condition.getValue().get(0)); return ObjectUtils.isNotEmpty(condition) && CollectionUtils.isNotEmpty(condition.getValue()) && StringUtils.isNotBlank(condition.getValue().get(0));
} }
private static Boolean viewIdMatch(List<String> viewIds, String viewId) { private static Boolean viewIdMatch(List<String> viewIds, String viewId) {
return CollectionUtils.isEmpty(viewIds) || viewIds.contains(viewId); return CollectionUtils.isEmpty(viewIds) || viewIds.contains(viewId);
} }
@ -88,7 +88,7 @@ public abstract class FilterBuildTemplate {
Map<String, Object> component = filterParamTO.getComponent(); Map<String, Object> component = filterParamTO.getComponent();
Map<String, Object> attrs = (Map<String, Object>) ((Map<String, Object>) component.get("options")).get("attrs"); Map<String, Object> attrs = (Map<String, Object>) ((Map<String, Object>) component.get("options")).get("attrs");
String fieldId = attrs.get("fieldId").toString(); String fieldId = attrs.get("fieldId").toString();
List<String> viewIds = (List<String>)attrs.get("viewIds"); List<String> viewIds = (List<String>) attrs.get("viewIds");
List<String> parameters = (List<String>) attrs.get("parameters"); List<String> parameters = (List<String>) attrs.get("parameters");
Boolean multiple = ObjectUtils.isNotEmpty(attrs.get("multiple")) && (Boolean) attrs.get("multiple"); Boolean multiple = ObjectUtils.isNotEmpty(attrs.get("multiple")) && (Boolean) attrs.get("multiple");
if (isTree && !multiple && CollectionUtils.isNotEmpty(value)) { if (isTree && !multiple && CollectionUtils.isNotEmpty(value)) {
@ -147,9 +147,9 @@ public abstract class FilterBuildTemplate {
} }
public static List<Map<String, Object>> componentsFilter(List<Map<String, Object>> components, String type, public static List<Map<String, Object>> componentsFilter(List<Map<String, Object>> components, String type,
String componentType, String serviceName) { String componentType, String serviceName) {
return components.stream().filter(component -> { return components.stream().filter(component -> {
String ctype = Optional.ofNullable(component.get("type")).orElse("").toString(); String ctype = Optional.ofNullable(component.get("type")).orElse("").toString();
String cComponentType = Optional.ofNullable(component.get("component")).orElse("").toString(); String cComponentType = Optional.ofNullable(component.get("component")).orElse("").toString();
String cServiceName = Optional.ofNullable(component.get("serviceName")).orElse("").toString(); String cServiceName = Optional.ofNullable(component.get("serviceName")).orElse("").toString();
@ -180,10 +180,20 @@ public abstract class FilterBuildTemplate {
beanMapping.put("numberRangeWidget", "numberRangeWidget"); beanMapping.put("numberRangeWidget", "numberRangeWidget");
beanMapping.put("textSelectTreeWidget", "textSelectTreeWidget"); beanMapping.put("textSelectTreeWidget", "textSelectTreeWidget");
beanMapping.put("textInputWidget", "textInputWidget"); beanMapping.put("textInputWidget", "textInputWidget");
beanMapping.put("timeDateWidget", "timeDateWidget");
beanMapping.put("timeMonthWidget", "timeMonthWidget");
beanMapping.put("timeYearWidget", "timeYearWidget");
beanMapping.put("timeDateRangeWidget", "timeDateRangeWidget");
String beanName = beanMapping.get(serviceName); String beanName = beanMapping.get(serviceName);
if (StringUtils.isBlank(beanName) && StringUtils.containsIgnoreCase(serviceName, "select")) { if (StringUtils.isBlank(beanName) && StringUtils.containsIgnoreCase(serviceName, "select")) {
beanName = "selectWidget"; beanName = "selectWidget";
} }
return (FilterBuildTemplate)CommonBeanFactory.getBean(beanName);
return (FilterBuildTemplate) CommonBeanFactory.getBean(beanName);
}
protected Map<String, Object> buildAttrs(Map<String, Object> component) {
Map<String, Object> attrs = (Map<String, Object>) ((Map<String, Object>) component.get("options")).get("attrs");
return attrs;
} }
} }

View File

@ -105,7 +105,7 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
String tableName = null; String tableName = null;
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(pluginViewSet.getInfo(), DataTableInfoDTO.class); DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(pluginViewSet.getInfo(), DataTableInfoDTO.class);
if (ObjectUtils.isNotEmpty(pluginViewSet.getMode()) && 1 == pluginViewSet.getMode()) { if (ObjectUtils.isNotEmpty(pluginViewSet.getMode()) && 1 == pluginViewSet.getMode()) {
tableName = TableUtils.tableName(pluginViewSet.getTabelId()); tableName = TableUtils.tableName(pluginViewSet.getTableId());
}else { }else {
switch (DatasetType.getEnumObjByKey(pluginViewSet.getType())) { switch (DatasetType.getEnumObjByKey(pluginViewSet.getType())) {
case DB: case DB:

View File

@ -0,0 +1,209 @@
package io.dataease.service.chart.build;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.LogUtil;
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 java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
public abstract class TimeBuild extends FilterBuildTemplate {
private static final String MULTIPLETYPE = "daterange";
@Override
protected FilterParamTO buildParam(Map<String, Object> component) {
FilterParamTO result = new FilterParamTO();
result.setComponent(component);
result.setValue(null);
result.setOperator("between");
result.setIsTree(false);
Map<String, Object> options = (Map<String, Object>) component.get("options");
Map<String, Object> attrs = (Map<String, Object>) options.get("attrs");
Object valueObj = options.get("value");
String defaultValue = "";
boolean multiple = attrs.get("type").equals(MULTIPLETYPE);
Object defaultObject = attrs.get("default");
Boolean isDynamic = false;
if (ObjectUtils.isNotEmpty(defaultObject)) {
Map<String, Object> defaultMap = (Map<String, Object>) defaultObject;
isDynamic = (Boolean) defaultMap.getOrDefault("isDynamic", false);
}
List<String> realValues = null;
if (!ObjectUtils.isEmpty(valueObj)) {
if (valueObj instanceof List) {
defaultValue = "";
} else {
defaultValue = valueObj.toString();
}
}
String componentType = componentType(component);
String labelFormat = labelFormat(component);
if (isDynamic) {
List<Long> dynamicTimes = dynamicDateFromNow(component);
if (CollectionUtils.isNotEmpty(dynamicTimes)) {
int size = dynamicTimes.size();
if (size > 1) {
String start = timeSection(String.valueOf(dynamicTimes.get(0)), multiple ? "datetime" : componentType, labelFormat).get(0);
String end = timeSection(String.valueOf(dynamicTimes.get(1)), multiple ? "datetime" : componentType, labelFormat).get(1);
realValues = add2List(start, end);
} else {
realValues = timeSection(String.valueOf(dynamicTimes.get(0)), componentType, labelFormat);
}
}
} else {
if (StringUtils.isBlank(defaultValue)) {
realValues = new ArrayList<>();
} else {
if (multiple) {
List<String> realVals = Arrays.asList(defaultValue.split(","));
String start = realVals.get(0);
String end = realVals.get(1);
start = timeSection(start, "datetime", labelFormat).get(0);
end = timeSection(end, "datetime", labelFormat).get(1);
realValues = add2List(start, end);
} else {
realValues = Arrays.asList(defaultValue.split(",")).stream().limit(1).collect(Collectors.toList());
realValues = timeSection(realValues.get(0), componentType, labelFormat);
}
}
}
result.setValue(realValues);
return result;
}
public List<String> timeSection(String sourceTimeStr, String type, String labelFormat) {
if (StringUtils.isBlank(sourceTimeStr)) return null;
Long sourceTime = Long.parseLong(sourceTimeStr);
List<String> result = new ArrayList<>();
List<String> formatArr = new ArrayList<>();
if (StringUtils.isNotBlank(labelFormat)) {
formatArr = Arrays.stream(labelFormat.split(" ")).collect(Collectors.toList());
}
Integer[] fieldNames = {Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND};
Calendar instance = Calendar.getInstance();
instance.setTimeInMillis(sourceTime);
int methodsLen = fieldNames.length;
int childArrLength = 0;
if (StringUtils.equals("datetime", type) && formatArr.size() > 1) {
List<String> childArr = new ArrayList<>();
if (StringUtils.isNotBlank(formatArr.get(1))) {
childArr = Arrays.stream(formatArr.get(1).split(":")).collect(Collectors.toList());
}
childArrLength = childArr.size();
while (--methodsLen >= childArrLength) {
executeSetFieldValue(instance, fieldNames[methodsLen], 0);
}
} else {
for (int i = 0; i < methodsLen; i++) {
executeSetFieldValue(instance, fieldNames[i], 0);
}
}
Calendar endInstance = Calendar.getInstance();
endInstance.setTimeInMillis(instance.getTimeInMillis());
if (StringUtils.equals("year", type)) {
instance.set(Calendar.MONTH, 0);
instance.set(Calendar.DATE, 1);
endInstance.setTimeInMillis(instance.getTimeInMillis());
endInstance.set(Calendar.YEAR, endInstance.get(Calendar.YEAR) + 1);
endInstance.add(Calendar.SECOND, -1);
endInstance.roll(Calendar.MILLISECOND, -1);
}
if (StringUtils.equals("month", type)) {
instance.set(Calendar.DATE, 1);
endInstance.setTimeInMillis(instance.getTimeInMillis());
endInstance.set(Calendar.MONTH, endInstance.get(Calendar.MONTH) + 1);
endInstance.add(Calendar.SECOND, -1);
endInstance.roll(Calendar.MILLISECOND, -1);
}
if (StringUtils.equals("date", type)) {
endInstance.set(Calendar.DATE, endInstance.get(Calendar.DATE) + 1);
endInstance.add(Calendar.SECOND, -1);
endInstance.roll(Calendar.MILLISECOND, -1);
}
if (StringUtils.equals("datetime", type)) {
if (childArrLength == 0) {
endInstance.set(Calendar.DATE, endInstance.get(Calendar.DATE) + 1);
} else {
Integer fieldNameFlag = fieldNames[childArrLength - 1];
endInstance.set(fieldNameFlag, endInstance.get(fieldNameFlag) + 1);
}
endInstance.add(Calendar.SECOND, -1);
endInstance.roll(Calendar.MILLISECOND, -1);
}
result.add(String.valueOf(instance.getTimeInMillis()));
result.add(String.valueOf(endInstance.getTimeInMillis()));
return result;
}
private void executeSetFieldValue(Calendar instance, Integer fieldFlag, Object value) {
try {
Method setMethod = instance.getClass().getMethod("set", int.class, int.class);
setMethod.invoke(instance, fieldFlag, value);
} catch (Exception e) {
DEException.throwException(e);
LogUtil.error(e.getMessage(), e);
}
}
public Boolean isTimeWidget(String serviceName) {
if (StringUtils.isBlank(serviceName)) return false;
String[] timeWidgets = {"timeDateWidget", "timeDateRangeWidget"};
return Arrays.stream(timeWidgets).anyMatch(widget -> StringUtils.equals(widget, serviceName));
}
public Boolean showTime(Map<String, Object> component) {
Map attrs = (Map) ((Map) component.get("options")).get("attrs");
if (ObjectUtils.isNotEmpty(attrs.get("showTime"))) {
return (boolean) attrs.get("showTime");
}
return false;
}
public String componentType(Map<String, Object> component) {
Map attrs = (Map) ((Map) component.get("options")).get("attrs");
String result = ObjectUtils.isEmpty(attrs.get("type")) ? "date" : attrs.get("type").toString();
String serviceName = component.get("serviceName").toString();
if (isTimeWidget(serviceName) && showTime(component)) {
result = StringUtils.equals("timeDateWidget", serviceName) ? "datetime" : "datetimerange";
}
return result;
}
public String labelFormat(Map<String, Object> component) {
String result = "yyyy-MM-dd";
Map attrs = (Map) ((Map) component.get("options")).get("attrs");
String serviceName = component.get("serviceName").toString();
if (isTimeWidget(serviceName) && showTime(component) && ObjectUtils.isNotEmpty(attrs.get("accuracy"))) {
return result + " " + attrs.get("accuracy");
}
return result;
}
public List add2List(Object... elements) {
return Arrays.stream(elements).collect(Collectors.toList());
}
public abstract List<Long> dynamicDateFromNow(Map<String, Object> component);
}

View File

@ -1,73 +0,0 @@
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;
}
}

View File

@ -0,0 +1,79 @@
package io.dataease.service.chart.build.time;
import io.dataease.service.chart.build.TimeBuild;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Service("timeDateWidget")
public class TimeDateBuild extends TimeBuild {
public List<Long> dynamicDateFromNow(Map<String, Object> component) {
Map<String, Object> attrs = buildAttrs(component);
Object defaultObject = attrs.get("default");
Boolean isDynamic = false;
Map<String, Object> defaultMap = null;
if (ObjectUtils.isNotEmpty(defaultObject)) {
defaultMap = (Map<String, Object>) defaultObject;
isDynamic = (Boolean) defaultMap.getOrDefault("isDynamic", false);
}
if (ObjectUtils.isEmpty(defaultObject) || !isDynamic) return null;
Calendar now = Calendar.getInstance();
int nowYear = now.get(Calendar.YEAR);
int nowMonth = now.get(Calendar.MONTH);
int nowDate = now.get(Calendar.DATE);
int dkey = (int) Double.parseDouble(defaultMap.get("dkey").toString());
if (dkey == 0) {
now.set(nowYear, nowMonth, nowDate, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 1) {
now.set(nowYear, nowMonth, nowDate - 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 2) {
now.set(nowYear, nowMonth, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 4) {
now.set(nowYear, 0, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 3) {
int dynamicPrefix = (int) Double.parseDouble(defaultMap.get("dynamicPrefix").toString());
String dynamicInfill = defaultMap.get("dynamicInfill").toString();
String dynamicSuffix = defaultMap.get("dynamicSuffix").toString();
now.set(nowYear, nowMonth, nowDate, 0, 0, 0);
if (StringUtils.equals("day", dynamicInfill)) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1);
now.roll(Calendar.DATE, step);
return add2List(now.getTimeInMillis());
}
if (StringUtils.equals("week", dynamicInfill)) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1) * 7;
now.roll(Calendar.DATE, step);
return add2List(now.getTimeInMillis());
}
if (StringUtils.equals("month", dynamicInfill)) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1);
now.roll(Calendar.MONTH, step);
return add2List(now.getTimeInMillis());
}
if (StringUtils.equals("year", dynamicInfill)) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1);
now.roll(Calendar.YEAR, step);
return add2List(now.getTimeInMillis());
}
}
return null;
}
}

View File

@ -0,0 +1,149 @@
package io.dataease.service.chart.build.time;
import io.dataease.service.chart.build.TimeBuild;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Service("timeDateRangeWidget")
public class TimeDateRangeBuild extends TimeBuild {
@Override
public List<Long> dynamicDateFromNow(Map<String, Object> component) {
Map<String, Object> attrs = buildAttrs(component);
Object defaultObject = null;
if ((defaultObject = attrs.get("default")) == null) return null;
Map<String, Object> defaultMap = (Map<String, Object>) defaultObject;
Boolean isDynamic = (Boolean) defaultMap.getOrDefault("isDynamic", false);
if (!isDynamic) return null;
int dkey = (int) Double.parseDouble(defaultMap.get("dkey").toString());
Calendar now = Calendar.getInstance();
now.set(Calendar.HOUR_OF_DAY, 0);
now.set(Calendar.MINUTE, 0);
now.set(Calendar.SECOND, 0);
now.set(Calendar.MILLISECOND, 0);
if (dkey % 5 == 0) {
if (dkey == 5) {
now.add(Calendar.DATE, -7);
}
now.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
long start = now.getTimeInMillis();
now.add(Calendar.DATE, 7);
now.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
long end = now.getTimeInMillis();
return add2List(start, end);
}
if (dkey == 1) {
Calendar endBase = (Calendar) now.clone();
now.set(Calendar.DAY_OF_MONTH, 1);
long start = now.getTimeInMillis();
endBase.add(Calendar.MONTH, 1);
endBase.set(Calendar.DAY_OF_MONTH, 0);
long end = endBase.getTimeInMillis();
return add2List(start, end);
}
if (dkey == 6) {
Calendar endBase = (Calendar) now.clone();
now.add(Calendar.MONTH, -1);
now.set(Calendar.DAY_OF_MONTH, 1);
long start = now.getTimeInMillis();
endBase.set(Calendar.DAY_OF_MONTH, 0);
long end = endBase.getTimeInMillis();
return add2List(start, end);
}
if (dkey % 5 == 2) {
int step = 0;
if (dkey == 7) {
step = -1;
}
Calendar endBase = (Calendar) now.clone();
Long start = quarterBegin(now, step);
Long end = quarterEnd(endBase, step);
return add2List(start, end);
}
if (dkey == 3) {
now.set(Calendar.MONTH, 0);
now.set(Calendar.DAY_OF_MONTH, 1);
long start = now.getTimeInMillis();
now.add(Calendar.YEAR, 1);
now.add(Calendar.DAY_OF_MONTH, -1);
long end = now.getTimeInMillis();
return add2List(start, end);
}
if (dkey == 8) {
now.add(Calendar.YEAR, -1);
now.set(Calendar.MONTH, 0);
now.set(Calendar.DAY_OF_MONTH, 1);
long start = now.getTimeInMillis();
now.add(Calendar.YEAR, 1);
now.add(Calendar.DAY_OF_MONTH, -1);
long end = now.getTimeInMillis();
return add2List(start, end);
}
if (dkey == 4) {
Object startDynamicObject = defaultMap.get("sDynamicPrefix");
Object endDynamicObject = defaultMap.get("eDynamicPrefix");
if (ObjectUtils.isNotEmpty(startDynamicObject) && ObjectUtils.isNotEmpty(endDynamicObject)) {
String startDynamicInfill = defaultMap.get("sDynamicInfill").toString();
String endDynamicInfill = defaultMap.get("eDynamicInfill").toString();
String startDynamicSuffix = defaultMap.get("sDynamicSuffix").toString();
String endDynamicSuffix = defaultMap.get("eDynamicSuffix").toString();
int startDynamic = (int) Double.parseDouble(startDynamicObject.toString());
int endDynamic = (int) Double.parseDouble(endDynamicObject.toString());
Calendar endBase = (Calendar) now.clone();
Long start = customTime(now, startDynamic, startDynamicInfill, startDynamicSuffix);
Long end = customTime(endBase, endDynamic, endDynamicInfill, endDynamicSuffix);
return add2List(start, end);
}
}
return null;
}
private Long customTime(Calendar now, int dynamicPrefix, String dynamicInfill, String dynamicSuffix) {
if (StringUtils.equals(dynamicInfill, "day")) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1);
now.add(Calendar.DAY_OF_MONTH, step);
}
if (StringUtils.equals(dynamicInfill, "week")) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1) * 7;
now.add(Calendar.DAY_OF_MONTH, step);
}
if (StringUtils.equals(dynamicInfill, "month")) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1);
now.add(Calendar.MONTH, step);
}
if (StringUtils.equals("year", dynamicInfill)) {
int step = dynamicPrefix * (StringUtils.equals("before", dynamicSuffix) ? -1 : 1);
now.add(Calendar.YEAR, step);
}
return now.getTimeInMillis();
}
private Long quarterBegin(Calendar instance, int step) {
int month = instance.get(Calendar.MONTH);
int quarterBegin = (int) Math.floor(month / 3) * 3;
instance.set(Calendar.MONTH, quarterBegin + (3 * step));
instance.set(Calendar.DAY_OF_MONTH, 1);
return instance.getTimeInMillis();
}
private Long quarterEnd(Calendar instance, int step) {
int month = instance.get(Calendar.MONTH);
int quarterBegin = (int) Math.floor(month / 3) * 3;
instance.set(Calendar.MONTH, quarterBegin + (3 * (step + 1)));
instance.set(Calendar.DAY_OF_MONTH, 1);
instance.add(Calendar.DATE, -1);
return instance.getTimeInMillis();
}
}

View File

@ -0,0 +1,55 @@
package io.dataease.service.chart.build.time;
import io.dataease.service.chart.build.TimeBuild;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Service("timeMonthWidget")
public class TimeMonthBuild extends TimeBuild {
@Override
public List<Long> dynamicDateFromNow(Map<String, Object> component) {
Map<String, Object> attrs = buildAttrs(component);
Object defaultObject = attrs.get("default");
if (ObjectUtils.isEmpty(defaultObject)) return null;
Map<String, Object> defaultMap = (Map<String, Object>) defaultObject;
Boolean isDynamic = (Boolean) defaultMap.getOrDefault("isDynamic", false);
if (!isDynamic) return null;
Calendar now = Calendar.getInstance();
int nowYear = now.get(Calendar.YEAR);
int nowMonth = now.get(Calendar.MONTH);
int dkey = (int) Double.parseDouble(defaultMap.get("dkey").toString());
if (dkey == 0) {
now.set(nowYear, nowMonth, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 1) {
now.set(nowYear, nowMonth - 1, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 2) {
now.set(nowYear, 0, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 4) {
now.set(nowYear - 1, nowMonth, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 3) {
int dynamicPrefix = (int) Double.parseDouble(defaultMap.get("dynamicPrefix").toString());
String dynamicSuffix = defaultMap.get("dynamicSuffix").toString();
int targetMonth = StringUtils.equals("before", dynamicSuffix) ? (nowMonth - dynamicPrefix) : (nowMonth + dynamicPrefix);
now.set(nowYear, targetMonth, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
return null;
}
}

View File

@ -0,0 +1,47 @@
package io.dataease.service.chart.build.time;
import io.dataease.service.chart.build.TimeBuild;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Service("timeYearWidget")
public class TimeYearBuild extends TimeBuild {
@Override
public List<Long> dynamicDateFromNow(Map<String, Object> component) {
Boolean isDynamic = false;
Map<String, Object> defaultMap = null;
Map<String, Object> attrs = buildAttrs(component);
Object defaultObject = attrs.get("default");
if (ObjectUtils.isNotEmpty(defaultObject)) {
defaultMap = (Map<String, Object>) defaultObject;
isDynamic = (Boolean) defaultMap.getOrDefault("isDynamic", false);
}
if (ObjectUtils.isEmpty(defaultObject) || !isDynamic) return null;
Calendar now = Calendar.getInstance();
int nowYear = now.get(Calendar.YEAR);
int dkey = (int) Double.parseDouble(defaultMap.get("dkey").toString());
if (dkey == 0) {
now.set(nowYear, 0, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 1) {
now.set(nowYear - 1, 0, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
if (dkey == 2) {
int dynamicPrefix = (int) Double.parseDouble(defaultMap.get("dynamicPrefix").toString());
String dynamicSuffix = defaultMap.get("dynamicSuffix").toString();
now.set(StringUtils.equals("before", dynamicSuffix) ? (nowYear - dynamicPrefix) : (nowYear + dynamicPrefix), 0, 1, 0, 0, 0);
return add2List(now.getTimeInMillis());
}
return null;
}
}

View File

@ -510,7 +510,7 @@ public class DataSetTableService {
DatasourceRequest datasourceRequest = new DatasourceRequest(); DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds); datasourceRequest.setDatasource(ds);
datasourceRequest.setTable(new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable()); datasourceRequest.setTable(new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable());
return datasourceProvider.getTableFileds(datasourceRequest); return datasourceProvider.getTableFields(datasourceRequest);
} }
public Map<String, List<DatasetTableField>> getFieldsFromDE(DataSetTableRequest dataSetTableRequest) public Map<String, List<DatasetTableField>> getFieldsFromDE(DataSetTableRequest dataSetTableRequest)

View File

@ -153,14 +153,13 @@
<div class="dataset"> <div class="dataset">
<span class="name">{{ $t('dataset.name') }}</span> <span class="name">{{ $t('dataset.name') }}</span>
<el-input <el-input
v-if="activeIndex !== -1" v-model="activeTable.datasetName"
v-model="tableData[activeIndex].datasetName"
size="small" size="small"
clearable clearable
@change="validateName" @change="validateName"
/> />
<div <div
v-if="tableData[activeIndex].nameExsit" v-if="activeTable.nameExsit"
style="left: 107px; top: 52px" style="left: 107px; top: 52px"
class="el-form-item__error" class="el-form-item__error"
> >
@ -257,15 +256,13 @@ export default {
avilibelTable: false, avilibelTable: false,
noAvilibelTableImg: require('@/assets/None.png'), noAvilibelTableImg: require('@/assets/None.png'),
noSelectTable: require('@/assets/None_Select_ds.png'), noSelectTable: require('@/assets/None_Select_ds.png'),
activeTable: {},
activeName: '' activeName: ''
} }
}, },
computed: { computed: {
activeIndex() {
return this.tableData.findIndex((ele) => ele.name === this.activeName)
},
checkDatasetName() { checkDatasetName() {
return this.tableData return this.tables
.filter((ele, index) => { .filter((ele, index) => {
return this.checkTableList.includes(ele.name) return this.checkTableList.includes(ele.name)
}) })
@ -285,11 +282,11 @@ export default {
const dsName = this.options.find((ele) => ele.id === val).name const dsName = this.options.find((ele) => ele.id === val).name
post('/datasource/getTables/' + val, {}).then((response) => { post('/datasource/getTables/' + val, {}).then((response) => {
this.tables = response.data this.tables = response.data
this.tableData = JSON.parse(JSON.stringify(this.tables)) this.tables.forEach((ele) => {
this.tableData.forEach((ele) => {
this.$set(ele, 'datasetName', dsName + '_' + ele.name) this.$set(ele, 'datasetName', dsName + '_' + ele.name)
this.$set(ele, 'nameExsit', false) this.$set(ele, 'nameExsit', false)
}) })
this.tableData = [...this.tables]
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck) this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
}).finally(() => { }).finally(() => {
this.dsLoading = false this.dsLoading = false
@ -302,18 +299,15 @@ export default {
} }
}, },
searchTable(val) { searchTable(val) {
this.activeName = ''
if (val && val !== '') { if (val && val !== '') {
this.tableData = JSON.parse( this.tableData = [...this.tables.filter((ele) => {
JSON.stringify( return ele.name
this.tables.filter((ele) => { .toLocaleLowerCase()
return ele.name .includes(val.toLocaleLowerCase())
.toLocaleLowerCase() })]
.includes(val.toLocaleLowerCase())
})
)
)
} else { } else {
this.tableData = JSON.parse(JSON.stringify(this.tables)) this.tableData = [...this.tables]
} }
} }
}, },
@ -355,17 +349,17 @@ export default {
} }
this.LeftWidth = e.pageX this.LeftWidth = e.pageX
}, },
nameExsitValidator(activeIndex) { nameExsitValidator(ele) {
this.tableData[activeIndex].nameExsit = ele.nameExsit =
this.nameList this.nameList
.concat(this.checkDatasetName) .concat(this.checkDatasetName)
.filter((name) => name === this.tableData[activeIndex].datasetName) .filter((name) => name === ele.datasetName)
.length > 1 .length > 1
}, },
validateName() { validateName() {
this.tableData.forEach((ele, index) => { this.tables.forEach((ele, index) => {
if (this.checkDatasetName.includes(ele.datasetName)) { if (this.checkTableList.includes(ele.name)) {
this.nameExsitValidator(index) this.nameExsitValidator(ele)
} else { } else {
ele.nameExsit = false ele.nameExsit = false
} }
@ -381,6 +375,7 @@ export default {
setActiveName({ name, datasourceId, enableCheck }) { setActiveName({ name, datasourceId, enableCheck }) {
if (!enableCheck) return if (!enableCheck) return
this.activeName = name this.activeName = name
this.activeTable = this.tableData.find((ele) => ele.name === this.activeName) || {}
this.dbPreview({ this.dbPreview({
dataSourceId: datasourceId, dataSourceId: datasourceId,
info: JSON.stringify({ table: name }) info: JSON.stringify({ table: name })
@ -428,7 +423,7 @@ export default {
const mode = this.mode const mode = this.mode
const syncType = this.syncType const syncType = this.syncType
this.checkTableList.forEach((name) => { this.checkTableList.forEach((name) => {
const datasetName = this.tableData.find( const datasetName = this.tables.find(
(ele) => ele.name === name (ele) => ele.name === name
).datasetName ).datasetName
tables.push({ tables.push({
@ -449,13 +444,6 @@ export default {
.finally(() => { .finally(() => {
this.loading = false this.loading = false
}) })
},
dataReset() {
this.searchTable = ''
this.options = []
this.dataSource = ''
this.tables = []
this.checkTableList = []
} }
} }
} }

View File

@ -160,14 +160,13 @@
<div class="dataset"> <div class="dataset">
<span class="name">{{ $t('dataset.name') }}</span> <span class="name">{{ $t('dataset.name') }}</span>
<el-input <el-input
v-if="activeIndex !== -1" v-model="activeTable.datasetName"
v-model="tableData[activeIndex].datasetName"
size="small" size="small"
clearable clearable
@change="validateName" @change="validateName"
/> />
<div <div
v-if="tableData[activeIndex].nameExsit" v-if="activeTable.nameExsit"
style="left: 107px; top: 52px" style="left: 107px; top: 52px"
class="el-form-item__error" class="el-form-item__error"
> >
@ -263,15 +262,13 @@ export default {
avilibelTable: false, avilibelTable: false,
noAvilibelTableImg: require('@/assets/None.png'), noAvilibelTableImg: require('@/assets/None.png'),
noSelectTable: require('@/assets/None_Select_ds.png'), noSelectTable: require('@/assets/None_Select_ds.png'),
activeTable: {},
activeName: '' activeName: ''
} }
}, },
computed: { computed: {
activeIndex() {
return this.tableData.findIndex((ele) => ele.name === this.activeName)
},
checkDatasetName() { checkDatasetName() {
return this.tableData return this.tables
.filter((ele, index) => { .filter((ele, index) => {
return this.checkTableList.includes(ele.name) return this.checkTableList.includes(ele.name)
}) })
@ -288,14 +285,15 @@ export default {
this.dsLoading = true this.dsLoading = true
this.checkTableList = [] this.checkTableList = []
this.activeName = '' this.activeName = ''
this.activeTable = {}
const dsName = this.options.find((ele) => ele.id === val).name const dsName = this.options.find((ele) => ele.id === val).name
post('/datasource/getTables/' + val, {}).then((response) => { post('/datasource/getTables/' + val, {}).then((response) => {
this.tables = response.data this.tables = response.data
this.tableData = JSON.parse(JSON.stringify(this.tables)) this.tables.forEach((ele) => {
this.tableData.forEach((ele) => {
this.$set(ele, 'datasetName', dsName + '_' + ele.name) this.$set(ele, 'datasetName', dsName + '_' + ele.name)
this.$set(ele, 'nameExsit', false) this.$set(ele, 'nameExsit', false)
}) })
this.tableData = [...this.tables]
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck) this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
}).finally(() => { }).finally(() => {
this.dsLoading = false this.dsLoading = false
@ -318,18 +316,15 @@ export default {
} }
}, },
searchTable(val) { searchTable(val) {
this.activeName = ''
if (val && val !== '') { if (val && val !== '') {
this.tableData = JSON.parse( this.tableData = [...this.tables.filter((ele) => {
JSON.stringify( return ele.name
this.tables.filter((ele) => { .toLocaleLowerCase()
return ele.name .includes(val.toLocaleLowerCase())
.toLocaleLowerCase() })]
.includes(val.toLocaleLowerCase())
})
)
)
} else { } else {
this.tableData = JSON.parse(JSON.stringify(this.tables)) this.tableData = [...this.tables]
} }
} }
}, },
@ -371,17 +366,17 @@ export default {
} }
this.LeftWidth = e.pageX this.LeftWidth = e.pageX
}, },
nameExsitValidator(activeIndex) { nameExsitValidator(ele) {
this.tableData[activeIndex].nameExsit = ele.nameExsit =
this.nameList this.nameList
.concat(this.checkDatasetName) .concat(this.checkDatasetName)
.filter((name) => name === this.tableData[activeIndex].datasetName) .filter((name) => name === ele.datasetName)
.length > 1 .length > 1
}, },
validateName() { validateName() {
this.tableData.forEach((ele, index) => { this.tables.forEach((ele, index) => {
if (this.checkDatasetName.includes(ele.datasetName)) { if (this.checkTableList.includes(ele.name)) {
this.nameExsitValidator(index) this.nameExsitValidator(ele)
} else { } else {
ele.nameExsit = false ele.nameExsit = false
} }
@ -410,6 +405,7 @@ export default {
setActiveName({ name, datasourceId, enableCheck }) { setActiveName({ name, datasourceId, enableCheck }) {
if (!enableCheck) return if (!enableCheck) return
this.activeName = name this.activeName = name
this.activeTable = this.tableData.find((ele) => ele.name === this.activeName) || {}
this.dbPreview({ this.dbPreview({
dataSourceId: datasourceId, dataSourceId: datasourceId,
info: JSON.stringify({ table: name }) info: JSON.stringify({ table: name })
@ -444,7 +440,7 @@ export default {
const mode = this.mode const mode = this.mode
const syncType = this.syncType const syncType = this.syncType
this.checkTableList.forEach((name) => { this.checkTableList.forEach((name) => {
const datasetName = this.tableData.find( const datasetName = this.tables.find(
(ele) => ele.name === name (ele) => ele.name === name
).datasetName ).datasetName
tables.push({ tables.push({
@ -465,13 +461,6 @@ export default {
.finally(() => { .finally(() => {
this.loading = false this.loading = false
}) })
},
dataReset() {
this.searchTable = ''
this.options = []
this.dataSource = ''
this.tables = []
this.checkTableList = []
} }
} }
} }

View File

@ -479,7 +479,7 @@ export default {
errMsgCont: '', errMsgCont: '',
options: [], options: [],
sql: '', sql: '',
dataReference: false, dataReference: true,
sqlOption: { sqlOption: {
tabSize: 2, tabSize: 2,
styleActiveLine: true, styleActiveLine: true,

View File

@ -551,7 +551,9 @@
<el-input <el-input
v-if="scope.row.deType === 1" v-if="scope.row.deType === 1"
v-model="scope.row.dateFormat" v-model="scope.row.dateFormat"
size="mini" :placeholder="$t('dataset.date_format')"
size="small"
class="input-type"
:disabled="!hasDataPermission('manage', param.privileges)" :disabled="!hasDataPermission('manage', param.privileges)"
@blur="saveEdit(scope.row)" @blur="saveEdit(scope.row)"
@keyup.enter.native="saveEdit(scope.row)" @keyup.enter.native="saveEdit(scope.row)"

View File

@ -1,6 +1,6 @@
<template> <template>
<el-col style="padding: 0 5px 0 5px;"> <el-col style="padding: 0 5px 0 5px;">
<el-row> <el-row class="de-tree">
<span class="header-title">{{ $t('panel.share_in') }}</span> <span class="header-title">{{ $t('panel.share_in') }}</span>
<div <div
class="block" class="block"
@ -40,7 +40,7 @@
</div> </div>
</el-row> </el-row>
<el-row> <el-row class="de-tree">
<span class="header-title">{{ $t('panel.share_out') }}</span> <span class="header-title">{{ $t('panel.share_out') }}</span>
<div <div
class="block" class="block"

View File

@ -8,7 +8,7 @@
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
@execute-axios="executeAxios" @execute-axios="executeAxios"
@on-add-languanges="addLanguages" @on-add-languages="addLanguages"
@plugin-call-back="pluginCallBack" @plugin-call-back="pluginCallBack"
/> />
<div v-else> <div v-else>

View File

@ -9,7 +9,7 @@
v-if="showAsync" v-if="showAsync"
:url="url" :url="url"
@execute-axios="executeAxios" @execute-axios="executeAxios"
@on-add-languanges="addLanguages" @on-add-languages="addLanguages"
@on-plugin-layout="setLayoutInfo" @on-plugin-layout="setLayoutInfo"
@plugin-call-back="pluginCallBack" @plugin-call-back="pluginCallBack"
/> />
@ -22,7 +22,7 @@
v-if="showAsync" v-if="showAsync"
:url="url" :url="url"
@execute-axios="executeAxios" @execute-axios="executeAxios"
@on-add-languanges="addLanguages" @on-add-languages="addLanguages"
@on-plugin-layout="setLayoutInfo" @on-plugin-layout="setLayoutInfo"
@plugin-call-back="pluginCallBack" @plugin-call-back="pluginCallBack"
/> />
@ -35,7 +35,7 @@
v-if="showAsync" v-if="showAsync"
:url="url" :url="url"
@execute-axios="executeAxios" @execute-axios="executeAxios"
@on-add-languanges="addLanguages" @on-add-languages="addLanguages"
@on-plugin-layout="setLayoutInfo" @on-plugin-layout="setLayoutInfo"
@plugin-call-back="pluginCallBack" @plugin-call-back="pluginCallBack"
/> />

View File

@ -241,7 +241,6 @@ export default {
originLoginType: null originLoginType: null
} }
}, },
computed: {},
beforeCreate() { beforeCreate() {
ldapStatus().then((res) => { ldapStatus().then((res) => {
if (res.success && res.data) { if (res.success && res.data) {
@ -392,7 +391,7 @@ export default {
updateInfo(param).then((response) => { updateInfo(param).then((response) => {
const flag = response.success const flag = response.success
if (flag) { if (flag) {
if (response.data && response.data.needLogout) { if (response.data?.needLogout) {
const casEnable = response.data.casEnable const casEnable = response.data.casEnable
bus.$emit('sys-logout', { casEnable }) bus.$emit('sys-logout', { casEnable })
return return

View File

@ -132,6 +132,7 @@ import { emailInfo, updateInfo, validate } from '@/api/system/email'
import operater from './Operater' import operater from './Operater'
import msgCfm from '@/components/msgCfm' import msgCfm from '@/components/msgCfm'
import dePwd from '@/components/deCustomCm/dePwd.vue' import dePwd from '@/components/deCustomCm/dePwd.vue'
const list = ['host', 'port', 'account', 'password', 'ssl', 'tls', '', 'recipient']
export default { export default {
name: 'EmailSetting', name: 'EmailSetting',
components: { components: {
@ -192,28 +193,18 @@ export default {
}) })
}, },
change() { change() {
if ( const result = !this.formInline.host ||
!this.formInline.host ||
!this.formInline.port || !this.formInline.port ||
!this.formInline.account !this.formInline.account
) { this.disabledConnection = result
this.disabledConnection = true this.disabledSave = result
this.disabledSave = true
} else {
this.disabledConnection = false
this.disabledSave = false
}
}, },
testConnection(formInline) { testConnection(formInline) {
const param = { const param = list.reduce((pre, next) => {
'smtp.host': this.formInline.host, if (!next) return pre
'smtp.port': this.formInline.port, pre[`smtp.${next}`] = this.formInline[next]
'smtp.account': this.formInline.account, return pre
'smtp.password': this.formInline.password, }, {})
'smtp.ssl': this.formInline.ssl,
'smtp.tls': this.formInline.tls,
'smtp.recipient': this.formInline.recipient
}
this.$refs[formInline].validate((valid) => { this.$refs[formInline].validate((valid) => {
if (valid) { if (valid) {
validate(param).then((response) => { validate(param).then((response) => {
@ -235,50 +226,16 @@ export default {
this.showCancel = false this.showCancel = false
this.showSave = false this.showSave = false
this.show = true this.show = true
const param = [ const param = list.reduce((pre, next, index) => {
{ if (!next) return pre
paramKey: 'smtp.host', pre.push({
paramValue: this.formInline.host, paramKey: `smtp.${next}`,
paramValue: this.formInline[next],
type: 'text', type: 'text',
sort: 1 sort: index + 1
}, })
{ return pre
paramKey: 'smtp.port', }, [])
paramValue: this.formInline.port,
type: 'text',
sort: 2
},
{
paramKey: 'smtp.account',
paramValue: this.formInline.account,
type: 'text',
sort: 3
},
{
paramKey: 'smtp.password',
paramValue: this.formInline.password,
type: 'password',
sort: 4
},
{
paramKey: 'smtp.ssl',
paramValue: this.formInline.ssl,
type: 'text',
sort: 5
},
{
paramKey: 'smtp.tls',
paramValue: this.formInline.tls,
type: 'text',
sort: 6
},
{
paramKey: 'smtp.recipient',
paramValue: this.formInline.recipient,
type: 'text',
sort: 8
}
]
this.$refs[formInline].validate((valid) => { this.$refs[formInline].validate((valid) => {
if (valid) { if (valid) {

View File

@ -47,17 +47,17 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
class="text-btn" class="de-text-btn"
type="text" type="text"
@click="create(scope.row)" @click="create(scope.row)"
>{{ $t("commons.edit") }}</el-button> >{{ $t("commons.edit") }}</el-button>
<el-button <el-button
class="text-btn" class="de-text-btn"
type="text" type="text"
@click="validateById(scope.row)" @click="validateById(scope.row)"
>{{ $t("commons.validate") }}</el-button> >{{ $t("commons.validate") }}</el-button>
<el-button <el-button
class="text-btn" class="de-text-btn"
type="text" type="text"
@click="del(scope.row)" @click="del(scope.row)"
>{{ >{{
@ -341,22 +341,6 @@ export default {
.table-box { .table-box {
height: calc(100% - 52px); height: calc(100% - 52px);
margin-top: 16px; margin-top: 16px;
.text-btn {
font-family: PingFang SC;
font-size: 14px;
font-weight: 400;
line-height: 22px;
letter-spacing: 0px;
text-align: center;
margin-left: 2px;
border: none;
padding: 2px 4px;
}
.text-btn:hover {
background: rgba(51, 112, 255, 0.1);
}
} }
} }
</style> </style>

View File

@ -118,12 +118,8 @@ export default {
}, },
nodeClick(data, node) { nodeClick(data, node) {
let parent = null const arr = node.parent?.data
if (node.parent.data instanceof Array) { const parent = Array.isArray(arr) ? arr[0] : arr
parent = node.parent.data[0]
} else {
parent = node.parent.data
}
const nodeInfo = { const nodeInfo = {
code: data.code, code: data.code,
name: data.name, name: data.name,
@ -132,24 +128,20 @@ export default {
} }
this.$emit('show-node-info', this.setStatus(nodeInfo, 'read-only')) this.$emit('show-node-info', this.setStatus(nodeInfo, 'read-only'))
}, },
addHandler(data, node) { addHandler({ code: pCode }, { level: pLevel }) {
let form = { let form = {
pLevel: node.level, pLevel,
pCode: data.code pCode
} }
if (node.level > 4) { if (pLevel > 4) {
this.$error('不支持4级行政级别') this.$error('不支持4级行政级别')
form = {} form = {}
} }
this.$emit('emit-add', this.setStatus(form, 'add')) this.$emit('emit-add', this.setStatus(form, 'add'))
}, },
removeHandler(data, node) { removeHandler(data, node) {
let parent = null const arr = node.parent?.data
if (node.parent.data instanceof Array) { const parent = Array.isArray(arr) ? arr[0] : arr
parent = node.parent.data[0]
} else {
parent = node.parent.data
}
const param = { const param = {
code: data.code, code: data.code,
pcode: parent.code, pcode: parent.code,
@ -185,10 +177,10 @@ export default {
this.$refs.tree.setCurrentKey(code) this.$refs.tree.setCurrentKey(code)
}, },
isChina(code) { isChina(code) {
return code && code.startsWith('156') return code?.startsWith('156')
}, },
isGlobal(code) { isGlobal(code) {
return code && code.startsWith('000') return code?.startsWith('000')
} }
} }
} }

View File

@ -2,7 +2,7 @@
<div> <div>
<!--基础配置表单--> <!--基础配置表单-->
<el-form <el-form
v-if="status !== 'empty' && status !== 'read-only'" v-if="!status.includes['read-only', 'empty']"
ref="formInline" ref="formInline"
v-loading="loading" v-loading="loading"
:model="formInline" :model="formInline"
@ -10,11 +10,6 @@
class="demo-form-inline" class="demo-form-inline"
size="small" size="small"
> >
<el-input
v-show="false"
v-model="formInline.pLevel"
/>
<el-row> <el-row>
<el-row> <el-row>
<el-col> <el-col>
@ -26,7 +21,7 @@
v-if="treeShow" v-if="treeShow"
ref="deSelectTree" ref="deSelectTree"
v-model="formInline.pCode" v-model="formInline.pCode"
:popper-append-to-body="true" popper-append-to-body
popover-class="map-class-wrap" popover-class="map-class-wrap"
:data="treeDatas" :data="treeDatas"
:select-params="selectParams" :select-params="selectParams"
@ -107,7 +102,7 @@
</el-button> </el-button>
<el-input <el-input
v-model="formInline.fileName" v-model="formInline.fileName"
:disabled="true" disabled
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -318,13 +313,13 @@ export default {
}, },
loadForm(form) { loadForm(form) {
if (form && form.code) { if (form?.code) {
this.nodeInfo = JSON.parse(JSON.stringify(form)) this.nodeInfo = JSON.parse(JSON.stringify(form))
this.setGeoJson() this.setGeoJson()
} }
}, },
setGeoJson() { setGeoJson() {
if (!this.nodeInfo || !this.nodeInfo.code) { if (!this.nodeInfo?.code) {
this.json = JSON.parse(JSON.stringify(this.noGsoJson)) this.json = JSON.parse(JSON.stringify(this.noGsoJson))
return return
} }
@ -348,9 +343,6 @@ export default {
if (!value) return true if (!value) return true
return data.id.toString().indexOf(value.toString()) !== -1 return data.id.toString().indexOf(value.toString()) !== -1
}, },
//
_nodeClickFun(data, node, vm) {
},
// //
_searchFun(value) { _searchFun(value) {
this.$refs.deSelectTree.filterFun(value) this.$refs.deSelectTree.filterFun(value)

View File

@ -51,28 +51,27 @@ export default {
methods: { methods: {
emitAdd(form) { emitAdd(form) {
this.setStatus(form.status) this.setStatus(form.status)
this.$refs && this.$refs['map_setting_form'] && this.$refs['map_setting_form'].emitAdd(form) this.$refs['map_setting_form']?.emitAdd(form)
}, },
loadForm(nodeInfo) { loadForm(nodeInfo) {
this.setStatus(nodeInfo.status) this.setStatus(nodeInfo.status)
this.$refs && this.$refs['map_setting_form'] && this.$refs['map_setting_form'].loadForm(nodeInfo) this.$refs['map_setting_form']?.loadForm(nodeInfo)
}, },
setStatus(status) { setStatus(status) {
this.formStatus = status this.formStatus = status
}, },
loadTreeData() { loadTreeData() {
Object.keys(this.treeDatas).length === 0 && areaMapping().then(res => { !Object.keys(this.treeDatas).length && areaMapping().then(res => {
this.treeDatas = res.data this.treeDatas = res.data
}) })
}, },
refreshTree(node) { refreshTree(node) {
areaMapping().then(res => { areaMapping().then(res => {
this.treeDatas = res.data this.treeDatas = res.data
if (node && node.code) { if (!node?.code) return
this.$refs && this.$refs['map_setting_tree'] && this.$refs['map_setting_tree'].showNewNode(node.code) this.$refs['map_setting_tree']?.showNewNode(node.code)
}
}) })
} }
} }

View File

@ -20,7 +20,6 @@
<el-select <el-select
v-model="form.type" v-model="form.type"
:placeholder="$t('datasource.please_choose_type')" :placeholder="$t('datasource.please_choose_type')"
filterable filterable
@change="changeType()" @change="changeType()"
> >
@ -160,14 +159,10 @@ export default {
port: '', port: '',
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull' extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull'
}, },
input: '',
visible: true,
showEdit: true, showEdit: true,
showSave: false, showSave: false,
showCancel: false, showCancel: false,
show: true, show: true,
disabledConnection: false,
disabledSave: false,
loading: false, loading: false,
rules: { rules: {
'configuration.host': [ 'configuration.host': [
@ -202,7 +197,6 @@ export default {
] ]
} }
}, },
created() { created() {
this.query() this.query()
}, },

View File

@ -8,40 +8,40 @@
class="de-tabs" class="de-tabs"
> >
<el-tab-pane <el-tab-pane
:lazy="true" lazy
:label="$t('system_parameter_setting.basic_setting')" :label="$t('system_parameter_setting.basic_setting')"
name="zero" name="zero"
/> />
<el-tab-pane <el-tab-pane
:lazy="true" lazy
:label="$t('system_parameter_setting.mailbox_service_settings')" :label="$t('system_parameter_setting.mailbox_service_settings')"
name="first" name="first"
/> />
<el-tab-pane <el-tab-pane
:lazy="true" lazy
:label="$t('sysParams.map')" :label="$t('sysParams.map')"
name="ten" name="ten"
/> />
<el-tab-pane <el-tab-pane
v-if="engineMode === 'simple'" v-if="engineMode === 'simple'"
:lazy="true" lazy
:label="$t('system_parameter_setting.engine_mode_setting')" :label="$t('system_parameter_setting.engine_mode_setting')"
name="six" name="six"
/> />
<el-tab-pane <el-tab-pane
v-if="engineMode === 'cluster'" v-if="engineMode === 'cluster'"
:lazy="true" lazy
:label="$t('system_parameter_setting.engine_mode_setting')" :label="$t('system_parameter_setting.engine_mode_setting')"
name="seven" name="seven"
/> />
<el-tab-pane <el-tab-pane
v-if="engineMode === 'cluster'" v-if="engineMode === 'cluster'"
:lazy="true" lazy
:label="$t('system_parameter_setting.kettle_setting')" :label="$t('system_parameter_setting.kettle_setting')"
name="eight" name="eight"
/> />
@ -95,8 +95,6 @@ export default {
engineMode: 'local' engineMode: 'local'
} }
}, },
computed: {
},
beforeCreate() { beforeCreate() {
pluginLoaded().then((res) => { pluginLoaded().then((res) => {
this.isPluginLoaded = res.success && res.data this.isPluginLoaded = res.success && res.data
@ -104,10 +102,6 @@ export default {
engineMode().then((res) => { engineMode().then((res) => {
this.engineMode = res.data this.engineMode = res.data
}) })
},
methods: {
handlerBtn(btn) {
}
} }
} }
</script> </script>

View File

@ -333,36 +333,7 @@
</template> </template>
<script> <script>
const columnOptions = [ import { columnOptions } from './options'
{
label: 'dataset.task_name',
props: 'name'
},
{
label: 'dataset.task.dataset',
props: 'datasetName'
},
{
label: 'dataset.execute_rate',
props: 'rate'
},
{
label: 'dataset.task.last_exec_time',
props: 'lastExecTime'
},
{
label: 'dataset.task.last_exec_status',
props: 'lastExecStatus'
},
{
label: 'dataset.task.next_exec_time',
props: 'nextExecTime'
},
{
label: 'dataset.task.task_status',
props: 'status'
}
]
import { formatOrders } from '@/utils/index' import { formatOrders } from '@/utils/index'
import { datasetTaskList, post } from '@/api/dataset/dataset' import { datasetTaskList, post } from '@/api/dataset/dataset'
import { hasDataPermission } from '@/utils/permission' import { hasDataPermission } from '@/utils/permission'

View File

@ -502,9 +502,10 @@ export default {
}, },
insertParamToCodeMirror(param) { insertParamToCodeMirror(param) {
const pos1 = this.$refs.myCm.codemirror.getCursor() const pos1 = this.$refs.myCm.codemirror.getCursor()
const pos2 = {} const pos2 = {
pos2.line = pos1.line line: pos1.line,
pos2.ch = pos1.ch ch: pos1.ch
}
this.$refs.myCm.codemirror.replaceRange(param, pos2) this.$refs.myCm.codemirror.replaceRange(param, pos2)
}, },
saveTask(task) { saveTask(task) {
@ -542,14 +543,14 @@ export default {
this.incrementalConfig = response.data this.incrementalConfig = response.data
if ( if (
this.incrementalConfig.incrementalAdd.length === 0 && !this.incrementalConfig.incrementalAdd.length &&
this.incrementalConfig.incrementalDelete.length === 0 !this.incrementalConfig.incrementalDelete.length
) { ) {
this.incrementalUpdateType = 'incrementalAdd' this.incrementalUpdateType = 'incrementalAdd'
this.sql = '' this.sql = ''
return return
} }
if (this.incrementalConfig.incrementalAdd.length > 0) { if (this.incrementalConfig.incrementalAdd.length) {
this.incrementalUpdateType = 'incrementalAdd' this.incrementalUpdateType = 'incrementalAdd'
this.sql = this.incrementalConfig.incrementalAdd this.sql = this.incrementalConfig.incrementalAdd
} else { } else {
@ -561,29 +562,13 @@ export default {
}, },
incrementalUpdateTypeChange: function() { incrementalUpdateTypeChange: function() {
if (this.incrementalUpdateType === 'incrementalAdd') { if (this.incrementalUpdateType === 'incrementalAdd') {
if (this.sql) { this.incrementalConfig.incrementalDelete = this.sql || ''
this.incrementalConfig.incrementalDelete = this.sql this.sql = this.incrementalConfig.incrementalAdd || ''
} else {
this.incrementalConfig.incrementalDelete = ''
}
if (this.incrementalConfig.incrementalAdd) {
this.sql = this.incrementalConfig.incrementalAdd
} else {
this.sql = ''
}
} }
if (this.incrementalUpdateType === 'incrementalDelete') { if (this.incrementalUpdateType === 'incrementalDelete') {
if (this.sql) { this.incrementalConfig.incrementalAdd = this.sql || ''
this.incrementalConfig.incrementalAdd = this.sql this.sql = this.incrementalConfig.incrementalDelete || ''
} else {
this.incrementalConfig.incrementalAdd = ''
}
if (this.incrementalConfig.incrementalDelete) {
this.sql = this.incrementalConfig.incrementalDelete
} else {
this.sql = ''
}
} }
} }
} }

View File

@ -5,16 +5,8 @@
<script> <script>
export default ({ export default ({
data() {
return {
}
},
created() { created() {
this.$store.dispatch('app/toggleSideBarHide', false) this.$store.dispatch('app/toggleSideBarHide', false)
},
method: {
} }
}) })
</script> </script>

View File

@ -14,6 +14,38 @@ const filterDatasetRecord = {
value: 'Error' value: 'Error'
}] }]
} }
const columnOptions = [
{
label: 'dataset.task_name',
props: 'name'
},
{
label: 'dataset.task.dataset',
props: 'datasetName'
},
{
label: 'dataset.execute_rate',
props: 'rate'
},
{
label: 'dataset.task.last_exec_time',
props: 'lastExecTime'
},
{
label: 'dataset.task.last_exec_status',
props: 'lastExecStatus'
},
{
label: 'dataset.task.next_exec_time',
props: 'nextExecTime'
},
{
label: 'dataset.task.task_status',
props: 'status'
}
]
const filterDataset = [{ const filterDataset = [{
name: 'dataset.execute_rate', name: 'dataset.execute_rate',
type: 'dataset_table_task.rate', type: 'dataset_table_task.rate',
@ -75,5 +107,6 @@ function dateFormat(fmt, date) {
export { export {
filterDataset, filterDataset,
dateFormat, dateFormat,
filterDatasetRecord filterDatasetRecord,
columnOptions
} }

View File

@ -289,7 +289,6 @@ export default {
const results = res.data.map(node => { const results = res.data.map(node => {
if (node.hasChildren && !node.children) { if (node.hasChildren && !node.children) {
node.children = null node.children = null
// delete node.children
} }
return node return node
}) })

View File

@ -100,6 +100,9 @@ module.exports = {
sass: { sass: {
prependData: `@import "@/style/index.scss"` prependData: `@import "@/style/index.scss"`
} }
},
extract: {
ignoreOrder: true,
} }
} }