refactor(仪表板): APP样式操作逻辑等优化

This commit is contained in:
wangjiahao 2024-07-22 17:15:33 +08:00
parent b43f286bab
commit 1170e6c23a
7 changed files with 57 additions and 19 deletions

View File

@ -635,7 +635,7 @@ public class DataVisualizationServer implements DataVisualizationApi {
List<AppCoreDatasetTableFieldVO> datasetTableFieldVOInfo = null;
List<AppCoreDatasourceVO> datasourceVOInfo = null;
List<AppCoreDatasourceTaskVO> 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<VisualizationLinkageVO> linkageVOInfo = appTemplateMapper.findAppLinkageInfo(dvId);
List<VisualizationLinkageFieldVO> linkageFieldVOInfo = appTemplateMapper.findAppLinkageFieldInfo(dvId);
List<VisualizationLinkJumpVO> linkJumpVOInfo = appTemplateMapper.findAppLinkJumpInfo(dvId);

View File

@ -80,7 +80,7 @@ export const storeStatusApi = (id: string): Promise<IResponse> => {
}
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({

View File

@ -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()

View File

@ -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()
})
}

View File

@ -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)
}
})
})
}

View File

@ -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) {

View File

@ -3,10 +3,12 @@
:title="'保存应用'"
v-model="state.appApplyDrawer"
custom-class="de-app-drawer"
:show-close="false"
size="500px"
direction="rtl"
z-index="1000"
>
<div class="app-export" v-loading="requestStore.loadingMap[permissionStore.currentPath]">
<div class="app-export">
<el-form
ref="appSaveForm"
:model="state.form"
@ -117,7 +119,6 @@
</div>
<template #footer>
<div class="apply" style="width: 100%">
<el-button secondary @click="close">{{ $t('commons.cancel') }} </el-button>
<el-button type="primary" @click="saveApp">保存</el-button>
</div>
</template>
@ -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({