lilei пре 4 година
родитељ
комит
c52578b2a7

+ 5 - 1
src/views/common/custList.js

@@ -9,7 +9,7 @@ const CustList = {
           :showSearch="true"
           @change="handleChange"
           :filter-option="filterOption">
-          <a-select-option v-for="item in custAllList" :key="item.customerName" :value="item.customerName">{{ item.customerName }}</a-select-option>
+          <a-select-option v-for="item in custAllList" :key="item[defValKey]" :value="item[defValKey]">{{ item.customerName }}</a-select-option>
         </a-select>
     `,
   props: {
@@ -21,6 +21,10 @@ const CustList = {
       type: String,
       default: ''
     },
+    defValKey: {
+      type: String,
+      default: 'customerName'
+    }
   },
   data() {
     return {

+ 3 - 27
src/views/salesManagement/backorder/list.vue

@@ -18,37 +18,12 @@
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="客户名称">
-              <a-select
-                id="backorderList-bundleName"
-                placeholder="请选择"
-                allowClear
-                v-model="queryParam.dataSourceNo"
-                :showSearch="true"
-                option-filter-prop="children"
-                :filter-option="filterOption">
-                <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
-              </a-select>
+              <custList id="backorderList-bundleName" defValKey="customerSn" v-model="queryParam.buyerSn"></custList>
             </a-form-item>
           </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="销售单号">
-              <a-input id="backorderList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入销售单号"/>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
-            <a-col :md="6" :sm="24">
-              <a-form-item label="采购单号">
-                <a-input id="backorderList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入采购单号"/>
-              </a-form-item>
-            </a-col>
-          </template>
           <a-col :md="6" :sm="24">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="backorderList-refresh">查询</a-button>
             <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="backorderList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
           </a-col>
         </a-row>
       </a-form>
@@ -73,9 +48,10 @@
 
 <script>
 // import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
+import custList from '@/views/common/custList.js'
 import { STable, VSelect } from '@/components'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, custList },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭

+ 4 - 25
src/views/salesManagement/salesReturn/list.vue

@@ -28,16 +28,7 @@
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-select
-                id="salesReturn-buyerSn"
-                placeholder="请选择客户"
-                allowClear
-                v-model="queryParam.buyerSn"
-                :showSearch="true"
-                option-filter-prop="children"
-                :filter-option="filterOption">
-                <a-select-option v-for="item in custAllList" :key="item.customerSn" :value="item.customerSn">{{ item.customerName }}</a-select-option>
-              </a-select>
+              <custList id="salesReturn-buyerSn" defValKey="customerSn" v-model="queryParam.buyerSn"></custList>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
@@ -136,7 +127,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
-import { custAllList } from '@/api/customer'
+import custList from '@/views/common/custList.js'
 import { salesReturnList, salesReturnQueryCount, salesReturnAudit, salesReturnDel } from '@/api/salesReturn'
 import moment from 'moment'
 export default {
@@ -144,7 +135,8 @@ export default {
   components: {
     STable,
     VSelect,
-    chooseCustomModal
+    chooseCustomModal,
+    custList
   },
   data () {
     return {
@@ -156,7 +148,6 @@ export default {
       createDate: [], //  创建时间
       examineTime: [], //  审核时间
       openModal: false, // 选择客户弹框是否显示
-      custAllList: [], //  客户下拉数据
       // 查询参数
       queryParam: {
         buyerSn: undefined, //  客户名称
@@ -287,17 +278,6 @@ export default {
       this.examineTime = []
       this.$refs.table.refresh(true)
     },
-    // 客户无分页列表数据
-    getCustAllList () {
-      const _this = this
-      custAllList().then(res => {
-        if (res.status == 200) {
-          _this.custAllList = res.data || []
-        } else {
-          _this.custAllList = []
-        }
-      })
-    },
     filterOption (input, option) {
       return (
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
@@ -306,7 +286,6 @@ export default {
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.getCustAllList()
     })
   }
 }