fix: 设备详情 子设备列表添加刷新判断优化

This commit is contained in:
聂黎 2023-07-25 14:48:12 +08:00
parent 20fb862f61
commit 9cf476e38c
1 changed files with 12 additions and 6 deletions

View File

@ -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");
});
}
}