| | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | loadingview: true, |
| | | printing: false, |
| | | pages: null, |
| | | BID: '', |
| | | data: '', |
| | |
| | | horizontal: 1200, |
| | | verticaldefault: 1.45789, |
| | | verticalwithout: 1.41428, |
| | | horizontaldefault: 0.685, |
| | | horizontaldefault: 0.683, |
| | | horizontalwithout: 0.705, |
| | | }, |
| | | A3: { |
| | |
| | | } |
| | | |
| | | print = () => { |
| | | const { config } = this.state |
| | | const { config, printing } = this.state |
| | | |
| | | if (printing) return |
| | | |
| | | let jubuData = document.getElementById('bill-print').innerHTML |
| | | |
| | | this.setState({printing: true}) |
| | | |
| | | try { |
| | | let iframe = document.createElement('IFRAME') |
| | |
| | | doc.write(`</body></html>`) |
| | | doc.close() |
| | | |
| | | iframe.contentWindow.focus() |
| | | iframe.contentWindow.print() |
| | | |
| | | document.body.removeChild(iframe) |
| | | |
| | | setTimeout(() => { |
| | | window.close() |
| | | }, 2000) |
| | | iframe.contentWindow.focus() |
| | | iframe.contentWindow.print() |
| | | |
| | | document.body.removeChild(iframe) |
| | | |
| | | setTimeout(() => { |
| | | window.close() |
| | | }, 2000) |
| | | }, 500) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | <div className="bill-print-wrap" > |
| | | {loadingview && <Spin size="large" />} |
| | | {pages ? <div id="bill-print"> |
| | | {pages.map((components, index) => (<div className="print-page" key={index} style={{...config.style, overflow: 'hidden'}}><Row>{this.getComponents(components)}</Row></div>))} |
| | | {pages.map((components, index) => (<div className="print-page" key={index} style={{...config.style, overflow: 'hidden', boxSizing: 'border-box'}}><Row>{this.getComponents(components)}</Row></div>))} |
| | | </div> : null} |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | {pages && !loadingview && !viewlost ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null} |