This commit is contained in:
jhd
2026-05-23 16:46:53 +08:00
2 changed files with 32 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
<template>
<el-select filterable v-model="_customerId" remote :remote-method="remoteSearchCustomer" :style="style" :loading="customerLoading" placeholder="请选择客户">
<el-select filterable v-model="_customerId" :remote="pager" :remote-method="pager ? remoteSearchCustomer : undefined" :style="style" v-loading="customerLoading" placeholder="请选择客户">
<el-option v-for="item in customerList" :key="item[bindField]" :label="item.companyName" :value="item[bindField]" />
</el-select>
</template>
@@ -21,6 +21,10 @@
style: {
type: Object,
default: () => ({})
},
pager: {
type: Boolean,
default: true
}
},
computed: {
@@ -51,7 +55,7 @@
methods: {
remoteSearchCustomer(query) {
this.customerLoading = true;
listCustomer({ companyName: query, pageNum: 1, pageSize: 10 }).then(response => {
listCustomer({ companyName: query, pageNum: 1, pageSize: this.pager ? 10 : 10000 }).then(response => {
this.customerList = response.rows;
}).finally(() => {
this.customerLoading = false;

View File

@@ -2,11 +2,11 @@
<el-select
v-model="innerValue"
filterable
remote
:remote="pager"
:remote-method="pager ? remoteMethod : undefined"
reserve-keyword
placeholder="输入订单号搜索"
:remote-method="remoteMethod"
:loading="loading"
v-loading="loading"
>
<el-option
v-for="item in options"
@@ -25,6 +25,10 @@ export default {
value: {
type: String,
default: ''
},
pager: {
type: Boolean,
default: true
}
},
data() {
@@ -55,13 +59,31 @@ export default {
// this.$emit('input', newVal)
// }
// },
mounted() {
if (!this.pager) {
this.loading = true
listPurchaseOrder({
pageNum: 1,
pageSize: 10000
}).then(res => {
this.options = res.rows.map(item => ({
value: item.orderId,
label: item.orderCode
}))
}).catch(error => {
console.error('订单加载失败:', error)
}).finally(() => {
this.loading = false
})
}
},
methods: {
remoteMethod(query) {
if (query !== '') {
this.loading = true
listPurchaseOrder({
pageNum: 1,
pageSize: 10,
pageSize: this.pager ? 10 : 10000,
orderCode: query
}).then(res => {
this.loading = false