节点展开
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
<el-tree
|
<el-tree
|
||||||
:style="{ height: bxsDeviceData.length != 0 ? 'calc(100vh - 340px)' : 'calc(100vh - 278px)' }"
|
:style="{ height: bxsDeviceData.length != 0 ? 'calc(100vh - 340px)' : 'calc(100vh - 278px)' }"
|
||||||
ref="treeRef1" :props="defaultProps" highlight-current :filter-node-method="filterNode"
|
ref="treeRef1" :props="defaultProps" highlight-current :filter-node-method="filterNode"
|
||||||
node-key="id" default-expand-all v-bind="$attrs" :data="zlDevList" style="overflow: auto">
|
node-key="id" :default-expand-all="false" v-bind="$attrs" :data="zlDevList" style="overflow: auto">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span class="custom-tree-node">
|
<span class="custom-tree-node">
|
||||||
<Icon :name="data.icon" style="font-size: 16px" :style="{ color: data.color }"
|
<Icon :name="data.icon" style="font-size: 16px" :style="{ color: data.color }"
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<el-collapse-item title="便携式设备" name="1" v-if="bxsDeviceData.length != 0">
|
<el-collapse-item title="便携式设备" name="1" v-if="bxsDeviceData.length != 0">
|
||||||
<el-tree
|
<el-tree
|
||||||
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 280px)' : 'calc(100vh - 238px)' }"
|
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 280px)' : 'calc(100vh - 238px)' }"
|
||||||
ref="treeRef2" :props="defaultProps" highlight-current default-expand-all
|
ref="treeRef2" :props="defaultProps" highlight-current :default-expand-all="false"
|
||||||
:filter-node-method="filterNode" node-key="id" :data="bxsDeviceData" v-bind="$attrs"
|
:filter-node-method="filterNode" node-key="id" :data="bxsDeviceData" v-bind="$attrs"
|
||||||
style="overflow: auto">
|
style="overflow: auto">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<el-collapse-item title="在线设备" name="2" v-if="frontDeviceData.length != 0">
|
<el-collapse-item title="在线设备" name="2" v-if="frontDeviceData.length != 0">
|
||||||
<el-tree
|
<el-tree
|
||||||
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 280px)' : 'calc(100vh - 238px)' }"
|
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 280px)' : 'calc(100vh - 238px)' }"
|
||||||
ref="treeRef3" :props="defaultProps" highlight-current default-expand-all
|
ref="treeRef3" :props="defaultProps" highlight-current :default-expand-all="false"
|
||||||
:filter-node-method="filterNode" node-key="id" :data="frontDeviceData" v-bind="$attrs"
|
:filter-node-method="filterNode" node-key="id" :data="frontDeviceData" v-bind="$attrs"
|
||||||
style="overflow: auto">
|
style="overflow: auto">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
@@ -124,6 +124,7 @@ watch(
|
|||||||
item.children.map((vv: any) => {
|
item.children.map((vv: any) => {
|
||||||
zlDeviceData.value.push(vv)
|
zlDeviceData.value.push(vv)
|
||||||
})
|
})
|
||||||
|
zlDevList.value = JSON.parse(JSON.stringify(zlDeviceData.value))
|
||||||
} else if (item.name == '便携式设备') {
|
} else if (item.name == '便携式设备') {
|
||||||
bxsDeviceData.value = []
|
bxsDeviceData.value = []
|
||||||
item.children.map((vv: any) => {
|
item.children.map((vv: any) => {
|
||||||
@@ -156,8 +157,6 @@ watch(filterText, val => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
watch(process, val => {
|
watch(process, val => {
|
||||||
|
|
||||||
|
|
||||||
if (val == '') {
|
if (val == '') {
|
||||||
zlDevList.value = JSON.parse(JSON.stringify(zlDeviceData.value))
|
zlDevList.value = JSON.parse(JSON.stringify(zlDeviceData.value))
|
||||||
} else {
|
} else {
|
||||||
@@ -180,7 +179,7 @@ function filterProcess(nodes: any) {
|
|||||||
if ( node.process == process.value || children.length > 0) {
|
if ( node.process == process.value || children.length > 0) {
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
children: node.children
|
children: children
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ getDeviceTree().then(res => {
|
|||||||
item2.color = config.getColorVal('elementUiPrimary')
|
item2.color = config.getColorVal('elementUiPrimary')
|
||||||
item2.children.forEach((item3: any) => {
|
item2.children.forEach((item3: any) => {
|
||||||
item3.icon = 'el-icon-Platform'
|
item3.icon = 'el-icon-Platform'
|
||||||
|
item3.level = 2
|
||||||
item3.color = config.getColorVal('elementUiPrimary')
|
item3.color = config.getColorVal('elementUiPrimary')
|
||||||
if (item3.comFlag === 1) {
|
if (item3.comFlag === 1) {
|
||||||
item3.color = '#e26257 !important'
|
item3.color = '#e26257 !important'
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
<el-tree
|
<el-tree
|
||||||
:style="{ height: bxsDeviceData.length != 0 ? 'calc(100vh - 340px)' : 'calc(100vh - 278px)' }"
|
:style="{ height: bxsDeviceData.length != 0 ? 'calc(100vh - 340px)' : 'calc(100vh - 278px)' }"
|
||||||
ref="treeRef1" :props="defaultProps" highlight-current :filter-node-method="filterNode"
|
ref="treeRef1" :props="defaultProps" highlight-current :filter-node-method="filterNode"
|
||||||
node-key="id" default-expand-all v-bind="$attrs" :data="zlDevList" style="overflow: auto">
|
node-key="id" v-bind="$attrs" :data="zlDevList" style="overflow: auto"
|
||||||
|
:default-expand-all="false">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span class="custom-tree-node">
|
<span class="custom-tree-node">
|
||||||
<Icon :name="data.icon" style="font-size: 16px" :style="{ color: data.color }"
|
<Icon :name="data.icon" style="font-size: 16px" :style="{ color: data.color }"
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
<el-collapse-item title="便携式设备" name="1" v-if="bxsDeviceData.length != 0">
|
<el-collapse-item title="便携式设备" name="1" v-if="bxsDeviceData.length != 0">
|
||||||
<el-tree
|
<el-tree
|
||||||
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 330px)' : 'calc(100vh - 238px)' }"
|
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 330px)' : 'calc(100vh - 238px)' }"
|
||||||
ref="treeRef2" :props="defaultProps" highlight-current default-expand-all
|
ref="treeRef2" :props="defaultProps" highlight-current :default-expand-all="false"
|
||||||
:filter-node-method="filterNode" node-key="id" :data="bxsDeviceData" v-bind="$attrs"
|
:filter-node-method="filterNode" node-key="id" :data="bxsDeviceData" v-bind="$attrs"
|
||||||
style="overflow: auto" >
|
style="overflow: auto" >
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
<el-collapse-item title="在线设备" name="2" v-if="yqfDeviceData.length != 0">
|
<el-collapse-item title="在线设备" name="2" v-if="yqfDeviceData.length != 0">
|
||||||
<el-tree
|
<el-tree
|
||||||
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 330px)' : 'calc(100vh - 238px)' }"
|
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 330px)' : 'calc(100vh - 238px)' }"
|
||||||
ref="treeRef3" :props="defaultProps" highlight-current default-expand-all
|
ref="treeRef3" :props="defaultProps" highlight-current :default-expand-all="false"
|
||||||
:filter-node-method="filterNode" node-key="id" :data="yqfDeviceData" v-bind="$attrs"
|
:filter-node-method="filterNode" node-key="id" :data="yqfDeviceData" v-bind="$attrs"
|
||||||
style="overflow: auto">
|
style="overflow: auto">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
@@ -76,7 +77,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import useCurrentInstance from '@/utils/useCurrentInstance'
|
import useCurrentInstance from '@/utils/useCurrentInstance'
|
||||||
import { ElTree } from 'element-plus'
|
import { ElTree } from 'element-plus'
|
||||||
import { el } from 'element-plus/es/locale'
|
import { el, fa } from 'element-plus/es/locale'
|
||||||
import { ref, watch, defineEmits, onMounted, nextTick, computed } from 'vue'
|
import { ref, watch, defineEmits, onMounted, nextTick, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
|
|||||||
Reference in New Issue
Block a user