|
@@ -120,22 +120,40 @@ export default {
|
|
|
},
|
|
|
searchTitle(newVal){
|
|
|
if(!newVal) return
|
|
|
- let data = null
|
|
|
- this.privateList.forEach((item)=>{
|
|
|
- item.children.forEach(i=>{
|
|
|
- if(i.PptId===newVal){
|
|
|
- data = i
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ let data = this.findPptById(this.privateList || [],newVal) || {};
|
|
|
this.$refs.privateTree.setCurrentKey('ppt'+newVal)
|
|
|
const node = this.$refs.privateTree.getCurrentNode()
|
|
|
+ if(!node) return;
|
|
|
!this.privateExpandKeys.includes(node.catalogId)&&this.privateExpandKeys.push(node.catalogId)
|
|
|
this.choosedItem = data
|
|
|
this.searchOptions=[]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ findPptById(data, newVal){
|
|
|
+ let result = null;
|
|
|
+ function traverse(node) {
|
|
|
+ if (!node || result) return;
|
|
|
+
|
|
|
+ if (node.PptId == newVal) {
|
|
|
+ result = node;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Array.isArray(node.children)) {
|
|
|
+ for (const child of node.children) {
|
|
|
+ traverse(child);
|
|
|
+ if (result) break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const item of data) {
|
|
|
+ traverse(item);
|
|
|
+ if (result) break;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
cancelHandle(){this.$emit('cancel')},
|
|
|
saveHandle(){
|
|
|
if(this.value.length===0){
|