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 -> {
PluginViewField pluginViewField = BeanUtils.copyBean(new PluginViewField(), field);
pluginViewField.setFilter(gson.fromJson(gson.toJson(field.getFilter()), new TypeToken<List<PluginChartCustomFilterItem>>() {
}.getType()));
pluginViewField.setTypeField(entry.getKey());
return pluginViewField;
})).collect(Collectors.toList());

View File

@ -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<List<ChartViewFieldFilterDTO>>() {
}.getType()));
Object execResult;
if ((execResult = execProviderMethod(queryProvider, methodName, chartViewFieldDTO, originField, fieldAlias)) != null) {
String where = (String) execResult;

View File

@ -17,8 +17,7 @@
v-if="curComponent.type != 'custom-button'"
icon="el-icon-document-copy"
@click.native="copy"
><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>
><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>
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-delete"
@ -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,

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> 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());
@ -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<String> aggWheres = new ArrayList<>();
aggWheres.addAll(yWheres.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList()));

View File

@ -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;
}

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<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);
@ -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<PluginViewSQL> groups = new ArrayList<>();
groups.addAll(xFields);
List<PluginViewSQL> orders = new ArrayList<>();
orders.addAll(xOrders);
// 外层再次套sql
List<String> 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());
}

View File

@ -40,9 +40,9 @@ public class RaceBarService extends ViewPluginService {
private static final Map<String, String[]> 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<Object> xs = new HashSet<>();
Set<String> keySet = new HashSet<>();
List<String> 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<String, List<String[]>> 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;
}

View File

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

View File

@ -65,7 +65,7 @@
/>
</el-tag>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item>
<el-dropdown-item>
<el-dropdown
placement="right-start"
size="mini"
@ -78,7 +78,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>
@ -86,7 +86,7 @@
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>-->
</el-dropdown-item>
<el-dropdown-item
v-show="item.deType === 1"

View File

@ -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;
}