Merge branch 'dev-v2' into pr@dev-v2@refactor_new-icon

This commit is contained in:
王嘉豪 2024-07-02 13:08:26 +08:00 committed by GitHub
commit 075635231b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 326 additions and 157 deletions

View File

@ -41,6 +41,7 @@ public class GroupMixHandler extends MixHandler {
xAxisGroup.addAll(view.getXAxisExt());
axisMap.put(ChartAxis.xAxis, xAxisGroup);
context.put("xAxisBase", xAxis);
axisMap.put(ChartAxis.drill, new ArrayList<>(view.getDrillFields()));
return result;
}
@ -49,45 +50,4 @@ public class GroupMixHandler extends MixHandler {
return super.buildNormalResult(view, formatResult, filterResult, data);
}
@Override
public ChartViewDTO buildChart(ChartViewDTO view, ChartCalcDataResult calcResult, AxisFormatResult formatResult, CustomFilterResult filterResult) {
var desensitizationList = (Map<String, ColumnPermissionItem>) filterResult.getContext().get("desensitizationList");
var leftCalcResult = (ChartCalcDataResult) calcResult.getData().get("left");
var leftFields = new ArrayList<ChartViewFieldDTO>();
leftFields.addAll(view.getXAxis());
leftFields.addAll(view.getXAxisExt());
leftFields.addAll(view.getYAxis());
var leftOriginData = leftCalcResult.getOriginData();
var leftTable = ChartDataBuild.transTableNormal(leftFields, view, leftOriginData, desensitizationList);
mergeAssistField(leftCalcResult.getDynamicAssistFields(), leftCalcResult.getAssistData());
var leftData = new HashMap<String, Object>(leftTable);
leftData.putAll(leftCalcResult.getData());
leftData.put("dynamicAssistLines", leftCalcResult.getDynamicAssistFields());
var rightCalcResult = (ChartCalcDataResult) calcResult.getData().get("right");
var rightFields = new ArrayList<ChartViewFieldDTO>();
rightFields.addAll(view.getXAxis());
rightFields.addAll(view.getExtBubble());
rightFields.addAll(view.getYAxisExt());
var rightOriginData = rightCalcResult.getOriginData();
var rightTable = ChartDataBuild.transTableNormal(rightFields, view, rightOriginData, desensitizationList);
mergeAssistField(rightCalcResult.getDynamicAssistFields(), rightCalcResult.getAssistData());
var rightData = new HashMap<String, Object>(rightTable);
rightData.putAll(rightCalcResult.getData());
rightData.put("dynamicAssistLines", rightCalcResult.getDynamicAssistFields());
var allFields = (List<ChartViewFieldDTO>) filterResult.getContext().get("allFields");
// 构建结果
Map<String, Object> chartData = new TreeMap<>();
chartData.put("left", leftData);
chartData.put("right", rightData);
var drillFilters = filterResult.getFilterList().stream().filter(f -> f.getFilterType() == 1).collect(Collectors.toList());
var isDrill = CollectionUtils.isNotEmpty(drillFilters);
view.setDrillFilters(drillFilters);
view.setDrill(isDrill);
view.setSql(leftCalcResult.getQuerySql());
view.setData(chartData);
return view;
}
}

View File

@ -45,6 +45,7 @@ public class MixHandler extends YoyChartHandler {
//图表整体主维度
axisMap.put(ChartAxis.xAxis, new ArrayList<>(view.getXAxis()));
context.put("xAxisBase", new ArrayList<>(view.getXAxis()));
axisMap.put(ChartAxis.drill, new ArrayList<>(view.getDrillFields()));
return result;
}
@ -93,26 +94,46 @@ public class MixHandler extends YoyChartHandler {
} catch (Exception e) {
e.printStackTrace();
}
AxisFormatResult formatResult2 = new AxisFormatResult();
var axisMap = new HashMap<ChartAxis, List<ChartViewFieldDTO>>();
axisMap.put(ChartAxis.xAxis, new ArrayList<>(formatResult.getAxisMap().get(ChartAxis.xAxis)));
axisMap.put(ChartAxis.extStack, new ArrayList<>());
axisMap.put(ChartAxis.xAxisExt, new ArrayList<>());
axisMap.put(ChartAxis.extBubble, new ArrayList<>(formatResult.getAxisMap().get(ChartAxis.extBubble)));
axisMap.put(ChartAxis.yAxisExt, new ArrayList<>(formatResult.getAxisMap().get(ChartAxis.yAxisExt)));
axisMap.put(ChartAxis.extLabel, new ArrayList<>(formatResult.getAxisMap().get(ChartAxis.extLabel)));
axisMap.put(ChartAxis.extTooltip, new ArrayList<>(formatResult.getAxisMap().get(ChartAxis.extTooltip)));
axisMap.put(ChartAxis.drill, new ArrayList<>(formatResult.getAxisMap().get(ChartAxis.drill)));
formatResult2.setAxisMap(axisMap);
formatResult2.setContext(formatResult.getContext());
// 计算右轴包含 xAxis,xAxisExt,yAxisExt,需要去掉 group stack
var xAxis = formatResult.getAxisMap().get(ChartAxis.xAxis);
var extStack = formatResult.getAxisMap().get(ChartAxis.extStack);
var xAxisExt = formatResult.getAxisMap().get(ChartAxis.xAxisExt);
xAxis = xAxis.subList(0, xAxis.size() - extStack.size() - xAxisExt.size());
var extBubble = formatResult.getAxisMap().get(ChartAxis.extBubble);
var xAxis = new ArrayList<>(view.getXAxis());
var extStack = formatResult2.getAxisMap().get(ChartAxis.extStack);
var xAxisExt = formatResult2.getAxisMap().get(ChartAxis.xAxisExt);
//xAxis = xAxis.subList(0, xAxis.size() - extStack.size() - xAxisExt.size());
var extBubble = formatResult2.getAxisMap().get(ChartAxis.extBubble);
xAxis.addAll(extBubble);
formatResult.getAxisMap().put(ChartAxis.xAxis, xAxis);
formatResult.getAxisMap().put(ChartAxis.xAxisExt, extBubble);
var yAxisExt = formatResult.getAxisMap().get(ChartAxis.yAxisExt);
formatResult.getAxisMap().put(ChartAxis.yAxis, yAxisExt);
formatResult.getContext().remove("yoyFiltered");
var dillAxis = (ArrayList<ChartViewFieldDTO>) formatResult.getContext().get("dillAxis");
xAxis.addAll(dillAxis);
formatResult2.getAxisMap().put(ChartAxis.xAxis, xAxis);
formatResult2.getAxisMap().put(ChartAxis.xAxisExt, extBubble);
var yAxisExt = formatResult2.getAxisMap().get(ChartAxis.yAxisExt);
formatResult2.getAxisMap().put(ChartAxis.yAxis, yAxisExt);
formatResult2.getContext().remove("yoyFiltered");
formatResult.getContext().put("subAxisMap", axisMap);
// 右轴重新检测同环比过滤
customFilter(view, filterResult.getFilterList(), formatResult);
var rightResult = (T) super.calcChartResult(view, formatResult, filterResult, sqlMap, sqlMeta, provider);
customFilter(view, filterResult.getFilterList(), formatResult2);
var rightResult = (T) super.calcChartResult(view, formatResult2, filterResult, sqlMap, sqlMeta, provider);
try {
//如果有同环比过滤,应该用原始sql
var originSql = rightResult.getQuerySql();
var rightAssistFields = dynamicAssistFields.stream().filter(x -> StringUtils.equalsAnyIgnoreCase(x.getYAxisType(), "right")).toList();
var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis);
var yAxis = formatResult2.getAxisMap().get(ChartAxis.yAxis);
var assistFields = getAssistFields(rightAssistFields, yAxis);
if (CollectionUtils.isNotEmpty(assistFields)) {
var req = new DatasourceRequest();
@ -140,8 +161,8 @@ public class MixHandler extends YoyChartHandler {
var desensitizationList = (Map<String, ColumnPermissionItem>) filterResult.getContext().get("desensitizationList");
var leftCalcResult = (ChartCalcDataResult) calcResult.getData().get("left");
var leftFields = new ArrayList<ChartViewFieldDTO>();
leftFields.addAll(view.getXAxis());
leftFields.addAll(view.getYAxis());
leftFields.addAll(formatResult.getAxisMap().get(ChartAxis.xAxis));
leftFields.addAll(formatResult.getAxisMap().get(ChartAxis.yAxis));
mergeAssistField(leftCalcResult.getDynamicAssistFields(), leftCalcResult.getAssistData());
var leftOriginData = leftCalcResult.getOriginData();
var leftTable = ChartDataBuild.transTableNormal(leftFields, view, leftOriginData, desensitizationList);
@ -151,13 +172,14 @@ public class MixHandler extends YoyChartHandler {
var rightCalcResult = (ChartCalcDataResult) calcResult.getData().get("right");
var rightFields = new ArrayList<ChartViewFieldDTO>();
rightFields.addAll(view.getXAxis());
rightFields.addAll(view.getExtBubble());
rightFields.addAll(view.getYAxisExt());
var subAxisMap = (HashMap<ChartAxis, List<ChartViewFieldDTO>>) formatResult.getContext().get("subAxisMap");
rightFields.addAll(subAxisMap.get(ChartAxis.xAxis));
rightFields.addAll(subAxisMap.get(ChartAxis.yAxis));
mergeAssistField(rightCalcResult.getDynamicAssistFields(), rightCalcResult.getAssistData());
var rightOriginData = rightCalcResult.getOriginData();
var rightTable = ChartDataBuild.transTableNormal(rightFields, view, rightOriginData, desensitizationList);
mergeAssistField(rightCalcResult.getDynamicAssistFields(), rightCalcResult.getAssistData());
var rightData = new HashMap<String, Object>(rightTable);
rightData.putAll(rightCalcResult.getData());
rightData.put("dynamicAssistLines", rightCalcResult.getDynamicAssistFields());

View File

@ -41,6 +41,7 @@ public class StackMixHandler extends MixHandler {
xAxisStack.addAll(view.getExtStack());
axisMap.put(ChartAxis.xAxis, xAxisStack);
context.put("xAxisBase", xAxis);
axisMap.put(ChartAxis.drill, new ArrayList<>(view.getDrillFields()));
return result;
}
@ -61,49 +62,7 @@ public class StackMixHandler extends MixHandler {
var xAxisBase = (List<ChartViewFieldDTO>) formatResult.getContext().get("xAxisBase");
var xAxis = formatResult.getAxisMap().get(ChartAxis.xAxis);
var xAxisExt = formatResult.getAxisMap().get(ChartAxis.xAxisExt);
return ChartDataBuild.transMixChartDataAntV(xAxisBase, xAxis, xAxisExt, yAxis, view, data, isDrill);
return super.buildNormalResult(view, formatResult, filterResult, data);
}
}
@Override
public ChartViewDTO buildChart(ChartViewDTO view, ChartCalcDataResult calcResult, AxisFormatResult formatResult, CustomFilterResult filterResult) {
var desensitizationList = (Map<String, ColumnPermissionItem>) filterResult.getContext().get("desensitizationList");
var leftCalcResult = (ChartCalcDataResult) calcResult.getData().get("left");
var leftFields = new ArrayList<ChartViewFieldDTO>();
leftFields.addAll(view.getXAxis());
leftFields.addAll(view.getExtStack());
leftFields.addAll(view.getYAxis());
var leftOriginData = leftCalcResult.getOriginData();
var leftTable = ChartDataBuild.transTableNormal(leftFields, view, leftOriginData, desensitizationList);
mergeAssistField(leftCalcResult.getDynamicAssistFields(), leftCalcResult.getAssistData());
var leftData = new HashMap<String, Object>(leftTable);
leftData.putAll(leftCalcResult.getData());
leftData.put("dynamicAssistLines", leftCalcResult.getDynamicAssistFields());
var rightCalcResult = (ChartCalcDataResult) calcResult.getData().get("right");
var rightFields = new ArrayList<ChartViewFieldDTO>();
rightFields.addAll(view.getXAxis());
rightFields.addAll(view.getExtBubble());
rightFields.addAll(view.getYAxisExt());
var rightOriginData = rightCalcResult.getOriginData();
var rightTable = ChartDataBuild.transTableNormal(rightFields, view, rightOriginData, desensitizationList);
mergeAssistField(rightCalcResult.getDynamicAssistFields(), rightCalcResult.getAssistData());
var rightData = new HashMap<String, Object>(rightTable);
rightData.putAll(rightCalcResult.getData());
rightData.put("dynamicAssistLines", rightCalcResult.getDynamicAssistFields());
var allFields = (List<ChartViewFieldDTO>) filterResult.getContext().get("allFields");
// 构建结果
Map<String, Object> chartData = new TreeMap<>();
chartData.put("left", leftData);
chartData.put("right", rightData);
var drillFilters = filterResult.getFilterList().stream().filter(f -> f.getFilterType() == 1).collect(Collectors.toList());
var isDrill = CollectionUtils.isNotEmpty(drillFilters);
view.setDrillFilters(drillFilters);
view.setDrill(isDrill);
view.setSql(leftCalcResult.getQuerySql());
view.setData(chartData);
return view;
}
}

View File

@ -104,9 +104,7 @@ public class ChartDataManage {
DEException.throwException(ResultCode.DATA_IS_WRONG.code(), Translator.get("i18n_chart_not_handler") + ": " + view.getRender() + "," + view.getType());
}
AxisFormatResult formatResult = chartHandler.formatAxis(view);
var xAxis = formatResult.getAxisMap().get(ChartAxis.xAxis);
var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis);
var dillAxis = new ArrayList<ChartViewFieldDTO>();
DatasetGroupInfoDTO table = datasetGroupManage.getDatasetGroupInfoDTO(view.getTableId(), null);
if (table == null) {
@ -122,7 +120,6 @@ public class ChartDataManage {
}
List<ChartViewFieldDTO> allFields = getAllChartFields(view);
formatResult.getContext().put("allFields", allFields);
// column permission
Map<String, ColumnPermissionItem> desensitizationList = new HashMap<>();
List<DatasetTableFieldDTO> columnPermissionFields = permissionManage.filterColumnPermissions(transFields(allFields), desensitizationList, table.getId(), chartExtRequest.getUser());
@ -130,13 +127,18 @@ public class ChartDataManage {
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree = permissionManage.getRowPermissionsTree(table.getId(), chartExtRequest.getUser());
//将没有权限的列删掉
List<String> dataeaseNames = columnPermissionFields.stream().map(DatasetTableFieldDTO::getDataeaseName).collect(Collectors.toList());
dataeaseNames.add("*");
AxisFormatResult formatResult = chartHandler.formatAxis(view);
formatResult.getContext().put("desensitizationList", desensitizationList);
var xAxis = formatResult.getAxisMap().get(ChartAxis.xAxis);
var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis);
formatResult.getContext().put("allFields", allFields);
var axisMap = formatResult.getAxisMap();
axisMap.forEach((axis, fields) -> {
Iterator<ChartViewFieldDTO> iterator = fields.iterator();
while (iterator.hasNext()) {
ChartViewFieldDTO fieldDTO = iterator.next();
if (desensitizationList.containsKey(fieldDTO.getDataeaseName()) || !dataeaseNames.contains(fieldDTO.getDataeaseName())) {
if (!dataeaseNames.contains(fieldDTO.getDataeaseName())) {
iterator.remove();
}
}
@ -290,6 +292,7 @@ public class ChartDataManage {
if (!fields.contains(dim.getId())) {
viewField.setSource(FieldSource.DRILL);
xAxis.add(viewField);
dillAxis.add(viewField);
fields.add(dim.getId());
}
if (i == drillRequestList.size() - 1) {
@ -298,13 +301,19 @@ public class ChartDataManage {
viewField.setSource(FieldSource.DRILL);
nextDrillField.setSort(getDrillSort(xAxis, drill.get(0)));
xAxis.add(nextDrillField);
dillAxis.add(nextDrillField);
fields.add(nextDrillField.getId());
} else {
dillAxis.add(nextDrillField);
}
}
}
}
}
}
formatResult.getContext().put("dillAxis", dillAxis);
//转义特殊字符
extFilterList = extFilterList.stream().peek(ele -> {
if (ObjectUtils.isNotEmpty(ele.getValue())) {
@ -352,10 +361,10 @@ public class ChartDataManage {
Dimension2SQLObj.dimension2sqlObj(sqlMeta, xAxis, FieldUtil.transFields(allFields), crossDs, dsMap);
Quota2SQLObj.quota2sqlObj(sqlMeta, yAxis, FieldUtil.transFields(allFields), crossDs, dsMap);
String querySql = SQLProvider.createQuerySQL(sqlMeta, true, needOrder, view);
querySql = SqlUtils.rebuildSQL(querySql, sqlMeta, crossDs, dsMap);
filterResult.getContext().put("querySql", querySql);
}
ChartCalcDataResult calcResult = chartHandler.calcChartResult(view, formatResult, filterResult, sqlMap, sqlMeta, calciteProvider);
formatResult.getContext().put("desensitizationList", desensitizationList);
return chartHandler.buildChart(view, calcResult, formatResult, filterResult);
}

View File

@ -453,13 +453,15 @@ public class CalciteProvider extends Provider {
if (StringUtils.isEmpty(configuration.getSchema())) {
DEException.throwException(Translator.get("i18n_schema_is_empty"));
}
sql = String.format("SELECT \n" +
" c.name ,t.name,ep.value \n" +
" c.name ,t.name ,ep.value \n" +
"FROM \n" +
" sys.columns AS c\n" +
"LEFT JOIN sys.extended_properties AS ep ON c.object_id = ep.major_id AND c.column_id = ep.minor_id\n" +
"LEFT JOIN sys.types AS t ON c.user_type_id = t.user_type_id\n" +
"WHERE c.object_id = OBJECT_ID('%s') ", datasourceRequest.getTable());
"LEFT JOIN sys.objects AS o ON c.object_id = o.object_id\n" +
"WHERE o.name = '%s'", datasourceRequest.getTable());
break;
case pg:
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Pg.class);

View File

@ -5,4 +5,4 @@
<path d="M47 19.5C47 19.2239 47.2239 19 47.5 19H56.5C56.7761 19 57 19.2239 57 19.5V48.5C57 48.7761 56.7761 49 56.5 49H47.5C47.2239 49 47 48.7761 47 48.5V19.5Z" />
<path d="M60 36.5C60 36.2239 60.2239 36 60.5 36H69.5C69.7761 36 70 36.2239 70 36.5V48.5C70 48.7761 69.7761 49 69.5 49H60.5C60.2239 49 60 48.7761 60 48.5V36.5Z" />
<path d="M37.686 5.23115C37.2792 4.8243 36.6138 4.84386 36.2315 5.27389L34.8455 6.83278C34.1868 7.57357 33.2442 8.63334 32.1089 9.90925C29.8382 12.4611 26.7969 15.8774 23.714 19.3352C17.5164 26.2866 11.2327 33.3131 10.6063 33.9395C10.0205 34.5252 10.0205 35.475 10.6063 36.0608C11.1921 36.6466 12.1419 36.6466 12.7277 36.0608C13.4346 35.3538 19.8175 28.2137 25.9533 21.3317C29.0371 17.8728 32.0791 14.4558 34.3501 11.9035C35.4725 10.6421 36.4066 9.59185 37.0644 8.85216L49.5834 21.3711C49.9141 21.7019 50.43 21.7592 50.8253 21.509L72.851 7.56895L72.8605 7.56229C73.5392 7.08722 73.7043 6.15192 73.2292 5.47325C72.7567 4.7983 71.8291 4.63135 71.1513 5.09682L50.5191 18.0642L37.686 5.23115Z" />
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -9,4 +9,4 @@
<path d="M60 36.5C60 36.2239 60.2239 36 60.5 36H69.5C69.7761 36 70 36.2239 70 36.5V41H60V36.5Z" />
<path d="M60 42H70V48.5C70 48.7761 69.7761 49 69.5 49H60.5C60.2239 49 60 48.7761 60 48.5V42Z" />
<path d="M37.686 5.23115C37.2792 4.8243 36.6138 4.84386 36.2315 5.27389L34.8455 6.83278C34.1868 7.57357 33.2442 8.63334 32.1089 9.90925C29.8382 12.4611 26.7969 15.8774 23.714 19.3352C17.5164 26.2866 11.2327 33.3131 10.6063 33.9395C10.0205 34.5252 10.0205 35.475 10.6063 36.0608C11.1921 36.6466 12.1419 36.6466 12.7277 36.0608C13.4346 35.3538 19.8175 28.2137 25.9533 21.3317C29.0371 17.8728 32.0791 14.4558 34.3501 11.9035C35.4725 10.6421 36.4066 9.59185 37.0644 8.85216L49.5834 21.3711C49.9141 21.7019 50.43 21.7592 50.8253 21.509L72.851 7.56895L72.8605 7.56229C73.5392 7.08722 73.7043 6.15192 73.2292 5.47325C72.7567 4.7983 71.8291 4.63135 71.1513 5.09682L50.5191 18.0642L37.686 5.23115Z" />
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -81,7 +81,10 @@ const loadPluginCategory = data => {
while (stack?.length) {
const parent = stack.pop()
if (parent.category === category) {
parent.details.push(node)
const chart = parent.details.find(chart => chart.value === node.value)
if (!chart) {
parent.details.push(node)
}
findParent = true
}
}

View File

@ -57,6 +57,7 @@ declare interface Chart {
jumpActive: boolean
aggregate?: boolean
plugin?: CustomPlugin
isPlugin: boolean
}
declare type CustomAttr = DeepPartial<ChartAttr> | JSONString<DeepPartial<ChartAttr>>
declare type CustomStyle = DeepPartial<ChartStyle> | JSONString<DeepPartial<ChartStyle>>

View File

@ -393,6 +393,7 @@ export const dvMainStore = defineStore('dataVisualization', {
id: component.id,
type: component.innerType,
render: component.render,
isPlugin: component.isPlugin,
plugin: {
isPlugin: component.isPlugin,
staticMap: component.staticMap

View File

@ -348,7 +348,7 @@ onMounted(() => {
<el-select
:effect="themes"
v-model="state.basicStyleForm.mapStyle"
@change="changeBasicStyle('mapBaseStyle')"
@change="changeBasicStyle('mapStyle')"
>
<el-option
v-for="item in mapStyleOptions"

View File

@ -373,7 +373,7 @@ onMounted(() => {
<el-form-item v-if="showProperty('customContent')" :class="'form-item-' + themes">
<template #label>
<span class="data-area-label">
<span>
<span style="margin-right: 4px">
{{ t('chart.content_formatter') }}
</span>
<el-tooltip class="item" :effect="toolTip" placement="bottom">
@ -996,4 +996,12 @@ onMounted(() => {
border-color: rgba(255, 255, 255, 0.15);
}
}
.data-area-label {
text-align: left;
position: relative;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
</style>

View File

@ -487,7 +487,7 @@ onMounted(() => {
<el-form-item v-if="showProperty('customContent')" :class="'form-item-' + themes">
<template #label>
<span class="data-area-label">
<span>
<span style="margin-right: 4px">
{{ t('chart.content_formatter') }}
</span>
<el-tooltip class="item" :effect="toolTip" placement="bottom">
@ -828,4 +828,12 @@ onMounted(() => {
.form-item-checkbox {
margin-bottom: 8px !important;
}
.data-area-label {
text-align: left;
position: relative;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
</style>

View File

@ -262,9 +262,6 @@ const chartStyleShow = computed(() => {
})
const chartViewInstance = computed(() => {
if (view.value.render === 'highchart') {
return chartViewManager.getChartView('antv', view.value.type)
}
return chartViewManager.getChartView(view.value.render, view.value.type)
})
const showAxis = (axis: AxisType) => chartViewInstance.value?.axis?.includes(axis)
@ -559,6 +556,33 @@ const showAggregate = computed<boolean>(() => {
return false
})
const disableUpdate = computed(() => {
let flag = false
if (view.value.type === 'table-info') {
return flag
}
if (!chartViewInstance.value) {
return flag
}
const axisConfig = chartViewInstance.value.axisConfig
if (!axisConfig) {
return flag
}
for (const key in axisConfig) {
if (Object.prototype.hasOwnProperty.call(axisConfig, key)) {
const axis = view.value[key]
if (axis instanceof Array) {
axis.forEach(a => {
if (a.desensitized) {
flag = true
}
})
}
}
}
return flag
})
const addAxis = (e, axis: AxisType) => {
recordSnapshotInfo('calcData')
const axisSpec = chartViewInstance.value?.axisConfig[axis]
@ -2210,8 +2234,26 @@ onMounted(() => {
<!-- extBubble -->
<el-row class="padding-lr drag-data" v-if="showAxis('extBubble')">
<div class="form-draggable-title">
<span>
{{ chartViewInstance.axisConfig.extBubble.name }}
<span class="data-area-label">
<span style="margin-right: 4px">
{{ chartViewInstance.axisConfig.extBubble.name }}
</span>
<el-tooltip
v-if="chartViewInstance.axisConfig.extBubble.tooltip"
class="item"
:effect="toolTip"
placement="top"
>
<template #content>
<span> {{ chartViewInstance.axisConfig.extBubble.tooltip }}</span>
</template>
<el-icon
class="hint-icon"
:class="{ 'hint-icon--dark': themes === 'dark' }"
>
<Icon name="icon_info_outlined" />
</el-icon>
</el-tooltip>
</span>
<el-tooltip :effect="toolTip" placement="top" :content="t('common.delete')">
<el-icon
@ -2464,6 +2506,7 @@ onMounted(() => {
</div>
<el-button
:disabled="disableUpdate"
type="primary"
class="result-style-button"
@click="updateChartData(view)"

View File

@ -55,7 +55,8 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
extBubble: {
name: `${t('chart.bubble_size')} / ${t('chart.quota')}`,
type: 'q',
limit: 1
limit: 1,
tooltip: '该指标生效时样式基础样式中的大小属性将失效'
}
}
constructor() {
@ -139,9 +140,32 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
}
})
})
scene.once('loaded', () => {
this.autoZoom(symbolicLayer, scene)
})
return new L7Wrapper(scene, configList)
}
/**
* 根据数据自动缩放大小及位置
* @param symbolicLayer
* @param scene
*/
autoZoom = (symbolicLayer, scene) => {
const roamMap = flag => {
return flag ? scene.zoomIn() : scene.zoomOut()
}
const resetZoom = () => {
symbolicLayer.fitBounds()
}
symbolicLayer && resetZoom()
// 自动放大两级
let index = 2
while (index--) {
roamMap(true)
}
}
/**
* 构建符号图层
* @param chart

View File

@ -45,6 +45,7 @@ import DeRichTextView from '@/custom-component/rich-text/DeRichTextView.vue'
import ChartEmptyInfo from '@/views/chart/components/views/components/ChartEmptyInfo.vue'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { viewFieldTimeTrans } from '@/utils/viewUtils'
import { CHART_TYPE_CONFIGS } from '@/views/chart/components/editor/util/chart'
const { wsCache } = useCache()
const chartComponent = ref<any>()
@ -473,9 +474,21 @@ const calcData = params => {
dvMainStore.setLastViewRequestInfo(params.id, params.chartExtRequest)
if (chartComponent?.value) {
loading.value = true
chartComponent?.value?.calcData?.(params, res => {
loading.value = false
})
if (view.value.isPlugin) {
chartComponent?.value?.invokeMethod({
methodName: 'calcData',
args: [
params,
res => {
loading.value = false
}
]
})
} else {
chartComponent?.value?.calcData?.(params, res => {
loading.value = false
})
}
}
}
@ -503,7 +516,9 @@ const listenerEnable = computed(() => {
return !showPosition.value.includes('viewDialog')
})
onMounted(() => {
queryData(true && !showPosition.value.includes('viewDialog'))
if (!view.value.isPlugin) {
queryData(true && !showPosition.value.includes('viewDialog'))
}
if (!listenerEnable.value) {
return
}
@ -693,6 +708,55 @@ const showActionIcons = computed(() => {
}
return trackMenu.value.length > 0 || state.title_remark.show
})
const chartConfigs = ref(CHART_TYPE_CONFIGS)
const pluginLoaded = computed(() => {
let result = false
chartConfigs.value.forEach(cat => {
result = cat.details.find(chart => view.value?.type === chart.value) !== undefined
})
return result
})
// TODO
const loadPluginCategory = data => {
data.forEach(item => {
const { category, title, render, chartValue, chartTitle, icon, staticMap } = item
const node = {
render,
category,
icon,
value: chartValue,
title: chartTitle,
isPlugin: true,
staticMap
}
if (view.value?.type === node.value) {
view.value.plugin = {
isPlugin: true,
staticMap
}
}
const stack = [...chartConfigs.value]
let findParent = false
while (stack?.length) {
const parent = stack.pop()
if (parent.category === category) {
const chart = parent.details.find(chart => chart.value === node.value)
if (!chart) {
parent.details.push(node)
}
findParent = true
}
}
if (!findParent) {
stack.push({
category,
title,
display: 'show',
details: [node]
})
}
})
}
</script>
<template>
@ -761,7 +825,7 @@ const showActionIcons = computed(() => {
<!--这里去渲染不同图库的图表-->
<div v-if="chartAreaShow" style="flex: 1; overflow: hidden">
<plugin-component
v-if="view.plugin?.isPlugin"
v-if="view.isPlugin"
:jsname="view.plugin.staticMap['index']"
:scale="scale"
:dynamic-area-id="dynamicAreaId"
@ -831,6 +895,11 @@ const showActionIcons = computed(() => {
ref="openHandler"
jsname="L2NvbXBvbmVudC9lbWJlZGRlZC1pZnJhbWUvT3BlbkhhbmRsZXI="
/>
<XpackComponent
v-if="!pluginLoaded && view.isPlugin"
jsname="L2NvbXBvbmVudC9wbHVnaW5zLWhhbmRsZXIvVmlld0NhdGVnb3J5SGFuZGxlcg=="
@load-plugin-category="loadPluginCategory"
/>
</div>
</template>

View File

@ -1,8 +1,10 @@
<script setup lang="ts">
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { onMounted, reactive } from 'vue'
import { onMounted, reactive, ref } from 'vue'
import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
import router from '@/router'
import { useEmitt } from '@/hooks/web/useEmitt'
import ExportExcel from '@/views/visualized/data/dataset/ExportExcel.vue'
import { initCanvasData } from '@/utils/canvasUtils'
import { queryTargetVisualizationJumpInfo } from '@/api/visualization/linkJump'
import { Base64 } from 'js-base64'
@ -119,6 +121,12 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
let p = null
const XpackLoaded = () => p(true)
onMounted(async () => {
useEmitt({
name: 'data-export-center',
callback: function (params) {
ExportExcelRef.value.init(params)
}
})
await new Promise(r => (p = r))
const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId
const { dvType, callBackFlag, taskId } = router.currentRoute.value.query
@ -132,6 +140,7 @@ onMounted(async () => {
dvMainStore.setEmbeddedCallBack(callBackFlag || 'no')
dvMainStore.setPublicLinkStatus(props.publicLinkStatus)
})
const ExportExcelRef = ref()
defineExpose({
loadCanvasDataAsync
@ -156,6 +165,7 @@ defineExpose({
@loaded="XpackLoaded"
@load-fail="XpackLoaded"
/>
<ExportExcel ref="ExportExcelRef"></ExportExcel>
</template>
<style lang="less">

View File

@ -42,7 +42,7 @@
:disabled="!linkCustom"
@blur="finishEditUuid"
>
<template #prefix>
<template v-if="!linkCustom" #prefix>
{{ formatLinkBase() }}
</template>
</el-input>
@ -122,7 +122,6 @@
</div>
<div v-if="shareEnable && showTicket" class="share-ticket-container">
<share-ticket
:link-url="linkAddr"
:uuid="state.detailInfo.uuid"
:resource-id="props.resourceId"
:ticket-require="state.detailInfo.ticketRequire"
@ -150,7 +149,8 @@ import { ShareInfo, SHARE_BASE, shortcuts } from './option'
import { ElMessage, ElLoading } from 'element-plus-secondary'
import useClipboard from 'vue-clipboard3'
import ShareTicket from './ShareTicket.vue'
import { useEmbedded } from '@/store/modules/embedded'
const embeddedStore = useEmbedded()
const { toClipboard } = useClipboard()
const { t } = useI18n()
const props = defineProps({
@ -311,8 +311,8 @@ const formatLinkAddr = () => {
}
const formatLinkBase = () => {
let prefix = '/'
if (window.DataEaseBi?.baseUrl) {
prefix = window.DataEaseBi.baseUrl + '#'
if (embeddedStore.baseUrl) {
prefix = embeddedStore.baseUrl + '#'
} else {
const href = window.location.href
prefix = href.substring(0, href.indexOf('#') + 1)

View File

@ -156,11 +156,14 @@ import { useI18n } from '@/hooks/web/useI18n'
import request from '@/config/axios'
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
import useClipboard from 'vue-clipboard3'
import { useEmbedded } from '@/store/modules/embedded'
import { SHARE_BASE } from './option'
const embeddedStore = useEmbedded()
const { toClipboard } = useClipboard()
const { t } = useI18n()
const props = defineProps({
linkUrl: propTypes.string.def(null),
uuid: propTypes.string.def(null),
uuid: propTypes.string.def(''),
resourceId: propTypes.string.def(null),
ticketRequire: propTypes.bool
})
@ -234,9 +237,21 @@ const addRow = () => {
state.tableData.splice(0, 0, row)
})
}
const formatLinkAddr = () => {
return formatLinkBase() + props.uuid
}
const formatLinkBase = () => {
let prefix = '/'
if (embeddedStore.baseUrl) {
prefix = embeddedStore.baseUrl + '#'
} else {
const href = window.location.href
prefix = href.substring(0, href.indexOf('#') + 1)
}
return prefix + SHARE_BASE
}
const copyTicket = async ticket => {
const url = `${props.linkUrl}?ticket=${ticket}`
const url = `${formatLinkAddr()}?ticket=${ticket}`
try {
await toClipboard(url)
ElMessage.success(t('common.copy_success'))

View File

@ -123,7 +123,6 @@
</div>
<div v-if="shareEnable && showTicket" class="share-ticket-container">
<share-ticket
:link-url="linkAddr"
:uuid="state.detailInfo.uuid"
:resource-id="props.resourceId"
:ticket-require="state.detailInfo.ticketRequire"
@ -143,7 +142,8 @@ import { ShareInfo, SHARE_BASE, shortcuts } from './option'
import { ElMessage, ElLoading } from 'element-plus-secondary'
import useClipboard from 'vue-clipboard3'
import ShareTicket from './ShareTicket.vue'
import { useEmbedded } from '@/store/modules/embedded'
const embeddedStore = useEmbedded()
const { toClipboard } = useClipboard()
const { t } = useI18n()
const props = defineProps({
@ -282,8 +282,8 @@ const formatLinkAddr = () => {
}
const formatLinkBase = () => {
let prefix = '/'
if (window.DataEaseBi?.baseUrl) {
prefix = window.DataEaseBi.baseUrl + '#'
if (embeddedStore.baseUrl) {
prefix = embeddedStore.baseUrl + '#'
} else {
const href = window.location.href
prefix = href.substring(0, href.indexOf('#') + 1)

View File

@ -155,7 +155,7 @@ const rule = reactive<FormRules>({
}
]
})
const activeName = ref('third')
const activeName = ref('table')
provide('api-active-name', activeName)
const initApiItem = (val: ApiItem, from, name) => {
activeName.value = name
@ -220,6 +220,21 @@ const saveItem = () => {
ElMessage.error(t('datasource.api_field_not_empty'))
return
}
if (apiItem.type === 'params') {
for (let i = 0; i < apiItem.fields.length; i++) {
for (let j = 0; j < paramsList.length; j++) {
for (let k = 0; k < paramsList[j].fields.length; k++) {
if (
apiItem.fields[i].name === paramsList[j].fields[k].name &&
apiItem.serialNumber !== paramsList[j].serialNumber
) {
ElMessage.error('已经存在同名参数:' + apiItem.fields[i].name)
return
}
}
}
}
}
for (let i = 0; i < apiItem.fields.length - 1; i++) {
for (let j = i + 1; j < apiItem.fields.length; j++) {
if (apiItem.fields[i].name === apiItem.fields[j].name) {
@ -241,15 +256,28 @@ const next = () => {
ElMessage.error(t('datasource.please_input_dataPath'))
return
}
for (let i = 0; i < apiItemList.length; i++) {
if (
apiItemList[i].name === apiItem.name &&
apiItem.serialNumber !== apiItemList[i].serialNumber
) {
ElMessage.error(t('datasource.has_repeat_name'))
return
if (apiItem.type === 'params') {
for (let i = 0; i < paramsList.length; i++) {
if (
paramsList[i].name === apiItem.name &&
apiItem.serialNumber !== paramsList[i].serialNumber
) {
ElMessage.error('已经存在同名的参数表')
return
}
}
} else {
for (let i = 0; i < apiItemList.length; i++) {
if (
apiItemList[i].name === apiItem.name &&
apiItem.serialNumber !== apiItemList[i].serialNumber
) {
ElMessage.error(t('datasource.has_repeat_name'))
return
}
}
}
cancelMap['/datasource/checkApiDatasource']?.()
const params = Base64.encode(JSON.stringify(paramsList))
@ -441,7 +469,7 @@ defineExpose({
{{ active <= 1 ? '2' : '' }}
</span>
<span class="title">{{
activeName === 'third' ? t('datasource.api_step_2') : '提取参数'
activeName === 'table' ? t('datasource.api_step_2') : '提取参数'
}}</span>
</div>
</template>

View File

@ -82,7 +82,6 @@ const options = [
value: 'fixed'
}
]
const value = ref('')
</script>
<template>

View File

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'
import { computed, onBeforeMount, PropType, toRefs } from 'vue'
import { computed, onBeforeMount, PropType, toRefs, inject } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { KeyValue } from './ApiTestModel.js'
import { guid } from '@/views/visualized/data/dataset/form/util'
@ -91,6 +91,7 @@ const createFilter = (queryString: string) => {
return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
}
}
const activeName = inject('api-active-name')
</script>
<template>
@ -149,7 +150,7 @@ const createFilter = (queryString: string) => {
/>
</el-col>
<el-col :span="5">
<el-col :span="activeName === 'params' ? 10 : 5">
<el-input
v-model="element.description"
maxlength="200"
@ -157,7 +158,7 @@ const createFilter = (queryString: string) => {
show-word-limit
/>
</el-col>
<el-col :span="5">
<el-col v-if="activeName !== 'params'" :span="5">
<el-autocomplete
v-if="suggestions"
v-model="element.name"

View File

@ -379,6 +379,9 @@ const returnItem = apiItem => {
if (form.value.paramsConfiguration[i].serialNumber === apiItem.serialNumber) {
find = true
form.value.paramsConfiguration[i] = apiItem
if (apiItem.serialNumber === activeParamsID.value) {
setActiveName(apiItem)
}
}
}
if (!find) {
@ -498,6 +501,7 @@ const apiRule = {
const dialogEditParams = ref(false)
const dialogRenameApi = ref(false)
const activeParamsName = ref('')
const activeParamsID = ref(0)
const paramsObj = ref({
name: '',
id: 1,
@ -542,6 +546,7 @@ const apiObjRules = {
const setActiveName = val => {
gridData.value = val.fields
activeParamsName.value = val.name
activeParamsName.value = val.serialNumber
}
const paramsObjRef = ref()

View File

@ -2,12 +2,14 @@ package io.dataease.extensions.view.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AxisFormatResult {
private Map<ChartAxis, List<ChartViewFieldDTO>> axisMap;
private Map<String, Object> context;

View File

@ -18,7 +18,7 @@ public abstract class AbstractChartPlugin implements DataEasePlugin {
@Override
public void loadPlugin() {
XpackPluginsViewVO viewConfig = getConfig();
PluginsChartFactory.loadPlugin(viewConfig.getRender(), viewConfig.getCategory(), this);
PluginsChartFactory.loadPlugin(viewConfig.getRender(), viewConfig.getChartValue(), this);
}