mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
fix: 解决保存时候可能数据获取不完整的bug
This commit is contained in:
parent
f348038ff7
commit
55c84f2e39
@ -161,17 +161,17 @@ export const useChartEditStore = defineStore({
|
||||
},
|
||||
getComponentList(): Array<CreateComponentType | CreateComponentGroupType> {
|
||||
return this.componentList
|
||||
}
|
||||
},
|
||||
// 获取需要存储的数据项
|
||||
actions: {
|
||||
// * 获取需要存储的数据项
|
||||
getStorageInfo(): ChartEditStorage {
|
||||
return {
|
||||
[ChartEditStoreEnum.EDIT_CANVAS_CONFIG]: this.getEditCanvasConfig,
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: this.getComponentList,
|
||||
[ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG]: this.getRequestGlobalConfig
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// * 设置 editCanvas 数据项
|
||||
setEditCanvas<T extends keyof EditCanvasType, K extends EditCanvasType[T]>(key: T, value: K) {
|
||||
this.editCanvas[key] = value
|
||||
|
@ -19,14 +19,14 @@ export const syncData = () => {
|
||||
transformOrigin: 'center',
|
||||
onPositiveCallback: () => {
|
||||
window['$message'].success('正在同步编辑器...')
|
||||
dispatchEvent(new CustomEvent(SavePageEnum.CHART, { detail: chartEditStore.getStorageInfo }))
|
||||
dispatchEvent(new CustomEvent(SavePageEnum.CHART, { detail: chartEditStore.getStorageInfo() }))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 同步数据到预览页
|
||||
export const syncDataToPreview = () => {
|
||||
dispatchEvent(new CustomEvent(SavePageEnum.CHART_TO_PREVIEW, { detail: chartEditStore.getStorageInfo }))
|
||||
dispatchEvent(new CustomEvent(SavePageEnum.CHART_TO_PREVIEW, { detail: chartEditStore.getStorageInfo() }))
|
||||
}
|
||||
|
||||
// 侦听器更新
|
||||
|
@ -158,7 +158,7 @@ const editHandle = () => {
|
||||
|
||||
// 把内存中的数据同步到SessionStorage 便于传递给新窗口初始化数据
|
||||
const updateToSession = (id: string) => {
|
||||
const storageInfo = chartEditStore.getStorageInfo
|
||||
const storageInfo = chartEditStore.getStorageInfo()
|
||||
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
||||
|
||||
if (sessionStorageInfo?.length) {
|
||||
|
@ -9,7 +9,7 @@ export const exportHandle = () => {
|
||||
|
||||
// 导出数据
|
||||
downloadTextFile(
|
||||
JSONStringify(chartEditStore.getStorageInfo || []),
|
||||
JSONStringify(chartEditStore.getStorageInfo() || []),
|
||||
undefined,
|
||||
'json'
|
||||
)
|
||||
|
@ -32,7 +32,7 @@ const previewHandle = () => {
|
||||
const { id } = routerParamsInfo.params
|
||||
// id 标识
|
||||
const previewId = typeof id === 'string' ? id : id[0]
|
||||
const storageInfo = chartEditStore.getStorageInfo
|
||||
const storageInfo = chartEditStore.getStorageInfo()
|
||||
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
||||
|
||||
if (sessionStorageInfo?.length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user