gm-printer 10.37.0-beta.0 → 10.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.37.0-beta.0",
3
+ "version": "10.37.2",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -72,13 +72,15 @@ class EditorTitle extends React.Component {
72
72
  }
73
73
 
74
74
  handleTestPrint = () => {
75
- const { mockData, editStore } = this.props
75
+ // 新增结款单每页合计标识,测试打印时原样透传到打印入口
76
+ const { mockData, editStore, isSomeSubtotalTr } = this.props
76
77
  doPrint(
77
78
  {
78
79
  config: toJS(editStore.config),
79
80
  data: mockData
80
81
  },
81
- true
82
+ true,
83
+ isSomeSubtotalTr
82
84
  )
83
85
  }
84
86
 
@@ -140,10 +142,14 @@ class EditorTitle extends React.Component {
140
142
  EditorTitle.propTypes = {
141
143
  onSave: PropTypes.func.isRequired,
142
144
  isPurchase: PropTypes.bool,
143
- editStore: PropTypes.object
145
+ editStore: PropTypes.object,
146
+ // 标识是否为结款单每页合计场景
147
+ isSomeSubtotalTr: PropTypes.bool
144
148
  }
145
149
  EditorTitle.defaultProps = {
146
- isPurchase: false
150
+ isPurchase: false,
151
+ // 默认按非结款单每页合计场景处理
152
+ isSomeSubtotalTr: false
147
153
  }
148
154
 
149
155
  EditorTitle.wrappedComponent.propTypes = {
@@ -42,7 +42,8 @@ class Editor extends React.Component {
42
42
 
43
43
  {showEditor && (
44
44
  <div className='gm-printer-edit-zone'>
45
- <EditorTitle onSave={onSave} />
45
+ {/* 透传结款单每页合计标识给标题区,用于测试打印时走对应逻辑 */}
46
+ <EditorTitle onSave={onSave} isSomeSubtotalTr={isSomeSubtotalTr} />
46
47
  <Gap height='10px' />
47
48
  <EditorSelect />
48
49
  <Gap height='5px' />
@@ -1,5 +1,5 @@
1
1
  import i18next from '../../locales'
2
- import { action, observable, computed, toJS } from 'mobx'
2
+ import { action, observable, computed } from 'mobx'
3
3
  import {
4
4
  getSumTrHeight,
5
5
  isMultiTable,
@@ -530,7 +530,7 @@ class PrinterStore {
530
530
  })({
531
531
  ...this.data.common,
532
532
  [i18next.t('当前页码')]: pageIndex + 1,
533
- [i18next.t('页码总数')]: this.pages.length,
533
+ [i18next.t('页码总数')]: Math.max(1, this.pages.length),
534
534
  price: price
535
535
  })
536
536
  } catch (err) {
@@ -604,7 +604,7 @@ class PrinterStore {
604
604
 
605
605
  [i18next.t('列')]: list[index],
606
606
  [i18next.t('当前页码')]: pageIndex + 1,
607
- [i18next.t('页码总数')]: this.pages.length,
607
+ [i18next.t('页码总数')]: Math.max(1, this.pages.length),
608
608
  price: price // 提供一个价格处理函数
609
609
  })
610
610
  } catch (err) {
@@ -626,7 +626,7 @@ class PrinterStore {
626
626
  ...this.data.common,
627
627
  [i18next.t('列')]: list[index],
628
628
  [i18next.t('当前页码')]: pageIndex + 1,
629
- [i18next.t('页码总数')]: this.pages.length,
629
+ [i18next.t('页码总数')]: Math.max(1, this.pages.length),
630
630
  price: price // 提供一个价格处理函数
631
631
  })
632
632
  res =