企业类型 字典回显

This commit is contained in:
孙景学
2025-07-24 11:56:57 +08:00
parent 823da974f9
commit b2109fdd90
9 changed files with 131 additions and 28 deletions

View File

@ -80,13 +80,14 @@ const supplierNews: React.FC = () => {
dataIndex: 'content',
key: 'content',
ellipsis: true,
},
{
title: '业务类型',
dataIndex: 'typeCn',
key: 'typeCn',
dataIndex: 'type',
key: 'type',
width: 160,
render: (code: string) => typeMap[code] || code
},
{
title: '发送时间',
@ -95,11 +96,17 @@ const supplierNews: React.FC = () => {
width: 200,
},
];
const [typeMap, setTypeMap] = useState<{ [code: string]: string }>({});
//初始化
useEffect(() => {
getDictList('message_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setTypeMap(map);
setCategoryOptions(data)
}
})
@ -167,7 +174,7 @@ const supplierNews: React.FC = () => {
className="custom-table"
columns={columns}
dataSource={data}
pagination={{...tableProps.pagination, total: pagination.total }}
pagination={{ ...tableProps.pagination, total: pagination.total }}
loading={loading}
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, content: '', type: '' })}
style={{ flex: 1, minHeight: 0 }}

View File

@ -4,6 +4,7 @@ import type { ColumnsType } from 'antd/es/table';
import type { UploadFile } from 'antd/es/upload/interface';
import { UploadOutlined } from '@ant-design/icons';
//接口
import { getDictList } from '@/servers/api/dicts'
import { getSupplierPage, detail, apply, uploadFile } from "../services";
//统一列表分页
import tableProps from '@/utils/tableProps'
@ -92,9 +93,20 @@ const SupplierAddModal: React.FC<{
if (res.code === 200 && res.data) setCategoryInfo(res.data);
fetchSuppliers(pagination.current, pagination.pageSize, res.data.suppliers || []);
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
useEffect(() => {
if (visible) {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
fetchCategoryInfo();
}
// eslint-disable-next-line
@ -129,17 +141,17 @@ const SupplierAddModal: React.FC<{
return
}
const values = await form.validateFields();
if(values.approveType === 'offline') {
if (values.approveType === 'offline') {
if (values.attachments.length === 0) {
message.warning('请上传附件');
return
}
} else if(!values.approveType) {
} else if (!values.approveType) {
message.warning('请选择签报');
return
}
//
if(values.attachments && values.attachments.length > 0) {
if (values.attachments && values.attachments.length > 0) {
values.coscoCategoryLibrarAttachments = {
...values.attachments[0].response,
fileUrl: values.attachments[0].response.url,
@ -150,7 +162,7 @@ const SupplierAddModal: React.FC<{
setSubmitting(true);
try {
apply({ categoryLibraryId: storeId, supplierIds: selectedIds, ...values }).then((res) => {
if(res.code == 200) {
if (res.code == 200) {
message.success('操作成功');
setSelectedIds([]);
onSuccess && onSuccess();
@ -207,7 +219,7 @@ const SupplierAddModal: React.FC<{
render: (ext: any, record: any) => (<span>{`${record.supplierCategory === 'dvs' ? '境内企业' : '境外企业'}`}</span>)
},
{ title: '统一社会信用代码', dataIndex: 'unifiedCode', align: 'center', ellipsis: true },
{ title: '企业类型', dataIndex: 'categoryName', align: 'center', ellipsis: true },
{ title: '企业类型', dataIndex: 'enterpriseType', align: 'center', ellipsis: true, render: (code: string) => enterpriseTypeMap[code] || code },
{
title: '操作',
@ -238,7 +250,7 @@ const SupplierAddModal: React.FC<{
visible={visible}
onCancel={onCancel}
footer={[
<Button key="ok" type="primary" onClick={handleOk} disabled={submitting}></Button>,
<Button key="ok" type="primary" onClick={handleOk} disabled={submitting}></Button>,
<Button key="cancel" onClick={onCancel}></Button>,
]}
width={820}

View File

@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Modal, Table, Button, Descriptions, Spin } from 'antd';
import { Modal, Table, Button, Descriptions, Spin } from 'antd';
import { getDictList } from '@/servers/api/dicts'
import { getSupplierPage, detail } from "../services";
import type { ColumnsType } from 'antd/es/table';
// 供应商类型
@ -63,9 +64,20 @@ const SupplierListModal: React.FC<{
const res = await detail({ id: storeId });
if (res.code === 200 && res.data) setCategoryInfo(res.data);
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
useEffect(() => {
if (visible) {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
fetchSuppliers(pagination.current, pagination.pageSize);
fetchCategoryInfo();
}
@ -83,7 +95,7 @@ const SupplierListModal: React.FC<{
{ title: '供应商名称', dataIndex: 'name', align: 'center' },
{ title: '境内/境外', dataIndex: 'region', align: 'center' },
{ title: '统一社会信用代码', dataIndex: 'creditCode', align: 'center' },
{ title: '企业类型', dataIndex: 'enterpriseTypeCn', align: 'center' },
{ title: '企业类型', dataIndex: 'enterpriseType', align: 'center', render: (code: string) => enterpriseTypeMap[code] || code },
];
return (

View File

@ -77,8 +77,19 @@ const SupplierChangeReviewManage: React.FC<Props> = ({ dispatch }) => {
setLoading(false);
}
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
// 初始化
useEffect(() => {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
getDictList('approve_type').then((res) => {
if (res.code == 200) {
setEnterpriseType(res.data)
@ -146,9 +157,10 @@ const SupplierChangeReviewManage: React.FC<Props> = ({ dispatch }) => {
},
{
title: '企业类型',
dataIndex: 'enterpriseTypeCn',
dataIndex: 'enterpriseType',
align: 'center',
width: 160,
render: (code: string) => enterpriseTypeMap[code] || code
},
{
title: '准入时间',

View File

@ -6,6 +6,7 @@ import type { ColumnsType } from 'antd/es/table';
import SupplierViewModal from './components/SupplierViewModal';
import SupplierExitModal from './components/SupplierExitModal';
//接口
import { getDictList } from '@/servers/api/dicts'
import { getPageAgent } from './services';
//统一列表分页
import tableProps from '@/utils/tableProps'
@ -68,9 +69,20 @@ const SupplierRegisterAgent: React.FC = () => {
setLoading(false);
}
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
// 首次&依赖刷新
useEffect(() => {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
fetchData(1, pagination.pageSize);
}, [tabKey]);
@ -119,10 +131,11 @@ const SupplierRegisterAgent: React.FC = () => {
},
{
title: '企业类型',
dataIndex: 'enterpriseTypeCn',
dataIndex: 'enterpriseType',
align: 'center',
width: 140,
ellipsis: true,
render: (code: string) => enterpriseTypeMap[code] || code
},
{
title: '创建单位',

View File

@ -5,6 +5,7 @@ import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import { connect } from 'umi';
//接口
import { treeData, getPageQualified } from './services';
import { getDictList } from '@/servers/api/dicts'
//组件
import tableProps from '@/utils/tableProps';
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
@ -127,9 +128,19 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
setLoading(false);
}
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
// 初始化
useEffect(() => {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
setTreeLoading(true);
treeData({}).then((res) => {
const { code, data } = res;
@ -195,10 +206,12 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
},
{
title: '企业类型',
dataIndex: 'enterpriseTypeCn',
key: 'enterpriseTypeCn',
dataIndex: 'enterpriseType',
key: 'enterpriseType',
align: 'center',
width: 160,
ellipsis: true,
render: (code: string) => enterpriseTypeMap[code] || code
},
{
title: '注册时间',

View File

@ -15,6 +15,7 @@ import AccessStatusSelect from '@/components/CommonSelect/AccessStatusSelect'
//本地服务/接口
import { getPageMy } from './services';
import { downloadFile } from '@/utils/download';
import { getDictList } from '@/servers/api/dicts'
//统一列表分页
import tableProps from '@/utils/tableProps'
@ -77,8 +78,20 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
setLoading(false);
}
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
// 初始化
useEffect(() => {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
getList();
}, []);
@ -123,10 +136,11 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
},
{
title: '企业类型',
dataIndex: 'enterpriseTypeCn',
key: 'enterpriseTypeCn',
dataIndex: 'enterpriseType',
key: 'enterpriseType',
align: 'center',
width: 120,
render: (code: string) => enterpriseTypeMap[code] || code
},
{
title: '准入品类',

View File

@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
//第三方UI库/组件
import { Form, Button, Table, Select, Input, Space, Tooltip, message } from 'antd';
import { Form, Button, Table, Input, Space, Tooltip } from 'antd';
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
//类型定义
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
@ -13,6 +13,7 @@ import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
import AccessStatusSelect from '@/components/CommonSelect/AccessStatusSelect'
//本地服务/接口
import { getRegisterPage } from './services';
import { getDictList } from '@/servers/api/dicts'
//统一列表分页
import tableProps from '@/utils/tableProps'
@ -80,8 +81,20 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
setLoading(false);
}
};
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
//初始化
useEffect(() => {
getDictList('enterprise_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setEnterpriseTypeMap(map);
}
})
//列表
getList();
}, [])
@ -127,11 +140,11 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
},
{
title: '企业类型',
dataIndex: 'enterpriseTypeCn',
key: 'enterpriseTypeCn',
dataIndex: 'enterpriseType',
key: 'enterpriseType',
align: 'center',
width: 160,
render: (code: string) => enterpriseTypeMap[code] || code
},
{
title: '注册时间',
@ -160,14 +173,14 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
render: (record) => (
<Space>
<a
onClick={() => {
onClick={() => {
dispatch({
type: 'globalModal/show',
payload: {
id: record.id,
},
});
}}
}}
></a>
{/* <a
onClick={() => { setCurrentRecord(record.id); setDetailVisible(true); }}
@ -208,7 +221,7 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
columns={columns}
dataSource={data}
loading={loading}
pagination={{...tableProps.pagination, total: pagination.total }}
pagination={{ ...tableProps.pagination, total: pagination.total }}
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 350px)' }}

View File

@ -27,6 +27,7 @@ const SupplierMessage: React.FC = () => {
const [viewVisible, setViewVisible] = useState(false); // 弹窗显隐
//下拉数据
const [categoryOptions, setCategoryOptions] = useState<CategoryOption[]>([]);
const [typeMap, setTypeMap] = useState<{ [code: string]: string }>({});
// 获取数据
const getList = async (pageNo = 1, pageSize = 10) => {
@ -62,6 +63,11 @@ const SupplierMessage: React.FC = () => {
getDictList('message_type').then((res: any) => {
const { code, data } = res;
if (code == 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setTypeMap(map);
setCategoryOptions(data)
}
})
@ -87,9 +93,10 @@ const SupplierMessage: React.FC = () => {
},
{
title: '业务类型',
dataIndex: 'typeCn',
key: 'typeCn',
dataIndex: 'type',
key: 'type',
align: 'center',
render: (code: string) => typeMap[code] || code
},
{
title: '接收时间',