feat: id改identity

This commit is contained in:
ygx
2025-12-27 14:10:16 +08:00
parent 7a5fa1f4ea
commit 53cccfaa59
13 changed files with 44 additions and 44 deletions

View File

@@ -91,30 +91,30 @@ const closeHandle = () => {
const previewHandle = () => {
const path = fetchPathByName(PreviewEnum.CHART_PREVIEW_NAME, 'href')
if (!path) return
const { id } = routerParamsInfo.params
// id 标识
const previewId = typeof id === 'string' ? id : id[0]
const { identity } = routerParamsInfo.params
// identity 标识
const previewId = typeof identity === 'string' ? identity : identity[0]
const storageInfo = chartEditStore.getStorageInfo()
const sessionStorageInfo = getSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
if (sessionStorageInfo?.length) {
const repeateIndex = sessionStorageInfo.findIndex((e: { id: string }) => e.id === previewId)
const repeateIndex = sessionStorageInfo.findIndex((e: { identity: string }) => e.identity === previewId)
// 重复替换
if (repeateIndex !== -1) {
sessionStorageInfo.splice(repeateIndex, 1, {
id: previewId,
identity: previewId,
...storageInfo
})
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, sessionStorageInfo)
} else {
sessionStorageInfo.push({
id: previewId,
identity: previewId,
...storageInfo
})
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, sessionStorageInfo)
}
} else {
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ id: previewId, ...storageInfo }])
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ identity: previewId, ...storageInfo }])
}
// 跳转
routerTurnByPath(path, [previewId], undefined, true)
@@ -138,7 +138,7 @@ const copyPreviewPath = (successText?: string, failureText?: string) => {
// 发布
const sendHandle = async () => {
const res = await changeProjectReleaseApi({
id: fetchRouteParamsLocation(),
identity: fetchRouteParamsLocation(),
// 反过来
state: release.value ? -1 : 1
})