fix(系统设置): 打开方式设置为当前页面打开导致仪表板新页面预览没有发生跳转

This commit is contained in:
dataeaseShu
2024-11-29 10:02:07 +08:00
parent 57ab4f8e0e
commit 73de15a92d
4 changed files with 28 additions and 5 deletions

View File

@@ -1,11 +1,13 @@
import { ref, onBeforeUnmount, onMounted } from 'vue'
import { useCache } from '@/hooks/web/useCache'
import { useEmitt } from '@/hooks/web/useEmitt'
type Sidebar = 'DATASET' | 'DASHBOARD' | 'DATASOURCE' | 'DATA-FILLING'
export const useMoveLine = (type: Sidebar) => {
const { wsCache } = useCache('localStorage')
const width = ref(wsCache.get(type) || 280)
wsCache.set('current-collapse_bar', width.value)
const getCoordinates = () => {
if (document.querySelector('.sidebar-move-line')) {
@@ -16,15 +18,22 @@ export const useMoveLine = (type: Sidebar) => {
document.querySelector('body').style['user-select'] = 'none'
}
const setCollapseBarWidth = () => {
wsCache.set('current-collapse_bar', width.value)
useEmitt().emitter.emit('current-collapse_bar')
}
const setCoordinates = (e: MouseEvent) => {
const x = e.clientX
if (x > 401 || x < 279) {
width.value = Math.max(Math.min(401, x), 279)
ele.style.left = width.value - 5 + 'px'
setCollapseBarWidth()
return
}
ele.style.left = width.value - 5 + 'px'
width.value = x
setCollapseBarWidth()
}
const cancelEvent = () => {

View File

@@ -1,7 +1,9 @@
<script lang="ts" setup>
import icon_sideFold_outlined from '@/assets/svg/icon_side-fold_outlined.svg'
import icon_sideExpand_outlined from '@/assets/svg/icon_side-expand_outlined.svg'
import { useMoveLine } from '@/hooks/web/useMoveLine'
import { useCache } from '@/hooks/web/useCache'
import { useEmitt } from '@/hooks/web/useEmitt'
import { ref, onMounted } from 'vue'
const props = defineProps({
isCollapse: Boolean
})
@@ -9,7 +11,20 @@ const emits = defineEmits(['setCollapse'])
const setCollapse = () => {
emits('setCollapse', !props.isCollapse)
}
const { width } = useMoveLine('DATASET')
const width = ref(280)
const { wsCache } = useCache('localStorage')
const setWidth = () => {
const num = wsCache.get('current-collapse_bar')
if (!num) return
width.value = num
}
onMounted(() => {
useEmitt({
name: 'current-collapse_bar',
callback: setWidth
})
setWidth()
})
</script>
<template>

View File

@@ -47,8 +47,7 @@ const triggerFilterPanel = () => {
}
const preview = id => {
const routeUrl = `/#/preview?dvId=${id}`
const openType = wsCache.get('open-backend') === '1' ? '_self' : '_blank'
window.open(routeUrl, openType)
window.open(routeUrl, '_blank')
}
const formatterTime = (_, _column, cellValue) => {
if (!cellValue) {

View File

@@ -104,7 +104,7 @@ const preview = id => {
path: '/preview',
query: { dvId: id }
})
window.open(routeUrl.href, openType)
window.open(routeUrl.href, '_blank')
}
const openDataset = id => {