|
@@ -15,7 +15,7 @@
|
|
|
<tr>
|
|
|
<td>
|
|
|
<div class="print-box" style="width: 564pt;margin-left:1.5pt;">
|
|
|
- <div style="text-align:center;margin:15pt 0 5pt;font-size:22px;font-weight: bold;">收款通知单</div>
|
|
|
+ <div style="text-align:center;margin:5pt 0;font-size:22px;font-weight: bold;">收款通知单</div>
|
|
|
<div>
|
|
|
<div>
|
|
|
<table border="1" style="width: 564pt;border-collapse: collapse;text-align: center;">
|
|
@@ -82,7 +82,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { jGPlPrint } from '@/libs/JGPrint.js'
|
|
|
+import { jGPlPrint, groupLessThan } from '@/libs/JGPrint.js'
|
|
|
import moment from 'moment'
|
|
|
export default {
|
|
|
data () {
|
|
@@ -106,12 +106,13 @@ export default {
|
|
|
handleCommonOk () {
|
|
|
const _this = this
|
|
|
const html = document.getElementsByClassName('sendGood-print-box')
|
|
|
+ const pageHeight = 535
|
|
|
const printCons = []
|
|
|
for (let i = 0; i < html.length; i++) {
|
|
|
const h = html[i].clientHeight
|
|
|
printCons.push({
|
|
|
- h: h,
|
|
|
- t: html[i].innerHTML
|
|
|
+ h: h<=pageHeight?pageHeight:h,
|
|
|
+ t: '<div style="height:'+(h<=pageHeight?(pageHeight+'px'):'auto')+';">'+html[i].innerHTML+'</div>'
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -120,19 +121,13 @@ export default {
|
|
|
return a['h'] - b['h']
|
|
|
})
|
|
|
|
|
|
- const htmlStr = []
|
|
|
- for (let i = 0; i < printCons.length; i++) {
|
|
|
- if (printCons[i].h > 560) {
|
|
|
- htmlStr.push('')
|
|
|
- }else{
|
|
|
- printCons[i].t = '<div style="width:564pt;margin:0 auto;height:535px;">' +printCons[i].t+'</div>'
|
|
|
- }
|
|
|
- htmlStr.push(printCons[i].t)
|
|
|
- }
|
|
|
+ // 自动排版
|
|
|
+ const htmlStr = groupLessThan(printCons, pageHeight*2)
|
|
|
+ // console.log(htmlStr.join('').split('&-NEWPAGE-&'))
|
|
|
this.$store.state.app.curActionPermission = 'B_SkPrint'
|
|
|
// html, type, callback, printLogParams
|
|
|
this.spinning = true
|
|
|
- jGPlPrint(htmlStr, 'print', function (res) {
|
|
|
+ jGPlPrint(htmlStr.join('').split('&-NEWPAGE-&'), 'preview', function (res) {
|
|
|
if(res){
|
|
|
_this.handleCommonCancel()
|
|
|
}
|