|
@@ -2,19 +2,26 @@
|
|
|
<div class="treeList">
|
|
|
<div class="tree-body">
|
|
|
<a-spin :spinning="spinning">
|
|
|
- <a-tree
|
|
|
- v-model="checkedKeys"
|
|
|
- show-checkbox
|
|
|
- checkable
|
|
|
- :expanded-keys="expandedKeys"
|
|
|
- :auto-expand-parent="autoExpandParent"
|
|
|
- :selected-keys="selectedKeys"
|
|
|
- :tree-data="treeData"
|
|
|
- node-key="id"
|
|
|
- @expand="onExpand"
|
|
|
- @select="onSelect"
|
|
|
- @check="onCheck"
|
|
|
- />
|
|
|
+ <Tree
|
|
|
+ :multiple="true"
|
|
|
+ :notNull="true"
|
|
|
+ :returnParentNode="false"
|
|
|
+ :data="treeData"
|
|
|
+ @change="onChange"
|
|
|
+ />
|
|
|
+<!-- <a-tree-->
|
|
|
+<!-- v-model="checkedKeys"-->
|
|
|
+<!-- show-checkbox-->
|
|
|
+<!-- checkable-->
|
|
|
+<!-- :expanded-keys="expandedKeys"-->
|
|
|
+<!-- :auto-expand-parent="autoExpandParent"-->
|
|
|
+<!-- :selected-keys="selectedKeys"-->
|
|
|
+<!-- :tree-data="treeData"-->
|
|
|
+<!-- node-key="id"-->
|
|
|
+<!-- @expand="onExpand"-->
|
|
|
+<!-- @select="onSelect"-->
|
|
|
+<!-- @check="onCheck"-->
|
|
|
+<!-- />-->
|
|
|
</a-spin>
|
|
|
</div>
|
|
|
|
|
@@ -70,6 +77,10 @@ export default {
|
|
|
console.log("onSelect", info);
|
|
|
this.selectedKeys = selectedKeys;
|
|
|
},
|
|
|
+ onChange(id){
|
|
|
+ console.log(id);
|
|
|
+ this.checkedKeys = id.checkedIds;
|
|
|
+ },
|
|
|
queryByGroup() {
|
|
|
this.spinning = true;
|
|
|
const data = {
|
|
@@ -88,23 +99,29 @@ export default {
|
|
|
const children = this.mapTree(item.Category);
|
|
|
newTree.push({
|
|
|
title: item.Name,
|
|
|
+ name: item.Name,
|
|
|
id: item.Id,
|
|
|
key:item.Id,
|
|
|
+ checked: 'uncheck',
|
|
|
children
|
|
|
});
|
|
|
} else {
|
|
|
newTree.push({
|
|
|
title: item.Name,
|
|
|
+ name: item.Name,
|
|
|
id: item.Id,
|
|
|
key:item.Id,
|
|
|
+ checked: 'uncheck',
|
|
|
children: []
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
newTree.push({
|
|
|
title: '其他分组',
|
|
|
+ name: '其他分组',
|
|
|
id: '#',
|
|
|
key:'#',
|
|
|
+ checked: 'uncheck',
|
|
|
children: []
|
|
|
})
|
|
|
return newTree;
|
|
@@ -113,9 +130,20 @@ export default {
|
|
|
getSelectId(data){
|
|
|
if(data == 'cancel'){
|
|
|
this.checkedKeys = this.categoryIdS;
|
|
|
+ this.treeData.map(item=>{
|
|
|
+ if(this.categoryIdS.indexOf(item.id)>-1){
|
|
|
+ item.checked = 'checked'
|
|
|
+ }else{
|
|
|
+ item.checked = 'uncheck'
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
}else if(data == 'rest'){
|
|
|
// this.checkedKeys = [this.categoryId];
|
|
|
this.checkedKeys = [];
|
|
|
+ this.treeData.map(item=>{
|
|
|
+ item.checked = 'uncheck'
|
|
|
+ })
|
|
|
}else{
|
|
|
this.checkedKeys =data;
|
|
|
}
|