Browse Source

更新设备在线状态显示,不会刷新整个表格,只刷新状态

wuyunfeng 3 years ago
parent
commit
5c0b97f42c

+ 6 - 2
src/views/ncs-device/components/deviceManager.vue

@@ -1032,8 +1032,12 @@ export default {
             this.rowData[i]['online_state'] = (mac !== undefined && mac !== null) ? this.$t('deviceManage.connectTrue') : this.$t('deviceManage.connectFalse')
           }
         }
-        const rowData = [...this.rowData]
-        this.$set(this, 'rowData', rowData)
+       //只刷新在线状态列数据
+          var params = {
+              columns: ['online_state']
+          }
+          this.gridApi.refreshCells(params);
+
       }
     },
     websocketclose: function(e) {

+ 5 - 2
src/views/ncs-device/nurse_watch.vue

@@ -350,8 +350,11 @@ export default {
           const mac = this.onlineDevice.filter(p => p.toLowerCase() === item.eth_mac.toLowerCase())[0]
           item.online_state = (mac !== undefined && mac !== null) ? '在线' : '离线'
         })
-        const tableData = [...this.tableData]
-        this.$set(this, 'tableData', tableData)
+        //只刷新在线状态列数据
+        var params = {
+          columns: ['online_state']
+        }
+        this.gridApi.refreshCells(params);
       }
     },
     deviceOnlineWebsocketclose: function(e) {