fix: 修复新建可视化资源控制台有异常错误信息问题

This commit is contained in:
wangjiahao 2024-01-12 09:52:14 +08:00
parent 00b3f520e0
commit 20cd55a1be
5 changed files with 31 additions and 6 deletions

View File

@ -2,4 +2,4 @@ import request from '@/config/axios'
export const watermarkSave = params => request.post({ url: '/watermark/save', data: params })
export const watermarkFind = () => request.get({ url: 'watermark/find' })
export const watermarkFind = async () => request.get({ url: 'watermark/find' })

View File

@ -212,7 +212,11 @@ watch(
)
const initWatermark = (waterDomId = 'editor-canvas-main') => {
if (dvInfo.value.watermarkInfo && isMainCanvas(canvasId.value)) {
if (
dvInfo.value.watermarkInfo &&
dvInfo.value.watermarkInfo.settingContent &&
isMainCanvas(canvasId.value)
) {
const scale = dashboardActive.value ? 1 : curScale.value
if (userInfo.value) {
activeWatermark(

View File

@ -890,7 +890,7 @@ export const dvMainStore = defineStore('dataVisualization', {
}
}
},
createInit(dvType, resourceId?, pid?) {
createInit(dvType, resourceId?, pid?, watermarkInfo?) {
const optName = dvType === 'dashboard' ? '新建仪表板' : '新建数据大屏'
this.dvInfo = {
dataState: 'prepare',
@ -901,7 +901,7 @@ export const dvMainStore = defineStore('dataVisualization', {
type: dvType,
status: 1,
selfWatermarkStatus: true,
watermarkInfo: {}
watermarkInfo: watermarkInfo
}
const canvasStyleDataNew =
dvType === 'dashboard'

View File

@ -17,6 +17,7 @@ import { check, compareStorage } from '@/utils/CrossPermission'
import { useCache } from '@/hooks/web/useCache'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { interactiveStoreWithOut } from '@/store/modules/interactive'
import { watermarkFind } from '@/api/watermark'
const interactiveStore = interactiveStoreWithOut()
const { wsCache } = useCache()
const eventCheck = e => {
@ -93,8 +94,17 @@ onMounted(async () => {
})
} else if (opt && opt === 'create') {
dataInitState.value = false
let watermarkBaseInfo
try {
await watermarkFind().then(rsp => {
watermarkBaseInfo = rsp.data
watermarkBaseInfo.settingContent = JSON.parse(watermarkBaseInfo.settingContent)
})
} catch (e) {
console.error('can not find watermark info')
}
nextTick(() => {
dvMainStore.createInit('dashboard', null, pid)
dvMainStore.createInit('dashboard', null, pid, watermarkBaseInfo)
//
if (createType === 'template') {
const deTemplateDataStr = wsCache.get(`de-template-data`)

View File

@ -26,6 +26,7 @@ import { check, compareStorage } from '@/utils/CrossPermission'
import { useCache } from '@/hooks/web/useCache'
import RealTimeListTree from '@/components/data-visualization/RealTimeListTree.vue'
import { interactiveStoreWithOut } from '@/store/modules/interactive'
import { watermarkFind } from '@/api/watermark'
const interactiveStore = interactiveStoreWithOut()
const { wsCache } = useCache()
const eventCheck = e => {
@ -221,7 +222,17 @@ onMounted(async () => {
})
} else if (opt && opt === 'create') {
state.canvasInitStatus = false
dvMainStore.createInit('dataV', null, pid)
let watermarkBaseInfo
try {
await watermarkFind().then(rsp => {
watermarkBaseInfo = rsp.data
watermarkBaseInfo.settingContent = JSON.parse(watermarkBaseInfo.settingContent)
})
} catch (e) {
console.error('can not find watermark info')
}
dvMainStore.createInit('dataV', null, pid, watermarkBaseInfo)
nextTick(() => {
state.canvasInitStatus = true
dvMainStore.setDataPrepareState(true)