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

43 lines
782 B
Vue
Raw Normal View History

2024-09-11 18:49:43 +08:00
<template>
<el-select v-model="staffSelected" clearable filterable>
<el-option v-for="staff in staffList" :key="staff.id" :label="staff.name" :value="staff.id"/>
</el-select>
</template>
<script>
import {getStaffList} from "@/api/company/staff";
export default {
name: "StaffChoose",
data() {
return {
staffList: [],
staffSelected: undefined,
}
},
watch:{
staffSelected(val) {
const staff = this.staffList.find(item => item.id === val);
this.$emit("selected", staff);
}
},
mounted() {
this.listStaff()
},
methods: {
async listStaff() {
try {
const res = await getStaffList()
this.staffList = res.data
} catch {
}
}
}
}
</script>
<style scoped lang="scss">
</style>