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

打印修改

上级 0705985e
...@@ -112,7 +112,12 @@ export default function DetailDom({ config, data }) { ...@@ -112,7 +112,12 @@ export default function DetailDom({ config, data }) {
}; };
if (transform) { if (transform) {
styleOutSide.transform = `rotate(${transform}deg)`; styleOutSide.transform = `rotate(${transform}deg)`;
styleOutSide.WebkitTransform = `rotate(${transform}deg)`;
styleOutSide.MozTransform = `rotate(${transform}deg)`;
styleOutSide.MsTransform = `rotate(${transform}deg)`;
// styleOutSide.MsFilter = "progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=1.2246467991473532e-16, M21=-1.2246467991473532e-16, M22=-1, SizingMethod='auto expand')";
} }
const outSideDom = (children) => { const outSideDom = (children) => {
return ( return (
<div <div
......
...@@ -2,23 +2,23 @@ import { message } from 'antd'; ...@@ -2,23 +2,23 @@ import { message } from 'antd';
import { ModalConfirm, ModalInfo } from '@/baseComponent/Modal'; import { ModalConfirm, ModalInfo } from '@/baseComponent/Modal';
import * as lo from './LodopFuncs'; import * as lo from './LodopFuncs';
export const A4Height = '28.7cm'; export const A4Height = '29.7cm';
export const A4Width = '19.8cm'; export const A4Width = '21cm';
export const imageStyleAll = { export const imageStyleAll = {
width: '100%', width: '100%',
// height: '100%', // height: '100%',
}; };
export const defaultConfigInfo = {
paperHeight: A4Height,
paperWidth: A4Width,
};
export function getCLodopFuncJS() { export function getCLodopFuncJS() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(true); resolve(true);
}); });
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (window.LODOP) { if (window.LODOP) {
console.log('打印插件加载成功'); console.log('打印插件加载成功');
......
...@@ -6,10 +6,11 @@ import Shell from '@/baseComponent/Shell'; ...@@ -6,10 +6,11 @@ import Shell from '@/baseComponent/Shell';
import ButtonDiy from '@/baseComponent/ButtonDiy'; import ButtonDiy from '@/baseComponent/ButtonDiy';
import router from 'umi/router'; import router from 'umi/router';
import DetailDom from './DetailDom'; import DetailDom from './DetailDom';
import { A4Width, A4Height, getCLodopFuncJS, templateCode } from './config'; import { A4Width, A4Height, getCLodopFuncJS, templateCode, defaultConfigInfo } from './config';
import RenderAuthorized from '@/components/Authorized'; import RenderAuthorized from '@/components/Authorized';
import { getAuthority } from '@/utils/authority'; import { getAuthority } from '@/utils/authority';
import { ModalInfo } from '@/baseComponent/Modal'; import { ModalInfo } from '@/baseComponent/Modal';
import { isJSON } from '@/webPublic/one_stop_public/copy';
const Authorized = RenderAuthorized(getAuthority()); const Authorized = RenderAuthorized(getAuthority());
...@@ -93,6 +94,12 @@ export default class ViewPrint extends Component { ...@@ -93,6 +94,12 @@ export default class ViewPrint extends Component {
printOne = (optionType = 0) => { printOne = (optionType = 0) => {
const { printIndex, configAll, viewData } = this.state; const { printIndex, configAll, viewData } = this.state;
let { info } = configAll;
if(isJSON(info)){
info = JSON.parse(info);
}else{
info = defaultConfigInfo;
}
const { printMeth } = configAll; const { printMeth } = configAll;
const { wide, high } = configAll; const { wide, high } = configAll;
const { LODOP } = window; const { LODOP } = window;
...@@ -106,20 +113,9 @@ export default class ViewPrint extends Component { ...@@ -106,20 +113,9 @@ export default class ViewPrint extends Component {
} }
console.log(wide, high); console.log(wide, high);
const strHTML = dom.innerHTML; const strHTML = dom.innerHTML;
LODOP.PRINT_INITA( LODOP.PRINT_INITA(0, 0, `${wide}cm`, `${high}cm`, `printDomId${printIndex}`);
0, LODOP.SET_PRINT_PAGESIZE(printMeth, info.paperWidth, info.paperHeight, 'CreateCustomPage'); // 打印方向 纸张大小.
0, LODOP.ADD_PRINT_HTML(0, 0, '100%', '100%', strHTML); // HTML 打印
`${wide}cm`,
`${high}cm`,
`printDomId-djkfgjkdlfg`,
);
LODOP.SET_PRINT_PAGESIZE(
printMeth,
`${wide}cm`,
`${high}cm`,
'CreateCustomPage',
); // 打印方向
LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', strHTML); // HTML 打印
console.log(strHTML); console.log(strHTML);
switch (optionType) { switch (optionType) {
case 1: case 1:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论