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