字典转换问题修改

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,8 +23,15 @@ const AccessCategoryTable = ({id}:{id:string}) => {
const columns = [ const columns = [
{ {
title: '准入单位', title: '准入单位',
dataIndex: 'orgName',
key: 'orgName',
ellipsis: true
},
{
title: '准入部门',
dataIndex: 'deptName', dataIndex: 'deptName',
key: 'deptName', key: 'deptName',
ellipsis: true
}, },
{ {
title: '准入品类', title: '准入品类',

View File

@ -43,6 +43,10 @@ const fetchRegionNames = async (codes: string[]) => {
const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => { const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => {
//币种 //币种
const [currencyMap, setCurrencyMap] = useState<{ [code: string]: string }>({}); const [currencyMap, setCurrencyMap] = useState<{ [code: string]: string }>({});
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
const [contactsTypeMap, setContactsTypeMap] = useState<{ [code: string]: string }>({});
const [taxpayerTypeMap, setTaxpayerTypeMap] = useState<{ [code: string]: string }>({});
const [regionLoading, setRegionLoading] = useState(false); const [regionLoading, setRegionLoading] = useState(false);
const [, forceUpdate] = useState({}); // 用于触发重新渲染 const [, forceUpdate] = useState({}); // 用于触发重新渲染
@ -56,6 +60,34 @@ const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => {
setCurrencyMap(map); setCurrencyMap(map);
} }
}); });
getDictList('taxpayer_type').then((res) => {
if (res.code == 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setTaxpayerTypeMap(map);
}
})
getDictList('contacts_type').then((res) => {
if (res.code === 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setContactsTypeMap(map);
}
});
getDictList('enterprise_type').then((res) => {
if (res.code === 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
});
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -100,10 +132,10 @@ const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => {
{ title: intl.formatMessage({ id: 'component.globalModal.openingBank' }), dataIndex: 'bank', key: 'bank' }, { title: intl.formatMessage({ id: 'component.globalModal.openingBank' }), dataIndex: 'bank', key: 'bank' },
{ title: intl.formatMessage({ id: 'component.globalModal.accountName' }), dataIndex: 'accountName', key: 'accountName' }, { title: intl.formatMessage({ id: 'component.globalModal.accountName' }), dataIndex: 'accountName', key: 'accountName' },
{ title: intl.formatMessage({ id: 'component.globalModal.accountNumber' }), dataIndex: 'account', key: 'account' }, { title: intl.formatMessage({ id: 'component.globalModal.accountNumber' }), dataIndex: 'account', key: 'account' },
{ title: intl.formatMessage({ id: 'component.globalModal.currency' }), dataIndex: 'currency', key: 'currency', render: (code: string) => currencyMap[code] || code }, { title: intl.formatMessage({ id: 'component.globalModal.currency' }), dataIndex: 'currency', key: 'currency', render: (code: string) => currencyMap[code] || code },
{ title: intl.formatMessage({ id: 'component.globalModal.country' }), dataIndex: 'nation', key: 'nation', render: renderRegionName }, { title: intl.formatMessage({ id: 'component.globalModal.country' }), dataIndex: 'nation', key: 'nation', render: renderRegionName },
{ title: intl.formatMessage({ id: 'component.globalModal.province' }), dataIndex: 'province', key: 'province', render: renderRegionName }, { title: intl.formatMessage({ id: 'component.globalModal.province' }), dataIndex: 'province', key: 'province', render: renderRegionName },
{ title: intl.formatMessage({ id: 'component.globalModal.city' }), dataIndex: 'city', key: 'city', render: renderRegionName}, { title: intl.formatMessage({ id: 'component.globalModal.city' }), dataIndex: 'city', key: 'city', render: renderRegionName },
]; ];
if (!registerInfo) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>; if (!registerInfo) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>;
@ -186,13 +218,13 @@ const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => {
{registerInfo.coscoSupplierBase.regAddress} {registerInfo.coscoSupplierBase.regAddress}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactIdType' })}> <Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactIdType' })}>
{registerInfo.coscoSupplierBase.contactsTypeName} {contactsTypeMap[registerInfo.coscoSupplierBase.contactsType] || registerInfo.coscoSupplierBase.contactsType}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.idCardNumber' })}> <Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.idCardNumber' })}>
{registerInfo.coscoSupplierBase.idCard} {registerInfo.coscoSupplierBase.idCard}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.supplierType' })}> <Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.supplierType' })}>
{registerInfo.coscoSupplierBase.enterpriseTypeCn} {enterpriseTypeMap[registerInfo.coscoSupplierBase.enterpriseType] || registerInfo.coscoSupplierBase.enterpriseType}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactMobile' })}> <Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactMobile' })}>
{registerInfo.coscoSupplierBase.contactsPhone} {registerInfo.coscoSupplierBase.contactsPhone}
@ -226,7 +258,7 @@ const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => {
style={{ background: '#fff', padding: '16px 0 0' }} style={{ background: '#fff', padding: '16px 0 0' }}
> >
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.taxpayerType' })}> <Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.taxpayerType' })}>
{registerInfo.coscoSupplierInvoice.taxpayerTypeCn} { taxpayerTypeMap[registerInfo.coscoSupplierInvoice.taxpayerType] || registerInfo.coscoSupplierInvoice.taxpayerType }
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.invoiceTitle' })}> <Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.invoiceTitle' })}>
{registerInfo.coscoSupplierInvoice.head} {registerInfo.coscoSupplierInvoice.head}

View File

@ -3,6 +3,7 @@ import { Modal, Input, Row, Col, Table, Button, Form, Tooltip } from 'antd';
import { RightOutlined, LeftOutlined } from '@ant-design/icons'; import { RightOutlined, LeftOutlined } from '@ant-design/icons';
import { coscoSupplierBase } from '../services'; import { coscoSupplierBase } from '../services';
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect' import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext';
const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSelect?: (selected: any[]) => void; }> = ({ visible, onCancel, onSelect }) => { const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSelect?: (selected: any[]) => void; }> = ({ visible, onCancel, onSelect }) => {
// 查询 // 查询
@ -26,6 +27,8 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
const newSelected = selected.filter((item:any) => !ids.has(item.id)); const newSelected = selected.filter((item:any) => !ids.has(item.id));
return [...chosenSuppliers, ...newSelected]; return [...chosenSuppliers, ...newSelected];
}; };
const supplierDetailModal = useSupplierDetailModal();
//获取已选供应商 //获取已选供应商
const moveToRight = () => { const moveToRight = () => {
const selected = tableListData.filter((item:any) => leftSelected.includes(item.id)); const selected = tableListData.filter((item:any) => leftSelected.includes(item.id));
@ -65,7 +68,7 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
const name = record.supplierType === "ovs"? record.nameEn : record.name; const name = record.supplierType === "ovs"? record.nameEn : record.name;
return( return(
<Tooltip placement="topLeft" title={name}> <Tooltip placement="topLeft" title={name}>
{name} <a onClick={() => supplierDetailModal?.(record.id)}>{name}</a>
</Tooltip>) </Tooltip>)
} }, } },
{ title: '统一社会信用代码/税号', ellipsis: true, dataIndex: 'unifiedCode' }, { title: '统一社会信用代码/税号', ellipsis: true, dataIndex: 'unifiedCode' },

View File

@ -81,13 +81,21 @@ const CooperateEnterprise: React.FC = () => {
}, },
{ {
title: '准入单位', title: '准入单位',
dataIndex: 'orgName',
key: 'orgName',
ellipsis: true
},
{
title: '准入部门',
dataIndex: 'deptName', dataIndex: 'deptName',
key: 'deptName', key: 'deptName',
ellipsis: true
}, },
{ {
title: '准入品类', title: '准入品类',
dataIndex: 'categoryName', dataIndex: 'categoryName',
key: 'categoryName', key: 'categoryName',
ellipsis: true
}, },
{ {
title: '准入时间', title: '准入时间',

View File

@ -172,12 +172,12 @@ const SupplierSelectModal: React.FC<SupplierSelectModalProps> = ({
bodyStyle={{ padding: 24 }} bodyStyle={{ padding: 24 }}
> >
<Form layout="inline" form={form} style={{ marginBottom: 16 }}> <Form layout="inline" form={form} style={{ marginBottom: 16 }}>
<Form.Item name="name" label="供应商名称"> <Form.Item name="supplierName" label="供应商名称">
<Input style={{ width: 140 }} allowClear maxLength={50} placeholder="请输入供应商名称" /> <Input style={{ width: 140 }} allowClear maxLength={50} placeholder="请输入供应商名称" />
</Form.Item> </Form.Item>
<Form.Item name="categoryId" label="准入品类"> <Form.Item name="categoryId" label="准入品类">
<CategorySelector multiple={false} style={{ width: 140 }} /> <CategorySelector multiple={false} style={{ width: 200 }} />
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Space> <Space>

View File

@ -177,7 +177,7 @@ const SupplierMessage: React.FC = () => {
{viewRecord && ( {viewRecord && (
<Descriptions bordered column={1} size="small"> <Descriptions bordered column={1} size="small">
<Descriptions.Item labelStyle={{ width: '120px' }} label="消息内容">{viewRecord.content}</Descriptions.Item> <Descriptions.Item labelStyle={{ width: '120px' }} label="消息内容">{viewRecord.content}</Descriptions.Item>
<Descriptions.Item label="业务类型">{viewRecord.typeCn}</Descriptions.Item> <Descriptions.Item label="业务类型">{typeMap[viewRecord.type] || viewRecord.type }</Descriptions.Item>
<Descriptions.Item label="接收时间">{viewRecord.createTime}</Descriptions.Item> <Descriptions.Item label="接收时间">{viewRecord.createTime}</Descriptions.Item>
</Descriptions> </Descriptions>
)} )}