Compare commits
2 Commits
e8f667264b
...
8c99a043a3
| Author | SHA1 | Date |
|---|---|---|
|
|
8c99a043a3 | |
|
|
933a9ef08f |
|
|
@ -61,7 +61,7 @@ const Page = () => {
|
||||||
x: 200,
|
x: 200,
|
||||||
y: 60,
|
y: 60,
|
||||||
width: '80%',
|
width: '80%',
|
||||||
height: 'calc(100% - 100px)'
|
height: 'calc(100% - 200px)'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', width:'72%',height:'98%',}}>
|
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', width:'72%',height:'98%',}}>
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ const Page = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gcdsj.qzqda.list).find_noCode);
|
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gcdsj.qzqda.list).find_noCode);
|
||||||
|
console.log(tableProps);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description pdf文件预览
|
* @description pdf文件预览
|
||||||
* @param {String} params 文件预览url
|
* @param {String} params 文件预览url
|
||||||
|
|
@ -62,6 +63,9 @@ const Page = () => {
|
||||||
const onExport = () => {
|
const onExport = () => {
|
||||||
let params = {
|
let params = {
|
||||||
...searchVal,
|
...searchVal,
|
||||||
|
pageSo:{
|
||||||
|
pageNum:1,pageSize:9999
|
||||||
|
}
|
||||||
}
|
}
|
||||||
httppost5(apiurl.gcdsj.qzqda.export, params).then(res => {
|
httppost5(apiurl.gcdsj.qzqda.export, params).then(res => {
|
||||||
exportFile(`全周期档案.xlsx`,res.data)
|
exportFile(`全周期档案.xlsx`,res.data)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useForm } from 'antd/lib/form/Form';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { httpgetExport, httppostAddfile } from '../../../../utils/request';
|
import { httpgetExport, httppostAddfile } from '../../../../utils/request';
|
||||||
import { exportFile } from '../../../../utils/tools';
|
import { exportFile } from '../../../../utils/tools';
|
||||||
|
import PdfView from './pdfView'
|
||||||
|
|
||||||
const { Dragger } = Upload;
|
const { Dragger } = Upload;
|
||||||
|
|
||||||
|
|
@ -115,9 +116,9 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const preView = (item) => {
|
const preView = (item) => {
|
||||||
if (checkMediaType(item.name) == 'pdf') {
|
if (checkMediaType(item.fileName) == 'pdf') {
|
||||||
// window.open(baseUrl + item.previewUrl)
|
// window.open(baseUrl + item.previewUrl)
|
||||||
setUrl(item.previewUrl)
|
setUrl(item.fileId)
|
||||||
setIsModal(true)
|
setIsModal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,6 +210,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
||||||
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
|
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
|
||||||
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
|
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
|
||||||
</div>
|
</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 >
|
</Form >
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -93,32 +93,22 @@ const Page = ({ mode, onCrudSuccess,record,submit }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
let obj = {
|
||||||
|
createName: localStorage.getItem('userName'),
|
||||||
|
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
createBy:localStorage.getItem('userId')
|
||||||
|
}
|
||||||
if(mode == 'edit' || mode =='view'){
|
if(mode == 'edit' || mode =='view'){
|
||||||
httpget(apiurl.szzf.ajdj.detail + record.id).then(async res=>{
|
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(res.data?.caseDate){
|
if(res.data?.caseDate){
|
||||||
obj.caseDate=dayjs(res.data.caseDate)
|
obj.caseDate=dayjs(res.data.caseDate)
|
||||||
}
|
}
|
||||||
if(res.data?.illegalDate){
|
if(res.data?.illegalDate){
|
||||||
obj.illegalDate=dayjs(res.data.illegalDate)
|
obj.illegalDate=dayjs(res.data.illegalDate)
|
||||||
}
|
}
|
||||||
// if(res.data.IllegalDate){
|
|
||||||
// obj.IllegalDate = dayjs(res.data.IllegalDate)
|
|
||||||
// }
|
|
||||||
|
|
||||||
setFormData({...res.data,...obj})
|
setFormData({...res.data,...obj})
|
||||||
})
|
})
|
||||||
}else if(mode == 'save'){
|
}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})
|
setFormData({...obj})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useForm } from 'antd/lib/form/Form';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { httpgetExport, httppostAddfile } from '../../../../utils/request';
|
import { httpgetExport, httppostAddfile } from '../../../../utils/request';
|
||||||
import { exportFile } from '../../../../utils/tools';
|
import { exportFile } from '../../../../utils/tools';
|
||||||
|
import PdfView from './pdfView'
|
||||||
|
|
||||||
const { Dragger } = Upload;
|
const { Dragger } = Upload;
|
||||||
|
|
||||||
|
|
@ -104,9 +105,9 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const preView = (item) => {
|
const preView = (item) => {
|
||||||
if (checkMediaType(item.name) == 'pdf') {
|
if (checkMediaType(item.fileName) == 'pdf') {
|
||||||
// window.open(baseUrl + item.previewUrl)
|
// window.open(baseUrl + item.previewUrl)
|
||||||
setUrl(item.previewUrl)
|
setUrl(item.fileId)
|
||||||
setIsModal(true)
|
setIsModal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,6 +174,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
|
||||||
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
|
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
|
||||||
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
|
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
|
||||||
</div>
|
</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 >
|
</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