gm-printer 10.39.4-beta.2 → 10.41.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.39.4-beta.2",
3
+ "version": "10.41.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -24,9 +24,6 @@ class EditorCutomizedConfig extends React.Component {
24
24
  handleFillIndex = value => {
25
25
  const { editStore } = this.props
26
26
  editStore.setFillIndex(value)
27
- if (editStore.isAutoFilling) {
28
- editStore.handleChangeTableData(true)
29
- }
30
27
  }
31
28
 
32
29
  handleTaxFreeProductRateDisplay = e => {
@@ -19,7 +19,7 @@ import {
19
19
  } from '../common/component'
20
20
  import { get, toJS } from 'mobx'
21
21
  import PropTypes from 'prop-types'
22
- import { subtotalRadioList } from './util'
22
+ import { subtotalRadioList, overallOrderRadioList } from './util'
23
23
  import { LONG_PRINT } from '../config'
24
24
  import _ from 'lodash'
25
25
 
@@ -529,7 +529,7 @@ class EditorField extends React.Component {
529
529
  {!isSomeSubtotalTr && (
530
530
  <div>
531
531
  <Flex>{i18next.t('合计栏打印金额')}:</Flex>
532
- <Flex style={{ marginLeft: 57 }}>
532
+ <Flex style={{ marginLeft: 57 }} wrap>
533
533
  {subtotalRadioList.map(fields => {
534
534
  // 兼容
535
535
  let subtotalFields = subtotal?.fields?.[0].valueField
@@ -627,8 +627,14 @@ class EditorField extends React.Component {
627
627
  onChange={this.handleOverallOrderStyleChange}
628
628
  />
629
629
  </Flex>
630
- <Flex style={{ marginLeft: 57 }}>
631
- {subtotalRadioList.map((fields, i) => {
630
+ <EditorSubtotalCheck
631
+ subtotalCheckDisabled
632
+ subtotalChecked={overallOrder?.showEachPage !== false}
633
+ subtotalCheckOnChange={editStore.setOverallOrderShowEachPage}
634
+ subtotalCheckText='每页展示'
635
+ />
636
+ <Flex style={{ marginLeft: 57 }} wrap>
637
+ {overallOrderRadioList.map((fields, i) => {
632
638
  return (
633
639
  <Radio
634
640
  style={{ marginLeft: 5 }}
@@ -2,30 +2,10 @@ import i18next from '../../locales'
2
2
  import { action, computed, observable, set, toJS } from 'mobx'
3
3
  import { pageTypeMap } from '../config'
4
4
  import _ from 'lodash'
5
- import {
6
- dispatchMsg,
7
- getBlockName,
8
- exchange,
9
- getColSpanLength,
10
- isMultiTable,
11
- getDataKey,
12
- getMultiNumber
13
- } from '../util'
5
+ import { dispatchMsg, getBlockName, exchange, getColSpanLength } from '../util'
14
6
  import { accountRadioList } from './util'
15
7
  import React from 'react'
16
8
  import { createDiySummaryStoreMethods } from './diy_summary_helper'
17
- import {
18
- detectColNumber,
19
- fillEmptyRowIndex,
20
- fillPartialLastRow,
21
- getMaxSerial,
22
- flattenHorizontalPackedRows,
23
- packVerticalNewspaper,
24
- packHorizontalRowMajor,
25
- createEmptyRows,
26
- createEmptyRowSkeleton,
27
- resolveVerticalEmptyCount
28
- } from '../printer/multi_column'
29
9
 
30
10
  class EditorStore {
31
11
  @observable
@@ -221,7 +201,6 @@ class EditorStore {
221
201
  vv.columns.length +
222
202
  vv.className +
223
203
  vv.dataKey +
224
- (vv.arrange || 'lateral') +
225
204
  vv.subtotal.show +
226
205
  vv.summaryConfig?.pageSummaryShow +
227
206
  vv.customerRowHeight
@@ -261,57 +240,14 @@ class EditorStore {
261
240
  tr_count = Math.floor(
262
241
  this.remainPageHeihgt / this.computedTableCustomerRowHeight
263
242
  )
264
- if (tr_count <= 0) return []
265
243
 
266
- const sample = (tableData || []).find(item => item && !item._isEmptyData)
267
- const dataKey =
268
- this.computedTableSpecialConfig?.dataKey || autoFillConfig?.dataKey
269
- const colNumber = detectColNumber(dataKey, tableData)
270
- return createEmptyRows(tr_count, sample, colNumber)
271
- }
272
-
273
- /** 多栏表缺失时(如双栏切三栏),从单栏/双栏源表现场打包到 mockData */
274
- @action
275
- ensureMockMultiTable(dataKey) {
276
- if (!dataKey || !isMultiTable(dataKey)) return
277
- if (!this.mockData._table) {
278
- this.mockData._table = {}
279
- }
280
- if (this.mockData._table[dataKey]?.length) return
281
-
282
- const isVertical = /_vertical$/.test(dataKey)
283
- const sourceKey = dataKey.replace(/_vertical$/, '')
284
- const colNumber = getMultiNumber(sourceKey)
285
- const singleKey = sourceKey.replace(/_multi3?/, '')
286
-
287
- let sourceRows = this.mockData._table[singleKey]
288
- let sourceColNumber = 1
289
- if (!sourceRows?.length && /multi3/.test(sourceKey)) {
290
- const dualKey = sourceKey.replace('multi3', 'multi')
291
- sourceRows = this.mockData._table[dualKey]
292
- sourceColNumber = 2
293
- }
294
- if (!sourceRows?.length) {
295
- sourceRows = this.mockData._table[sourceKey]
296
- sourceColNumber = isMultiTable(sourceKey) ? colNumber : 1
297
- }
298
- if (!sourceRows?.length) {
299
- this.mockData._table[dataKey] = []
300
- return
244
+ const filledData = {
245
+ _isEmptyData: true // 表示是填充的空白数据
301
246
  }
302
-
303
- const sourceItems = flattenHorizontalPackedRows(
304
- sourceRows,
305
- sourceColNumber
306
- )
307
- const baseRowCount = sourceItems.length
308
- ? Math.max(1, Math.ceil(sourceItems.length / colNumber))
309
- : 0
310
- this.mockData._table[dataKey] = !baseRowCount
311
- ? []
312
- : isVertical
313
- ? packVerticalNewspaper(sourceItems, colNumber, baseRowCount, false)
314
- : packHorizontalRowMajor(sourceItems, colNumber)
247
+ _.map(tableData[0], (val, key) => {
248
+ filledData[key] = ''
249
+ })
250
+ return Array(tr_count).fill(filledData)
315
251
  }
316
252
 
317
253
  @action.bound
@@ -320,6 +256,9 @@ class EditorStore {
320
256
  if (!this.selectedRegion && !autoFillConfig?.checked) return
321
257
  const dataKey =
322
258
  this.computedTableSpecialConfig?.dataKey || autoFillConfig?.dataKey
259
+ // 每次都更新一下?
260
+ const table = this.mockData._table[dataKey]
261
+ // 赋值一下
323
262
  this.setAutoFillingConfig(isAutoFilling)
324
263
  this.setFillIndex(autoFillConfig?.fillIndex || false)
325
264
  set(this.config, {
@@ -332,112 +271,24 @@ class EditorStore {
332
271
  }
333
272
  })
334
273
 
335
- if (dataKey && isMultiTable(dataKey)) {
336
- this.ensureMockMultiTable(dataKey)
337
- this.ensureMockMultiTable(getDataKey(dataKey, 'vertical'))
338
- }
274
+ const hasHadEmptyData = _.some(table, data => data?._isEmptyData)
339
275
 
340
- const syncEmptyRows = key => {
341
- if (!this.mockData._table?.[key]) return
342
- const list = this.mockData._table[key]
343
- const hasHadEmptyData = _.some(list, data => data?._isEmptyData)
344
- if (isAutoFilling && !hasHadEmptyData) {
345
- list.push(...this.getFilledTableData(list))
346
- }
347
- if (!isAutoFilling) {
348
- this.clearExtraTableData(key)
349
- return
350
- }
351
- this.mockData._table[key] = list
352
- }
353
-
354
- const numberEmptyRows = key => {
355
- const list = this.mockData._table?.[key]
356
- if (!list) return
357
- const table = list.filter(item => !item._isEmptyData)
358
- const emptyTable = list.filter(item => item._isEmptyData)
359
- // 纵向表:对半数据行 + 空行占位;左列优先交给 Printer.repack
360
- if (/_vertical$/.test(key)) {
361
- const sourceKey = key.replace(/_vertical$/, '')
362
- const singleKey = sourceKey.replace(/_multi3?/, '')
363
- const colNumber = getMultiNumber(sourceKey)
364
- const sourceRows =
365
- this.mockData._table[singleKey] ||
366
- this.mockData._table[sourceKey] ||
367
- []
368
- const sourceColNumber = isMultiTable(singleKey)
369
- ? getMultiNumber(singleKey)
370
- : isMultiTable(sourceKey)
371
- ? colNumber
372
- : 1
373
- const sourceItems = flattenHorizontalPackedRows(
374
- sourceRows,
375
- sourceColNumber
376
- )
377
- const baseRowCount = sourceItems.length
378
- ? Math.max(1, Math.ceil(sourceItems.length / colNumber))
379
- : 0
380
- // 钉死总行:repack 后 _isEmptyData 会变少,不能再用 emptyTable.length
381
- const emptyCount = resolveVerticalEmptyCount(
382
- list.length,
383
- baseRowCount,
384
- emptyTable.length > 0
385
- ? emptyTable.length
386
- : this.getFilledTableData(list).length,
387
- emptyTable.length > 0
388
- )
389
- const dataRows = baseRowCount
390
- ? packVerticalNewspaper(sourceItems, colNumber, baseRowCount, false)
391
- : []
392
- const sample = dataRows[0] || sourceRows[0]
393
- this.mockData._table[key] = dataRows.concat(
394
- createEmptyRows(emptyCount, sample, colNumber)
395
- )
396
- return
397
- }
398
- const colNumber = detectColNumber(key, list)
399
- const withPartial = fillPartialLastRow(table, colNumber, this.fillIndex)
400
- const lastKey = getMaxSerial(withPartial, colNumber) + 1
401
- const sample = table[0]
402
- this.mockData._table[key] = withPartial.concat(
403
- emptyTable.map((item, index) =>
404
- fillEmptyRowIndex(
405
- {
406
- ...createEmptyRowSkeleton(sample, colNumber),
407
- ...item,
408
- _isEmptyData: true
409
- },
410
- index,
411
- lastKey,
412
- colNumber,
413
- this.fillIndex
414
- )
415
- )
416
- )
417
- }
418
-
419
- syncEmptyRows(dataKey)
420
- if (dataKey && isMultiTable(dataKey)) {
421
- const verticalKey = getDataKey(dataKey, 'vertical')
422
- if (!this.mockData._table[verticalKey]) {
423
- this.mockData._table[verticalKey] = []
424
- }
425
- syncEmptyRows(verticalKey)
276
+ // 开关打开,且之前数组不包含空数据,再进行填充
277
+
278
+ if (isAutoFilling && !hasHadEmptyData) {
279
+ table.push(...this.getFilledTableData(table))
426
280
  }
427
- if (isAutoFilling) {
428
- numberEmptyRows(dataKey)
429
- if (dataKey && isMultiTable(dataKey)) {
430
- numberEmptyRows(getDataKey(dataKey, 'vertical'))
431
- }
281
+ if (!isAutoFilling) {
282
+ this.clearExtraTableData(dataKey)
283
+ return
432
284
  }
285
+ this.mockData._table[dataKey] = table
433
286
  }
434
287
 
435
288
  @action
436
289
  clearExtraTableData(dataKey) {
437
- if (!this.mockData._table?.[dataKey]) return
438
- this.mockData._table[dataKey] = this.mockData._table[dataKey].filter(
439
- x => !x._isEmptyData
440
- )
290
+ const newTable = this.mockData._table[dataKey].filter(x => !x._isEmptyData)
291
+ this.mockData._table[dataKey] = newTable
441
292
  }
442
293
 
443
294
  @action
@@ -692,44 +543,12 @@ class EditorStore {
692
543
  for (const [key, table] of Object.entries(tableData)) {
693
544
  tableData[key] = table.filter(x => !x._isEmptyData)
694
545
  }
695
- // 纵向 left-fill 后商品行数 > 对半行且无 _isEmptyData,只滤空行会留下偏多行,
696
- // 重挂载测高/remain 偏小,多栏切换后空行补不回来。收回到对半商品行。
697
- Object.keys(tableData).forEach(key => {
698
- if (!/_vertical$/.test(key) || !isMultiTable(key)) return
699
- this.collapseVerticalMultiToBaseRows(key)
700
- })
546
+ // this.setAutoFillingConfig(false)
701
547
  set(this.mockData, {
702
548
  _table: tableData
703
549
  })
704
550
  }
705
551
 
706
- /** 纵向多栏收到「对半」商品行,去掉 left-fill 撑开的多余行 */
707
- @action
708
- collapseVerticalMultiToBaseRows(key) {
709
- const sourceKey = key.replace(/_vertical$/, '')
710
- const singleKey = sourceKey.replace(/_multi3?/, '')
711
- const colNumber = getMultiNumber(sourceKey)
712
- const sourceRows =
713
- this.mockData._table[singleKey] ||
714
- this.mockData._table[sourceKey] ||
715
- []
716
- const sourceColNumber = isMultiTable(singleKey)
717
- ? getMultiNumber(singleKey)
718
- : isMultiTable(sourceKey)
719
- ? colNumber
720
- : 1
721
- const sourceItems = flattenHorizontalPackedRows(
722
- sourceRows,
723
- sourceColNumber
724
- )
725
- const baseRowCount = sourceItems.length
726
- ? Math.max(1, Math.ceil(sourceItems.length / colNumber))
727
- : 0
728
- this.mockData._table[key] = baseRowCount
729
- ? packVerticalNewspaper(sourceItems, colNumber, baseRowCount, false)
730
- : []
731
- }
732
-
733
552
  @action
734
553
  addConfigBlock(name, type, pos = {}, link = '') {
735
554
  let blocks
@@ -954,6 +773,10 @@ class EditorStore {
954
773
  set(table.overallOrder, {
955
774
  show: !table.overallOrder.show
956
775
  })
776
+ // 老模板补默认:每页展示默认勾选
777
+ if (table.overallOrder.showEachPage === undefined) {
778
+ set(table.overallOrder, { showEachPage: true })
779
+ }
957
780
  table.overallOrder.fields[0].colSpan =
958
781
  colSpanLength - (table.overallOrder.fields?.[1]?.colSpan ?? 0)
959
782
  } else {
@@ -961,6 +784,7 @@ class EditorStore {
961
784
  set(table, {
962
785
  overallOrder: {
963
786
  show: true,
787
+ showEachPage: true,
964
788
  fields: [
965
789
  {
966
790
  name: '整单合计:',
@@ -977,6 +801,19 @@ class EditorStore {
977
801
  this.config = toJS(this.config)
978
802
  }
979
803
 
804
+ // 整单合计「每页展示」
805
+ @action.bound
806
+ setOverallOrderShowEachPage() {
807
+ if (!this.selectedRegion) return
808
+ const arr = this.selectedRegion.split('.')
809
+ const table = this.config.contents[arr[2]]
810
+ if (!table?.overallOrder) return
811
+ this.overallOrderShow = !this.overallOrderShow
812
+ const next = !(table.overallOrder.showEachPage !== false)
813
+ set(table.overallOrder, { showEachPage: next })
814
+ this.config = toJS(this.config)
815
+ }
816
+
980
817
  @action
981
818
  setDiyOverallOrderShow(name) {
982
819
  const arr = name.split('.')
@@ -1114,34 +951,12 @@ class EditorStore {
1114
951
 
1115
952
  this.config.contents[arr[2]].dataKey = newDataKey.join('_')
1116
953
 
1117
- // 双栏↔三栏等切换时,mock 可能缺对应 _table,现场兜底生成,避免整表空白
1118
- const joinedKey = newDataKey.join('_')
1119
- if (isMultiTable(joinedKey)) {
1120
- this.ensureMockMultiTable(joinedKey)
1121
- this.ensureMockMultiTable(getDataKey(joinedKey, 'vertical'))
1122
- }
1123
-
1124
954
  // 整单合计不显示
1125
955
  if (overallOrder?.show) overallOrder.show = false
1126
956
  // 每页合计不显示
1127
957
  if (subtotal?.show) subtotal.show = false
1128
958
  // 自定义每页合计不显示
1129
959
  if (diyOverallOrder?.show) diyOverallOrder.show = false
1130
-
1131
- // 分类/多栏切换:清空旧空行并同步 autoFillConfig.dataKey,Printer 重挂载后会重补
1132
- if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
1133
- this.clearAllTableEmptyData()
1134
- this.setAutoFillingConfig(true)
1135
- set(this.config, {
1136
- autoFillConfig: {
1137
- ...(this.config.autoFillConfig || {}),
1138
- region: this.selectedRegion || this.config.autoFillConfig?.region,
1139
- dataKey: joinedKey,
1140
- checked: true,
1141
- fillIndex: this.fillIndex
1142
- }
1143
- })
1144
- }
1145
960
  }
1146
961
 
1147
962
  @action
@@ -1581,26 +1396,10 @@ class EditorStore {
1581
1396
  if (this.selectedRegion) {
1582
1397
  const arr = this.selectedRegion.split('.')
1583
1398
  if (arr.includes('table')) {
1584
- const table = this.config.contents[arr[2]]
1585
1399
  this.config.contents[arr[2]] = {
1586
- ...table,
1400
+ ...this.config.contents[arr[2]],
1587
1401
  arrange: val
1588
1402
  }
1589
- // 只改排列并清掉旧空行;保持填充开关,交给 Printer 重挂载后
1590
- //「先补空 → 再重新分页」恢复空行(勿在此处用旧 remainHeight 立刻补)
1591
- if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
1592
- this.clearAllTableEmptyData()
1593
- this.setAutoFillingConfig(true)
1594
- set(this.config, {
1595
- autoFillConfig: {
1596
- ...(this.config.autoFillConfig || {}),
1597
- region: this.selectedRegion,
1598
- dataKey: table.dataKey,
1599
- checked: true,
1600
- fillIndex: this.fillIndex
1601
- }
1602
- })
1603
- }
1604
1403
  }
1605
1404
  }
1606
1405
  }
@@ -2038,6 +1837,7 @@ class EditorStore {
2038
1837
  set(table, {
2039
1838
  overallOrder: {
2040
1839
  show: true,
1840
+ showEachPage: true,
2041
1841
  fields: [
2042
1842
  {
2043
1843
  name: '整单合计:',
@@ -1,10 +1,9 @@
1
1
  import i18next from '../../locales'
2
2
 
3
3
  /**
4
- * 每页合计设置单选按钮
5
- * id的值是用来计算每页的金额总数,不要轻易随便改
4
+ * 每页合计金额单选
5
+ * id 与 data_to_key 中文 key 对齐,用于对本页行求和,不要轻易改 id
6
6
  */
7
- // 整单合计和每页合计栏都使用的这个
8
7
  const subtotalRadioList = [
9
8
  {
10
9
  value: i18next.t('下单金额'),
@@ -17,6 +16,61 @@ const subtotalRadioList = [
17
16
  {
18
17
  value: i18next.t('实际金额'),
19
18
  id: '实际金额'
19
+ },
20
+ {
21
+ value: i18next.t('变化前金额'),
22
+ id: '变化前金额'
23
+ },
24
+ {
25
+ value: i18next.t('下单金额(不含税)'),
26
+ id: '下单金额_不含税'
27
+ },
28
+ {
29
+ value: i18next.t('实收金额'),
30
+ id: '实收金额'
31
+ },
32
+ {
33
+ value: i18next.t('实收金额(不含税)'),
34
+ id: '实收金额_不含税'
35
+ }
36
+ ]
37
+
38
+ /**
39
+ * 整单合计金额单选(比每页合计多「出库金额(不含税)」)
40
+ * id 与 data.common 中文 key 对齐,取订单已算金额,不重算
41
+ */
42
+ const overallOrderRadioList = [
43
+ {
44
+ value: i18next.t('下单金额'),
45
+ id: '下单金额'
46
+ },
47
+ {
48
+ value: i18next.t('出库金额'),
49
+ id: '出库金额'
50
+ },
51
+ {
52
+ value: i18next.t('实际金额'),
53
+ id: '实际金额'
54
+ },
55
+ {
56
+ value: i18next.t('变化前金额'),
57
+ id: '变化前金额'
58
+ },
59
+ {
60
+ value: i18next.t('下单金额(不含税)'),
61
+ id: '下单金额_不含税'
62
+ },
63
+ {
64
+ value: i18next.t('出库金额(不含税)'),
65
+ id: '出库金额_不含税'
66
+ },
67
+ {
68
+ value: i18next.t('实收金额'),
69
+ id: '实收金额'
70
+ },
71
+ {
72
+ value: i18next.t('实收金额(不含税)'),
73
+ id: '实收金额_不含税'
20
74
  }
21
75
  ]
22
76
 
@@ -26,4 +80,4 @@ const accountRadioList = {
26
80
  实际金额: i18next.t('实际金额')
27
81
  }
28
82
 
29
- export { subtotalRadioList, accountRadioList }
83
+ export { subtotalRadioList, overallOrderRadioList, accountRadioList }
@@ -57,8 +57,11 @@ const detailSortOptionsForMerchant = [
57
57
  @observer
58
58
  class TableDetailEditor extends React.Component {
59
59
  handleDataKeyChange = dataKey => {
60
- const { editStore } = this.props
61
- editStore.setPurchaseTableKey(dataKey)
60
+ const { editStore, addFields } = this.props
61
+ editStore.setPurchaseTableKey(
62
+ dataKey,
63
+ addFields.specialTableConfig
64
+ )
62
65
  }
63
66
 
64
67
  handlePurchaseSettingKeyChange = dataKey => {
@@ -74,7 +77,7 @@ class TableDetailEditor extends React.Component {
74
77
  }
75
78
 
76
79
  handleDetailAddField = ({ key, value }) => {
77
- const { editStore, config } = this.props
80
+ const { editStore, config, addFields } = this.props
78
81
  if (editStore.computedDataKey === 'purchase_detail_one_row') {
79
82
  // 序号 {{列.序号}}
80
83
  const transform = str => {
@@ -86,12 +89,18 @@ class TableDetailEditor extends React.Component {
86
89
  config.purchaseSettingKey === 'goods' &&
87
90
  config.dataKey !== 'purchase_independent_rol_sku'
88
91
  ) {
89
- editStore.setPurchaseTableKey('purchase_independent_rol_sku')
92
+ editStore.setPurchaseTableKey(
93
+ 'purchase_independent_rol_sku',
94
+ addFields.specialTableConfig
95
+ )
90
96
  } else if (
91
97
  config.purchaseSettingKey === 'merchant' &&
92
98
  config.dataKey !== 'purchase_independent_rol_address'
93
99
  ) {
94
- editStore.setPurchaseTableKey('purchase_independent_rol_address')
100
+ editStore.setPurchaseTableKey(
101
+ 'purchase_independent_rol_address',
102
+ addFields.specialTableConfig
103
+ )
95
104
  }
96
105
 
97
106
  editStore.addFieldToTable({ key, value: transform(value) })
@@ -113,7 +122,7 @@ class TableDetailEditor extends React.Component {
113
122
 
114
123
  render() {
115
124
  const {
116
- addFields: { detailFields },
125
+ addFields: { detailFields, specialTableConfig = {} },
117
126
  editStore
118
127
  } = this.props
119
128
  const {
@@ -123,18 +132,28 @@ class TableDetailEditor extends React.Component {
123
132
  specialConfig: { template_text, style }
124
133
  } = this.props.config
125
134
 
135
+ const title = specialTableConfig.title || i18next.t('设置采购明细')
136
+ const label = specialTableConfig.label || i18next.t('采购明细')
137
+ // 外部可整体覆盖下拉选项(dataKeyList),否则按 hideDataKeys 过滤默认列表
138
+ const baseDataKeyList = specialTableConfig.dataKeyList || dataKeyList
139
+ const hideDataKeys = specialTableConfig.hideDataKeys || []
140
+ const visibleDataKeyList = _.filter(
141
+ baseDataKeyList,
142
+ v => !hideDataKeys.includes(v.value)
143
+ )
144
+
126
145
  return (
127
146
  <div>
128
- <Title title={i18next.t('设置采购明细')} />
147
+ <Title title={title} />
129
148
  <Gap />
130
149
  <Flex alignCenter className='gm-padding-top-5'>
131
- <div>{i18next.t('采购明细')}:</div>
150
+ <div>{label}:</div>
132
151
  <Select
133
152
  className='gm-printer-edit-select'
134
153
  value={editStore.computedDataKey}
135
154
  onChange={this.handleDataKeyChange}
136
155
  >
137
- {_.map(dataKeyList, v => (
156
+ {_.map(visibleDataKeyList, v => (
138
157
  <Option key={v.value} value={v.value}>
139
158
  {v.text}
140
159
  </Option>
@@ -13,7 +13,7 @@ class Store extends EditorStore {
13
13
 
14
14
  /* start---------设置采购明细相关--------- */
15
15
  @action.bound
16
- setPurchaseTableKey(dataKey) {
16
+ setPurchaseTableKey(dataKey, specialTableConfig) {
17
17
  // 先移除选中项,安全第一
18
18
  this.selected = null
19
19
  this.setTableDataKey(dataKey)
@@ -38,9 +38,12 @@ class Store extends EditorStore {
38
38
  separator: '+',
39
39
  // detailsType: 'purchase_last_col',
40
40
  specialDetailsKey: '__details',
41
- text: i18next.t(
42
- '{{采购数量_采购单位}}{{采购单位}}*{{商户名}}*{{商品备注}}'
43
- )
41
+ text:
42
+ specialTableConfig && specialTableConfig.defaultDetailText !== undefined
43
+ ? specialTableConfig.defaultDetailText
44
+ : i18next.t(
45
+ '{{采购数量_采购单位}}{{采购单位}}*{{商户名}}*{{商品备注}}'
46
+ )
44
47
  })
45
48
  // 通过detailsType属性区分单列-总表最后一列的数据是否换行展示
46
49
  dataKey === 'purchase_last_col'
@@ -111,7 +111,8 @@ class Table extends React.Component {
111
111
  range,
112
112
  pageIndex,
113
113
  printerStore,
114
- isSomeSubtotalTr
114
+ isSomeSubtotalTr,
115
+ isLastTablePage
115
116
  } = this.props
116
117
  // 数据
117
118
  dataKey = getDataKey(dataKey, arrange)
@@ -227,6 +228,7 @@ class Table extends React.Component {
227
228
  range={range}
228
229
  config={config}
229
230
  printerStore={printerStore}
231
+ isLastTablePage={isLastTablePage}
230
232
  />
231
233
  <DiyOverallOrder
232
234
  range={range}
@@ -327,6 +329,7 @@ class Table extends React.Component {
327
329
  range={range}
328
330
  config={config}
329
331
  printerStore={printerStore}
332
+ isLastTablePage={isLastTablePage}
330
333
  />
331
334
  <DiyOverallOrder
332
335
  range={range}
@@ -385,7 +388,12 @@ Table.propTypes = {
385
388
  pageIndex: PropTypes.number.isRequired,
386
389
  placeholder: PropTypes.string,
387
390
  printerStore: PropTypes.object,
388
- isSomeSubtotalTr: PropTypes.bool
391
+ isSomeSubtotalTr: PropTypes.bool,
392
+ isLastTablePage: PropTypes.bool
393
+ }
394
+
395
+ Table.defaultProps = {
396
+ isLastTablePage: true
389
397
  }
390
398
 
391
399
  export default Table