mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 16:22:57 +08:00
fix: 修改预览的问题
This commit is contained in:
parent
75232ee902
commit
e3816524da
@ -31,21 +31,24 @@ 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 localStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
const localStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
|
||||||
|
|
||||||
if (localStorageInfo?.length) {
|
if (localStorageInfo?.length) {
|
||||||
// 重复替换
|
|
||||||
const repeateIndex = localStorageInfo.findIndex((e: { id: string }) => e.id === previewId)
|
const repeateIndex = localStorageInfo.findIndex((e: { id: string }) => e.id === previewId)
|
||||||
|
// 重复替换
|
||||||
if (repeateIndex !== -1) {
|
if (repeateIndex !== -1) {
|
||||||
localStorageInfo.splice(repeateIndex, 1, { id: previewId, ...storageInfo })
|
localStorageInfo.splice(repeateIndex, 1, { id: previewId, ...storageInfo })
|
||||||
|
setLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST, localStorageInfo)
|
||||||
|
} else {
|
||||||
|
localStorageInfo.push({
|
||||||
|
id: previewId, ...storageInfo
|
||||||
|
})
|
||||||
|
setLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST, localStorageInfo)
|
||||||
}
|
}
|
||||||
setLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST, localStorageInfo)
|
|
||||||
} else {
|
} else {
|
||||||
setLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ id: previewId, ...storageInfo }])
|
setLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ id: previewId, ...storageInfo }])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转
|
// 跳转
|
||||||
routerTurnByPath(path, [previewId], undefined, true)
|
routerTurnByPath(path, [previewId], undefined, true)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ const previewRefStyle = computed(() => {
|
|||||||
if (!localStorageInfo) {
|
if (!localStorageInfo) {
|
||||||
window['$message'].warning('获取数据失败')
|
window['$message'].warning('获取数据失败')
|
||||||
}
|
}
|
||||||
|
console.log(localStorageInfo);
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const { calcRate, windowResize, unWindowResize } = usePreviewScale(width.value as number, height.value as number, previewRef.value)
|
const { calcRate, windowResize, unWindowResize } = usePreviewScale(width.value as number, height.value as number, previewRef.value)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
:key="item.key"
|
:key="item.key"
|
||||||
@click="btnHandle"
|
@click="btnHandle"
|
||||||
>
|
>
|
||||||
<component :is="item.title"> </component>
|
<component :is="item.title"></component>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon size="18">
|
<n-icon size="18">
|
||||||
<component :is="item.icon" />
|
<component :is="item.icon" />
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
<template #action> </template>
|
<template #action></template>
|
||||||
</n-card>
|
</n-card>
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
import { watch, reactive } from 'vue'
|
import { watch, reactive } from 'vue'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
import { PageEnum, ChartEnum } from '@/enums/pageEnum'
|
import { PageEnum, ChartEnum } from '@/enums/pageEnum'
|
||||||
import { routerTurnByName, renderLang } from '@/utils'
|
import { fetchPathByName, routerTurnByPath, renderLang, getUUID } from '@/utils'
|
||||||
|
|
||||||
const { FishIcon, CloseIcon } = icon.ionicons5
|
const { FishIcon, CloseIcon } = icon.ionicons5
|
||||||
const { StoreIcon, ObjectStorageIcon } = icon.carbon
|
const { StoreIcon, ObjectStorageIcon } = icon.carbon
|
||||||
@ -84,13 +84,15 @@ const closeHandle = () => {
|
|||||||
// 处理按钮点击
|
// 处理按钮点击
|
||||||
const btnHandle = (key: string) => {
|
const btnHandle = (key: string) => {
|
||||||
closeHandle()
|
closeHandle()
|
||||||
routerTurnByName(ChartEnum.CHART_HOME_NAME, undefined, true)
|
const id = getUUID()
|
||||||
|
const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href')
|
||||||
|
routerTurnByPath(path, [id], undefined, true)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$cardWidth: 570px;
|
$cardWidth: 570px;
|
||||||
|
|
||||||
@include go('create-modal') {
|
@include go("create-modal") {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 200px;
|
top: 200px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@ -101,7 +103,7 @@ $cardWidth: 570px;
|
|||||||
border: 1px solid rgba(0, 0, 0, 0);
|
border: 1px solid rgba(0, 0, 0, 0);
|
||||||
@extend .go-transition;
|
@extend .go-transition;
|
||||||
&:hover {
|
&:hover {
|
||||||
@include hover-border-color('hover-border-color');
|
@include hover-border-color("hover-border-color");
|
||||||
}
|
}
|
||||||
&-tite {
|
&-tite {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
Loading…
Reference in New Issue
Block a user