mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 22:12:11 +08:00
Pre Merge pull request !212 from fresh66/2.2.6-fixed-bug
This commit is contained in:
commit
b7ae4d7f13
@ -182,9 +182,7 @@ export const useChartEditStore = defineStore({
|
|||||||
},
|
},
|
||||||
getComponentList(): Array<CreateComponentType | CreateComponentGroupType> {
|
getComponentList(): Array<CreateComponentType | CreateComponentGroupType> {
|
||||||
return this.componentList
|
return this.componentList
|
||||||
}
|
},
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
// * 获取需要存储的数据项
|
// * 获取需要存储的数据项
|
||||||
getStorageInfo(): ChartEditStorage {
|
getStorageInfo(): ChartEditStorage {
|
||||||
return {
|
return {
|
||||||
@ -192,7 +190,9 @@ export const useChartEditStore = defineStore({
|
|||||||
[ChartEditStoreEnum.COMPONENT_LIST]: this.getComponentList,
|
[ChartEditStoreEnum.COMPONENT_LIST]: this.getComponentList,
|
||||||
[ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG]: this.getRequestGlobalConfig
|
[ChartEditStoreEnum.REQUEST_GLOBAL_CONFIG]: this.getRequestGlobalConfig
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
// * 设置 editCanvas 数据项
|
// * 设置 editCanvas 数据项
|
||||||
setEditCanvas<T extends keyof EditCanvasType, K extends EditCanvasType[T]>(key: T, value: K) {
|
setEditCanvas<T extends keyof EditCanvasType, K extends EditCanvasType[T]>(key: T, value: K) {
|
||||||
this.editCanvas[key] = value
|
this.editCanvas[key] = value
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* @Author: jiangnan
|
||||||
|
* @Email: hujiangnan@hatech.com.cn
|
||||||
|
* @Date: 2023-09-27 17:22:40
|
||||||
|
* @LastEditors: jiangnan
|
||||||
|
* @LastEditTime: 2023-09-27 17:26:38
|
||||||
|
* @Describle: 描述
|
||||||
|
*/
|
||||||
import { watch } from 'vue'
|
import { watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import throttle from 'lodash/throttle'
|
import throttle from 'lodash/throttle'
|
||||||
@ -20,14 +28,14 @@ export const syncData = () => {
|
|||||||
onPositiveCallback: async () => {
|
onPositiveCallback: async () => {
|
||||||
window['$message'].success('正在同步编辑器...')
|
window['$message'].success('正在同步编辑器...')
|
||||||
dataSyncUpdate && (await dataSyncUpdate())
|
dataSyncUpdate && (await dataSyncUpdate())
|
||||||
dispatchEvent(new CustomEvent(SavePageEnum.CHART, { detail: chartEditStore.getStorageInfo() }))
|
dispatchEvent(new CustomEvent(SavePageEnum.CHART, { detail: chartEditStore.getStorageInfo }))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步数据到预览页
|
// 同步数据到预览页
|
||||||
export const syncDataToPreview = () => {
|
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 便于传递给新窗口初始化数据
|
// 把内存中的数据同步到SessionStorage 便于传递给新窗口初始化数据
|
||||||
const updateToSession = (id: string) => {
|
const updateToSession = (id: string) => {
|
||||||
const storageInfo = chartEditStore.getStorageInfo()
|
const storageInfo = chartEditStore.getStorageInfo
|
||||||
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
||||||
|
|
||||||
if (sessionStorageInfo?.length) {
|
if (sessionStorageInfo?.length) {
|
||||||
|
@ -9,7 +9,7 @@ export const exportHandle = () => {
|
|||||||
|
|
||||||
// 导出数据
|
// 导出数据
|
||||||
downloadTextFile(
|
downloadTextFile(
|
||||||
JSONStringify(chartEditStore.getStorageInfo() || []),
|
JSONStringify(chartEditStore.getStorageInfo || []),
|
||||||
undefined,
|
undefined,
|
||||||
'json'
|
'json'
|
||||||
)
|
)
|
||||||
|
@ -94,7 +94,7 @@ const previewHandle = () => {
|
|||||||
const { id } = routerParamsInfo.params
|
const { id } = routerParamsInfo.params
|
||||||
// id 标识
|
// id 标识
|
||||||
const previewId = typeof id === 'string' ? id : id[0]
|
const previewId = typeof id === 'string' ? id : id[0]
|
||||||
const storageInfo = chartEditStore.getStorageInfo()
|
const storageInfo = chartEditStore.getStorageInfo
|
||||||
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
||||||
|
|
||||||
if (sessionStorageInfo?.length) {
|
if (sessionStorageInfo?.length) {
|
||||||
|
@ -322,7 +322,7 @@ export const useSync = () => {
|
|||||||
// 保存数据
|
// 保存数据
|
||||||
let params = new FormData()
|
let params = new FormData()
|
||||||
params.append('projectId', projectId)
|
params.append('projectId', projectId)
|
||||||
params.append('content', JSONStringify(chartEditStore.getStorageInfo() || {}))
|
params.append('content', JSONStringify(chartEditStore.getStorageInfo || {}))
|
||||||
const res= await saveProjectApi(params)
|
const res= await saveProjectApi(params)
|
||||||
|
|
||||||
if (res && res.code === ResultEnum.SUCCESS) {
|
if (res && res.code === ResultEnum.SUCCESS) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user