页面搭建
parent
6cf31ab253
commit
933a9ef08f
|
|
@ -61,7 +61,7 @@ const Page = () => {
|
|||
x: 200,
|
||||
y: 60,
|
||||
width: '80%',
|
||||
height: 'calc(100% - 100px)'
|
||||
height: 'calc(100% - 200px)'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', width:'72%',height:'98%',}}>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ const Page = () => {
|
|||
}
|
||||
|
||||
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gcdsj.qzqda.list).find_noCode);
|
||||
console.log(tableProps);
|
||||
|
||||
/**
|
||||
* @description pdf文件预览
|
||||
|
|
@ -62,6 +63,9 @@ const Page = () => {
|
|||
const onExport = () => {
|
||||
let params = {
|
||||
...searchVal,
|
||||
pageSo:{
|
||||
pageNum:1,pageSize:9999
|
||||
}
|
||||
}
|
||||
httppost5(apiurl.gcdsj.qzqda.export, params).then(res => {
|
||||
exportFile(`全周期档案.xlsx`,res.data)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useForm } from 'antd/lib/form/Form';
|
|||
import { useEffect, useState } from 'react';
|
||||
import { httpgetExport, httppostAddfile } from '../../../../utils/request';
|
||||
import { exportFile } from '../../../../utils/tools';
|
||||
import PdfView from './pdfView'
|
||||
|
||||
const { Dragger } = Upload;
|
||||
|
||||
|
|
@ -115,9 +116,9 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
|||
return null;
|
||||
}
|
||||
const preView = (item) => {
|
||||
if (checkMediaType(item.name) == 'pdf') {
|
||||
if (checkMediaType(item.fileName) == 'pdf') {
|
||||
// window.open(baseUrl + item.previewUrl)
|
||||
setUrl(item.previewUrl)
|
||||
setUrl(item.fileId)
|
||||
setIsModal(true)
|
||||
}
|
||||
|
||||
|
|
@ -209,6 +210,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
|||
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
|
||||
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
|
||||
</div>
|
||||
<PdfView url={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/tsg/rescue/goods/file/download/${url}`)}`} isModal={isModal} setModalN={(e)=>setIsModal(e)}/>
|
||||
</Form >
|
||||
|
||||
)
|
||||
|
|
|
|||
|
|
@ -93,32 +93,22 @@ const Page = ({ mode, onCrudSuccess,record,submit }) => {
|
|||
})
|
||||
}
|
||||
useEffect(()=>{
|
||||
if(mode == 'edit' || mode =='view'){
|
||||
httpget(apiurl.szzf.ajdj.detail + record.id).then(async res=>{
|
||||
|
||||
let obj = {
|
||||
createName: localStorage.getItem('userName'),
|
||||
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy:localStorage.getItem('userId')
|
||||
}
|
||||
if(mode == 'edit' || mode =='view'){
|
||||
httpget(apiurl.szzf.ajdj.detail + record.id).then(async res=>{
|
||||
if(res.data?.caseDate){
|
||||
obj.caseDate=dayjs(res.data.caseDate)
|
||||
}
|
||||
if(res.data?.illegalDate){
|
||||
obj.illegalDate=dayjs(res.data.illegalDate)
|
||||
}
|
||||
// if(res.data.IllegalDate){
|
||||
// obj.IllegalDate = dayjs(res.data.IllegalDate)
|
||||
// }
|
||||
|
||||
setFormData({...res.data,...obj})
|
||||
})
|
||||
}else if(mode == 'save'){
|
||||
let obj = {
|
||||
createName: localStorage.getItem('userName'),
|
||||
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy:localStorage.getItem('userId'),
|
||||
}
|
||||
setFormData({...obj})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useForm } from 'antd/lib/form/Form';
|
|||
import { useEffect, useState } from 'react';
|
||||
import { httpgetExport, httppostAddfile } from '../../../../utils/request';
|
||||
import { exportFile } from '../../../../utils/tools';
|
||||
import PdfView from './pdfView'
|
||||
|
||||
const { Dragger } = Upload;
|
||||
|
||||
|
|
@ -104,9 +105,9 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
|||
return null;
|
||||
}
|
||||
const preView = (item) => {
|
||||
if (checkMediaType(item.name) == 'pdf') {
|
||||
if (checkMediaType(item.fileName) == 'pdf') {
|
||||
// window.open(baseUrl + item.previewUrl)
|
||||
setUrl(item.previewUrl)
|
||||
setUrl(item.fileId)
|
||||
setIsModal(true)
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +174,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
|||
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
|
||||
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
|
||||
</div>
|
||||
<PdfView url={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/tsg/rescue/goods/file/download/${url}`)}`} isModal={isModal} setModalN={(e)=>setIsModal(e)}/>
|
||||
</Form >
|
||||
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
import React, { Component, useEffect, useState } from 'react';
|
||||
import { Document, Page, pdfjs } from 'react-pdf';
|
||||
import { Modal } from 'antd';
|
||||
|
||||
const Pdf = ({ url,isModal,setModalN }) => {
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
|
||||
const handleOk = () => {
|
||||
setIsModalOpen(false);
|
||||
setModalN(false)
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
setIsModalOpen(false);
|
||||
setModalN(false)
|
||||
};
|
||||
useEffect(()=>{
|
||||
setIsModalOpen(isModal)
|
||||
},[isModal])
|
||||
return (
|
||||
<div>
|
||||
<Modal
|
||||
title={<div style={{ backgroundColor: '#259dff', padding: 10, color: "#fff" }}>pdf</div>}
|
||||
open={isModalOpen}
|
||||
width={1000}
|
||||
onOk={handleOk}
|
||||
footer={false}
|
||||
onCancel={handleCancel}
|
||||
style={{ marginTop: "-5%" }}
|
||||
destroyOnClose>
|
||||
<div style={{ padding: "0 10px" }}>
|
||||
<iframe
|
||||
style={{
|
||||
height: '80vh',
|
||||
width: '100%',
|
||||
border: 0,
|
||||
marginTop: 20,
|
||||
}}
|
||||
src={url}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default Pdf
|
||||
Loading…
Reference in New Issue