|
@@ -5,7 +5,7 @@
|
|
|
<hc-card scrollbar>
|
|
|
<hc-lazy-tree
|
|
|
v-if="isTreeMode" :root-menu="treeMenuData" :menus="treeMenuDatas" :h-props="treeProps"
|
|
|
- tree-key="id" @load="treeLoadNode" @node-tap="treeNodeTap" @menu-tap="treeMenuClick"
|
|
|
+ tree-key="id" :auto-expand-keys="autoExpandKeys" @load="treeLoadNode" @node-tap="treeNodeTap" @menu-tap="treeMenuClick"
|
|
|
>
|
|
|
<template #nodeName="{ data }">
|
|
|
<span class="text-16px font-400">{{ data.nodeName }}</span>
|
|
@@ -79,6 +79,7 @@ import { HcDelMsg } from 'hc-vue3-ui'
|
|
|
import { getDictionaryData, getDictionaryName } from '~src/utils/tools'
|
|
|
import { arrToId, deepClone, formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
import mainApi from '~api/desk/system-unit'
|
|
|
+import { getStoreValue, setStoreValue } from '~uti/storage'
|
|
|
|
|
|
const props = defineProps({
|
|
|
data: {
|
|
@@ -103,6 +104,7 @@ watch(() => props.data, (data) => {
|
|
|
//监听显示
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) getDataApi()
|
|
|
+ autoExpandKeys.value = getStoreValue('autoExpandKeys') || []
|
|
|
})
|
|
|
|
|
|
//处理相关数据
|
|
@@ -143,9 +145,10 @@ const treeMenuDatas = [
|
|
|
{ icon: 'arrow-up-down', label: '排序节点', key: 'rank' },
|
|
|
{ icon: 'delete-bin', label: '删除节点', key: 'del' },
|
|
|
]
|
|
|
-
|
|
|
+const autoExpandKeys = ref([])
|
|
|
//菜单被点击
|
|
|
-const treeMenuClick = async ({ key, data, node }) => {
|
|
|
+const treeMenuClick = async ({ key, data, node, keys }) => {
|
|
|
+ setStoreValue('autoExpandKeys', keys)
|
|
|
nodeInfo.value = data
|
|
|
if (key === 'add') {
|
|
|
formModel.value = {}
|
|
@@ -173,7 +176,9 @@ const treeMenuClick = async ({ key, data, node }) => {
|
|
|
|
|
|
//树节点被点击
|
|
|
const nodeInfo = ref({})
|
|
|
-const treeNodeTap = ({ data }) => {
|
|
|
+const treeNodeTap = ({ data, keys }) => {
|
|
|
+ setStoreValue('autoExpandKeys', keys)
|
|
|
+
|
|
|
const label = getDictionaryName(meterUnitType.value, data.nodeType)
|
|
|
data.nodeTypeName = label ?? '-'
|
|
|
nodeInfo.value = data
|
|
@@ -255,7 +260,9 @@ const setTreeMode = () => {
|
|
|
tableData.value = []
|
|
|
setTimeout(() => {
|
|
|
isTreeMode.value = true
|
|
|
+ autoExpandKeys.value = getStoreValue('autoExpandKeys') || []
|
|
|
}, 500)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//排序
|