| | |
| | | data: '', |
| | | tempId: '', |
| | | config: null, |
| | | auto: true |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | this.setState({loadingview: false, pages}) |
| | | } |
| | | |
| | | let auto = true |
| | | |
| | | if (comps[comps.length - 1].wrap && comps[comps.length - 1].wrap.printHeight) { |
| | | auto = false |
| | | } |
| | | |
| | | while (!over) { |
| | | let page = [] |
| | | let count = 0 |
| | |
| | | } else if (_pageover) { |
| | | return |
| | | } else if (item.subtype === 'datacard' || item.type === 'table') { |
| | | if (_item.dataArray && _item.dataArray.length > 0) { |
| | | if (!_item.dataArray || _item.dataArray.length === 0) return |
| | | |
| | | if (item.subtype === 'datacard' && item.wrap.layout === 'flex') { |
| | | if (!item.added && item.wrap.printHeight) { |
| | | count += item.wrap.printHeight |
| | | if (count >= limit) { |
| | | _pageover = true |
| | | } |
| | | if (count <= limit) { |
| | | _item.added = true |
| | | page.push(item) |
| | | } |
| | | } else if (!item.added) { |
| | | _item.added = true |
| | | page.push(item) |
| | | } |
| | | } else { |
| | | item.data = [] |
| | | |
| | | while (count < limit && _item.dataArray.length > 0) { |
| | | while (count + 1 <= limit && _item.dataArray.length > 0) { |
| | | item.data.push(_item.dataArray.shift()) |
| | | count++ |
| | | } |
| | |
| | | if (count >= limit) { |
| | | _pageover = true |
| | | } |
| | | page.push(item) |
| | | } |
| | | } else if (!item.added && item.wrap && item.wrap.printHeight) { |
| | | if (item.wrap.empty === 'hidden' && (!item.data || item.data.length === 0)) { |
| | | _item.added = true |
| | | return |
| | | } |
| | | |
| | | count += item.wrap.printHeight |
| | | if (count >= limit) { |
| | | _pageover = true |
| | | } |
| | | if (count <= limit) { |
| | | _item.added = true |
| | | page.push(item) |
| | | } |
| | | } else if (!item.added) { |
| | |
| | | } else if (_pageover) { |
| | | return |
| | | } else if (item.subtype === 'datacard' || item.type === 'table') { |
| | | if (_item.dataArray && _item.dataArray.length > 0) { |
| | | if (!_item.dataArray || _item.dataArray.length === 0) return |
| | | |
| | | if (item.subtype === 'datacard' && item.wrap.layout === 'flex') { |
| | | if (!item.added && item.wrap.printHeight) { |
| | | count += item.wrap.printHeight |
| | | if (count >= limit) { |
| | | _pageover = true |
| | | } |
| | | if (count <= limit) { |
| | | _item.added = true |
| | | page.push(item) |
| | | } |
| | | } else if (!item.added) { |
| | | _item.added = true |
| | | page.push(item) |
| | | } |
| | | } else { |
| | | item.data = [] |
| | | |
| | | while (count < limit && _item.dataArray.length > 0) { |
| | | while (count + 1 <= limit && _item.dataArray.length > 0) { |
| | | item.data.push(_item.dataArray.shift()) |
| | | count++ |
| | | } |
| | |
| | | if (count >= limit) { |
| | | _pageover = true |
| | | } |
| | | page.push(item) |
| | | } |
| | | } else if (!item.added && item.wrap && item.wrap.printHeight) { |
| | | if (item.wrap.empty === 'hidden' && (!item.data || item.data.length === 0)) { |
| | | _item.added = true |
| | | return |
| | | } |
| | | count += item.wrap.printHeight |
| | | if (count >= limit) { |
| | | _pageover = true |
| | | } |
| | | if (count <= limit) { |
| | | _item.added = true |
| | | page.push(item) |
| | | } |
| | | } else if (!item.added) { |
| | |
| | | } |
| | | } |
| | | |
| | | this.setState({loadingview: false, pages}) |
| | | this.setState({loadingview: false, pages, auto}) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { loadingview, viewlost, config, pages } = this.state |
| | | const { loadingview, viewlost, config, pages, auto } = this.state |
| | | |
| | | return ( |
| | | <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', boxSizing: 'border-box'}}><Row>{this.getComponents(components)}</Row></div>))} |
| | | {pages.map((components, index) => (<div className={'print-page' + (auto ? ' auto' : '')} 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} |