供应商 选中的对应的全部数据

pull/1/head
qiuhongwu 9 months ago
parent a37b927698
commit af11cca079

@ -44,7 +44,6 @@ onMounted(async () => {
}
try {
const data = await CustomerApi.getCustomerPage(clientParams)
console.log(data.list)
clientList.value = data.list
//
remoteMethod('')

@ -23,7 +23,7 @@
<ClientSelect v-model="formData.clientId" @update:newValue="handleSelectedClient" />
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<SupplierSelect v-model="formData.supplierId" />
<SupplierSelect v-model="formData.supplierId" @update:newValue="handleSelectedSupplier" />
</el-form-item>
<el-form-item label="材质" prop="compositionId">
<CompositionSelect v-model="formData.compositionId" />
@ -166,4 +166,9 @@ const handleSelectedClient = (newValue: any) => {
console.log('接收客户对应的数据:', newValue)
formData.value.clientId = newValue.id
}
//
const handleSelectedSupplier = (newValue: any) => {
console.log('接收客户对应的数据:', newValue)
formData.value.supplierId = newValue.id
}
</script>

@ -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>

Loading…
Cancel
Save