Files
GEAR-OA/gear-ui3/src/components/CustomerSelect/index.vue

48 lines
1.1 KiB
Vue
Raw Normal View History

2025-09-02 15:03:34 +08:00
<template>
<el-select filterable v-model="_customerId" remote :remote-method="remoteSearchCustomer" :loading="customerLoading" placeholder="请选择客户">
2025-09-03 11:55:00 +08:00
<el-option v-for="item in customerList" :key="item.customerId" :label="item.name" :value="item.customerId" />
2025-09-02 15:03:34 +08:00
</el-select>
</template>
<script>
2025-09-17 15:59:03 +08:00
import { listCustomer } from '@/api/oms/customer';
2025-09-02 15:03:34 +08:00
export default {
name: 'CustomerSelect',
props: {
value: {
type: String,
default: ''
}
},
computed: {
_customerId: {
get() {
return this.value;
},
set(value) {
this.$emit('input', value);
}
}
},
data() {
return {
customerList: [],
customerLoading: false
}
},
mounted() {
this.remoteSearchCustomer('');
},
methods: {
remoteSearchCustomer(query) {
this.customerLoading = true;
2025-09-03 11:55:00 +08:00
listCustomer({ name: query, pageNum: 1, pageSize: 10 }).then(response => {
2025-09-02 15:03:34 +08:00
this.customerList = response.rows;
}).finally(() => {
this.customerLoading = false;
});
}
}
}
</script>