Sfoglia il codice sorgente

bug修复,custList组件重新渲染后下拉数据清空问题

chenrui 3 anni fa
parent
commit
6a3db3acda

+ 17 - 1
src/views/common/custList.vue

@@ -31,6 +31,10 @@ export default {
     size: {
       type: String,
       default: 'default'
+    },
+    itemSn: {
+      type: String || Number,
+      default: undefined
     }
   },
   data () {
@@ -50,7 +54,13 @@ export default {
       const fetchId = this.lastFetchId
       this.data = []
       this.fetching = true
-      custList({ 'queryWord': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
+      const params = { pageNo: 1, pageSize: 20 }
+      if (this.itemSn) {
+        params.customerSn = this.itemSn
+      } else {
+        params.queryWord = dealerName
+      }
+      custList(params).then(res => {
         if (fetchId !== this.lastFetchId) {
           return
         }
@@ -80,6 +90,12 @@ export default {
         fetching: false
       })
     }
+  },
+  mounted () {
+    if (this.itemSn) {
+      this.fetchUser(this.itemSn)
+      this.setData({ key: this.itemSn })
+    }
   }
 }
 </script>

+ 1 - 1
src/views/salesManagement/giftRecord/list.vue

@@ -27,7 +27,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="赠送客户">
-                <custList ref="custList" @change="custChange" v-model="queryParam.customerSn"></custList>
+                <custList ref="custList" @change="custChange" :itemSn="queryParam.customerSn"></custList>
               </a-form-item>
             </a-col>
           </template>