From bef779666866bf1c354b94883d04ba5668504bbe Mon Sep 17 00:00:00 2001 From: zhujiyan <17812234322@163.com> Date: Wed, 9 Oct 2024 16:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=B1=95=E7=A4=BA-=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9D=A5=E6=BA=90=E5=A6=82=E6=9E=9C=E4=BE=BF=E6=90=BA?= =?UTF-8?q?=E5=BC=8F=E8=AE=BE=E5=A4=87=E6=88=96=E6=B2=BB=E7=90=86=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=B2=A1=E6=95=B0=E6=8D=AE=E5=88=99=E4=B8=8D=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/govern/alarm/Device.vue | 16 +++++++++++----- src/views/govern/alarm/Steady.vue | 17 +++++++++++------ src/views/govern/alarm/Transient.vue | 16 +++++++++++----- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/views/govern/alarm/Device.vue b/src/views/govern/alarm/Device.vue index cba533c..791d7a6 100644 --- a/src/views/govern/alarm/Device.vue +++ b/src/views/govern/alarm/Device.vue @@ -6,7 +6,7 @@ v-model="tableStore.table.params.cascader" placeholder="请选择数据来源" @change="sourceChange" - :options="props.deviceTree" + :options="deviceTreeOptions" :show-all-levels="false" :props="{ checkStrictly: true }" clearable @@ -103,21 +103,27 @@ tableStore.table.params.status = '' tableStore.table.params.target = [] tableStore.table.params.userId = '' +const deviceTreeOptions = ref(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] || '' } } diff --git a/src/views/govern/alarm/Steady.vue b/src/views/govern/alarm/Steady.vue index 662df17..005a1b7 100644 --- a/src/views/govern/alarm/Steady.vue +++ b/src/views/govern/alarm/Steady.vue @@ -6,7 +6,7 @@ v-model="tableStore.table.params.cascader" placeholder="请选择数据来源" @change="sourceChange" - :options="props.deviceTree" + :options="deviceTreeOptions" :show-all-levels="false" :props="{ checkStrictly: true }" clearable @@ -102,25 +102,30 @@ tableStore.table.params.userId = '' tableStore.table.params.cascader = '' // tableStore.table.params.level='' +const deviceTreeOptions = ref(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] || '' } } - onMounted(() => { tableStore.index() }) diff --git a/src/views/govern/alarm/Transient.vue b/src/views/govern/alarm/Transient.vue index 747667c..9dde192 100644 --- a/src/views/govern/alarm/Transient.vue +++ b/src/views/govern/alarm/Transient.vue @@ -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(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] || '' } }