|
|
@@ -28,21 +28,24 @@
|
|
|
@click="getDevices"
|
|
|
/>
|
|
|
<template v-else>
|
|
|
- <div class="l-flex__none l-flex--row c-sibling-item--v u-overflow--hidden">
|
|
|
- <div
|
|
|
- v-if="canReset"
|
|
|
- class="l-flex__none o-button c-sibling-item"
|
|
|
- @click="onReset"
|
|
|
- >
|
|
|
- 重置
|
|
|
- </div>
|
|
|
+ <div
|
|
|
+ v-if="hasData"
|
|
|
+ class="l-flex__none l-flex--row c-sibling-item--v u-overflow--hidden"
|
|
|
+ >
|
|
|
<search-input
|
|
|
v-model.trim="deviceName"
|
|
|
- class="l-flex__fill c-sibling-item near"
|
|
|
+ class="l-flex__fill c-sibling-item"
|
|
|
size="small"
|
|
|
placeholder="设备名称"
|
|
|
@search="onSearch"
|
|
|
/>
|
|
|
+ <div
|
|
|
+ v-if="checkbox"
|
|
|
+ class="l-flex__none o-button c-sibling-item near"
|
|
|
+ @click="onReset"
|
|
|
+ >
|
|
|
+ 重置
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<c-tree
|
|
|
class="l-flex__fill c-sibling-item--v"
|
|
|
@@ -93,7 +96,8 @@ export default {
|
|
|
loading: false,
|
|
|
error: false,
|
|
|
active: 'group',
|
|
|
- deviceName: ''
|
|
|
+ deviceName: '',
|
|
|
+ hasData: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -102,9 +106,6 @@ export default {
|
|
|
},
|
|
|
iconClass () {
|
|
|
return this.shrinkState ? 'el-icon-d-arrow-right' : 'el-icon-d-arrow-left'
|
|
|
- },
|
|
|
- canReset () {
|
|
|
- return this.checkbox && !this.rootOption.disabled
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -125,6 +126,7 @@ export default {
|
|
|
this.getDevicesByActive().then(
|
|
|
data => {
|
|
|
this.$nodes = data
|
|
|
+ this.hasData = !!data.length
|
|
|
this.initData()
|
|
|
},
|
|
|
() => {
|
|
|
@@ -256,7 +258,7 @@ export default {
|
|
|
this.customExpand = !!this.deviceName
|
|
|
},
|
|
|
filterNode (node, regx) {
|
|
|
- const { disbaled, checked, indeterminate } = node
|
|
|
+ const { disabled, checked, indeterminate } = node
|
|
|
let change = false
|
|
|
node.children.forEach(subnode => {
|
|
|
if (subnode.children) {
|
|
|
@@ -272,7 +274,7 @@ export default {
|
|
|
})
|
|
|
if (change) {
|
|
|
this.checkNode(node)
|
|
|
- return disbaled !== node.disbaled || checked !== node.checked || indeterminate !== node.indeterminate
|
|
|
+ return disabled !== node.disabled || checked !== node.checked || indeterminate !== node.indeterminate
|
|
|
}
|
|
|
return change
|
|
|
},
|