feat(视图): 仪表盘支持动态大小
This commit is contained in:
parent
67385719b6
commit
959ef4dd77
@ -1,27 +1,33 @@
|
||||
package io.dataease.service.chart;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.commons.model.PluginViewSetImpl;
|
||||
import io.dataease.dto.dataset.SqlVariableDetails;
|
||||
import io.dataease.ext.*;
|
||||
import io.dataease.commons.constants.CommonConstants;
|
||||
import io.dataease.commons.constants.JdbcConstants;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.model.PluginViewSetImpl;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.controller.request.chart.*;
|
||||
import io.dataease.controller.response.ChartDetail;
|
||||
import io.dataease.controller.response.DataSetDetail;
|
||||
import io.dataease.dto.chart.*;
|
||||
import io.dataease.dto.chart.ChartDimensionDTO;
|
||||
import io.dataease.dto.chart.ChartGroupDTO;
|
||||
import io.dataease.dto.chart.ChartViewDTO;
|
||||
import io.dataease.dto.chart.ViewOption;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.dto.dataset.SqlVariableDetails;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.ext.ExtChartGroupMapper;
|
||||
import io.dataease.ext.ExtChartViewMapper;
|
||||
import io.dataease.ext.ExtPanelGroupExtendDataMapper;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import io.dataease.plugins.common.base.domain.*;
|
||||
@ -567,6 +573,10 @@ public class ChartViewService {
|
||||
List<ChartViewFieldDTO> yAxisExt = gson.fromJson(view.getYAxisExt(), tokenType);
|
||||
yAxis.addAll(yAxisExt);
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(view.getRender(), "antv") && StringUtils.equalsIgnoreCase(view.getType(), "gauge")) {
|
||||
List<ChartViewFieldDTO> sizeField = getSizeField(view);
|
||||
yAxis.addAll(sizeField);
|
||||
}
|
||||
List<ChartViewFieldDTO> extStack = gson.fromJson(view.getExtStack(), tokenType);
|
||||
List<ChartViewFieldDTO> extBubble = gson.fromJson(view.getExtBubble(), tokenType);
|
||||
List<ChartFieldCustomFilterDTO> fieldCustomFilter = gson.fromJson(view.getCustomFilter(), filterTokenType);
|
||||
@ -1553,4 +1563,53 @@ public class ChartViewService {
|
||||
public List<ViewOption> viewOptions(String panelId) {
|
||||
return extChartViewMapper.chartOptions(panelId);
|
||||
}
|
||||
|
||||
private List<ChartViewFieldDTO> getSizeField(ChartViewDTO view) {
|
||||
List<ChartViewFieldDTO> list = new ArrayList<>();
|
||||
String customAttr = view.getCustomAttr();
|
||||
JSONObject jsonObject = JSONObject.parseObject(customAttr);
|
||||
JSONObject size = jsonObject.getJSONObject("size");
|
||||
|
||||
String gaugeMinType = size.getString("gaugeMinType");
|
||||
if (StringUtils.equalsIgnoreCase("dynamic", gaugeMinType)) {
|
||||
JSONObject gaugeMinField = size.getJSONObject("gaugeMinField");
|
||||
String id = gaugeMinField.getString("id");
|
||||
String summary = gaugeMinField.getString("summary");
|
||||
DatasetTableField datasetTableField = dataSetTableFieldsService.get(id);
|
||||
if (ObjectUtils.isNotEmpty(datasetTableField)) {
|
||||
if (datasetTableField.getDeType() == 0 || datasetTableField.getDeType() == 1 || datasetTableField.getDeType() == 5) {
|
||||
if (!StringUtils.containsIgnoreCase(summary, "count")) {
|
||||
DEException.throwException(Translator.get("i18n_gauge_field_change"));
|
||||
}
|
||||
}
|
||||
ChartViewFieldDTO dto = new ChartViewFieldDTO();
|
||||
BeanUtils.copyBean(dto, datasetTableField);
|
||||
dto.setSummary(summary);
|
||||
list.add(dto);
|
||||
} else {
|
||||
DEException.throwException(Translator.get("i18n_gauge_field_delete"));
|
||||
}
|
||||
}
|
||||
String gaugeMaxType = size.getString("gaugeMaxType");
|
||||
if (StringUtils.equalsIgnoreCase("dynamic", gaugeMaxType)) {
|
||||
JSONObject gaugeMaxField = size.getJSONObject("gaugeMaxField");
|
||||
String id = gaugeMaxField.getString("id");
|
||||
String summary = gaugeMaxField.getString("summary");
|
||||
DatasetTableField datasetTableField = dataSetTableFieldsService.get(id);
|
||||
if (ObjectUtils.isNotEmpty(datasetTableField)) {
|
||||
if (datasetTableField.getDeType() == 0 || datasetTableField.getDeType() == 1 || datasetTableField.getDeType() == 5) {
|
||||
if (!StringUtils.containsIgnoreCase(summary, "count")) {
|
||||
DEException.throwException(Translator.get("i18n_gauge_field_change"));
|
||||
}
|
||||
}
|
||||
ChartViewFieldDTO dto = new ChartViewFieldDTO();
|
||||
BeanUtils.copyBean(dto, datasetTableField);
|
||||
dto.setSummary(summary);
|
||||
list.add(dto);
|
||||
} else {
|
||||
DEException.throwException(Translator.get("i18n_gauge_field_delete"));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,6 +199,9 @@ I18N_EMAIL_ACCOUNT_ERROR=Email account can not be empty
|
||||
i18n_row_permission_type_error=Row permission type can not be empty
|
||||
i18n_row_permission_id=Row permission type is Dept/Role/User,name can not be empty
|
||||
|
||||
i18n_gauge_field_change=Field type changed,please edit
|
||||
i18n_gauge_field_delete=Field type changed,please edit
|
||||
|
||||
|
||||
\u7CFB\u7EDF\u914D\u7F6E=System
|
||||
\u5916\u89C2\u914D\u7F6E=Appearance
|
||||
|
||||
@ -204,3 +204,6 @@ i18n_row_permission_id=\u884C\u6743\u9650\u7C7B\u578B\u4E3A\u7EC4\u7EC7/\u89D2\u
|
||||
\u7CFB\u7EDF\u914D\u7F6E=\u7CFB\u7EDF\u914D\u7F6E
|
||||
\u5916\u89C2\u914D\u7F6E=\u5916\u89C2\u914D\u7F6E
|
||||
\u6570\u636E\u540C\u6B65\u8868\u5355=\u6570\u636E\u540C\u6B65\u8868\u5355
|
||||
|
||||
i18n_gauge_field_change=\u6240\u7528\u5b57\u6bb5\u53d1\u751f\u53d8\u66f4\uff0c\u8bf7\u91cd\u65b0\u7f16\u8f91
|
||||
i18n_gauge_field_delete=\u6240\u7528\u5b57\u6bb5\u5df2\u5220\u9664\uff0c\u8bf7\u91cd\u65b0\u7f16\u8f91
|
||||
|
||||
@ -199,4 +199,7 @@ i18n_row_permission_id=\u884C\u6B0A\u9650\u985E\u578B\u70BA\u7D44\u7E54/\u89D2\u
|
||||
|
||||
\u7CFB\u7EDF\u914D\u7F6E=\u7CFB\u7D71\u914D\u7F6E
|
||||
\u5916\u89C2\u914D\u7F6E=\u5916\u89C0\u914D\u7F6E
|
||||
\u6570\u636E\u540C\u6B65\u8868\u5355=\u6578\u64DA\u540C\u6B65\u8868\u55AE
|
||||
\u6570\u636E\u540C\u6B65\u8868\u5355=\u6578\u64DA\u540C\u6B65\u8868\u55AE
|
||||
|
||||
i18n_gauge_field_change=\u6240\u7528\u5b57\u6bb5\u767c\u751f\u8b8a\u66f4\uff0c\u8acb\u91cd\u65b0\u7de8\u8f2f
|
||||
i18n_gauge_field_delete=\u6240\u7528\u5b57\u6bb5\u5df2\u522a\u9664\uff0c\u8acb\u91cd\u65b0\u7de8\u8f2f
|
||||
|
||||
Loading…
Reference in New Issue
Block a user