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

打印纸张高度 宽度配置单位修改为厘米了

上级 ef296829
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
import React, { Fragment, Component } from 'react'; import React, { Fragment, Component } from 'react';
import styles from './index.less'; import styles from './index.less';
import { imageStyleAll, A4Height, A4Width } from './ViewPrint/config';
export default class Index extends Component { export default class Index extends Component {
constructor(props) { constructor(props) {
...@@ -124,8 +126,8 @@ export default class Index extends Component { ...@@ -124,8 +126,8 @@ export default class Index extends Component {
} = this.props; } = this.props;
const imageStyle = { const imageStyle = {
height: high || '902px', height: `${high}cm` || A4Height,
width: wide || 'auto', width: `${wide}cm` || A4Width,
}; };
return ( return (
...@@ -143,10 +145,7 @@ export default class Index extends Component { ...@@ -143,10 +145,7 @@ export default class Index extends Component {
id={'dropZone'} id={'dropZone'}
draggable={false} draggable={false}
className={styles.bgimage} className={styles.bgimage}
style={{ style={imageStyleAll}
width: 'auto',
height: '100%',
}}
alt={'背景图'} alt={'背景图'}
/> />
{config.map((item, index) => { {config.map((item, index) => {
......
export const A4Height = '29.6cm';
export const A4Width = '20.9cm';
export const imageStyleAll = {
width: '100%',
height: '100%',
};
...@@ -8,6 +8,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy'; ...@@ -8,6 +8,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import router from 'umi/router'; import router from 'umi/router';
import styles from '../index.less'; import styles from '../index.less';
import DetailDom from './DetailDom'; import DetailDom from './DetailDom';
import { imageStyleAll, A4Width, A4Height } from './config';
export default class ViewPrint extends Component { export default class ViewPrint extends Component {
constructor(props) { constructor(props) {
...@@ -101,7 +102,8 @@ export default class ViewPrint extends Component { ...@@ -101,7 +102,8 @@ export default class ViewPrint extends Component {
const ids = selectedRows.map((x) => { const ids = selectedRows.map((x) => {
return x.id; return x.id;
}); });
if (configAll.callUrl && false) { // 暂时关闭调用这个接口 不通知后台是否打印了 if (configAll.callUrl && false) {
// 暂时关闭调用这个接口 不通知后台是否打印了
getInfo({ ids: ids.join(',') }, configAll.callUrl).then((x) => { getInfo({ ids: ids.join(',') }, configAll.callUrl).then((x) => {
if (x) { if (x) {
this.setState({ showWindowPrint: true }, () => { this.setState({ showWindowPrint: true }, () => {
...@@ -136,9 +138,10 @@ export default class ViewPrint extends Component { ...@@ -136,9 +138,10 @@ export default class ViewPrint extends Component {
} }
const { hasPrintBackground, backgroundUrl, wide, high } = configAll; const { hasPrintBackground, backgroundUrl, wide, high } = configAll;
const imageStyle = { const imageStyle = {
height: high || '902px', height: `${high}cm` || A4Height,
width: wide || 'auto', width: `${wide}cm` || A4Width,
}; };
return ( return (
<Fragment> <Fragment>
<Shell styleShell={{ marginTop: '0', marginBottom: '20px' }}> <Shell styleShell={{ marginTop: '0', marginBottom: '20px' }}>
...@@ -176,21 +179,18 @@ export default class ViewPrint extends Component { ...@@ -176,21 +179,18 @@ export default class ViewPrint extends Component {
<div> <div>
{viewData.map((info, index) => { {viewData.map((info, index) => {
return ( return (
<div className={styles.outSideDivPrint} <div
className={styles.outSideDivPrint}
key={index + 'divKey'} key={index + 'divKey'}
style={{ style={{
...imageStyle, ...imageStyle,
}} }}>
>
<img <img
src={backgroundUrl} src={backgroundUrl}
draggable={false} draggable={false}
className={styles.bgimagePrint} className={styles.bgimagePrint}
alt={'背景图'} alt={'背景图'}
style={{ style={imageStyleAll}
width: 'auto',
height: '100%',
}}
/> />
{this.detailDom(info)} {this.detailDom(info)}
</div> </div>
...@@ -204,7 +204,7 @@ export default class ViewPrint extends Component { ...@@ -204,7 +204,7 @@ export default class ViewPrint extends Component {
<div <div
ref={(node) => (this.content = node)} ref={(node) => (this.content = node)}
style={{ style={{
display: showWindowPrint ? 'block' : 'none', display: showWindowPrint /*|| true*/ ? 'block' : 'none',
}}> }}>
{viewData.map((info, index) => { {viewData.map((info, index) => {
return ( return (
...@@ -213,18 +213,15 @@ export default class ViewPrint extends Component { ...@@ -213,18 +213,15 @@ export default class ViewPrint extends Component {
key={`${index}divKey`} key={`${index}divKey`}
style={{ style={{
...imageStyle, ...imageStyle,
}} }}>
>
{hasPrintBackground ? ( {hasPrintBackground ? (
<img <img
src={backgroundUrl} src={backgroundUrl}
draggable={false} draggable={false}
className={styles.bgimagePrint} className={styles.bgimagePrint}
alt={'背景图'} alt={'背景图'}
style={{ style={imageStyleAll}
width: 'auto', />
height: '100%',
}}/>
) : null} ) : null}
{this.detailDom(info)} {this.detailDom(info)}
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
.outSideDivPrint{ .outSideDivPrint{
position: relative; position: relative;
width: auto; width: auto;
margin-bottom: 10px; //margin-bottom: 10px;
page-break-after: always; page-break-after: always;
.bgimagePrint{ .bgimagePrint{
height: auto; height: auto;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论