gm-printer 10.37.3-beta.1 → 10.38.0

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.3-beta.1",
3
+ "version": "10.38.0",
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' />
@@ -36,18 +36,10 @@ class Store extends EditorStore {
36
36
  }
37
37
 
38
38
  getDefaultTableConfig() {
39
- console.log('getDefaultTableConfig--->')
40
39
  return {
41
40
  dataKey: this.defaultTableDataKey,
42
41
  subtotal: { show: false },
43
- columns: [
44
- {
45
- head: i18next.t('表头'),
46
- text: i18next.t('{{列.表头}}'),
47
- style: { textAlign: 'center' },
48
- headStyle: { textAlign: 'center' }
49
- }
50
- ]
42
+ columns: DEFAULT_TABLE_COLUMNS
51
43
  }
52
44
  }
53
45
 
@@ -59,6 +51,9 @@ class Store extends EditorStore {
59
51
 
60
52
  @action.bound
61
53
  addContent(name, index, type, tableConfig = null) {
54
+ if (type === 'table' && !tableConfig) {
55
+ tableConfig = this.getDefaultTableConfig()
56
+ }
62
57
  super.addContent(name, index, type, tableConfig)
63
58
  this.config = toJS(this.config)
64
59
  }
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ import '../locales'
3
3
  import Editor, { Editor2 } from './editor'
4
4
 
5
5
  import EditorPurchase from './editor_purchase'
6
- import EditorExaminingReport from './examining_report_editor'
6
+ import examiningReportEditor from './examining_report_editor'
7
7
  import EditorStockIn from './editor_stockin'
8
8
  import EditorStockOut from './editor_stockout'
9
9
  import EditorSettle from './editor_settle'
@@ -33,7 +33,7 @@ export {
33
33
  EditorStockIn,
34
34
  EditorStockOut,
35
35
  EditorPurchase,
36
- EditorExaminingReport,
36
+ examiningReportEditor,
37
37
  EditorSettle,
38
38
  EditorStatement,
39
39
  EditorAccoutStatement,
@@ -20,7 +20,13 @@ class BatchPrinter extends React.Component {
20
20
  const { list } = this.props
21
21
 
22
22
  return _.map(list, ({ config, data }, i) => (
23
- <Printer key={i} data={data} config={config} onReady={this.handleReady} />
23
+ <Printer
24
+ key={i}
25
+ data={data}
26
+ config={config}
27
+ onReady={this.handleReady}
28
+ isLast={i === list.length - 1}
29
+ />
24
30
  ))
25
31
  }
26
32
  }
@@ -374,6 +374,7 @@ class Printer extends React.Component {
374
374
  onReady,
375
375
  selectedRegion,
376
376
  printerStore,
377
+ isLast,
377
378
  ...rest
378
379
  } = this.props
379
380
  const {
@@ -390,7 +391,8 @@ class Printer extends React.Component {
390
391
  className={classNames('gm-printer', className)}
391
392
  style={Object.assign({}, style, {
392
393
  width,
393
- breakAfter: batchPrintConfig === 2 ? 'auto' : 'always'
394
+ breakAfter: batchPrintConfig === 2 || isLast ? 'auto' : 'always',
395
+ pageBreakAfter: batchPrintConfig === 2 || isLast ? 'auto' : 'always'
394
396
  })}
395
397
  >
396
398
  {this.doRender()}