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

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

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

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

@ -12,7 +12,7 @@
:loading="Loading" :loading="Loading"
@change="onSelectChange" @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> </el-select>
</template> </template>
@ -21,6 +21,9 @@ import { ref, onMounted, toRefs } from 'vue'
import * as SupplierApi from '@/api/heli/supplier' import * as SupplierApi from '@/api/heli/supplier'
const valueName: any = ref() // const valueName: any = ref() //
const valueNameObject: any = ref() //
const emit = defineEmits(['update:newValue'])
const supplierList = ref<SupplierApi.SupplierVO[]>([]) // const supplierList = ref<SupplierApi.SupplierVO[]>([]) //
const supplierSelectList = ref<SupplierApi.SupplierVO[]>([]) const supplierSelectList = ref<SupplierApi.SupplierVO[]>([])
const Loading = ref(false) const Loading = ref(false)
@ -36,7 +39,6 @@ onMounted(async () => {
} }
try { try {
const data = await SupplierApi.getSupplierPage(queryParams) const data = await SupplierApi.getSupplierPage(queryParams)
console.log(data.list)
supplierList.value = data.list supplierList.value = data.list
// //
remoteMethod('') remoteMethod('')
@ -51,7 +53,11 @@ const remoteMethod = (query: any) => {
setTimeout(() => { setTimeout(() => {
Loading.value = false Loading.value = false
supplierSelectList.value = supplierList.value 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 .slice(0, 10) //10
}, 200) }, 200)
} else { } else {
@ -59,9 +65,8 @@ const remoteMethod = (query: any) => {
} }
} }
// const onSelectChange = (newValue: number | null) => { const onSelectChange = (newValue: any) => {
// // console.log(newValue) valueNameObject.value = supplierList.value.find(supplier => supplier.id === newValue); //
// emit('update:valueName', newValue) emit('update:newValue', valueNameObject.value)
// valueName.value = newValue }
// }
</script> </script>

Loading…
Cancel
Save