From 9cf476e38ca1680858a009487e489466503c788c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=82=E9=BB=8E?= <329261568@qq.com> Date: Tue, 25 Jul 2023 14:48:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E5=A4=87=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E5=AD=90=E8=AE=BE=E5=A4=87=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=88=A4=E6=96=AD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/DeviceDetailsView/childDevice.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/views/profile/DeviceDetailsView/childDevice.vue b/src/views/profile/DeviceDetailsView/childDevice.vue index e67ad635..8db82a8b 100644 --- a/src/views/profile/DeviceDetailsView/childDevice.vue +++ b/src/views/profile/DeviceDetailsView/childDevice.vue @@ -382,7 +382,7 @@ export default { }, created() { this.getDeviceTypeList(); - this.getList(); + this.getList(false); }, methods: { relationSubmit() { @@ -404,7 +404,6 @@ export default { this.msgSuccess("子设备绑定操作成功!"); this.selectTableBoxShow = false; this.getList(); - this.$emit("EventUpload"); }); }, chenking_deviceKey(rule, value, callback) { @@ -725,11 +724,21 @@ export default { val + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize ); }, + // 判断两个数组是否 + compareName(arr = [], arr2 = [], keys){ + if (!arr || !arr2) return false; + if (arr.length !== arr2.length) return false; + + return arr.every(obj => arr2.find(v => v[keys] === obj[keys])); + }, /** 查询设备列表 */ - getList() { + getList(upload = true) { this.loading = true; this.queryParams.parentId = this.sourceId; listDevice(this.queryParams).then((response) => { + if (upload && !this.compareName([...this.deviceList], [...response.rows], 'deviceKey')) { + this.$emit("EventUpload"); + } this.deviceList = response.rows; this.total = response.total; this.loading = false; @@ -763,7 +772,6 @@ export default { .then(() => { this.getList(); this.msgSuccess("取消成功"); - this.$emit("EventUpload"); }); }, /** 删除按钮操作 */ @@ -779,7 +787,6 @@ export default { .then(() => { this.getList(); this.msgSuccess("删除成功"); - this.$emit("EventUpload"); }); }, /** 提交按钮 */ @@ -802,7 +809,6 @@ export default { this.msgSuccess("新增成功"); this.open = false; this.getList(); - this.$emit("EventUpload"); }); } }