更新版本库

This commit is contained in:
ajaxfan
2021-01-16 11:29:42 +08:00
parent b42e0c1ddd
commit ff889c3db4
352 changed files with 39993 additions and 15507 deletions

View File

@ -1,9 +1,10 @@
import React, { useState, useRef, useEffect } from 'react';
import { Button, Table, Space, Modal, PageHeader, Collapse } from 'antd';
import { ActionType } from '@ant-design/pro-table';
import React, { useState, useEffect } from 'react';
import { Button, Table, Space, Modal, Collapse, message } from 'antd';
import ReactResumableJs from '@/components/Upload/react-resumable'
import { getUpload, withdrawTfile, getReceiptList } from './service';
import { getUpload, withdrawTfile, getReceiptList, getDecrypt } from './service';
import '@/assets/ld_style.less';
import { getProId } from '@/utils/session';
import FileDown from '@/utils/Download';
const { Panel } = Collapse;
@ -16,7 +17,7 @@ function getDate(idContent: any) { // 当前时间
}
}
function showtime(val: any) {
function showtime(val: any, ind: any) {
var nowtime = new Date(), //获取当前时间
endtime = new Date(val); //定义结束时间
var lefttime = endtime.getTime() - nowtime.getTime(); //距离结束时间的毫秒数
@ -25,41 +26,50 @@ function showtime(val: any) {
lefth = Math.floor(lefttime / (1000 * 60 * 60) % 24), //计算小时数
leftm = Math.floor(lefttime / (1000 * 60) % 60), //计算分钟数
lefts = Math.floor(lefttime / 1000 % 60); //计算秒数
var div1 = document.getElementById('endTime');
if (div1 != null) {
var div1 = document.getElementById('endTime' + ind);
var Btn = document.getElementById('uploadBtn' + ind);
if (div1) {
div1.innerHTML = leftd + "天" + lefth + "时" + leftm + "分" + lefts + "秒";
}
if (Btn != null) {
Btn.style.display = 'block';
}
} else {
var div1 = document.getElementById('overTime');
var Btn = document.getElementById('uploadBtn' + ind);
var div1 = document.getElementById('overTime' + ind);
if (div1 != null) {
div1.innerHTML = '已超过截至时间';
}
if (Btn != null) {
Btn.style.display = 'none';
}
}
}
const Index: React.FC<{}> = () => {
const [dateList, setDateList] = useState([]);
const [receiptList, setReceiptList] = useState([]);
const [uploadVisible, setUploadVisible] = useState<boolean>(false);
const [withdrawVisible, setWithdrawVisible] = useState<boolean>(false);
const [receiptVisible, setReceiptVisible] = useState<boolean>(false);
const [timeVisible, setTimeVisible] = useState<boolean>(false);
const [lookVisible, setLookVisible] = useState<boolean>(false);
const [timestamp, setTimestamp] = useState<any>(); // 时间戳
const [subsectionId, setSubsectionId] = useState<any>(); // 分段id
const [replyLength, setReplyLength] = useState<any>(); // 应答状态数组
const [Tfile, setTfile] = useState<any>(); // 上传文件参数
const [filePath, setFilePath] = useState<any>(); // 上传文件路径
const [uploadList, setUploadList] = useState<any>([]);
const [fileT, setFileT] = useState<any>();
let projectId = getProId()
const actionRef = useRef<ActionType>();
const columns: any[] = [ // 列表数据
{
title: '序号',
width: '10%',
render: (text: any, record: any, index: any) => `${index + 1}`
},
{
title: '分段名称',
width: '25%',
dataIndex: 'fileCategory',
render: (_: any, record: any) => {
if (record.fileCategory === 0) {
@ -77,65 +87,47 @@ const Index: React.FC<{}> = () => {
},
{
title: '应答状态',
width: '15%',
dataIndex: 'status',
render: (_: any, record: any) => {
if (record.status === 0) {
return (<></>)
} else if (record.status === 1) {
return (<></>)
if (record.status === 1) {
return (<></>)
} else {
return (<></>)
return (<></>)
}
}
},
{
title: '应答时间',
dataIndex: 'startDate',
},
// {
// title: '评审开始时间(招募)',
// dataIndex: 'openTime',
// },
{
title: '应答截至时间',
dataIndex: 'endDate',
},
{
title: '签到时间',
dataIndex: 'signDateTime',
width: '20%',
dataIndex: 'operateTime',
},
{
title: '操作',
width: '30%',
render: (text: any, record: any) => {
let d: any = new Date('2020-12-02 19:22:51')
return (
<>
<Button type="link" danger onClick={() => batchUpload(record, 'single')}></Button>
<Button type="link" danger onClick={() => submitWithdraw(record.id)}></Button>
<Button type="link" danger onClick={() => { lookReceipt(record.id) }}></Button>
</>
)
// if (d.valueOf(d) > timestamp) {
// return (
// <>
// <Button type="link" danger onClick={() => upLoad(record)}>上传</Button>
// </>
// )
// }
// if (d.valueOf(d) > timestamp && record.status != null) {
// return (
// <>
// <Button type="link" danger onClick={() => { setWithdrawVisible(true) }}>撤回</Button>
// </>
// )
// }
// if (record.status != null) {
// return (
// <>
// <Button type="link" danger onClick={() => { setReceiptVisible(true) }}>查看回执</Button>
// </>
// )
// }
let d: any = new Date(record.endDate)
let s: any = new Date(record.startDate)
if (d.valueOf(d) > timestamp && record.status != 1 && timestamp > s.valueOf(s)) {
return (
<>
<Button type="link" danger onClick={() => batchUpload(record, 'single')}></Button>
</>
)
} else if (d.valueOf(d) > timestamp && record.status == 1) {
return (
<>
<Button type="link" danger onClick={() => submitWithdraw(record.id)} ></Button>
<Button type="link" danger onClick={() => { lookReceipt(record.id) }}></Button>
</>
)
} else if (d.valueOf(d) < timestamp && record.status == 1) {
return (
<>
<Button type="link" danger onClick={() => { lookReceipt(record.id) }}></Button>
</>
)
}
},
},
];
@ -161,11 +153,12 @@ const Index: React.FC<{}> = () => {
},
{
title: '操作',
render: (text: any, record: any) => (
<Space size="middle">
<Button type="link" size="middle" onClick={() => setLookVisible(true)}></Button>
<Button type="link" size="middle" onClick={() => setTimeVisible(true)}></Button>
</Space>
render: (text: any, record: any, index: any) => (
// <Space size="middle">
<FileDown apiUrl={`/api/core-service-ebtp-updownload/v1/attachment/download/oid/${record.fileId}`} fileName={'回执记录表'+(index+1)} type='pdf' method='GET' btnName='回执导出'/>
// {/* <Button type="link" size="middle" onClick={() => setLookVisible(true)}>查看回执</Button> */}
// {/* <Button type="link" size="middle" onClick={() => setTimeVisible(true)}>验证时间戳</Button> */}
// </Space>
),
},
];
@ -176,9 +169,10 @@ const Index: React.FC<{}> = () => {
}
const getWithdraw = () => { // 确定撤回
withdrawTfile("1").then((res) => {
withdrawTfile(subsectionId).then((res) => {
if (res.code == 200) {
setWithdrawVisible(false)
getList()
}
})
}
@ -186,7 +180,7 @@ const Index: React.FC<{}> = () => {
const lookReceipt = (id: any) => { // 查看回执
setReceiptVisible(true)
const data = {
relId: 1
relId: id
}
getReceiptList(data).then((res) => {
if (res.code == 200) {
@ -195,54 +189,115 @@ const Index: React.FC<{}> = () => {
})
}
const batchUpload = (val: any, index: any) => { // 批量上传
const batchUpload = (val: any, index: any) => { // 上传
setUploadList([])
setUploadVisible(true)
let path, object
if(index == 'single'){
let path, object, filetype
if (index == 'single') {
filetype = '.file'
object = JSON.stringify(val)
path = '/' + val.tpId + '/' + val.sectionId + '/' + val.pathId + '/' + val.companyId
path = '/' + val.createYear + '/' + val.tpId + '/' + val.sectionId + '/' + val.tdocId + '/uploadFile/' + val.tendererId
} else {
filetype = '.zip'
object = JSON.stringify(dateList[index].tfileList[0])
path = '/' + dateList[index].tpId + '/' + dateList[index].sectionId + '/' + dateList[index].id + '/' + dateList[index].companyId
path = '/' + dateList[index].createYear + '/' + dateList[index].tpId + '/' + dateList[index].sectionId + '/' + dateList[index].id + '/uploadFile/' + dateList[index].tendererId
}
setFilePath(path)
setTfile(object)
setFileT(filetype)
}
const onUploadSuccess = () => { // 上传成功
const closeModal = () => { // 关闭上传
setUploadVisible(false)
setUploadList([])
}
const onUploadError = () => { // 上传失败
/**
* 大文件上传完成后的组件返回
*
* @param file
* @param resumable
* @param callback
*/
const onUploadSuccess = (file: any, cache: any, callback: any) => {
cache.push({
key: cache.length + 1,
filename: "文件解密中",
uploading: false,// 这不是文件上传作业
prograss: 0,
});
// TODO 下面演示一下接口如何调用
let test = 0;
let switchBtn = true;
let task = setInterval(() => {
if (test < 90) {
test += 20;
} else if (test == 100) {
clearInterval(task);
}
if (switchBtn) {
getDecrypt(file.uniqueIdentifier).then((res) => {
if (res.code == 200) {
if (res.data.consumptionState == '2' || res.data.consumptionState == '4') {
message.error('上传失败,请重新上传!')
callback(cache.length - 1, "文件解密中", 2);
setUploadVisible(false)
getList()
switchBtn = false
return;
} else if (res.data.consumptionState == '3') {
switchBtn = false
test = 100;
callback(cache.length - 1, "文件解密中", test);
message.success('上传成功!')
setUploadVisible(false)
getList()
// clearInterval(task);
return;
} else {
callback(cache.length - 1, "文件解密中", test);
}
}
})
}
// else {
// callback(cache.length - 1, "文件解密中", test);
// }
}, 3000);
}
const upLoad = (val: any) => { // 上传
console.log(val)
/**
* 大文件上传失败后的组件返回
*/
const onUploadError = () => {
message.error('上传失败!')
}
const onSelectChange = (selectedRowKeys: any, selectedRows: any) => { // 单选中回执列表数据
console.log(selectedRowKeys)
console.log(selectedRows)
// const onSelectChange = (selectedRowKeys: any, selectedRows: any) => { // 单选中回执列表数据
// console.log(selectedRowKeys)
// console.log(selectedRows)
// }
const getList = () => {
getUpload(projectId).then((res) => {
if (res.code == 200) {
setDateList(res.data)
setUploadList([])
}
})
}
useEffect(() => {
setTimestamp((new Date()).getTime())
getUpload("4419993030303037111").then((res) => {
if (res.code == 200) {
setDateList(res.data)
}
})
getList()
}, []);
return (
<>
<PageHeader
title="上传应答文件"
/>
<div className="bidContent uploadResponse">
<div>
<h3 className="name">-11111</h3>
<div>
<p className="message"><a className="text"></a></p>
</div>
@ -250,17 +305,26 @@ const Index: React.FC<{}> = () => {
{
dateList.map((item: any, index: any) => {
setInterval(() => getDate('currentTime' + index), 1000)
setInterval(() => showtime(item.endDate), 1000)
setInterval(() => showtime(item.endDate, index), 1000)
item.tfileList.map((val: any, ind: any) => {
if (val.status != 1) {
uploadList.push(val.id)
}
console.log(val)
})
return (
<>
<Collapse>
<Panel header={item.sectionName} key="1">
<div className="table-mess">
<span className="red mess"></span>
{/* <span className="red mess"></span> */}
<span className="f12 mess">{item.endDate}</span>
<span className="f12 mess"><span id={'currentTime' + index}></span></span>
<span className="tr f12 mess">
<span id="overTime"><span id="endTime" className="red">2183819</span></span>
<Button onClick={() => batchUpload('1', index)} className="b-red" type="primary" size="small" danger></Button>
<span id={'overTime' + index}><span id={'endTime' + index} className="red"></span></span>
{
item.state == '0' && new Date(item.startDate).getTime() < timestamp ? <Button id={'uploadBtn' + index} onClick={() => batchUpload('1', index)} className="b-red" type="primary" size="small" danger></Button> : null
}
</span>
</div>
<div>
@ -274,10 +338,13 @@ const Index: React.FC<{}> = () => {
val.sectionId = item.sectionId
val.pathId = item.id
val.companyId = item.companyId
val.createYear = item.createYear
})
}
<Table pagination={false} columns={columns} dataSource={item.tfileList} />
<p className="red"></p>
{
item.state == '1' ? null : <p className="red"></p>
}
</div>
</Panel>
</Collapse>
@ -286,35 +353,22 @@ const Index: React.FC<{}> = () => {
})
}
</div>
{/* <Modal // 单个上传
title="投标文件上传"
visible={singleVisible}
onCancel={() => setSingleVisible(false)}
footer={null}
>
<ReactResumableJs
query={{ 'relativePath': filePath, 'Tfile': Tfile }}
maxFiles={1}
filetypes={[]}
onUploadSuccess={() => onUploadSuccess}
onUploadError={() => onUploadError}
service="http://192.168.1.103:8760/ebtp-mall-updownload/fileupload/upload"
/>
</Modal> */}
<Modal // 批量上传
title="投标文件上传"
visible={uploadVisible}
onCancel={() => setUploadVisible(false)}
onCancel={closeModal}
width={800}
footer={null}
>
<ReactResumableJs
query={{ 'relativePath': filePath, 'Tfile': Tfile }}
maxFiles={1}
filetypes={['zip']}
onUploadSuccess={() => onUploadSuccess}
onUploadError={() => onUploadError}
// service="http://192.168.1.103:8760/ebtp-mall-updownload/fileupload/upload"
service="http://192.168.1.103:8760/api/core-service-ebtp-updownload/v1/hulk/upload"
fileAccept={fileT}
onUploadSuccess={onUploadSuccess.bind(this)}
onUploadError={onUploadError.bind(this)}
// onFileAdded={ onFileAdded.bind(this) }
// service="http://192.168.1.104:18016/v1/hulk/upload"
service="http://125.32.114.204:8760/api/core-service-ebtp-updownload/v1/hulk/upload"
/>
</Modal>
<Modal // 撤回
@ -334,10 +388,10 @@ const Index: React.FC<{}> = () => {
onOk={() => setReceiptVisible(false)}
>
<Table
rowSelection={{
type: 'radio',
onChange: onSelectChange,
}}
// rowSelection={{
// type: 'radio',
// onChange: onSelectChange,
// }}
pagination={false}
columns={receiptColumns}
dataSource={receiptList}
@ -363,7 +417,7 @@ const Index: React.FC<{}> = () => {
<p className="tr"></p>
</div>
</Modal>
<Modal // 验证时间戳
{/* <Modal // 验证时间戳
width={400}
centered
visible={timeVisible}
@ -373,7 +427,7 @@ const Index: React.FC<{}> = () => {
]}
>
时间戳校验成功时间为2020-08-14 18:55:23
</Modal>
</Modal> */}
</>
)
}