diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java index bcfbcfe54e..3f30beb3be 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java @@ -250,6 +250,120 @@ public class DefaultChartHandler extends AbstractChartPlugin { return res; } + protected List getAssistFields(List list, List yAxis, List xAxis) { + List res = new ArrayList<>(); + for (ChartSeniorAssistDTO dto : list) { + DatasetTableFieldDTO curField = dto.getCurField(); + ChartViewFieldDTO field = null; + String alias = ""; + for (int i = 0; i < yAxis.size(); i++) { + ChartViewFieldDTO yField = yAxis.get(i); + if (Objects.equals(yField.getId(), curField.getId())) { + field = yField; + alias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i); + break; + } + } + if (ObjectUtils.isEmpty(field) && CollectionUtils.isNotEmpty(xAxis)) { + for (int i = 0; i < xAxis.size(); i++) { + ChartViewFieldDTO xField = xAxis.get(i); + if (StringUtils.equalsIgnoreCase(String.valueOf(xField.getId()), String.valueOf(curField.getId()))) { + field = xField; + alias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i); + break; + } + } + } + if (ObjectUtils.isEmpty(field)) { + continue; + } + + ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO(); + BeanUtils.copyBean(chartViewFieldDTO, curField); + chartViewFieldDTO.setSummary(dto.getSummary()); + chartViewFieldDTO.setOriginName(alias);// yAxis的字段别名,就是查找的字段名 + res.add(chartViewFieldDTO); + } + return res; + } + + public List getDynamicThresholdFields(ChartViewDTO view) { + List list = new ArrayList<>(); + Map senior = view.getSenior(); + if (ObjectUtils.isEmpty(senior)) { + return list; + } + ChartSeniorThresholdCfgDTO thresholdCfg = JsonUtil.parseObject((String) JsonUtil.toJSONString(senior.get("threshold")), ChartSeniorThresholdCfgDTO.class); + + if (null == thresholdCfg || !thresholdCfg.isEnable()) { + return list; + } + List tableThreshold = thresholdCfg.getTableThreshold(); + + if (ObjectUtils.isEmpty(tableThreshold)) { + return list; + } + + List conditionsList = tableThreshold.stream() + .filter(item -> !ObjectUtils.isEmpty(item)) + .map(TableThresholdDTO::getConditions) + .flatMap(List::stream) + .filter(condition -> StringUtils.equalsAnyIgnoreCase(condition.getType(), "dynamic")) + .toList(); + + List assistDTOs = conditionsList.stream() + .flatMap(condition -> getConditionFields(condition).stream()) + .filter(this::solveThresholdCondition) + .toList(); + + list.addAll(assistDTOs); + + return list; + } + + private boolean solveThresholdCondition(ChartSeniorAssistDTO fieldDTO) { + Long fieldId = fieldDTO.getFieldId(); + String summary = fieldDTO.getValue(); + if (ObjectUtils.isEmpty(fieldId) || StringUtils.isEmpty(summary)) { + return false; + } + + DatasetTableFieldDTO datasetTableFieldDTO = datasetTableFieldManage.selectById(fieldId); + if (ObjectUtils.isEmpty(datasetTableFieldDTO)) { + return false; + } + ChartViewFieldDTO datasetTableField = new ChartViewFieldDTO(); + BeanUtils.copyBean(datasetTableField, datasetTableFieldDTO); + fieldDTO.setCurField(datasetTableField); + fieldDTO.setSummary(summary); + return true; + } + + private List getConditionFields(ChartSeniorThresholdDTO condition) { + List list = new ArrayList<>(); + if ("between".equals(condition.getTerm())) { + if (!StringUtils.equalsIgnoreCase(condition.getDynamicMaxField().getSummary(), "value")) { + list.add(of(condition.getDynamicMaxField())); + } + if (!StringUtils.equalsIgnoreCase(condition.getDynamicMinField().getSummary(), "value")) { + list.add(of(condition.getDynamicMinField())); + } + } else { + if (!StringUtils.equalsIgnoreCase(condition.getDynamicField().getSummary(), "value")) { + list.add(of(condition.getDynamicField())); + } + } + + return list; + } + + private ChartSeniorAssistDTO of(ThresholdDynamicFieldDTO dynamicField) { + ChartSeniorAssistDTO conditionField = new ChartSeniorAssistDTO(); + conditionField.setFieldId(Long.parseLong(dynamicField.getFieldId())); + conditionField.setValue(dynamicField.getSummary()); + return conditionField; + } + protected String assistSQL(String sql, List assistFields) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < assistFields.size(); i++) { @@ -464,7 +578,8 @@ public class DefaultChartHandler extends AbstractChartPlugin { if (StringUtils.isNotEmpty(compareCalc.getType()) && !StringUtils.equalsIgnoreCase(compareCalc.getType(), "none")) { if (Arrays.asList(ChartConstants.M_Y).contains(compareCalc.getType())) { - if (StringUtils.equalsIgnoreCase(compareCalc.getField() + "", filterDTO.getFieldId()) && filterDTO.getFilterType() == 0) { + if (StringUtils.equalsIgnoreCase(compareCalc.getField() + "", filterDTO.getFieldId()) + && (filterDTO.getFilterType() == 0 || filterDTO.getFilterType() == 2)) { // -1 year try { Calendar calendar = Calendar.getInstance(); diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java index a53999a8a3..519ba6afc8 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java @@ -120,11 +120,11 @@ public class YoyChartHandler extends DefaultChartHandler { expandedResult.setQuerySql(originSql); } // 同环比数据排序 - expandedResult.setOriginData(sortData(view, expandedResult.getOriginData())); + expandedResult.setOriginData(sortData(view, expandedResult.getOriginData(),formatResult)); return expandedResult; } - public static List sortData(ChartViewDTO view, List data) { + public static List sortData(ChartViewDTO view, List data, AxisFormatResult formatResult) { // 维度排序 List xAxisSortList = view.getXAxis().stream().filter(x -> !StringUtils.equalsIgnoreCase("none", x.getSort())).toList(); // 指标排序 @@ -135,11 +135,9 @@ public class YoyChartHandler extends DefaultChartHandler { ChartViewFieldDTO firstYAxis = yAxisSortList.getFirst(); boolean asc = firstYAxis.getSort().equalsIgnoreCase("asc"); // 维度指标 - List allAxisList = Stream.of( - view.getXAxis(), - view.getXAxisExt(), - view.getYAxis() - ).flatMap(List::stream).toList(); + List allAxisList = new ArrayList<>(); + allAxisList.addAll(formatResult.getAxisMap().get(ChartAxis.xAxis)); + allAxisList.addAll(formatResult.getAxisMap().get(ChartAxis.yAxis)); int index = findIndex(allAxisList, firstYAxis.getId()); return sortData(data, asc, index); } diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java index 12bd57256f..63805ef11e 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java @@ -12,8 +12,9 @@ import io.dataease.extensions.datasource.provider.Provider; import io.dataease.extensions.view.dto.*; import io.dataease.extensions.view.util.ChartDataUtil; import io.dataease.extensions.view.util.FieldUtil; -import io.dataease.utils.JsonUtil; +import io.dataease.utils.BeanUtils; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -21,6 +22,8 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; @Component public class TableInfoHandler extends DefaultChartHandler { @@ -135,6 +138,32 @@ public class TableInfoHandler extends DefaultChartHandler { calcResult.setContext(filterResult.getContext()); calcResult.setQuerySql(querySql); calcResult.setOriginData(data); + try { + var dynamicAssistFields = getDynamicThresholdFields(view); + Set fieldIds = xAxis.stream().map(ChartViewFieldDTO::getId).collect(Collectors.toSet()); + List finalXAxis = xAxis; + dynamicAssistFields.forEach(i -> { + if (!fieldIds.contains(i.getFieldId())) { + ChartViewFieldDTO fieldDTO = new ChartViewFieldDTO(); + BeanUtils.copyBean(fieldDTO, i.getCurField()); + finalXAxis.add(fieldDTO); + } + }); + var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis); + var assistFields = getAssistFields(dynamicAssistFields, yAxis, xAxis); + if (CollectionUtils.isNotEmpty(assistFields)) { + var req = new DatasourceRequest(); + req.setDsList(dsMap); + var assistSql = assistSQL(querySql, assistFields); + req.setQuery(assistSql); + logger.debug("calcite assistSql sql: " + assistSql); + var assistData = (List) provider.fetchResultField(req).get("data"); + calcResult.setAssistData(assistData); + calcResult.setDynamicAssistFields(dynamicAssistFields); + } + } catch (Exception e) { + e.printStackTrace(); + } return calcResult; } } diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java index 36522b8117..bc48648ea3 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java @@ -1,9 +1,18 @@ package io.dataease.chart.charts.impl.table; import io.dataease.chart.charts.impl.YoyChartHandler; +import io.dataease.extensions.datasource.dto.DatasourceRequest; +import io.dataease.extensions.datasource.dto.DatasourceSchemaDTO; +import io.dataease.extensions.datasource.model.SQLMeta; +import io.dataease.extensions.datasource.provider.Provider; +import io.dataease.extensions.view.dto.*; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; + /** * @author jianneng * @date 2024/9/11 11:37 @@ -12,4 +21,29 @@ import org.springframework.stereotype.Component; public class TableNormalHandler extends YoyChartHandler { @Getter private String type = "table-normal"; + + @Override + public T calcChartResult(ChartViewDTO view, AxisFormatResult formatResult, CustomFilterResult filterResult, Map sqlMap, SQLMeta sqlMeta, Provider provider) { + var dsMap = (Map) sqlMap.get("dsMap"); + var result = (T) super.calcChartResult(view, formatResult, filterResult, sqlMap, sqlMeta, provider); + try { + var originSql = result.getQuerySql(); + var dynamicAssistFields = getDynamicThresholdFields(view); + var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis); + var assistFields = getAssistFields(dynamicAssistFields, yAxis); + if (CollectionUtils.isNotEmpty(assistFields)) { + var req = new DatasourceRequest(); + req.setDsList(dsMap); + var assistSql = assistSQL(originSql, assistFields); + req.setQuery(assistSql); + logger.debug("calcite assistSql sql: " + assistSql); + var assistData = (List) provider.fetchResultField(req).get("data"); + result.setAssistData(assistData); + result.setDynamicAssistFields(dynamicAssistFields); + } + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } } diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java index 3cdbb4159b..afd07ab49d 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java @@ -17,6 +17,7 @@ import io.dataease.utils.BeanUtils; import io.dataease.utils.IDUtils; import io.dataease.utils.JsonUtil; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import reactor.util.function.Tuple2; @@ -35,6 +36,25 @@ public class TablePivotHandler extends GroupChartHandler { T result = super.calcChartResult(view, formatResult, filterResult, sqlMap, sqlMeta, provider); Map customCalc = calcCustomExpr(view, filterResult, sqlMap, sqlMeta, provider); result.getData().put("customCalc", customCalc); + try { + var dsMap = (Map) sqlMap.get("dsMap"); + var originSql = result.getQuerySql(); + var dynamicAssistFields = getDynamicThresholdFields(view); + var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis); + var assistFields = getAssistFields(dynamicAssistFields, yAxis); + if (CollectionUtils.isNotEmpty(assistFields)) { + var req = new DatasourceRequest(); + req.setDsList(dsMap); + var assistSql = assistSQL(originSql, assistFields); + req.setQuery(assistSql); + logger.debug("calcite assistSql sql: " + assistSql); + var assistData = (List) provider.fetchResultField(req).get("data"); + result.setAssistData(assistData); + result.setDynamicAssistFields(dynamicAssistFields); + } + } catch (Exception e) { + e.printStackTrace(); + } return result; } @@ -54,7 +74,9 @@ public class TablePivotHandler extends GroupChartHandler { var rowAxis = view.getXAxis(); var colAxis = view.getXAxisExt(); var dataMap = new HashMap(); - var quotaIds = view.getYAxis().stream().map(ChartViewFieldDTO::getDataeaseName).collect(Collectors.toSet()); + if (CollectionUtils.isEmpty(rowAxis)) { + return dataMap; + } // 行总计,列维度聚合加上自定义字段 var row = tableTotal.getRow(); if (row.isShowGrandTotals()) { @@ -96,7 +118,7 @@ public class TablePivotHandler extends GroupChartHandler { } // 列总计,行维度聚合加上自定义字段 var col = tableTotal.getCol(); - if (col.isShowGrandTotals()) { + if (col.isShowGrandTotals() && CollectionUtils.isNotEmpty(colAxis)) { var yAxis = getCustomFields(view, col.getCalcTotals().getCfg()); if (!yAxis.isEmpty()) { var result = getData(sqlMeta, rowAxis, yAxis, allFields, crossDs, dsMap, view, provider, needOrder); @@ -109,7 +131,7 @@ public class TablePivotHandler extends GroupChartHandler { } } // 列小计,行维度聚合,自定义指标数 * (列维度的数量 - 1) - if (col.isShowSubTotals()) { + if (col.isShowSubTotals() && colAxis.size() >= 2) { var yAxis = getCustomFields(view, col.getCalcSubTotals().getCfg()); if (!yAxis.isEmpty()) { var tmpData = new ArrayList>(); @@ -153,7 +175,7 @@ public class TablePivotHandler extends GroupChartHandler { } } // 行总计里面的列小计 - if (row.isShowGrandTotals() && col.isShowSubTotals()) { + if (row.isShowGrandTotals() && col.isShowSubTotals() && colAxis.size() >= 2) { var yAxis = getCustomFields(view, col.getCalcTotals().getCfg()); if (!yAxis.isEmpty()) { var tmpData = new ArrayList>(); @@ -174,7 +196,7 @@ public class TablePivotHandler extends GroupChartHandler { } } // 列总计里面的行小计 - if (col.isShowGrandTotals() && row.isShowGrandTotals()) { + if (col.isShowGrandTotals() && row.isShowGrandTotals() && rowAxis.size() >= 2) { var yAxis = getCustomFields(view, row.getCalcTotals().getCfg()); if (!yAxis.isEmpty()) { var tmpData = new ArrayList>(); @@ -195,7 +217,7 @@ public class TablePivotHandler extends GroupChartHandler { } } // 行小计和列小计相交部分 - if (row.isShowSubTotals() && col.isShowSubTotals()) { + if (row.isShowSubTotals() && col.isShowSubTotals() && colAxis.size() >= 2 && rowAxis.size() >= 2) { var yAxis = getCustomFields(view, col.getCalcTotals().getCfg()); if (!yAxis.isEmpty()) { var tmpData = new ArrayList>>(); @@ -230,6 +252,14 @@ public class TablePivotHandler extends GroupChartHandler { private Map buildCustomCalcResult(List data, List dimAxis, List quotaAxis) { var rootResult = new HashMap(); + if (CollectionUtils.isEmpty(dimAxis)) { + var rowData = data.getFirst(); + for (int i = 0; i < rowData.length; i++) { + var qAxis = quotaAxis.get(i); + rootResult.put(qAxis.getDataeaseName(), rowData[i]); + } + return rootResult; + } for (int i = 0; i < data.size(); i++) { var rowData = data.get(i); Map curSubMap = rootResult; diff --git a/core/core-backend/src/main/java/io/dataease/home/RestIndexController.java b/core/core-backend/src/main/java/io/dataease/home/RestIndexController.java index e848d88e9d..231afa9d90 100644 --- a/core/core-backend/src/main/java/io/dataease/home/RestIndexController.java +++ b/core/core-backend/src/main/java/io/dataease/home/RestIndexController.java @@ -1,9 +1,9 @@ package io.dataease.home; -import io.dataease.license.utils.LicenseUtil; +import io.dataease.home.manage.DeIndexManage; import io.dataease.utils.ModelUtils; import io.dataease.utils.RsaUtils; -import org.springframework.beans.factory.annotation.Value; +import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -13,8 +13,9 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping public class RestIndexController { - @Value("${dataease.xpack-front-distributed:false}") - private boolean xpackFrontDistributed; + + @Resource + private DeIndexManage deIndexManage; @GetMapping("/dekey") @ResponseBody @@ -31,8 +32,8 @@ public class RestIndexController { @GetMapping("/xpackModel") @ResponseBody - public boolean xpackModel() { - return xpackFrontDistributed && LicenseUtil.licenseValid(); + public Boolean xpackModel() { + return deIndexManage.xpackModel(); } } diff --git a/core/core-backend/src/main/java/io/dataease/home/manage/DeIndexManage.java b/core/core-backend/src/main/java/io/dataease/home/manage/DeIndexManage.java new file mode 100644 index 0000000000..9ef0cfe13a --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/home/manage/DeIndexManage.java @@ -0,0 +1,13 @@ +package io.dataease.home.manage; + +import io.dataease.license.config.XpackInteract; +import org.springframework.stereotype.Component; + +@Component +public class DeIndexManage { + + @XpackInteract(value = "deIndexManage", replace = true) + public Boolean xpackModel() { + return null; + } +} diff --git a/core/core-backend/src/main/java/io/dataease/substitute/permissions/login/SubstituleLoginServer.java b/core/core-backend/src/main/java/io/dataease/substitute/permissions/login/SubstituleLoginServer.java index 88a010a0e8..cc6de17d76 100644 --- a/core/core-backend/src/main/java/io/dataease/substitute/permissions/login/SubstituleLoginServer.java +++ b/core/core-backend/src/main/java/io/dataease/substitute/permissions/login/SubstituleLoginServer.java @@ -5,14 +5,17 @@ import com.auth0.jwt.JWTCreator; import com.auth0.jwt.algorithms.Algorithm; import io.dataease.api.permissions.login.dto.PwdLoginDTO; import io.dataease.auth.bo.TokenUserBO; +import io.dataease.auth.config.SubstituleLoginConfig; import io.dataease.auth.vo.TokenVO; +import io.dataease.exception.DEException; +import io.dataease.i18n.Translator; import io.dataease.utils.LogUtil; +import io.dataease.utils.Md5Utils; +import io.dataease.utils.RsaUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @Component @ConditionalOnMissingBean(name = "loginServer") @@ -21,11 +24,26 @@ import org.springframework.web.bind.annotation.RestController; public class SubstituleLoginServer { @PostMapping("/login/localLogin") - public TokenVO localLogin(PwdLoginDTO dto) { + public TokenVO localLogin(@RequestBody PwdLoginDTO dto) { + + String name = dto.getName(); + name = RsaUtils.decryptStr(name); + String pwd = dto.getPwd(); + pwd = RsaUtils.decryptStr(pwd); + + dto.setName(name); + dto.setPwd(pwd); + + if (!StringUtils.equals("admin", name)) { + DEException.throwException("仅admin账号可用"); + } + if (!StringUtils.equals(pwd, SubstituleLoginConfig.getPwd())) { + DEException.throwException(Translator.get("i18n_login_name_pwd_err")); + } TokenUserBO tokenUserBO = new TokenUserBO(); tokenUserBO.setUserId(1L); tokenUserBO.setDefaultOid(1L); - String md5Pwd = "83d923c9f1d8fcaa46cae0ed2aaa81b5"; + String md5Pwd = Md5Utils.md5(pwd); return generate(tokenUserBO, md5Pwd); } diff --git a/core/core-backend/src/main/resources/db/migration/V2.10.1__ddl.sql b/core/core-backend/src/main/resources/db/migration/V2.10.1__ddl.sql index 3d30eb0d18..811ee6f2e1 100644 --- a/core/core-backend/src/main/resources/db/migration/V2.10.1__ddl.sql +++ b/core/core-backend/src/main/resources/db/migration/V2.10.1__ddl.sql @@ -1,12 +1,10 @@ ALTER TABLE `visualization_outer_params_info` - ADD COLUMN `required` tinyint(1) DEFAULT 0 COMMENT '是否必填', + ADD COLUMN `required` tinyint(1) DEFAULT 0 COMMENT '是否必填', ADD COLUMN `default_value` varchar(255) DEFAULT NULL COMMENT '默认值 JSON格式', ADD COLUMN `enabled_default` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用默认值'; update visualization_outer_params_info set required =0; -ALTER TABLE `xpack_report_info` - ADD COLUMN `show_watermark` tinyint(1) NOT NULL DEFAULT 0 COMMENT '显示水印' AFTER `rid`; ALTER TABLE `visualization_link_jump_info` ADD COLUMN `window_size` varchar(255) NULL DEFAULT 'middle' COMMENT '窗口大小large middle small'; diff --git a/core/core-backend/src/main/resources/db/migration/V2.10.2__ddl.sql b/core/core-backend/src/main/resources/db/migration/V2.10.2__ddl.sql new file mode 100644 index 0000000000..746a588daf --- /dev/null +++ b/core/core-backend/src/main/resources/db/migration/V2.10.2__ddl.sql @@ -0,0 +1 @@ +INSERT INTO area (id, level, name, pid) VALUES ('156440315', 'district', '大鹏新区', '156440300'); \ No newline at end of file diff --git a/core/core-frontend/index.html b/core/core-frontend/index.html index 946a05d659..3822848898 100644 --- a/core/core-frontend/index.html +++ b/core/core-frontend/index.html @@ -1,13 +1,16 @@ - - - - - - - -
- - - + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/core/core-frontend/mobile.html b/core/core-frontend/mobile.html index beca7603cc..ddfd163a40 100644 --- a/core/core-frontend/mobile.html +++ b/core/core-frontend/mobile.html @@ -3,10 +3,8 @@ - - DataEase @@ -14,4 +12,4 @@ - + \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/bubble-map-dark.svg b/core/core-frontend/src/assets/svg/bubble-map-dark.svg index 25a9630000..d9d5147e94 100644 --- a/core/core-frontend/src/assets/svg/bubble-map-dark.svg +++ b/core/core-frontend/src/assets/svg/bubble-map-dark.svg @@ -1,75 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_bubble-map_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/bubble-map-origin.svg b/core/core-frontend/src/assets/svg/bubble-map-origin.svg index 03ffbc078d..3ca5414790 100644 --- a/core/core-frontend/src/assets/svg/bubble-map-origin.svg +++ b/core/core-frontend/src/assets/svg/bubble-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_bubble-map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/bubble-map.svg b/core/core-frontend/src/assets/svg/bubble-map.svg index 8259226e64..9137455e4e 100644 --- a/core/core-frontend/src/assets/svg/bubble-map.svg +++ b/core/core-frontend/src/assets/svg/bubble-map.svg @@ -1,80 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_bubble-map_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/flow-map-dark.svg b/core/core-frontend/src/assets/svg/flow-map-dark.svg index f1111c5f87..35d88664ce 100644 --- a/core/core-frontend/src/assets/svg/flow-map-dark.svg +++ b/core/core-frontend/src/assets/svg/flow-map-dark.svg @@ -1,74 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_flow-map_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/flow-map-origin.svg b/core/core-frontend/src/assets/svg/flow-map-origin.svg index a263e1907e..1ab1cd253b 100644 --- a/core/core-frontend/src/assets/svg/flow-map-origin.svg +++ b/core/core-frontend/src/assets/svg/flow-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_flow-map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/flow-map.svg b/core/core-frontend/src/assets/svg/flow-map.svg index 7c3fc1a889..7dac663297 100644 --- a/core/core-frontend/src/assets/svg/flow-map.svg +++ b/core/core-frontend/src/assets/svg/flow-map.svg @@ -1,79 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_flow-map_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/heat-map-dark.svg b/core/core-frontend/src/assets/svg/heat-map-dark.svg index ef33a25f67..e024a30f37 100644 --- a/core/core-frontend/src/assets/svg/heat-map-dark.svg +++ b/core/core-frontend/src/assets/svg/heat-map-dark.svg @@ -1,122 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map-lbs-heat_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/heat-map-origin.svg b/core/core-frontend/src/assets/svg/heat-map-origin.svg index cc501bcbd9..f2d9ce0558 100644 --- a/core/core-frontend/src/assets/svg/heat-map-origin.svg +++ b/core/core-frontend/src/assets/svg/heat-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map-lbs-heat_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/heat-map.svg b/core/core-frontend/src/assets/svg/heat-map.svg index 3970fe95fb..407bff1cd6 100644 --- a/core/core-frontend/src/assets/svg/heat-map.svg +++ b/core/core-frontend/src/assets/svg/heat-map.svg @@ -1,122 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map-lbs-heat_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/map-dark.svg b/core/core-frontend/src/assets/svg/map-dark.svg index bdd14c6a41..5e2f2f1c62 100644 --- a/core/core-frontend/src/assets/svg/map-dark.svg +++ b/core/core-frontend/src/assets/svg/map-dark.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map_dark-01 \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/map-origin.svg b/core/core-frontend/src/assets/svg/map-origin.svg index 54b17b9449..f80a57b984 100644 --- a/core/core-frontend/src/assets/svg/map-origin.svg +++ b/core/core-frontend/src/assets/svg/map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/map.svg b/core/core-frontend/src/assets/svg/map.svg index a14e153f05..ff2b8a3606 100644 --- a/core/core-frontend/src/assets/svg/map.svg +++ b/core/core-frontend/src/assets/svg/map.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/rich-text.svg b/core/core-frontend/src/assets/svg/rich-text.svg index ff6d406b3c..cea3f7eea5 100644 --- a/core/core-frontend/src/assets/svg/rich-text.svg +++ b/core/core-frontend/src/assets/svg/rich-text.svg @@ -1,3 +1,3 @@ - + diff --git a/core/core-frontend/src/assets/svg/symbolic-map-dark.svg b/core/core-frontend/src/assets/svg/symbolic-map-dark.svg index b3364f324d..f8c6e89af7 100644 --- a/core/core-frontend/src/assets/svg/symbolic-map-dark.svg +++ b/core/core-frontend/src/assets/svg/symbolic-map-dark.svg @@ -1,88 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_symbolic-map_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/symbolic-map-origin.svg b/core/core-frontend/src/assets/svg/symbolic-map-origin.svg index fcda4d557c..71a0c1b036 100644 --- a/core/core-frontend/src/assets/svg/symbolic-map-origin.svg +++ b/core/core-frontend/src/assets/svg/symbolic-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_symbolic-map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/symbolic-map.svg b/core/core-frontend/src/assets/svg/symbolic-map.svg index e7b32071ee..aec98583f6 100644 --- a/core/core-frontend/src/assets/svg/symbolic-map.svg +++ b/core/core-frontend/src/assets/svg/symbolic-map.svg @@ -1,93 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_symbolic-map_light \ No newline at end of file diff --git a/core/core-frontend/src/components/dashboard/DbToolbar.vue b/core/core-frontend/src/components/dashboard/DbToolbar.vue index 6fe5928131..a07689c3e0 100644 --- a/core/core-frontend/src/components/dashboard/DbToolbar.vue +++ b/core/core-frontend/src/components/dashboard/DbToolbar.vue @@ -531,7 +531,7 @@ const initOpenHandler = newWindow => { is-label themes="light" placement="bottom" - :base-width="315" + :base-width="328" :icon-name="dvMedia" title="媒体" > diff --git a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue index d248900c1e..ad15008546 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue @@ -195,7 +195,7 @@ const componentBackgroundStyle = computed(() => { if (backgroundColorSelect && backgroundColor) { colorRGBA = backgroundColor } - if (backgroundImageEnable) { + if (backgroundImageEnable || (config.value.innerType === 'VQuery' && backgroundColorSelect)) { if (backgroundType === 'outerImage' && typeof outerImage === 'string') { style['background'] = `url(${imgUrlTrans(outerImage)}) no-repeat ${colorRGBA}` } else { diff --git a/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue b/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue index 751a152cbe..277c5c1bd7 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue @@ -126,6 +126,9 @@ const baseComponentData = computed(() => ) const canvasStyle = computed(() => { let style = {} + if (isMainCanvas(canvasId.value) && !isDashboard()) { + style['overflowY'] = 'hidden !important' + } if (canvasStyleData.value && canvasStyleData.value.width && isMainCanvas(canvasId.value)) { style = { ...getCanvasStyle(canvasStyleData.value), @@ -383,7 +386,9 @@ const filterBtnShow = computed( const datasetParamsInit = item => { customDatasetParamsRef.value?.optInit(item) } - +const dataVPreview = computed( + () => dvInfo.value.type === 'dataV' && canvasId.value === 'canvas-main' +) defineExpose({ restore }) @@ -394,7 +399,7 @@ defineExpose({ :id="domId" class="canvas-container" :style="canvasStyle" - :class="{ 'de-download-custom': downloadStatus }" + :class="{ 'de-download-custom': downloadStatus, 'datav-preview': dataVPreview }" ref="previewCanvas" @mousedown="handleMouseDown" > @@ -467,4 +472,8 @@ defineExpose({ .fix-button { position: fixed !important; } + +.datav-preview { + overflow-y: hidden !important; +} diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index d8d1cfc385..cce3dbea96 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -521,13 +521,14 @@ const handleMouseDownOnShape = e => { const left = curX - startX + startLeft pos['top'] = top pos['left'] = left - // 非主画布非分组画布的情况 需要检测是否从Tab中移除组件(向左移除30px 或者向右移除30px) + // 非主画布非分组画布的情况 需要检测是否从Tab中移除组件(向左移除30px 或者向右移除30px 向左移除30px) + // 因为仪表板中组件向下移动可能只是为了挤占空间 不一定是为了移出 这里无法判断明确意图 暂时支不支持向下移出 // 大屏和仪表板暂时做位置算法区分 仪表板暂时使用curX 因为缩放的影响 大屏使用 tab位置 + 组件位置(相对内部画布)+初始触发点 if ( !isMainCanvas(canvasId.value) && !isGroupCanvas(canvasId.value) && !isGroupArea.value && - (left < -30 || left + componentWidth - canvasWidth > 30) + (top < -30 || left < -30 || left + componentWidth - canvasWidth > 30) ) { contentDisplay.value = false dvMainStore.setMousePointShadowMap({ @@ -869,7 +870,7 @@ const componentBackgroundStyle = computed(() => { if (backgroundColorSelect && backgroundColor) { colorRGBA = backgroundColor } - if (backgroundImageEnable) { + if (backgroundImageEnable || (element.value.innerType === 'VQuery' && backgroundColorSelect)) { if (backgroundType === 'outerImage' && typeof outerImage === 'string') { style['background'] = `url(${imgUrlTrans(outerImage)}) no-repeat ${colorRGBA}` } else { diff --git a/core/core-frontend/src/components/plugin/src/PluginComponent.vue b/core/core-frontend/src/components/plugin/src/PluginComponent.vue index b0e2fc2894..8232500f52 100644 --- a/core/core-frontend/src/components/plugin/src/PluginComponent.vue +++ b/core/core-frontend/src/components/plugin/src/PluginComponent.vue @@ -12,6 +12,7 @@ import * as vueRouter from 'vue-router' import { useEmitt } from '@/hooks/web/useEmitt' import request from '@/config/axios' const { wsCache } = useCache() +import { isNull } from '@/utils/utils' const plugin = ref() @@ -103,11 +104,15 @@ onMounted(async () => { let distributed = false if (wsCache.get(key) === null) { const res = await xpackModelApi() - wsCache.set('xpack-model-distributed', res.data) + wsCache.set('xpack-model-distributed', isNull(res.data) ? 'null' : res.data) distributed = res.data } else { distributed = wsCache.get(key) } + if (isNull(distributed)) { + emits('loadFail') + return + } if (distributed) { const moduleName = getModuleName() if (window[moduleName]) { diff --git a/core/core-frontend/src/components/plugin/src/index.vue b/core/core-frontend/src/components/plugin/src/index.vue index 3072a48018..9718f639b4 100644 --- a/core/core-frontend/src/components/plugin/src/index.vue +++ b/core/core-frontend/src/components/plugin/src/index.vue @@ -12,6 +12,7 @@ import * as echarts from 'echarts' import router from '@/router' import tinymce from 'tinymce/tinymce' import { useEmitt } from '@/hooks/web/useEmitt' +import { isNull } from '@/utils/utils' const { wsCache } = useCache() @@ -107,11 +108,16 @@ onMounted(async () => { let distributed = false if (wsCache.get(key) === null) { const res = await xpackModelApi() - wsCache.set('xpack-model-distributed', res.data) + const resData = isNull(res.data) ? 'null' : res.data + wsCache.set('xpack-model-distributed', resData) distributed = res.data } else { distributed = wsCache.get(key) } + if (isNull(distributed)) { + emits('loadFail') + return + } if (distributed) { if (window['DEXPack']) { const xpack = await window['DEXPack'].mapping[attrs.jsname] diff --git a/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue b/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue index a45295e95f..db133a1fbf 100644 --- a/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue +++ b/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue @@ -141,6 +141,12 @@ placeholder="选择边框..." @change="onBackgroundChange" > + +
+ +
+ + + + + diff --git a/core/core-frontend/src/custom-component/common/CommonAttr.vue b/core/core-frontend/src/custom-component/common/CommonAttr.vue index 6b72fd10dc..8dd90c553a 100644 --- a/core/core-frontend/src/custom-component/common/CommonAttr.vue +++ b/core/core-frontend/src/custom-component/common/CommonAttr.vue @@ -143,7 +143,9 @@ const stopEvent = e => { - + + + { - eventBus.emit('handleNew', { componentName: params, innerType: params }) +const newComponent = (componentName, innerType) => { + eventBus.emit('handleNew', { componentName: componentName, innerType: innerType }) } const handleDragStart = e => { @@ -47,25 +48,36 @@ const handleDragEnd = e => { @@ -73,6 +85,9 @@ const handleDragEnd = e => { diff --git a/core/core-frontend/src/custom-component/picture-group/Attr.vue b/core/core-frontend/src/custom-component/picture-group/Attr.vue index a318a73ae0..5644779aa0 100644 --- a/core/core-frontend/src/custom-component/picture-group/Attr.vue +++ b/core/core-frontend/src/custom-component/picture-group/Attr.vue @@ -1,200 +1,60 @@ diff --git a/core/core-frontend/src/custom-component/picture-group/PictureGroupThreshold.vue b/core/core-frontend/src/custom-component/picture-group/PictureGroupThreshold.vue new file mode 100644 index 0000000000..f9a6cfe7e0 --- /dev/null +++ b/core/core-frontend/src/custom-component/picture-group/PictureGroupThreshold.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue b/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue new file mode 100644 index 0000000000..a318a73ae0 --- /dev/null +++ b/core/core-frontend/src/custom-component/picture-group/PictureGroupUploadAttr.vue @@ -0,0 +1,358 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/picture-group/PictureItem.vue b/core/core-frontend/src/custom-component/picture-group/PictureItem.vue new file mode 100644 index 0000000000..d50f91cf19 --- /dev/null +++ b/core/core-frontend/src/custom-component/picture-group/PictureItem.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/picture-group/PictureOptionPrefix.vue b/core/core-frontend/src/custom-component/picture-group/PictureOptionPrefix.vue new file mode 100644 index 0000000000..2dd329338e --- /dev/null +++ b/core/core-frontend/src/custom-component/picture-group/PictureOptionPrefix.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue index 9d862c47bd..4263a24ffb 100644 --- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue +++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue @@ -6,6 +6,7 @@ @keyup.stop @dblclick="setEdit" @click="onClick" + :style="richTextStyle" > { @@ -182,6 +204,7 @@ watch( canEdit.value = false reShow() myValue.value = assignment(element.value.propValue.textValue) + console.log('===myValue.value=' + myValue.value) ed.setContent(myValue.value) } } @@ -241,6 +264,23 @@ const initCurFieldsChange = () => { } } +const jumpTargetAdaptor = () => { + setTimeout(() => { + const paragraphs = document.querySelectorAll('p') + paragraphs.forEach(p => { + // 如果 p 标签已经有 onclick 且包含 event.stopPropagation,则跳过 + if ( + p.getAttribute('onclick') && + p.getAttribute('onclick').includes('event.stopPropagation()') + ) { + return // 已经有 stopPropagation,跳过 + } + // 否则添加 onclick 事件 + p.setAttribute('onclick', 'event.stopPropagation()') + }) + }, 1000) +} + const assignment = content => { const on = content.match(/\[(.+?)\]/g) if (on) { @@ -266,8 +306,10 @@ const assignment = content => { //De 本地跳转失效问题 content = content.replace(/href="#\//g, 'href="/#/') content = content.replace(/href=\\"#\//g, 'href=\\"/#/') + content = content.replace(/href=\\"#\//g, 'href=\\"/#/') resetSelect() initFontFamily(content) + jumpTargetAdaptor() return content } const initFontFamily = htmlText => { @@ -561,6 +603,8 @@ const conditionAdaptor = (chart: Chart) => { return res } +const richTextStyle = computed(() => [{ '--de-canvas-scale': props.scale }]) + onMounted(() => { viewInit() }) @@ -583,6 +627,12 @@ defineExpose({ width: 0px !important; height: 0px !important; } + ::v-deep(p) { + zoom: var(--de-canvas-scale); + } + ::v-deep(td span) { + zoom: var(--de-canvas-scale); + } } :deep(.ol) { diff --git a/core/core-frontend/src/custom-component/user-view/Component.vue b/core/core-frontend/src/custom-component/user-view/Component.vue index 74187ef5fa..b43a501d71 100644 --- a/core/core-frontend/src/custom-component/user-view/Component.vue +++ b/core/core-frontend/src/custom-component/user-view/Component.vue @@ -58,18 +58,19 @@ const props = defineProps({ const { element, view, active, searchCount, scale } = toRefs(props) const autoStyle = computed(() => { - if (element.value.innerType === 'rich-text') { - return { - position: 'absolute', - height: 100 / scale.value + '%!important', - width: 100 / scale.value + '%!important', - left: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2 - top: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2 - transform: 'scale(' + scale.value + ')' - } as CSSProperties - } else { - return {} - } + return {} + // if (element.value.innerType === 'rich-text') { + // return { + // position: 'absolute', + // height: 100 / scale.value + '%!important', + // width: 100 / scale.value + '%!important', + // left: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2 + // top: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2 + // transform: 'scale(' + scale.value + ') translateZ(0)' + // } as CSSProperties + // } else { + // return {} + // } }) const emits = defineEmits(['onPointClick']) diff --git a/core/core-frontend/src/custom-component/v-query/Component.vue b/core/core-frontend/src/custom-component/v-query/Component.vue index 02776ec0b9..10170dc402 100644 --- a/core/core-frontend/src/custom-component/v-query/Component.vue +++ b/core/core-frontend/src/custom-component/v-query/Component.vue @@ -18,7 +18,8 @@ import { onBeforeMount, CSSProperties, shallowRef, - provide + provide, + nextTick } from 'vue' import { storeToRefs } from 'pinia' import { useI18n } from '@/hooks/web/useI18n' @@ -57,12 +58,15 @@ const props = defineProps({ }) const { element, view, scale } = toRefs(props) const { t } = useI18n() +const vQueryRef = ref() const dvMainStore = dvMainStoreWithOut() const { curComponent, canvasViewInfo, mobileInPc, firstLoadMap } = storeToRefs(dvMainStore) const canEdit = ref(false) const queryConfig = ref() const defaultStyle = { border: '', + placeholderSize: 14, + placeholderShow: true, background: '', text: '', layout: 'horizontal', @@ -111,6 +115,27 @@ const btnStyle = computed(() => { return style }) + +const btnPlainStyle = computed(() => { + const style = { + backgroundColor: 'transparent', + borderColor: customStyle.btnColor, + color: customStyle.btnColor + } as CSSProperties + if (customStyle.fontSizeBtn) { + style.fontSize = customStyle.fontSizeBtn + 'px' + } + + if (customStyle.fontWeightBtn) { + style.fontWeight = customStyle.fontWeightBtn + } + + if (customStyle.fontStyleBtn) { + style.fontStyle = customStyle.fontStyleBtn + } + + return style +}) const curComponentView = computed(() => { return (canvasViewInfo.value[element.value.id] || {}).customStyle }) @@ -130,7 +155,6 @@ const setCustomStyle = val => { layout, titleShow, titleColor, - textColorShow, title, fontSize, fontWeight, @@ -143,12 +167,22 @@ const setCustomStyle = val => { queryConditionSpacing, labelColorBtn, btnColor, + placeholderSize, + placeholderShow, labelShow } = val customStyle.background = bgColorShow ? bgColor || '' : '' customStyle.border = borderShow ? borderColor || '' : '' customStyle.btnList = [...btnList] customStyle.layout = layout + customStyle.placeholderShow = placeholderShow ?? true + customStyle.placeholderSize = placeholderSize ?? 14 + nextTick(() => { + vQueryRef.value.style.setProperty( + '--ed-component-size', + `${customStyle.placeholderSize + 18}px` + ) + }) customStyle.titleShow = titleShow customStyle.titleColor = titleColor customStyle.labelColor = labelShow ? labelColor || '' : '' @@ -156,7 +190,7 @@ const setCustomStyle = val => { customStyle.fontWeight = labelShow ? fontWeight || '' : '' customStyle.fontStyle = labelShow ? fontStyle || '' : '' customStyle.title = title - customStyle.text = textColorShow ? text || '' : '' + customStyle.text = customStyle.placeholderShow ? text || '' : '' customStyle.titleLayout = titleLayout customStyle.fontSizeBtn = fontSizeBtn || '14' customStyle.fontWeightBtn = fontWeightBtn @@ -271,6 +305,12 @@ const getCascadeList = () => { return props.element.cascade } +const getPlaceholder = computed(() => { + return { + placeholderShow: customStyle.placeholderShow + } +}) + const isConfirmSearch = id => { if (componentWithSure.value) return queryDataForId(id) @@ -282,6 +322,7 @@ provide('release-unmount-select', releaseSelect) provide('query-data-for-id', queryDataForId) provide('com-width', getQueryConditionWidth) provide('cascade-list', getCascadeList) +provide('placeholder', getPlaceholder) onBeforeUnmount(() => { emitter.off(`addQueryCriteria${element.value.id}`) @@ -449,6 +490,10 @@ watch( } ) +const boxWidth = computed(() => { + return `${customStyle.placeholderSize}px` +}) + const queryData = () => { let requiredName = '' const emitterList = (element.value.propValue || []).reduce((pre, next) => { @@ -536,14 +581,14 @@ const autoStyle = computed(() => { width: 100 / scale.value + '%!important', left: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2 top: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2 - transform: 'scale(' + scale.value + ')', + transform: 'scale(' + scale.value + ') translateZ(0)', opacity: element.value?.style?.opacity || 1 } as CSSProperties })