Files
fe_service_ebtp_frontend/src/pages/Auction/AuctionManagerProject/components/AuctionManagerProject.tsx

271 lines
7.4 KiB
TypeScript

import { Button, Card, Form } from "antd"
import { history } from 'umi';
import ProTable from '@ant-design/pro-table';
import React, { useEffect, useState } from "react";
import { getInteriorManagerProjectList } from '../service'
import { auctionFollowUpAProjectManager, getDicData, getSessionUserData } from '@/utils/session';
import { getUrlParam, getUrlRelativePath, isEmpty, proTableValueEnum } from '@/utils/CommonUtils';
import { btnAuthority } from '@/utils/authority';
import { createHiddenForm } from '@/utils/CustomerService' //智慧客服
const AuctionMyLookingForInnerShot: React.FC<{}> = () => {
const [form] = Form.useForm();
//获取字典
const getDict: any = getDicData();
const dictData = JSON.parse(getDict);
//项目列表参数
const [projectParams, setProjectParams] = useState<string>("");
//url项目名称
const projectName = getUrlParam("projectName");
//url分页信息
const current = getUrlParam("current");
const saveTmpForm = (record: any) => {//智慧客服-创建临时表单
let roleAuthority: any | null = sessionStorage.getItem('roleAuthority');
let data = getSessionUserData();
console.log(record)
const inputList = [
{
label: null,
paraName: 'origin',
isEncode: false,
paraVal: 'eBid',
},
{
label: null,
paraName: 'organizationId',
isEncode: false,
paraVal: data.organizationId,
},
{
label: '处置实施项目',
paraName: 'projectName',
isEncode: true,
paraVal: record.projectName,
},
{
label: '处置编号 ',
paraName: 'disposalNum',
isEncode: true,
paraVal: record.disposalNum,
},
{
label: null,
paraName: 'tenderAgencyId',
isEncode: false,
paraVal: 'EMPTY',
},
{
label: null,
paraName: 'tenderAgencyName',
isEncode: true,
paraVal: '招投标客服',
},
{
label: '处置实施部门',
paraName: 'disposalDepartmentName',
isEncode: true,
paraVal: record.disposalDepartmentName,
},
{
label: '处置经理',
paraName: 'disposalManagerName',
isEncode: true,
paraVal: record.disposalManagerName
},
{
label: null,
paraName: 'roleAuthority',
isEncode: false,
paraVal: JSON.parse(roleAuthority)[0],
},
{
label: null,
paraName: 'module',
isEncode: false,
paraVal: '2',
},
{
label: null,
paraName: 'custType',
isEncode: false,
paraVal: '1',
},
]
createHiddenForm(inputList, window.location.pathname)
}
const columns: any = [
{
title: '序号',
valueType: 'index',
width: 80
},
{
title: '处置名称',
dataIndex: 'projectName',
initialValue: projectName ? projectName : void 0
},
{
title: '处置编号',
dataIndex: 'disposalNum',
search: false,
key: 'disposalNum',
},
{
title: '处置实施部门',
dataIndex: 'disposalDepartmentName',
search: false,
key: 'disposalDepartmentName',
},
{
title: '处置经理',
dataIndex: 'disposalManagerName',
search: false,
},
{
title: '处置类型',
dataIndex: 'auctionType',
valueEnum: proTableValueEnum(dictData['dispose_type=ebp_project']),
search: false,
key: 'auctionType',
},
{
title: '竞拍开始时间',
dataIndex: 'auctionStartTime',
search: false,
key: 'auctionStartTime',
},
{
title: '状态',
dataIndex: 'bidOpeningStatus',
search: false,
key: 'bidOpeningStatus',
render: (_: any, record: any) => {
if (record.bidOpeningStatus == 0) {
return (<></>)
} else if (record.bidOpeningStatus == 1) {
return (<></>)
} else if (record.bidOpeningStatus == 2) {
return (<></>)
} else if (record.bidOpeningStatus == 6) {//(手动结束)竞拍结束无人出价页面操作
return (<></>)
} else if (record.bidOpeningStatus == 7) {
return (<></>)
} else {
return (<></>)
}
}
},
{
title: '操作',
valueType: 'option',
width: 100,
render: (_: any, record: any) => {
return <Button hidden={btnAuthority(['ebtp-auction-manager'])} type='link' danger onClick={() => {
//创建临时表单-智慧客服
saveTmpForm(record)
saveProject({
"id": record?.id,
"projectName": record?.projectName,
"bidMethodDict": 'auction',
})
}}></Button>
}
}
];
const pagination: any= {
defaultPageSize: 10,
showSizeChanger: false,
defaultCurrent: current ? Number(current) : 1
}
const saveProject = (val: any) => { // 点击项目跟进存储项目信息
let projectURLParams = JSON.parse(projectParams);
let params = `${'?current=' + projectURLParams.current}${isEmpty(projectURLParams.projectName) ? '' : '&projectName=' + projectURLParams.projectName}`;
val.returnURL = getUrlRelativePath() + params;
auctionFollowUpAProjectManager(val);
history.push('/ProjectLayout/Auction/AuctionInfoManage')
}
/*拉取数据 beg*/
useEffect(() => {
form.resetFields();//清除form中数据
}, []);
return (
<>
<Card title="我发起的内拍项目">
<ProTable
className="proSearch"
columns={columns}
rowKey="id"
options={false}
size="small"
request={async (params) =>
await getInteriorManagerProjectList(params).then((res) => {
setProjectParams(JSON.stringify(params));
if (res.code == 200) {
let data = res.data;
return Promise.resolve({
data: data.records,
success: res.success,
total: res.data.total,
current: res.data.current,
});
}
return Promise.resolve({
data: [],
success: false,
total: 0,
current: 1,
});
})
}
pagination={pagination}
toolBarRender={false}
search={{
filterType: "query",
optionRender: (searchConfig: any, { form }) => {
return [
<Button
key="resetText"
onClick={() => {
form?.setFieldsValue({
projectName: null,
bidMethodDict: null,
current: 1,
})
form?.submit();
}}
>
{searchConfig?.resetText}
</Button>,
<Button
key="searchText"
type="primary"
onClick={() => {
form?.submit();
}}
>
{searchConfig?.searchText}
</Button>,
];
},
}}
/>
</Card>
</>
)
}
export default AuctionMyLookingForInnerShot