lanan-system-vue/src/views/repair/Components/UserChoose.vue

40 lines
741 B
Vue
Raw Normal View History

2024-09-12 18:29:04 +08:00
<template>
2024-09-13 18:31:13 +08:00
<el-select v-model="userSelected" clearable filterable >
<el-option v-for="user in userList" :key="user.id" :label="user.cusName" :value="user.id" />
2024-09-12 18:29:04 +08:00
</el-select>
</template>
<script>
2024-09-13 18:31:13 +08:00
import {getCustomerList} from "@/api/base/customer";
2024-09-12 18:29:04 +08:00
export default {
name: "UserChoose",
data() {
return {
userList: [],
2024-09-13 18:31:13 +08:00
userSelected: undefined,
}
},
watch:{
userSelected(val){
const user = this.userList.find(item => item.id === val)
this.$emit("selected", user)
2024-09-12 18:29:04 +08:00
}
},
2024-09-13 18:31:13 +08:00
mounted() {
this.listCustomer()
},
methods: {
async listCustomer(){
const res = await getCustomerList()
this.userList = res.data
}
}
2024-09-12 18:29:04 +08:00
}
</script>
<style scoped lang="scss">
</style>