From a5ac9031404973f79121d8595521b4b57aede6a3 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 12 Aug 2024 14:57:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E8=AE=A1=E7=AE=97=E5=AD=97=E6=AE=B5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=AE=BE=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/canvas/CanvasCore.vue | 8 ++ .../canvas/ComponentWrapper.vue | 3 +- .../data-visualization/canvas/DePreview.vue | 7 ++ .../data-visualization/canvas/Shape.vue | 6 ++ .../visualization/ComponentEditBar.vue | 9 +- .../visualization/DatasetParamsComponent.vue | 98 ++++++++++++------- .../indicator/DeIndicator.vue | 2 +- .../rich-text/DeRichTextView.vue | 4 +- .../modules/data-visualization/dvMain.ts | 8 +- .../views/components/ChartComponentG2Plot.vue | 2 +- .../views/components/ChartComponentS2.vue | 2 +- 11 files changed, 104 insertions(+), 45 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index b3af403303..eb7e036a7b 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -45,6 +45,7 @@ import DragInfo from '@/components/visualization/common/DragInfo.vue' import { activeWatermark } from '@/components/watermark/watermark' import { personInfoApi } from '@/api/user' import PopArea from '@/custom-component/pop-area/Component.vue' +import DatasetParamsComponent from '@/components/visualization/DatasetParamsComponent.vue' const snapshotStore = snapshotStoreWithOut() const dvMainStore = dvMainStoreWithOut() @@ -203,6 +204,7 @@ const isShowArea = ref(false) const svgFilterAttrs = ['width', 'height', 'top', 'left', 'rotate', 'backgroundColor'] const commonFilterAttrs = ['width', 'height', 'top', 'left', 'rotate'] const userViewEnlargeRef = ref(null) +const customDatasetParamsRef = ref(null) const linkJumpRef = ref(null) const linkageRef = ref(null) const mainDomId = ref('editor-' + canvasId.value) @@ -1346,6 +1348,10 @@ const userViewEnlargeOpen = (opt, item) => { ) } +const datasetParamsInit = item => { + customDatasetParamsRef.value?.optInit(item) +} + const initSnapshotTimer = () => { snapshotTimer.value = setInterval(() => { snapshotStore.snapshotCatchToStore() @@ -1531,6 +1537,7 @@ defineExpose({ @onDragging="onDragging($event, item, index)" @onResizing="onResizing($event, item, index)" @userViewEnlargeOpen="userViewEnlargeOpen($event, item)" + @datasetParamsInit="datasetParamsInit(item)" @linkJumpSetOpen="linkJumpSetOpen(item)" @linkageSetOpen="linkageSetOpen(item)" > @@ -1596,6 +1603,7 @@ defineExpose({ + diff --git a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue index dcb454b941..821e72d8e6 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue @@ -90,7 +90,7 @@ const { config, showPosition, index, canvasStyleData, canvasViewInfo, dvInfo, se toRefs(props) let currentInstance const component = ref(null) -const emits = defineEmits(['userViewEnlargeOpen', 'onPointClick']) +const emits = defineEmits(['userViewEnlargeOpen', 'datasetParamsInit', 'onPointClick']) const htmlToImage = () => { setTimeout(() => { @@ -254,6 +254,7 @@ const deepScale = computed(() => scale.value / 100) :show-position="showPosition" :class="{ 'wrapper-edit-bar-active': active }" @userViewEnlargeOpen="opt => emits('userViewEnlargeOpen', opt)" + @datasetParamsInit="() => emits('datasetParamsInit')" > + diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index d6a8db35d5..5045976ceb 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -31,6 +31,7 @@ :show-position="showPosition" :canvas-id="canvasId" @userViewEnlargeOpen="userViewEnlargeOpen" + @datasetParamsInit="datasetParamsInit" @linkJumpSetOpen="linkJumpSetOpen" @linkageSetOpen="linkageSetOpen" > @@ -132,6 +133,7 @@ const { const { editorMap, areaData, isCtrlOrCmdDown } = storeToRefs(composeStore) const emit = defineEmits([ 'userViewEnlargeOpen', + 'datasetParamsInit', 'onStartResize', 'onStartMove', 'onDragging', @@ -324,6 +326,10 @@ const userViewEnlargeOpen = opt => { emit('userViewEnlargeOpen', opt) } +const datasetParamsInit = opt => { + emit('datasetParamsInit', opt) +} + const getPointStyle = point => { let { width, height } = defaultStyle.value const { sizeX, sizeY } = element.value diff --git a/core/core-frontend/src/components/visualization/ComponentEditBar.vue b/core/core-frontend/src/components/visualization/ComponentEditBar.vue index 5081780ba6..c6fd01997d 100644 --- a/core/core-frontend/src/components/visualization/ComponentEditBar.vue +++ b/core/core-frontend/src/components/visualization/ComponentEditBar.vue @@ -60,7 +60,7 @@ effect="dark" placement="top" content="输入计算数据" - v-if="barShowCheck('datasetParams')" + v-if="barShowCheck('datasetParams') && datasetParamsSetShow" > @@ -199,6 +199,7 @@ import { ElMessage, ElTooltip, ElButton } from 'element-plus-secondary' import CustomTabsSort from '@/custom-component/de-tabs/CustomTabsSort.vue' import { exportPivotExcel } from '@/views/chart/components/js/panel/common/common_table' import { XpackComponent } from '@/components/plugin' +import DatasetParamsComponent from '@/components/visualization/DatasetParamsComponent.vue' const dvMainStore = dvMainStoreWithOut() const snapshotStore = snapshotStoreWithOut() const copyStore = copyStoreWithOut() @@ -206,6 +207,7 @@ const customTabsSortRef = ref(null) const authShow = computed(() => !dvInfo.value.weight || dvInfo.value.weight > 3) const emits = defineEmits([ 'userViewEnlargeOpen', + 'datasetParamsInit', 'closePreview', 'showViewDetails', 'amRemoveItem', @@ -434,6 +436,7 @@ const deleteComponent = () => { const datasetParamsInit = () => { // do init + emits('datasetParamsInit') } const copyComponent = () => { @@ -562,6 +565,10 @@ const initCurFields = () => { } // 富文本-End +const datasetParamsSetShow = computed(() => { + return canvasViewInfo.value[element.value.id]?.calParams?.length > 0 +}) + onMounted(() => { if (element.value.component === 'UserView') { eventBus.on('initCurFields-' + element.value.id, initCurFields) diff --git a/core/core-frontend/src/components/visualization/DatasetParamsComponent.vue b/core/core-frontend/src/components/visualization/DatasetParamsComponent.vue index c2e1df39d0..d6676da614 100644 --- a/core/core-frontend/src/components/visualization/DatasetParamsComponent.vue +++ b/core/core-frontend/src/components/visualization/DatasetParamsComponent.vue @@ -1,29 +1,21 @@