This commit is contained in:
houjishuang
2025-05-28 17:22:38 +08:00
parent 2f84b7e3ca
commit c51d11a174

View File

@ -1,12 +1,18 @@
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree } from 'antd'; import { message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree } from 'antd';
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
import { getPage, getDataById, deleteAgency, addAgency, updateAgency,disableAgency } from './service'; import { getProviderToAgencyPage } from '../service';
// import './styles.less'; // import './styles.less';
import { getDicData } from '@/utils/session'; import { getDicData } from '@/utils/session';
import TextArea from 'antd/lib/input/TextArea'; import TextArea from 'antd/lib/input/TextArea';
const selectProvider: React.FC<{}> = () => { interface SelectProviderProps {
onSelect?: (record: any) => void;
visible?: boolean;
onCancel?: () => void;
}
const SelectProvider: React.FC<SelectProviderProps> = ({ onSelect, visible = false, onCancel }) => {
//获取字典 //获取字典
const getDict: any = getDicData(); const getDict: any = getDicData();
const [form] = Form.useForm(); const [form] = Form.useForm();
@ -38,18 +44,19 @@ const selectProvider: React.FC<{}> = () => {
//委托列表 //委托列表
const columns: ProColumns<any>[] = [ const columns: ProColumns<any>[] = [
{ title: '序号', valueType: 'index', width: 50, search: false, }, { title: '序号', valueType: 'index', width: 50, search: false, },
{ title: '供应商名称', dataIndex: 'providerName', },//, ellipsis: true { title: '供应商名称', dataIndex: 'name', },//, ellipsis: true
{ title: '供应商分类', dataIndex: 'roleName', { title: '供应商分类code', dataIndex: 'kindCode', hideInTable:true,
valueEnum: { 'EBTP': { text: '招标采购中心', status: 'EBTP' }, }, valueEnum: { 'EBTP': { text: '招标采购中心', status: 'EBTP' }, },
},
{ title: '供应商分类', dataIndex: 'kindName',
},//, ellipsis: true//, ellipsis: true },//, ellipsis: true//, ellipsis: true
{ title: '品类', dataIndex: 'roleName', }, { title: '品类', dataIndex: 'goodsTypeName', },
{ title: '准入时间', dataIndex: 'roleName', },//, ellipsis: true { title: '准入时间', dataIndex: 'accessTime', },//, ellipsis: true
{ title: '准入人', dataIndex: 'roleName', search: false, hideInTable:true,},//, ellipsis: true { title: '准入人', dataIndex: 'accessUser', search: false, hideInTable:true,},//, ellipsis: true
{ title: '失效时间', dataIndex: 'roleName', search: false,},//, ellipsis: true { title: '状态', dataIndex: 'agent', },//, ellipsis: true
{ title: '状态', dataIndex: 'status', },//, ellipsis: true
{ title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true { title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true
{ title: 'providerId', dataIndex: 'providerId', search: false,hideInTable:true,},
// { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false }, // { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false },
{ {
@ -62,19 +69,17 @@ const selectProvider: React.FC<{}> = () => {
] ]
}, },
]; ];
// 删除操作 // 选择供应商
const handleSelect = (id: string) => { const handleSelect = (record: any) => {
Modal.confirm({ Modal.confirm({
title: '确认选择该供应商?', title: '确认选择该供应商?',
onOk: async () => { onOk: async () => {
await deleteAgency(id).then((r: any) => { // 调用父组件传入的onSelect回调传递选中的供应商数据
if (r?.code == 200) { if (onSelect) {
message.success('删除成功'); onSelect(record);
} else { message.success('已选择供应商');
message.error('删除失败'); // 如果需要关闭弹窗,可以在这里添加关闭逻辑
} }
})
.finally(() => actionRef.current?.reload());
}, },
}); });
}; };
@ -84,9 +89,15 @@ const selectProvider: React.FC<{}> = () => {
return ( return (
<Spin spinning={spin}> <Modal
<PageHeader title="我的招标代理" /> title="选择供应商"
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'> visible={visible}
onCancel={onCancel}
width={1000}
footer={null}
>
<Spin spinning={spin}>
<div style={{ height: '600px' }} className='xsy-entrust bgCWhite'>
<ProTable<any> <ProTable<any>
actionRef={actionRef}//action触发后更新表格 actionRef={actionRef}//action触发后更新表格
columns={columns}//表格 columns={columns}//表格
@ -96,9 +107,9 @@ const selectProvider: React.FC<{}> = () => {
size='small' size='small'
search={{ labelWidth: 'auto', span: 6 }} search={{ labelWidth: 'auto', span: 6 }}
request={(params) => request={(params) =>
getPage({ getProviderToAgencyPage({
...params, ...params,
basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize }, pageNo: pageData.pageNo, pageSize: pageData.pageSize ,
}).then((res) => { }).then((res) => {
const result = { const result = {
data: res.data.records, data: res.data.records,
@ -110,12 +121,7 @@ const selectProvider: React.FC<{}> = () => {
return result; return result;
}) })
} }
toolBarRender={() => [
<Button onClick={() => { handleAdd() }} type="primary">
</Button>,
]
}
pagination={{ pagination={{
defaultPageSize: 10, defaultPageSize: 10,
showSizeChanger: false, showSizeChanger: false,
@ -128,6 +134,7 @@ const selectProvider: React.FC<{}> = () => {
</div> </div>
{/* 查看 */} {/* 查看 */}
</Spin > </Spin >
</Modal>
) )
}; };
export default selectProvider; export default SelectProvider;