合并代码
This commit is contained in:
@ -6,7 +6,7 @@ import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
//umi 相关
|
||||
import { useIntl } from 'umi';
|
||||
//本地服务/接口
|
||||
import { supplierDetail } from '../services';
|
||||
import { getCategoryPage } from '../services';
|
||||
|
||||
interface Data {
|
||||
id: number;
|
||||
@ -47,15 +47,16 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
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 supplierDetail({ page, pageSize });
|
||||
const values = form.getFieldsValue();
|
||||
const { code, data, message } = await getCategoryPage({ 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);
|
||||
@ -63,8 +64,10 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
};
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
getList();
|
||||
}, [])
|
||||
if(visible) {
|
||||
getList();
|
||||
}
|
||||
}, [visible])
|
||||
// 列表头部数据
|
||||
const columns:ColumnsType<Data> = [
|
||||
{
|
||||
@ -72,30 +75,38 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
dataIndex: "index",
|
||||
key: "index",
|
||||
align: "center",
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
width: 60,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: "准入单位",
|
||||
dataIndex: "unit",
|
||||
key: "unit",
|
||||
dataIndex: "deptId",
|
||||
key: "deptId",
|
||||
align: "left",
|
||||
ellipsis: true,
|
||||
render: (dom, record) =>
|
||||
<Tooltip title={record.unit}>
|
||||
{record.unit}
|
||||
</Tooltip>,
|
||||
},
|
||||
{
|
||||
title: "准入品类",
|
||||
dataIndex: "category",
|
||||
key: "category",
|
||||
dataIndex: "categoryNames",
|
||||
key: "categoryNames",
|
||||
align: "center",
|
||||
render: (_: any, record: any) => {
|
||||
console.log(record.categoryNames);
|
||||
const arr = record.categoryNames ? record.categoryNames.split(',') : [];
|
||||
|
||||
return arr.length
|
||||
? arr.map((item: string, idx: number) => (
|
||||
<div key={idx} style={{ marginBottom: 4 }}>
|
||||
{item}
|
||||
</div>
|
||||
))
|
||||
: '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "准入时间",
|
||||
dataIndex: "accessTime",
|
||||
key: "accessTime",
|
||||
dataIndex: "updateTime",
|
||||
key: "updateTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
@ -104,12 +115,6 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
key: "exitTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入灰名单时间",
|
||||
dataIndex: "grayTime",
|
||||
key: "grayTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入黑名单时间",
|
||||
dataIndex: "blackTime",
|
||||
@ -128,11 +133,12 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
>
|
||||
{/* 查询栏 */}
|
||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }}>
|
||||
<Form.Item name="keyword">
|
||||
<Form.Item name="categoryNames">
|
||||
<Input
|
||||
placeholder="请输入准入单位或准入品类关键字"
|
||||
style={{ width: 300 }}
|
||||
allowClear
|
||||
maxLength={50}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
|
@ -13,7 +13,8 @@ interface SupplierViewModalProps {
|
||||
const SupplierViewModal: React.FC<SupplierViewModalProps> = ({ visible, onCancel, record }) => {
|
||||
return (
|
||||
<Modal visible={visible} title="供应商信息查看" onCancel={onCancel} footer={null} width='80%' destroyOnClose >
|
||||
<CompanyInfo />
|
||||
<CompanyInfo
|
||||
viewType={true} />
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ import { useIntl } from 'umi';
|
||||
import SupplierViewModal from './components/SupplierViewModal';
|
||||
import SupplierDetailModal from './components/SupplierDetailModal';
|
||||
//本地服务/接口
|
||||
import { systemDict, list } from './services';
|
||||
import { getRegisterPage } from './services';
|
||||
|
||||
// 列表数据接口
|
||||
interface Data {
|
||||
@ -63,15 +63,16 @@ const RegistrationQuery: 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 getRegisterPage({ 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);
|
||||
@ -80,19 +81,16 @@ const RegistrationQuery: React.FC = () => {
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
// 境内/境外 下拉
|
||||
systemDict('regionDict').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setRegionOptions(data)
|
||||
}
|
||||
});
|
||||
// 状态 下拉
|
||||
systemDict('status').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setStatusOptions(data)
|
||||
}
|
||||
});
|
||||
setRegionOptions([
|
||||
{ label: '境内企业', value: 'dvs' },
|
||||
{ label: '境外企业', value: 'ovs' },
|
||||
])
|
||||
//状态 下拉
|
||||
setStatusOptions([
|
||||
{ label: '未准入', value: '0' },
|
||||
{ label: '已准', value: '1' },
|
||||
{ label: '退出', value: '2' },
|
||||
])
|
||||
//列表
|
||||
getList();
|
||||
}, [])
|
||||
@ -104,7 +102,7 @@ const RegistrationQuery: React.FC = () => {
|
||||
key: 'index',
|
||||
width: 70,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{
|
||||
title: '供应商名称',
|
||||
@ -119,27 +117,28 @@ const RegistrationQuery: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: '境内/境外',
|
||||
dataIndex: 'region',
|
||||
key: 'region',
|
||||
dataIndex: 'supplierTypeCn',
|
||||
key: 'supplierTypeCn',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '供应商分类',
|
||||
dataIndex: 'supplierType',
|
||||
key: 'supplierType',
|
||||
dataIndex: 'enterpriseTypeCn',
|
||||
key: 'enterpriseTypeCn',
|
||||
align: 'center',
|
||||
|
||||
},
|
||||
{
|
||||
title: '注册时间',
|
||||
dataIndex: 'regTime',
|
||||
key: 'regTime',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
dataIndex: 'accessStatusCn',
|
||||
key: 'accessStatusCn',
|
||||
align: 'center',
|
||||
render: (val: string) =>
|
||||
<span style={{
|
||||
@ -174,17 +173,17 @@ const RegistrationQuery: React.FC = () => {
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
<Form.Item name="name" label="供应商名称">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} />
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
|
||||
</Form.Item>
|
||||
<Form.Item name="region" label="境内/境外">
|
||||
<Select style={{ width: 160 }}>
|
||||
<Form.Item name="supplierType" label="境内/境外">
|
||||
<Select style={{ width: 160 }} placeholder="请选择境内/境外" allowClear>
|
||||
{regionOptions.map(opt => (
|
||||
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="status" label="状态">
|
||||
<Select style={{ width: 160 }}>
|
||||
<Form.Item name="accessStatus" label="状态">
|
||||
<Select style={{ width: 160 }} placeholder="请选择状态" allowClear>
|
||||
{statusOptions.map(opt => (
|
||||
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
|
||||
))}
|
||||
|
@ -2,36 +2,28 @@ import request from '@/utils/request';
|
||||
|
||||
|
||||
|
||||
|
||||
interface getRegisterPage {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
name?: string;
|
||||
supplierType?: string;
|
||||
accessStatus?: string;
|
||||
}
|
||||
export const getRegisterPage = (data: getRegisterPage) => request.post('/coscoSupplierBase/getRegisterPage', { data });
|
||||
|
||||
interface getCategoryPage {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
categoryNames?: string;
|
||||
}
|
||||
export const getCategoryPage = (data: getCategoryPage) => request.post('/coscoSupplierBase/getCategoryPage', { data });
|
||||
|
||||
|
||||
|
||||
export async function systemDict(dict:String) {
|
||||
return request(`/api/system/${dict}`, {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export interface ListParams {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
captcha?: string;
|
||||
tmpToken?: string;
|
||||
}
|
||||
export async function list(params:ListParams) {
|
||||
return request(`/api/system/list`, {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
export interface supplierDetailParams {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
captcha?: string;
|
||||
tmpToken?: string;
|
||||
}
|
||||
export async function supplierDetail(params:supplierDetailParams) {
|
||||
return request(`/api/system/supplierDetail`, {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user