对接注册

This commit is contained in:
linxd
2025-07-16 10:51:30 +08:00
parent 27d6d10d27
commit 1f3a4909f7
8 changed files with 83 additions and 90 deletions

View File

@ -138,7 +138,7 @@ export const QualificationSection: React.FC<CommonFormSectionsProps> = ({ form }
<Form.Item
name={[record.name, 'certType']}
rules={[createConditionalRule('certType', '请输入资质证书类型')]}
style={{ margin: 0}}
style={{ margin: 0 }}
wrapperCol={{ span: 24 }}
>
<Input placeholder="请输入资质证书类型" />
@ -177,7 +177,11 @@ export const QualificationSection: React.FC<CommonFormSectionsProps> = ({ form }
title: createRequiredTitle('资质类别和等级'),
dataIndex: 'certLevel',
render: (_, record) => (
<Form.Item name={[record.name, 'certLevel']} style={{ margin: 0 }} wrapperCol={{ span: 24 }}>
<Form.Item
name={[record.name, 'certLevel']}
style={{ margin: 0 }}
wrapperCol={{ span: 24 }}
>
<Input placeholder="请输入资质类别和等级" />
</Form.Item>
),
@ -241,11 +245,21 @@ export const QualificationSection: React.FC<CommonFormSectionsProps> = ({ form }
rules={[createConditionalRule('certFile', '请上传资质证书附件')]}
style={{ margin: 0 }}
wrapperCol={{ span: 24 }}
getValueProps={(value) => {
return {
value: value?.length > 0 ? value[0]?.url : undefined,
};
}}
getValueFromEvent={(value) => {
return value.length > 0 && value[0].url;
}}
>
<FileUpload
listType="text"
maxCount={1}
allowedTypes={['pdf', 'jpg', 'jpeg', 'png']}
maxSize={10}
tip="pdf,jpg,jpeg,png类型的文件,大小不超过10MB"
/>
</Form.Item>
),
@ -350,16 +364,25 @@ export const InvoiceSection: React.FC<CommonFormSectionsProps> = ({ form }) => {
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="generalTaxpayerCert" label="一般纳税人资格证明">
<Upload
name="generalTaxpayerCert"
action="/api/upload"
<Form.Item
name="generalTaxpayerCert"
label="一般纳税人资格证明"
getValueProps={(value) => {
return {
value: value?.length > 0 ? value[0]?.url : undefined,
};
}}
getValueFromEvent={(value) => {
return value.length > 0 && value[0].url;
}}
>
<FileUpload
listType="text"
maxCount={1}
beforeUpload={(file) => validateFileSize(file, 10, ['pdf', 'jpg', 'jpeg', 'png'])}
>
<Button icon={<UploadOutlined />}></Button>
</Upload>
allowedTypes={['pdf', 'jpg', 'jpeg', 'png']}
maxSize={10}
tip="pdf,jpg,jpeg,png类型的文件,大小不超过10MB"
/>
</Form.Item>
</Col>
</Row>
@ -796,43 +819,22 @@ export const AttachmentSection: React.FC<CommonFormSectionsProps> = ({ form }) =
<Form.Item
name={[field.name, 'fileUrl']}
rules={[{ required: true, message: '请上传已盖章的反商业贿赂承诺书' }]}
getValueFromEvent={(value) => {
return value.length > 0 && value[0].url;
}}
getValueProps={(value) => {
return {
value: value?.length > 0 ? value[0]?.url : undefined,
};
}}
>
<Upload
name="file"
action="/api/upload"
<FileUpload
listType="text"
maxCount={1}
beforeUpload={(file) =>
validateFileSize(file, 10, ['pdf', 'doc', 'docx'])
}
onChange={(info) => {
if (info.file.status === 'done') {
const response = info.file.response;
if (response && response.success) {
// 填充文件信息
form.setFieldsValue({
coscoSupplierSurveyAttachments: [
{
...form.getFieldValue([
'coscoSupplierSurveyAttachments',
field.name,
]),
fileName: info.file.name,
fileType: info.file.type,
fileSize: info.file.size?.toString() || '0',
filePath: response.filePath || response.url,
},
],
});
message.success(`${info.file.name} 上传成功`);
} else {
message.error(`${info.file.name} 上传失败`);
}
}
}}
>
<Button icon={<UploadOutlined />}></Button>
</Upload>
allowedTypes={['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png']}
maxSize={10}
tip="pdf,doc,docx,jpg,jpeg,png类型的文件,大小不超过10MB"
/>
</Form.Item>
</div>
))}
@ -869,42 +871,23 @@ export const AttachmentSection: React.FC<CommonFormSectionsProps> = ({ form }) =
)}
{index > 0 && (
<Form.Item name={[field.name, 'fileUrl']}>
<Upload
name="file"
action="/api/upload"
<Form.Item
name={[field.name, 'fileUrl']}
getValueFromEvent={(value) => {
return value.length > 0 && value[0].url;
}}
getValueProps={(value) => {
return {
value: value?.length > 0 ? value[0]?.url : undefined,
};
}}
>
<FileUpload
listType="text"
maxCount={1}
beforeUpload={(file) => validateFileSize(file, 20, ['*'])}
onChange={(info) => {
if (info.file.status === 'done') {
const response = info.file.response;
if (response && response.success) {
// 填充文件信息
const fieldValue = form.getFieldValue([
'coscoSupplierSurveyAttachments',
field.name,
]);
form.setFieldsValue({
coscoSupplierSurveyAttachments: [
{
...fieldValue,
fileName: info.file.name,
fileType: info.file.type,
fileSize: info.file.size?.toString() || '0',
filePath: response.filePath || response.url,
},
],
});
message.success(`${info.file.name} 上传成功`);
} else {
message.error(`${info.file.name} 上传失败`);
}
}
}}
>
<Button icon={<UploadOutlined />}></Button>
</Upload>
maxSize={10}
tip="大小不超过10MB"
/>
</Form.Item>
)}
</div>

View File

@ -72,13 +72,12 @@ const DomesticForm: React.FC<DomesticFormProps> = ({
<Form.Item
name={['coscoSupplierBase', 'licenceAccessory']}
label="营业执照附件"
extra="pdf,jpg,jpeg,png类型的文件,大小不超过10MB"
rules={[{ required: true, message: '请上传营业执照附件' }]}
// getValueProps={(value) => {
// return {
// value: value?.length > 0 ? value[0]?.url : undefined,
// };
// }}
getValueProps={(value) => {
return {
value: value?.length > 0 ? value[0]?.url : undefined,
};
}}
getValueFromEvent={(value) => {
return value?.length > 0 ? value[0]?.url : undefined;
}}
@ -88,6 +87,7 @@ const DomesticForm: React.FC<DomesticFormProps> = ({
maxCount={1}
maxSize={10}
allowedTypes={['pdf', 'jpg', 'jpeg', 'png']}
tip="pdf,jpg,jpeg,png类型的文件,大小不超过10MB"
>
<Button icon={<UploadOutlined />}></Button>
</FileUpload>
@ -220,7 +220,11 @@ const DomesticForm: React.FC<DomesticFormProps> = ({
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="officeAddress" label="办公地址" rules={[{ required: true, message: '请输入办公地址' }]}>
<Form.Item
name="officeAddress"
label="办公地址"
rules={[{ required: true, message: '请输入办公地址' }]}
>
<Input
prefix={<EnvironmentOutlined />}
placeholder="请具体注明省、市、区、路、门牌号"