From 1ff4f4dd655d96fa36c80e8e23c1c7f396fb8fe1 Mon Sep 17 00:00:00 2001 From: linxd <544554903@qq.com> Date: Wed, 16 Jul 2025 14:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=B3=A8=E5=86=8C=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../register/supplier/CommonFormSections.tsx | 207 ++++++++++++------ src/pages/register/supplier/DomesticForm.tsx | 35 ++- src/pages/register/supplier/ForeignForm.tsx | 81 ++++--- 3 files changed, 220 insertions(+), 103 deletions(-) diff --git a/src/pages/register/supplier/CommonFormSections.tsx b/src/pages/register/supplier/CommonFormSections.tsx index 577a3b5..f57ffcf 100644 --- a/src/pages/register/supplier/CommonFormSections.tsx +++ b/src/pages/register/supplier/CommonFormSections.tsx @@ -63,14 +63,14 @@ export const QualificationSection: React.FC = ({ form } const rowData = values.coscoSupplierQualifications[recordObj.name]; const fields = [ - 'certType', - 'certName', - 'certNumber', - 'certLevel', - 'issuingAuthority', + 'certificateType', + 'name', + 'code', + 'typeLevel', + 'authority', 'dateTime', 'termOfValidity', - 'certFile', + 'accessory', ]; // 过滤掉当前正在验证的字段 @@ -78,7 +78,7 @@ export const QualificationSection: React.FC = ({ form } .filter((field) => field !== currentField) .some((field) => { const value = rowData[field]; - if (field === 'certFile' && value) { + if (field === 'accessory' && value) { return value.fileList && value.fileList.length > 0; } return value !== undefined && value !== null && value !== ''; @@ -133,11 +133,11 @@ export const QualificationSection: React.FC = ({ form } }, { title: createRequiredTitle('资质证书类型'), - dataIndex: 'certType', + dataIndex: 'certificateType', render: (_, record) => ( @@ -147,11 +147,11 @@ export const QualificationSection: React.FC = ({ form } }, { title: createRequiredTitle('资质名称'), - dataIndex: 'certName', + dataIndex: 'name', render: (_, record) => ( @@ -161,11 +161,11 @@ export const QualificationSection: React.FC = ({ form } }, { title: createRequiredTitle('资质证书编号'), - dataIndex: 'certNumber', + dataIndex: 'code', render: (_, record) => ( @@ -175,10 +175,10 @@ export const QualificationSection: React.FC = ({ form } }, { title: createRequiredTitle('资质类别和等级'), - dataIndex: 'certLevel', + dataIndex: 'typeLevel', render: (_, record) => ( @@ -188,11 +188,11 @@ export const QualificationSection: React.FC = ({ form } }, { title: createRequiredTitle('发证机构'), - dataIndex: 'issuingAuthority', + dataIndex: 'authority', render: (_, record) => ( @@ -202,7 +202,7 @@ export const QualificationSection: React.FC = ({ form } }, { title: createRequiredTitle('发证日期'), - dataIndex: 'issueDate', + dataIndex: 'dateTime', render: (_, record) => ( = ({ form } }, { title: createRequiredTitle('资质有效期至'), - dataIndex: 'expiryDate', + dataIndex: 'termOfValidity', render: (_, record) => ( = ({ form } }, { title: createRequiredTitle('附件'), - dataIndex: 'certFile', + dataIndex: 'accessory', render: (_, record) => ( { @@ -327,7 +327,7 @@ export const InvoiceSection: React.FC = ({ form }) => { @@ -336,7 +336,7 @@ export const InvoiceSection: React.FC = ({ form }) => { @@ -344,28 +344,28 @@ export const InvoiceSection: React.FC = ({ form }) => { - + - + - + - + { return { @@ -432,6 +432,26 @@ export const BankAccountSection: React.FC = ({ form, su render?: (text: any, record: TableRecord, index?: number) => React.ReactNode; } + // 处理地址选择,将级联值转换为国家、省份、城市 + const handleAddressChange = (value: any, record: TableRecord) => { + if (value && value.length > 0) { + // 根据级联选择器的层级,设置国家、省份、城市 + const formValues = form.getFieldsValue(); + const bankData = formValues.coscoSupplierBank || []; + + if (!bankData[record.name]) { + bankData[record.name] = {}; + } + + // 设置国家、省份、城市字段 + bankData[record.name].nation = value[0]; + bankData[record.name].province = value.length > 1 ? value[1] : undefined; + bankData[record.name].city = value.length > 2 ? value[2] : undefined; + + form.setFieldsValue({ coscoSupplierBank: bankData }); + } + }; + return ( <>
银行账户
@@ -494,10 +514,10 @@ export const BankAccountSection: React.FC = ({ form, su const commonColumns: ColumnType[] = [ { title: '开户银行', - dataIndex: 'bankName', + dataIndex: 'bank', render: (text, record) => ( @@ -520,10 +540,10 @@ export const BankAccountSection: React.FC = ({ form, su }, { title: '账号', - dataIndex: 'accountNumber', + dataIndex: 'account', render: (text, record) => ( @@ -554,30 +574,44 @@ export const BankAccountSection: React.FC = ({ form, su }, { title: '地址', - dataIndex: 'location', + dataIndex: 'address', render: (text, record) => ( - - { - return path.some((option) => { - if (typeof option.label === 'string') { - return ( - option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1 - ); - } - return false; - }); - }, - }} - /> - + <> + {/* 隐藏字段用于存储拆分后的地址值 */} + + + + + {/* 级联选择器用于用户选择 */} + + handleAddressChange(value, record)} + showSearch={{ + filter: (inputValue, path) => { + return path.some((option) => { + if (typeof option.label === 'string') { + return ( + option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1 + ); + } + return false; + }); + }, + }} + /> + + ), }, { @@ -815,12 +849,36 @@ export const AttachmentSection: React.FC = ({ form }) = > + + + + { - return value.length > 0 && value[0].url; + if (value && value.length > 0) { + const file = value[0]; + form.setFieldsValue({ + coscoSupplierSurveyAttachments: { + [field.name]: { + fileName: file.name, + fileType: file.type, + fileSize: file.size.toString(), + fileUrl: file.url, + } + } + }); + return file.url; + } + return undefined; }} getValueProps={(value) => { return { @@ -861,6 +919,7 @@ export const AttachmentSection: React.FC = ({ form }) = }} > {index > 0 && ( + <> = ({ form }) = > + + + + )} {index > 0 && ( { - return value.length > 0 && value[0].url; + if (value && value.length > 0) { + const file = value[0]; + form.setFieldsValue({ + coscoSupplierSurveyAttachments: { + [field.name]: { + fileName: file.name, + fileType: file.type, + fileSize: file.size.toString(), + fileUrl: file.url, + } + } + }); + return file.url; + } + return undefined; }} getValueProps={(value) => { return { diff --git a/src/pages/register/supplier/DomesticForm.tsx b/src/pages/register/supplier/DomesticForm.tsx index 56dfc97..c752d65 100644 --- a/src/pages/register/supplier/DomesticForm.tsx +++ b/src/pages/register/supplier/DomesticForm.tsx @@ -48,7 +48,16 @@ const DomesticForm: React.FC = ({ const [contactsTypeOptions, setContactsTypeOptions] = useState([]); // 企业类别 const [companyTypeOptions, setCompanyTypeOptions] = useState([]); + useEffect(() => { + // 设置供应商类型为境内企业 + form.setFieldsValue({ + coscoSupplierBase: { + ...form.getFieldValue('coscoSupplierBase'), + supplierType: 'dvs' + } + }); + // 从字典中 联系人身份类别contacts_type 获取数据 getDictList('contacts_type').then((res) => { if (res.code === 200) { @@ -62,10 +71,16 @@ const DomesticForm: React.FC = ({ } }); }, []); + return ( <>
基本信息
+ {/* 隐藏字段 - 供应商类型 */} + + {/* 营业执照附件和有效期 */} @@ -169,7 +184,7 @@ const DomesticForm: React.FC = ({ @@ -178,7 +193,7 @@ const DomesticForm: React.FC = ({ @@ -206,13 +221,13 @@ const DomesticForm: React.FC = ({ */} - + @@ -221,7 +236,7 @@ const DomesticForm: React.FC = ({ @@ -233,7 +248,7 @@ const DomesticForm: React.FC = ({ @@ -248,7 +263,7 @@ const DomesticForm: React.FC = ({ @@ -257,7 +272,7 @@ const DomesticForm: React.FC = ({ = ({ @@ -301,7 +316,7 @@ const DomesticForm: React.FC = ({ */} = ({ // 币种 const [currencyOptions, setCurrencyOptions] = useState([]); useEffect(() => { + // 设置供应商类型为境外企业 + form.setFieldsValue({ + coscoSupplierBase: { + ...form.getFieldValue('coscoSupplierBase'), + supplierType: 'ovs' + } + }); + getregionInternational().then((res) => { if (res.code === 200) { setRegionOptions(res.data); @@ -69,10 +77,15 @@ const ForeignForm: React.FC = ({ {/* 境外企业特有的基本信息部分 */}
基本信息
+ {/* 隐藏字段 - 供应商类型 */} + + @@ -81,7 +94,7 @@ const ForeignForm: React.FC = ({ @@ -89,19 +102,24 @@ const ForeignForm: React.FC = ({ - - + + + {/* + + + + */} @@ -141,18 +159,18 @@ const ForeignForm: React.FC = ({ */} - {/* + } placeholder="请具体注明" /> - */} + @@ -161,7 +179,7 @@ const ForeignForm: React.FC = ({ @@ -169,7 +187,7 @@ const ForeignForm: React.FC = ({ - + @@ -178,19 +196,21 @@ const ForeignForm: React.FC = ({ - {/* - ({ + label: item.dicName, + value: item.code, + }))} + /> - */} + {/* = ({ - + } /> + + + + + {/* = ({ */} - - {/* - - - - */} {/* 使用通用表单组件 */}