Merge pull request #3382 from dataease/pr@dev@dateformat

feat(数据集): 数据集字段,字符串转时间,可以指定时间格式
This commit is contained in:
wisonic-s 2022-10-18 18:43:56 +08:00 committed by GitHub
commit ac46f9a8c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 142 additions and 71 deletions

View File

@ -125,7 +125,7 @@ public class DorisQueryProvider extends QueryProvider {
} else if (f.getDeType() == 3) {
fieldName = String.format(DorisConstants.CAST, originField, DorisConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -201,7 +201,7 @@ public class DorisQueryProvider extends QueryProvider {
} else if (f.getDeType() == 3) {
fieldName = String.format(DorisConstants.CAST, originField, DorisConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -801,7 +801,7 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(DorisConstants.STR_TO_DATE, originName, DorisConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(DorisConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -931,7 +931,7 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(DorisConstants.STR_TO_DATE, originName, DorisConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(DorisConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1035,7 +1035,7 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(DorisConstants.STR_TO_DATE, originName, DorisConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(DorisConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1147,7 +1147,7 @@ public class DorisQueryProvider extends QueryProvider {
if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == 0) {
fieldName = String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT), format);
fieldName = String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT), format);
} else {
String cast = String.format(DorisConstants.CAST, originField, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
String from_unixtime = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);

View File

@ -126,7 +126,7 @@ public class MysqlQueryProvider extends QueryProvider {
} else if (f.getDeType() == 3) {
fieldName = String.format(MysqlConstants.CAST, originField, MysqlConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(MysqlConstants.STR_TO_DATE, originField, MysqlConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(MysqlConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -201,7 +201,7 @@ public class MysqlQueryProvider extends QueryProvider {
} else if (f.getDeType() == 3) {
fieldName = String.format(MysqlConstants.CAST, originField, MysqlConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(MysqlConstants.STR_TO_DATE, originField, MysqlConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(MysqlConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -801,7 +801,7 @@ public class MysqlQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(MysqlConstants.STR_TO_DATE, originName, MysqlConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(MysqlConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(MysqlConstants.CAST, originName, MysqlConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -931,7 +931,7 @@ public class MysqlQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(MysqlConstants.STR_TO_DATE, originName, MysqlConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(MysqlConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(MysqlConstants.CAST, originName, MysqlConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1040,7 +1040,7 @@ public class MysqlQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
whereName = String.format(MysqlConstants.STR_TO_DATE, originName, MysqlConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(MysqlConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(MysqlConstants.CAST, originName, MysqlConstants.DEFAULT_INT_FORMAT) + "/1000";

View File

@ -131,6 +131,9 @@ public class Db2QueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(Db2Constants.CAST, originField, Db2Constants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
if (StringUtils.isNotEmpty(f.getDateFormat())) {
originField = String.format(Db2Constants.TO_DATE, originField, f.getDateFormat());
}
fieldName = String.format(Db2Constants.DATE_FORMAT, originField, Db2Constants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
@ -213,6 +216,9 @@ public class Db2QueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(Db2Constants.CAST, originField, Db2Constants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
if (StringUtils.isNotEmpty(f.getDateFormat())) {
originField = String.format(Db2Constants.TO_DATE, originField, f.getDateFormat());
}
fieldName = String.format(Db2Constants.DATE_FORMAT, originField, Db2Constants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
@ -824,7 +830,11 @@ public class Db2QueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
originName = String.format(Db2Constants.STR_TO_DATE, originName);
if (StringUtils.isNotEmpty(field.getDateFormat())) {
originName = String.format(Db2Constants.TO_DATE, originName, field.getDateFormat());
} else {
originName = String.format(Db2Constants.STR_TO_DATE, originName);
}
whereName = String.format(Db2Constants.DATE_FORMAT, originName, Db2Constants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == DeTypeConstants.DE_FLOAT) {
@ -959,7 +969,11 @@ public class Db2QueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
originName = String.format(Db2Constants.STR_TO_DATE, originName);
if (StringUtils.isNotEmpty(field.getDateFormat())) {
originName = String.format(Db2Constants.TO_DATE, originName, field.getDateFormat());
} else {
originName = String.format(Db2Constants.STR_TO_DATE, originName);
}
whereName = String.format(Db2Constants.DATE_FORMAT, originName, Db2Constants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == DeTypeConstants.DE_FLOAT) {
@ -1074,7 +1088,11 @@ public class Db2QueryProvider extends QueryProvider {
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
originName = String.format(Db2Constants.STR_TO_DATE, originName);
if (StringUtils.isNotEmpty(field.getDateFormat())) {
originName = String.format(Db2Constants.TO_DATE, originName, field.getDateFormat());
} else {
originName = String.format(Db2Constants.STR_TO_DATE, originName);
}
whereName = String.format(Db2Constants.DATE_FORMAT, originName, Db2Constants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
@ -1210,6 +1228,9 @@ public class Db2QueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
if (StringUtils.isNotEmpty(x.getDateFormat())) {
originField = String.format(Db2Constants.TO_DATE, originField, x.getDateFormat());
}
fieldName = String.format(Db2Constants.DATE_FORMAT, originField, format);
} else {
String cast = String.format(Db2Constants.CAST, originField, Db2Constants.DEFAULT_INT_FORMAT);
@ -1337,7 +1358,7 @@ public class Db2QueryProvider extends QueryProvider {
}
@Override
public String sqlForPreview(String table, Datasource ds){
public String sqlForPreview(String table, Datasource ds) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
schema = String.format(Db2Constants.KEYWORD_TABLE, schema);
return "SELECT * FROM " + schema + "." + String.format(Db2Constants.KEYWORD_TABLE, table);

View File

@ -155,7 +155,7 @@ public class EsQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(EsSqlLConstants.CAST, originField, "double");
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(EsSqlLConstants.CAST, originField, "timestamp");
fieldName = String.format(EsSqlLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : EsSqlLConstants.DEFAULT_DATE_FORMAT, EsSqlLConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -232,7 +232,7 @@ public class EsQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(EsSqlLConstants.CAST, originField, "double");
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(EsSqlLConstants.CAST, originField, "timestamp");
fieldName = String.format(EsSqlLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : EsSqlLConstants.DEFAULT_DATE_FORMAT, EsSqlLConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -858,7 +858,7 @@ public class EsQueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(EsSqlLConstants.CAST, originName, "timestamp");
whereName = String.format(EsSqlLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : EsSqlLConstants.DEFAULT_DATE_FORMAT, EsSqlLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == DeTypeConstants.DE_FLOAT || field.getDeExtractType() == DeTypeConstants.DE_BOOL) {
String cast = String.format(EsSqlLConstants.CAST, originName, "timestamp");
@ -981,7 +981,7 @@ public class EsQueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(EsSqlLConstants.CAST, originName, "timestamp");
whereName = String.format(EsSqlLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : EsSqlLConstants.DEFAULT_DATE_FORMAT, EsSqlLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == DeTypeConstants.DE_FLOAT || field.getDeExtractType() == DeTypeConstants.DE_BOOL) {
String cast = String.format(EsSqlLConstants.CAST, originName, "timestamp");
@ -1079,7 +1079,7 @@ public class EsQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(EsSqlLConstants.CAST, originName, "timestamp");
whereName = String.format(EsSqlLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : EsSqlLConstants.DEFAULT_DATE_FORMAT, EsSqlLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(EsSqlLConstants.CAST, originName, "timestamp");
@ -1193,8 +1193,7 @@ public class EsQueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
String cast = String.format(EsSqlLConstants.CAST, originField, "timestamp");
fieldName = String.format(EsSqlLConstants.DATETIME_FORMAT, cast, format);
fieldName = String.format(EsSqlLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : EsSqlLConstants.DEFAULT_DATE_FORMAT, format);
} else {
String cast = String.format(EsSqlLConstants.CAST, originField, "timestamp");
fieldName = String.format(EsSqlLConstants.DATETIME_FORMAT, cast, format);

View File

@ -116,7 +116,7 @@ public class HiveQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(HiveConstants.CAST, originField, HiveConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(HiveConstants.STR_TO_DATE, originField, HiveConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(HiveConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -191,7 +191,7 @@ public class HiveQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(HiveConstants.CAST, originField, HiveConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(HiveConstants.STR_TO_DATE, originField, HiveConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(HiveConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -793,7 +793,7 @@ public class HiveQueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
whereName = String.format(HiveConstants.STR_TO_DATE, originName, HiveConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(HiveConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(HiveConstants.CAST, originName, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -916,7 +916,7 @@ public class HiveQueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
whereName = String.format(HiveConstants.STR_TO_DATE, originName, HiveConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(HiveConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(HiveConstants.CAST, originName, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1015,7 +1015,7 @@ public class HiveQueryProvider extends QueryProvider {
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
whereName = String.format(HiveConstants.STR_TO_DATE, originName, HiveConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(HiveConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(HiveConstants.CAST, originName, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";

View File

@ -113,7 +113,7 @@ public class ImpalaQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(ImpalaConstants.CAST, originField, ImpalaConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(ImpalaConstants.DATE_FORMAT, originField, ImpalaConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -198,7 +198,7 @@ public class ImpalaQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(ImpalaConstants.CAST, originField, ImpalaConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(ImpalaConstants.DATE_FORMAT, originField, ImpalaConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -790,7 +790,7 @@ public class ImpalaQueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
whereName = String.format(ImpalaConstants.DATE_FORMAT, originName, ImpalaConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -917,7 +917,7 @@ public class ImpalaQueryProvider extends QueryProvider {
}
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
whereName = String.format(ImpalaConstants.DATE_FORMAT, originName, ImpalaConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1020,7 +1020,7 @@ public class ImpalaQueryProvider extends QueryProvider {
if (field.getDeType() == DeTypeConstants.DE_TIME) {
if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
whereName = String.format(ImpalaConstants.DATE_FORMAT, originName, ImpalaConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(ImpalaConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(ImpalaConstants.CAST, originName, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1139,7 +1139,7 @@ public class ImpalaQueryProvider extends QueryProvider {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
fieldName = String.format(ImpalaConstants.DATE_FORMAT, originField, format);
fieldName = String.format(ImpalaConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : ImpalaConstants.DEFAULT_DATE_FORMAT ,ImpalaConstants.DEFAULT_DATE_FORMAT);
} else {
String cast = String.format(ImpalaConstants.CAST, originField, ImpalaConstants.DEFAULT_INT_FORMAT) + "/1000";
String from_unixtime = String.format(ImpalaConstants.FROM_UNIXTIME, cast, ImpalaConstants.DEFAULT_DATE_FORMAT);

View File

@ -8,6 +8,7 @@ import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.plugins.common.constants.datasource.MySQLConstants;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.constants.engine.MysqlConstants;
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
@ -128,7 +129,7 @@ public class MysqlQueryProvider extends QueryProvider {
} else if (f.getDeType() == 3) {
fieldName = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(MySQLConstants.STR_TO_DATE, originField, MySQLConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(MySQLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -187,7 +188,7 @@ public class MysqlQueryProvider extends QueryProvider {
} else if (f.getDeType() == 3) {
fieldName = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(MySQLConstants.STR_TO_DATE, originField, MySQLConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(MySQLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -814,7 +815,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(MySQLConstants.STR_TO_DATE, originName, MySQLConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(MySQLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -936,7 +937,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(MySQLConstants.STR_TO_DATE, originName, MySQLConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(MySQLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1034,7 +1035,7 @@ public class MysqlQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(MySQLConstants.STR_TO_DATE, originName, MySQLConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(MySQLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";

View File

@ -851,7 +851,7 @@ public class OracleQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(OracleConstants.TO_DATE, originName, OracleConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(OracleConstants.TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -897,7 +897,7 @@ public class OracleQueryProvider extends QueryProvider {
whereValue = "'%" + value + "%'";
} else {
if (field.getDeType() == 1) {
whereValue = String.format(OracleConstants.TO_DATE, "'" + value + "'", OracleConstants.DEFAULT_DATE_FORMAT);
whereValue = String.format(OracleConstants.TO_DATE, "'" + value + "'", StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
} else {
whereValue = String.format(OracleConstants.WHERE_VALUE_VALUE, value);
}
@ -980,7 +980,7 @@ public class OracleQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(OracleConstants.TO_DATE, originName, OracleConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(OracleConstants.TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1028,7 +1028,7 @@ public class OracleQueryProvider extends QueryProvider {
whereValue = "'%" + value + "%'";
} else {
if (field.getDeType() == 1) {
whereValue = String.format(OracleConstants.TO_DATE, "'" + value + "'", OracleConstants.DEFAULT_DATE_FORMAT);
whereValue = String.format(OracleConstants.TO_DATE, "'" + value + "'", StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
} else {
whereValue = String.format(OracleConstants.WHERE_VALUE_VALUE, value);
}
@ -1083,7 +1083,7 @@ public class OracleQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(OracleConstants.TO_DATE, originName, OracleConstants.DEFAULT_DATE_FORMAT);
whereName = String.format(OracleConstants.TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -1213,7 +1213,7 @@ public class OracleQueryProvider extends QueryProvider {
if (x.getDeType() == TIME) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == STRING) { //字符串转时间
String toDate = String.format(OracleConstants.TO_DATE, originField, OracleConstants.DEFAULT_DATE_FORMAT);
String toDate = String.format(OracleConstants.TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : OracleConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(OracleConstants.TO_CHAR, toDate, format);
} else { //数值转时间
String date = originField + "/(1000 * 60 * 60 * 24)+" + String.format(OracleConstants.TO_DATE, OracleConstants.DEFAULT_START_DATE, OracleConstants.DEFAULT_DATE_FORMAT);
@ -1372,9 +1372,9 @@ public class OracleQueryProvider extends QueryProvider {
}
@Override
public String sqlForPreview(String table, Datasource ds){
public String sqlForPreview(String table, Datasource ds) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
schema = String.format(OracleConstants.KEYWORD_TABLE, schema);
return "SELECT * FROM " + schema + "." + String.format(OracleConstants.KEYWORD_TABLE, table);
return "SELECT * FROM " + schema + "." + String.format(OracleConstants.KEYWORD_TABLE, table);
}
}

View File

@ -144,7 +144,7 @@ public class PgQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.CAST, originField, "timestamp");
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -218,7 +218,7 @@ public class PgQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.CAST, originField, "timestamp");
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -823,7 +823,7 @@ public class PgQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.CAST, originName, "timestamp");
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");

View File

@ -150,7 +150,7 @@ public class RedshiftQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.CAST, originField, "timestamp");
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -225,7 +225,7 @@ public class RedshiftQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(PgConstants.CAST, originField, PgConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) {
fieldName = String.format(PgConstants.CAST, originField, "timestamp");
fieldName = String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -759,7 +759,7 @@ public class RedshiftQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(PgConstants.CAST, originName, "timestamp");
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(PgConstants.CAST, originName, "bigint");

View File

@ -143,7 +143,7 @@ public class SqlserverQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(SqlServerSQLConstants.CONVERT, SqlServerSQLConstants.DEFAULT_FLOAT_FORMAT, originField);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) { //字符串转时间
fieldName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField);
fieldName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -216,7 +216,7 @@ public class SqlserverQueryProvider extends QueryProvider {
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
fieldName = String.format(SqlServerSQLConstants.CONVERT, SqlServerSQLConstants.DEFAULT_FLOAT_FORMAT, originField);
} else if (f.getDeType() == DeTypeConstants.DE_TIME) { //字符串转时间
fieldName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField);
fieldName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
@ -854,7 +854,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName);
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
@ -979,7 +979,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName);
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
@ -1078,7 +1078,7 @@ public class SqlserverQueryProvider extends QueryProvider {
if (field.getDeType() == 1) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName);
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
}
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originName + "/1000");
@ -1207,7 +1207,7 @@ public class SqlserverQueryProvider extends QueryProvider {
} else {
if (x.getDeType() == DeTypeConstants.DE_TIME) {
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {// 字符串转时间
String cast = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField);
String cast = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
fieldName = transDateFormat(x.getDateStyle(), x.getDatePattern(), cast);
} else {// 数值转时间
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originField + "/1000");
@ -1326,7 +1326,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
@Override
public String sqlForPreview(String table, Datasource ds){
public String sqlForPreview(String table, Datasource ds) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
schema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema);
return "SELECT * FROM " + schema + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);

View File

@ -8,4 +8,7 @@ UPDATE `sys_menu` set `component` = REPLACE(`component`, 'dataset', 'Dataset') w
UPDATE `sys_menu` set `component` = REPLACE(`component`, 'form', 'Form') where (`component` = 'system/task/form');
ALTER TABLE `dataset_table_field` ADD COLUMN `date_format` VARCHAR(255) NULL AFTER `accuracy`;

View File

@ -1673,7 +1673,8 @@ export default {
field_edit_name: 'Field Name',
input_edit_name: 'Input field name',
edit_search: 'Search by name',
na: 'None'
na: 'None',
date_format: 'Time format, default: year-month-day hour:minute:second'
},
driver: {
driver: 'Driver',

View File

@ -1673,7 +1673,8 @@ export default {
field_edit_name: '字段名稱',
input_edit_name: '請輸入字段名稱',
edit_search: '通過名稱搜索',
na: '暫無'
na: '暫無',
date_format: '時間格式,默認:年-月-日 時:分:秒'
},
driver: {
driver: '驅動',

View File

@ -1672,7 +1672,8 @@ export default {
field_edit_name: '字段名称',
input_edit_name: '请输入字段名称',
edit_search: '通过名称搜索',
na: '暂无'
na: '暂无',
date_format: '时间格式,默认: 年-月-日 时:分:秒'
},
driver: {
driver: '驱动',

View File

@ -7,7 +7,8 @@
secondary
icon="el-icon-plus"
@click="addCalcField"
>{{ $t('dataset.add_calc_field') }}</deBtn>
>{{ $t('dataset.add_calc_field') }}
</deBtn>
<deBtn
v-if="
hasDataPermission('manage', param.privileges) &&
@ -19,7 +20,8 @@
:loading="isSyncField"
icon="el-icon-refresh-left"
@click="syncField"
>{{ $t('dataset.sync_field') }}</deBtn>
>{{ $t('dataset.sync_field') }}
</deBtn>
&nbsp;
</el-col>
<el-col
@ -209,6 +211,16 @@
/>
</span>
</span>
<el-input
v-if="scope.row.deType === 1"
v-model="scope.row.dateFormat"
:placeholder="$t('dataset.date_format')"
size="small"
class="input-type"
:disabled="!hasDataPermission('manage', param.privileges)"
@blur="saveEdit(scope.row)"
@keyup.enter.native="saveEdit(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
@ -309,7 +321,8 @@
style="margin-left: -4px"
:disabled="!hasDataPermission('manage', param.privileges)"
@click="dqTrans(scope.row, 'd')"
>{{ $t('deDataset.convert_to_indicator') }}</el-button>
>{{ $t('deDataset.convert_to_indicator') }}
</el-button>
<template v-if="scope.row.extField !== 0">
<el-button
:disabled="!hasDataPermission('manage', param.privileges)"
@ -317,7 +330,8 @@
class="de-text-btn"
style="margin-left: 8px"
@click="editField(scope.row)"
>{{ $t('dataset.edit') }}</el-button>
>{{ $t('dataset.edit') }}
</el-button>
<el-dropdown
size="medium"
trigger="click"
@ -362,7 +376,8 @@
style="margin-left: 8px"
class="de-text-btn"
@click="copyField(scope.row)"
>{{ $t('dataset.copy') }}</el-button>
>{{ $t('dataset.copy') }}
</el-button>
</template>
</el-table-column>
</el-table>
@ -533,6 +548,14 @@
/>
</span>
</span>
<el-input
v-if="scope.row.deType === 1"
v-model="scope.row.dateFormat"
size="mini"
:disabled="!hasDataPermission('manage', param.privileges)"
@blur="saveEdit(scope.row)"
@keyup.enter.native="saveEdit(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
@ -626,7 +649,8 @@
style="margin-left: -4px"
:disabled="!hasDataPermission('manage', param.privileges)"
@click="dqTrans(scope.row, 'q')"
>{{ $t('deDataset.convert_to_dimension') }}</el-button>
>{{ $t('deDataset.convert_to_dimension') }}
</el-button>
<template v-if="scope.row.extField !== 0">
<el-button
:disabled="!hasDataPermission('manage', param.privileges)"
@ -634,7 +658,8 @@
class="de-text-btn"
style="margin-left: 8px"
@click="editField(scope.row)"
>{{ $t('dataset.edit') }}</el-button>
>{{ $t('dataset.edit') }}
</el-button>
<el-dropdown
size="medium"
trigger="click"
@ -679,7 +704,8 @@
style="margin-left: 8px"
class="de-text-btn"
@click="copyField(scope.row)"
>{{ $t('dataset.copy') }}</el-button>
>{{ $t('dataset.copy') }}
</el-button>
</template>
</el-table-column>
</el-table>
@ -712,6 +738,7 @@ import { post, fieldListDQ, batchEdit } from '@/api/dataset/dataset'
import CalcFieldEdit from './CalcFieldEdit'
import { getFieldName } from '@/views/dataset/data/utils'
import msgCfm from '@/components/msgCfm/index'
export default {
name: 'FieldEdit',
components: { CalcFieldEdit },
@ -896,7 +923,8 @@ export default {
localStorage.setItem('reloadDsData', 'true')
})
})
.catch(() => {})
.catch(() => {
})
},
syncField() {
@ -1032,35 +1060,48 @@ export default {
.el-divider--horizontal {
margin: 12px 0;
}
span {
font-size: 14px;
}
.field-class {
font-size: 12px !important;
}
.el-select ::v-deep input {
padding-right: 10px;
}
.el-select ::v-deep .el-input__suffix {
right: 0;
}
.el-radio {
margin-right: 10px !important;
}
.style-collapse {
border: none;
.select-type {
width: 180px;
::v-deep.el-input__inner {
padding-left: 32px;
}
}
.input-type {
width: 180px;
}
.select-svg-icon {
position: absolute;
left: 24px;
top: 10px;
}
::v-deep.el-collapse-item__header {
height: 30px;
line-height: 30px;
@ -1068,6 +1109,7 @@ span {
position: relative;
border-bottom: 1px solid rgba(31, 35, 41, 0.15);
}
::v-deep.el-checkbox {
margin-left: 8px;
}
@ -1077,6 +1119,7 @@ span {
background-color: rgba(51, 112, 255, 0.1);
}
}
.quota {
::v-deep.el-collapse-item__header {
background-color: rgba(4, 180, 156, 0.1);
@ -1098,6 +1141,7 @@ span {
transform: rotate(90deg);
}
}
.style-collapse ::v-deep .el-collapse-item__wrap {
border-bottom: 0 solid #e6ebf5 !important;
}