From c22c3605eb2b691a9cda7943c33ba257c427ec67 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 1 Aug 2024 11:00:08 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E7=9A=84=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=86=8D=E5=AF=BC=E5=85=A5=E5=88=B0=E6=A8=A1=E6=9D=BF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=B8=AD=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/DataVisualizationServer.java | 19 +++++++++++++------ core/core-frontend/src/utils/imgUtils.ts | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java index e53d980086..27461a0363 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java @@ -576,12 +576,19 @@ public class DataVisualizationServer implements DataVisualizationApi { // 模板市场记录 coreOptRecentManage.saveOpt(request.getResourceName(), OptConstants.OPT_RESOURCE_TYPE.TEMPLATE, OptConstants.OPT_TYPE.NEW); } - if(StringUtils.isNotEmpty(appDataStr)){ - VisualizationExport2AppVO appDataFormat = JsonUtil.parseObject(appDataStr,VisualizationExport2AppVO.class); - String dvInfo = appDataFormat.getVisualizationInfo(); - VisualizationBaseInfoVO baseInfoVO = JsonUtil.parseObject(dvInfo,VisualizationBaseInfoVO.class); - Long sourceDvId = baseInfoVO.getId(); - appDataStr = appDataStr.replaceAll(sourceDvId.toString(), newDvId.toString()); + if(StringUtils.isNotEmpty(appDataStr) && appDataStr.length()>10){ + try{ + VisualizationExport2AppVO appDataFormat = JsonUtil.parseObject(appDataStr,VisualizationExport2AppVO.class); + String dvInfo = appDataFormat.getVisualizationInfo(); + VisualizationBaseInfoVO baseInfoVO = JsonUtil.parseObject(dvInfo,VisualizationBaseInfoVO.class); + Long sourceDvId = baseInfoVO.getId(); + appDataStr = appDataStr.replaceAll(sourceDvId.toString(), newDvId.toString()); + }catch (Exception e){ + LogUtil.error(e); + appDataStr = null; + } + }else{ + appDataStr = null; } // 解析动态数据 Map dynamicDataMap = JsonUtil.parseObject(dynamicData, Map.class); diff --git a/core/core-frontend/src/utils/imgUtils.ts b/core/core-frontend/src/utils/imgUtils.ts index 0aa5825cde..f824dda73a 100644 --- a/core/core-frontend/src/utils/imgUtils.ts +++ b/core/core-frontend/src/utils/imgUtils.ts @@ -56,7 +56,7 @@ export function download2AppTemplate(downloadType, canvasDom, name, attachParams componentData: JSON.stringify(componentData.value), dynamicData: JSON.stringify(canvasViewDataTemplate), staticResource: JSON.stringify(staticResource || {}), - appData: JSON.stringify(attachParams || {}) + appData: attachParams ? JSON.stringify(attachParams) : null } const blob = new Blob([JSON.stringify(templateInfo)], { type: '' }) if (downloadType === 'template') { From 578affd9a63cb150fd33896dd39da06e96fdf602 Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Thu, 1 Aug 2024 11:39:50 +0800 Subject: [PATCH 2/8] chore: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09d75a224b..9a475b5822 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ curl -sSL https://dataease.oss-cn-hangzhou.aliyuncs.com/quick_start_v2.sh | bash - [MaxKB](https://github.com/1panel-dev/MaxKB/) - 基于 LLM 大语言模型的开源知识库问答系统 - [JumpServer](https://github.com/jumpserver/jumpserver/) - 广受欢迎的开源堡垒机 - [Halo](https://github.com/halo-dev/halo/) - 强大易用的开源建站工具 -- [MeterSphere](https://github.com/metersphere/metersphere/) - 开源的测试管理和接口测试工具 +- [MeterSphere](https://github.com/metersphere/metersphere/) - 新一代的开源持续测试工具 ## License From 2f5976105af8ab9643cd4070c00fa0b05c462458 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 1 Aug 2024 11:44:17 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix(X-Pack):=20=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=92=8CLDAP=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- de-xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/de-xpack b/de-xpack index 5dfbeaaf9c..b599a20410 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 5dfbeaaf9c02463f0fb7b9589ae78bd09ab88fc4 +Subproject commit b599a20410e4562a964ccb6e0f732cf0ce0671fa From 996ac9adec29987e1c77a5e6fdf1f32a38e6c616 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 1 Aug 2024 11:58:28 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix(xpack):=20vue=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/plugin/src/index.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/core-frontend/src/components/plugin/src/index.vue b/core/core-frontend/src/components/plugin/src/index.vue index d412975937..3f0aeaae0d 100644 --- a/core/core-frontend/src/components/plugin/src/index.vue +++ b/core/core-frontend/src/components/plugin/src/index.vue @@ -117,12 +117,12 @@ onMounted(async () => { plugin.value = xpack.default } else if (!window._de_xpack_not_loaded) { window._de_xpack_not_loaded = true - window['Vue'] = Vue - window['Axios'] = axios - window['Pinia'] = Pinia - window['vueRouter'] = router - window['MittAll'] = useEmitt().emitter.all - window['I18n'] = i18n + window['VueDe'] = Vue + window['AxiosDe'] = axios + window['PiniaDe'] = Pinia + window['vueRouterDe'] = router + window['MittAllDe'] = useEmitt().emitter.all + window['I18nDe'] = i18n if (!window.tinymce) { window.tinymce = tinymce } From d9a9e7a0160a453e4f849650ca3fe2d79a2c78a6 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Thu, 1 Aug 2024 12:50:28 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=82=B9=E5=87=BB=E6=94=BE=E5=A4=A7=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=90=8E=E7=82=B9=E5=87=BB=E5=85=B3=E9=97=AD=EF=BC=8C=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=9C=80=E5=80=BC=E6=B6=88=E5=A4=B1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/js/extremumUitl.ts | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts index 649f6983ad..5b9f3ee3b6 100644 --- a/core/core-frontend/src/views/chart/components/js/extremumUitl.ts +++ b/core/core-frontend/src/views/chart/components/js/extremumUitl.ts @@ -4,7 +4,7 @@ import { isEmpty } from 'lodash-es' export const clearExtremum = chart => { // 清除图表标注 - const pointElement = document.getElementById('point_' + chart.id) + const pointElement = document.getElementById(chartPointParentId(chart)) if (pointElement) { pointElement.remove() pointElement.parentNode?.removeChild(pointElement) @@ -51,13 +51,13 @@ const getRgbaColorLastRgba = (rgbaString: string) => { return lastRGBA } -function createExtremumDiv(id, value, formatterCfg, chartId) { +function createExtremumDiv(id, value, formatterCfg, chart) { // 空值不处理 if (!value && value != 0) { return } // 装标注的div - const parentElement = document.getElementById('point_' + chartId) + const parentElement = document.getElementById(chartPointParentId(chart)) if (parentElement) { // 标注div const element = document.getElementById(id) @@ -103,8 +103,16 @@ const noChildrenFieldChart = chart => { return ['area', 'bar'].includes(chart.type) } +const chartContainerId = chart => { + return chart.container + '_' +} + +const chartPointParentId = chart => { + return chart.container + '_point_' + chart.id + '_' +} + const overlap = chart => { - const container = document.getElementById('point_' + chart.id) + const container = document.getElementById(chartPointParentId(chart)) const children = Array.from(container.getElementsByClassName('child')) function getOverlapArea(rect1, rect2) { @@ -145,7 +153,7 @@ export const extremumEvt = (newChart, chart, _options, container) => { chart.container = container const { label: labelAttr } = parseJson(chart.customAttr) const { yAxis } = parseJson(chart) - newChart.on('beforerender', ev => { + newChart.once('beforerender', ev => { ev.view.on('beforepaint', () => { newChart.chart.geometries[0]?.beforeMappingData.forEach(i => { i.forEach(item => { @@ -184,7 +192,7 @@ export const extremumEvt = (newChart, chart, _options, container) => { .getController('legend') .components[0].component.cfg.items.filter(l => !l.unchecked) if (legendShowSize.length === 0) { - const allElement = document.getElementById('point_' + chart.id) + const allElement = document.getElementById(chartPointParentId(chart)) if (allElement && allElement.childNodes) { allElement.childNodes.forEach(c => { c.style.display = 'none' @@ -216,12 +224,11 @@ export const createExtremumPoint = (chart, ev) => { const pointSize = basicStyle.lineSymbolSize const { yAxis } = parseJson(chart) clearExtremum(chart) - const parentKey = 'point_' + chart.id // 创建标注父元素 - const divParentElement = document.getElementById(parentKey) + const divParentElement = document.getElementById(chartPointParentId(chart)) if (!divParentElement) { const divParent = document.createElement('div') - divParent.id = parentKey + divParent.id = chartPointParentId(chart) divParent.style.position = 'fixed' divParent.style.zIndex = '1' // 将父标注加入到图表中 @@ -267,12 +274,17 @@ export const createExtremumPoint = (chart, ev) => { return } const maxKey = - parentKey + - 'point_' + + chartContainerId(chart) + + chartPointParentId(chart) + pointObj._origin.category + - '-' + + '_' + (maxItem ? maxItem._origin.value : minItem._origin.value) - const minKey = parentKey + 'point_' + pointObj._origin.category + '-' + minItem._origin.value + const minKey = + chartContainerId(chart) + + chartPointParentId(chart) + + pointObj._origin.category + + '_' + + minItem._origin.value // 最值标注 if (showExtremum && labelAttr.show) { if (maxItem) { @@ -280,18 +292,22 @@ export const createExtremumPoint = (chart, ev) => { maxKey, maxItem._origin.value, attr ? attr.formatterCfg : labelAttr.labelFormatter, - chart.id + chart ) } createExtremumDiv( minKey, minItem._origin.value, attr ? attr.formatterCfg : labelAttr.labelFormatter, - chart.id + chart ) pointObjList.forEach(point => { const pointElement = document.getElementById( - parentKey + 'point_' + point._origin.category + '-' + point._origin.value + chartContainerId(chart) + + chartPointParentId(chart) + + point._origin.category + + '_' + + point._origin.value ) if (pointElement && point._origin.EXTREME) { pointElement.style.position = 'absolute' From 13a1d1f8ebdb71de112f72aed7dba3dd190ef4b4 Mon Sep 17 00:00:00 2001 From: ulleo Date: Thu, 1 Aug 2024 14:34:37 +0800 Subject: [PATCH 6/8] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8)=EF=BC=9A=E5=8F=8C?= =?UTF-8?q?=E8=BD=B4=E7=B1=BB=E5=9E=8B=E5=9B=BE=E8=A1=A8=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=BB=B4=E5=BA=A6=E8=BF=9B=E8=A1=8C=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/models/chart/editor.d.ts | 1 + .../editor/editor-style/ChartStyle.vue | 15 + .../components/CustomColorStyleSelect.vue | 108 ++++- .../components/DualBasicStyleSelector.vue | 420 ++++++++++++++++++ .../panel/charts/others/chart-mix-common.ts | 46 +- .../js/panel/charts/others/chart-mix.ts | 348 +++++++++++++-- .../components/js/panel/types/impl/g2plot.ts | 4 + 7 files changed, 880 insertions(+), 62 deletions(-) create mode 100644 core/core-frontend/src/views/chart/components/editor/editor-style/components/DualBasicStyleSelector.vue diff --git a/core/core-frontend/src/models/chart/editor.d.ts b/core/core-frontend/src/models/chart/editor.d.ts index 7196366466..58b3bd8a86 100644 --- a/core/core-frontend/src/models/chart/editor.d.ts +++ b/core/core-frontend/src/models/chart/editor.d.ts @@ -1,6 +1,7 @@ declare type EditorProperty = | 'background-overall-component' | 'basic-style-selector' + | 'dual-basic-style-selector' | 'label-selector' | 'tooltip-selector' | 'x-axis-selector' diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue index 4596694f2b..dfe016730d 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue @@ -14,6 +14,7 @@ import { storeToRefs } from 'pinia' import CollapseSwitchItem from '@/components/collapse-switch-item/src/CollapseSwitchItem.vue' import { ElCollapse, ElCollapseItem } from 'element-plus-secondary' import BasicStyleSelector from '@/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue' +import DualBasicStyleSelector from '@/views/chart/components/editor/editor-style/components/DualBasicStyleSelector.vue' import ComponentPosition from '@/components/visualization/common/ComponentPosition.vue' import BackgroundOverallCommon from '@/components/visualization/component-background/BackgroundOverallCommon.vue' import TableHeaderSelector from '@/views/chart/components/editor/editor-style/components/table/TableHeaderSelector.vue' @@ -242,6 +243,20 @@ watch( @onMiscChange="onMiscChange" /> + + + chart: ChartObj + sub?: boolean }>(), { - themes: 'light' + themes: 'light', + sub: false } ) const dvMainStore = dvMainStoreWithOut() @@ -34,7 +36,7 @@ const { batchOptStatus } = storeToRefs(dvMainStore) const emits = defineEmits(['update:modelValue', 'changeBasicStyle']) const changeChartType = () => { if (isColorGradient.value) { - state.value.basicStyleForm.colorScheme = 'default' + state.value.basicStyleForm[colorSchemeName.value] = 'default' changeColorOption({ value: 'default' }) } } @@ -50,28 +52,79 @@ const seriesColorState = reactive({ curColorIndex: 0, seriesColorPickerId: 'body' }) + +const instance = ref() + +const colorsName = computed(() => { + return props.sub ? 'subColors' : 'colors' +}) +const colorSchemeName = computed(() => { + return props.sub ? 'subColorScheme' : 'colorScheme' +}) +const seriesColorName = computed(() => { + return props.sub ? 'subSeriesColor' : 'seriesColor' +}) + +const needSetSeriesColor = computed(() => { + return ( + instance.value?.propertyInner?.['basic-style-selector']?.includes('seriesColor') || + instance.value?.propertyInner?.['dual-basic-style-selector']?.includes('seriesColor') + ) +}) + +const needSetSubSeriesColor = computed(() => { + return instance.value?.propertyInner?.['dual-basic-style-selector']?.includes('subSeriesColor') +}) + const setupSeriesColor = () => { if (batchOptStatus.value || !props.chart) { return } - const instance = chartViewManager.getChartView( + + instance.value = chartViewManager.getChartView( props.chart.render, props.chart.type ) as G2PlotChartView - if (!instance?.propertyInner?.['basic-style-selector'].includes('seriesColor')) { - return + + if (!props.sub) { + if (!needSetSeriesColor.value) { + return + } + } else { + if (!needSetSubSeriesColor.value) { + return + } } - const viewData = dvMainStore.getViewOriginData(props.chart.id) + let viewData = dvMainStore.getViewOriginData(props.chart.id) if (!viewData) { return } - const newSeriesColor = instance.setupSeriesColor(props.chart, viewData.data) + + if (props.chart.type.includes('chart-mix')) { + if (props.sub) { + viewData = viewData.right?.data?.[0] + } else { + viewData = viewData.left?.data?.[0] + } + } + if (!viewData) { + return + } + + const sFunction = props.sub + ? instance.value?.setupSubSeriesColor + : instance.value.setupSeriesColor + if (!sFunction) { + return + } + const newSeriesColor = sFunction(props.chart, viewData.data) const oldSeriesColor = - props.chart.customAttr.basicStyle.seriesColor?.reduce((p, n) => { + props.chart.customAttr.basicStyle[seriesColorName.value]?.reduce((p, n) => { p[n.id] = n return p }, {}) || {} + newSeriesColor?.forEach(item => { const oldColorItem = oldSeriesColor[item.id] if (oldColorItem) { @@ -116,7 +169,7 @@ const changeSeriesColor = () => { } }) if (changed) { - state.value.basicStyleForm.seriesColor = seriesColorState.seriesColor + state.value.basicStyleForm[seriesColorName.value] = seriesColorState.seriesColor changeBasicStyle('seriesColor') } } @@ -154,7 +207,7 @@ const colorCaseSelectorRef = ref>() const customColorPickerRef = ref>() function selectColorCase(option) { - state.value.basicStyleForm.colorScheme = option.value + state.value.basicStyleForm[colorSchemeName.value] = option.value colorCaseSelectorRef.value?.hide() changeColorOption(option) } @@ -162,13 +215,14 @@ function selectColorCase(option) { const changeColorOption = (option?) => { let isGradient = option?.value?.endsWith('_split_gradient') || isColorGradient.value const getColorItems = isGradient ? getMapColorCases(colorCases) : colorCases - const items = getColorItems.filter(ele => ele.value === state.value.basicStyleForm.colorScheme) - + const items = getColorItems.filter( + ele => ele.value === state.value.basicStyleForm[colorSchemeName.value] + ) if (items.length > 0) { - state.value.basicStyleForm.colors = [...items[0].colors] - state.value.customColor = state.value.basicStyleForm.colors[0] + state.value.basicStyleForm[colorsName.value] = [...items[0].colors] + state.value.customColor = state.value.basicStyleForm[colorsName.value][0] state.value.colorIndex = 0 - state.value.basicStyleForm.seriesColor?.forEach((c, i) => { + state.value.basicStyleForm[seriesColorName.value]?.forEach((c, i) => { const length = items[0].colors.length c.color = items[0].colors[i % length] }) @@ -181,22 +235,22 @@ const resetCustomColor = () => { const switchColorCase = () => { const { colorIndex, customColor, basicStyleForm } = state.value - const colors = basicStyleForm.colors + const colors = basicStyleForm[colorsName.value] if (isColorGradient.value) { let startColor = colorIndex === 0 ? customColor : colors[0] let endColor = colorIndex === 0 ? colors[8] : customColor - basicStyleForm.colors = stepsColor(startColor, endColor, 9, 1) + basicStyleForm[colorsName.value] = stepsColor(startColor, endColor, 9, 1) } else { colors[colorIndex] = customColor } changeBasicStyle() } const isColorGradient = computed(() => - state.value.basicStyleForm.colorScheme.endsWith('_split_gradient') + state.value.basicStyleForm[colorSchemeName.value].endsWith('_split_gradient') ) const showColorGradientIndex = index => { - return index === 0 || index === state.value.basicStyleForm.colors.length - 1 + return index === 0 || index === state.value.basicStyleForm[colorsName.value].length - 1 } const switchColor = (index, c) => { if (isColorGradient.value && !showColorGradientIndex(index)) { @@ -279,7 +333,7 @@ const colorItemBorderColor = (index, state) => {