Browse Source

1. 优化

MONSTER-ygh 1 year ago
parent
commit
b23cd56086
1 changed files with 19 additions and 3 deletions
  1. 19 3
      src/views/distribution/personnelMr/dialog/addAndEdit.vue

+ 19 - 3
src/views/distribution/personnelMr/dialog/addAndEdit.vue

@@ -157,7 +157,8 @@ export default {
       },
 
       parentNameLoading: false,
-      parentNameList: []
+      parentNameList: [],
+      parentId: null,
     };
   },
   methods: {
@@ -169,6 +170,7 @@ export default {
      */
     openDialog(title, obj) {
       this.open = true;
+      this.parentId = null
       this.reset();
       if (obj){
         this.title = "编辑分销人员";
@@ -185,6 +187,7 @@ export default {
       const id = row.id
       getSelectById(id).then(response => {
         const obj = response.data;
+        this.parentId = obj.id
         if(row.parentId && obj.parentId != 0){
           this.getList({id:row.parentId})
         }
@@ -312,7 +315,14 @@ export default {
           })
           .then(response => {
               this.parentNameLoading = false;
-              this.parentNameList = [].concat(response.data.rows);
+              let list = []
+              console.log("list===",this.parentId)
+              response.data.rows.forEach((item,index)=>{
+                if(this.parentId != item.id) {
+                  list.push(item)
+                }
+              })
+              this.parentNameList = [].concat(list);
               this.parentNameLoading = false;
             }
           ).catch ((error)=>{
@@ -331,7 +341,13 @@ export default {
           })
           .then(response => {
               this.parentNameLoading = false;
-              this.parentNameList = [].concat(response.data.rows);
+              let list = []
+              response.data.rows.forEach((item,index)=>{
+                if(this.parentId != item.id) {
+                  list.push(item)
+                }
+              })
+              this.parentNameList = [].concat(list);
               this.parentNameLoading = false;
             }
           ).catch ((error)=>{