bug修改
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-input-search v-model="searchValue" style="margin-bottom: 8px" :placeholder="$t('NodeQuickLookup')" @change="onChange" />
|
||||
<a-input-search v-model="searchValue" style="margin-bottom: 8px" :placeholder="$t('NodeQuickLookup')" @change="onChange" @search="onSearch" />
|
||||
<a-tree
|
||||
v-if="treeData && treeData.length"
|
||||
v-model="checkedKeys"
|
||||
@@ -48,7 +48,8 @@
|
||||
autoExpandParent: true,
|
||||
treeData: [],
|
||||
dataList:[],
|
||||
searchValue:''
|
||||
searchValue:'',
|
||||
data:[]
|
||||
}
|
||||
},
|
||||
props:{
|
||||
@@ -68,15 +69,21 @@
|
||||
methods:{
|
||||
//获取数据
|
||||
loadData(){
|
||||
let params = {}
|
||||
let params = {
|
||||
title:this.searchValue
|
||||
}
|
||||
|
||||
getAction(`sys/category/getSysCategoryTree`,params).then(res=> {
|
||||
if(res.success){
|
||||
let data=res.result
|
||||
this.treeData=this.addAttr(data)
|
||||
this.data=[...res.result]
|
||||
this.treeData=this.addAttr(this.data)
|
||||
// console.log('treeData',this.treeData)
|
||||
}
|
||||
})
|
||||
},
|
||||
onSearch(){
|
||||
this.loadData()
|
||||
},
|
||||
//获取用户的订阅
|
||||
getSubscribtion(){
|
||||
postAction(`domain/domainUserRel/queryList`,{}).then(res=> {
|
||||
@@ -96,6 +103,9 @@
|
||||
if((Array.isArray(dataI)) && dataI.length>0){
|
||||
dataI.forEach((item,index)=>{
|
||||
this.$set(item,'key',item.id)
|
||||
// if(item.title.indexOf(this.searchValue)!==-1){
|
||||
// console.log('item.title',item.title)
|
||||
// }
|
||||
let arr = [];
|
||||
this.addAttr(item.children,arr);
|
||||
});
|
||||
@@ -155,15 +165,17 @@
|
||||
this.autoExpandParent = false;
|
||||
},
|
||||
onChange(e) {
|
||||
// this.loadData()
|
||||
const value = e.target.value;
|
||||
const expandedKeys = this.dataList
|
||||
.map(item => {
|
||||
if (item.title.indexOf(value) > -1) {
|
||||
return this.getParentKey(item.key, this.gData);
|
||||
return this.getParentKey(item.key, this.treeData);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((item, i, self) => item && self.indexOf(item) === i);
|
||||
console.log('item',item)
|
||||
Object.assign(this, {
|
||||
expandedKeys,
|
||||
searchValue: value,
|
||||
@@ -171,11 +183,11 @@
|
||||
})
|
||||
},
|
||||
onCheck(checkedKeys) {
|
||||
console.log('onCheck', checkedKeys);
|
||||
// console.log('onCheck', checkedKeys);
|
||||
this.checkedKeys = checkedKeys;
|
||||
},
|
||||
onSelect(selectedKeys, info) {
|
||||
console.log('onSelect', info);
|
||||
// console.log('onSelect', info);
|
||||
this.selectedKeys = selectedKeys;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user