字典转换问题修改

This commit is contained in:
孙景学
2025-07-24 16:22:38 +08:00
parent 6c0c837ebe
commit 0ac5c96438
11 changed files with 122 additions and 31 deletions

View File

@ -11,6 +11,7 @@ interface props {
onCancel: () => void;
initialValues?: any;
readOnly?: boolean;
supplierType: string;
}
interface viewDataData {
id?: string | null;
@ -40,6 +41,7 @@ const InvoiceFormModal: React.FC<props> = ({
onCancel,
initialValues,
readOnly = false,
supplierType
}) => {
const userId = sessionStorage.getItem('userId') || '';
// 新增与修改
@ -140,11 +142,11 @@ const InvoiceFormModal: React.FC<props> = ({
}
};
const fetchRegionNames = async (codes: string) => {
console.log(codes,'codes');
const { data } = await dictRegion(codes);
console.log(codes, 'codes');
const { data } = await dictRegion(codes);
console.log(data);
};
return (
<Modal
@ -166,7 +168,12 @@ const InvoiceFormModal: React.FC<props> = ({
<Descriptions.Item label="开户账号">{viewData.account}</Descriptions.Item>
<Descriptions.Item label="账户名称">{viewData.accountName}</Descriptions.Item>
<Descriptions.Item label="开户银行">{viewData.bank}</Descriptions.Item>
<Descriptions.Item label="联行号">{viewData.interbankNumber}</Descriptions.Item>
{supplierType === 'ovs' ? (
<Descriptions.Item label="SWIFT CODE">{viewData.swiftCode}</Descriptions.Item>
) : (
<Descriptions.Item label="联行号">{viewData.interbankNumber}</Descriptions.Item>
)}
<Descriptions.Item label="国家/地区">{nationName || viewData.nation}</Descriptions.Item>
<Descriptions.Item label="省份">{provinceName || viewData.province}</Descriptions.Item>
<Descriptions.Item label="城市">{cityName || viewData.city}</Descriptions.Item>
@ -190,11 +197,20 @@ const InvoiceFormModal: React.FC<props> = ({
<Input placeholder='请输入开户银行' />
</Form.Item>
</Col>
<Col span={24}>
<Form.Item name="interbankNumber" label="联行号" rules={[{ required: true }]}>
<Input placeholder='请输入联行号' />
</Form.Item>
</Col>
{supplierType === 'ovs' ? (
<Col span={24}>
<Form.Item name="swiftCode" label="SWIFT CODE" rules={[{ required: true }]}>
<Input placeholder='请输入SWIFT CODE' />
</Form.Item>
</Col>
) : (
<Col span={24}>
<Form.Item name="interbankNumber" label="联行号" rules={[{ required: true }]}>
<Input placeholder='请输入联行号' />
</Form.Item>
</Col>
)}
<Col span={24}>
<Form.Item name="address" label="地址" rules={[{ required: true }]}>

View File

@ -24,6 +24,7 @@ interface BankInfo {
interface Props {
viewType?: boolean;
record?: string;
supplierType?: string;
}
const codeNameCache = new Map<string, string>();
@ -45,7 +46,7 @@ const fetchRegionNames = async (codes: string[]) => {
const BankInfoTab: React.FC<Props> = (props) => {
const userId = sessionStorage.getItem('userId') || '';
const { viewType = false, record = userId } = props;
const { viewType = false, record = userId, supplierType = 'dvs' } = props;
//双语
const intl = useIntl();
//列表渲染数据
@ -111,6 +112,8 @@ const BankInfoTab: React.FC<Props> = (props) => {
//初始化
useEffect(() => {
if (record) {
console.log(supplierType,'supplierType');
getDictList('currency').then((res) => {
if (res.code === 200) {
const map: { [code: string]: string } = {};
@ -162,11 +165,23 @@ const BankInfoTab: React.FC<Props> = (props) => {
align: 'center',
render: (_: any, __: any, index: number) => index + 1
},
{
title: 'page.workbench.bank.interbankNumber',
dataIndex: 'interbankNumber',
key: 'interbankNumber', ellipsis: true
},
...(supplierType === 'ovs'
? [
{
title: 'SWIFT CODE',
dataIndex: 'swiftCode',
key: 'swiftCode',
ellipsis: true,
}
]
: [
{
title: 'page.workbench.bank.interbankNumber',
dataIndex: 'interbankNumber',
key: 'interbankNumber',
ellipsis: true
}
]),
{
title: 'page.workbench.bank.bank',
dataIndex: 'bank',
@ -265,6 +280,7 @@ const BankInfoTab: React.FC<Props> = (props) => {
/>
<BankFormModal
visible={formVisible}
supplierType={supplierType}
onOk={handleFormSubmit}
onCancel={() => setFormVisible(false)}
initialValues={editingRecord || undefined}

View File

@ -192,9 +192,16 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactEmail' })}>
{registerInfo.coscoSupplierBase.contactsEmail}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactPhone' })}>
{registerInfo.coscoSupplierBase.telephone}
</Descriptions.Item>
{registerInfo.coscoSupplierBase.supplierType === 'dvs' && (
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactPhone' })}>
{registerInfo.coscoSupplierBase.telephone}
</Descriptions.Item>
)}
{registerInfo.coscoSupplierBase.supplierType !== 'dvs' && (
<Descriptions.Item label='联系电话'>
{registerInfo.coscoSupplierBase.contactsPhone}
</Descriptions.Item>
)}
</Descriptions>
<BaseInfoFormModal
visible={formVisible}

View File

@ -26,7 +26,7 @@ const ForeignForm: React.FC<ForeignFormProps> = ({ form, countdown, handleGetCap
// 全球
const [regionOptions, setRegionOptions] = useState<API.RegionOption[]>([]);
useEffect(() => {
getregionInternational().then(res => {
getregionInternational({pId: 0}).then(res => {
if (res.code === 200) {
setRegionOptions(res.data);
}
@ -151,7 +151,7 @@ const ForeignForm: React.FC<ForeignFormProps> = ({ form, countdown, handleGetCap
</Col>
<Col span={12}>
<Form.Item name={['coscoSupplierBase', 'telephone']} label="联系电话">
<Form.Item name={['coscoSupplierBase', 'contactsPhone']} label="联系电话">
<Input placeholder="请输入企业联系电话" />
</Form.Item>
</Col>

View File

@ -24,11 +24,13 @@ const CompanyInfo: React.FC<CompanyInfoProps> = (props) => {
const intl = useIntl();
// 切换tab
const [subTab, setSubTab] = useState<string>('');
const [supplierType, setSupplierType] = useState<string>('');
useEffect(() => {
if(record) {
coscoSupplierBase(record).then((res) => {
if (res.code === 200) {
setSupplierType(res.data.coscoSupplierBase.supplierType)
if (res.data.coscoSupplierBase.supplierType === 'pe') {
setSubTab('pe')
} else {
@ -57,7 +59,7 @@ const CompanyInfo: React.FC<CompanyInfoProps> = (props) => {
<InvoiceTab viewType={viewType} record={record} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.bank' })} key="bank">
<BankInfoTab viewType={viewType} record={record} />
<BankInfoTab viewType={viewType} record={record} supplierType={supplierType} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.attachments' })} key="attachments">
<AttachmentsTab viewType={viewType} record={record} />