Browse Source

Merge branch 'edit' of http://192.168.10.210:3000/daiyanrong/order-ui-pc into edit

戴艳蓉 3 years ago
parent
commit
d7b539885a
1 changed files with 21 additions and 38 deletions
  1. 21 38
      src/components/company-search/main.vue

+ 21 - 38
src/components/company-search/main.vue

@@ -37,18 +37,8 @@ export default {
       list: [],
       states: [],
       children: [],
-      parmValue: {
-        page: 1,
-        size: 100,
-      },
     };
   },
-  mounted() {
-    // this.list = this.states.map((item) => {
-    //   return { value: `value:${item}`, label: `label:${item}` };
-    // });
-    this.stockName();
-  },
   computed: {
     ...mapGetters(["searchSize"]),
   },
@@ -62,45 +52,38 @@ export default {
         }
       });
       let company = {
-        // ['gggg公司']
         value: e,
         companyName,
       };
       this.$emit("searchCard", company);
-      // this.options.forEach((element) => {
-      //   if (element.value === this.value) {
-      //     this.children = element.children;
-      //     this.$emit("stock", this.children);
-      //   }
-      // });
     },
-
-    remoteMethod(query) {
+    async remoteMethod(query) {
       if (query !== "") {
         this.loading = true;
-        setTimeout(() => {
-          this.loading = false;
-          this.options = this.list.filter((item) => {
-            return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
-          });
-        }, 200);
+        let parmValue = {
+          page: 1,
+          size: 100,
+        };
+        const res = await asyncRequest.list(parmValue);
+        let arr = res.data.list;
+        arr.forEach((ele) => {
+          let item = {
+            value: ele.id,
+            label: ele.name,
+            code: ele.code,
+          };
+          this.options.push(item);
+        });
+        this.loading = false;
+        console.log(this.options);
+        this.options = arr.filter((item) => {
+          return item.name.indexOf(query) > -1;
+        });
+        console.log(this.options);
       } else {
         this.options = [];
       }
     },
-    //获取多级仓库名称的方法
-    async stockName() {
-      const res = await asyncRequest.list(this.parmValue);
-      let arr = res.data.list;
-      arr.forEach((ele) => {
-        let item = {
-          value: ele.id,
-          label: ele.name,
-          code: ele.code,
-        };
-        this.options.push(item);
-      });
-    },
   },
 };
 </script>