소스 검색

客户查询

lilei 3 년 전
부모
커밋
11afcc79bb

+ 4 - 4
src/views/allocationManagement/storeTransferOut/basicInfoModal.vue

@@ -23,7 +23,7 @@
           </a-radio-group>
         </a-form-model-item>
         <a-form-model-item label="调往对象名称" :prop="isCustomer ? 'putPersonSn' : 'putPersonName'">
-          <custList ref="custList" :isValidateEnabled="true" v-if="isCustomer" @change="custChange" v-model="form.putPersonSn"></custList>
+          <custList ref="custList" :isValidateEnabled="true" v-if="isCustomer" @change="custChange"></custList>
           <a-input v-if="!isCustomer" v-model.trim="form.putPersonName" placeholder="请输入调往对象名称(最多30个字符)" allowClear :maxLength="30" />
         </a-form-model-item>
         <a-form-model-item label="调拨类型" prop="callOutType">
@@ -119,9 +119,9 @@ export default {
       })
     },
     // 调往对象名称 change
-    custChange (obj) {
-      this.form.putPersonSn = obj.key || undefined
-      this.form.putPersonName = obj.row.customerName
+    custChange (obj, row) {
+      this.form.putPersonSn = row && row.customerSn || undefined
+      this.form.putPersonName = row && row.customerName || undefined
     },
     // 调往对象  change
     putPersonTypeChange (e) {

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

@@ -80,7 +80,7 @@ export default {
     },
     handleChange (value) {
       if (value && value.key) {
-        const ind = this.data.findIndex(item => item.customerSn == value.key)
+        const ind = this.data.findIndex(item => item.customerName == value.key)
         value.row = ind != -1 ? this.data[ind] : undefined
       }
       Object.assign(this, {

+ 113 - 0
src/views/common/selectCust.vue

@@ -0,0 +1,113 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :size="size"
+    :value="dealerName"
+    placeholder="请输入客户名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    :dropdownMatchSelectWidth="false"
+    @blur="blurSelect"
+    @search="fetchUser"
+    @change="handleChange"
+    allowClear
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.customerSn" :value="item.customerSn" :disabled="isValidateEnabled ? item.enabledFlag=='0' : false">
+      {{ item.customerName }}
+      <span v-if="isValidateEnabled && item.enabledFlag=='0'">(已禁用)</span>
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { custList } from '@/api/customer'
+export default {
+  props: {
+    isValidateEnabled: {
+      type: Boolean,
+      default: false
+    },
+    size: {
+      type: String,
+      default: 'default'
+    },
+    itemSn: {
+      type: String || Number,
+      default: undefined
+    },
+    isEnabled: { // 是否只查启用状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      dealerName: undefined,
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      const params = { pageNo: 1, pageSize: 20 }
+      if (this.itemSn) {
+        params.customerSn = this.itemSn
+      } else {
+        params.queryWord = dealerName
+      }
+      if (this.isEnabled) {
+        params.enabledFlag = 1
+      }
+      custList(params).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data && res.data.list ? res.data.list : []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      if (value && value.key) {
+        const ind = this.data.findIndex(item => item.customerSn == value.key)
+        value.row = ind != -1 ? this.data[ind] : undefined
+      }
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value || { key: undefined })
+    },
+    resetForm () {
+      this.dealerName = undefined
+    },
+    setData (value) {
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+    },
+    blurSelect () {
+      this.data = []
+    }
+  },
+  mounted () {
+    if (this.itemSn) {
+      this.fetchUser(this.itemSn)
+      this.setData({ key: this.itemSn })
+    }
+  }
+}
+</script>

+ 9 - 4
src/views/numsGoodsShelves/settlementManagement/list.vue

@@ -12,7 +12,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="关联客户">
-                <custList ref="custList" @change="custChange" :itemSn="queryParam.customerSn" :isEnabled="true"></custList>
+                <custList ref="custList" @change="custChange"></custList>
               </a-form-item>
             </a-col>
             <a-col :md="4" :sm="24">
@@ -169,9 +169,14 @@ export default {
     }
   },
   methods: {
-    // 客户 change
-    custChange (obj) {
-      this.queryParam.customerSn = obj.key || undefined
+    custChange (obj, row) {
+      if (row) {
+        this.queryParam.customerSn = row && row.customerSn || undefined
+        this.queryParam.customerName = undefined
+      } else {
+        this.queryParam.customerName = obj || undefined
+        this.queryParam.customerSn = undefined
+      }
     },
     // 禁止选择今天之后的日期
     disabledDate (current) {

+ 2 - 2
src/views/numsGoodsShelves/shelfSet/basicInfoModal.vue

@@ -77,8 +77,8 @@ export default {
   },
   methods: {
     // 客户 change
-    custChange (obj) {
-      this.form.customerSn = obj.key || undefined
+    custChange (obj, row) {
+      this.form.customerSn = row && row.customerSn || undefined
     },
     //  保存
     handleSave () {

+ 14 - 4
src/views/numsGoodsShelves/shelfSet/list.vue

@@ -12,7 +12,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="关联客户">
-                <custList ref="custList" @change="custChange" :itemSn="queryParam.customerSn" :isEnabled="true"></custList>
+                <custList ref="custList" @change="custChange" :isEnabled="true"></custList>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -93,7 +93,10 @@ export default {
       queryParam: {
         shelfSn: undefined,
         customerSn: undefined,
-        finishFlag: undefined
+        finishFlag: undefined,
+        customerEntity: {
+          customerName: undefined
+        }
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
@@ -142,13 +145,20 @@ export default {
       this.$router.push({ path: `/numsGoodsShelves/shelfSet/set/${data.shelfSn}` })
     },
     // 客户 change
-    custChange (obj) {
-      this.queryParam.customerSn = obj.key || undefined
+    custChange (obj, row) {
+      if (row) {
+        this.queryParam.customerSn = row && row.customerSn || undefined
+        this.queryParam.customerEntity.customerName = undefined
+      } else {
+        this.queryParam.customerEntity.customerName = obj || undefined
+        this.queryParam.customerSn = undefined
+      }
     },
     // 重置
     resetSearchForm () {
       this.queryParam.shelfSn = undefined
       this.queryParam.customerSn = undefined
+      this.queryParam.customerEntity.customerName = undefined
       this.$refs.custList.resetForm()
       this.queryParam.finishFlag = undefined
       this.$refs.table.refresh(true)

+ 12 - 4
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" :itemSn="queryParam.customerSn"></custList>
+                <custList ref="custList" @change="custChange"></custList>
               </a-form-item>
             </a-col>
           </template>
@@ -83,7 +83,8 @@ export default {
         productCode: '', //  产品编码
         productOrigCode: '', //  原厂编码
         salesBillNo: '', //  关联销售单号
-        customerSn: undefined //  赠送客户
+        customerSn: undefined, //  赠送客户
+        customerName: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       // 加载数据方法 必须为 Promise 对象
@@ -134,8 +135,14 @@ export default {
       this.queryParam.endDate = date[1]
     },
     // 客户 change
-    custChange (obj) {
-      this.queryParam.customerSn = obj.key || undefined
+    custChange (obj, row) {
+      if (row) {
+        this.queryParam.customerSn = row && row.customerSn || undefined
+        this.queryParam.customerName = undefined
+      } else {
+        this.queryParam.customerName = obj || undefined
+        this.queryParam.customerSn = undefined
+      }
     },
     //  重置
     resetSearchForm () {
@@ -146,6 +153,7 @@ export default {
       this.queryParam.productOrigCode = ''
       this.queryParam.salesBillNo = ''
       this.queryParam.customerSn = undefined
+      this.queryParam.customerName = undefined
       if (this.advanced) {
         this.$refs.custList.resetForm()
       }

+ 15 - 4
src/views/salesManagement/productPricing/productSalesRecordModal.vue

@@ -16,7 +16,7 @@
         </div>
         <div style="display: flex;padding-bottom: 15px;align-items: center;">
           <span>选择客户:</span>
-          <div style="width: 40%;"><custList ref="custList" @change="custChange" placeholder="输入客户名称搜索" v-model="queryParam.buyerSn"></custList></div>
+          <div style="width: 40%;"><custList ref="custList" @change="custChange" placeholder="输入客户名称搜索"></custList></div>
           <div style="padding: 0 15px;color: #999;">
             <a-button type="primary" @click="handelSearch(1)">查询</a-button>
             <a-button type="default" style="margin-left: 5px" @click="reset">重置</a-button>
@@ -75,7 +75,10 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       queryParam: {
         productSn: null,
-        buyerSn: undefined
+        buyerSn: undefined,
+        salesBillEntity: {
+          buyerName: undefined
+        }
       },
       // 表头
       columns: [
@@ -97,12 +100,19 @@ export default {
   methods: {
     reset () {
       this.queryParam.buyerSn = undefined
+      this.queryParam.salesBillEntity.buyerName = undefined
       this.$refs.custList.setData(undefined)
       this.getDetail(this.baseData)
     },
     // 客户 change
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key || undefined
+    custChange (obj, row) {
+      if (row) {
+        this.queryParam.buyerSn = row && row.customerSn || undefined
+        this.queryParam.salesBillEntity.buyerName = undefined
+      } else {
+        this.queryParam.salesBillEntity.buyerName = obj || undefined
+        this.queryParam.buyerSn = undefined
+      }
     },
     //  获取详情
     getDetail (row) {
@@ -161,6 +171,7 @@ export default {
         this.curTab = '1'
         this.list = []
         this.queryParam.buyerSn = undefined
+        this.queryParam.salesBillEntity.buyerName = undefined
         this.$refs.custList.setData(undefined)
       }
     }

+ 3 - 3
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -22,7 +22,7 @@
           <a-row :gutter="15">
             <a-col :span="16">
               <a-form-model-item label="客户名称" prop="buyerSn" :labelCol="{ span: 3 }" :wrapperCol="{ span: 20 }">
-                <custList ref="custList" :isValidateEnabled="true" id="chooseCustom-buyerSn" @change="custChange" v-model="form.buyerSn"></custList>
+                <selectCust ref="custList" :isValidateEnabled="true" id="chooseCustom-buyerSn" @change="custChange" v-model="form.buyerSn"></selectCust>
               </a-form-model-item>
             </a-col>
             <a-col :span="8" v-if="$hasPermissions('B_customer_customerInfo_add')">
@@ -199,11 +199,11 @@ import { salesSave } from '@/api/sales'
 import { employeeAllList } from '@/api/salesman'
 import settleStyle from '@/views/common/settleStyle'
 import { VSelect } from '@/components'
-import custList from '@/views/common/custList.vue'
+import selectCust from '@/views/common/selectCust.vue'
 import CustomerManagementEdit from '@/views/customerManagement/customerInfo/edit.vue'
 export default {
   name: 'ChooseCustomModal',
-  components: { VSelect, CustomerManagementEdit, custList, settleStyle },
+  components: { VSelect, CustomerManagementEdit, selectCust, settleStyle },
   props: {
     show: [Boolean]
   },

+ 3 - 3
src/views/salesManagement/salesReturn/chooseCustomModal.vue

@@ -21,7 +21,7 @@
         <a-row :gutter="15">
           <a-col :span="16">
             <a-form-model-item label="客户名称" prop="buyerSn" :labelCol="{ span: 3 }" :wrapperCol="{ span: 20 }">
-              <custList ref="custList" :isValidateEnabled="true" @change="custChange" v-model="form.buyerSn"></custList>
+              <selectCust ref="custList" :isValidateEnabled="true" @change="custChange" v-model="form.buyerSn"></selectCust>
             </a-form-model-item>
           </a-col>
           <!-- <a-col :span="16">
@@ -139,11 +139,11 @@ import { getArea } from '@/api/data'
 import { custFindById, updateByCustomerSn } from '@/api/customer'
 import { salesReturnSave } from '@/api/salesReturn'
 import { VSelect } from '@/components'
-import custList from '@/views/common/custList.vue'
+import selectCust from '@/views/common/selectCust.vue'
 import CustomerManagementEdit from '@/views/customerManagement/customerInfo/edit.vue'
 export default {
   name: 'ChooseCustomModal',
-  components: { VSelect, CustomerManagementEdit, custList },
+  components: { VSelect, CustomerManagementEdit, selectCust },
   props: {
     show: [Boolean]
   },

+ 3 - 7
src/views/salesManagement/salesReturn/list.vue

@@ -17,7 +17,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                <custList ref="custList" @change="custChange" v-model="queryParam.buyerSn"></custList>
+                <custList ref="custList" v-model="queryParam.buyerName"></custList>
               </a-form-item>
             </a-col>
             <template v-if="advanced">
@@ -159,7 +159,7 @@ export default {
         endDate: getDate.getCurrMonthDays().endtime,
         auditBeginDate: '',
         auditEndDate: '',
-        buyerSn: undefined, //  客户名称
+        buyerName: undefined,
         salesReturnNo: undefined, //  销售退货单号
         state: undefined // 业务状态
       },
@@ -288,7 +288,7 @@ export default {
       this.$refs.rangeExamineDate.resetDate()
       this.queryParam.auditBeginDate = ''
       this.queryParam.auditEndDate = ''
-      this.queryParam.buyerSn = undefined
+      this.queryParam.buyerName = undefined
       this.queryParam.salesReturnNo = ''
       this.queryParam.state = undefined
       this.$refs.custList.resetForm()
@@ -296,10 +296,6 @@ export default {
         this.setIsHomeNav(this.$route.name, null)
       }
     },
-    // 客户 change
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key || undefined
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 3 - 7
src/views/salesManagement/urgentItemsOffset/list.vue

@@ -12,7 +12,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="单位名称">
-                <custList ref="custList" @change="custChange" v-model="queryParam.buyerSn"></custList>
+                <custList ref="custList" v-model="queryParam.buyerName"></custList>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -121,7 +121,7 @@ export default {
       queryParam: { //  查询条件
         beginDate: getDate.getCurrMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
-        buyerSn: undefined, //  客户名称
+        buyerName: undefined, //  客户名称
         bizBillNo: '', //  关联单号
         urgentBillNo: '', //  急件单号
         status: undefined, //  状态
@@ -193,7 +193,7 @@ export default {
       this.$refs.rangeDate.resetDate(this.time)
       this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
       this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.buyerSn = undefined
+      this.queryParam.buyerName = undefined
       this.queryParam.bizBillNo = ''
       this.queryParam.urgentBillNo = ''
       this.queryParam.status = undefined
@@ -205,10 +205,6 @@ export default {
     handleDetail (row) {
       this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.urgentBillSn}` })
     },
-    // 客户 change
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key || undefined
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调