Files
fe_service_ebtp_frontend/src/pages/Evaluation/BiddingDocumentsDecrypt/index.tsx

155 lines
5.5 KiB
TypeScript
Raw Normal View History

2020-12-23 11:14:35 +08:00
import React, {useEffect, useState} from 'react';
import {Button, Card, Divider, List, message, Modal, Progress} from "antd";
2021-01-16 11:29:42 +08:00
import style from "@/pages/Bid/BiddingAnnouncement/components/style.less";
2020-12-23 11:14:35 +08:00
import ProTable from "@ant-design/pro-table";
import {DownloadOutlined, UnorderedListOutlined} from "@ant-design/icons/lib";
2021-01-16 11:29:42 +08:00
import {getBiddingDocumentsDecryptList, DownFile, decryptFile, decryptFileType} from "./service"
import {getRoomId, getSessionUserData} from "@/utils/session";
import request from "umi-request";
2020-12-23 11:14:35 +08:00
interface BiddingDocumentsDecryptProps {
2021-01-16 11:29:42 +08:00
2020-12-23 11:14:35 +08:00
}
const BiddingDocumentsDecrypt: React.FC<BiddingDocumentsDecryptProps> = (props) => {
// /*投标文件查看*/
const [pageloading, setPageloading] = useState<boolean>(false);
const [spin, spinSet] = useState<any>(false);
const [rateVis, handleRateVis] = useState<boolean>(false); //进度显隐
const [rateCount, rateCountSet] = useState<number>(0); //查询进度启动器
const [jmComplete, jmCompleteSet] = useState<number>(0);//已解密成功
const [jmFail, jmFailSet] = useState<number>(0);//解密失败
const [jmWait, jmWaitSet] = useState<number>(0);//未解密
const [jmFileCount, jmFileCountSet] = useState<number>(0);//文件总数
const [ListData, setListData] = useState<any>();
useEffect(() => {
2021-01-16 11:29:42 +08:00
let roomId= getRoomId();
// roomId="1331563848498413568";
if(roomId!=""&&roomId!=undefined){
getBiddingDocumentsDecryptList(roomId).then(res => {
if (res.message != null && res.message == "success") {
setListData(res.data)
}else{
message.warn("未获取到列表信息,请您稍后再试!");
}
})
}else{
message.warn("为获取到评审室id请您稍后再试!");
}
}, [])
2020-12-23 11:14:35 +08:00
/*查看*/
const OpenWindow = (record: any, docid: any) => {
window.open("/viewOfTenderDocuments?tdocid=" + docid + "&tendererId=" + record.id);
}
/*下载*/
2021-01-16 11:29:42 +08:00
const download = (filePath: any,filename:any,record: any) => {
window.location.href = "/api/core-service-ebtp-updownload/v1/hulk/download?p="+filePath +"/"+record.companyName +"&n="+filename+"---"+record.companyName;
2020-12-23 11:14:35 +08:00
}
2021-01-16 11:29:42 +08:00
const downloadPak = (filePath: any,filename:any) => {
window.location.href = "/api/core-service-ebtp-updownload/v1/hulk/download?p="+filePath +"&n="+filename;
2020-12-23 11:14:35 +08:00
}
/*解密*/
const decrypt =(record:any)=>{
handleRateVis(true);
2021-01-16 11:29:42 +08:00
/*发起解密*/
2020-12-23 11:14:35 +08:00
decryptFile({turnId:record}).then(res=>{
})
2021-01-16 11:29:42 +08:00
/*查看解密进度*/
decryptFileType({turnId:record}).then(res=>{
2020-12-23 11:14:35 +08:00
2021-01-16 11:29:42 +08:00
})
2020-12-23 11:14:35 +08:00
}
/*===========================*/
/*===========================*/
return (
<Card>
<Divider style={{margin: "8px 0px"}}/>
<div className={style.label}>
<UnorderedListOutlined style={{marginRight: "8px"}}/>
</div>
<List
itemLayout="vertical"
dataSource={ListData}
renderItem={item => (
<List.Item>
<ProTable
loading={pageloading}
toolBarRender={() => [
2021-01-16 11:29:42 +08:00
getSessionUserData().roleIds=="daili"?<Button onClick={() => decrypt(item.id)}></Button>:null,
<Button onClick={() => downloadPak(item.filepath,item.filename)}> </Button>,
2020-12-23 11:14:35 +08:00
// <Button> 下载说明</Button>,
]}
search={false}
options={false}
columns={[
{
title: '序号',
dataIndex: 'index',
valueType: 'index'
},
{
title: '供应商名称',
dataIndex: 'companyName',
valueType: 'text'
},
{
title: '操作',
// valueType: 'option',
render: (text: any, record: any) => {
return (
<>
2021-01-16 11:29:42 +08:00
<Button type="primary" onClick={() => download(item.filepath,item.filename,record)} shape="round"
2020-12-23 11:14:35 +08:00
icon={<DownloadOutlined/>}></Button>
<Button type="primary" onClick={() => OpenWindow(record, item.id)} shape="round"
icon={<DownloadOutlined/>}></Button>
</>
);
}
}
]}
dataSource={item.registerInfoVOList}
// request={params => }
// rowKey={"id"}
/>
</List.Item>
)}
/>
<Modal
title="解密进度"
width={'800px'}
destroyOnClose
centered
bodyStyle={{ padding: '32px 40px 48px', overflowY: 'auto' }}
visible={rateVis}
footer={false}
onCancel={()=>handleRateVis(false)}
>
<Progress percent={(jmComplete + jmFail) * 100 / jmFileCount} status="active" />
<div style={{ textAlign: "center" }}>
<span style={{ fontSize: 30, color: 'rgb(0,144,255)' }}>{jmFileCount}</span>
</div>
<div style={{ textAlign: "center" }}>
<span style={{ fontSize: 30, color: 'rgb(61,169,92)' }}>{jmComplete}</span> ,
{/* 排队解密中:<span style={{ fontSize: 30, color: 'red' }}>{100 - rate}</span> 个, */}
<span style={{ fontSize: 30, color: 'rgb(0,144,255)' }}>{jmWait}</span> ,
<span style={{ fontSize: 30, color: 'red' }}>{jmFail}</span>
</div>
</Modal>
</Card>
)
}
export default BiddingDocumentsDecrypt