|
@@ -38,10 +38,14 @@ import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
|
|
import { SavePageEnum } from '@/enums/editPageEnum'
|
|
import { SavePageEnum } from '@/enums/editPageEnum'
|
|
|
import { getSessionStorageInfo } from '../preview/utils'
|
|
import { getSessionStorageInfo } from '../preview/utils'
|
|
|
import type { ChartEditStorageType } from '../preview/index.d'
|
|
import type { ChartEditStorageType } from '../preview/index.d'
|
|
|
-import { setSessionStorage } from '@/utils'
|
|
|
|
|
|
|
+import { setSessionStorage, fetchRouteParamsLocation } from '@/utils'
|
|
|
import { StorageEnum } from '@/enums/storageEnum'
|
|
import { StorageEnum } from '@/enums/storageEnum'
|
|
|
import { icon } from '@/plugins'
|
|
import { icon } from '@/plugins'
|
|
|
-
|
|
|
|
|
|
|
+import { useSync } from '@/views/chart/hooks/useSync.hook'
|
|
|
|
|
+import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
|
|
|
|
+import { ProjectInfoEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
|
|
|
|
+const chartEditStore = useChartEditStore()
|
|
|
|
|
+const { dataSyncUpdate } = useSync()
|
|
|
const { ChevronBackOutlineIcon, DownloadIcon } = icon.ionicons5
|
|
const { ChevronBackOutlineIcon, DownloadIcon } = icon.ionicons5
|
|
|
const showOpenFilePicker: Function = (window as any).showOpenFilePicker
|
|
const showOpenFilePicker: Function = (window as any).showOpenFilePicker
|
|
|
const content = ref('')
|
|
const content = ref('')
|
|
@@ -93,6 +97,11 @@ async function updateSync() {
|
|
|
const detail = JSON.parse(content.value)
|
|
const detail = JSON.parse(content.value)
|
|
|
delete detail.id
|
|
delete detail.id
|
|
|
// 保持id不变
|
|
// 保持id不变
|
|
|
|
|
+ // 带后端版本额外处理请求
|
|
|
|
|
+ if (dataSyncUpdate) {
|
|
|
|
|
+ chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, fetchRouteParamsLocation())
|
|
|
|
|
+ await dataSyncUpdate(false) // JSON界面保存不上传缩略图
|
|
|
|
|
+ }
|
|
|
window.opener.dispatchEvent(new CustomEvent(SavePageEnum.JSON, { detail }))
|
|
window.opener.dispatchEvent(new CustomEvent(SavePageEnum.JSON, { detail }))
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
window['$message'].error('内容格式有误')
|
|
window['$message'].error('内容格式有误')
|