事件展示-数据来源如果便携式设备或治理设备没数据则不展示

This commit is contained in:
zhujiyan
2024-10-09 16:25:51 +08:00
parent 6db4568c19
commit bef7796668
3 changed files with 33 additions and 16 deletions

View File

@@ -7,7 +7,7 @@
placeholder="请选择数据来源"
@change="sourceChange"
v-model="tableStore.table.params.cascader"
:options="props.deviceTree"
:options="deviceTreeOptions"
:show-all-levels="false"
:props="{ checkStrictly: true }"
clearable
@@ -215,21 +215,27 @@ tableStore.table.params.userId = ''
tableStore.table.params.cascader = ''
// tableStore.table.params.level=''
const deviceTreeOptions = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => {
if (item.children.length == 0) {
deviceTreeOptions.value.splice(index, 1)
}
})
const sourceChange = (e: any) => {
tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || ''
const zlIndex = props.deviceTree.findIndex((item: any) => {
const zlIndex = deviceTreeOptions.value.findIndex((item: any) => {
return item.name == '治理设备'
})
const bxsIndex = props.deviceTree.findIndex((item: any) => {
const bxsIndex = deviceTreeOptions.value.findIndex((item: any) => {
return item.name == '便携式设备'
})
//便携式设备特殊处理
if (props.deviceTree[bxsIndex].id == e[0] && e.length == 2) {
if (bxsIndex != -1 && deviceTreeOptions.value[bxsIndex].id == e[0] && e.length == 2) {
tableStore.table.params.deviceId = e[1]
}
//治理设备
if (props.deviceTree[zlIndex].id == e[0]) {
if (zlIndex != -1 && deviceTreeOptions.value[zlIndex].id == e[0]) {
tableStore.table.params.deviceId = e[2] || ''
}
}