Explorar o código

多级分类回显问题解决

赵志鹏 hai 1 ano
pai
achega
3819516605

+ 12 - 12
src/views/modules/knowledge/warehouse/contentData.vue

@@ -203,19 +203,19 @@ export default {
       }
       this.categoryName=this.$route.query.categoryName
     }
-
     if(this.$route.query.isBack) {
-      this.categoryValue = []
-      if(this.$route.query.categoryId!=undefined){
-        this.categoryId=this.$route.query.categoryId
-        this.categoryValue=[this.$route.query.parentp,this.$route.query.parent,this.$route.query.categoryId]
-      }else if(this.$route.query.parent!=undefined){
-        this.categoryId=this.$route.query.parent
-        this.categoryValue=[this.$route.query.parentp,this.$route.query.parent]
-      }else{
-        this.categoryId=this.$route.query.parentp
-        this.categoryValue.push(this.$route.query.parentp)
-      }
+      // this.categoryValue = []
+      // if(this.$route.query.categoryId!=undefined){
+      //   this.categoryId=this.$route.query.categoryId
+      //   this.categoryValue=[this.$route.query.parentp,this.$route.query.parent,this.$route.query.categoryId]
+      // }else if(this.$route.query.parent!=undefined){
+      //   this.categoryId=this.$route.query.parent
+      //   this.categoryValue=[this.$route.query.parentp,this.$route.query.parent]
+      // }else{
+      //   this.categoryId=this.$route.query.parentp
+      //   this.categoryValue.push(this.$route.query.parentp)
+      // }
+      this.categoryValue = this.$route.query.categoryId.split(',')
       // console.log(this.$route.query.categoryName)
       if(this.$route.query.categoryName) {
         this.categoryName=this.$route.query.categoryName

+ 11 - 9
src/views/modules/knowledge/warehouse/knowledgeAddUpdate.vue

@@ -571,22 +571,24 @@ export default {
       }
     },
     cancle() {
+      console.log(this.knowledgeForm.categoryId)
       if(this.classifyName) {
         let queryData = {
           categoryName: this.classifyName,
           isBack: 1,
           type: this.$route.query.type,
           tapAction: this.$route.query.tapAction,
+          categoryId: this.knowledgeForm.categoryId.join(',')
         }
-        if(this.knowledgeForm.categoryId[0]) {
-          queryData.parentp = this.knowledgeForm.categoryId[0]
-          if(this.knowledgeForm.categoryId[1]) {
-            queryData.parent = this.knowledgeForm.categoryId[1]
-            if(this.knowledgeForm.categoryId[2]) {
-              queryData.categoryId = this.knowledgeForm.categoryId[2]
-            } 
-          }
-        }
+        // if(this.knowledgeForm.categoryId[0]) {
+        //   queryData.parentp = this.knowledgeForm.categoryId[0]
+        //   if(this.knowledgeForm.categoryId[1]) {
+        //     queryData.parent = this.knowledgeForm.categoryId[1]
+        //     if(this.knowledgeForm.categoryId[2]) {
+        //       queryData.categoryId = this.knowledgeForm.categoryId[2]
+        //     } 
+        //   }
+        // }
         this.$router.replace({
           name: "contentData",
           query: queryData,