forked from github/dataease
feat: [AntV组合图] 支持纬度排序
This commit is contained in:
parent
fd6599896e
commit
7794cc5150
@ -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
|
||||
|
@ -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": ""
|
||||
}
|
||||
|
@ -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()));
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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--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,82 +95,82 @@
|
||||
>{{ $t('chart.custom_sort') }}...</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>-->
|
||||
<!-- <el-dropdown-item
|
||||
v-show="item.deType === 1"
|
||||
divided
|
||||
>
|
||||
<el-dropdown
|
||||
placement="right-start"
|
||||
size="mini"
|
||||
style="width: 100%"
|
||||
@command="dateStyle"
|
||||
>
|
||||
<span class="el-dropdown-link inner-dropdown-menu">
|
||||
<span>
|
||||
<i class="el-icon-c-scale-to-original"/>
|
||||
<span>{{ $t('chart.dateStyle') }}</span>
|
||||
<span class="summary-span-item">({{ $t('chart.' + item.dateStyle) }})</span>
|
||||
</span>
|
||||
<i class="el-icon-arrow-right el-icon--right"/>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeDateStyle('y')">{{ $t('chart.y') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="showDateExt"
|
||||
:command="beforeDateStyle('y_Q')"
|
||||
>{{ $t('chart.y_Q') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M')">{{ $t('chart.y_M') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="showDateExt"
|
||||
:command="beforeDateStyle('y_W')"
|
||||
>{{ $t('chart.y_W') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M_d')">{{ $t('chart.y_M_d') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:command="beforeDateStyle('H_m_s')"
|
||||
divided
|
||||
>{{ $t('chart.H_m_s') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m')">{{ $t('chart.y_M_d_H_m') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m_s')">{{
|
||||
$t('chart.y_M_d_H_m_s')
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-show="item.deType === 1">
|
||||
<el-dropdown
|
||||
placement="right-start"
|
||||
size="mini"
|
||||
style="width: 100%"
|
||||
@command="datePattern"
|
||||
>
|
||||
<span class="el-dropdown-link inner-dropdown-menu">
|
||||
<span>
|
||||
<i class="el-icon-timer"/>
|
||||
<span>{{ $t('chart.datePattern') }}</span>
|
||||
<span class="summary-span-item">({{ $t('chart.' + item.datePattern) }})</span>
|
||||
</span>
|
||||
<i class="el-icon-arrow-right el-icon--right"/>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeDatePattern('date_sub')">{{
|
||||
$t('chart.date_sub')
|
||||
}}(1990-01-01)</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDatePattern('date_split')">{{
|
||||
$t('chart.date_split')
|
||||
}}(1990/01/01)</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
<!-- <el-dropdown-item
|
||||
v-show="item.deType === 1"
|
||||
divided
|
||||
>
|
||||
<el-dropdown
|
||||
placement="right-start"
|
||||
size="mini"
|
||||
style="width: 100%"
|
||||
@command="dateStyle"
|
||||
>
|
||||
<span class="el-dropdown-link inner-dropdown-menu">
|
||||
<span>
|
||||
<i class="el-icon-c-scale-to-original"/>
|
||||
<span>{{ $t('chart.dateStyle') }}</span>
|
||||
<span class="summary-span-item">({{ $t('chart.' + item.dateStyle) }})</span>
|
||||
</span>
|
||||
<i class="el-icon-arrow-right el-icon--right"/>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeDateStyle('y')">{{ $t('chart.y') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="showDateExt"
|
||||
:command="beforeDateStyle('y_Q')"
|
||||
>{{ $t('chart.y_Q') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M')">{{ $t('chart.y_M') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="showDateExt"
|
||||
:command="beforeDateStyle('y_W')"
|
||||
>{{ $t('chart.y_W') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M_d')">{{ $t('chart.y_M_d') }}</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:command="beforeDateStyle('H_m_s')"
|
||||
divided
|
||||
>{{ $t('chart.H_m_s') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m')">{{ $t('chart.y_M_d_H_m') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDateStyle('y_M_d_H_m_s')">{{
|
||||
$t('chart.y_M_d_H_m_s')
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-show="item.deType === 1">
|
||||
<el-dropdown
|
||||
placement="right-start"
|
||||
size="mini"
|
||||
style="width: 100%"
|
||||
@command="datePattern"
|
||||
>
|
||||
<span class="el-dropdown-link inner-dropdown-menu">
|
||||
<span>
|
||||
<i class="el-icon-timer"/>
|
||||
<span>{{ $t('chart.datePattern') }}</span>
|
||||
<span class="summary-span-item">({{ $t('chart.' + item.datePattern) }})</span>
|
||||
</span>
|
||||
<i class="el-icon-arrow-right el-icon--right"/>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeDatePattern('date_sub')">{{
|
||||
$t('chart.date_sub')
|
||||
}}(1990-01-01)</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeDatePattern('date_split')">{{
|
||||
$t('chart.date_split')
|
||||
}}(1990/01/01)</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
|
||||
<el-dropdown-item
|
||||
v-if="chart && chart.render === 'antv' && chart.type.includes('table') && item.groupType === 'q'"
|
||||
icon="el-icon-notebook-2"
|
||||
divided
|
||||
:command="beforeClickItem('formatter')"
|
||||
>
|
||||
<span>{{ $t('chart.value_formatter') }}...</span>
|
||||
</el-dropdown-item>-->
|
||||
<el-dropdown-item
|
||||
v-if="chart && chart.render === 'antv' && chart.type.includes('table') && item.groupType === 'q'"
|
||||
icon="el-icon-notebook-2"
|
||||
divided
|
||||
:command="beforeClickItem('formatter')"
|
||||
>
|
||||
<span>{{ $t('chart.value_formatter') }}...</span>
|
||||
</el-dropdown-item>-->
|
||||
<el-dropdown-item
|
||||
icon="el-icon-edit-outline"
|
||||
:command="beforeClickItem('rename')"
|
@ -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
|
||||
|
@ -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) {
|
@ -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;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user