forked from github/dataease
perf(地图): 优化地图后台逻辑
This commit is contained in:
parent
ac6f412586
commit
4dd805cf05
@ -960,6 +960,11 @@ public class ChartViewService {
|
||||
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
} else {
|
||||
querySql = qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
detailFieldSql = qp.getSQLWithPage(false, sql, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.CUSTOM.name())) {
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
@ -976,6 +981,11 @@ public class ChartViewService {
|
||||
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
} else {
|
||||
querySql = qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
detailFieldSql = qp.getSQLWithPage(false, sql, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.UNION.name())) {
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
@ -992,6 +1002,11 @@ public class ChartViewService {
|
||||
totalPageSql = qp.getResultCount(false, sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
} else {
|
||||
querySql = qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view);
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
detailFieldSql = qp.getSQLWithPage(false, sql, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view, pageInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(totalPageSql) && StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) {
|
||||
@ -1029,6 +1044,11 @@ public class ChartViewService {
|
||||
datasourceRequest.setQuery(qp.getSQLTableInfo(tableName, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
} else {
|
||||
datasourceRequest.setQuery(qp.getSQL(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
|
||||
if (containDetailField(view) && CollectionUtils.isNotEmpty(viewFields)) {
|
||||
detailFieldList.addAll(xAxis);
|
||||
detailFieldList.addAll(viewFields);
|
||||
detailFieldSql = qp.getSQLTableInfo(tableName, detailFieldList, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(assistFields)) {
|
||||
datasourceAssistRequest.setQuery(assistSQL(datasourceRequest.getQuery(), assistFields));
|
||||
@ -1055,6 +1075,10 @@ public class ChartViewService {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailFieldSql)) {
|
||||
datasourceRequest.setQuery(detailFieldSql);
|
||||
detailData = datasourceProvider.getData(datasourceRequest);
|
||||
}
|
||||
}
|
||||
// 自定义排序
|
||||
if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
@ -1218,9 +1242,11 @@ public class ChartViewService {
|
||||
}
|
||||
}
|
||||
// table组件,明细表,也用于导出数据
|
||||
Map<String, Object> mapTableNormal = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList);
|
||||
Map<String, Object> mapTableNormal = null;
|
||||
if (CollectionUtils.isNotEmpty(detailData)) {
|
||||
mapTableNormal = ChartDataBuild.transTableNormalWithDetail(xAxis, yAxis, data, detailFieldList, detailData, desensitizationList);
|
||||
} else {
|
||||
mapTableNormal = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList);
|
||||
}
|
||||
chartViewDTO = uniteViewResult(datasourceRequest.getQuery(), mapChart, mapTableNormal, view, isDrill, drillFilters, dynamicAssistFields, assistData);
|
||||
chartViewDTO.setTotalPage(totalPage);
|
||||
|
@ -48,9 +48,9 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
|
||||
let currentSeriesId = seriesId
|
||||
const yAxis = JSON.parse(chart.yaxis)
|
||||
if (!currentSeriesId || !yAxis.some(item => item.id === currentSeriesId)) {
|
||||
currentSeriesId = yAxis[0].id
|
||||
currentSeriesId = yAxis?.length ? yAxis[0].id : null
|
||||
}
|
||||
chart.data.series.forEach((item, index) => {
|
||||
chart.data?.series.forEach((item, index) => {
|
||||
if (item.data[0].quotaList[0].id === currentSeriesId) {
|
||||
seriesIndex = index
|
||||
return false
|
||||
@ -213,7 +213,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
|
||||
}
|
||||
const val = values[valueIndex]
|
||||
const field = deNameArray[valueIndex]
|
||||
const con = getSvgCondition(val, field, markCondition.conditions)
|
||||
const con = getSvgCondition(val, field, markCondition?.conditions || null)
|
||||
let svgName = null
|
||||
if (con) {
|
||||
svgName = con.icon
|
||||
@ -227,7 +227,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
|
||||
color: params => {
|
||||
const { value } = params
|
||||
const val = value[valueIndex]
|
||||
const con = getSvgCondition(val, null, markCondition.conditions)
|
||||
const con = getSvgCondition(val, null, markCondition?.conditions || null)
|
||||
return con?.color || '#b02a02'
|
||||
}
|
||||
},
|
||||
@ -248,6 +248,9 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
|
||||
}
|
||||
|
||||
const getSvgCondition = (val, field, conditions) => {
|
||||
if (!conditions) {
|
||||
return null
|
||||
}
|
||||
for (let i = 0; i < conditions.length; i++) {
|
||||
const condition = conditions[i]
|
||||
if (conditionMatch(condition, val)) {
|
||||
|
@ -455,20 +455,20 @@ export default {
|
||||
},
|
||||
roamMap(flag) {
|
||||
let targetZoom = 1
|
||||
const zoom = this.myChart.getOption().series[0].zoom
|
||||
const zoom = this.myChart.getOption().geo[0].zoom
|
||||
if (flag) {
|
||||
targetZoom = zoom * 1.2
|
||||
} else {
|
||||
targetZoom = zoom / 1.2
|
||||
}
|
||||
const options = JSON.parse(JSON.stringify(this.myChart.getOption()))
|
||||
options.series[0].zoom = targetZoom
|
||||
options.geo[0].zoom = targetZoom
|
||||
this.myChart.setOption(options)
|
||||
},
|
||||
resetZoom() {
|
||||
const options = JSON.parse(JSON.stringify(this.myChart.getOption()))
|
||||
options.series[0].zoom = 1
|
||||
options.series[0].center = this.mapCenter
|
||||
options.geo[0].zoom = 1
|
||||
options.geo[0].center = this.mapCenter
|
||||
this.myChart.setOption(options)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user