合并代码
This commit is contained in:
@ -8,8 +8,9 @@ import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
//本地组件、弹窗、业务逻辑
|
||||
import SupplierViewModal from './components/SupplierViewModal';
|
||||
import SupplierDetailModal from './components/SupplierDetailModal';
|
||||
import CategorySelector from '@/components/CategorySelector';
|
||||
//本地服务/接口
|
||||
import { list, systemDict } from './services';
|
||||
import { getPageMy } from './services';
|
||||
|
||||
const { Option } = Select;
|
||||
//下拉数据接口
|
||||
@ -32,7 +33,7 @@ const mySupplierInquiry: React.FC = () => {
|
||||
//列表加载
|
||||
const [loading, setLoading] = useState(false);
|
||||
//分页
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 188 });
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
||||
//查看是否显示状态
|
||||
const [viewVisible, setViewVisible] = useState(false);
|
||||
//准入明细是否显示状态
|
||||
@ -41,13 +42,15 @@ const mySupplierInquiry: React.FC = () => {
|
||||
const [currentRecord, setCurrentRecord] = useState<any>(null);
|
||||
// 境内/境外下拉数据
|
||||
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
|
||||
//集采类别
|
||||
const [categoryOptions, setCategoryOptions] = useState<OptionType[]>([]);
|
||||
//集采库
|
||||
// 准入状态
|
||||
const [storeOptions, setStoreOptions] = useState<OptionType[]>([]);
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
message.success('导出成功(此处为前端示例,实际应调接口)');
|
||||
const handleExport = async () => {
|
||||
// const res = await getPageMyExport();
|
||||
window.open(
|
||||
`${SERVER_BASE}/coscoSupplierBase/getPageMyExport`,
|
||||
'_blank',
|
||||
);
|
||||
};
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
@ -61,15 +64,16 @@ const mySupplierInquiry: React.FC = () => {
|
||||
getList();
|
||||
};
|
||||
//列表方法
|
||||
const getList = async (page: number = 1, pageSize: number = 10) => {
|
||||
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { code, data, msg, total } = await list({ page, pageSize });
|
||||
const values = form.getFieldsValue();
|
||||
const { code, data, message } = await getPageMy({ pageNo, pageSize, ...values });
|
||||
if (code === 200) {
|
||||
setData(data);
|
||||
setPagination({ current: page, pageSize, total });
|
||||
setData(data.records);
|
||||
setPagination({ current: pageNo, pageSize, total: data.total });
|
||||
} else {
|
||||
message.error(msg)
|
||||
message.error(message)
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@ -78,26 +82,17 @@ const mySupplierInquiry: React.FC = () => {
|
||||
// 初始化
|
||||
useEffect(() => {
|
||||
// 境内/境外 下拉
|
||||
systemDict('regionOptions').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setRegionOptions(data)
|
||||
}
|
||||
});
|
||||
// 集采类别 下拉
|
||||
systemDict('categoryOptions').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setCategoryOptions(data)
|
||||
}
|
||||
});
|
||||
// 集采库 下拉
|
||||
systemDict('storeOptions').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setStoreOptions(data)
|
||||
}
|
||||
});
|
||||
setRegionOptions([
|
||||
{ label: '境内企业', value: 'dvs' },
|
||||
{ label: '境外企业', value: 'ovs' },
|
||||
])
|
||||
|
||||
// 准入状态下拉
|
||||
setStoreOptions([
|
||||
{ label: '已准入', value: '1' },
|
||||
{ label: '退出', value: '2' },
|
||||
])
|
||||
|
||||
getList();
|
||||
}, []);
|
||||
|
||||
@ -109,7 +104,7 @@ const mySupplierInquiry: React.FC = () => {
|
||||
key: 'index',
|
||||
align: 'center',
|
||||
width: 60,
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{
|
||||
title: '供应商名称',
|
||||
@ -117,28 +112,34 @@ const mySupplierInquiry: React.FC = () => {
|
||||
key: 'name',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '统一社会信用代码/税号',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '境内/境外',
|
||||
dataIndex: 'region',
|
||||
key: 'region',
|
||||
dataIndex: 'supplierTypeCn',
|
||||
key: 'supplierTypeCn',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '企业类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
dataIndex: 'enterpriseTypeCn',
|
||||
key: 'enterpriseTypeCn',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '注册时间',
|
||||
dataIndex: 'regTime',
|
||||
key: 'regTime',
|
||||
title: '准入品类',
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '准入时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '准入状态',
|
||||
dataIndex: 'accessStatusCn',
|
||||
key: 'accessStatusCn',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
@ -168,24 +169,20 @@ const mySupplierInquiry: React.FC = () => {
|
||||
style={{ marginBottom: 12, }}
|
||||
>
|
||||
<Form.Item name="name" label="供应商名称">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} />
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} allowClear maxLength={20} />
|
||||
</Form.Item>
|
||||
<Form.Item name="category" label="集采类别">
|
||||
<Select style={{ width: 150 }} allowClear>
|
||||
{categoryOptions.map(opt => (
|
||||
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
||||
))}
|
||||
</Select>
|
||||
<Form.Item name="categoryId" label="准入品类">
|
||||
<CategorySelector multiple={false} style={{ width: 140 }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="store" label="集采库">
|
||||
<Select style={{ width: 150 }} allowClear>
|
||||
<Form.Item name="accessStatus" label="准入状态">
|
||||
<Select style={{ width: 140 }} allowClear placeholder="请选择准入状态">
|
||||
{storeOptions.map(opt => (
|
||||
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="region" label="境内/境外">
|
||||
<Select style={{ width: 130 }} allowClear>
|
||||
<Form.Item name="supplierType" label="境内/境外">
|
||||
<Select style={{ width: 140 }} allowClear placeholder="请选择境内/境外" >
|
||||
{regionOptions.map(opt => (
|
||||
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
||||
))}
|
||||
|
Reference in New Issue
Block a user