Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
74559a6f
提交
74559a6f
authored
3 年前
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
打印功能修改
上级
e81ef846
master
yaanzhiyuan_2021
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
56 行增加
和
20 行删除
+56
-20
PrintForYx.js
FormInsertDiy/RenderForm/PrintForYx.js
+50
-20
index.less
FormInsertDiy/RenderForm/index.less
+6
-0
没有找到文件。
FormInsertDiy/RenderForm/PrintForYx.js
浏览文件 @
74559a6f
import
React
,
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
ReactToPrint
from
"react-to-print"
;
import
styles
from
"./index.less"
;
import
{
Button
}
from
"antd"
;
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"
name
:
'新生入学登记表'
,
key
:
'xsrxdjb'
,
},
{
id
:
'1427570690688548864'
,
name
:
"新生入学报到单"
,
key
:
"xsrxbdd"
name
:
'新生入学报到单'
,
key
:
'xsrxbdd'
,
},
];
...
...
@@ -23,32 +23,62 @@ export default function PrintQnmz(props) {
const
[
showPrint
,
setShowPrint
]
=
useState
(
false
);
console
.
log
(
window
.
history
);
useEffect
(()
=>
{
document
.
title
=
"新手报到单打印"
;
document
.
title
=
'新手报到单打印'
;
setTimeout
(()
=>
{
setShowPrint
(
true
);
},
1
000
);
},
2
000
);
},
[]);
// function printDom() {
// document.getElementById('showButtonDiv').style.display = 'none';
// window.print();
// setTimeout(() => {
// document.getElementById('showButtonDiv').style.display = 'grid';
// }, 1000);
// }
return
(
<
div
>
<
div
className
=
{
styles
.
buttonDiv
}
>
{
showPrint
&&
<
ReactToPrint
trigger
=
{()
=>
<
Button
type
=
{
"primary"
}
>
打印
<
/Button>
}
content
=
{()
=>
componentRef
.
current
}
/
>
}
<
div
className
=
{
styles
.
buttonDiv
}
id
=
{
'showButtonDiv'
}
>
{
/* {
showPrint ? <Button type={"primary"} onClick={printDom}>打印</Button> : <div>正在加载打印信息, 请稍等</div>
}
*/
}
{
showPrint
?
<
ReactToPrint
trigger
=
{()
=>
<
Button
type
=
{
'primary'
}
>
打印
<
/Button>
}
content
=
{()
=>
componentRef
.
current
}
onBeforePrint
=
{()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
(
true
);
},
2000
);
});
}}
/> : <div>正在加载打印信息, 请稍等</
div
>
}
{
showPrint
&&
window
.
history
.
length
>
1
&&
<
Button
type
=
{
"danger"
}
onClick
=
{()
=>
{
<
Button
type
=
{
'danger'
}
onClick
=
{()
=>
{
window
.
history
.
go
(
-
1
);
}}
>
返回
<
/Button
>
}
<
/div
>
<
div
ref
=
{
componentRef
}
>
{
idsConfig
.
map
((
x
)
=>
{
return
(
<
div
style
=
{{
minHeight
:
'29cm'
}}
>
<
IframeForRenderForm
id
=
{
x
.
id
}
{...
props
}
/
>
<
div
style
=
{{
minHeight
:
'29cm'
,
minWidth
:
'21cm'
,
pageBreakAfter
:
'always'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
}}
>
<
IframeForRenderForm
id
=
{
x
.
id
}
{...
props
}
/
>
<
/div
>
);
})
...
...
This diff is collapsed.
Click to expand it.
FormInsertDiy/RenderForm/index.less
浏览文件 @
74559a6f
...
...
@@ -24,3 +24,9 @@
padding: 10px;
justify-content: center;
}
@media print{
table{
//min-width: 19cm !important;
//min-height: 25cm !important;
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论