2025-06-24 10:52:30 +08:00
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
//第三方UI库/组件
|
2025-07-09 14:01:45 +08:00
|
|
|
import { Form, Button, Table, Select, Input, Space, message, Tooltip } from 'antd';
|
2025-06-24 10:52:30 +08:00
|
|
|
import { SearchOutlined, DownloadOutlined, ReloadOutlined } from '@ant-design/icons';
|
|
|
|
//类型定义
|
|
|
|
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
|
|
|
//umi 相关
|
2025-07-09 14:01:45 +08:00
|
|
|
import { connect } from 'umi';
|
2025-06-24 10:52:30 +08:00
|
|
|
//本地组件、弹窗、业务逻辑
|
|
|
|
import SupplierViewModal from './components/SupplierViewModal';
|
|
|
|
import SupplierDetailModal from './components/SupplierDetailModal';
|
2025-07-02 16:18:03 +08:00
|
|
|
import CategorySelector from '@/components/CategorySelector';
|
2025-06-24 10:52:30 +08:00
|
|
|
//本地服务/接口
|
2025-07-02 16:18:03 +08:00
|
|
|
import { getPageMy } from './services';
|
2025-06-24 10:52:30 +08:00
|
|
|
|
|
|
|
const { Option } = Select;
|
|
|
|
//下拉数据接口
|
|
|
|
type OptionType = { label: string; value: string };
|
|
|
|
// 列表数据接口
|
|
|
|
interface Data {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
region: string;
|
|
|
|
supplierType: string;
|
|
|
|
regTime: string;
|
|
|
|
status: string;
|
|
|
|
}
|
2025-07-09 14:01:45 +08:00
|
|
|
interface mySupplierInquiryProps {
|
|
|
|
dispatch: any;
|
|
|
|
}
|
|
|
|
const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
2025-06-24 10:52:30 +08:00
|
|
|
//搜搜表单
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
//列表数据
|
|
|
|
const [data, setData] = useState<Data[]>([]);
|
|
|
|
//列表加载
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
//分页
|
2025-07-02 16:18:03 +08:00
|
|
|
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
2025-06-24 10:52:30 +08:00
|
|
|
//查看是否显示状态
|
|
|
|
const [viewVisible, setViewVisible] = useState(false);
|
|
|
|
//准入明细是否显示状态
|
|
|
|
const [detailVisible, setDetailVisible] = useState(false);
|
|
|
|
//查看、准入明细 参数传递
|
2025-07-03 10:24:33 +08:00
|
|
|
const [currentRecord, setCurrentRecord] = useState('');
|
2025-06-24 10:52:30 +08:00
|
|
|
// 境内/境外下拉数据
|
|
|
|
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
|
2025-07-02 16:18:03 +08:00
|
|
|
// 准入状态
|
2025-06-24 10:52:30 +08:00
|
|
|
const [storeOptions, setStoreOptions] = useState<OptionType[]>([]);
|
|
|
|
// 导出
|
2025-07-02 16:18:03 +08:00
|
|
|
const handleExport = async () => {
|
|
|
|
window.open(
|
|
|
|
`${SERVER_BASE}/coscoSupplierBase/getPageMyExport`,
|
|
|
|
'_blank',
|
|
|
|
);
|
2025-06-24 10:52:30 +08:00
|
|
|
};
|
|
|
|
// 查询
|
|
|
|
const handleSearch = () => {
|
|
|
|
setPagination({ ...pagination, current: 1 });
|
|
|
|
getList();
|
|
|
|
};
|
|
|
|
// 重置
|
|
|
|
const handleReset = () => {
|
|
|
|
form.resetFields();
|
|
|
|
setPagination({ ...pagination, current: 1 });
|
|
|
|
getList();
|
|
|
|
};
|
|
|
|
//列表方法
|
2025-07-02 16:18:03 +08:00
|
|
|
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
2025-06-24 10:52:30 +08:00
|
|
|
setLoading(true);
|
|
|
|
try {
|
2025-07-02 16:18:03 +08:00
|
|
|
const values = form.getFieldsValue();
|
|
|
|
const { code, data, message } = await getPageMy({ pageNo, pageSize, ...values });
|
2025-06-24 10:52:30 +08:00
|
|
|
if (code === 200) {
|
2025-07-02 16:18:03 +08:00
|
|
|
setData(data.records);
|
|
|
|
setPagination({ current: pageNo, pageSize, total: data.total });
|
2025-06-24 10:52:30 +08:00
|
|
|
} else {
|
2025-07-02 16:18:03 +08:00
|
|
|
message.error(message)
|
2025-06-24 10:52:30 +08:00
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
setLoading(false);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
// 初始化
|
|
|
|
useEffect(() => {
|
|
|
|
// 境内/境外 下拉
|
2025-07-02 16:18:03 +08:00
|
|
|
setRegionOptions([
|
|
|
|
{ label: '境内企业', value: 'dvs' },
|
|
|
|
{ label: '境外企业', value: 'ovs' },
|
2025-07-09 16:34:10 +08:00
|
|
|
{ label: '个人', value: 'pe' },
|
2025-07-02 16:18:03 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
// 准入状态下拉
|
|
|
|
setStoreOptions([
|
|
|
|
{ label: '已准入', value: '1' },
|
|
|
|
{ label: '退出', value: '2' },
|
|
|
|
])
|
|
|
|
|
2025-06-24 10:52:30 +08:00
|
|
|
getList();
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
const columns: ColumnsType<Data> = [
|
|
|
|
{
|
|
|
|
title: '序号',
|
|
|
|
dataIndex: 'index',
|
|
|
|
key: 'index',
|
|
|
|
align: 'center',
|
|
|
|
width: 60,
|
2025-07-02 16:18:03 +08:00
|
|
|
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '供应商名称',
|
|
|
|
dataIndex: 'name',
|
|
|
|
key: 'name',
|
|
|
|
align: 'center',
|
2025-07-09 14:01:45 +08:00
|
|
|
render: (dom, record) =>
|
|
|
|
<Tooltip title={record.name}>
|
|
|
|
<a
|
|
|
|
onClick={() => {
|
|
|
|
dispatch({
|
|
|
|
type: 'globalModal/show',
|
|
|
|
payload: {
|
|
|
|
id: record.id,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{record.name}
|
|
|
|
</a>
|
|
|
|
</Tooltip>,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-02 16:18:03 +08:00
|
|
|
title: '境内/境外',
|
|
|
|
dataIndex: 'supplierTypeCn',
|
|
|
|
key: 'supplierTypeCn',
|
2025-06-24 10:52:30 +08:00
|
|
|
align: 'center',
|
|
|
|
},
|
|
|
|
{
|
2025-07-02 16:18:03 +08:00
|
|
|
title: '企业类型',
|
|
|
|
dataIndex: 'enterpriseTypeCn',
|
|
|
|
key: 'enterpriseTypeCn',
|
2025-06-24 10:52:30 +08:00
|
|
|
align: 'center',
|
|
|
|
},
|
|
|
|
{
|
2025-07-02 16:18:03 +08:00
|
|
|
title: '准入品类',
|
|
|
|
dataIndex: 'categoryName',
|
|
|
|
key: 'categoryName',
|
|
|
|
align: 'center',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入时间',
|
|
|
|
dataIndex: 'updateTime',
|
|
|
|
key: 'updateTime',
|
2025-06-24 10:52:30 +08:00
|
|
|
align: 'center',
|
|
|
|
},
|
|
|
|
{
|
2025-07-02 16:18:03 +08:00
|
|
|
title: '准入状态',
|
|
|
|
dataIndex: 'accessStatusCn',
|
|
|
|
key: 'accessStatusCn',
|
2025-06-24 10:52:30 +08:00
|
|
|
align: 'center',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '操作',
|
|
|
|
key: 'option',
|
|
|
|
align: 'center',
|
|
|
|
render: (record: any) => (
|
|
|
|
<Space>
|
|
|
|
<a
|
|
|
|
style={{ color: '#1677ff' }}
|
2025-07-03 10:24:33 +08:00
|
|
|
onClick={() => { setCurrentRecord(record.id); setViewVisible(true); }}
|
2025-06-24 10:52:30 +08:00
|
|
|
>查看</a>
|
|
|
|
<a
|
|
|
|
style={{ color: '#1677ff' }}
|
2025-07-03 10:24:33 +08:00
|
|
|
onClick={() => { setCurrentRecord(record.id); setDetailVisible(true); }}
|
2025-06-24 10:52:30 +08:00
|
|
|
>准入明细</a>
|
|
|
|
</Space>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Form
|
|
|
|
form={form}
|
|
|
|
layout="inline"
|
|
|
|
style={{ marginBottom: 12, }}
|
|
|
|
>
|
|
|
|
<Form.Item name="name" label="供应商名称">
|
2025-07-02 16:18:03 +08:00
|
|
|
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} allowClear maxLength={20} />
|
2025-06-24 10:52:30 +08:00
|
|
|
</Form.Item>
|
2025-07-02 16:18:03 +08:00
|
|
|
<Form.Item name="categoryId" label="准入品类">
|
|
|
|
<CategorySelector multiple={false} style={{ width: 140 }} />
|
2025-06-24 10:52:30 +08:00
|
|
|
</Form.Item>
|
2025-07-02 16:18:03 +08:00
|
|
|
<Form.Item name="accessStatus" label="准入状态">
|
|
|
|
<Select style={{ width: 140 }} allowClear placeholder="请选择准入状态">
|
2025-06-24 10:52:30 +08:00
|
|
|
{storeOptions.map(opt => (
|
|
|
|
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
|
|
|
))}
|
|
|
|
</Select>
|
|
|
|
</Form.Item>
|
2025-07-02 16:18:03 +08:00
|
|
|
<Form.Item name="supplierType" label="境内/境外">
|
|
|
|
<Select style={{ width: 140 }} allowClear placeholder="请选择境内/境外" >
|
2025-06-24 10:52:30 +08:00
|
|
|
{regionOptions.map(opt => (
|
|
|
|
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
|
|
|
))}
|
|
|
|
</Select>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
|
|
<Button type="primary" icon={<DownloadOutlined />} style={{ marginRight: 8 }} onClick={handleExport}>
|
|
|
|
数据导出
|
|
|
|
</Button>
|
|
|
|
<Button type="primary" icon={<SearchOutlined />} htmlType="submit" onClick={handleSearch}>
|
|
|
|
查询
|
|
|
|
</Button>
|
|
|
|
<Button style={{ marginLeft: 8 }} icon={<ReloadOutlined />} onClick={handleReset}>
|
|
|
|
重置
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
|
|
|
{/* 表格 */}
|
|
|
|
<Table
|
|
|
|
rowKey="id"
|
|
|
|
columns={columns}
|
|
|
|
dataSource={data}
|
|
|
|
loading={loading}
|
|
|
|
pagination={pagination}
|
|
|
|
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
|
|
|
|
/>
|
|
|
|
{/* 查看组件 */}
|
|
|
|
<SupplierViewModal
|
|
|
|
visible={viewVisible}
|
|
|
|
record={currentRecord}
|
|
|
|
onCancel={() => setViewVisible(false)}
|
|
|
|
/>
|
|
|
|
{/* 准入明细组件 */}
|
|
|
|
<SupplierDetailModal
|
|
|
|
visible={detailVisible}
|
|
|
|
record={currentRecord}
|
|
|
|
onCancel={() => setDetailVisible(false)}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2025-07-09 14:01:45 +08:00
|
|
|
export default connect()(mySupplierInquiry);
|