2024-09-11 18:49:43 +08:00
|
|
|
<template>
|
2024-09-13 18:31:13 +08:00
|
|
|
<el-select v-model="supplierSelected" clearable filterable>
|
2024-09-11 18:49:43 +08:00
|
|
|
<el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name"
|
|
|
|
|
:value="supplier.id"/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-09-13 18:31:13 +08:00
|
|
|
|
|
|
|
|
import {getBaseSupplierList} from "@/api/repair/supplier";
|
|
|
|
|
|
2024-09-11 18:49:43 +08:00
|
|
|
export default {
|
2024-09-13 18:31:13 +08:00
|
|
|
name: "SupplierChoose",
|
2024-09-11 18:49:43 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
supplierSelected: undefined,
|
|
|
|
|
supplierList: null
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-09-13 18:31:13 +08:00
|
|
|
watch:{
|
|
|
|
|
supplierSelected(val) {
|
|
|
|
|
const supplier = this.supplierList.find(item => item.id === val);
|
|
|
|
|
this.$emit("selected", supplier);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.listSupplier()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async listSupplier() {
|
|
|
|
|
const res = await getBaseSupplierList();
|
|
|
|
|
this.supplierList = res.data
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-11 18:49:43 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
|
|
</style>
|