فهرست منبع

fix: 优化经销商加载

Howie 1 سال پیش
والد
کامیت
0f55898771
2فایلهای تغییر یافته به همراه40 افزوده شده و 3 حذف شده
  1. 39 2
      src/views/commercialEngineering/components/base.vue
  2. 1 1
      src/views/commercialEngineering/mixin/index.js

+ 39 - 2
src/views/commercialEngineering/components/base.vue

@@ -150,6 +150,10 @@
               placeholder="请选择"
               clearable
               filterable
+              remote
+              reserve-keyword
+              :remote-method="remoteMethod"
+              :loading="loading"
               @change="handleCustomer"
             >
               <el-option
@@ -568,6 +572,7 @@ import GeographicalPosi from './geographicalPosi.vue'
 import FileUpload from '@/components/Common/file-upload.vue'
 import { mapGetters } from 'vuex'
 import { getPositionProject, getHistory } from '@/api/frock'
+import { getDealerListV2 } from '@/api/basic_data/dealer'
 
 export default {
   components: {
@@ -634,7 +639,8 @@ export default {
         '1608756901402767362': '儋州市',
         '1608756898412228610': '三沙市',
         '1608757977963163649': '嘉峪关市'
-      }
+      },
+      loading: false
     }
   },
   computed: {
@@ -651,6 +657,7 @@ export default {
   watch: {
     async 'formData.id'(newValue, oldValue) {
       if (newValue) {
+
         if (this.isTradeExaminer) {
           this.getPositionProject()
         } else {
@@ -690,7 +697,6 @@ export default {
           this.formData.homeProjectNameSeat = ''
           this.formData.homeProjectNameNumber = ''
         }
-
         await this.getCallbackPosition(null, this.formData.provinceId, 'province', 'lbsId')
         await this.getCallbackPosition(this.formData.provinceId, this.formData.cityId, 'city', 'lbsId')
         await this.getCallbackPosition(this.formData.cityId, this.formData.areaId, 'area', 'lbsId')
@@ -698,6 +704,9 @@ export default {
         if (!temp && !temp?.parentLbsId && !Object.keys(this.specialCity).includes(temp?.parentLbsId)) {
           await this.getCallbackPosition(this.formData.areaId, this.formData.streetId, 'street', 'lbsId')
         }
+        if (this.formData.customerId && this.formData.customerName) {
+          this.getDealerListV2(this.formData.customerName)
+        }
       }
     }
   },
@@ -1011,6 +1020,34 @@ export default {
         this.formData.customerLinkMobile = res.data.linkMobile || ''
         this.formData.customerAddress = res.data.address || ''
       })
+    },
+    remoteMethod(e){
+      this.loading = false
+      this.getDealerListV2(e)
+    },
+    getDealerListV2(e){
+      getDealerListV2({
+        pageNum: 1,
+        pageSize: 100,
+        params:[
+          {
+            "param": "a.name",
+            "compare": "like",
+            "value": e
+          }
+        ]
+      }).then(res => {
+        this.commonData.customerList = res.data.records.map(k => {
+          return {
+            number: k.number,
+            label: k.name,
+            value: k.id
+          }
+        })
+      }).finally(()=>{
+        this.loading = false
+
+      })
     }
   }
 }

+ 1 - 1
src/views/commercialEngineering/mixin/index.js

@@ -183,7 +183,7 @@ export default {
     getDealerListV2() {
       getDealerListV2({
         pageNum: 1,
-        pageSize: -1
+        pageSize: 100
       }).then(res => {
         this.commonData.customerList = res.data.records.map(k => {
           return {