feat: [AntV组合图] 支持纬度排序

This commit is contained in:
ulleo 2023-09-06 14:55:21 +08:00
parent fd6599896e
commit 7794cc5150
8 changed files with 96 additions and 93 deletions

View File

@ -1,8 +1,8 @@
#!/bin/sh
mvn clean package
cp view-chartmix-backend/target/view-chartmix-backend-1.18.9.jar .
cp view-chartmix-backend/target/view-chartmix-backend-1.18.10.jar .
zip -r chartmix.zip ./view-chartmix-backend-1.18.9.jar ./plugin.json
zip -r chartmix.zip ./view-chartmix-backend-1.18.10.jar ./plugin.json
rm -f ./view-chartmix-backend-1.18.9.jar
rm -f ./view-chartmix-backend-1.18.10.jar

View File

@ -5,9 +5,9 @@
"cost": 0,
"category": "view",
"descript": "AntV G2Plot 组合图插件",
"version": "1.18.9",
"version": "1.18.10",
"creator": "DATAEASE",
"moduleName": "view-chartmix-backend",
"require": "1.18.9",
"require": "1.18.10",
"dsType": ""
}

View File

@ -1,5 +1,6 @@
package io.dataease.plugins.view.official.handler;
import com.google.gson.Gson;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.util.ConstantsUtil;
@ -19,7 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class DefaultViewStatHandler implements PluginViewStatHandler {
public class ChartMixViewStatHandler implements PluginViewStatHandler {
@Override
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {
@ -43,6 +44,8 @@ public class DefaultViewStatHandler implements PluginViewStatHandler {
List<PluginViewSQL> xFields = fieldSQLMap.getOrDefault("xAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList());
List<PluginViewSQL> 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<String> xWheres = fieldSQLMap.get("xAxis").stream().map(singleField -> singleField.getWhere()).collect(Collectors.toList());
List<PluginViewSQL> yFields = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList());
@ -75,6 +78,9 @@ public class DefaultViewStatHandler implements PluginViewStatHandler {
List<PluginViewSQL> orders = new ArrayList<>();
orders.addAll(xOrders);
orders.addAll(yOrders);
System.out.println("11111111 orders: " + new Gson().toJson(orders));
List<String> aggWheres = new ArrayList<>();
aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList()));

View File

@ -3,7 +3,7 @@ package io.dataease.plugins.view.official.impl;
import com.google.gson.Gson;
import io.dataease.plugins.common.dto.StaticResource;
import io.dataease.plugins.view.entity.*;
import io.dataease.plugins.view.official.handler.DefaultViewStatHandler;
import io.dataease.plugins.view.official.handler.ChartMixViewStatHandler;
import io.dataease.plugins.view.service.ViewPluginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -110,11 +110,10 @@ public class ChartMixService extends ViewPluginService {
if (CollectionUtils.isNotEmpty(yAxisExt)) {
yAxis.addAll(yAxisExt);
}*/
System.out.println(new Gson().toJson(yAxis));
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis)) {
return null;
}
String sql = new DefaultViewStatHandler().build(param, this);
String sql = new ChartMixViewStatHandler().build(param, this);
System.out.println(sql);
return sql;

View File

@ -70,7 +70,7 @@
/>
</el-tag>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item>
<el-dropdown-item>
<el-dropdown
placement="right-start"
size="mini"
@ -83,7 +83,7 @@
<span>{{ $t('chart.sort') }}</span>
<span class="summary-span-item">({{ $t('chart.' + item.sort) }})</span>
</span>
<i class="el-icon-arrow-right el-icon&#45;&#45;right"/>
<i class="el-icon-arrow-right el-icon--right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
@ -95,8 +95,8 @@
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>-->
<!-- <el-dropdown-item
</el-dropdown-item>
<!-- <el-dropdown-item
v-show="item.deType === 1"
divided
>

View File

@ -8,7 +8,7 @@
<draggable v-model="view.xaxis" group="drag" animation="300" :move="onMove" class="drag-block-style"
@add="addXaxis" @update="calcData(true)">
<transition-group class="draggable-group">
<sankey-dimension-item v-for="(item,index) in view.xaxis" :key="index"
<dimension-item v-for="(item,index) in view.xaxis" :key="index"
:param="param"
:index="0"
:item="item"
@ -98,7 +98,7 @@
</template>
<script>
import SankeyDimensionItem from '@/components/views/SankeyDimensionItem'
import DimensionItem from '@/components/views/DimensionItem'
import QuotaItem from '@/components/views/QuotaItem'
import QuotaExtItem from '@/components/views/QuotaExtItem'
import FilterItem from '@/components/views/FilterItem'
@ -118,7 +118,7 @@ export default {
},
},
components: {
SankeyDimensionItem,
DimensionItem,
QuotaItem,
QuotaExtItem,
FilterItem

View File

@ -1,6 +1,5 @@
package io.dataease.plugins.view.official.handler;
import com.google.gson.Gson;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.util.ConstantsUtil;
@ -21,7 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class DefaultViewStatHandler implements PluginViewStatHandler {
public class RaceBarViewStatHandler implements PluginViewStatHandler {
@Override
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {

View File

@ -1,11 +1,10 @@
package io.dataease.plugins.view.official.impl;
import com.google.gson.Gson;
import io.dataease.plugins.common.dto.StaticResource;
import io.dataease.plugins.view.entity.PluginViewField;
import io.dataease.plugins.view.entity.PluginViewParam;
import io.dataease.plugins.view.entity.PluginViewType;
import io.dataease.plugins.view.official.handler.DefaultViewStatHandler;
import io.dataease.plugins.view.official.handler.RaceBarViewStatHandler;
import io.dataease.plugins.view.service.ViewPluginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -107,7 +106,7 @@ public class RaceBarService extends ViewPluginService {
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis) || xAxis.size() < 2) {
return null;
}
String sql = new DefaultViewStatHandler().build(param, this);
String sql = new RaceBarViewStatHandler().build(param, this);
return sql;
}