Browse Source

fix 在列表删除ppt后无法正确显示列表

cxmo 5 months ago
parent
commit
d5a5fc8695

+ 4 - 4
src/views/ppt_manage/newVersion/pptCatalog.vue

@@ -569,14 +569,14 @@ export default {
         this.$nextTick(()=>{
            //选中节点
           this.$refs[`${this.treeName}Tree`].setCurrentKey(item.nodeKeyId)
-          //展开该节点的父节点
+          //找到该节点的父节点,展开,获取父节点id
           const node = this.$refs[`${this.treeName}Tree`].getCurrentNode()
           !this[`${this.treeName}ExpandKeys`].includes(node.catalogId)&&this[`${this.treeName}ExpandKeys`].push(node.catalogId)
+          this.pptItem.catalogId = node.catalogId||''
           this.selectNode = item
         })
       }else{
         //获取目录下的ppt列表:getCatalogListByGroupId/getCatalogListByAdminId
-
         const res = this.treeName==='public' 
           ? await pptInterface.getCatalogListByAdminId({ AdminId:item.AdminId||''})
           : this.treeName==='private'
@@ -771,13 +771,13 @@ export default {
             this.$refs[`${this.treeName}Tree`].setCurrentKey(data.catalogId)
             //删除的是公共目录下,某目录的最后一个PPT时,该公共目录会消失
             if(this.treeName==='public'&&catalog.PptList.length>1){
-              this.changeModel('list',catalog)
+              this.changeModel('list',catalog||{})
             }else if(this.treeName==='public'&&catalog.PptList.length===1){
               this.changeModel('list',{})
             }
             //但是私有目录不会
             if(this.treeName==='private'){
-              this.changeModel('list',catalog)
+              this.changeModel('list',catalog||{})
             }
           }
         })

+ 4 - 3
src/views/ppt_manage/newVersion/pptEnCatalog.vue

@@ -545,9 +545,10 @@ export default {
         this.$nextTick(()=>{
            //选中节点
           this.$refs[`${this.treeName}Tree`].setCurrentKey(item.nodeKeyId)
-          //展开该节点的父节点
+          //找到该节点的父节点,展开,获取父节点id
           const node = this.$refs[`${this.treeName}Tree`].getCurrentNode()
           !this[`${this.treeName}ExpandKeys`].includes(node.catalogId)&&this[`${this.treeName}ExpandKeys`].push(node.catalogId)
+          this.pptItem.catalogId = node.catalogId||''
           this.selectNode = item
         })
       }else{
@@ -740,13 +741,13 @@ export default {
             this.$refs[`${this.treeName}Tree`].setCurrentKey(data.catalogId)
             //删除的是公共目录下,某目录的最后一个PPT时,该公共目录会消失
             if(this.treeName==='public'&&catalog.PptList.length>1){
-              this.changeModel('list',catalog)
+              this.changeModel('list',catalog||{})
             }else if(this.treeName==='public'&&catalog.PptList.length===1){
               this.changeModel('list',{})
             }
             //但是私有目录不会
             if(this.treeName==='private'){
-              this.changeModel('list',catalog)
+              this.changeModel('list',catalog||{})
             }
           }
         })