云设备录入

This commit is contained in:
sjl
2025-10-11 10:35:25 +08:00
parent 2e58e58c73
commit a3b6a5c0be
23 changed files with 9302 additions and 3827 deletions

View File

@@ -68,7 +68,7 @@
</el-collapse-item>
<el-collapse-item title="便携式设备" name="1" v-if="bxsDeviceData.length != 0">
<el-tree
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 280px)' : 'calc(100vh - 238px)' }"
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 330px)' : 'calc(100vh - 238px)' }"
ref="treeRef2"
:props="defaultProps"
highlight-current
@@ -92,6 +92,32 @@
</template>
</el-tree>
</el-collapse-item>
<el-collapse-item title="云前置设备" name="2" v-if="yqfDeviceData.length != 0">
<el-tree
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 330px)' : 'calc(100vh - 238px)' }"
ref="treeRef3"
:props="defaultProps"
highlight-current
default-expand-all
:filter-node-method="filterNode"
node-key="id"
:data="yqfDeviceData"
v-bind="$attrs"
style="overflow: auto"
>
<template #default="{ node, data }">
<span class="custom-tree-node">
<Icon
:name="data.icon"
style="font-size: 16px"
:style="{ color: data.color }"
v-if="data.icon"
/>
<span style="margin-left: 4px">{{ node.label }}</span>
</span>
</template>
</el-tree>
</el-collapse-item>
</el-collapse>
</div>
</div>
@@ -100,6 +126,7 @@
<script lang="ts" setup>
import useCurrentInstance from '@/utils/useCurrentInstance'
import { ElTree } from 'element-plus'
import { el } from 'element-plus/es/locale'
import { ref, watch, defineEmits, onMounted, nextTick, computed } from 'vue'
import { useRoute } from 'vue-router'
defineOptions({
@@ -134,6 +161,8 @@ const zlDeviceData = ref<any>([])
const zlDevList = ref<any>([])
//便携式设备数据
const bxsDeviceData = ref<any>([])
//云前置设备数据
const yqfDeviceData = ref<any>([])
watch(
() => props.data,
(val, oldVal) => {
@@ -148,21 +177,13 @@ watch(
item.children.map((vv: any) => {
bxsDeviceData.value.push(vv)
})
}else if (item.name == '云前置设备') {
item.children.map((vv: any) => {
yqfDeviceData.value.push(vv)
})
}
})
if (zlDeviceData.value.length != 0) {
zlDevList.value = filterProcess(JSON.parse(JSON.stringify(zlDeviceData.value)))
activeName.value = '0'
}
if (zlDeviceData.value.length === 0 && bxsDeviceData.value.length != 0) {
activeName.value = '1'
}
if (!zlDeviceData.value && !bxsDeviceData.value) {
activeName.value = ''
}
nextTick(() => {
changeDevice(activeName.value)
})
}
},
{
@@ -174,8 +195,10 @@ watch(
watch(filterText, val => {
if (activeName.value == '0') {
treeRef1.value!.filter(val)
} else {
} else if(activeName.value == '1') {
treeRef2.value!.filter(val)
}else {
treeRef3.value!.filter(val)
}
})
watch(process, val => {
@@ -190,6 +213,7 @@ watch(process, val => {
})
const changeDevice = (val: any) => {
console.log('changeDevice', val)
let arr1: any = []
//zlDeviceData
zlDevList.value.forEach((item: any) => {
@@ -207,6 +231,16 @@ const changeDevice = (val: any) => {
arr2.push(item2)
})
})
let arr3: any = []
yqfDeviceData.value.forEach((item: any) => {
item.children.forEach((item2: any) => {
item2.children.forEach((item3: any) => {
item3.children.forEach((item4: any) => {
arr3.push(item4)
})
})
})
})
activeName.value = val
if (val == '0') {
arr2.map((item: any) => {
@@ -222,6 +256,13 @@ const changeDevice = (val: any) => {
treeRef2?.value && treeRef2.value.setCurrentKey(arr2[0]?.id)
emit('changePointType', activeName.value, arr2[0])
}
if(val == '2'){
arr3.map((item: any) => {
item.checked = false
})
treeRef3?.value && treeRef3.value.setCurrentKey(arr3[0]?.id)
emit('changePointType', activeName.value, arr3[0])
}
// if(activeName.value){
// emit('changePointType', activeName.value)
// }
@@ -290,12 +331,25 @@ const chooseNode = (value: string, data: any, node: any) => {
const treeRef1 = ref<InstanceType<typeof ElTree>>()
//便携式
const treeRef2 = ref<InstanceType<typeof ElTree>>()
//云前置
const treeRef3 = ref<InstanceType<typeof ElTree>>()
defineExpose({ treeRef1, treeRef2 })
onMounted(() => {
// nextTick(() => {
// // setTimeout(() => {
// // }, 500)
// })
setTimeout(() => {
if (zlDeviceData.value.length != 0) {
zlDevList.value = filterProcess(JSON.parse(JSON.stringify(zlDeviceData.value)))
activeName.value = '0'
}
if (zlDeviceData.value.length === 0 && bxsDeviceData.value.length != 0) {
activeName.value = '1'
}
if (!zlDeviceData.value && !bxsDeviceData.value) {
activeName.value = ''
}
nextTick(() => {
changeDevice(activeName.value)
})
}, 500)
})
</script>
@@ -327,4 +381,6 @@ onMounted(() => {
display: flex;
align-items: center;
}
</style>