Merge pull request #11084 from dataease/pr@dev-v2@refactor_app-style

refactor(仪表板): APP样式操作逻辑等优化
This commit is contained in:
王嘉豪 2024-07-22 17:16:49 +08:00 committed by GitHub
commit 89a0eef927
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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<AppCoreDatasetTableFieldVO> datasetTableFieldVOInfo = null;
List<AppCoreDatasourceVO> datasourceVOInfo = null; List<AppCoreDatasourceVO> datasourceVOInfo = null;
List<AppCoreDatasourceTaskVO> datasourceTaskVOInfo = null; List<AppCoreDatasourceTaskVO> datasourceTaskVOInfo = null;
//TODO 获取所有视图信息 //获取所有视图信息
if (!CollectionUtils.isEmpty(viewIds)) { if (!CollectionUtils.isEmpty(viewIds)) {
chartViewVOInfo = appTemplateMapper.findAppViewInfo(viewIds); chartViewVOInfo = appTemplateMapper.findAppViewInfo(viewIds);
} }
@ -647,6 +647,10 @@ public class DataVisualizationServer implements DataVisualizationApi {
datasourceTaskVOInfo = appTemplateMapper.findAppDatasourceTaskInfo(dsIds); datasourceTaskVOInfo = appTemplateMapper.findAppDatasourceTaskInfo(dsIds);
} }
if(CollectionUtils.isEmpty(datasourceVOInfo)){
DEException.throwException("当前不存在数据源无法导出");
}
List<VisualizationLinkageVO> linkageVOInfo = appTemplateMapper.findAppLinkageInfo(dvId); List<VisualizationLinkageVO> linkageVOInfo = appTemplateMapper.findAppLinkageInfo(dvId);
List<VisualizationLinkageFieldVO> linkageFieldVOInfo = appTemplateMapper.findAppLinkageFieldInfo(dvId); List<VisualizationLinkageFieldVO> linkageFieldVOInfo = appTemplateMapper.findAppLinkageFieldInfo(dvId);
List<VisualizationLinkJumpVO> linkJumpVOInfo = appTemplateMapper.findAppLinkJumpInfo(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 => export const decompression = async data =>
request.post({ url: '/dataVisualization/decompression', data }) request.post({ url: '/dataVisualization/decompression', data, loading: true })
export const viewDetailList = dvId => { export const viewDetailList = dvId => {
return request.get({ return request.get({

View File

@ -191,6 +191,7 @@ const saveResource = () => {
if (appData.value) { if (appData.value) {
initCanvasData(dvInfo.value.id, 'dashboard', () => { initCanvasData(dvInfo.value.id, 'dashboard', () => {
useEmitt().emitter.emit('refresh-dataset-selector') useEmitt().emitter.emit('refresh-dataset-selector')
useEmitt().emitter.emit('calcData-all')
resourceAppOpt.value.close() resourceAppOpt.value.close()
dvMainStore.setAppDataInfo(null) dvMainStore.setAppDataInfo(null)
snapshotStore.resetSnapshot() snapshotStore.resetSnapshot()

View File

@ -138,6 +138,7 @@ const saveResource = () => {
useEmitt().emitter.emit('refresh-dataset-selector') useEmitt().emitter.emit('refresh-dataset-selector')
resourceAppOpt.value.close() resourceAppOpt.value.close()
dvMainStore.setAppDataInfo(null) dvMainStore.setAppDataInfo(null)
useEmitt().emitter.emit('calcData-all')
snapshotStore.resetSnapshot() snapshotStore.resetSnapshot()
}) })
} }

View File

@ -143,18 +143,22 @@ const gatherAppInfo = (viewIds, dsIds) => {
dsIds.push(tableId) dsIds.push(tableId)
} else if (item.component === 'Group') { } else if (item.component === 'Group') {
item.propValue.forEach(groupItem => { item.propValue.forEach(groupItem => {
const viewDetails = canvasViewInfo.value[groupItem.id] if (groupItem.component === 'UserView') {
const { id, tableId } = viewDetails const viewDetails = canvasViewInfo.value[groupItem.id]
viewIds.push(id) const { id, tableId } = viewDetails
dsIds.push(tableId) viewIds.push(id)
dsIds.push(tableId)
}
}) })
} else if (item.component === 'DeTabs') { } else if (item.component === 'DeTabs') {
item.propValue.forEach(tabItem => { item.propValue.forEach(tabItem => {
tabItem.componentData.forEach(tabComponent => { tabItem.componentData.forEach(tabComponent => {
const viewDetails = canvasViewInfo.value[tabComponent.id] if (tabComponent.component === 'UserView') {
const { id, tableId } = viewDetails const viewDetails = canvasViewInfo.value[tabComponent.id]
viewIds.push(id) const { id, tableId } = viewDetails
dsIds.push(tableId) 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({ useEmitt({
name: 'renderChart-' + view.value.id, name: 'renderChart-' + view.value.id,
callback: function (val) { callback: function (val) {

View File

@ -3,10 +3,12 @@
:title="'保存应用'" :title="'保存应用'"
v-model="state.appApplyDrawer" v-model="state.appApplyDrawer"
custom-class="de-app-drawer" custom-class="de-app-drawer"
:show-close="false"
size="500px" size="500px"
direction="rtl" direction="rtl"
z-index="1000"
> >
<div class="app-export" v-loading="requestStore.loadingMap[permissionStore.currentPath]"> <div class="app-export">
<el-form <el-form
ref="appSaveForm" ref="appSaveForm"
:model="state.form" :model="state.form"
@ -117,7 +119,6 @@
</div> </div>
<template #footer> <template #footer>
<div class="apply" style="width: 100%"> <div class="apply" style="width: 100%">
<el-button secondary @click="close">{{ $t('commons.cancel') }} </el-button>
<el-button type="primary" @click="saveApp">保存</el-button> <el-button type="primary" @click="saveApp">保存</el-button>
</div> </div>
</template> </template>
@ -143,18 +144,13 @@ import DatasetSelect from '@/views/chart/components/editor/dataset-select/Datase
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { deepCopy } from '@/utils/utils' import { deepCopy } from '@/utils/utils'
import eventBus from '@/utils/eventBus'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { useRequestStoreWithOut } from '@/store/modules/request'
import { usePermissionStoreWithOut } from '@/store/modules/permission'
const { t } = useI18n() const { t } = useI18n()
const emits = defineEmits(['closeDraw', 'saveApp']) const emits = defineEmits(['closeDraw', 'saveAppCanvas'])
const appSaveForm = ref(null) const appSaveForm = ref(null)
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const { dvInfo, appData } = storeToRefs(dvMainStore) const { dvInfo, appData } = storeToRefs(dvMainStore)
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
const requestStore = useRequestStoreWithOut()
const permissionStore = usePermissionStoreWithOut()
const props = defineProps({ const props = defineProps({
componentData: { componentData: {
type: Object, type: Object,
@ -292,6 +288,7 @@ const dsTreeSelect = element => {
const close = () => { const close = () => {
emits('closeDraw') emits('closeDraw')
snapshotStore.recordSnapshotCache('renderChart')
state.appApplyDrawer = false state.appApplyDrawer = false
} }
@ -315,12 +312,15 @@ const saveApp = () => {
dvInfo.value['datasetFolderPid'] = state.form.datasetFolderPid dvInfo.value['datasetFolderPid'] = state.form.datasetFolderPid
dvInfo.value['datasetFolderName'] = state.form.datasetFolderName dvInfo.value['datasetFolderName'] = state.form.datasetFolderName
dvInfo.value['dataState'] = 'ready' dvInfo.value['dataState'] = 'ready'
eventBus.emit('save')
snapshotStore.recordSnapshotCache('renderChart') snapshotStore.recordSnapshotCache('renderChart')
emits('saveAppCanvas')
} else { } else {
return false return false
} }
}) })
setTimeout(() => {
appSaveForm?.value?.clearValidate()
}, 0)
} }
defineExpose({ defineExpose({