12-23-上传master
This commit is contained in:
380
src/pages/Tender/UploadResponse/index.tsx
Normal file
380
src/pages/Tender/UploadResponse/index.tsx
Normal file
@ -0,0 +1,380 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Button, Table, Space, Modal, PageHeader, Collapse } from 'antd';
|
||||
import { ActionType } from '@ant-design/pro-table';
|
||||
import ReactResumableJs from '@/components/Upload/react-resumable'
|
||||
import { getUpload, withdrawTfile, getReceiptList } from './service';
|
||||
import '@/assets/ld_style.less';
|
||||
|
||||
const { Panel } = Collapse;
|
||||
|
||||
function getDate(idContent: any) { // 当前时间
|
||||
var date = new Date()
|
||||
var date1 = date.toLocaleString();
|
||||
var div1 = document.getElementById(idContent);
|
||||
if (div1 != null) {
|
||||
div1.innerHTML = date1;
|
||||
}
|
||||
}
|
||||
|
||||
function showtime(val: any) {
|
||||
var nowtime = new Date(), //获取当前时间
|
||||
endtime = new Date(val); //定义结束时间
|
||||
var lefttime = endtime.getTime() - nowtime.getTime(); //距离结束时间的毫秒数
|
||||
if (lefttime > 0) {
|
||||
var leftd = Math.floor(lefttime / (1000 * 60 * 60 * 24)), //计算天数
|
||||
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) {
|
||||
div1.innerHTML = leftd + "天" + lefth + "时" + leftm + "分" + lefts + "秒";
|
||||
}
|
||||
} else {
|
||||
var div1 = document.getElementById('overTime');
|
||||
if (div1 != null) {
|
||||
div1.innerHTML = '已超过截至时间';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 actionRef = useRef<ActionType>();
|
||||
const columns: any[] = [ // 列表数据
|
||||
{
|
||||
title: '序号',
|
||||
render: (text: any, record: any, index: any) => `${index + 1}`
|
||||
},
|
||||
{
|
||||
title: '分段名称',
|
||||
dataIndex: 'fileCategory',
|
||||
render: (_: any, record: any) => {
|
||||
if (record.fileCategory === 0) {
|
||||
return (<>商务</>)
|
||||
} else if (record.fileCategory === 1) {
|
||||
return (<>技术</>)
|
||||
} else if (record.fileCategory === 2) {
|
||||
return (<>服务</>)
|
||||
} else if (record.fileCategory === 3) {
|
||||
return (<>报价</>)
|
||||
} else {
|
||||
return (<>其他</>)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '应答状态',
|
||||
dataIndex: 'status',
|
||||
render: (_: any, record: any) => {
|
||||
if (record.status === 0) {
|
||||
return (<>撤回</>)
|
||||
} else if (record.status === 1) {
|
||||
return (<>已投标</>)
|
||||
} else {
|
||||
return (<>未投标</>)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '应答时间',
|
||||
dataIndex: 'startDate',
|
||||
},
|
||||
// {
|
||||
// title: '评审开始时间(招募)',
|
||||
// dataIndex: 'openTime',
|
||||
// },
|
||||
{
|
||||
title: '应答截至时间',
|
||||
dataIndex: 'endDate',
|
||||
},
|
||||
{
|
||||
title: '签到时间',
|
||||
dataIndex: 'signDateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
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>
|
||||
// </>
|
||||
// )
|
||||
// }
|
||||
},
|
||||
},
|
||||
];
|
||||
const receiptColumns: any[] = [ // 回执列表数据
|
||||
{
|
||||
title: '序号',
|
||||
render: (text: any, record: any, index: any) => `${index + 1}`
|
||||
},
|
||||
{
|
||||
title: '回执类别',
|
||||
dataIndex: 'status',
|
||||
render: (_: any, record: any) => {
|
||||
if (record.status === 0) {
|
||||
return (<>撤回</>)
|
||||
} else if (record.status === 1) {
|
||||
return (<>投标</>)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '回执时间',
|
||||
dataIndex: 'createDate',
|
||||
},
|
||||
{
|
||||
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>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const submitWithdraw = (id: any) => { // 撤回
|
||||
setWithdrawVisible(true)
|
||||
setSubsectionId(id)
|
||||
}
|
||||
|
||||
const getWithdraw = () => { // 确定撤回
|
||||
withdrawTfile("1").then((res) => {
|
||||
if (res.code == 200) {
|
||||
setWithdrawVisible(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const lookReceipt = (id: any) => { // 查看回执
|
||||
setReceiptVisible(true)
|
||||
const data = {
|
||||
relId: 1
|
||||
}
|
||||
getReceiptList(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
setReceiptList(res.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const batchUpload = (val: any, index: any) => { // 批量上传
|
||||
setUploadVisible(true)
|
||||
let path, object
|
||||
if(index == 'single'){
|
||||
object = JSON.stringify(val)
|
||||
path = '/' + val.tpId + '/' + val.sectionId + '/' + val.pathId + '/' + val.companyId
|
||||
} else {
|
||||
object = JSON.stringify(dateList[index].tfileList[0])
|
||||
path = '/' + dateList[index].tpId + '/' + dateList[index].sectionId + '/' + dateList[index].id + '/' + dateList[index].companyId
|
||||
}
|
||||
setFilePath(path)
|
||||
setTfile(object)
|
||||
}
|
||||
|
||||
const onUploadSuccess = () => { // 上传成功
|
||||
|
||||
}
|
||||
|
||||
const onUploadError = () => { // 上传失败
|
||||
|
||||
}
|
||||
|
||||
const upLoad = (val: any) => { // 上传
|
||||
console.log(val)
|
||||
}
|
||||
|
||||
const onSelectChange = (selectedRowKeys: any, selectedRows: any) => { // 单选中回执列表数据
|
||||
console.log(selectedRowKeys)
|
||||
console.log(selectedRows)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setTimestamp((new Date()).getTime())
|
||||
getUpload("4419993030303037111").then((res) => {
|
||||
if (res.code == 200) {
|
||||
setDateList(res.data)
|
||||
}
|
||||
})
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="上传应答文件"
|
||||
/>
|
||||
<div className="bidContent uploadResponse">
|
||||
<div>
|
||||
<h3 className="name">项目名称:竞争性谈判-11111</h3>
|
||||
<div>
|
||||
<p className="message"><a className="text">分包分段信息</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{
|
||||
dateList.map((item: any, index: any) => {
|
||||
setInterval(() => getDate('currentTime' + index), 1000)
|
||||
setInterval(() => showtime(item.endDate), 1000)
|
||||
return (
|
||||
<>
|
||||
<Collapse>
|
||||
<Panel header={item.sectionName} key="1">
|
||||
<div className="table-mess">
|
||||
<span className="red mess"></span>
|
||||
<span className="f12 mess">国家授时中心标准时间:<span id={'currentTime' + index}></span></span>
|
||||
<span className="tr f12 mess">
|
||||
<span id="overTime">距离递交结束还有<span id="endTime" className="red">2天18时38分19秒</span></span>
|
||||
<Button onClick={() => batchUpload('1', index)} className="b-red" type="primary" size="small" danger>批量上传</Button>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
{
|
||||
item.tfileList.map((val: any, index: any) => {
|
||||
val.startDate = item.startDate
|
||||
val.endDate = item.endDate
|
||||
val.openTime = item.openTime
|
||||
val.signDateTime = item.signDateTime
|
||||
val.tpId = item.tpId
|
||||
val.sectionId = item.sectionId
|
||||
val.pathId = item.id
|
||||
val.companyId = item.companyId
|
||||
})
|
||||
}
|
||||
<Table pagination={false} columns={columns} dataSource={item.tfileList} />
|
||||
<p className="red">温馨提示:您尚未上传完成投标文件!</p>
|
||||
</div>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
</>
|
||||
)
|
||||
})
|
||||
}
|
||||
</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)}
|
||||
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"
|
||||
/>
|
||||
</Modal>
|
||||
<Modal // 撤回
|
||||
width={300}
|
||||
centered
|
||||
visible={withdrawVisible}
|
||||
onCancel={() => setWithdrawVisible(false)}
|
||||
onOk={() => getWithdraw()}
|
||||
>
|
||||
确定撤回吗?
|
||||
</Modal>
|
||||
<Modal // 查看回执
|
||||
title="回执文件列表"
|
||||
width={800}
|
||||
visible={receiptVisible}
|
||||
onCancel={() => setReceiptVisible(false)}
|
||||
onOk={() => setReceiptVisible(false)}
|
||||
>
|
||||
<Table
|
||||
rowSelection={{
|
||||
type: 'radio',
|
||||
onChange: onSelectChange,
|
||||
}}
|
||||
pagination={false}
|
||||
columns={receiptColumns}
|
||||
dataSource={receiptList}
|
||||
/>
|
||||
</Modal>
|
||||
<Modal // 查看回执-查看回执
|
||||
title="投标申请回执"
|
||||
width={600}
|
||||
visible={lookVisible}
|
||||
onCancel={() => setLookVisible(false)}
|
||||
footer={null}
|
||||
>
|
||||
<div>
|
||||
<h2 className="tc">投标申请回执</h2>
|
||||
<p>中兴通讯股份有限公司:</p>
|
||||
<p>我们于2020年8月24日14时28分32秒收到贵公司的投标资料一份,详细信息如下:</p>
|
||||
<p>项目名称:竞争性谈判</p>
|
||||
<p>包名:y2302339/6</p>
|
||||
<p>标段名称:商务</p>
|
||||
<p>上传成功,特此函复!</p>
|
||||
<p className="tr">招标代理机构名称:宁夏股份有限公司</p>
|
||||
<p className="tr">联系人:赵四</p>
|
||||
<p className="tr">联系电话:暂无</p>
|
||||
</div>
|
||||
</Modal>
|
||||
<Modal // 验证时间戳
|
||||
width={400}
|
||||
centered
|
||||
visible={timeVisible}
|
||||
onCancel={() => setTimeVisible(false)}
|
||||
footer={[
|
||||
<Button key="submit" danger type="primary" onClick={() => setTimeVisible(false)}>确定</Button>
|
||||
]}
|
||||
>
|
||||
时间戳校验成功时间为:2020-08-14 18:55:23
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default Index
|
Reference in New Issue
Block a user