emis-frontend/src/views/emis/EmisBaseTools/CustomerPicker.vue
2024-05-07 12:53:25 +08:00

81 lines
1.6 KiB
Vue

<template>
<section class="p-10">
<el-select
filterable
clearable
v-model="svalue"
sPlaceholder="选择"
@change="onChange">
<el-option v-for="item in optionItems" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</section>
</template>
<script>
import { listEmisCustomerUser } from "@/api/emis/emisCustomerUser";
export default {
name: "CustomerPicker",
props: {
value: {
type: [String, Number],
required: false
},
countryCode: {
type: String,
required: false
},
},
data() {
return {
optionItems: [],
svalue: this.value,
sCountry:null,
};
},
watch: {
value(newVal) {
this.svalue = newVal;
},
svalue(newVal, oldVal) {
if (newVal !== oldVal) {
this.$emit("input", this.svalue);
}
},
countryCode(newVal) {
this.sCountry = newVal;
this.queryData();
}
},
created() {
this.queryData();
},
methods: {
onChange() {
this.$emit("onChange");
},
queryData() {
// if(this.sCountry==null){
// return;
// }
let queryParams = {
pageNum: 1,
pageSize: 10
};
listEmisCustomerUser(queryParams).then(response => {
this.optionItems = this.handleOptions(response.rows,"customerCode", "customerFullName",false);
this.svalue=this.optionItems[0].value;
// if(this.svalue==null){
// }
});
},
}
};
</script>