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

打印修改

上级 c28e41ee
......@@ -91,28 +91,58 @@ export default class ViewPrint extends Component {
return res;
};
printOne = (review = false) => {
printOne = (optionType = 0) => {
const { printIndex, configAll, viewData } = this.state;
const { printMeth } = configAll;
const { wide, high } = configAll;
const { LODOP } = window;
let strHTML = document.getElementById(`printDomId_${printIndex}`).innerHTML;
if (review) {
strHTML = document.getElementById(`printDomId_0`).innerHTML;
let dom = document.getElementById(`printDomId-${printIndex}`);
if (optionType >= 1) {
dom = document.getElementById('printDomId-0');
}
LODOP.PRINT_INITA(0, 0, `${wide}cm`, `${high}cm`, `printDomId_${printIndex}`);
LODOP.SET_PRINT_PAGESIZE(printMeth, `${wide}cm`, `${high}cm`, 'CreateCustomPage'); // 打印方向
if (!dom) {
console.error('dom节点没找到');
return false;
}
const strHTML = dom.innerHTML;
LODOP.PRINT_INITA(
0,
0,
`${wide}cm`,
`${high}cm`,
`printDomId-${Math.random() * 10000}`,
);
LODOP.SET_PRINT_PAGESIZE(
printMeth,
`${wide}cm`,
`${high}cm`,
'CreateCustomPage',
); // 打印方向
LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', strHTML); // HTML 打印
if (review) {
switch (optionType) {
case 1:
LODOP.PREVIEW(); // 打印预览
} else {
break;
case 2:
debugger;
LODOP.PRINT_DESIGN();
break;
case 0:
LODOP.PRINT(); // 打印
break;
default:
break;
}
};
printPreview = () => {
// 打印预览
this.printOne(true);
this.printOne(1);
};
printSetUp = () => {
this.printOne(2);
};
printedDataSave = (index) => {
......@@ -143,7 +173,7 @@ export default class ViewPrint extends Component {
LODOPObj.On_Return_Remain = true;
LODOPObj.On_Return = (TaskId, Value) => {
if (Number(Value) === 1) {
message.info(`正在打印第${printIndex + 1}张`);
message.info(`正在打印第${printIndex + 1}, 共${viewData.length}`);
this.printedDataSave(printIndex);
}
this.setState({ printIndex: this.state.printIndex + 1 }, () => {
......@@ -182,7 +212,8 @@ export default class ViewPrint extends Component {
render() {
const { configAll, viewData, showWindowPrint, loading } = this.state;
if (!viewData) {
return <Shell styleShell={{ marginTop: '0', marginBottom: '20px' }}>
return (
<Shell styleShell={{ marginTop: '0', marginBottom: '20px' }}>
<div style={{ height: '54px', padding: '12px 0 12px 12px' }}>
<ButtonDiy
name={'返回'}
......@@ -191,7 +222,8 @@ export default class ViewPrint extends Component {
}}
/>
</div>
</Shell>;
</Shell>
);
}
if (!configAll.backgroundUrl) {
console.error('没有设置模版图片无法使用');
......@@ -207,7 +239,7 @@ export default class ViewPrint extends Component {
const templateInfo = templateCode.find((x) => {
return x.path === pathname;
});
if(!templateInfo){
if (!templateInfo) {
console.error('未找到templateInfo', pathname);
}
return (
......@@ -236,6 +268,18 @@ export default class ViewPrint extends Component {
}}
/>
<Authorized authority={'/jc/setting/PrintPositionSetting'}>
<span style={{ float: 'right' }}>
<ButtonDiy
name={'打印调试模式(实施)'}
handleClick={() => {
this.printSetUp();
}}
loading={loading}
/>
</span>
</Authorized>
<Authorized authority={'/jc/setting/PrintPositionSetting'}>
<span style={{ float: 'right' }}>
<ButtonDiy
......@@ -284,7 +328,7 @@ export default class ViewPrint extends Component {
}}>
{viewData.map((info, index) => {
return (
<div key={`${index}divKey`} id={`printDomId_${index}`}>
<div key={`${index}divKey`} id={`printDomId-${index}`}>
<div
style={{
position: 'relative',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论