企业类型 字典回显

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', dataIndex: 'content',
key: 'content', key: 'content',
ellipsis: true, ellipsis: true,
}, },
{ {
title: '业务类型', title: '业务类型',
dataIndex: 'typeCn', dataIndex: 'type',
key: 'typeCn', key: 'type',
width: 160, width: 160,
render: (code: string) => typeMap[code] || code
}, },
{ {
title: '发送时间', title: '发送时间',
@ -95,11 +96,17 @@ const supplierNews: React.FC = () => {
width: 200, width: 200,
}, },
]; ];
const [typeMap, setTypeMap] = useState<{ [code: string]: string }>({});
//初始化 //初始化
useEffect(() => { useEffect(() => {
getDictList('message_type').then((res: any) => { getDictList('message_type').then((res: any) => {
const { code, data } = res; const { code, data } = res;
if (code == 200) { 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) setCategoryOptions(data)
} }
}) })
@ -167,7 +174,7 @@ const supplierNews: React.FC = () => {
className="custom-table" className="custom-table"
columns={columns} columns={columns}
dataSource={data} dataSource={data}
pagination={{...tableProps.pagination, total: pagination.total }} pagination={{ ...tableProps.pagination, total: pagination.total }}
loading={loading} loading={loading}
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, content: '', type: '' })} onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, content: '', type: '' })}
style={{ flex: 1, minHeight: 0 }} 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 type { UploadFile } from 'antd/es/upload/interface';
import { UploadOutlined } from '@ant-design/icons'; import { UploadOutlined } from '@ant-design/icons';
//接口 //接口
import { getDictList } from '@/servers/api/dicts'
import { getSupplierPage, detail, apply, uploadFile } from "../services"; import { getSupplierPage, detail, apply, uploadFile } from "../services";
//统一列表分页 //统一列表分页
import tableProps from '@/utils/tableProps' import tableProps from '@/utils/tableProps'
@ -92,9 +93,20 @@ const SupplierAddModal: React.FC<{
if (res.code === 200 && res.data) setCategoryInfo(res.data); if (res.code === 200 && res.data) setCategoryInfo(res.data);
fetchSuppliers(pagination.current, pagination.pageSize, res.data.suppliers || []); fetchSuppliers(pagination.current, pagination.pageSize, res.data.suppliers || []);
}; };
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
useEffect(() => { useEffect(() => {
if (visible) { 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(); fetchCategoryInfo();
} }
// eslint-disable-next-line // eslint-disable-next-line
@ -129,17 +141,17 @@ const SupplierAddModal: React.FC<{
return return
} }
const values = await form.validateFields(); const values = await form.validateFields();
if(values.approveType === 'offline') { if (values.approveType === 'offline') {
if (values.attachments.length === 0) { if (values.attachments.length === 0) {
message.warning('请上传附件'); message.warning('请上传附件');
return return
} }
} else if(!values.approveType) { } else if (!values.approveType) {
message.warning('请选择签报'); message.warning('请选择签报');
return return
} }
// //
if(values.attachments && values.attachments.length > 0) { if (values.attachments && values.attachments.length > 0) {
values.coscoCategoryLibrarAttachments = { values.coscoCategoryLibrarAttachments = {
...values.attachments[0].response, ...values.attachments[0].response,
fileUrl: values.attachments[0].response.url, fileUrl: values.attachments[0].response.url,
@ -150,7 +162,7 @@ const SupplierAddModal: React.FC<{
setSubmitting(true); setSubmitting(true);
try { try {
apply({ categoryLibraryId: storeId, supplierIds: selectedIds, ...values }).then((res) => { apply({ categoryLibraryId: storeId, supplierIds: selectedIds, ...values }).then((res) => {
if(res.code == 200) { if (res.code == 200) {
message.success('操作成功'); message.success('操作成功');
setSelectedIds([]); setSelectedIds([]);
onSuccess && onSuccess(); onSuccess && onSuccess();
@ -207,7 +219,7 @@ const SupplierAddModal: React.FC<{
render: (ext: any, record: any) => (<span>{`${record.supplierCategory === 'dvs' ? '境内企业' : '境外企业'}`}</span>) render: (ext: any, record: any) => (<span>{`${record.supplierCategory === 'dvs' ? '境内企业' : '境外企业'}`}</span>)
}, },
{ title: '统一社会信用代码', dataIndex: 'unifiedCode', align: 'center', ellipsis: true }, { 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: '操作', title: '操作',
@ -238,7 +250,7 @@ const SupplierAddModal: React.FC<{
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
footer={[ 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>, <Button key="cancel" onClick={onCancel}></Button>,
]} ]}
width={820} width={820}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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