|
|
|
@ -12,7 +12,7 @@
|
|
|
|
|
:loading="Loading"
|
|
|
|
|
@change="onSelectChange"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in supplierSelectList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
<el-option v-for="item in supplierSelectList" :key="item.id" :label="item.code + ' ' + item.name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@ -21,6 +21,9 @@ import { ref, onMounted, toRefs } from 'vue'
|
|
|
|
|
import * as SupplierApi from '@/api/heli/supplier'
|
|
|
|
|
|
|
|
|
|
const valueName: any = ref() //选中的值
|
|
|
|
|
const valueNameObject: any = ref() //选中的值
|
|
|
|
|
const emit = defineEmits(['update:newValue'])
|
|
|
|
|
|
|
|
|
|
const supplierList = ref<SupplierApi.SupplierVO[]>([]) // 用户列表
|
|
|
|
|
const supplierSelectList = ref<SupplierApi.SupplierVO[]>([])
|
|
|
|
|
const Loading = ref(false)
|
|
|
|
@ -36,7 +39,6 @@ onMounted(async () => {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const data = await SupplierApi.getSupplierPage(queryParams)
|
|
|
|
|
console.log(data.list)
|
|
|
|
|
supplierList.value = data.list
|
|
|
|
|
// 设置初始值,如果需要的话
|
|
|
|
|
remoteMethod('')
|
|
|
|
@ -51,7 +53,11 @@ const remoteMethod = (query: any) => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
Loading.value = false
|
|
|
|
|
supplierSelectList.value = supplierList.value
|
|
|
|
|
.filter((item) => item.name.toLowerCase().includes(query.toLowerCase()))
|
|
|
|
|
.filter(
|
|
|
|
|
(item) =>
|
|
|
|
|
item.code.toLowerCase().includes(query.toLowerCase()) ||
|
|
|
|
|
item.name.toLowerCase().includes(query.toLowerCase())
|
|
|
|
|
)
|
|
|
|
|
.slice(0, 10) //只显示前10个
|
|
|
|
|
}, 200)
|
|
|
|
|
} else {
|
|
|
|
@ -59,9 +65,8 @@ const remoteMethod = (query: any) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// const onSelectChange = (newValue: number | null) => {
|
|
|
|
|
// // console.log(newValue)
|
|
|
|
|
// emit('update:valueName', newValue)
|
|
|
|
|
// valueName.value = newValue
|
|
|
|
|
// }
|
|
|
|
|
const onSelectChange = (newValue: any) => {
|
|
|
|
|
valueNameObject.value = supplierList.value.find(supplier => supplier.id === newValue); // 更新选中的完整用户对象
|
|
|
|
|
emit('update:newValue', valueNameObject.value)
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|