lilei há 2 anos atrás
pai
commit
417f6ab85f
1 ficheiros alterados com 11 adições e 10 exclusões
  1. 11 10
      src/views/allocationManagement/transferOut/basicInfoModal.vue

+ 11 - 10
src/views/allocationManagement/transferOut/basicInfoModal.vue

@@ -135,6 +135,7 @@ export default {
     detailData: Object
   },
   data () {
+    this.lastFetchId = 0
     this.fetchUser = debounce(this.fetchUser, 800)
     return {
       isShow: this.openModal, //  是否打开弹框
@@ -235,18 +236,18 @@ export default {
       console.log(val, opt, '------------')
       this.form.productBrandName = opt ? opt.brandName : ''
     },
-    // 搜索经销商
-    fetchUser (value) {
-      console.log('fetching user', value)
+    fetchUser (dealerName) {
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.dealerData = []
       this.fetching = true
-      dealerSubareaScopeList({ nameLike: value, pageNo: 1, pageSize: 20 }).then(res => {
-        if (res.status == 200) {
-          this.dealerData = res.data && res.data.list ? res.data.list : []
-          this.fetching = false
-        } else {
-          this.dealerData = []
-          this.fetching = false
+      dealerSubareaScopeList({ nameLike: dealerName.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
         }
+        this.dealerData = res.data && res.data.list ? res.data.list : []
+        this.fetching = false
       })
     },
     // 调往对象名称经销商  change