Merge pull request #6066 from ulleo/dev

fix bugs
This commit is contained in:
ulleo 2023-09-07 16:50:59 +08:00 committed by GitHub
commit fc7e8fcdb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 70 additions and 41 deletions

View File

@ -1474,6 +1474,8 @@ public class ChartViewService {
List<PluginViewField> pluginViewFields = fieldMap.entrySet().stream().flatMap(entry -> entry.getValue().stream().map(field -> { List<PluginViewField> pluginViewFields = fieldMap.entrySet().stream().flatMap(entry -> entry.getValue().stream().map(field -> {
PluginViewField pluginViewField = BeanUtils.copyBean(new PluginViewField(), field); PluginViewField pluginViewField = BeanUtils.copyBean(new PluginViewField(), field);
pluginViewField.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken<List<PluginChartCustomFilterItem>>() {
}.getType()));
pluginViewField.setTypeField(entry.getKey()); pluginViewField.setTypeField(entry.getKey());
return pluginViewField; return pluginViewField;
})).collect(Collectors.toList()); })).collect(Collectors.toList());

View File

@ -2,6 +2,7 @@ package io.dataease.service.chart;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.commons.model.PluginViewSetImpl; import io.dataease.commons.model.PluginViewSetImpl;
import io.dataease.commons.utils.TableUtils; import io.dataease.commons.utils.TableUtils;
import io.dataease.controller.request.chart.ChartExtRequest; 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.constants.datasource.SQLConstants;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO; import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO; 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.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest; import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO; import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
@ -247,6 +249,9 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
methodName = "getYWheres"; methodName = "getYWheres";
} }
ChartViewFieldDTO chartViewFieldDTO = BeanUtils.copyBean(new ChartViewFieldDTO(), field); ChartViewFieldDTO chartViewFieldDTO = BeanUtils.copyBean(new ChartViewFieldDTO(), field);
chartViewFieldDTO.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken<List<ChartViewFieldFilterDTO>>() {
}.getType()));
Object execResult; Object execResult;
if ((execResult = execProviderMethod(queryProvider, methodName, chartViewFieldDTO, originField, fieldAlias)) != null) { if ((execResult = execProviderMethod(queryProvider, methodName, chartViewFieldDTO, originField, fieldAlias)) != null) {
String where = (String) execResult; String where = (String) execResult;

View File

@ -5,7 +5,7 @@
trigger="click" trigger="click"
@mouseup="handleMouseUp" @mouseup="handleMouseUp"
> >
<slot name="icon"/> <slot name="icon" />
<el-dropdown-menu v-if="curComponent"> <el-dropdown-menu v-if="curComponent">
<el-dropdown-item <el-dropdown-item
v-if="editFilter.includes(curComponent.type)" v-if="editFilter.includes(curComponent.type)"
@ -17,8 +17,7 @@
v-if="curComponent.type != 'custom-button'" v-if="curComponent.type != 'custom-button'"
icon="el-icon-document-copy" icon="el-icon-document-copy"
@click.native="copy" @click.native="copy"
><span>{{ $t('panel.copy') }}&nbsp(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command" ><span>{{ $t('panel.copy') }}&nbsp;(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command" />+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
/>+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
icon="el-icon-delete" icon="el-icon-delete"
@ -34,7 +33,7 @@
<el-dropdown-item v-if="!curComponent.auxiliaryMatrix"> <el-dropdown-item v-if="!curComponent.auxiliaryMatrix">
<el-dropdown placement="right-start"> <el-dropdown placement="right-start">
<span class="el-icon-copy-document"> <span class="el-icon-copy-document">
{{ $t('panel.level') }} <i class="el-icon-arrow-right el-icon--right"/> {{ $t('panel.level') }} <i class="el-icon-arrow-right el-icon--right" />
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item
@ -93,13 +92,13 @@
<el-dropdown-item <el-dropdown-item
v-if="curComponent.type != 'custom-button'" v-if="curComponent.type != 'custom-button'"
@click.native="hyperlinksSet" @click.native="hyperlinksSet"
><i class="icon iconfont icon-chaolianjie1"/>{{ $t('panel.hyperlinks') }} ><i class="icon iconfont icon-chaolianjie1" />{{ $t('panel.hyperlinks') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
v-if="curComponent.type !== 'view' && !curComponent.auxiliaryMatrix" v-if="curComponent.type !== 'view' && !curComponent.auxiliaryMatrix"
@click.native="positionAdjust" @click.native="positionAdjust"
> >
<i class="el-icon-map-location"/> <i class="el-icon-map-location" />
{{ $t('panel.position_adjust') }} {{ $t('panel.position_adjust') }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
@ -180,7 +179,7 @@ import TabCarouselDialog from '@/components/canvas/components/editor/TabCarousel
import CustomTabsSort from '@/components/widget/deWidget/CustomTabsSort' import CustomTabsSort from '@/components/widget/deWidget/CustomTabsSort'
export default { export default {
components: { CustomTabsSort, HyperlinksDialog,TabCarouselDialog }, components: { CustomTabsSort, HyperlinksDialog, TabCarouselDialog },
data() { data() {
return { return {
tabCarouselVisible: false, tabCarouselVisible: false,
@ -193,7 +192,8 @@ export default {
'text', 'text',
'label', 'label',
'flow-map', 'flow-map',
'bidirectional-bar' 'bidirectional-bar',
'race-bar'
], ],
linkageExcludeViewType: [ linkageExcludeViewType: [
'richTextView', 'richTextView',
@ -202,7 +202,8 @@ export default {
'text', 'text',
'label', 'label',
'flow-map', 'flow-map',
'bidirectional-bar' 'bidirectional-bar',
'race-bar'
], ],
copyData: null, copyData: null,
hyperlinksSetVisible: false, hyperlinksSetVisible: false,

View File

@ -45,7 +45,6 @@ public class ChartMixViewStatHandler 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());
@ -79,7 +78,6 @@ public class ChartMixViewStatHandler implements PluginViewStatHandler {
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()));

View File

@ -122,6 +122,9 @@ export default {
.form-item>>>.el-form-item__label{ .form-item>>>.el-form-item__label{
font-size: 12px; font-size: 12px;
} }
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item{ .el-select-dropdown__item{
padding: 0 20px; padding: 0 20px;
} }

View File

@ -49,20 +49,14 @@ public class RaceBarViewStatHandler 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.get("xAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(singleField -> singleField.getField()).collect(Collectors.toList());
List<PluginViewSQL> xOrders = fieldSQLMap.get("xAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(singleField -> singleField.getSort()).collect(Collectors.toList());
// 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());
List<String> yWheres = fieldSQLMap.getOrDefault("yAxis", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(PluginSingleField::getWhere).collect(Collectors.toList()); List<String> yWheres = fieldSQLMap.get("yAxis").stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getWhere())).map(singleField -> singleField.getWhere()).collect(Collectors.toList());
/*List<PluginViewSQL> yExtFields = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getField())).map(PluginSingleField::getField).collect(Collectors.toList());
List<PluginViewSQL> yExtOrders = fieldSQLMap.getOrDefault("yAxisExt", new ArrayList<>()).stream().filter(singleField -> ObjectUtils.isNotEmpty(singleField.getSort())).map(PluginSingleField::getSort).collect(Collectors.toList());
List<String> 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); String customWheres = baseService.customWhere(dsType, pluginViewParam.getPluginChartFieldCustomFilters(), tableObj);
@ -75,9 +69,15 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler {
if (customWheres != null) wheres.add(customWheres); if (customWheres != null) wheres.add(customWheres);
if (panelWheres != null) wheres.add(panelWheres); if (panelWheres != null) wheres.add(panelWheres);
if (permissionWhere != null) wheres.add(permissionWhere); if (permissionWhere != null) wheres.add(permissionWhere);
List<PluginViewSQL> groups = new ArrayList<>(); List<PluginViewSQL> groups = new ArrayList<>();
groups.addAll(xFields); groups.addAll(xFields);
List<PluginViewSQL> orders = new ArrayList<>();
orders.addAll(xOrders);
// 外层再次套sql // 外层再次套sql
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()));
@ -99,7 +99,9 @@ public class RaceBarViewStatHandler implements PluginViewStatHandler {
.tableAlias(String.format(table_alias_prefix, 1)) .tableAlias(String.format(table_alias_prefix, 1))
.build(); .build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres); if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL); if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return baseService.sqlLimit(dsType, st.render(), pluginViewParam.getPluginViewLimit()); return baseService.sqlLimit(dsType, st.render(), pluginViewParam.getPluginViewLimit());
} }

View File

@ -40,9 +40,9 @@ public class RaceBarService extends ViewPluginService {
private static final Map<String, String[]> VIEW_STYLE_PROPERTY_INNER = new HashMap<>(); private static final Map<String, String[]> VIEW_STYLE_PROPERTY_INNER = new HashMap<>();
static { static {
VIEW_STYLE_PROPERTY_INNER.put("color-selector", new String[]{"value", "alpha"}); VIEW_STYLE_PROPERTY_INNER.put("color-selector", new String[]{"value"});
VIEW_STYLE_PROPERTY_INNER.put("label-selector", new String[]{"show", "fontSize", "color", "position", "formatter"}); VIEW_STYLE_PROPERTY_INNER.put("label-selector", new String[]{"show", "fontSize", "color", "position"});
VIEW_STYLE_PROPERTY_INNER.put("tooltip-selector", new String[]{"show", "textStyle", "formatter"}); 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"}); 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; return null;
} }
String sql = new RaceBarViewStatHandler().build(param, this); String sql = new RaceBarViewStatHandler().build(param, this);
return sql; return sql;
} }
@ -143,10 +144,21 @@ public class RaceBarService extends ViewPluginService {
map.put("encode", encode); map.put("encode", encode);
Set<Object> xs = new HashSet<>(); Set<Object> xs = new HashSet<>();
Set<String> keySet = new HashSet<>();
List<String> keyList = new ArrayList<>();
data.forEach(ss -> { data.forEach(ss -> {
xs.add(ss[encode.get("y")]); xs.add(ss[encode.get("y")]);
String key = ss[(Integer) map.get("extIndex")];
if (!keySet.contains(key)) {
keySet.add(key);
keyList.add(key);
}
}); });
Map<String, List<String[]>> groupData = data.stream().collect(Collectors.toMap( Map<String, List<String[]>> groupData = data.stream().collect(Collectors.toMap(
k -> k[(Integer) map.get("extIndex")], k -> k[(Integer) map.get("extIndex")],
v -> { 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("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; return map;
} }

View File

@ -17,6 +17,17 @@
<el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style" <el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style"
:predefine="predefineColors" @change="changeTooltipAttr"/> :predefine="predefineColors" @change="changeTooltipAttr"/>
</el-form-item> </el-form-item>
<el-form-item
:label="$t('chart.background')"
class="form-item"
>
<el-color-picker
v-model="tooltipForm.backgroundColor"
class="color-picker-style"
:predefine="predefineColors"
@change="changeTooltipAttr"
/>
</el-form-item>
<!-- <el-form-item class="form-item"> <!-- <el-form-item class="form-item">
<span slot="label"> <span slot="label">
<span class="span-box"> <span class="span-box">
@ -40,7 +51,7 @@
</template> </template>
<script> <script>
import {COLOR_PANEL, DEFAULT_TOOLTIP} from '@/utils/map' import {COLOR_PANEL, DEFAULT_TOOLTIP} from '../../utils/map'
export default { export default {
name: 'TooltipSelector', name: 'TooltipSelector',
@ -127,6 +138,10 @@ export default {
font-size: 12px; font-size: 12px;
} }
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item { .el-select-dropdown__item {
padding: 0 20px; padding: 0 20px;
} }

View File

@ -65,7 +65,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"
@ -78,7 +78,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&#45;&#45;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>
@ -86,7 +86,7 @@
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item> <el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</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"

View File

@ -122,6 +122,9 @@ export default {
.form-item>>>.el-form-item__label{ .form-item>>>.el-form-item__label{
font-size: 12px; font-size: 12px;
} }
.form-item ::v-deep .el-form-item__label {
font-size: 12px;
}
.el-select-dropdown__item{ .el-select-dropdown__item{
padding: 0 20px; padding: 0 20px;
} }