提交 9934afe4 authored 作者: 钟是志's avatar 钟是志

打印效果修改

上级 c8378d7f
......@@ -23,6 +23,7 @@ export default class ViewPrint extends Component {
loading: true,
printIndex: 0,
showWindowPrint: false,
preaparePrint: false,
};
this.getConfigInfo = queryConfig.bind(this);
}
......@@ -95,11 +96,12 @@ export default class ViewPrint extends Component {
printOne = (optionType = 0) => {
const { printIndex, configAll, viewData } = this.state;
let { info } = configAll;
if(isJSON(info)){
if (isJSON(info)) {
info = JSON.parse(info);
}else{
} else {
info = defaultConfigInfo;
}
console.log(info);
const { printMeth } = configAll;
const { wide, high } = configAll;
const { LODOP } = window;
......@@ -111,11 +113,12 @@ export default class ViewPrint extends Component {
console.error('dom节点没找到');
return false;
}
console.log(wide, high);
const strHTML = dom.innerHTML;
LODOP.SET_SHOW_MODE('LANGUAGE', 0);
LODOP.SET_LICENSES('成都市知用科技有限公司', '649677881727389907689190562356', '', '');
LODOP.PRINT_INITA(0, 0, `${wide}cm`, `${high}cm`, `printDomId${printIndex}`);
// LODOP.PRINT_INITA(0, 0, `${wide}cm`, `${high}cm`, `printDomId${printIndex}`);
LODOP.PRINT_INIT(`${Math.random() * 10000 + 'test'}`);
LODOP.SET_PRINT_MODE('RESELECT_PAGESIZE', true);
LODOP.SET_PRINT_PAGESIZE(printMeth, info.paperWidth, info.paperHeight, 'CreateCustomPage'); // 打印方向 纸张大小.
LODOP.ADD_PRINT_HTML(0, 0, '100%', '100%', strHTML); // HTML 打印
switch (optionType) {
......@@ -207,7 +210,7 @@ export default class ViewPrint extends Component {
};
render() {
const { configAll, viewData, showWindowPrint, loading } = this.state;
const { configAll, viewData, showWindowPrint, loading, preaparePrint } = this.state;
if (!viewData) {
return (
<Shell styleShell={{ marginTop: '0', marginBottom: '20px' }}>
......@@ -247,42 +250,50 @@ export default class ViewPrint extends Component {
name={'打印设备选择'}
handleClick={() => {
window.LODOP.SELECT_PRINTER();
this.setState({
preaparePrint: true,
});
}}
loading={loading}
/>
<ButtonDiy
name={'打印'}
name={'打印预览'}
handleClick={() => {
this.printByLodop();
if (!preaparePrint) {
message.warning('请先选择打印设备');
return false;
}
this.printPreview();
}}
loading={loading}
/>
<ButtonDiy
name={'返回'}
name={'打印'}
handleClick={() => {
router.goBack();
if (!preaparePrint) {
message.warning('请先选择打印设备');
return false;
}
this.printByLodop();
}}
loading={loading}
/>
<Authorized authority={'/jc/setting/PrintPositionSetting'}>
<span style={{ float: 'right' }}>
<ButtonDiy
name={'打印调试模式(实施)'}
name={'返回'}
handleClick={() => {
this.printSetUp();
router.goBack();
}}
loading={loading}
/>
</span>
</Authorized>
<Authorized authority={'/jc/setting/PrintPositionSetting'}>
<span style={{ float: 'right' }}>
<ButtonDiy
name={'打印预览(实施)'}
name={'打印调试模式(实施)'}
handleClick={() => {
this.printPreview();
this.printSetUp();
}}
loading={loading}
/>
......@@ -331,7 +342,7 @@ export default class ViewPrint extends Component {
<div
style={{
position: 'relative',
// pageBreakAfter: 'always',
pageBreakAfter: 'avoid',
...imageStyle,
backgroundColor: '#fff',
}}>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论