forked from github/dataease
Merge pull request #2291 from dataease/pr@dev@feat_marker_map_label
feat: 气泡地图增加标签字段设置
This commit is contained in:
commit
5a78aa0599
@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -128,6 +129,9 @@ public class ChartViewService {
|
||||
}
|
||||
|
||||
public ChartViewWithBLOBs newOne(ChartViewWithBLOBs chartView) {
|
||||
if (StringUtils.isBlank(chartView.getViewFields())) {
|
||||
chartView.setViewFields("[]");
|
||||
}
|
||||
long timestamp = System.currentTimeMillis();
|
||||
chartView.setUpdateTime(timestamp);
|
||||
chartView.setId(UUID.randomUUID().toString());
|
||||
@ -300,23 +304,23 @@ public class ChartViewService {
|
||||
if (ObjectUtils.isEmpty(view)) {
|
||||
throw new RuntimeException(Translator.get("i18n_chart_delete"));
|
||||
}
|
||||
List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> xAxis = gson.fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot")) {
|
||||
List<ChartViewFieldDTO> xAxisExt = new Gson().fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> xAxisExt = gson.fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
xAxis.addAll(xAxisExt);
|
||||
}
|
||||
List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> yAxis = gson.fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "chart-mix")) {
|
||||
List<ChartViewFieldDTO> yAxisExt = new Gson().fromJson(view.getYAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> yAxisExt = gson.fromJson(view.getYAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
yAxis.addAll(yAxisExt);
|
||||
}
|
||||
List<ChartViewFieldDTO> extStack = new Gson().fromJson(view.getExtStack(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> extStack = gson.fromJson(view.getExtStack(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> extBubble = new Gson().fromJson(view.getExtBubble(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> extBubble = gson.fromJson(view.getExtBubble(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter = new ArrayList<ChartFieldCustomFilterDTO>();
|
||||
List<ChartViewFieldDTO> drill = new ArrayList<ChartViewFieldDTO>();
|
||||
@ -401,7 +405,7 @@ public class ChartViewService {
|
||||
// 如果是插件视图 走插件内部的逻辑
|
||||
if (ObjectUtils.isNotEmpty(view.getIsPlugin()) && view.getIsPlugin()) {
|
||||
Map<String, List<ChartViewFieldDTO>> fieldMap = new HashMap<>();
|
||||
List<ChartViewFieldDTO> xAxisExt = new Gson().fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> xAxisExt = gson.fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
fieldMap.put("xAxisExt", xAxisExt);
|
||||
fieldMap.put("xAxis", xAxis);
|
||||
@ -434,7 +438,7 @@ public class ChartViewService {
|
||||
}
|
||||
// DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
datasourceRequest.setDatasource(ds);
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
DataTableInfoDTO dataTableInfoDTO = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
if (StringUtils.equalsIgnoreCase(table.getType(), "db")) {
|
||||
datasourceRequest.setTable(dataTableInfoDTO.getTable());
|
||||
@ -462,7 +466,7 @@ public class ChartViewService {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmp(dataTableInfoDTO.getSql(), xAxis, yAxis, fieldCustomFilter, extFilterList, view));
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), "custom")) {
|
||||
DataTableInfoDTO dt = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
|
||||
String sql = dataSetTableService.getCustomSQLDatasource(dt, list, ds);
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
@ -477,7 +481,7 @@ public class ChartViewService {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, extFilterList, view));
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), "union")) {
|
||||
DataTableInfoDTO dt = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dt, ds);
|
||||
String sql = (String) sqlMap.get("sql");
|
||||
|
||||
@ -538,28 +542,30 @@ public class ChartViewService {
|
||||
if (ObjectUtils.isEmpty(view)) {
|
||||
throw new RuntimeException(Translator.get("i18n_chart_delete"));
|
||||
}
|
||||
List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
Type tokenType = new TypeToken<List<ChartViewFieldDTO>>() {}.getType();
|
||||
Type filterTokenType = new TypeToken<List<ChartFieldCustomFilterDTO>>() {}.getType();
|
||||
|
||||
List<ChartViewFieldDTO> viewFields = gson.fromJson(view.getViewFields(), tokenType);
|
||||
Map<String, List<ChartViewFieldDTO>> extFieldsMap = null;
|
||||
if (CollectionUtils.isNotEmpty(viewFields)) {
|
||||
extFieldsMap = viewFields.stream().collect(Collectors.groupingBy(ChartViewFieldDTO::getBusiType));
|
||||
}
|
||||
|
||||
|
||||
List<ChartViewFieldDTO> xAxis = gson.fromJson(view.getXAxis(), tokenType);
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot")) {
|
||||
List<ChartViewFieldDTO> xAxisExt = new Gson().fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> xAxisExt = gson.fromJson(view.getXAxisExt(), tokenType);
|
||||
xAxis.addAll(xAxisExt);
|
||||
}
|
||||
List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> yAxis = gson.fromJson(view.getYAxis(), tokenType);
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "chart-mix")) {
|
||||
List<ChartViewFieldDTO> yAxisExt = new Gson().fromJson(view.getYAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> yAxisExt = gson.fromJson(view.getYAxisExt(), tokenType);
|
||||
yAxis.addAll(yAxisExt);
|
||||
}
|
||||
List<ChartViewFieldDTO> extStack = new Gson().fromJson(view.getExtStack(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> extBubble = new Gson().fromJson(view.getExtBubble(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter = new Gson().fromJson(view.getCustomFilter(), new TypeToken<List<ChartFieldCustomFilterDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> drill = new Gson().fromJson(view.getDrillFields(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> extStack = gson.fromJson(view.getExtStack(), tokenType);
|
||||
List<ChartViewFieldDTO> extBubble = gson.fromJson(view.getExtBubble(), tokenType);
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter = gson.fromJson(view.getCustomFilter(), filterTokenType);
|
||||
List<ChartViewFieldDTO> drill = gson.fromJson(view.getDrillFields(), tokenType);
|
||||
|
||||
|
||||
DatasetTableField datasetTableFieldObj = DatasetTableField.builder().tableId(view.getTableId()).checked(Boolean.TRUE).build();
|
||||
@ -741,14 +747,12 @@ public class ChartViewService {
|
||||
|
||||
// 如果是插件视图 走插件内部的逻辑
|
||||
if (ObjectUtils.isNotEmpty(view.getIsPlugin()) && view.getIsPlugin()) {
|
||||
Map<String, List<ChartViewFieldDTO>> fieldMap = new HashMap<>();
|
||||
List<ChartViewFieldDTO> xAxisExt = new Gson().fromJson(view.getXAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
fieldMap.put("xAxisExt", xAxisExt);
|
||||
fieldMap.put("xAxis", xAxis);
|
||||
Map<String, List<ChartViewFieldDTO>> fieldMap = ObjectUtils.isEmpty(extFieldsMap) ? new HashMap<>() : extFieldsMap;
|
||||
|
||||
fieldMap.put("yAxis", yAxis);
|
||||
fieldMap.put("extStack", extStack);
|
||||
fieldMap.put("extBubble", extBubble);
|
||||
fieldMap.put("xAxis", xAxis);
|
||||
PluginViewParam pluginViewParam = buildPluginParam(fieldMap, fieldCustomFilter, extFilterList, ds, table, view);
|
||||
String sql = pluginViewSql(pluginViewParam, view);
|
||||
if (StringUtils.isBlank(sql)) {
|
||||
@ -775,7 +779,7 @@ public class ChartViewService {
|
||||
}
|
||||
// DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
datasourceRequest.setDatasource(ds);
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
DataTableInfoDTO dataTableInfoDTO = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
if (StringUtils.equalsIgnoreCase(table.getType(), "db")) {
|
||||
datasourceRequest.setTable(dataTableInfoDTO.getTable());
|
||||
@ -803,7 +807,7 @@ public class ChartViewService {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmp(dataTableInfoDTO.getSql(), xAxis, yAxis, fieldCustomFilter, extFilterList, view));
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), "custom")) {
|
||||
DataTableInfoDTO dt = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
|
||||
String sql = dataSetTableService.getCustomSQLDatasource(dt, list, ds);
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
@ -818,7 +822,7 @@ public class ChartViewService {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, extFilterList, view));
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), "union")) {
|
||||
DataTableInfoDTO dt = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dt, ds);
|
||||
String sql = (String) sqlMap.get("sql");
|
||||
|
||||
@ -1376,7 +1380,7 @@ public class ChartViewService {
|
||||
public List<String> getFieldData(String id, ChartExtRequest requestList, boolean cache, String fieldId) throws Exception {
|
||||
ChartViewDTO view = getOne(id, requestList.getQueryFrom());
|
||||
List<String[]> sqlData = sqlData(view, requestList, cache, fieldId);
|
||||
List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
List<ChartViewFieldDTO> xAxis = gson.fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
DatasetTableField field = dataSetTableFieldsService.get(fieldId);
|
||||
|
||||
|
@ -822,6 +822,7 @@ export default {
|
||||
view.customFilter = JSON.stringify([])
|
||||
view.drillFields = JSON.stringify([])
|
||||
view.extBubble = JSON.stringify([])
|
||||
view.viewFields = JSON.stringify([])
|
||||
this.setChartDefaultOptions(view)
|
||||
const _this = this
|
||||
post('/chart/view/newOne/' + this.panelInfo.id, view, true).then(response => {
|
||||
|
@ -657,6 +657,8 @@
|
||||
:view="view"
|
||||
:chart="chart"
|
||||
:properties="chartProperties"
|
||||
:dimension-data="dimensionData"
|
||||
:quota-data="quotaData"
|
||||
@calcStyle="calcStyle"
|
||||
@onColorChange="onColorChange"
|
||||
@onSizeChange="onSizeChange"
|
||||
@ -1082,6 +1084,7 @@ export default {
|
||||
yaxisExt: [],
|
||||
extStack: [],
|
||||
drillFields: [],
|
||||
viewFields: [],
|
||||
extBubble: [],
|
||||
show: true,
|
||||
type: 'bar',
|
||||
@ -1528,6 +1531,7 @@ export default {
|
||||
this.view = JSON.parse(JSON.stringify(view))
|
||||
// stringify json param
|
||||
view.xaxis = JSON.stringify(view.xaxis)
|
||||
view.viewFields = JSON.stringify(view.viewFields)
|
||||
view.xaxisExt = JSON.stringify(view.xaxisExt)
|
||||
view.yaxis = JSON.stringify(view.yaxis)
|
||||
view.yaxisExt = JSON.stringify(view.yaxisExt)
|
||||
@ -1596,6 +1600,7 @@ export default {
|
||||
// 将视图传入echart...组件
|
||||
const view = JSON.parse(JSON.stringify(this.view))
|
||||
view.xaxis = JSON.stringify(this.view.xaxis)
|
||||
view.viewFields = JSON.stringify(this.view.viewFields)
|
||||
view.xaxisExt = JSON.stringify(this.view.xaxisExt)
|
||||
view.yaxis = JSON.stringify(this.view.yaxis)
|
||||
view.yaxisExt = JSON.stringify(this.view.yaxisExt)
|
||||
@ -1660,6 +1665,7 @@ export default {
|
||||
}).then(response => {
|
||||
this.initTableData(response.data.tableId)
|
||||
this.view = JSON.parse(JSON.stringify(response.data))
|
||||
this.view.viewFields = this.view.viewFields ? JSON.parse(this.view.viewFields) : []
|
||||
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
|
||||
this.view.xaxisExt = this.view.xaxisExt ? JSON.parse(this.view.xaxisExt) : []
|
||||
this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : []
|
||||
@ -1710,6 +1716,7 @@ export default {
|
||||
this.initTableData(response.data.tableId)
|
||||
}
|
||||
this.view = JSON.parse(JSON.stringify(response.data))
|
||||
this.view.viewFields = this.view.viewFields ? JSON.parse(this.view.viewFields) : []
|
||||
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
|
||||
this.view.xaxisExt = this.view.xaxisExt ? JSON.parse(this.view.xaxisExt) : []
|
||||
this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : []
|
||||
|
@ -5,7 +5,7 @@
|
||||
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
|
||||
class="attr-style theme-border-class"
|
||||
:component-name="view.type + '-style'"
|
||||
:obj="{view, param, chart}"
|
||||
:obj="{view, param, chart, dimensionData, quotaData}"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
@ -328,6 +328,14 @@ export default {
|
||||
properties: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
dimensionData: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
quotaData: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
Loading…
Reference in New Issue
Block a user