This commit is contained in:
houjishuang
2025-06-04 17:21:57 +08:00
parent 0852a973d3
commit d929a8f0a4
3 changed files with 157 additions and 2 deletions

View File

@ -0,0 +1,121 @@
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 { getEntrustedProjects } from '../service';
// import './styles.less';
import { getDicData } from '@/utils/session';
import { proTableValueEnum } from '@/utils/CommonUtils';
interface EntrustedProjectProps {
providerId?: string;
visible?: boolean;
onCancel?: () => void;
}
const EntrustedProject: React.FC<EntrustedProjectProps> = ({providerId, visible = false, onCancel }) => {
//获取字典
const getDict: any = getDicData();
const [form] = Form.useForm();
const [title, setTitle] = useState<string>('');
const [open, setOpen] = useState<boolean>(false);
const [checkedKeys, setCheckedKeys] = useState<React.Key[]>([]);
const [currentRoleId, setCurrentRoleId] = useState<number | null>(null);
const dictData = JSON.parse(getDict);
const actionRef = useRef<ActionType>();
const [spin, spinSet] = useState<boolean>(false);
//查询分页数据
const [pageData, pageDataSet] = useState<any>({
pageNo: 1,
pageSize: 10
});
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 13 },
};
interface DictType {
value: string;
label: string;
}
const sys_normal_scope: DictType[] = [
{ value: 'EBTP', label: '招标采购中心' },
];
//委托列表
const columns: ProColumns<any>[] = [
{ title: '序号', valueType: 'index', width: 50, search: false, },
{ title: '委托方', dataIndex: 'tendereeOrgName', },//, ellipsis: true
{ title: '委托方id', dataIndex: 'tendereeOrgId', hideInTable:true,
search: false,},
{ title: '委托部门', dataIndex: 'tendereeName',
},//, ellipsis: true//, ellipsis: true
{ title: '委托部门id', dataIndex: 'tendereeId', hideInTable:true,
search: false,},
{ title: '代理机构', dataIndex: 'tenderAgencyName', },
{ title: '代理机构id', dataIndex: 'tenderAgencyId',hideInTable:true, },
{ title: '项目名称', dataIndex: 'projectName', },//, ellipsis: true
{ title: '项目编号', dataIndex: 'ebpProjectNumber', search: false,},//, ellipsis: true
{ title: '采购方式', dataIndex: 'bidMethodDict', search: false,
// valueEnum: proTableValueEnum(dictData['bid_method_dict=ebp_purc_mode']),
},
{ title: '状态', dataIndex: 'status', valueEnum: { 2: { text: '进行中', status: 'Success' }, 3: { text: '已结束', status: 'Default' },9: { text: '废止', status: 'Error' } },//, ellipsis: true
},
{ title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true
// { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false },
];
const [menuOptions, setMenuOptions] = useState<any[]>([]);
return (
<Spin spinning={spin}>
<div style={{ height: '600px' }} className='xsy-entrust bgCWhite'>
<ProTable<any>
actionRef={actionRef}//action触发后更新表格
columns={columns}//表格
options={false}
bordered={false}
className='tableSearch'
size='small'
search={{ labelWidth: 'auto', span: 6 }}
request={(params) =>
getEntrustedProjects({
...params,
tenderAgencyId:providerId,
pageNo: pageData.pageNo, pageSize: pageData.pageSize ,
}).then((res) => {
const result = {
data: res.data.records,
total: res.data.total,
success: res.success,
pageSize: res.data.size,
current: res.data.current
}
return result;
})
}
pagination={{
defaultPageSize: 10,
showSizeChanger: false,
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }),
}}
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
/>
</div>
{/* 查看 */}
</Spin >
)
};
export default EntrustedProject;

View File

@ -17,6 +17,7 @@ import localeData from 'dayjs/plugin/localeData'
import weekday from 'dayjs/plugin/weekday'
import weekOfYear from 'dayjs/plugin/weekOfYear'
import weekYear from 'dayjs/plugin/weekYear'
import EntrustedProject from './components/EntrustedProject';
dayjs.extend(customParseFormat)
dayjs.extend(advancedFormat)
@ -35,7 +36,8 @@ const agency: React.FC<{}> = () => {
const [form] = Form.useForm();
const [title, setTitle] = useState<string>('');
const [open, setOpen] = useState<boolean>(false);
const [viewEntrustedProjectVisible, setViewEntrustedProjectVisible] = useState<boolean>(false);
const [currentProviderId, setCurrentProviderId] = useState<string>('');
const [checkedKeys, setCheckedKeys] = useState<React.Key[]>([]);
const [currentRoleId, setCurrentRoleId] = useState<number | null>(null);
const dictData = JSON.parse(getDict);
@ -97,7 +99,7 @@ const agency: React.FC<{}> = () => {
title: '操作', width: '9%',
valueType: 'option',
render: (_, record) => [
<Button type='text' onClick={() => { handleUpdate(record.providerId) }}></Button>,
<Button type='text' onClick={() => { viewEntrustedProject(record.providerId) }}></Button>,
<Button type='text' onClick={() => { handleUpdate(record) }}></Button>,
record.validityStatus === '1' && (
<Button key="disable" type='text' onClick={() => handleDisable(record.id)}></Button>
@ -109,6 +111,11 @@ const agency: React.FC<{}> = () => {
]
},
];
const viewEntrustedProject =(id: string) => {
setViewEntrustedProjectVisible(true);
setCurrentProviderId(id);
};
// 删除操作
const handleDelete = (id: string) => {
Modal.confirm({
@ -239,6 +246,25 @@ const agency: React.FC<{}> = () => {
console.error(error);
}
};
const closeProjectModal = async () => {
setViewEntrustedProjectVisible(false);
};
const entrustedProjects = (
<Modal
width="80%"
centered
destroyOnClose={true}
bodyStyle={{ maxHeight: window.innerHeight * 0.96 - 108, overflowY: 'auto', paddingTop: 0 }}
// footer={<Button onClick={() => setOpen(false)}>关闭</Button>}
onCancel={() => closeProjectModal()}
visible={viewEntrustedProjectVisible}
>
<EntrustedProject providerId={currentProviderId} />
</Modal>
);
const checkSupModal = (
<Modal
title={title}
@ -410,6 +436,7 @@ marginBottom: '1.5rem'
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
/>
{checkSupModal}
{entrustedProjects}
<SelectProvider
visible={selectProviderVisible}
onSelect={(provider) => {

View File

@ -72,4 +72,11 @@ export async function rejectAgency(id: any) {
method: 'post',
});
}
export async function getEntrustedProjects(params: any) {
return request('/api/biz-service-ebtp-project/v1/projectRecord/getAgencyProjects', {
method: 'post',
data: params,
});
}