修改附件
This commit is contained in:
@ -90,77 +90,6 @@ const SupplierRegister: React.FC = () => {
|
|||||||
values.coscoSupplierBase = values.coscoSupplierBase || {};
|
values.coscoSupplierBase = values.coscoSupplierBase || {};
|
||||||
values.coscoSupplierBase.supplierType = supplierType;
|
values.coscoSupplierBase.supplierType = supplierType;
|
||||||
|
|
||||||
// 记录详细的表单数据,便于调试
|
|
||||||
console.log('表单原始数据:', JSON.parse(JSON.stringify(values)));
|
|
||||||
console.log('供应商基本信息:', values.coscoSupplierBase);
|
|
||||||
console.log('开票信息:', values.coscoSupplierInvoice);
|
|
||||||
console.log('银行账户信息:', values.coscoSupplierBank);
|
|
||||||
console.log('资质信息:', values.coscoSupplierQualifications);
|
|
||||||
console.log('调查问卷信息:', values.coscoSupplierSurvey);
|
|
||||||
console.log('调查问卷回复:', values.coscoSupplierSurveyQuestionReply);
|
|
||||||
console.log('调查问卷附件:', values.coscoSupplierSurveyAttachments);
|
|
||||||
|
|
||||||
// 处理文件上传组件返回的文件列表值
|
|
||||||
// 处理营业执照附件
|
|
||||||
if (
|
|
||||||
values.coscoSupplierBase.licenceAccessory &&
|
|
||||||
Array.isArray(values.coscoSupplierBase.licenceAccessory)
|
|
||||||
) {
|
|
||||||
const licenceFile = values.coscoSupplierBase.licenceAccessory[0];
|
|
||||||
values.coscoSupplierBase.licenceAccessory =
|
|
||||||
licenceFile?.response?.url || licenceFile?.response?.filePath || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理纳税人资格证明
|
|
||||||
if (
|
|
||||||
values.coscoSupplierInvoice?.qualificationCertificate &&
|
|
||||||
Array.isArray(values.coscoSupplierInvoice.qualificationCertificate)
|
|
||||||
) {
|
|
||||||
const taxFile = values.coscoSupplierInvoice.qualificationCertificate[0];
|
|
||||||
values.coscoSupplierInvoice.qualificationCertificate =
|
|
||||||
taxFile?.response?.url || taxFile?.response?.filePath || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理资质证书附件
|
|
||||||
if (values.coscoSupplierQualifications) {
|
|
||||||
values.coscoSupplierQualifications = values.coscoSupplierQualifications.map((qual: any) => {
|
|
||||||
if (qual.accessory && Array.isArray(qual.accessory)) {
|
|
||||||
const accessoryFile = qual.accessory[0];
|
|
||||||
qual.accessory =
|
|
||||||
accessoryFile?.response?.url || accessoryFile?.response?.filePath || '';
|
|
||||||
}
|
|
||||||
return qual;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理调查问卷附件
|
|
||||||
if (values.coscoSupplierSurveyAttachments) {
|
|
||||||
values.coscoSupplierSurveyAttachments = values.coscoSupplierSurveyAttachments.map(
|
|
||||||
(item: any) => {
|
|
||||||
if (item.fileUrl && Array.isArray(item.fileUrl)) {
|
|
||||||
const file = item.fileUrl[0];
|
|
||||||
item.fileUrl = file?.response?.url || file?.response?.filePath || '';
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理调查问卷回复
|
|
||||||
if (values.coscoSupplierSurveyQuestionReply) {
|
|
||||||
// 过滤出有效的问卷回复并确保数据格式正确
|
|
||||||
values.coscoSupplierSurveyQuestionReply = values.coscoSupplierSurveyQuestionReply
|
|
||||||
.filter((item: any) => item && item.surveyQuestionId && item.replyValue)
|
|
||||||
.map((item: any) => ({
|
|
||||||
surveyQuestionId: item.surveyQuestionId,
|
|
||||||
replyValue: item.replyValue,
|
|
||||||
}));
|
|
||||||
|
|
||||||
console.log('处理后的问卷回复:', values.coscoSupplierSurveyQuestionReply);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('最终提交的表单数据:', JSON.parse(JSON.stringify(values)));
|
|
||||||
|
|
||||||
// 直接调用API
|
// 直接调用API
|
||||||
const response = await coscoSupplierBaseAdd(values);
|
const response = await coscoSupplierBaseAdd(values);
|
||||||
|
|
||||||
|
@ -119,7 +119,14 @@ const DomesticForm: React.FC<DomesticFormProps> = ({
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
valuePropName="value"
|
getValueProps={(value) => {
|
||||||
|
return {
|
||||||
|
value: value?.length > 0 ? value[0]?.url : undefined,
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
getValueFromEvent={(value) => {
|
||||||
|
return value?.length > 0 ? value[0]?.url : undefined;
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<FileUpload
|
<FileUpload
|
||||||
maxSize={10}
|
maxSize={10}
|
||||||
|
Reference in New Issue
Block a user