diff --git a/src/pages/dataStatistics/supplierAnnualStatistics/supplierAnnualStatistics.tsx b/src/pages/dataStatistics/supplierAnnualStatistics/supplierAnnualStatistics.tsx index 1f30cb7..53a4b42 100644 --- a/src/pages/dataStatistics/supplierAnnualStatistics/supplierAnnualStatistics.tsx +++ b/src/pages/dataStatistics/supplierAnnualStatistics/supplierAnnualStatistics.tsx @@ -32,7 +32,6 @@ const SupplierAnnualStatistics: React.FC = () => { const [searchParams, setSearchParams] = useState({}); - // 年审结果选项 const annualResultOptions = Object.entries(AnnualReviewResultText).map(([key, value]) => ({ label: value, @@ -140,23 +139,40 @@ const SupplierAnnualStatistics: React.FC = () => { }, { title: intl.formatMessage({ id: 'dataStatistics.common.accessUnit' }), - dataIndex: 'accessUnit', - key: 'accessUnit', + dataIndex: 'orgNameList', + key: 'orgNameList', width: 180, ellipsis: { showTitle: false, }, - render: (text: string) => ( - - {text} - + render: (orgNameList: supplierAnnualTaskManage.SupplierOrgNameList[]) => ( + <> + {orgNameList && orgNameList.length > 0 ? ( + item.orgName).join(',')}> + {orgNameList[0].orgName} + + ) : ( + '-' + )} + ), }, { title: intl.formatMessage({ id: 'dataStatistics.common.accessDept' }), - dataIndex: 'accessDept', - key: 'accessDept', + dataIndex: 'orgNameList', + key: 'orgNameList', width: 120, + render: (orgNameList: supplierAnnualTaskManage.SupplierOrgNameList[]) => ( + <> + {orgNameList && orgNameList.length > 0 ? ( + item.deptName).join(',')}> + {orgNameList[0].deptName} + + ) : ( + '-' + )} + + ), }, { title: intl.formatMessage({ id: 'dataStatistics.common.year' }), @@ -170,7 +186,7 @@ const SupplierAnnualStatistics: React.FC = () => { title: intl.formatMessage({ id: 'dataStatistics.annual.annualStatisticsResult' }), dataIndex: 'annualStatisticsResult', key: 'annualStatisticsResult', - width: 100 + width: 100, }, ]; diff --git a/src/pages/dataStatistics/supplierEvaluateStatistics/supplierEvaluateStatistics.tsx b/src/pages/dataStatistics/supplierEvaluateStatistics/supplierEvaluateStatistics.tsx index d8b8fed..8ea3313 100644 --- a/src/pages/dataStatistics/supplierEvaluateStatistics/supplierEvaluateStatistics.tsx +++ b/src/pages/dataStatistics/supplierEvaluateStatistics/supplierEvaluateStatistics.tsx @@ -158,23 +158,40 @@ const SupplierEvaluateStatistics: React.FC = () => { }, { title: intl.formatMessage({ id: 'dataStatistics.common.accessUnit' }), - dataIndex: 'accessUnit', - key: 'accessUnit', + dataIndex: 'orgNameList', + key: 'orgNameList', width: 180, ellipsis: { showTitle: false, }, - render: (text: string) => ( - - {text} - + render: (orgNameList: SupplierTaskManage.SupplierOrgNameList[]) => ( + <> + {orgNameList && orgNameList.length > 0 ? ( + item.orgName).join(',')}> + {orgNameList[0].orgName} + + ) : ( + '-' + )} + ), }, { title: intl.formatMessage({ id: 'dataStatistics.common.accessDept' }), - dataIndex: 'accessDept', - key: 'accessDept', + dataIndex: 'orgNameList', + key: 'orgNameList', width: 120, + render: (orgNameList: SupplierTaskManage.SupplierOrgNameList[]) => ( + <> + {orgNameList && orgNameList.length > 0 ? ( + item.deptName).join(',')}> + {orgNameList[0].deptName} + + ) : ( + '-' + )} + + ), }, { title: intl.formatMessage({ id: 'dataStatistics.evaluate.evaluateYear' }), diff --git a/src/pages/register/supplier/CommonFormSections copy.tsx b/src/pages/register/supplier/CommonFormSections copy.tsx new file mode 100644 index 0000000..429becd --- /dev/null +++ b/src/pages/register/supplier/CommonFormSections copy.tsx @@ -0,0 +1,1025 @@ +/** + * 供应商注册表单通用部分 + * 封装了国内企业和境外企业注册表单相同的部分 + */ +import React, { useState, useEffect } from 'react'; +import { + Form, + Input, + Button, + Select, + Upload, + DatePicker, + Row, + Col, + Table, + Radio, + Cascader, + Empty, + Descriptions, +} from 'antd'; +import { UploadOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons'; +import { message } from 'antd'; +import { validateFileSize } from '@/utils/utils'; +import { getRegionTree, getregionInternational } from '@/servers/api/register'; +import { getDictList } from '@/servers/api/dicts'; +import type { DictItem } from '@/servers/api/dicts'; +import FileUpload from '@/components/FileUpload/FileUpload'; +import DictRegionSelect from '@/components/CommonSelect/DictRegionSelect'; + +const { Option } = Select; + +interface CommonFormSectionsProps { + form: any; + supplierType?: string; +} + +// 扩展问卷部分的属性接口 +interface SurveySectionProps extends CommonFormSectionsProps { + surveyQuestions?: API.SurveyQuestionResponse; +} +function convertToCascaderOptions(data: any[]): any[] { + return data.map((item) => ({ + label: item.name, + value: item.id, + children: + item.children && item.children.length > 0 + ? convertToCascaderOptions(item.children) + : undefined, + })); +} +/** + * 资质信息表单部分 + * 包含资质证书类型、名称、编号、等级、发证机构、发证日期、有效期等 + */ +export const QualificationSection: React.FC = ({ form }) => { + // 检查行是否有任何字段被填写 + const hasRowValue = (formInstance: any, recordObj: any, currentField: string) => { + const values = formInstance.getFieldsValue(['coscoSupplierQualifications']); + if ( + !values.coscoSupplierQualifications || + !values.coscoSupplierQualifications[recordObj.name] + ) { + return false; + } + + const rowData = values.coscoSupplierQualifications[recordObj.name]; + const fields = [ + 'certificateType', + 'name', + 'code', + 'typeLevel', + 'authority', + 'dateTime', + 'termOfValidity', + 'accessory', + ]; + + // 过滤掉当前正在验证的字段 + return fields + .filter((field) => field !== currentField) + .some((field) => { + const value = rowData[field]; + if (field === 'accessory' && value) { + return value.fileList && value.fileList.length > 0; + } + return value !== undefined && value !== null && value !== ''; + }); + }; + + // 生成条件性验证规则 + const createConditionalRule = (fieldName: string, errorMsg: string) => ({ + validator: (_: any, value: any, callback: any) => { + const record = _.field.split('.')[1]; + + // 如果当前字段有值,或者行中有任何字段有值,则该字段为必填 + if (value || hasRowValue(form, { name: record }, fieldName)) { + if (!value) { + return Promise.reject(new Error(errorMsg)); + } + } + return Promise.resolve(); + }, + }); + + // 创建带必填标识的表头 + const createRequiredTitle = (title: string) => ( + + {title} * + + ); + + return ( + <> +
资质信息
+ + + {(fields, { add, remove }) => ( + <> + ({ + ...field, + key: field.key, + fieldKey: field.name, + }))} + pagination={false} + bordered + size="middle" + rowKey="key" + columns={[ + { + title: '序号', + dataIndex: 'name', + width: 60, + render: (_, __, index) => index + 1, + }, + { + title: createRequiredTitle('资质证书类型'), + dataIndex: 'certificateType', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('资质名称'), + dataIndex: 'name', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('资质证书编号'), + dataIndex: 'code', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('资质类别和等级'), + dataIndex: 'typeLevel', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('发证机构'), + dataIndex: 'authority', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('发证日期'), + dataIndex: 'dateTime', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('资质有效期至'), + dataIndex: 'termOfValidity', + render: (_, record) => ( + + + + ), + }, + { + title: createRequiredTitle('附件'), + dataIndex: 'accessory', + render: (_, record) => ( + { + return { + value: value?.length > 0 ? value[0]?.url : undefined, + }; + }} + getValueFromEvent={(value) => { + return value.length > 0 && value[0].url; + }} + > + + + ), + }, + { + title: '操作', + width: 70, + render: (_, record) => ( + + ), + }, + ]} + /> + + + + + )} + + + ); +}; + +/** + * 开票信息表单部分 + * 包含纳税人类型、开票抬头、纳税人识别号、开票地址等 + */ +export const InvoiceSection: React.FC = ({ form }) => { + const [taxpayerTypeOptions, setTaxpayerTypeOptions] = useState([]); + useEffect(() => { + getDictList('taxpayer_type').then((res) => { + if (res.code === 200) { + setTaxpayerTypeOptions(res.data); + } + }); + }, []); + return ( + <> +
开票信息
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + return { + value: value?.length > 0 ? value[0]?.url : undefined, + }; + }} + getValueFromEvent={(value) => { + return value.length > 0 && value[0].url; + }} + > + + + + + + ); +}; + +/** + * 银行账户表单部分 + * 包含开户银行、账户名称、账号、所在地区等 + * supplierType dvs 境内 ovs 境外 + */ +export const BankAccountSection: React.FC = ({ form, supplierType }) => { + // 地区 + const [addressOptions, setAddressOptions] = useState([]); + const [currencyOptions, setCurrencyOptions] = useState([]); + useEffect(() => { + getDictList('currency').then((res) => { + if (res.code === 200) { + setCurrencyOptions(res.data); + } + }); + }, []); + useEffect(() => { + if (supplierType) { + // const submitInterface = supplierType === 'dvs' ? getRegionTree : getregionInternational; + // submitInterface({ pId: 0 }).then((res) => { + // if (res.code === 200) { + // setAddressOptions(convertToCascaderOptions(res.data)); + // } + // }); + } + }, [supplierType]); + + // 定义表格记录和表格列类型 + interface TableRecord { + name: number; + key: React.Key; + fieldKey: number; + [key: string]: any; + } + + interface ColumnType { + title: string; + dataIndex?: string; + width?: number; + 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 ( + <> +
银行账户
+ + + {(fields, { add, remove }) => { + // 根据供应商类型定义表格列 + const getColumns = () => { + // 基础列定义 + const baseColumns: ColumnType[] = [ + { + title: '序号', + dataIndex: 'name', + width: 60, + render: (text, record, index = 0) => index + 1, + }, + ]; + + // 境内企业特有列 + const domesticColumns: ColumnType[] = + supplierType === 'dvs' + ? [ + { + title: '银联号', + dataIndex: 'interbankNumber', + render: (text, record) => ( + + + + ), + }, + ] + : []; + + // 境外企业特有列 + const foreignColumns: ColumnType[] = + supplierType === 'ovs' + ? [ + { + title: 'SWIFT CODE', + dataIndex: 'swiftCode', + render: (text, record) => ( + + + + ), + }, + ] + : []; + + // 通用列 + const commonColumns: ColumnType[] = [ + { + title: '开户银行', + dataIndex: 'bank', + render: (text, record) => ( + + + + ), + }, + { + title: '账户名称', + dataIndex: 'accountName', + render: (text, record) => ( + + + + ), + }, + { + title: '账号', + dataIndex: 'account', + render: (text, record) => ( + + + + ), + }, + { + title: '币种', + dataIndex: 'currency', + width: 200, + render: (text, record) => ( + + + + + + + {/* 级联选择器用于用户选择 */} + + handleAddressChange(value as string[], record)} + /> + {/* 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; + }); + }, + }} + /> */} + + + ), + }, + { + title: '操作', + width: 70, + render: (text, record) => ( + + ), + }, + ]; + + // 合并所有列 + return [...baseColumns, ...domesticColumns, ...foreignColumns, ...commonColumns]; + }; + + return ( + <> +
({ + ...field, + key: field.key, + fieldKey: field.name, + }))} + pagination={false} + bordered + size="middle" + rowKey="key" + columns={getColumns()} + /> + + + + + ); + }} + + + ); +}; + +/** + * 社会准则符合性自查问卷部分 + * 包含填写人信息和问卷内容 + */ +export const SurveySection: React.FC = ({ form, surveyQuestions }) => { + // 使用API获取的问卷数据,如果没有则显示无数据状态 + const hasQuestions = surveyQuestions && surveyQuestions.length > 0; + + return ( + <> +
社会准则符合性自查问卷
+ +
填写人信息:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 问卷: +
+ + {hasQuestions ? ( + + {(fields, { add, remove }) => { + // 确保有足够的表单项对应每个问题 + if (fields.length < surveyQuestions.length) { + const diff = surveyQuestions.length - fields.length; + for (let i = 0; i < diff; i++) { + add(); + } + } + + return ( +
index + 1, + }, + { + title: '问题', + dataIndex: 'questionName', + render: (text) =>
{text}
, + }, + { + title: '回复', + width: 650, + render: (_, record, index) => ( + <> + + + + {record.coscoSurveyQuestionOptionList?.map((option: any) => ( + + {option.optionName} + + ))} + + + + ), + }, + ]} + /> + ); + }} + + ) : ( +
+ +
+ )} + + ); +}; + +/** + * 供应商反商业贿赂承诺书和其他附件部分 + */ +export const AttachmentSection: React.FC = ({ form }) => { + return ( + <> +
供应商反商业贿赂承诺书
+ + + + + + + {(fields, { add, remove }) => { + // 确保至少有一项用于反商业贿赂承诺书 + if (fields.length === 0) { + add({ attachmentsType: 'commitment' }); + } + + return ( +
+ {fields.map((field, index) => ( +
+ + + + + + + { + 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, + filePath: file.filePath, + }, + }, + }); + return file.url; + } + return undefined; + }} + getValueProps={(value) => { + return { + value: value?.length > 0 ? value[0]?.url : undefined, + }; + }} + > + + +
+ ))} +
+ ); + }} +
+
+
+ +
其他附件
+ + + + {(fields, { add, remove }) => ( + <> + {fields.map((field, index) => ( +
0 || fields.length === 1 ? 'block' : 'none', + marginBottom: 8, + position: 'relative', + borderBottom: index > 0 ? '1px solid #eee' : 'none', + }} + > + {index > 0 && ( + <> + + + + + + )} + + {index > 0 && ( + <> + { + 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, + filePath: file.filePath, + }, + }, + }); + return file.url; + } + return undefined; + }} + getValueProps={(value) => { + return { + value: value?.length > 0 ? value[0]?.url : undefined, + }; + }} + > + + + + + )} +
+ ))} + + + + )} +
+
+
+ + ); +}; diff --git a/src/servers/dao/supplierAnnualManage/supplierAnnualTaskManage.d.ts b/src/servers/dao/supplierAnnualManage/supplierAnnualTaskManage.d.ts index 255117e..de7ee27 100644 --- a/src/servers/dao/supplierAnnualManage/supplierAnnualTaskManage.d.ts +++ b/src/servers/dao/supplierAnnualManage/supplierAnnualTaskManage.d.ts @@ -47,8 +47,12 @@ declare namespace supplierAnnualTaskManage { } // 供应商的组织 interface SupplierOrgNameList { + // 准入部门 deptId: string; deptName: string; + // 准入单位 + orgName: string; + orgId: string; } // 列表响应 interface TaskListResponse { diff --git a/src/servers/dao/supplierEvaluateManage/supplierTaskManage.d.ts b/src/servers/dao/supplierEvaluateManage/supplierTaskManage.d.ts index f451178..65bfe28 100644 --- a/src/servers/dao/supplierEvaluateManage/supplierTaskManage.d.ts +++ b/src/servers/dao/supplierEvaluateManage/supplierTaskManage.d.ts @@ -256,8 +256,12 @@ declare namespace SupplierTaskManage { } // 供应商的组织 interface SupplierOrgNameList { + // 准入部门 deptId: string; deptName: string; + // 准入单位 + orgName: string; + orgId: string; } /** * 品类树响应