12-23-上传master

This commit is contained in:
xingsy
2020-12-23 11:14:35 +08:00
parent 9769f83bc8
commit b42e0c1ddd
553 changed files with 56506 additions and 0 deletions

View 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">2183819</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>2020824142832</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