搜索与分页
This commit is contained in:
@ -75,7 +75,7 @@ const CategoryLibraryManage: React.FC = () => {
|
|||||||
const res = await approval({ id });
|
const res = await approval({ id });
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
message.success('提交成功');
|
message.success('提交成功');
|
||||||
getList(); // 刷新列表
|
getList(1, pagination.pageSize || 10);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -40,17 +40,17 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
|
|||||||
// 查询
|
// 查询
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
setPagination(p => ({ ...p, current: 1 }));
|
setPagination(p => ({ ...p, current: 1 }));
|
||||||
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
|
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setPagination(p => ({ ...p, current: 1 }));
|
setPagination(p => ({ ...p, current: 1 }));
|
||||||
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
|
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
const handleTreeSelect = (keys: string | number) => {
|
const handleTreeSelect = (keys: string | number) => {
|
||||||
const key = keys as string;
|
const key = keys as string;
|
||||||
setSelectedKeys(key);
|
setSelectedKeys(key);
|
||||||
getList(key);
|
getList(key,1, pagination.pageSize);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
//第三方UI库/组件
|
//第三方UI库/组件
|
||||||
import { Form, Button, Table, Input, Space, Tooltip } from 'antd';
|
import { Form, Button, Table, Input, Space, Tooltip, Select } 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';
|
||||||
@ -11,14 +11,24 @@ import { connect } from 'umi';
|
|||||||
// import SupplierDetailModal from './components/SupplierDetailModal';
|
// import SupplierDetailModal from './components/SupplierDetailModal';
|
||||||
import CategorySelector from '@/components/TreeCategorySelector';
|
import CategorySelector from '@/components/TreeCategorySelector';
|
||||||
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
|
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
|
||||||
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 { getDictList } from '@/servers/api/dicts'
|
||||||
//统一列表分页
|
//统一列表分页
|
||||||
import tableProps from '@/utils/tableProps'
|
import tableProps from '@/utils/tableProps'
|
||||||
|
const accessStatusType = [
|
||||||
|
{ code: '0', dicName: '未准入' },
|
||||||
|
{ code: '1', dicName: '已准入' },
|
||||||
|
{ code: '2', dicName: '已退出' }
|
||||||
|
]
|
||||||
|
|
||||||
|
//准入状态
|
||||||
|
const statusColor = (status: string) => {
|
||||||
|
if (status === '已驳回' || status === '已退出') return '#ef6969';
|
||||||
|
if (status === '已准入') return '#004f8e';
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
// 列表数据接口
|
// 列表数据接口
|
||||||
interface Data {
|
interface Data {
|
||||||
id: number;
|
id: number;
|
||||||
@ -54,13 +64,13 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
// 查询
|
// 查询
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
setPagination({ ...pagination, current: 1 });
|
setPagination({ ...pagination, current: 1 });
|
||||||
getList();
|
getList(1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
// 重置
|
// 重置
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setPagination({ ...pagination, current: 1 });
|
setPagination({ ...pagination, current: 1 });
|
||||||
getList();
|
getList(1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
//列表方法
|
//列表方法
|
||||||
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
||||||
@ -79,7 +89,6 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
|
const [enterpriseTypeMap, setEnterpriseTypeMap] = useState<{ [code: string]: string }>({});
|
||||||
const [approveTypeMap, setApproveTypeMap] = useState<{ [code: string]: string }>({});
|
|
||||||
// 初始化
|
// 初始化
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDictList('enterprise_type').then((res: any) => {
|
getDictList('enterprise_type').then((res: any) => {
|
||||||
@ -92,15 +101,6 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
setEnterpriseTypeMap(map);
|
setEnterpriseTypeMap(map);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getDictList('approve_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;
|
|
||||||
});
|
|
||||||
setApproveTypeMap(map);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
getList();
|
getList();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -184,11 +184,14 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '准入状态',
|
title: '准入状态',
|
||||||
dataIndex: 'accessStatus',
|
dataIndex: 'accessStatusCn',
|
||||||
key: 'accessStatus',
|
key: 'accessStatusCn',
|
||||||
|
width: 160,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 140,
|
render: (val: string) =>
|
||||||
render: (code: string) => approveTypeMap[code] || code
|
<span style={{
|
||||||
|
color: statusColor(val) || (val === '未准入' ? '#aaa' : undefined),
|
||||||
|
}}>{val}</span>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@ -232,7 +235,11 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
<CategorySelector multiple={false} />
|
<CategorySelector multiple={false} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="accessStatus" label="准入状态">
|
<Form.Item name="accessStatus" label="准入状态">
|
||||||
<AccessStatusSelect />
|
<Select style={{ width: 160 }} placeholder="请选择" allowClear>
|
||||||
|
{accessStatusType?.map(item => (
|
||||||
|
<Select.Option key={item.code} value={item.code}>{item.dicName}</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="境内/境外">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
@ -260,7 +267,7 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
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 - 380px)' }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/* 查看组件
|
{/* 查看组件
|
||||||
|
@ -43,18 +43,18 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
|
|||||||
// 查询
|
// 查询
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
setPagination(p => ({ ...p, current: 1 }));
|
setPagination(p => ({ ...p, current: 1 }));
|
||||||
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
|
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setPagination(p => ({ ...p, current: 1 }));
|
setPagination(p => ({ ...p, current: 1 }));
|
||||||
getList(selectedKeys ? selectedKeys : currentUser.organizationId);
|
getList(selectedKeys ? selectedKeys : currentUser.organizationId, 1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTreeSelect = (keys: string | number) => {
|
const handleTreeSelect = (keys: string | number) => {
|
||||||
const key = keys as string;
|
const key = keys as string;
|
||||||
setSelectedKeys(key);
|
setSelectedKeys(key);
|
||||||
getList(key);
|
getList(key, 1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getList = async (orgId: string, pageNo: number = 1, pageSize: number = 10) => {
|
const getList = async (orgId: string, pageNo: number = 1, pageSize: number = 10) => {
|
||||||
|
@ -63,13 +63,13 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
|
|||||||
// 搜索
|
// 搜索
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
setPagination({ ...pagination, current: 1 });
|
setPagination({ ...pagination, current: 1 });
|
||||||
getList();
|
getList(1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
// 重置
|
// 重置
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setPagination({ ...pagination, current: 1 });
|
setPagination({ ...pagination, current: 1 });
|
||||||
getList();
|
getList(1, pagination.pageSize);
|
||||||
};
|
};
|
||||||
//列表方法
|
//列表方法
|
||||||
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
||||||
@ -235,7 +235,7 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
|
|||||||
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 - 380px)' }}
|
||||||
/>
|
/>
|
||||||
{/* 查看组件 */}
|
{/* 查看组件 */}
|
||||||
<SupplierViewModal
|
<SupplierViewModal
|
||||||
|
@ -68,7 +68,7 @@ const blacklistManage: React.FC = () => {
|
|||||||
const res = await submit({ id });
|
const res = await submit({ id });
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
message.success('提交成功');
|
message.success('提交成功');
|
||||||
getList(); // 刷新列表
|
getList(1, pagination.pageSize);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -80,7 +80,7 @@ const blacklistManage: React.FC = () => {
|
|||||||
const res = await restoreSubmit({ id });
|
const res = await restoreSubmit({ id });
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
message.success('提交成功');
|
message.success('提交成功');
|
||||||
getList(); // 刷新列表
|
getList(1, pagination.pageSize);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user