Merge pull request #8193 from dataease/pr@dev-v2_dzz_mobile

feat(仪表板): 树列表侧边栏新增展开、收起功能
This commit is contained in:
dataeaseShu 2024-02-27 18:50:38 +08:00 committed by GitHub
commit 7a35f7c647
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 87 additions and 9 deletions

View File

@ -11,6 +11,7 @@ interface AppState {
desktop: boolean
isDataEaseBi: boolean
isIframe: boolean
arrowSide: boolean
}
export const useAppStore = defineStore('app', {
@ -22,13 +23,17 @@ export const useAppStore = defineStore('app', {
dekey: 'DataEaseKey',
isDataEaseBi: false,
isIframe: false,
desktop: false
desktop: false,
arrowSide: false
}
},
getters: {
getSize(): boolean {
return this.size
},
getArrowSide(): boolean {
return this.arrowSide
},
getPageLoading(): boolean {
return this.pageLoading
},
@ -58,6 +63,9 @@ export const useAppStore = defineStore('app', {
setSize(size: boolean) {
this.size = size
},
setArrowSide(ArrowSide: boolean) {
this.arrowSide = ArrowSide
},
setIsDataEaseBi(isDataEaseBi: boolean) {
this.isDataEaseBi = isDataEaseBi
},

View File

@ -1,24 +1,34 @@
<script lang="ts" setup>
import { ref } from 'vue'
const sideTreeStatus = ref(true)
import { useAppStoreWithOut } from '@/store/modules/app'
const appStore = useAppStoreWithOut()
defineProps({
isInside: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['changeSideTreeStatus'])
const handleClick = val => {
appStore.setArrowSide(val)
emits('changeSideTreeStatus', val)
sideTreeStatus.value = val
}
</script>
<template>
<div
@click="handleClick(false)"
v-if="sideTreeStatus"
v-if="appStore.getArrowSide && !isInside"
class="arrow-side-tree arrow-side-tree-left"
>
<el-icon>
<Icon name="icon_left_outlined" />
</el-icon>
</div>
<div @click="handleClick(true)" v-else class="arrow-side-tree arrow-side-tree-right">
<div
@click="handleClick(true)"
v-else-if="!appStore.getArrowSide && isInside"
class="arrow-side-tree arrow-side-tree-right"
>
<el-icon>
<Icon name="icon_right_outlined" />
</el-icon>

View File

@ -140,6 +140,14 @@ const changeSideTreeStatus = val => {
sideTreeStatus.value = val
}
const mouseenter = () => {
appStore.setArrowSide(true)
}
const mouseleave = () => {
appStore.setArrowSide(false)
}
defineExpose({
getPreviewStateInfo
})
@ -150,13 +158,21 @@ defineExpose({
<ArrowSide
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
:isInside="!sideTreeStatus"
></ArrowSide>
<el-aside
@mouseenter="mouseenter"
@mouseleave="mouseleave"
class="resource-area"
:class="{ 'close-side': !slideShow, retract: !sideTreeStatus }"
ref="node"
:style="{ width: width + 'px' }"
>
<ArrowSide
:isInside="!sideTreeStatus"
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
></ArrowSide>
<de-resource-tree
ref="resourceTreeRef"
v-show="slideShow"

View File

@ -127,6 +127,14 @@ const changeSideTreeStatus = val => {
sideTreeStatus.value = val
}
const mouseenter = () => {
appStore.setArrowSide(true)
}
const mouseleave = () => {
appStore.setArrowSide(false)
}
onBeforeMount(() => {
dvMainStore.canvasDataInit()
})
@ -137,13 +145,21 @@ onBeforeMount(() => {
<ArrowSide
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
:isInside="!sideTreeStatus"
></ArrowSide>
<el-aside
class="resource-area"
@mouseenter="mouseenter"
@mouseleave="mouseleave"
:class="{ 'close-side': !slideShow, retract: !sideTreeStatus }"
ref="node"
:style="{ width: width + 'px' }"
>
<ArrowSide
:isInside="!sideTreeStatus"
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
></ArrowSide>
<de-resource-tree
ref="resourceTreeRef"
v-show="slideShow"

View File

@ -132,9 +132,6 @@ onBeforeUnmount(() => {
})
const insertParamToCodeMirror = (value: string) => {
mirror.value.dispatch({
changes: { from: 0, to: mirror.value.state.doc.toString().length, insert: '' }
})
mirror.value.dispatch({
changes: { from: mirror.value.viewState.state.selection.ranges[0].from, insert: value },
selection: { anchor: mirror.value.viewState.state.selection.ranges[0].from }

View File

@ -460,6 +460,13 @@ const filterNode = (value: string, data: BusiTreeNode) => {
if (!value) return true
return data.name?.includes(value)
}
const mouseenter = () => {
appStore.setArrowSide(true)
}
const mouseleave = () => {
appStore.setArrowSide(false)
}
const getMenuList = (val: boolean) => {
return !val || isDataEaseBi.value
@ -479,13 +486,21 @@ const getMenuList = (val: boolean) => {
<ArrowSide
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
:isInside="!sideTreeStatus"
></ArrowSide>
<el-aside
class="resource-area"
@mouseenter="mouseenter"
@mouseleave="mouseleave"
:class="{ retract: !sideTreeStatus }"
ref="node"
:style="{ width: width + 'px' }"
>
<ArrowSide
:isInside="!sideTreeStatus"
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
></ArrowSide>
<div class="resource-tree">
<div class="tree-header">
<div class="icon-methods">

View File

@ -672,6 +672,14 @@ const changeSideTreeStatus = val => {
sideTreeStatus.value = val
}
const mouseenter = () => {
appStore.setArrowSide(true)
}
const mouseleave = () => {
appStore.setArrowSide(false)
}
const getMenuList = (val: boolean) => {
return !val || isDataEaseBi.value
? menuList
@ -690,13 +698,21 @@ const getMenuList = (val: boolean) => {
<ArrowSide
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
:isInside="!sideTreeStatus"
></ArrowSide>
<el-aside
@mouseenter="mouseenter"
@mouseleave="mouseleave"
class="resource-area"
:class="{ retract: !sideTreeStatus }"
ref="node"
:style="{ width: width + 'px' }"
>
<ArrowSide
:isInside="!sideTreeStatus"
:style="{ left: (sideTreeStatus ? width - 12 : 0) + 'px' }"
@change-side-tree-status="changeSideTreeStatus"
></ArrowSide>
<div class="resource-tree">
<div class="tree-header">
<div class="icon-methods">