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

502 lines
19 KiB
TypeScript
Raw Normal View History

2022-03-10 14:24:13 +08:00
import React, { useEffect, useState } from 'react';
import { Button, Card, DatePicker, Divider, Form, List, message, Modal, Popover, Progress, Spin, Typography } from "antd";
2022-03-10 14:24:13 +08:00
import ProForm, {
ModalForm,
ProFormDateTimePicker,
} from '@ant-design/pro-form';
2020-12-23 11:14:35 +08:00
import ProTable from "@ant-design/pro-table";
2022-03-10 14:24:13 +08:00
import {
2023-05-06 16:42:17 +08:00
AlertOutlined,
2022-03-10 14:24:13 +08:00
ClockCircleOutlined,
DownloadOutlined,
ExclamationCircleOutlined,
2022-03-10 14:24:13 +08:00
FullscreenExitOutlined,
InfoCircleOutlined,
2022-03-10 14:24:13 +08:00
UnorderedListOutlined
} from "@ant-design/icons";
2022-03-10 14:24:13 +08:00
import {
getBiddingDocumentsDecryptList,
DownFile,
decryptFile,
decryptFileType,
getBiddingDocumentsDecryptListOther, setEndTime, endTimeUp, selectParam1, selectParam2
} from "./service"
import { getDefId, getProMethod, getRoomId, getSessionProjectData, getSessionUserData } from "@/utils/session";
2021-01-16 11:29:42 +08:00
import request from "umi-request";
2022-03-10 14:24:13 +08:00
import moment from "moment";
import "@/assets/xsy_style.less";
import { btnAuthority } from "@/utils/authority";
import { numberToChinese } from '@/utils/CommonUtils';
import { checkObjectId } from '@/utils/DownloadUtils';
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) => {
2022-03-10 14:24:13 +08:00
let proMsg = getSessionProjectData();
const [form] = Form.useForm();
2020-12-23 11:14:35 +08:00
// /*投标文件查看*/
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);//文件总数
2022-03-10 14:24:13 +08:00
const [tdocId, tdocIdSet] = useState<any>('');//tdocId
const [jmTimeVis, jmTimeVisSet] = useState<boolean>(false);//解密时限显隐
const [endTime, endTimeSet] = useState<any>('');//解密时限
const [endTimeVis, endTimeVisSet] = useState<boolean>(true);//解密时限提示显隐
const [endTimeModalType, setEndTimeModalType] = useState<boolean>(false);
2020-12-23 11:14:35 +08:00
2022-03-10 14:24:13 +08:00
const [PageRefresh, setPageRefresh] = useState<any>(0);//页面刷新
2020-12-23 11:14:35 +08:00
const [ListData, setListData] = useState<any>();
2022-03-10 14:24:13 +08:00
const [downFileBodyVis, downFileBodyVisSet] = useState<boolean>(false);//下载文件 打包下载文件loading
const [spinTip, spinTipSet] = useState<string>('请稍等...');//spin tip显示文字
const MethodDict = getProMethod();
const { Title, Text } = Typography;
2022-03-10 14:24:13 +08:00
//应答字段类型 评标,应答
let responseType = MethodDict == "procurement_mode_1" || MethodDict == "procurement_mode_2" ? "投标" : "应答"
let supplierType = MethodDict == "procurement_mode_1" || MethodDict == "procurement_mode_2" ? "投标人" : "供应商"
2020-12-23 11:14:35 +08:00
useEffect(() => {
2022-03-10 14:24:13 +08:00
let roomId = getRoomId();
if (roomId != "" && roomId != undefined) {
if (getProMethod() == "procurement_mode_4") {
getBiddingDocumentsDecryptListOther(roomId).then(res => {
if (res?.code == 200) {
setListData(res?.data);
tdocIdSet(res?.data[0].id);
}
})
} else {
getBiddingDocumentsDecryptList(roomId).then(res => {
if (res?.code == 200) {
setListData(res?.data);
tdocIdSet(res?.data[0].id);
}
})
}
} else {
message.warn("未获取到评审室id请您稍后再试!");
2021-01-16 11:29:42 +08:00
}
2022-03-10 14:24:13 +08:00
}, [PageRefresh])
2020-12-23 11:14:35 +08:00
/*查看*/
const OpenWindow = (record: any, docid: any) => {
window.open("/viewOfTenderDocuments?tdocid=" + docid + "&tendererId=" + record.id);
}
/*下载*/
2022-03-10 14:24:13 +08:00
const download = (filePath: any, filename: any, record: any, id: any) => {
// spinTipSet('供应商资质文件与下载链接生成中,请稍等...');
// downFileBodyVisSet(true);
// selectParam1({ "tdocId": tdocId, "tendererId": record.id }).then((res) => {
// if (res?.code == 200) {
// selectParam2({ "data": res?.data || [], "name": filename, "path": filePath }).then((res2) => {
// let key = res2?.key
// if (key != undefined && key != null && key.length > 0) {
// window.location.href = "/api/core-service-ebtp-updownload/v1/hulk/pull/" + res2.key;
// } else {
// message.error("请求文档中心失败!请您稍后再试。")
// }
// })
// }
// }).finally(() => {
// downFileBodyVisSet(false);
// })
window.location.href = `/api/core-service-ebtp-updownload/v1/hulk/downloadFromResp/${id}?n=${filename}&tendererId=${record.id}&tendererName=${record.companyName}`;
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
/*打包下载*/
const downloadPak = (filePath: any, filename: any, id?: any) => {
// spinTipSet('供应商资质文件与下载链接生成中,请稍等...');
// downFileBodyVisSet(true);
// selectParam1({ "tdocId": tdocId }).then((res) => {
// if (res?.code == 200) {
// selectParam2({ "data": res?.data || [], "name": filename, "path": filePath }).then((res2) => {
// let key = res2?.key
// if (key != undefined && key != null && key.length > 0) {
// window.location.href = "/api/core-service-ebtp-updownload/v1/hulk/pull/" + res2.key;
// } else {
// message.error("请求文档中心失败!请您稍后再试。")
// }
// })
// }
// }).finally(() => {
// downFileBodyVisSet(false);
// })
window.location.href = `/api/core-service-ebtp-updownload/v1/hulk/downloadFromResp/${id}?n=${filename}`;
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
/*提交解密截止时间*/
const OnFinshTime = () => {
form.validateFields().then(res => {
}).catch(res => {
message.warn("您有未填写的选项!")
2020-12-23 11:14:35 +08:00
})
2022-03-10 14:24:13 +08:00
}
/*设置解密时间*/
const setDecryptionTime = (record?: any) => {
return (
<ModalForm
title="设置解密截止时间"
width={300}
trigger={
<Button type="primary" disabled={record?.decryptStatus}>
</Button>
}
modalProps={{
onCancel: () => { },
}}
onFinish={async (values) => {
let msg;
await setEndTime({ id: record?.id, decryptEndDate: values?.decryptEndDate }).then(res => {
if (res.code == 200) {
message.success('提交成功');
msg = true;
} else {
msg = false;
}
})
return msg;
}}
>
<ProFormDateTimePicker name="decryptEndDate" />
</ModalForm>
);
}
/*解密*/
const decrypt = (record: any) => {
spinTipSet('正在查询解密进度,请稍等...');
downFileBodyVisSet(true);
/*发起解密*/
decryptFile({ tdocId: record }).then(res => {
if (res?.code == 200) {
handleRateVis(true);
rateCountSet(rateCount + 1);
}
}).finally(() => {
downFileBodyVisSet(false);
2021-01-16 11:29:42 +08:00
})
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
//查询进度
useEffect(() => {
if (rateVis) {
queryRate();
setTimeout(async () => {
rateCountSet(rateCount + 1);
}, 2000);
}
}, [rateCount]);
async function queryRate() {//查询解密进度
await decryptFileType({ tdocId: tdocId }).then((res) => {
// if (data != undefined) {
if (res?.code == 200) {
let data = res.data;
let all: number, comp: number, fail: number, wait: number = 0;
all = data['-1'] != undefined ? parseInt(data['-1']) : 0;
comp = data['1'] != undefined ? parseInt(data['1']) : 0;
fail = data['2'] != undefined ? parseInt(data['2']) : 0;
wait = data['0'] != undefined ? parseInt(data['0']) : 0;
jmCompleteSet(comp);
jmFailSet(fail);
jmFileCountSet(all);
jmWaitSet(wait);
// comp == all && setTimeout(() => {//全解密 成功自动关窗
// handleRateVis(false);
// }, 1000);
}
});
}
2020-12-23 11:14:35 +08:00
2022-03-10 14:24:13 +08:00
const queryDecrypt = async (tdocid: any) => {
let msg = true;
await decryptFileType({ tdocId: tdocid }).then(res => {
if (res?.code == 200) {
let data = res.data;
if (data != undefined) {
let quanbu = data['-1'] != undefined ? data['-1'] : 0;//6
let yijie = data['1'] != undefined ? data['1'] : 0;//6
let shibai = data['2'] != undefined ? data['2'] : 0;
let weijie = data['0'] != undefined ? data['0'] : 0;// //6
if (weijie > 0) {
msg = false;
}
}
}
});
return msg;
}
2020-12-23 11:14:35 +08:00
/*===========================*/
/*===========================*/
2022-03-10 14:24:13 +08:00
//解密时限
function onOkJmsx(value: any) {
endTimeSet(value.format('yyyy-MM-DD HH:mm:ss'));
}
function returnJmBtn() {
if (ListData[0].decryptEndDate !== '' && ListData[0].decryptEndDate !== null) {
return <div key='jmsxTip' className='mR8 xsy-red floatLeft h32 ftSz20'
hidden={ListData[0].decryptEndDate == null}>{supplierType}: {ListData[0].decryptEndDate}</div>
} else {
return <Button key='jmsx' className='mR8' type="primary" onClick={() => {
jmTimeVisSet(true)
}}></Button>
}
}
const jmTime = () => {
return (
<>
<Modal
title="设置解密时限"
width={'400px'}
destroyOnClose
centered
bodyStyle={{ overflowY: 'auto' }}
visible={jmTimeVis}
onCancel={() => {
jmTimeVisSet(false);
}}
okButtonProps={{ disabled: spin }}
onOk={async () => {
if (endTime != '') {
spinSet(true);
await endTimeUp({ id: tdocId, decryptEndDate: endTime }).then(res => {
if (res.success) {
message.success('设置成功');
}
});
spinSet(false);
jmTimeVisSet(false);
} else {
message.error('您未设置解密截止时间')
}
setPageRefresh(PageRefresh + 1);
}}
>
<Spin spinning={spin}>
<DatePicker
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
showTime={{ defaultValue: moment('00:00:00', 'HH:mm:ss') }}
// disabled={disabled}
showNow={false}
onOk={onOkJmsx}
/>
</Spin>
</Modal>
</>
)
}
function disabledDate(current: any) {//日期选择
// Can not select days before today and today
return current && current < moment().startOf('day');
}
/**20210330新增 公开招标 邀请招标 公开比选一阶段 不显示轮次文字*/
/**20211112修改 只有竞争性谈判和单一来源显示轮次,其他采购方式不显示 */
let headType = false;
let defId = getDefId();
if (MethodDict == "procurement_mode_5" || MethodDict == "procurement_mode_6") {
headType = true;
}
/**end*/
/**20210330新增 轮次信息 即同意轮次下可有多条信息 quoteOrOther 0-报价 1-应答文件 quoteOrOther=1 取registerInfoVOList里 decryptOtherStatus*/
const getMsg = (Code?: any) => {
let msg = ""
if (Code == "0") {
msg = ":报价";
} else if (Code == "1") {
msg = ":应答文件"
}
return msg
}
/**end*/
2020-12-23 11:14:35 +08:00
return (
<Card>
2022-03-10 14:24:13 +08:00
<Spin spinning={downFileBodyVis} tip={spinTip}>
<List
itemLayout="vertical"
dataSource={ListData}
renderItem={(item: any) => (
2020-12-23 11:14:35 +08:00
<ProTable
2022-03-10 14:24:13 +08:00
headerTitle={headType ? "第" + numberToChinese(item.turnSort) + "轮" + getMsg(item.quoteOrOther) : null}
size={"small"}
2020-12-23 11:14:35 +08:00
loading={pageloading}
toolBarRender={() => [
2022-03-10 14:24:13 +08:00
proMsg.isIPassDecode == 0 ?
// setDecryptionTime(item) :
returnJmBtn() :
(<Button hidden={btnAuthority(['ebtp-agency-project-manager', 'ebtp-purchase'])} disabled={!item.decryptStatus} type="primary" onClick={() => {
tdocIdSet(item.id);
decrypt(item.id)
}}></Button>),
<Button disabled={item?.registerInfoVOList?.findIndex((e: any) => {
if (item.quoteOrOther == "1") {
return e.decryptOtherStatus == "1"
} else {
return e.decryptStatus == "1"
}
}) != -1} onClick={() => downloadPak(item.filepath, item.filename, item.id)}> </Button>,
2020-12-23 11:14:35 +08:00
// <Button> 下载说明</Button>,
]}
2022-03-10 14:24:13 +08:00
2020-12-23 11:14:35 +08:00
search={false}
options={false}
columns={[
{
title: '序号',
dataIndex: 'index',
valueType: 'index'
},
{
title: '供应商名称',
dataIndex: 'companyName',
2023-05-06 16:42:17 +08:00
valueType: 'text',
render: (_: any, record: any, index: any) => (
<>
{_}
<Popover
content={
<Typography style={{ width: "352px" }}>
<Text style={{ display: 'block', color: "rgb(245,156,38)" }}></Text>
<Text ><Text underline>{record?.supplierCreatetime && record?.supplierCreatetime.foundTime}</Text>/</Text>
</Typography>
}
>
{(record?.supplierCreatetime && record?.supplierCreatetime.toOpenbidTime === 0) && <AlertOutlined style={{ color: "rgb(245,156,38)", marginLeft: 6 }} />}
</Popover>
{record?.supplierCreatetime && record?.supplierCreatetime.foundTime === null ? (
<Popover
content={
<Typography>
<Text style={{ display: 'block', color: "rgb(245,156,38)" }}></Text>
<Text></Text>
</Typography>
}
>
<InfoCircleOutlined style={{ color: "rgb(245,156,38)", marginLeft: 6 }} />
</Popover>
) : null}
2023-05-06 16:42:17 +08:00
</>
)
2020-12-23 11:14:35 +08:00
},
{
title: (
<span>
MAC地址检测承诺书时间
<Popover
content={
<Typography>
<Title level={5}></Title>
<Text style={{ display: 'inline-block', textIndent: '2em' }}>IPMAC地址校验MAC地址相同/</Text>
</Typography>
}
overlayInnerStyle={{ width: 400 }}
>
<ExclamationCircleOutlined style={{ color: '#b30000', marginLeft: 4 }} />
</Popover>
</span>
),
dataIndex: 'confirmTime',
valueType: 'text'
},
2022-03-10 14:24:13 +08:00
{
title: '解密状态',
dataIndex: item.quoteOrOther == "1" ? 'decryptOtherStatus' : "decryptStatus",
valueType: 'text',
valueEnum: {
"1": { text: "未解密" },
"2": { text: "解密成功" },
"3": { text: "解密失败" },
}
},
2020-12-23 11:14:35 +08:00
{
title: '操作',
// valueType: 'option',
render: (text: any, record: any) => {
2022-03-10 14:24:13 +08:00
let disabled = false
if (item.quoteOrOther == "1") {
if (record.decryptOtherStatus != 2) {
disabled = true;
}
} else {
if (record.decryptStatus != 2) {
disabled = true;
}
}
2020-12-23 11:14:35 +08:00
return (
<>
2022-03-10 14:24:13 +08:00
<Button disabled={disabled} type="text"
onClick={() => download(record?.filePath, headType ? record?.companyName + "第" + item.turnSort + "轮" + responseType + "文件" : record?.companyName + responseType + "文件", record, item?.id)}
icon={<DownloadOutlined />}></Button>
{checkObjectId(record.id) && <Button disabled={disabled} type="text" onClick={() => OpenWindow(record, item?.id)}
icon={<DownloadOutlined />}></Button>}
2020-12-23 11:14:35 +08:00
</>
);
}
}
]}
dataSource={item.registerInfoVOList}
2022-03-10 14:24:13 +08:00
pagination={{
defaultPageSize: 10
}}
2020-12-23 11:14:35 +08:00
/>
2022-03-10 14:24:13 +08:00
)}
/>
</Spin>
2020-12-23 11:14:35 +08:00
<Modal
title="解密进度"
width={'800px'}
destroyOnClose
centered
bodyStyle={{ padding: '32px 40px 48px', overflowY: 'auto' }}
visible={rateVis}
footer={false}
2022-03-10 14:24:13 +08:00
onCancel={() => {
handleRateVis(false);
setPageRefresh(PageRefresh + 1)
}}
2020-12-23 11:14:35 +08:00
>
2022-03-10 14:24:13 +08:00
<Card bordered={false} style={{ textAlign: 'center', fontSize: '30px', }}>
{(jmComplete + jmFail == jmFileCount && jmFileCount !== 0) ? `解 密 结 束` : `正 在 解 密...`}
</Card>
<Progress percent={Math.floor((jmComplete / jmFileCount) * 100)} status="active" />
2020-12-23 11:14:35 +08:00
<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> 个, */}
2022-03-10 14:24:13 +08:00
<span style={{ fontSize: 30, color: 'rgb(0,144,255)' }}>{jmWait}</span> ,
2020-12-23 11:14:35 +08:00
<span style={{ fontSize: 30, color: 'red' }}>{jmFail}</span>
</div>
</Modal>
2022-03-10 14:24:13 +08:00
{jmTime()}
2020-12-23 11:14:35 +08:00
</Card>
)
}
export default BiddingDocumentsDecrypt