From 4bd74560916830283ec975ba831978086161bd32 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 13 Nov 2024 21:16:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20T?= =?UTF-8?q?ab=E6=94=AF=E6=8C=81=E6=A0=87=E7=AD=BE=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20#12487?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/ContextMenuDetails.vue | 6 +++++ .../visualization/ComponentEditBar.vue | 5 ++-- .../de-tabs/CustomTabsSort.vue | 24 +++++++------------ .../src/views/data-visualization/index.vue | 11 +++++++++ 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue index 5da20aa54e..104db7660b 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue @@ -188,6 +188,11 @@ const bottomComponent = () => { menuOpt('bottomComponent') } +const customSort = () => { + // do customSort + eventBus.emit('tabSort') +} + const componentCompose = () => { composeStore.compose() snapshotStore.recordSnapshotCache('componentCompose') @@ -291,6 +296,7 @@ const editQueryCriteria = () => {
  • 下移一层
  • 置于顶层
  • 置于底层
  • +
  • 排序
  • - + @@ -227,7 +227,6 @@ 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() @@ -356,7 +355,7 @@ const state = reactive({ }) const tabSort = () => { - customTabsSortRef.value.sortInit() + customTabsSortRef.value.sortInit(element.value) } const downloadClick = () => { diff --git a/core/core-frontend/src/custom-component/de-tabs/CustomTabsSort.vue b/core/core-frontend/src/custom-component/de-tabs/CustomTabsSort.vue index 29b196ec3e..13d5d5214c 100644 --- a/core/core-frontend/src/custom-component/de-tabs/CustomTabsSort.vue +++ b/core/core-frontend/src/custom-component/de-tabs/CustomTabsSort.vue @@ -40,35 +40,27 @@ import { ElButton } from 'element-plus-secondary' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import eventBus from '@/utils/eventBus' const snapshotStore = snapshotStoreWithOut() -const props = defineProps({ - element: { - type: Object, - required: true - } -}) -onMounted(() => { - init() -}) -const { element } = toRefs(props) +const config = ref(null) const sortList = ref([]) const dialogShow = ref(false) -const sortInit = () => { - init() +const sortInit = component => { + init(component) dialogShow.value = true } -const init = () => { - sortList.value = deepCopy(element.value.propValue) +const init = component => { + config.value = component + sortList.value = deepCopy(config.value.propValue) } const closeDialog = () => { dialogShow.value = false } const save = () => { - element.value.propValue = deepCopy(sortList.value) + config.value.propValue = deepCopy(sortList.value) snapshotStore.recordSnapshotCache() - eventBus.emit('onTabSortChange-' + element.value.id) + eventBus.emit('onTabSortChange-' + config.value.id) closeDialog() } diff --git a/core/core-frontend/src/views/data-visualization/index.vue b/core/core-frontend/src/views/data-visualization/index.vue index 636d39b8fe..237bbd3972 100644 --- a/core/core-frontend/src/views/data-visualization/index.vue +++ b/core/core-frontend/src/views/data-visualization/index.vue @@ -45,6 +45,7 @@ import DeRuler from '@/custom-component/common/DeRuler.vue' import { useRequestStoreWithOut } from '@/store/modules/request' import { usePermissionStoreWithOut } from '@/store/modules/permission' import ChartStyleBatchSet from '@/views/chart/components/editor/editor-style/ChartStyleBatchSet.vue' +import CustomTabsSort from '@/custom-component/de-tabs/CustomTabsSort.vue' const interactiveStore = interactiveStoreWithOut() const embeddedStore = useEmbedded() const { wsCache } = useCache() @@ -62,6 +63,7 @@ const eventCheck = e => { } } const mainCanvasCoreRef = ref(null) +const customTabsSortRef = ref(null) const appStore = useAppStoreWithOut() const isDataEaseBi = computed(() => appStore.getIsDataEaseBi) const dvMainStore = dvMainStoreWithOut() @@ -107,6 +109,12 @@ const state = reactive({ baseHeight: 10 }) +const tabSort = () => { + if (curComponent.value) { + customTabsSortRef.value.sortInit(curComponent.value) + } +} + // 启用拖动 const enableDragging = e => { if (isSpaceDown.value) { @@ -449,6 +457,8 @@ const popComponentData = computed(() => ) eventBus.on('handleNew', handleNew) + +eventBus.on('tabSort', tabSort)