diff --git a/jero-web/src/views/documentManage/splitting/modules/imports.vue b/jero-web/src/views/documentManage/splitting/modules/imports.vue index c612a166b..5fd2d7707 100644 --- a/jero-web/src/views/documentManage/splitting/modules/imports.vue +++ b/jero-web/src/views/documentManage/splitting/modules/imports.vue @@ -34,7 +34,7 @@
- +
{ if(res.success){ + console.log('result',res.result) this.data=[...res.result] - this.treeData=[...this.addAttr(this.data)] + this.treeData1=[...this.addAttr(this.data)] + this.treeData=[...this.treeData1] // console.log('treeData',this.treeData) } }) @@ -84,6 +88,7 @@ onSearch(){ // this.treeData=[] // this.treeData=this.getSearch(this.data) + // this.getSearch(this.searchValue,this.treeData1) }, //获取用户的订阅 getSubscribtion(){ @@ -111,21 +116,26 @@ // console.log('dataI',dataI) return dataI }, - getSearch(dataI){ + getSearch(key,tree){ let dataSearch=[] - console.log('tree',this.treeData,this.data) - if((Array.isArray(dataI)) && dataI.length>0){ - dataI.forEach((item,index)=>{ - this.$set(item,'key',item.id) - if(item.title.indexOf(this.searchValue)>-1){ - dataSearch.push(item) + let parentKey; + for (let i = 0; i < tree.length; i++) { + const node = tree[i]; + + if (node.children) { + if (node.children.some(item => item.title.indexOf(key)>-1)) { + console.log('titel',node) + parentKey = node.key; + this.parentItem.push(node) + } else if (this.getParentKey(key, node.children)) { + parentKey = this.getParentKey(key, node.children); } - let arr = []; - this.addAttr(item.children,arr); - }); + } } - console.log('dataSearch',dataSearch) - return dataSearch + console.log('dataSearch',this.parentItem) + return this.parentItem + + // return dataSearch }, afterVisibleChange(val) { // console.log('visible', val);