2024-09-23 15:52:06 +08:00
|
|
|
|
import React, { Fragment, useRef, useMemo,useEffect,useState } from 'react';
|
|
|
|
|
|
import BasicCrudModal from '../../../../components/crud/BasicCrudModal';
|
|
|
|
|
|
import { Table, Card, Modal, Form, Input, Button, Row,Col, Timeline, message, Tabs,Image } from 'antd';
|
|
|
|
|
|
import {FileWordOutlined,FilePdfOutlined,FileZipOutlined,FileExcelOutlined } from '@ant-design/icons';
|
|
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
import ToolBar from './toolbar';
|
|
|
|
|
|
import apiurl from '../../../../service/apiurl';
|
|
|
|
|
|
import usePageTable from '../../../../components/crud/usePageTable2';
|
|
|
|
|
|
import { createCrudService } from '../../../../components/crud/_';
|
|
|
|
|
|
import {CrudOpRender_text} from '../../../../components/crud/CrudOpRender';
|
2024-09-24 16:52:00 +08:00
|
|
|
|
import './index.less'
|
2024-09-26 17:59:26 +08:00
|
|
|
|
import { httppost5 } from '../../../../utils/request';
|
|
|
|
|
|
import { exportFile } from '../../../../utils/tools';
|
2024-09-23 15:52:06 +08:00
|
|
|
|
|
|
|
|
|
|
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
|
|
|
|
|
|
const Page = () => {
|
|
|
|
|
|
const role = useSelector(state => state.auth.role);
|
|
|
|
|
|
const editBtn = role?.rule?.find(item => item.menuName == "编辑");
|
|
|
|
|
|
const viewBtn = role?.rule?.find(item => item.menuName == "查看");
|
|
|
|
|
|
const delBtn = role?.rule?.find(item => item.menuName == "删除");
|
|
|
|
|
|
const refModal = useRef();
|
|
|
|
|
|
const [searchVal, setSearchVal] = useState(false)
|
|
|
|
|
|
const [isFetch, setIsFetch] = useState(false)
|
2024-09-26 17:59:26 +08:00
|
|
|
|
const [iframeSrc, setIframeSrc] = useState('')
|
|
|
|
|
|
const [pdfViewOPen, setPdfViewOPen] = useState(false)
|
2024-09-23 15:52:06 +08:00
|
|
|
|
|
|
|
|
|
|
const command = (type) => (params) => {
|
|
|
|
|
|
if (type === 'save') {
|
|
|
|
|
|
refModal.current.showSave();
|
|
|
|
|
|
} else if (type === 'edit') {
|
|
|
|
|
|
refModal.current.showEdit({ ...params });
|
|
|
|
|
|
} else if (type === 'view') {
|
|
|
|
|
|
refModal.current.showView(params);
|
|
|
|
|
|
} else if (type === 'del') {
|
|
|
|
|
|
refModal.current.onDeleteGet(apiurl.rcgl.gcdsj.delete + `/${params.id}`);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const download = (params) => {
|
|
|
|
|
|
let downloadLink = document.createElement("a");
|
2024-09-27 10:15:58 +08:00
|
|
|
|
downloadLink.href = `http://local.gunshiiot.com:18083/gunshiApp/tsg/projectEvents/file/download/${params}`;
|
2024-09-23 15:52:06 +08:00
|
|
|
|
downloadLink.download = `${params.fileName}`;
|
|
|
|
|
|
downloadLink.style.display = "none";
|
|
|
|
|
|
// 将链接添加到页面中
|
|
|
|
|
|
document.body.appendChild(downloadLink);
|
|
|
|
|
|
|
|
|
|
|
|
// 模拟点击事件,开始下载
|
|
|
|
|
|
downloadLink.click();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-24 16:52:00 +08:00
|
|
|
|
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gcdsj.qzqda.list).find_noCode);
|
2024-10-09 08:58:52 +08:00
|
|
|
|
console.log(tableProps);
|
|
|
|
|
|
|
2024-09-26 17:59:26 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @description pdf文件预览
|
|
|
|
|
|
* @param {String} params 文件预览url
|
|
|
|
|
|
*/
|
|
|
|
|
|
const viewPdf = (params) => {
|
|
|
|
|
|
setIframeSrc(params)
|
|
|
|
|
|
setPdfViewOPen(true)
|
|
|
|
|
|
}
|
2024-09-23 15:52:06 +08:00
|
|
|
|
|
2024-09-26 17:59:26 +08:00
|
|
|
|
const onExport = () => {
|
|
|
|
|
|
let params = {
|
|
|
|
|
|
...searchVal,
|
2024-10-09 08:58:52 +08:00
|
|
|
|
pageSo:{
|
|
|
|
|
|
pageNum:1,pageSize:9999
|
|
|
|
|
|
}
|
2024-09-26 17:59:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
httppost5(apiurl.gcdsj.qzqda.export, params).then(res => {
|
|
|
|
|
|
exportFile(`全周期档案.xlsx`,res.data)
|
|
|
|
|
|
})
|
2024-09-23 15:52:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
useEffect(()=>{
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
search: {
|
|
|
|
|
|
...searchVal,
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
search(params)
|
|
|
|
|
|
}, [searchVal])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className='content-root clearFloat xybm' style={{paddingRight:"0",paddingBottom:"0"}}>
|
|
|
|
|
|
<div className='lf CrudAdcdTreeTableBox' style={{width:"100%",overflowY:"auto"}}>
|
|
|
|
|
|
<Card className='nonebox'>
|
|
|
|
|
|
<ToolBar
|
|
|
|
|
|
setSearchVal={setSearchVal}
|
2024-09-26 17:59:26 +08:00
|
|
|
|
onExport={onExport}
|
2024-09-23 15:52:06 +08:00
|
|
|
|
role={role}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<div className="ant-card-body" style={{ padding: "20px 0 0 0" }}>
|
|
|
|
|
|
<div className='time-line'>
|
|
|
|
|
|
<Timeline>
|
2024-09-24 16:52:00 +08:00
|
|
|
|
{tableProps.dataSource?.map((item, index) => (
|
2024-09-23 15:52:06 +08:00
|
|
|
|
<Timeline.Item key={index}>
|
|
|
|
|
|
<div className='time-line-item'>
|
2024-09-30 10:21:57 +08:00
|
|
|
|
<div style={{width:100}}>
|
|
|
|
|
|
<span>{item.eventsDate}</span>
|
2024-09-30 11:23:26 +08:00
|
|
|
|
<div className='dsj'>{item.typeName}</div>
|
2024-09-30 10:21:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2024-09-23 15:52:06 +08:00
|
|
|
|
<div className='item-right'>
|
|
|
|
|
|
<span>{item.eventsDesc}</span>
|
|
|
|
|
|
<div style={{ display: "flex"}}>
|
|
|
|
|
|
<span>附件:</span>
|
|
|
|
|
|
<Row gutter={[16]} style={{flex:1}}>
|
|
|
|
|
|
{
|
2024-09-24 16:52:00 +08:00
|
|
|
|
item.files?.length > 0 && item.files?.map(file => {
|
2024-09-23 15:52:06 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
|
<div className="file-item" style={{width:"100%"}}>
|
|
|
|
|
|
<div className='file-description'>
|
2024-09-24 16:52:00 +08:00
|
|
|
|
{file.fileName?.indexOf('.docx') > -1 ?
|
2024-09-23 15:52:06 +08:00
|
|
|
|
<div
|
|
|
|
|
|
onClick={() => { download(file.fileId) }}
|
|
|
|
|
|
style={{ cursor: 'pointer' }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<FileWordOutlined
|
|
|
|
|
|
style={{ fontSize: 40 }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
:
|
2024-09-24 16:52:00 +08:00
|
|
|
|
file.fileName?.indexOf('.pdf') > -1 ?
|
2024-09-23 15:52:06 +08:00
|
|
|
|
<div
|
|
|
|
|
|
onClick={() => { viewPdf(file?.fileId) }}
|
|
|
|
|
|
style={{ cursor: 'pointer' }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<FilePdfOutlined style={{ fontSize: 40 }} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
:
|
2024-09-24 16:52:00 +08:00
|
|
|
|
file.fileName?.indexOf('.zip') > -1 ?
|
2024-09-23 15:52:06 +08:00
|
|
|
|
<div
|
|
|
|
|
|
onClick={() => { download(file?.fileId) }}
|
|
|
|
|
|
style={{ cursor: 'pointer' }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<FileZipOutlined style={{ fontSize: 40 }} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
:
|
2024-09-24 16:52:00 +08:00
|
|
|
|
file.fileName?.indexOf('.xlsx') > -1 ?
|
2024-09-23 15:52:06 +08:00
|
|
|
|
<div
|
|
|
|
|
|
onClick={() => { download(file?.fileId) }}
|
|
|
|
|
|
style={{ cursor: 'pointer' }}
|
|
|
|
|
|
>
|
|
|
|
|
|
<FileExcelOutlined style={{ fontSize: 40 }} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
:
|
|
|
|
|
|
<Image width={60} src={url +file?.filePath} alt='' />
|
|
|
|
|
|
}
|
|
|
|
|
|
<span>{file.fileName}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Timeline.Item>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</Timeline>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2024-09-26 17:59:26 +08:00
|
|
|
|
<Modal
|
|
|
|
|
|
open={pdfViewOPen}
|
|
|
|
|
|
width={1000}
|
|
|
|
|
|
title=""
|
|
|
|
|
|
footer={null}
|
|
|
|
|
|
style={{marginTop:"-5%"}}
|
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
|
setPdfViewOPen(false)
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<iframe
|
|
|
|
|
|
style={{
|
|
|
|
|
|
height: '80vh',
|
|
|
|
|
|
width: '100%',
|
|
|
|
|
|
border: 0,
|
|
|
|
|
|
marginTop: 20,
|
|
|
|
|
|
}}
|
2024-09-27 10:15:58 +08:00
|
|
|
|
src={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/tsg/projectEvents/file/download/${iframeSrc}`)}`}
|
2024-09-26 17:59:26 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Modal>
|
2024-09-23 15:52:06 +08:00
|
|
|
|
</>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default Page;
|