forked from github/dataease
feat: [AntV组合图] 支持纬度排序
This commit is contained in:
parent
fd6599896e
commit
7794cc5150
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
mvn clean package
|
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
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
"cost": 0,
|
"cost": 0,
|
||||||
"category": "view",
|
"category": "view",
|
||||||
"descript": "AntV G2Plot 组合图插件",
|
"descript": "AntV G2Plot 组合图插件",
|
||||||
"version": "1.18.9",
|
"version": "1.18.10",
|
||||||
"creator": "DATAEASE",
|
"creator": "DATAEASE",
|
||||||
"moduleName": "view-chartmix-backend",
|
"moduleName": "view-chartmix-backend",
|
||||||
"require": "1.18.9",
|
"require": "1.18.10",
|
||||||
"dsType": ""
|
"dsType": ""
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.plugins.view.official.handler;
|
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.constants.datasource.SQLConstants;
|
||||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||||
import io.dataease.plugins.common.util.ConstantsUtil;
|
import io.dataease.plugins.common.util.ConstantsUtil;
|
||||||
@ -19,7 +20,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DefaultViewStatHandler implements PluginViewStatHandler {
|
public class ChartMixViewStatHandler implements PluginViewStatHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {
|
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> 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());
|
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<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());
|
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<>();
|
List<PluginViewSQL> orders = new ArrayList<>();
|
||||||
orders.addAll(xOrders);
|
orders.addAll(xOrders);
|
||||||
orders.addAll(yOrders);
|
orders.addAll(yOrders);
|
||||||
|
|
||||||
|
System.out.println("11111111 orders: " + new Gson().toJson(orders));
|
||||||
|
|
||||||
List<String> aggWheres = new ArrayList<>();
|
List<String> aggWheres = new ArrayList<>();
|
||||||
aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList()));
|
aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList()));
|
||||||
|
|
@ -3,7 +3,7 @@ package io.dataease.plugins.view.official.impl;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import io.dataease.plugins.common.dto.StaticResource;
|
import io.dataease.plugins.common.dto.StaticResource;
|
||||||
import io.dataease.plugins.view.entity.*;
|
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 io.dataease.plugins.view.service.ViewPluginService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -110,11 +110,10 @@ public class ChartMixService extends ViewPluginService {
|
|||||||
if (CollectionUtils.isNotEmpty(yAxisExt)) {
|
if (CollectionUtils.isNotEmpty(yAxisExt)) {
|
||||||
yAxis.addAll(yAxisExt);
|
yAxis.addAll(yAxisExt);
|
||||||
}*/
|
}*/
|
||||||
System.out.println(new Gson().toJson(yAxis));
|
|
||||||
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis)) {
|
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String sql = new DefaultViewStatHandler().build(param, this);
|
String sql = new ChartMixViewStatHandler().build(param, this);
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
return sql;
|
return sql;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<!-- <el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
placement="right-start"
|
placement="right-start"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -83,7 +83,7 @@
|
|||||||
<span>{{ $t('chart.sort') }}</span>
|
<span>{{ $t('chart.sort') }}</span>
|
||||||
<span class="summary-span-item">({{ $t('chart.' + item.sort) }})</span>
|
<span class="summary-span-item">({{ $t('chart.' + item.sort) }})</span>
|
||||||
</span>
|
</span>
|
||||||
<i class="el-icon-arrow-right el-icon--right"/>
|
<i class="el-icon-arrow-right el-icon--right"/>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
|
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
|
||||||
@ -95,8 +95,8 @@
|
|||||||
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>
|
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-dropdown-item>-->
|
</el-dropdown-item>
|
||||||
<!-- <el-dropdown-item
|
<!-- <el-dropdown-item
|
||||||
v-show="item.deType === 1"
|
v-show="item.deType === 1"
|
||||||
divided
|
divided
|
||||||
>
|
>
|
@ -8,7 +8,7 @@
|
|||||||
<draggable v-model="view.xaxis" group="drag" animation="300" :move="onMove" class="drag-block-style"
|
<draggable v-model="view.xaxis" group="drag" animation="300" :move="onMove" class="drag-block-style"
|
||||||
@add="addXaxis" @update="calcData(true)">
|
@add="addXaxis" @update="calcData(true)">
|
||||||
<transition-group class="draggable-group">
|
<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"
|
:param="param"
|
||||||
:index="0"
|
:index="0"
|
||||||
:item="item"
|
:item="item"
|
||||||
@ -98,7 +98,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import SankeyDimensionItem from '@/components/views/SankeyDimensionItem'
|
import DimensionItem from '@/components/views/DimensionItem'
|
||||||
import QuotaItem from '@/components/views/QuotaItem'
|
import QuotaItem from '@/components/views/QuotaItem'
|
||||||
import QuotaExtItem from '@/components/views/QuotaExtItem'
|
import QuotaExtItem from '@/components/views/QuotaExtItem'
|
||||||
import FilterItem from '@/components/views/FilterItem'
|
import FilterItem from '@/components/views/FilterItem'
|
||||||
@ -118,7 +118,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
SankeyDimensionItem,
|
DimensionItem,
|
||||||
QuotaItem,
|
QuotaItem,
|
||||||
QuotaExtItem,
|
QuotaExtItem,
|
||||||
FilterItem
|
FilterItem
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package io.dataease.plugins.view.official.handler;
|
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.constants.datasource.SQLConstants;
|
||||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||||
import io.dataease.plugins.common.util.ConstantsUtil;
|
import io.dataease.plugins.common.util.ConstantsUtil;
|
||||||
@ -21,7 +20,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DefaultViewStatHandler implements PluginViewStatHandler {
|
public class RaceBarViewStatHandler implements PluginViewStatHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {
|
public String build(PluginViewParam pluginViewParam, ViewPluginService viewPluginService) {
|
@ -1,11 +1,10 @@
|
|||||||
package io.dataease.plugins.view.official.impl;
|
package io.dataease.plugins.view.official.impl;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import io.dataease.plugins.common.dto.StaticResource;
|
import io.dataease.plugins.common.dto.StaticResource;
|
||||||
import io.dataease.plugins.view.entity.PluginViewField;
|
import io.dataease.plugins.view.entity.PluginViewField;
|
||||||
import io.dataease.plugins.view.entity.PluginViewParam;
|
import io.dataease.plugins.view.entity.PluginViewParam;
|
||||||
import io.dataease.plugins.view.entity.PluginViewType;
|
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 io.dataease.plugins.view.service.ViewPluginService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
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) {
|
if (CollectionUtils.isEmpty(xAxis) || CollectionUtils.isEmpty(yAxis) || xAxis.size() < 2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String sql = new DefaultViewStatHandler().build(param, this);
|
String sql = new RaceBarViewStatHandler().build(param, this);
|
||||||
return sql;
|
return sql;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user