Pārlūkot izejas kodu

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

chenrui 3 gadi atpakaļ
vecāks
revīzija
69d5158f10

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

@@ -26,6 +26,10 @@ export default {
     size: {
       type: String,
       default: 'default'
+    },
+    itemSn: {
+      type: String || Number,
+      default: undefined
     }
   },
   data () {
@@ -45,7 +49,13 @@ export default {
       const fetchId = this.lastFetchId
       this.data = []
       this.fetching = true
-      dealerQueryList({ 'nameLike': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
+      const params = { pageNo: 1, pageSize: 20 }
+      if (this.itemSn) {
+        params.dealerSn = this.itemSn
+      } else {
+        params.nameLike = dealerName
+      }
+      dealerQueryList(params).then(res => {
         if (fetchId !== this.lastFetchId) {
           return
         }
@@ -69,6 +79,19 @@ export default {
       dealerFindUpdateInfoBySn({ sn: sn }).then(res => {
         this.$emit('dealerDetail', res.data || null)
       })
+    },
+    setData (value) {
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+    }
+  },
+  mounted () {
+    if (this.itemSn) {
+      this.fetchUser(this.itemSn)
+      this.setData({ key: this.itemSn })
     }
   }
 }

+ 1 - 1
src/views/reportData/priceDifferenceDetailReport/list.vue

@@ -32,7 +32,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="客户名称">
-                  <custList id="priceDifferenceDetailList-custList" ref="custList" @change="custChange"></custList>
+                  <custList id="priceDifferenceDetailList-custList" ref="custList" :itemSn="queryParam.dealerSn" @change="custChange"></custList>
                 </a-form-model-item>
               </a-col>
             </template>

+ 1 - 1
src/views/reportData/salesReturnsReport/list.vue

@@ -30,7 +30,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="客户名称">
-                  <custList id="salesReturnsReportList-dealerName" ref="custList" @change="custChange"></custList>
+                  <custList id="salesReturnsReportList-dealerName" ref="custList" :itemSn="queryParam.dealerSn" @change="custChange"></custList>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">

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

@@ -23,7 +23,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-item label="客户名称">
-                  <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
+                  <custList ref="custList" id="shortageStatisticsCList-buyerSn" :itemSn="queryParam.buyerSn" @change="custChange"></custList>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">