瀏覽代碼

客户查询

lilei 3 年之前
父節點
當前提交
5ab6ddb139
共有 3 個文件被更改,包括 32 次插入67 次删除
  1. 1 1
      public/version.json
  2. 30 57
      src/views/common/custList.vue
  3. 1 9
      src/views/salesManagement/salesQuery/list.vue

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1655285242518
+  "version": 1655286839915
 }

+ 30 - 57
src/views/common/custList.vue

@@ -1,30 +1,26 @@
 <template>
-  <div style="position: relative;z-index: 1000;">
-    <a-input ref="inputs" v-if="showInput" v-model="queryWord" allowClear/>
-    <a-select
-      v-else
-      show-search
-      :show-arrow="false"
-      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>
-  </div>
+  <a-select
+    show-search
+    label-in-value
+    :size="size"
+    :value="dealerName"
+    mode="combobox"
+    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.customerName" :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'
@@ -54,24 +50,13 @@ export default {
     return {
       data: [],
       dealerName: undefined,
-      fetching: false,
-      queryWord: '',
-      showInput: false
-    }
-  },
-  watch: {
-    queryWord (newValue, oldValue) {
-      this.inputChange()
-      if (newValue.length == 0) {
-        this.showInput = false
-        this.setData(undefined)
-      }
+      fetching: false
     }
   },
   methods: {
-    fetchUser (value) {
-      console.log('fetching user', value)
-      if (value == '') return
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
       this.lastFetchId += 1
       const fetchId = this.lastFetchId
       this.data = []
@@ -80,8 +65,7 @@ export default {
       if (this.itemSn) {
         params.customerSn = this.itemSn
       } else {
-        params.queryWord = value
-        this.queryWord = value
+        params.queryWord = dealerName
       }
       if (this.isEnabled) {
         params.enabledFlag = 1
@@ -92,20 +76,8 @@ export default {
         }
         this.data = res.data && res.data.list ? res.data.list : []
         this.fetching = false
-        // 显示输入框
-        this.showInput = this.data.length == 0
-        this.inputChange()
       })
     },
-    inputChange () {
-      if (this.showInput) {
-        this.$emit('changeInput', this.queryWord)
-        this.$emit('change', { key: undefined })
-        this.$nextTick(() => {
-          this.$refs.inputs && this.$refs.inputs.focus()
-        })
-      }
-    },
     handleChange (value) {
       if (value && value.key) {
         const ind = this.data.findIndex(item => item.customerSn == value.key)
@@ -113,10 +85,11 @@ export default {
       }
       Object.assign(this, {
         dealerName: value,
+        data: [],
         fetching: false
       })
-      this.$emit('change', value || { key: undefined })
-      this.$emit('changeInput', undefined)
+      this.$emit('change', value && value.key || undefined, value && value.row || undefined)
+      this.$emit('input', value && value.key || undefined)
     },
     resetForm () {
       this.dealerName = undefined

+ 1 - 9
src/views/salesManagement/salesQuery/list.vue

@@ -23,7 +23,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                  <custList ref="custList" @change="custChange" @changeInput="custChangeInput" v-model="queryParam.buyerSn"></custList>
+                  <custList ref="custList" v-model="queryParam.buyerName"></custList>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
@@ -417,14 +417,6 @@ export default {
         }
       })
     },
-    // 客户 change
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key || undefined
-    },
-    custChangeInput (v) {
-      console.log(v)
-      this.queryParam.buyerName = v || undefined
-    },
     // 重置
     resetSearchForm () {
       this.resetData()