diff --git a/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 63306c1af5..adc6fe33ce 100644 --- a/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -1474,6 +1474,8 @@ public class ChartViewService { List pluginViewFields = fieldMap.entrySet().stream().flatMap(entry -> entry.getValue().stream().map(field -> { PluginViewField pluginViewField = BeanUtils.copyBean(new PluginViewField(), field); + pluginViewField.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken>() { + }.getType())); pluginViewField.setTypeField(entry.getKey()); return pluginViewField; })).collect(Collectors.toList()); diff --git a/core/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java b/core/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java index 97b44fe33f..36c9eb843b 100644 --- a/core/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java +++ b/core/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java @@ -2,6 +2,7 @@ package io.dataease.service.chart; import cn.hutool.core.util.ReflectUtil; import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; import io.dataease.commons.model.PluginViewSetImpl; import io.dataease.commons.utils.TableUtils; import io.dataease.controller.request.chart.ChartExtRequest; @@ -14,6 +15,7 @@ import io.dataease.plugins.common.constants.DatasetType; import io.dataease.plugins.common.constants.datasource.SQLConstants; import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO; import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO; +import io.dataease.plugins.common.dto.chart.ChartViewFieldFilterDTO; import io.dataease.plugins.common.dto.sqlObj.SQLObj; import io.dataease.plugins.common.request.chart.ChartExtFilterRequest; import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO; @@ -247,6 +249,9 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService { methodName = "getYWheres"; } ChartViewFieldDTO chartViewFieldDTO = BeanUtils.copyBean(new ChartViewFieldDTO(), field); + chartViewFieldDTO.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken>() { + }.getType())); + Object execResult; if ((execResult = execProviderMethod(queryProvider, methodName, chartViewFieldDTO, originField, fieldAlias)) != null) { String where = (String) execResult; diff --git a/core/frontend/src/components/canvas/components/editor/SettingMenu.vue b/core/frontend/src/components/canvas/components/editor/SettingMenu.vue index 797dcb83e8..7b06044173 100644 --- a/core/frontend/src/components/canvas/components/editor/SettingMenu.vue +++ b/core/frontend/src/components/canvas/components/editor/SettingMenu.vue @@ -5,7 +5,7 @@ trigger="click" @mouseup="handleMouseUp" > - + {{ $t('panel.copy') }} (+ D Control + D) + >{{ $t('panel.copy') }} (+ D Control + D) - {{ $t('panel.level') }} + {{ $t('panel.level') }} {{ $t('panel.hyperlinks') }} + >{{ $t('panel.hyperlinks') }} - + {{ $t('panel.position_adjust') }} @@ -180,7 +179,7 @@ import TabCarouselDialog from '@/components/canvas/components/editor/TabCarousel import CustomTabsSort from '@/components/widget/deWidget/CustomTabsSort' export default { - components: { CustomTabsSort, HyperlinksDialog,TabCarouselDialog }, + components: { CustomTabsSort, HyperlinksDialog, TabCarouselDialog }, data() { return { tabCarouselVisible: false, @@ -193,7 +192,8 @@ export default { 'text', 'label', 'flow-map', - 'bidirectional-bar' + 'bidirectional-bar', + 'race-bar' ], linkageExcludeViewType: [ 'richTextView', @@ -202,7 +202,8 @@ export default { 'text', 'label', 'flow-map', - 'bidirectional-bar' + 'bidirectional-bar', + 'race-bar' ], copyData: null, hyperlinksSetVisible: false, diff --git a/extensions/dataease-extensions-view/view-chartmix/view-chartmix-backend/src/main/java/io/dataease/plugins/view/official/handler/ChartMixViewStatHandler.java b/extensions/dataease-extensions-view/view-chartmix/view-chartmix-backend/src/main/java/io/dataease/plugins/view/official/handler/ChartMixViewStatHandler.java index b23b5062fa..55d05e2620 100644 --- a/extensions/dataease-extensions-view/view-chartmix/view-chartmix-backend/src/main/java/io/dataease/plugins/view/official/handler/ChartMixViewStatHandler.java +++ b/extensions/dataease-extensions-view/view-chartmix/view-chartmix-backend/src/main/java/io/dataease/plugins/view/official/handler/ChartMixViewStatHandler.java @@ -45,7 +45,6 @@ public class ChartMixViewStatHandler implements PluginViewStatHandler { List xFields = fieldSQLMap.getOrDefault("xAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList()); List xOrders = fieldSQLMap.getOrDefault("xAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(PluginSingleField::getSort).collect(Collectors.toList()); - System.out.println("11111111 orders:"+new Gson().toJson(xOrders)); // List xWheres = fieldSQLMap.get("xAxis").stream().map(singleField -> singleField.getWhere()).collect(Collectors.toList()); List yFields = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList()); @@ -79,7 +78,6 @@ public class ChartMixViewStatHandler implements PluginViewStatHandler { orders.addAll(xOrders); orders.addAll(yOrders); - System.out.println("11111111 orders: " + new Gson().toJson(orders)); List aggWheres = new ArrayList<>(); aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList())); diff --git a/extensions/dataease-extensions-view/view-chartmix/view-chartmix-frontend/src/components/selector/TooltipSelector.vue b/extensions/dataease-extensions-view/view-chartmix/view-chartmix-frontend/src/components/selector/TooltipSelector.vue index c59e0f6185..2461555af5 100644 --- a/extensions/dataease-extensions-view/view-chartmix/view-chartmix-frontend/src/components/selector/TooltipSelector.vue +++ b/extensions/dataease-extensions-view/view-chartmix/view-chartmix-frontend/src/components/selector/TooltipSelector.vue @@ -122,6 +122,9 @@ export default { .form-item>>>.el-form-item__label{ font-size: 12px; } +.form-item ::v-deep .el-form-item__label { + font-size: 12px; +} .el-select-dropdown__item{ padding: 0 20px; } diff --git a/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/handler/RaceBarViewStatHandler.java b/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/handler/RaceBarViewStatHandler.java index 4c31689de3..e5187964de 100644 --- a/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/handler/RaceBarViewStatHandler.java +++ b/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/handler/RaceBarViewStatHandler.java @@ -49,20 +49,14 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler { } - List xFields = fieldSQLMap.getOrDefault("xAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList()); + List xFields = fieldSQLMap.get("xAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(singleField -> singleField.getField()).collect(Collectors.toList()); + List xOrders = fieldSQLMap.get("xAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(singleField -> singleField.getSort()).collect(Collectors.toList()); // List xWheres = fieldSQLMap.get("xAxis").stream().map(singleField -> singleField.getWhere()).collect(Collectors.toList()); List yFields = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList()); - List yWheres = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(PluginSingleField::getWhere).collect(Collectors.toList()); + List yWheres = fieldSQLMap.get("yAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(singleField -> singleField.getWhere()).collect(Collectors.toList()); - /*List yExtFields = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList()); - List yExtOrders = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(PluginSingleField::getSort).collect(Collectors.toList()); - List yExtWheres = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(PluginSingleField::getWhere).collect(Collectors.toList()); - - yFields.addAll(yExtFields); - yOrders.addAll(yExtOrders); - yWheres.addAll(yExtWheres);*/ // 处理视图中字段过滤 String customWheres = baseService.customWhere(dsType, pluginViewParam.getPluginChartFieldCustomFilters(), tableObj); @@ -75,9 +69,15 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler { if (customWheres != null) wheres.add(customWheres); if (panelWheres != null) wheres.add(panelWheres); if (permissionWhere != null) wheres.add(permissionWhere); + List groups = new ArrayList<>(); groups.addAll(xFields); + + List orders = new ArrayList<>(); + orders.addAll(xOrders); + + // 外层再次套sql List aggWheres = new ArrayList<>(); aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList())); @@ -99,7 +99,9 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler { .tableAlias(String.format(table_alias_prefix, 1)) .build(); if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres); + if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders); if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL); + return baseService.sqlLimit(dsType, st.render(), pluginViewParam.getPluginViewLimit()); } diff --git a/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/impl/RaceBarService.java b/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/impl/RaceBarService.java index 4cc2e91127..a70b680992 100644 --- a/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/impl/RaceBarService.java +++ b/extensions/dataease-extensions-view/view-racebar/view-racebar-backend/src/main/java/io/dataease/plugins/view/official/impl/RaceBarService.java @@ -40,9 +40,9 @@ public class RaceBarService extends ViewPluginService { private static final Map VIEW_STYLE_PROPERTY_INNER = new HashMap<>(); static { - VIEW_STYLE_PROPERTY_INNER.put("color-selector", new String[]{"value", "alpha"}); - VIEW_STYLE_PROPERTY_INNER.put("label-selector", new String[]{"show", "fontSize", "color", "position", "formatter"}); - VIEW_STYLE_PROPERTY_INNER.put("tooltip-selector", new String[]{"show", "textStyle", "formatter"}); + VIEW_STYLE_PROPERTY_INNER.put("color-selector", new String[]{"value"}); + VIEW_STYLE_PROPERTY_INNER.put("label-selector", new String[]{"show", "fontSize", "color", "position"}); + VIEW_STYLE_PROPERTY_INNER.put("tooltip-selector", new String[]{"show", "textStyle",}); VIEW_STYLE_PROPERTY_INNER.put("title-selector", new String[]{"show", "title", "fontSize", "color", "hPosition", "vPosition", "isItalic", "isBolder"}); } @@ -107,6 +107,7 @@ public class RaceBarService extends ViewPluginService { return null; } String sql = new RaceBarViewStatHandler().build(param, this); + return sql; } @@ -143,10 +144,21 @@ public class RaceBarService extends ViewPluginService { map.put("encode", encode); Set xs = new HashSet<>(); + Set keySet = new HashSet<>(); + List keyList = new ArrayList<>(); + data.forEach(ss -> { xs.add(ss[encode.get("y")]); + + String key = ss[(Integer) map.get("extIndex")]; + if (!keySet.contains(key)) { + keySet.add(key); + keyList.add(key); + } + }); + Map> groupData = data.stream().collect(Collectors.toMap( k -> k[(Integer) map.get("extIndex")], v -> { @@ -160,24 +172,12 @@ public class RaceBarService extends ViewPluginService { }) ); - for (String key : groupData.keySet()) { - String finalType = type; - groupData.put(key, groupData.get(key).stream().sorted((o1, o2) -> { - if (StringUtils.equals(finalType, "LONG")) { - return Long.valueOf(o2[encode.get("x")]).compareTo(Long.valueOf(o1[encode.get("x")])); - } else if (StringUtils.equals(finalType, "DOUBLE")) { - return Double.valueOf(o2[encode.get("x")]).compareTo(Double.valueOf(o1[encode.get("x")])); - } - return o2[encode.get("x")].compareTo(o1[encode.get("x")]); - }).collect(Collectors.toList())); - - } map.put("groupData", groupData); - map.put("extXs", new ArrayList<>(groupData.keySet()).stream().sorted().collect(Collectors.toList())); + map.put("extXs", keyList); - map.put("xs", new ArrayList<>(xs).stream().sorted().collect(Collectors.toList())); + map.put("xs", xs); return map; } diff --git a/extensions/dataease-extensions-view/view-racebar/view-racebar-frontend/src/components/selector/TooltipSelector.vue b/extensions/dataease-extensions-view/view-racebar/view-racebar-frontend/src/components/selector/TooltipSelector.vue index bba74bfd46..bb93c0abcb 100644 --- a/extensions/dataease-extensions-view/view-racebar/view-racebar-frontend/src/components/selector/TooltipSelector.vue +++ b/extensions/dataease-extensions-view/view-racebar/view-racebar-frontend/src/components/selector/TooltipSelector.vue @@ -17,6 +17,17 @@ + + + + >>.el-form-item__label{ font-size: 12px; } +.form-item ::v-deep .el-form-item__label { + font-size: 12px; +} .el-select-dropdown__item{ padding: 0 20px; }