|
@@ -38,14 +38,14 @@
|
|
|
:data="data.showPanel.items"
|
|
|
:ref="`tree-${index}`"
|
|
|
show-checkbox
|
|
|
- check-strictly
|
|
|
+ :check-strictly="data.showPanel.checkStrictly"
|
|
|
node-key="value"
|
|
|
:default-checked-keys="data.showPanel.props?.defaultCheckedKeys ?? []"
|
|
|
@check="(_, treeObj) => onCheck(data, treeObj)"
|
|
|
>
|
|
|
- <span class="custom-tree-node" slot-scope="{ node, data: _data }" >
|
|
|
+ <span slot-scope="{ node, data: _data }" >
|
|
|
<span>{{ node.label }}</span>
|
|
|
- <template v-if="_data.children?.length">
|
|
|
+ <template v-if="_data.children?.length && data.showPanel.checkStrictly">
|
|
|
<m-button text size="mini" type="primary" class="ml-3" @click.stop="onSelectAll($refs[`tree-${index}`], _data, data)">全选</m-button>
|
|
|
<m-button text size="mini" type="primary" @click.stop="onSelectNone($refs[`tree-${index}`], _data, data)">全不选</m-button>
|
|
|
</template>
|
|
@@ -126,7 +126,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onCheck ({ showPanel }, treeObj) {
|
|
|
- this.setProps(showPanel, treeObj.checkedNodes.map(e => e.tag))
|
|
|
+ if (showPanel.checkStrictly) {
|
|
|
+ this.setProps(showPanel, treeObj.checkedNodes.map(e => e.tag))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.setProps(showPanel, treeObj.checkedNodes.filter(e => !e.children).map(e => e.tag))
|
|
|
},
|
|
|
// 选中当前节点及子节点
|
|
|
onSelectAll (ref, data, { showPanel }) {
|
|
@@ -144,7 +148,6 @@ export default {
|
|
|
this.setProps(showPanel, ref[0].getCheckedNodes().map(e => e.tag))
|
|
|
},
|
|
|
setProps (showPanel, values) {
|
|
|
- console.log(values)
|
|
|
if (showPanel) {
|
|
|
showPanel.props = {
|
|
|
...showPanel.props,
|