From 1170e6c23a3a3aecc541be16b6e6e3d51a9bfbe1 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 22 Jul 2024 17:15:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20APP?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=93=8D=E4=BD=9C=E9=80=BB=E8=BE=91=E7=AD=89?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/DataVisualizationServer.java | 6 +++- .../api/visualization/dataVisualization.ts | 2 +- .../src/components/dashboard/DbToolbar.vue | 1 + .../data-visualization/DvToolbar.vue | 1 + .../src/components/de-app/AppExportForm.vue | 20 +++++++------ .../views/chart/components/views/index.vue | 28 +++++++++++++++++++ .../src/views/common/DeAppApply.vue | 18 ++++++------ 7 files changed, 57 insertions(+), 19 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 50b3a10fa0..a1312043f1 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 @@ -635,7 +635,7 @@ public class DataVisualizationServer implements DataVisualizationApi { List datasetTableFieldVOInfo = null; List datasourceVOInfo = null; List datasourceTaskVOInfo = null; - //TODO 获取所有视图信息 + //获取所有视图信息 if (!CollectionUtils.isEmpty(viewIds)) { chartViewVOInfo = appTemplateMapper.findAppViewInfo(viewIds); } @@ -647,6 +647,10 @@ public class DataVisualizationServer implements DataVisualizationApi { datasourceTaskVOInfo = appTemplateMapper.findAppDatasourceTaskInfo(dsIds); } + if(CollectionUtils.isEmpty(datasourceVOInfo)){ + DEException.throwException("当前不存在数据源无法导出"); + } + List linkageVOInfo = appTemplateMapper.findAppLinkageInfo(dvId); List linkageFieldVOInfo = appTemplateMapper.findAppLinkageFieldInfo(dvId); List linkJumpVOInfo = appTemplateMapper.findAppLinkJumpInfo(dvId); diff --git a/core/core-frontend/src/api/visualization/dataVisualization.ts b/core/core-frontend/src/api/visualization/dataVisualization.ts index 323264f52f..d13d7ffe3c 100644 --- a/core/core-frontend/src/api/visualization/dataVisualization.ts +++ b/core/core-frontend/src/api/visualization/dataVisualization.ts @@ -80,7 +80,7 @@ export const storeStatusApi = (id: string): Promise => { } export const decompression = async data => - request.post({ url: '/dataVisualization/decompression', data }) + request.post({ url: '/dataVisualization/decompression', data, loading: true }) export const viewDetailList = dvId => { return request.get({ diff --git a/core/core-frontend/src/components/dashboard/DbToolbar.vue b/core/core-frontend/src/components/dashboard/DbToolbar.vue index 26909f8733..9ae7a2aab6 100644 --- a/core/core-frontend/src/components/dashboard/DbToolbar.vue +++ b/core/core-frontend/src/components/dashboard/DbToolbar.vue @@ -191,6 +191,7 @@ const saveResource = () => { if (appData.value) { initCanvasData(dvInfo.value.id, 'dashboard', () => { useEmitt().emitter.emit('refresh-dataset-selector') + useEmitt().emitter.emit('calcData-all') resourceAppOpt.value.close() dvMainStore.setAppDataInfo(null) snapshotStore.resetSnapshot() diff --git a/core/core-frontend/src/components/data-visualization/DvToolbar.vue b/core/core-frontend/src/components/data-visualization/DvToolbar.vue index 0350ae7a0f..6de07eae33 100644 --- a/core/core-frontend/src/components/data-visualization/DvToolbar.vue +++ b/core/core-frontend/src/components/data-visualization/DvToolbar.vue @@ -138,6 +138,7 @@ const saveResource = () => { useEmitt().emitter.emit('refresh-dataset-selector') resourceAppOpt.value.close() dvMainStore.setAppDataInfo(null) + useEmitt().emitter.emit('calcData-all') snapshotStore.resetSnapshot() }) } diff --git a/core/core-frontend/src/components/de-app/AppExportForm.vue b/core/core-frontend/src/components/de-app/AppExportForm.vue index 4c0851e7e1..c19cf4a445 100644 --- a/core/core-frontend/src/components/de-app/AppExportForm.vue +++ b/core/core-frontend/src/components/de-app/AppExportForm.vue @@ -143,18 +143,22 @@ const gatherAppInfo = (viewIds, dsIds) => { dsIds.push(tableId) } else if (item.component === 'Group') { item.propValue.forEach(groupItem => { - const viewDetails = canvasViewInfo.value[groupItem.id] - const { id, tableId } = viewDetails - viewIds.push(id) - dsIds.push(tableId) + if (groupItem.component === 'UserView') { + const viewDetails = canvasViewInfo.value[groupItem.id] + const { id, tableId } = viewDetails + viewIds.push(id) + dsIds.push(tableId) + } }) } else if (item.component === 'DeTabs') { item.propValue.forEach(tabItem => { tabItem.componentData.forEach(tabComponent => { - const viewDetails = canvasViewInfo.value[tabComponent.id] - const { id, tableId } = viewDetails - viewIds.push(id) - dsIds.push(tableId) + if (tabComponent.component === 'UserView') { + const viewDetails = canvasViewInfo.value[tabComponent.id] + const { id, tableId } = viewDetails + viewIds.push(id) + dsIds.push(tableId) + } }) }) } diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index 915ca2b374..1abc251bb9 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -566,6 +566,34 @@ onMounted(() => { }) } }) + + useEmitt({ + name: 'calcData-' + view.value.id, + callback: function (val) { + if (!state.initReady) { + return + } + initTitle() + nextTick(() => { + view.value.chartExtRequest = filter(false) + calcData(val) + }) + } + }) + + useEmitt({ + name: 'calcData-all', + callback: function () { + if (!state.initReady) { + return + } + initTitle() + nextTick(() => { + view.value.chartExtRequest = filter(false) + calcData(view.value) + }) + } + }) useEmitt({ name: 'renderChart-' + view.value.id, callback: function (val) { diff --git a/core/core-frontend/src/views/common/DeAppApply.vue b/core/core-frontend/src/views/common/DeAppApply.vue index bb02b682ef..dcdf872a83 100644 --- a/core/core-frontend/src/views/common/DeAppApply.vue +++ b/core/core-frontend/src/views/common/DeAppApply.vue @@ -3,10 +3,12 @@ :title="'保存应用'" v-model="state.appApplyDrawer" custom-class="de-app-drawer" + :show-close="false" size="500px" direction="rtl" + z-index="1000" > -
+
@@ -143,18 +144,13 @@ import DatasetSelect from '@/views/chart/components/editor/dataset-select/Datase import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' import { deepCopy } from '@/utils/utils' -import eventBus from '@/utils/eventBus' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' -import { useRequestStoreWithOut } from '@/store/modules/request' -import { usePermissionStoreWithOut } from '@/store/modules/permission' const { t } = useI18n() -const emits = defineEmits(['closeDraw', 'saveApp']) +const emits = defineEmits(['closeDraw', 'saveAppCanvas']) const appSaveForm = ref(null) const dvMainStore = dvMainStoreWithOut() const { dvInfo, appData } = storeToRefs(dvMainStore) const snapshotStore = snapshotStoreWithOut() -const requestStore = useRequestStoreWithOut() -const permissionStore = usePermissionStoreWithOut() const props = defineProps({ componentData: { type: Object, @@ -292,6 +288,7 @@ const dsTreeSelect = element => { const close = () => { emits('closeDraw') + snapshotStore.recordSnapshotCache('renderChart') state.appApplyDrawer = false } @@ -315,12 +312,15 @@ const saveApp = () => { dvInfo.value['datasetFolderPid'] = state.form.datasetFolderPid dvInfo.value['datasetFolderName'] = state.form.datasetFolderName dvInfo.value['dataState'] = 'ready' - eventBus.emit('save') snapshotStore.recordSnapshotCache('renderChart') + emits('saveAppCanvas') } else { return false } }) + setTimeout(() => { + appSaveForm?.value?.clearValidate() + }, 0) } defineExpose({