refactor: 仪表板编辑时新页面预览展示最新保存的

This commit is contained in:
wangjiahao
2025-04-09 17:14:53 +08:00
committed by 王嘉豪
parent c1bcd393cc
commit 2ab7db3345
2 changed files with 7 additions and 2 deletions

View File

@@ -151,7 +151,7 @@ const previewOuter = () => {
return
}
canvasSave(() => {
let url = '#/preview?dvId=' + dvInfo.value.id + '&ignoreParams=true'
let url = '#/preview?dvId=' + dvInfo.value.id + '&ignoreParams=true&editPreview=true'
if (embeddedStore.baseUrl) {
url = `${embeddedStore.baseUrl}${url}`.replaceAll('\/\/#', '\/#')
}

View File

@@ -33,6 +33,7 @@ const state = reactive({
dvInfo: null,
curPreviewGap: 0,
initState: true,
editPreview: false,
showPosition: null,
showOffset: {
top: 3,
@@ -117,7 +118,7 @@ const loadCanvasDataAsync = async (dvId, dvType, ignoreParams = false) => {
await initCanvasData(
dvId,
{ busiFlag: dvType, resourceTable: 'core' },
{ busiFlag: dvType, resourceTable: state.editPreview ? 'snapshot' : 'core' },
async function ({
canvasDataResult,
canvasStyleResult,
@@ -129,6 +130,9 @@ const loadCanvasDataAsync = async (dvId, dvType, ignoreParams = false) => {
state.canvasStylePreview = canvasStyleResult
state.canvasViewInfoPreview = canvasViewInfoPreview
state.dvInfo = dvInfo
if (state.editPreview) {
state.dvInfo.status = 1
}
state.curPreviewGap = curPreviewGap
if (state.dvInfo.status) {
if (jumpParam || (!ignoreParams && attachParam)) {
@@ -196,6 +200,7 @@ onMounted(async () => {
const ignoreParams = router.currentRoute.value.query.ignoreParams === 'true'
const isPopWindow = router.currentRoute.value.query.popWindow === 'true'
const isFrameFlag = window.self !== window.top
state.editPreview = router.currentRoute.value.query.editPreview === 'true'
dvMainStore.setIframeFlag(isFrameFlag)
dvMainStore.setIsPopWindow(isPopWindow)
const { dvType, callBackFlag, taskId, showWatermark } = router.currentRoute.value.query