|
|
@@ -7,6 +7,7 @@
|
|
|
horizontal
|
|
|
>
|
|
|
<device-tree
|
|
|
+ ref="tree"
|
|
|
class="c-sibling-item c-sidebar u-width--lg"
|
|
|
shrink
|
|
|
checkbox
|
|
|
@@ -111,14 +112,17 @@ export default {
|
|
|
onDeviceLoaded (data) {
|
|
|
const count = this.colCount > 0 ? this.colCount * this.colCount : 9
|
|
|
if (count) {
|
|
|
- this.devices = this.addDefaultDevices(data, count, [])
|
|
|
+ const deviceIds = this.addDefaultDevices(data, count, [])
|
|
|
+ if (deviceIds.length > 0) {
|
|
|
+ this.$refs.tree.reset(deviceIds)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
addDefaultDevices ({ children, devices }, count, arr) {
|
|
|
if (arr.length < count && devices?.length) {
|
|
|
for (let i = 0; i < devices.length; i++) {
|
|
|
if (devices[i].onlineStatus === 1) {
|
|
|
- arr.push(this.transformDevice(devices[i]))
|
|
|
+ arr.push(devices[i].id)
|
|
|
if (arr.length >= count) {
|
|
|
return arr
|
|
|
}
|