合并代码
This commit is contained in:
@ -6,9 +6,9 @@ import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
//umi 相关
|
||||
import { useIntl } from 'umi';
|
||||
//本地服务/接口
|
||||
import { supplierDetail } from '../services';
|
||||
import { getCategoryPage } from '../services';
|
||||
//本地组件
|
||||
import CategoryAddModal from './CategoryAddModal';
|
||||
// import CategoryAddModal from './CategoryAddModal';
|
||||
|
||||
interface Data {
|
||||
id: number;
|
||||
@ -51,15 +51,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);
|
||||
@ -67,60 +68,65 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
};
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
getList();
|
||||
}, [])
|
||||
if(visible) {
|
||||
getList();
|
||||
}
|
||||
|
||||
}, [visible])
|
||||
// 列表头部数据
|
||||
const columns:ColumnsType<Data> = [
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: "index",
|
||||
key: "index",
|
||||
align: "center",
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
title: "准入单位",
|
||||
dataIndex: "unit",
|
||||
key: "unit",
|
||||
align: "left",
|
||||
ellipsis: true,
|
||||
render: (dom, record) =>
|
||||
<Tooltip title={record.unit}>
|
||||
{record.unit}
|
||||
</Tooltip>,
|
||||
},
|
||||
{
|
||||
title: "准入品类",
|
||||
dataIndex: "category",
|
||||
key: "category",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "准入时间",
|
||||
dataIndex: "accessTime",
|
||||
key: "accessTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "退出时间",
|
||||
dataIndex: "exitTime",
|
||||
key: "exitTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入灰名单时间",
|
||||
dataIndex: "grayTime",
|
||||
key: "grayTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入黑名单时间",
|
||||
dataIndex: "blackTime",
|
||||
key: "blackTime",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: "index",
|
||||
key: "index",
|
||||
align: "center",
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
title: "准入单位",
|
||||
dataIndex: "deptId",
|
||||
key: "deptId",
|
||||
align: "left",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "准入品类",
|
||||
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: "updateTime",
|
||||
key: "updateTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "退出时间",
|
||||
dataIndex: "exitTime",
|
||||
key: "exitTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入黑名单时间",
|
||||
dataIndex: "blackTime",
|
||||
key: "blackTime",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
@ -132,7 +138,7 @@ 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 }}
|
||||
@ -147,15 +153,6 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
<Form.Item>
|
||||
<Button onClick={handleReset}>重置</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ background: "#52a8ff", borderColor: "#52a8ff" }}
|
||||
onClick={() => setAddModalVisible(true)}
|
||||
>
|
||||
新增品类
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{/* 表格内容 */}
|
||||
<Table
|
||||
@ -166,12 +163,12 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
|
||||
pagination={pagination}
|
||||
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
|
||||
/>
|
||||
{/* 新增品类弹窗 */}
|
||||
{/* 新增品类弹窗
|
||||
<CategoryAddModal
|
||||
visible={addModalVisible}
|
||||
onCancel={() => setAddModalVisible(false)}
|
||||
// onOk={...} // 根据你的业务需要加
|
||||
/>
|
||||
/>*/}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ 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>
|
||||
);
|
||||
};
|
||||
|
@ -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>
|
||||
))}
|
||||
|
@ -1,36 +1,26 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export interface ListParams {
|
||||
page: number;
|
||||
|
||||
|
||||
|
||||
interface getPageMy {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
treeId?: string;
|
||||
tmpToken?: string;
|
||||
name?: string;
|
||||
categoryId?: string;
|
||||
accessStatus?: string;
|
||||
supplierType?: string;
|
||||
}
|
||||
export async function list(params:ListParams) {
|
||||
return request('/api/system/library', {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
export interface supplierDetailParams {
|
||||
page: number;
|
||||
export const getPageMy = (data: getPageMy) => request.post('/coscoSupplierBase/getPageMy', { data });
|
||||
|
||||
interface getCategoryPage {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
captcha?: string;
|
||||
tmpToken?: string;
|
||||
categoryNames?: string;
|
||||
}
|
||||
export async function supplierDetail(params:supplierDetailParams) {
|
||||
return request(`/api/system/supplierDetail`, {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
export async function treeData() {
|
||||
return request('/api/system/treeData', {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
export async function systemDict(dict:String) {
|
||||
return request(`/api/system/${dict}`, {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
export const getCategoryPage = (data: getCategoryPage) => request.post('/coscoSupplierBase/getCategoryPage', { data });
|
||||
|
||||
|
||||
export const getPageMyExport = () => request.get('/coscoSupplierBase/getPageMyExport', {responseType: 'blob'});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user