gm-printer 10.28.0-beta.1 → 10.28.0-beta.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/.eslintcache ADDED
@@ -0,0 +1 @@
1
+ [{"/Users/joke/Desktop/gm-printer/src/printer/printer.js":"1","/Users/joke/Desktop/gm-printer/src/printer/page.js":"2","/Users/joke/Desktop/gm-printer/src/printer/long_print_table/index.js":"3","/Users/joke/Desktop/gm-printer/src/editor/context_menu.js":"4","/Users/joke/Desktop/gm-printer/src/config.js":"5","/Users/joke/Desktop/gm-printer/src/common/editor_select.js":"6","/Users/joke/Desktop/gm-printer/src/common/editor_edit_field.js":"7","/Users/joke/Desktop/gm-printer/src/common/common_context_menu.js":"8"},{"size":12305,"mtime":1728981026281},{"size":1899,"mtime":1728981006613},{"size":11905,"mtime":1728980840768,"results":"9","hashOfConfig":"10"},{"size":6329,"mtime":1728980977665},{"size":3185,"mtime":1728980903446},{"size":6042,"mtime":1728980953458,"results":"11","hashOfConfig":"10"},{"size":24316,"mtime":1728980939561},{"size":9821,"mtime":1728980917598,"results":"12","hashOfConfig":"10"},{"filePath":"13","messages":"14","errorCount":4,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"1ho4xzn",{"filePath":"15","messages":"16","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/joke/Desktop/gm-printer/src/printer/long_print_table/index.js",["19","20","21","22"],"/Users/joke/Desktop/gm-printer/src/common/editor_select.js",[],"/Users/joke/Desktop/gm-printer/src/common/common_context_menu.js",[],{"ruleId":"23","severity":2,"message":"24","line":100,"column":26,"nodeType":"25","endLine":100,"endColumn":33},{"ruleId":"26","severity":2,"message":"27","line":240,"column":5,"nodeType":"28","endLine":339,"endColumn":6},{"ruleId":"29","severity":2,"message":"30","line":257,"column":22,"nodeType":"25","messageId":"31","endLine":257,"endColumn":32},{"ruleId":"29","severity":2,"message":"30","line":297,"column":30,"nodeType":"25","messageId":"31","endLine":297,"endColumn":40},"no-unused-vars","'dataKey' is assigned a value but never used.","Identifier","no-unreachable","Unreachable code.","ReturnStatement","no-undef","'getTdStyle' is not defined.","undef"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.28.0-beta.1",
3
+ "version": "10.28.0-beta.2",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  import i18next from '../../locales'
2
2
  import React, { useEffect } from 'react'
3
3
  import PropTypes from 'prop-types'
4
- import { tableClassNameList } from '../config'
4
+ import { tableClassNameList, LONG_PRINT } from '../config'
5
5
  import _ from 'lodash'
6
6
  import { Hr, ImageUploader } from '../common/component'
7
7
  import { observer, inject } from 'mobx-react'
@@ -192,7 +192,7 @@ class CommonContextMenu extends React.Component {
192
192
  const { className } = editStore.config.contents[arr[2]]
193
193
  const isActive = c => className === c
194
194
  const { config } = editStore
195
- const isLongPrint = config?.page?.type === 'longPrint'
195
+ const isLongPrint = config?.page?.type === LONG_PRINT
196
196
  return (
197
197
  <>
198
198
  {renderTableAction && (
@@ -205,16 +205,21 @@ class CommonContextMenu extends React.Component {
205
205
  <div onClick={this.handleRemove}>{i18next.t('移除列')}</div>
206
206
  <Hr />
207
207
 
208
- {!isLongPrint && <> {_.map(tableClassNameList, o => (
209
- <div
210
- onClick={this.handleSetTableConfig.bind(this, o.value)}
211
- key={o.value}
212
- className={isActive(o.value) ? 'active' : ''}
213
- >
214
- {o.text}
215
- </div>
216
- ))} <Hr /></>}
217
-
208
+ {!isLongPrint && (
209
+ <>
210
+ {' '}
211
+ {_.map(tableClassNameList, o => (
212
+ <div
213
+ onClick={this.handleSetTableConfig.bind(this, o.value)}
214
+ key={o.value}
215
+ className={isActive(o.value) ? 'active' : ''}
216
+ >
217
+ {o.text}
218
+ </div>
219
+ ))}{' '}
220
+ <Hr />
221
+ </>
222
+ )}
218
223
 
219
224
  <div onClick={this.handleAddContent.bind(this, 0, '')}>
220
225
  {i18next.t('向上插入区域块')}
@@ -20,6 +20,7 @@ import {
20
20
  import { get, toJS } from 'mobx'
21
21
  import PropTypes from 'prop-types'
22
22
  import { subtotalRadioList } from './util'
23
+ import { LONG_PRINT } from '../config'
23
24
  import _ from 'lodash'
24
25
 
25
26
  @inject('editStore')
@@ -199,7 +200,8 @@ class EditorField extends React.Component {
199
200
  renderTable() {
200
201
  const { tableDataKeyList, editStore, isSomeSubtotalTr } = this.props
201
202
  const { head, headStyle, text, style } = editStore.computedSelectedInfo
202
-
203
+ const { config } = editStore
204
+ const isLongPrint = config?.page?.type === LONG_PRINT
203
205
  const {
204
206
  specialConfig,
205
207
  subtotal,
@@ -362,19 +364,21 @@ class EditorField extends React.Component {
362
364
 
363
365
  <Gap height='5px' />
364
366
 
365
- <Flex alignCenter>
366
- <Flex alignCenter>{i18next.t('表格样式')}:</Flex>
367
- <Select
368
- className='gm-printer-edit-select'
369
- value={editStore.tableCustomStyle}
370
- onChange={editStore.changeTableCustomStyle}
371
- >
372
- <Option value='default'>{i18next.t('默认样式')}</Option>
373
- <Option value='className0'>{i18next.t('样式一')}</Option>
374
- <Option value='className1'>{i18next.t('样式二')}</Option>
375
- <Option value='className2'>{i18next.t('样式三')}</Option>
376
- </Select>
377
- </Flex>
367
+ {!isLongPrint && (
368
+ <Flex alignCenter>
369
+ <Flex alignCenter>{i18next.t('表格样式')}:</Flex>
370
+ <Select
371
+ className='gm-printer-edit-select'
372
+ value={editStore.tableCustomStyle}
373
+ onChange={editStore.changeTableCustomStyle}
374
+ >
375
+ <Option value='default'>{i18next.t('默认样式')}</Option>
376
+ <Option value='className0'>{i18next.t('样式一')}</Option>
377
+ <Option value='className1'>{i18next.t('样式二')}</Option>
378
+ <Option value='className2'>{i18next.t('样式三')}</Option>
379
+ </Select>
380
+ </Flex>
381
+ )}
378
382
 
379
383
  <Gap height='5px' />
380
384
 
@@ -2,12 +2,9 @@ import i18next from '../../locales'
2
2
  import React from 'react'
3
3
  import { observer, inject } from 'mobx-react'
4
4
  import { Flex, Option, Select } from '../components'
5
- import {
6
- RadioGroup,
7
- Radio,
8
- } from '@gmfe/react'
5
+ import { RadioGroup, Radio } from '@gmfe/react'
9
6
  import { InputWithUnit } from '../common/component'
10
- import { pageTypeMap, printDirectionList } from '../config'
7
+ import { pageTypeMap, printDirectionList, LONG_PRINT } from '../config'
11
8
  import _ from 'lodash'
12
9
  import { dispatchMsg } from '../util'
13
10
  import PropTypes from 'prop-types'
@@ -19,7 +16,7 @@ class EditorSelector extends React.Component {
19
16
  this.props.editStore.setConfigName(e.target.value)
20
17
  }
21
18
 
22
- handleConfigIsFixLastFooter = (_val) => {
19
+ handleConfigIsFixLastFooter = _val => {
23
20
  this.props.editStore.setConfigIsFixLastFooter(_val)
24
21
  }
25
22
 
@@ -45,13 +42,19 @@ class EditorSelector extends React.Component {
45
42
 
46
43
  render() {
47
44
  const {
48
- config: { name, page, batchPrintConfig, isFixLastFooter, showDiyOverAllOrder },
45
+ config: {
46
+ name,
47
+ page,
48
+ batchPrintConfig,
49
+ isFixLastFooter,
50
+ showDiyOverAllOrder
51
+ },
49
52
  computedRegionList,
50
53
  computedSelectedRegionTip,
51
54
  selectedRegion
52
55
  } = this.props.editStore
53
56
  const isDIY = page.type === 'DIY'
54
- const isLongPrint = page.type === 'longPrint'
57
+ const isLongPrint = page.type === LONG_PRINT
55
58
  return (
56
59
  <div>
57
60
  <Flex alignCenter>
@@ -102,20 +105,22 @@ class EditorSelector extends React.Component {
102
105
  />
103
106
  </Flex>
104
107
  )}
105
- {!isLongPrint && <Flex alignCenter className='gm-padding-top-5'>
106
- <div>{i18next.t('打印布局')}:</div>
107
- <Select
108
- className='gm-printer-edit-select'
109
- value={page.printDirection}
110
- onChange={this.handlePrintDirection}
111
- >
112
- {_.map(printDirectionList, v => (
113
- <Option key={v.value} value={v.value}>
114
- {v.text}
115
- </Option>
116
- ))}
117
- </Select>
118
- </Flex>}
108
+ {!isLongPrint && (
109
+ <Flex alignCenter className='gm-padding-top-5'>
110
+ <div>{i18next.t('打印布局')}:</div>
111
+ <Select
112
+ className='gm-printer-edit-select'
113
+ value={page.printDirection}
114
+ onChange={this.handlePrintDirection}
115
+ >
116
+ {_.map(printDirectionList, v => (
117
+ <Option key={v.value} value={v.value}>
118
+ {v.text}
119
+ </Option>
120
+ ))}
121
+ </Select>
122
+ </Flex>
123
+ )}
119
124
 
120
125
  <Flex alignCenter className='gm-padding-top-5'>
121
126
  <div>{i18next.t('选择区域')}:</div>
@@ -156,21 +161,25 @@ class EditorSelector extends React.Component {
156
161
  </>
157
162
  )}
158
163
 
159
- {
160
- showDiyOverAllOrder !== undefined && <Flex alignCenter className='gm-padding-top-5'>
161
- <label htmlFor={1}>{'是否固定末页签名和页脚区域:'}</label>
164
+ {showDiyOverAllOrder !== undefined && (
165
+ <Flex alignCenter className='gm-padding-top-5'>
166
+ <label htmlFor={1}>是否固定末页签名和页脚区域:</label>
162
167
  <RadioGroup
163
168
  name='isFixFooter'
164
169
  value={isFixLastFooter}
165
170
  inline
166
171
  onChange={this.handleConfigIsFixLastFooter}
167
- className="gm-flex"
172
+ className='gm-flex'
168
173
  >
169
- <Radio value={true} style={{ display: 'flex', marginRight: 10 }}><span style={{ marginLeft: 5 }}>是</span></Radio>
170
- <Radio value={false} style={{ display: 'flex' }}><span style={{ marginLeft: 5 }}>否</span></Radio>
174
+ <Radio value style={{ display: 'flex', marginRight: 10 }}>
175
+ <span style={{ marginLeft: 5 }}>是</span>
176
+ </Radio>
177
+ <Radio value={false} style={{ display: 'flex' }}>
178
+ <span style={{ marginLeft: 5 }}>否</span>
179
+ </Radio>
171
180
  </RadioGroup>
172
181
  </Flex>
173
- }
182
+ )}
174
183
 
175
184
  <Flex className='gm-padding-top-5 gm-text-red' column>
176
185
  {computedSelectedRegionTip}
package/src/config.js CHANGED
@@ -1,4 +1,7 @@
1
1
  import i18next from '../locales'
2
+
3
+ export const LONG_PRINT = 'longPrint'
4
+
2
5
  export const pageTypeMap = {
3
6
  A4: {
4
7
  name: 'A4',
@@ -79,7 +82,7 @@ export const pageTypeMap = {
79
82
  }
80
83
  },
81
84
  // 新增长条打印配置选项
82
- 'longPrint': {
85
+ [LONG_PRINT]: {
83
86
  name: i18next.t('长条打印'),
84
87
  size: {
85
88
  width: '80mm',
@@ -87,10 +90,10 @@ export const pageTypeMap = {
87
90
  },
88
91
  printDirection: 'vertical',
89
92
  gap: {
90
- paddingTop: '5mm',
91
- paddingRight: '5mm',
92
- paddingBottom: '5mm',
93
- paddingLeft: '5mm'
93
+ paddingTop: '2mm',
94
+ paddingRight: '2mm',
95
+ paddingBottom: '2mm',
96
+ paddingLeft: '2mm'
94
97
  }
95
98
  },
96
99
  DIY: {
@@ -6,6 +6,7 @@ import { inject, observer } from 'mobx-react'
6
6
  import _ from 'lodash'
7
7
  import { Printer } from '../printer'
8
8
  import { isMultiTable } from '../util'
9
+ import { LONG_PRINT } from '../config'
9
10
 
10
11
  const blockTypeList = [
11
12
  { value: '', text: i18next.t('插入文本') },
@@ -123,16 +124,18 @@ class ContextMenu extends React.Component {
123
124
  const isOverallOrder = overallOrder?.show
124
125
  const isDiyOverallOrder = diyOverallOrder?.show
125
126
  // 长条打印
126
- const isLongPrint = type === 'longPrint'
127
+ const isLongPrint = type === LONG_PRINT
127
128
 
128
129
  return (
129
130
  <>
130
- {!isLongPrint && <div
131
- onClick={this.handleChangeTableDataKey.bind(this, 'multi', name)}
132
- className={isMultiActive ? 'active' : ''}
133
- >
134
- {i18next.t('双栏商品')}
135
- </div>}
131
+ {!isLongPrint && (
132
+ <div
133
+ onClick={this.handleChangeTableDataKey.bind(this, 'multi', name)}
134
+ className={isMultiActive ? 'active' : ''}
135
+ >
136
+ {i18next.t('双栏商品')}
137
+ </div>
138
+ )}
136
139
  {/* 三分纸高度太小,做不了三栏,会死循环 */}
137
140
  {type !== 'A4/3' && !isLongPrint && (
138
141
  <div
@@ -6,7 +6,7 @@ import {
6
6
  getDataKey,
7
7
  getHeight,
8
8
  getTableColumnName,
9
- getWidth,
9
+ getWidth
10
10
  } from '../../util'
11
11
  import { inject, observer } from 'mobx-react'
12
12
  import classNames from 'classnames'
@@ -82,7 +82,7 @@ class Table extends React.Component {
82
82
 
83
83
  handleDrop = e => {
84
84
  const { index } = e.target.dataset
85
- console.log(this.state.index, index);
85
+ console.log(this.state.index, index)
86
86
  if (this.state.index !== index) {
87
87
  dispatchMsg('gm-printer-table-drag', {
88
88
  source: this.state.index,
@@ -148,85 +148,94 @@ class Table extends React.Component {
148
148
  )
149
149
  }
150
150
 
151
- return (<div style={{ tableLayout: 'inherit', wordBreak: 'break-all' }}>
152
- {_.map(_.range(range.begin, range.end), i => {
153
- const _special = tableData[i] && tableData[i]._special
154
- const _specialText = tableData[i] && tableData[i]._specialText
155
- if (_specialText)
156
- return <CategoryTr key={i} config={config} data={_specialText} />
157
- if (_special)
158
- return <SpecialTr key={i} config={config} data={_special} />
159
- // 如果项为空对象展现一个占满一行的td
160
- const isItemNone = !_.keys(tableData[i]).length
161
- console.log(columns, "columns");
162
- return (
163
- <div key={i} style={{ borderTop: '1px dashed black' }}>
164
- {isItemNone ? (
165
- null
166
- ) : (
167
- _.map(columns, (col, j) => {
168
- return (
169
- <div
170
- key={j}
171
- data-name={getTableColumnName(name, col.index)}
172
- data-index={col.index}
173
- onClick={this.handleClick}
174
- draggable
175
- onDragStart={this.handleDragStart}
176
- onDrop={this.handleDrop}
177
- onDragOver={this.handleDragOver}
178
- style={{ padding: "2px 0" }}
179
- className={classNames("long_print_table_row", {
180
- active:
181
- getTableColumnName(name, col.index) ===
182
- printerStore.selected
183
- })}>
184
- <span
185
- data-name={getTableColumnName(name, col.index)}
186
- data-index={col.index}
187
- onClick={this.handleClick}
188
- style={{ ...col.headStyle }}>{col.head}:</span>
189
- <span
190
- style={{
191
- ...col.style
192
- }}
193
- data-name={getTableColumnName(name, col.index)}
194
- data-index={col.index}
195
- onClick={this.handleClick}
196
- dangerouslySetInnerHTML={{
197
- __html: col.isSpecialColumn
198
- ? printerStore.templateSpecialDetails(
199
- col,
200
- dataKey,
201
- i
202
- )
203
- : printerStore
204
- .templateTable(col.text, dataKey, i, pageIndex)
205
- .replace(/\(\)/g, '')
206
- }}
207
- />
208
- </div>
209
- )
210
- })
211
- )}
212
- </div>
213
- )
214
- })}
215
- {this.props.config.subtotal.isCommutationPlace
216
- ? PageSummarySubtotalTr()
217
- : subtotalTrPageSummary()}
218
- <OverallOrder
219
- range={range}
220
- config={config}
221
- printerStore={printerStore}
222
- />
223
- <DiyOverallOrder
224
- range={range}
225
- config={config}
226
- printerStore={printerStore}
227
- pageIndex={pageIndex}
228
- />
229
- </div>)
151
+ return (
152
+ <div style={{ tableLayout: 'inherit', wordBreak: 'break-all' }}>
153
+ {_.map(_.range(range.begin, range.end), i => {
154
+ const _special = tableData[i] && tableData[i]._special
155
+ const _specialText = tableData[i] && tableData[i]._specialText
156
+ if (_specialText)
157
+ return <CategoryTr key={i} config={config} data={_specialText} />
158
+ if (_special)
159
+ return <SpecialTr key={i} config={config} data={_special} />
160
+ // 如果项为空对象展现一个占满一行的td
161
+ const isItemNone = !_.keys(tableData[i]).length
162
+ console.log(columns, 'columns')
163
+ return (
164
+ <div key={i} style={{ borderTop: '1px dashed black' }}>
165
+ {isItemNone
166
+ ? null
167
+ : _.map(columns, (col, j) => {
168
+ return (
169
+ <div
170
+ key={j}
171
+ data-name={getTableColumnName(name, col.index)}
172
+ data-index={col.index}
173
+ onClick={this.handleClick}
174
+ draggable
175
+ onDragStart={this.handleDragStart}
176
+ onDrop={this.handleDrop}
177
+ onDragOver={this.handleDragOver}
178
+ style={{ padding: '2px 0' }}
179
+ className={classNames('long_print_table_row', {
180
+ active:
181
+ getTableColumnName(name, col.index) ===
182
+ printerStore.selected
183
+ })}
184
+ >
185
+ <span
186
+ data-name={getTableColumnName(name, col.index)}
187
+ data-index={col.index}
188
+ onClick={this.handleClick}
189
+ style={{ ...col.headStyle }}
190
+ >
191
+ {col.head}:
192
+ </span>
193
+ <span
194
+ style={{
195
+ ...col.style
196
+ }}
197
+ data-name={getTableColumnName(name, col.index)}
198
+ data-index={col.index}
199
+ onClick={this.handleClick}
200
+ dangerouslySetInnerHTML={{
201
+ __html: col.isSpecialColumn
202
+ ? printerStore.templateSpecialDetails(
203
+ col,
204
+ dataKey,
205
+ i
206
+ )
207
+ : printerStore
208
+ .templateTable(
209
+ col.text,
210
+ dataKey,
211
+ i,
212
+ pageIndex
213
+ )
214
+ .replace(/\(\)/g, '')
215
+ }}
216
+ />
217
+ </div>
218
+ )
219
+ })}
220
+ </div>
221
+ )
222
+ })}
223
+ {this.props.config.subtotal.isCommutationPlace
224
+ ? PageSummarySubtotalTr()
225
+ : subtotalTrPageSummary()}
226
+ <OverallOrder
227
+ range={range}
228
+ config={config}
229
+ printerStore={printerStore}
230
+ />
231
+ <DiyOverallOrder
232
+ range={range}
233
+ config={config}
234
+ printerStore={printerStore}
235
+ pageIndex={pageIndex}
236
+ />
237
+ </div>
238
+ )
230
239
 
231
240
  return (
232
241
  <table
@@ -296,13 +305,13 @@ class Table extends React.Component {
296
305
  dangerouslySetInnerHTML={{
297
306
  __html: col.isSpecialColumn
298
307
  ? printerStore.templateSpecialDetails(
299
- col,
300
- dataKey,
301
- i
302
- )
308
+ col,
309
+ dataKey,
310
+ i
311
+ )
303
312
  : printerStore
304
- .templateTable(col.text, dataKey, i, pageIndex)
305
- .replace(/\(\)/g, '')
313
+ .templateTable(col.text, dataKey, i, pageIndex)
314
+ .replace(/\(\)/g, '')
306
315
  }}
307
316
  />
308
317
  )
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
3
3
  import { inject, observer } from 'mobx-react'
4
4
  import { getHeight } from '../util'
5
5
  import classNames from 'classnames'
6
+ import { LONG_PRINT } from '../config'
6
7
 
7
8
  @inject('printerStore')
8
9
  @observer
@@ -44,7 +45,9 @@ class Page extends React.Component {
44
45
  ...pageStyle,
45
46
  boxSizing: 'content-box',
46
47
  width: `calc(${width} - ${paddingLeft} - ${paddingRight})`,
47
- [type == "longPrint" ? "minHeight" : "height"]: `calc(${height} - ${paddingTop} - ${paddingBottom} ${x})`,
48
+ [type === LONG_PRINT
49
+ ? 'minHeight'
50
+ : 'height']: `calc(${height} - ${paddingTop} - ${paddingBottom} ${x})`,
48
51
  padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`
49
52
  }}
50
53
  >
@@ -52,7 +55,9 @@ class Page extends React.Component {
52
55
  className='gm-printer-page-inner'
53
56
  style={{
54
57
  width: `calc(${width} - ${paddingLeft} - ${paddingRight})`,
55
- [type == "longPrint" ? "minHeight" : "height"]: `calc(${height} - ${paddingTop} - ${paddingBottom} ${x})`
58
+ [type === LONG_PRINT
59
+ ? 'minHeight'
60
+ : 'height']: `calc(${height} - ${paddingTop} - ${paddingBottom} ${x})`
56
61
  }}
57
62
  >
58
63
  {children}
@@ -8,8 +8,9 @@ import Page from './page'
8
8
  import _ from 'lodash'
9
9
  import Panel from './panel'
10
10
  import Table from './table'
11
- import LongPrintTable from "./long_print_table"
11
+ import LongPrintTable from './long_print_table'
12
12
  import MergePage from './merge_page'
13
+ import { LONG_PRINT } from '../config'
13
14
 
14
15
  // Header Sign Footer 相对特殊,要单独处理
15
16
  const Header = props => (
@@ -165,37 +166,39 @@ class Printer extends React.Component {
165
166
  renderLongPage() {
166
167
  const { printerStore } = this.props
167
168
  const { config } = printerStore
168
- return <Page>
169
- <Header config={config.header} pageIndex={0} />
170
- {_.map(config.contents, (content, index) => {
171
- switch (content.type) {
172
- case 'table':
173
- // eslint-disable-next-line no-case-declarations
174
- const list = printerStore.data._table[content.dataKey]
175
- return (
176
- <LongPrintTable
177
- key={`contents.table.${index}`}
178
- name={`contents.table.${index}`}
179
- config={content}
180
- range={{ begin: 0, end: list?.length || 0 }}
181
- pageIndex={0}
182
- placeholder={`${i18next.t('区域')} ${index}`}
183
- />
184
- )
185
-
186
- default:
187
- return (
188
- <Panel
189
- key={`contents.panel.${index}`}
190
- name={`contents.panel.${index}`}
191
- config={content}
192
- pageIndex={0}
193
- placeholder={`${i18next.t('区域')} ${index}`}
194
- />
195
- )
196
- }
197
- })}
198
- </Page>
169
+ return (
170
+ <Page>
171
+ <Header config={config.header} pageIndex={0} />
172
+ {_.map(config.contents, (content, index) => {
173
+ switch (content.type) {
174
+ case 'table':
175
+ // eslint-disable-next-line no-case-declarations
176
+ const list = printerStore.data._table[content.dataKey]
177
+ return (
178
+ <LongPrintTable
179
+ key={`contents.table.${index}`}
180
+ name={`contents.table.${index}`}
181
+ config={content}
182
+ range={{ begin: 0, end: list?.length || 0 }}
183
+ pageIndex={0}
184
+ placeholder={`${i18next.t('区域')} ${index}`}
185
+ />
186
+ )
187
+
188
+ default:
189
+ return (
190
+ <Panel
191
+ key={`contents.panel.${index}`}
192
+ name={`contents.panel.${index}`}
193
+ config={content}
194
+ pageIndex={0}
195
+ placeholder={`${i18next.t('区域')} ${index}`}
196
+ />
197
+ )
198
+ }
199
+ })}
200
+ </Page>
201
+ )
199
202
  }
200
203
 
201
204
  renderPage() {
@@ -221,10 +224,10 @@ class Printer extends React.Component {
221
224
 
222
225
  const end = isAutofillConfig
223
226
  ? panel.end +
224
- Math.floor(
225
- remainPageHeight /
226
- printerStore.computedTableCustomerRowHeight
227
- )
227
+ Math.floor(
228
+ remainPageHeight /
229
+ printerStore.computedTableCustomerRowHeight
230
+ )
228
231
  : panel.end
229
232
  switch (panel.type) {
230
233
  case 'table':
@@ -320,7 +323,7 @@ class Printer extends React.Component {
320
323
  const { printerStore, config } = this.props
321
324
  // batchPrintConfig: 1 不连续打印(纸张会间断)2 连续打印(纸张连续打,不间断)
322
325
  const batchPrintConfig = config.batchPrintConfig
323
- if (config.page.type === "longPrint") {
326
+ if (config.page.type === LONG_PRINT) {
324
327
  return !printerStore.ready ? this.renderBefore() : this.renderLongPage()
325
328
  }
326
329
  if (batchPrintConfig === 2) {