mirror of
https://gitee.com/dromara/go-view.git
synced 2026-05-12 00:00:01 +08:00
Merge branch 'dev' into master-fetch-dev
This commit is contained in:
+9
-1
@@ -65,6 +65,7 @@ import { RequestHeader } from '../RequestHeader'
|
||||
import { isDev } from '@/utils'
|
||||
import { icon } from '@/plugins'
|
||||
import {
|
||||
graphUrl,
|
||||
chartDataUrl,
|
||||
chartSingleDataUrl,
|
||||
rankListUrl,
|
||||
@@ -80,7 +81,8 @@ import {
|
||||
capsuleUrl,
|
||||
wordCloudUrl,
|
||||
treemapUrl,
|
||||
threeEarth01Url
|
||||
threeEarth01Url,
|
||||
sankeyUrl
|
||||
} from '@/api/mock'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -142,6 +144,12 @@ const apiList = [
|
||||
},
|
||||
{
|
||||
value: `【三维地球】${threeEarth01Url}`
|
||||
},
|
||||
{
|
||||
value: `【桑基图】${sankeyUrl}`
|
||||
},
|
||||
{
|
||||
value: `【关系图】${graphUrl}`
|
||||
}
|
||||
]
|
||||
</script>
|
||||
|
||||
@@ -25,6 +25,11 @@ export const syncData = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 同步数据到预览页
|
||||
export const syncDataToPreview = () => {
|
||||
dispatchEvent(new CustomEvent(SavePageEnum.CHART_TO_PREVIEW, { detail: chartEditStore.getStorageInfo }))
|
||||
}
|
||||
|
||||
// 侦听器更新
|
||||
const useSyncUpdateHandle = () => {
|
||||
// 定义侦听器变量
|
||||
@@ -49,8 +54,8 @@ const useSyncUpdateHandle = () => {
|
||||
// document.hasFocus() && syncData()
|
||||
// }, editToJsonInterval)
|
||||
|
||||
// 失焦同步数据(暂不开启)
|
||||
// addEventListener('blur', syncData)
|
||||
// 失焦同步数据
|
||||
addEventListener('blur', syncDataToPreview)
|
||||
|
||||
// 监听编辑器保存事件 刷新工作台图表
|
||||
addEventListener(SavePageEnum.JSON, updateFn)
|
||||
@@ -62,7 +67,7 @@ const useSyncUpdateHandle = () => {
|
||||
// 关闭侦听
|
||||
const unUse = () => {
|
||||
// clearInterval(timer)
|
||||
// removeEventListener('blur', syncData)
|
||||
removeEventListener('blur', syncDataToPreview)
|
||||
removeEventListener(SavePageEnum.JSON, updateFn)
|
||||
}
|
||||
|
||||
|
||||
@@ -322,6 +322,15 @@ $asideBottom: 70px;
|
||||
border-radius: 25px;
|
||||
}
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
bottom: -10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
/* 最小化 */
|
||||
&.isMini {
|
||||
@@ -348,6 +357,7 @@ $asideBottom: 70px;
|
||||
50% {
|
||||
opacity: 0;
|
||||
bottom: calc(#{$dockMiniBottom} - 10px);
|
||||
pointer-events: none;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
@@ -362,15 +372,6 @@ $asideBottom: 70px;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
bottom: -20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<!-- 模块展示按钮 -->
|
||||
<n-tooltip v-for="item in btnList" :key="item.key" placement="bottom" trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button size="small" ghost :type="styleHandle(item)" @click="clickHandle(item)">
|
||||
<n-button size="small" ghost :type="styleHandle(item)" :focusable="false" @click="clickHandle(item)">
|
||||
<component :is="item.icon"></component>
|
||||
</n-button>
|
||||
</template>
|
||||
|
||||
@@ -1,105 +1,16 @@
|
||||
<template>
|
||||
<div
|
||||
:class="`go-preview ${chartEditStore.editCanvasConfig.previewScaleType}`"
|
||||
>
|
||||
<template v-if="showEntity">
|
||||
<!-- 实体区域 -->
|
||||
<div ref="entityRef" class="go-preview-entity">
|
||||
<!-- 缩放层 -->
|
||||
<div ref="previewRef" class="go-preview-scale">
|
||||
<!-- 展示层 -->
|
||||
<div :style="previewRefStyle" v-if="show">
|
||||
<!-- 渲染层 -->
|
||||
<preview-render-list></preview-render-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 缩放层 -->
|
||||
<div ref="previewRef" class="go-preview-scale">
|
||||
<!-- 展示层 -->
|
||||
<div :style="previewRefStyle" v-if="show">
|
||||
<!-- 渲染层 -->
|
||||
<preview-render-list></preview-render-list>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<!--
|
||||
Copyright 2023 MT
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { PreviewRenderList } from './components/PreviewRenderList'
|
||||
import { getFilterStyle, routerTurnByName, setTitle } from '@/utils'
|
||||
import { getEditCanvasConfigStyle, getSessionStorageInfo } from './utils'
|
||||
import { PageEnum } from '@/enums/pageEnum'
|
||||
import { useScale } from './hooks/useScale.hook'
|
||||
import { useStore } from './hooks/useStore.hook'
|
||||
import { PreviewScaleEnum } from '@/enums/styleEnum'
|
||||
import { useComInstall } from './hooks/useComInstall.hook'
|
||||
import type { ChartEditStorageType } from './index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
|
||||
await getSessionStorageInfo()
|
||||
const chartEditStore = useChartEditStore() as unknown as ChartEditStorageType
|
||||
|
||||
setTitle(`预览-${chartEditStore.editCanvasConfig.projectName}`)
|
||||
|
||||
// @ts-ignore
|
||||
if(chartEditStore.isRelease === false) {
|
||||
routerTurnByName(PageEnum.REDIRECT_UN_PUBLISH_NAME, true, false)
|
||||
}
|
||||
|
||||
const previewRefStyle = computed(() => {
|
||||
return {
|
||||
...getEditCanvasConfigStyle(chartEditStore.editCanvasConfig),
|
||||
...getFilterStyle(chartEditStore.editCanvasConfig.filterShow ? chartEditStore.editCanvasConfig : undefined),
|
||||
}
|
||||
})
|
||||
|
||||
const showEntity = computed(() => {
|
||||
const type = chartEditStore.editCanvasConfig.previewScaleType
|
||||
return (
|
||||
type === PreviewScaleEnum.SCROLL_Y || type === PreviewScaleEnum.SCROLL_X
|
||||
)
|
||||
})
|
||||
|
||||
useStore(chartEditStore)
|
||||
const { entityRef, previewRef } = useScale(chartEditStore)
|
||||
const { show } = useComInstall(chartEditStore)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('preview') {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
@include background-image('background-image');
|
||||
&.fit,
|
||||
&.full {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
.go-preview-scale {
|
||||
transform-origin: center center;
|
||||
}
|
||||
}
|
||||
&.scrollY {
|
||||
overflow-x: hidden;
|
||||
.go-preview-scale {
|
||||
transform-origin: left top;
|
||||
}
|
||||
}
|
||||
&.scrollX {
|
||||
overflow-y: hidden;
|
||||
.go-preview-scale {
|
||||
transform-origin: left top;
|
||||
}
|
||||
}
|
||||
.go-preview-entity {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<template>
|
||||
<preview :key="key"></preview>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getSessionStorageInfo } from './utils'
|
||||
import type { ChartEditStorageType } from './index.d'
|
||||
import { SavePageEnum } from '@/enums/editPageEnum'
|
||||
import { setSessionStorage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { ref } from 'vue'
|
||||
import Preview from './index.vue'
|
||||
|
||||
let key = ref(Date.now())
|
||||
|
||||
// 数据变更 -> 组件销毁重建
|
||||
;[SavePageEnum.JSON, SavePageEnum.CHART].forEach((saveEvent: string) => {
|
||||
if (!window.opener) return
|
||||
window.opener.addEventListener(saveEvent, async (e: any) => {
|
||||
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
|
||||
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])
|
||||
key.value = Date.now()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<preview :key="key"></preview>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getSessionStorageInfo } from './utils'
|
||||
import type { ChartEditStorageType } from './index.d'
|
||||
import { SavePageEnum } from '@/enums/editPageEnum'
|
||||
import { setSessionStorage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { ref } from 'vue'
|
||||
import Preview from './index.vue'
|
||||
|
||||
let key = ref(Date.now())
|
||||
|
||||
// 数据变更 -> 组件销毁重建
|
||||
;[SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW].forEach((saveEvent: string) => {
|
||||
if (!window.opener) return
|
||||
window.opener.addEventListener(saveEvent, async (e: any) => {
|
||||
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
|
||||
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])
|
||||
key.value = Date.now()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -45,8 +45,7 @@ const collapsed = ref<boolean>(false)
|
||||
const { getAsideCollapsedWidth } = toRefs(useSettingStore())
|
||||
|
||||
const route = useRoute()
|
||||
const routeRame = computed(() => route.name)
|
||||
const menuValue = ref(routeRame)
|
||||
const menuValue = computed(() => route.name)
|
||||
|
||||
const menuOptions = menuOptionsInit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user