提交 1a2ed5c5 authored 作者: 钟是志's avatar 钟是志

增加迎新打印报到单的页面

上级 9afe7e95
......@@ -21,25 +21,30 @@ const getUrlInfo = (param) => {
}
};
function OtherCheckRecord({ form, location: { pathname } }) {
function OtherCheckRecord({ form, location: { pathname }, ...props }) {
const [data, setData] = useState();
useEffect(() => {
const params = getUrlInfo();
const { id, token } = params;
let params = getUrlInfo();
let id = params.id || props.id;
const { token, isMobile} = params;
if(token){
setToken(token);
}
console.log(id);
if(!id){
console.error('没有找到id');
}
if(isMobile){
document.body.style.minWidth = 'auto'; // 移动端宽度自适应
}
setData(undefined);
fetchTemplateById(id).then(res => {
if (res) setData({...res, content: "{}"});
});
}, [pathname]);
return !!data && <RenderForm form={form} postData={data} style={{ padding: 0 }} />;
return !!data && <RenderForm form={form}
postData={data}
style={{ padding: 0 }} />;
}
export default Form.create()(OtherCheckRecord)
import React, { useEffect, useRef, useState } from "react";
import ReactToPrint from "react-to-print";
import styles from "./index.less";
import { Button } from "antd";
import IframeForRenderForm from './IframeForRenderForm';
const idsConfig = [
{
id: '1427569429700411392',
name: "新生入学登记表",
key: "xsrxdjb"
},
{
id: '1427570690688548864',
name: "新生入学报到单",
key: "xsrxbdd"
},
];
export default function PrintQnmz(props) {
const componentRef = useRef();
const [showPrint, setShowPrint] = useState(false);
useEffect(() => {
document.title = "新手报到单打印";
setTimeout(() => {
setShowPrint(true);
}, 2000);
}, []);
return (<div>
{
showPrint && <ReactToPrint
trigger={() => <div className={styles.buttonDiv}><Button type={"primary"}>打印</Button></div>}
content={() => componentRef.current}
/>
}
<div ref={componentRef}>
{
idsConfig.map((x) => {
return (
<div style={{minHeight: '29cm'}}>
<IframeForRenderForm id={x.id} {...props}/>
</div>
);
})
}
</div>
</div>);
}
......@@ -16,3 +16,12 @@
}
.buttonDiv{
padding: 10px;
margin: 0px auto;
//font-size: 20px;
//font-weight: bold;
width: 100%;
text-align: center;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论