gm-printer 11.0.2-beta.2 → 11.1.0-beta.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": "11.0.2-beta.2",
3
+ "version": "11.1.0-beta.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -94,45 +94,13 @@ class EditorStore {
94
94
 
95
95
  @action
96
96
  setSubtotalFieldsCol(arr) {
97
+ // this.overallOrderShow = !this.overallOrderShow
98
+ // 重新计算每页合计的单元格
97
99
  const table = this.config.contents[arr[2]]
98
- if (!table?.subtotal?.show) return
99
-
100
- const colSpanLength = getColSpanLength(table)
101
- if (!table.subtotal.fields?.length) {
102
- set(table.subtotal, {
103
- fields: [
104
- {
105
- name: '每页合计:',
106
- valueField: 'real_item_price',
107
- colSpan: colSpanLength
108
- }
109
- ]
110
- })
111
- return
112
- }
113
-
114
100
  const subtotalLength = table.subtotal.fields.length
115
101
  table.subtotal.fields[subtotalLength - 1].colSpan += 1
116
102
  }
117
103
 
118
- @action
119
- updateSelectedRegionAfterContentInsert(insertIndex) {
120
- const updateNameIndex = name => {
121
- if (!name) return name
122
- const parts = name.split('.')
123
- if (parts[0] !== 'contents') return name
124
- const regionIndex = ~~parts[2]
125
- if (regionIndex >= insertIndex) {
126
- parts[2] = String(regionIndex + 1)
127
- return parts.join('.')
128
- }
129
- return name
130
- }
131
-
132
- this.selectedRegion = updateNameIndex(this.selectedRegion)
133
- this.selected = updateNameIndex(this.selected)
134
- }
135
-
136
104
  @action
137
105
  setMultiDigitDecimal(bool) {
138
106
  this.isMultiDigitDecimal = bool
@@ -298,7 +266,6 @@ class EditorStore {
298
266
  { batchPrintConfig: 1, isFixLastFooter: true },
299
267
  config
300
268
  )
301
- this.defaultTableDataKey = config.defaultTableDataKey || 'orders'
302
269
  this.originConfig = config
303
270
  this.selected = null
304
271
  this.selectedRegion = null
@@ -1238,8 +1205,6 @@ class EditorStore {
1238
1205
  }
1239
1206
  })
1240
1207
  }
1241
- this.updateSelectedRegionAfterContentInsert(index)
1242
- this.config = toJS(this.config)
1243
1208
  }
1244
1209
  }
1245
1210
  }
@@ -72,15 +72,13 @@ class EditorTitle extends React.Component {
72
72
  }
73
73
 
74
74
  handleTestPrint = () => {
75
- // 新增结款单每页合计标识,测试打印时原样透传到打印入口
76
- const { mockData, editStore, isSomeSubtotalTr } = this.props
75
+ const { mockData, editStore } = this.props
77
76
  doPrint(
78
77
  {
79
78
  config: toJS(editStore.config),
80
79
  data: mockData
81
80
  },
82
- true,
83
- isSomeSubtotalTr
81
+ true
84
82
  )
85
83
  }
86
84
 
@@ -142,14 +140,10 @@ class EditorTitle extends React.Component {
142
140
  EditorTitle.propTypes = {
143
141
  onSave: PropTypes.func.isRequired,
144
142
  isPurchase: PropTypes.bool,
145
- editStore: PropTypes.object,
146
- // 标识是否为结款单每页合计场景
147
- isSomeSubtotalTr: PropTypes.bool
143
+ editStore: PropTypes.object
148
144
  }
149
145
  EditorTitle.defaultProps = {
150
- isPurchase: false,
151
- // 默认按非结款单每页合计场景处理
152
- isSomeSubtotalTr: false
146
+ isPurchase: false
153
147
  }
154
148
 
155
149
  EditorTitle.wrappedComponent.propTypes = {
@@ -1,6 +1,4 @@
1
1
  import withShadowDom from '../common/hoc_with_shadow_dom'
2
2
  import Editor from './editor'
3
- import EditorMenuConfig from './editor_menu_config'
4
3
 
5
4
  export default withShadowDom(Editor)
6
- export const Editor2 = withShadowDom(EditorMenuConfig)
@@ -42,8 +42,7 @@ class Editor extends React.Component {
42
42
 
43
43
  {showEditor && (
44
44
  <div className='gm-printer-edit-zone'>
45
- {/* 透传结款单每页合计标识给标题区,用于测试打印时走对应逻辑 */}
46
- <EditorTitle onSave={onSave} isSomeSubtotalTr={isSomeSubtotalTr} />
45
+ <EditorTitle onSave={onSave} />
47
46
  <Gap height='10px' />
48
47
  <EditorSelect />
49
48
  <Gap height='5px' />
package/src/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  // ‼️优先初始化语言设置(必须先初始化语言)
2
2
  import '../locales'
3
- import Editor, { Editor2 } from './editor'
4
-
3
+ import Editor from './editor'
5
4
  import EditorPurchase from './editor_purchase'
6
- import EditorExaminingReport from './examining_report_editor'
7
5
  import EditorStockIn from './editor_stockin'
8
6
  import EditorStockOut from './editor_stockout'
9
7
  import EditorSettle from './editor_settle'
@@ -29,11 +27,9 @@ export { setLocale } from '../locales'
29
27
 
30
28
  export {
31
29
  Editor,
32
- Editor2,
33
30
  EditorStockIn,
34
31
  EditorStockOut,
35
32
  EditorPurchase,
36
- EditorExaminingReport,
37
33
  EditorSettle,
38
34
  EditorStatement,
39
35
  EditorAccoutStatement,
@@ -1,32 +1,44 @@
1
1
  import React from 'react'
2
2
  import _ from 'lodash'
3
- import { getDataKey, isMultiTable } from '../util'
3
+ import {
4
+ getDataKey,
5
+ isMultiTable,
6
+ formatSumWithPrecision,
7
+ getHighPrecisionField,
8
+ extractSumField,
9
+ templateSumResult
10
+ } from '../util'
4
11
  import Big from 'big.js'
5
12
  import { observer } from 'mobx-react'
6
13
  import { get } from 'mobx'
7
14
  import i18next from '../../locales'
8
15
 
9
- const regExp = text => {
10
- const match = /{{([^{}]+)}}/.exec(text)
11
- const key = match ? match[1] : ''
12
- return key ? key.split('.')[1] : ''
13
- }
14
16
  /**
15
17
  * 每列统计
16
18
  * @param key
17
19
  * @param dataList
18
20
  * @param summaryFieldsResultToNumber 需要转换为数字的汇总字段
21
+ * @param formatter 精度格式化函数,由 stationv2 传入 AmountPrecisionUtil(precision_control)
22
+ * @param highPrecisionMapping 高精度字段映射,优先用高精度字段求和
19
23
  * @returns {*|string}
20
24
  */
21
- const sumCol = (key, dataList, summaryFieldsResultToNumber = []) => {
25
+ const sumCol = (
26
+ key,
27
+ dataList,
28
+ summaryFieldsResultToNumber = [],
29
+ formatter,
30
+ highPrecisionMapping
31
+ ) => {
22
32
  let result
23
33
  try {
24
- result = dataList
25
- .reduce((acc, item) => {
26
- acc = acc.plus(item[key] || 0)
27
- return acc
28
- }, Big(0))
29
- .toFixed(2)
34
+ // 优先使用高精度字段求和
35
+ const sumKey = getHighPrecisionField(key, highPrecisionMapping)
36
+ const sum = dataList.reduce((acc, item) => {
37
+ const val = item[sumKey] ?? item._origin?.[sumKey] ?? 0
38
+ acc = acc.plus(val)
39
+ return acc
40
+ }, Big(0))
41
+ result = formatSumWithPrecision(sum, formatter)
30
42
 
31
43
  if (summaryFieldsResultToNumber.includes(key)) {
32
44
  result = Number(result)
@@ -63,9 +75,16 @@ const PageSummary = props => {
63
75
  printerStore.config?.summaryFieldsResultToNumber
64
76
  if (summaryFieldsResultToNumber) {
65
77
  summaryFieldsResultToNumber = summaryFieldsResultToNumber.map(item =>
66
- regExp(item)
78
+ extractSumField(item)
67
79
  )
68
80
  }
81
+ const formatter = printerStore.config?.payAmountFormatter
82
+ const highPrecisionMapping = printerStore.config?.highPrecisionFieldMapping
83
+
84
+ const summaryKeys = summaryConfig.summaryColumns.map(text =>
85
+ extractSumField(text)
86
+ )
87
+
69
88
  return (
70
89
  <tr>
71
90
  {_.map(columns, (col, index) => {
@@ -74,13 +93,19 @@ const PageSummary = props => {
74
93
  if (index === 0) {
75
94
  html = i18next.t('合计')
76
95
  } else {
77
- const key = regExp(col.text)
78
- html =
79
- summaryConfig.summaryColumns
80
- .map(text => regExp(text))
81
- .includes(key) && key
82
- ? sumCol(key, currentPageTableData, summaryFieldsResultToNumber)
83
- : ' '
96
+ const key = extractSumField(col.text)
97
+ if (key && summaryKeys.includes(key)) {
98
+ const sum = sumCol(
99
+ key,
100
+ currentPageTableData,
101
+ summaryFieldsResultToNumber,
102
+ formatter,
103
+ highPrecisionMapping
104
+ )
105
+ html = templateSumResult(col.text, sum, key)
106
+ } else {
107
+ html = ' '
108
+ }
84
109
  }
85
110
 
86
111
  return (
@@ -103,10 +103,10 @@ class Printer extends React.Component {
103
103
  componentDidMount() {
104
104
  const { printerStore, config, getremainpageHeight } = this.props
105
105
  const batchPrintConfig = config.batchPrintConfig
106
- // didMount 代表第一次渲染完成
107
- printerStore.setReady(true)
108
- // 连续打印不需要分页计算
106
+ // 连续打印不需要计算
109
107
  if (batchPrintConfig !== 2) {
108
+ // didMount 代表第一次渲染完成
109
+ printerStore.setReady(true)
110
110
  printerStore.computedPages()
111
111
  if (config.autoFillConfig?.checked) {
112
112
  this.props.printerStore.setAutofillConfig(
@@ -5,17 +5,14 @@ import {
5
5
  isMultiTable,
6
6
  caclSingleDetailsPageHeight,
7
7
  getArrayMid,
8
- getOverallOrderTrHeight
8
+ getOverallOrderTrHeight,
9
+ price
9
10
  } from '../util'
10
11
  import _ from 'lodash'
11
12
  import Big from 'big.js'
12
13
  import { Tip } from '../components'
13
14
 
14
15
  export const TR_BASE_HEIGHT = 23
15
- const price = (n, f = 2) => {
16
- if (isNaN(n)) return null
17
- return Big(n || 0).toFixed(f)
18
- }
19
16
  class PrinterStore {
20
17
  @observable ready = false
21
18
 
@@ -530,7 +527,7 @@ class PrinterStore {
530
527
  })({
531
528
  ...this.data.common,
532
529
  [i18next.t('当前页码')]: pageIndex + 1,
533
- [i18next.t('页码总数')]: Math.max(1, this.pages.length),
530
+ [i18next.t('页码总数')]: this.pages.length,
534
531
  price: price
535
532
  })
536
533
  } catch (err) {
@@ -604,7 +601,7 @@ class PrinterStore {
604
601
 
605
602
  [i18next.t('列')]: list[index],
606
603
  [i18next.t('当前页码')]: pageIndex + 1,
607
- [i18next.t('页码总数')]: Math.max(1, this.pages.length),
604
+ [i18next.t('页码总数')]: this.pages.length,
608
605
  price: price // 提供一个价格处理函数
609
606
  })
610
607
  } catch (err) {
@@ -626,7 +623,7 @@ class PrinterStore {
626
623
  ...this.data.common,
627
624
  [i18next.t('列')]: list[index],
628
625
  [i18next.t('当前页码')]: pageIndex + 1,
629
- [i18next.t('页码总数')]: Math.max(1, this.pages.length),
626
+ [i18next.t('页码总数')]: this.pages.length,
630
627
  price: price // 提供一个价格处理函数
631
628
  })
632
629
  res =
@@ -2,7 +2,11 @@ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import _ from 'lodash'
4
4
  // import Big from 'big.js'
5
- import { coverDigit2Uppercase, getDataKey } from '../util'
5
+ import {
6
+ coverDigit2Uppercase,
7
+ getDataKey,
8
+ formatSumWithPrecision
9
+ } from '../util'
6
10
  import { observer } from 'mobx-react'
7
11
  import classNames from 'classnames'
8
12
  import Big from 'big.js'
@@ -15,20 +19,30 @@ const DiyOverallOrder = props => {
15
19
  } = props
16
20
  const tableData = printerStore.data._table[getDataKey(dataKey)] || []
17
21
 
22
+ const formatter = printerStore.config?.payAmountFormatter
23
+ const highPrecisionMapping = printerStore.config?.highPrecisionFieldMapping
24
+
18
25
  // 计算合计
19
26
  const sumData = field => {
20
- return _.reduce(
27
+ // 查找高精度字段,有则直接从原始数据取值,避免 templateTable 的精度损失
28
+ const hpField = highPrecisionMapping?.[field]
29
+ const sum = _.reduce(
21
30
  tableData,
22
31
  (a, b, i) => {
23
32
  let result = a
24
- const bRes = printerStore
25
- .templateTable(field, dataKey, i, pageIndex)
26
- .replace(/\(\)/g, '')
27
- result = a.plus(+bRes || 0)
33
+ if (hpField) {
34
+ result = a.plus(b._origin?.[hpField] ?? b[hpField] ?? 0)
35
+ } else {
36
+ const bRes = printerStore
37
+ .templateTable(field, dataKey, i, pageIndex)
38
+ .replace(/\(\)/g, '')
39
+ result = a.plus(+bRes || 0)
40
+ }
28
41
  return result
29
42
  },
30
43
  Big(0)
31
- ).toFixed(2)
44
+ )
45
+ return formatSumWithPrecision(sum, formatter)
32
46
  }
33
47
 
34
48
  if (!diyOverallOrder?.show || !printerStore?.ready) {
@@ -1,7 +1,15 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import _ from 'lodash'
4
- import { coverDigit2Uppercase, getDataKey, isMultiTable } from '../util'
4
+ import {
5
+ coverDigit2Uppercase,
6
+ getDataKey,
7
+ isMultiTable,
8
+ formatSumWithPrecision,
9
+ toSumColTemplate,
10
+ templateSumResult,
11
+ extractSumField
12
+ } from '../util'
5
13
  import { MULTI_SUFFIX, MULTI_SUFFIX3 } from '../config'
6
14
  import { observer } from 'mobx-react'
7
15
  import classNames from 'classnames'
@@ -43,14 +51,23 @@ const DiySummary = props => {
43
51
  // 判断是否是多栏表格
44
52
  const isMulti = isMultiTable(dataKey)
45
53
 
46
- // 计算合计
54
+ const formatter = printerStore.config?.payAmountFormatter
55
+ const highPrecisionMapping = printerStore.config?.highPrecisionFieldMapping
56
+
57
+ // 计算合计(逐行取原始列值,内置函数只作用在最终合计结果上)
47
58
  const sumData = field => {
59
+ // 查找高精度字段,有则直接从原始数据取值,避免 templateTable 的精度损失
60
+ // 兼容映射 key 为模板串或字段名两种写法
61
+ const fieldKey = extractSumField(field)
62
+ const hpField =
63
+ highPrecisionMapping?.[field] || highPrecisionMapping?.[fieldKey]
64
+
48
65
  if (isMulti) {
49
- return _.reduce(
66
+ // 多栏表格暂不使用高精度字段,保持原有 templateTable 逻辑
67
+ const sum = _.reduce(
50
68
  tableData,
51
69
  (a, b, i) => {
52
70
  let result = a
53
- // 先通过 templateTable 获取原始字段的值
54
71
  const bRes = getRes(field, i)
55
72
  result = a.plus(+bRes || 0)
56
73
 
@@ -65,10 +82,24 @@ const DiySummary = props => {
65
82
  return result
66
83
  },
67
84
  Big(0)
68
- ).toFixed(2)
85
+ )
86
+ return formatSumWithPrecision(sum, formatter)
87
+ }
88
+
89
+ // 单栏:有高精度字段则直接从原始数据取值
90
+ if (hpField) {
91
+ const sum = _.reduce(
92
+ tableData,
93
+ (a, b) => {
94
+ return a.plus(b._origin?.[hpField] ?? b[hpField] ?? 0)
95
+ },
96
+ Big(0)
97
+ )
98
+ return formatSumWithPrecision(sum, formatter)
69
99
  }
70
100
 
71
- return _.reduce(
101
+ // 兜底:无高精度字段,使用 templateTable
102
+ const sum = _.reduce(
72
103
  tableData,
73
104
  (a, b, i) => {
74
105
  let result = a
@@ -77,7 +108,8 @@ const DiySummary = props => {
77
108
  return result
78
109
  },
79
110
  Big(0)
80
- ).toFixed(2)
111
+ )
112
+ return formatSumWithPrecision(sum, formatter)
81
113
 
82
114
  function getRes(field, i) {
83
115
  return printerStore
@@ -99,8 +131,16 @@ const DiySummary = props => {
99
131
  const isUpperLowerCaseSeparate = diyConfig?.isUpperLowerCaseSeparate
100
132
  const isUpperCaseBefore = diyConfig?.isUpperCaseBefore
101
133
  const needUpperCase = diyConfig?.needUpperCase
102
- const numericValue = sumData(leftField.valueField)
103
- const upperCaseValue = needUpperCase ? coverDigit2Uppercase(numericValue) : ''
134
+ const fieldKey = extractSumField(leftField.valueField)
135
+ // 求和用去掉内置函数后的列模板,多栏/高精度逻辑保持不变
136
+ const numericValue = sumData(toSumColTemplate(leftField.valueField))
137
+ // 仅对合计结果做模板/内置函数渲染
138
+ const displayValue = templateSumResult(
139
+ leftField.valueField,
140
+ numericValue,
141
+ fieldKey
142
+ )
143
+ const upperCaseValue = needUpperCase ? coverDigit2Uppercase(displayValue) : ''
104
144
 
105
145
  const leftText = () => {
106
146
  if (isUpperLowerCaseSeparate) {
@@ -109,25 +149,25 @@ const DiySummary = props => {
109
149
  return upperCaseValue
110
150
  }
111
151
  // 小写金额在前
112
- return numericValue
152
+ return displayValue
113
153
  }
114
154
 
115
155
  // 大写金额在前且需要大写金额
116
156
  if (isUpperCaseBefore) {
117
- return `${upperCaseValue} ${numericValue}`
157
+ return `${upperCaseValue} ${displayValue}`
118
158
  }
119
159
 
120
160
  if (needUpperCase) {
121
- return `${numericValue} ${upperCaseValue}`
161
+ return `${displayValue} ${upperCaseValue}`
122
162
  }
123
163
 
124
- return numericValue
164
+ return displayValue
125
165
  }
126
166
 
127
167
  const rightText = () => {
128
168
  if (isUpperLowerCaseSeparate) {
129
169
  if (isUpperCaseBefore) {
130
- return `${rightName} ${numericValue}`
170
+ return `${rightName} ${displayValue}`
131
171
  }
132
172
  return `${rightName} ${upperCaseValue}`
133
173
  }
@@ -4,7 +4,13 @@ import PropTypes from 'prop-types'
4
4
  import _ from 'lodash'
5
5
  import { MULTI_SUFFIX, MULTI_SUFFIX3 } from '../config'
6
6
  import Big from 'big.js'
7
- import { coverDigit2Uppercase, getDataKey } from '../util'
7
+ import {
8
+ coverDigit2Uppercase,
9
+ getDataKey,
10
+ formatSumWithPrecision,
11
+ extractSumField,
12
+ templateSumResult
13
+ } from '../util'
8
14
  import { observer } from 'mobx-react'
9
15
  import { get } from 'mobx'
10
16
  import classNames from 'classnames'
@@ -45,69 +51,65 @@ const SubtotalTr = props => {
45
51
  isSomeSubtotalTr
46
52
  } = props
47
53
  const tableData = printerStore.data._table[getDataKey(dataKey, arrange)] || []
48
- // 计算合计
49
- const sumData = (list, field) => {
50
- return _.reduce(
51
- list,
52
- (a, b) => {
53
- let result = a
54
-
55
- const _origin = b._origin || {}
56
- const _origin2 = b['_origin' + MULTI_SUFFIX] || {}
57
- const _origin3 = b['_origin' + MULTI_SUFFIX3] || {}
58
-
59
- result = a.plus(_origin[field] || 0)
60
- if (_origin2[field]) {
61
- result = result.plus(_origin2[field])
62
- }
63
- if (_origin3[field]) {
64
- result = result.plus(_origin3[field])
65
- }
66
- return result
67
- },
68
- Big(0)
69
- ).toFixed(2)
70
- }
71
54
 
72
55
  // 计算合计
73
- const sumData2 = (list, field) => {
56
+ const sumData2 = (list, field, formatter, highPrecisionMapping) => {
57
+ // 在字段名转换前,查找是否有高精度字段
58
+ const hpField = highPrecisionMapping?.[field]
59
+
74
60
  // 兼容之前
75
61
  if (field === 'total_item_price') field = '下单金额'
76
62
  if (field === 'real_item_price') field = '出库金额'
77
63
  if (field === 'settle_money2') field = '结算金额'
78
64
  if (field === 'total_money2') field = '金额'
79
- return _.reduce(
65
+
66
+ const sum = _.reduce(
80
67
  list,
81
68
  (a, b) => {
82
69
  let result = a
83
- result = a.plus(b[field] || 0)
84
- if (b?.[field + MULTI_SUFFIX]) {
70
+ // 优先使用高精度字段(从 _origin 中取原始数据)
71
+ if (hpField) {
72
+ result = a.plus(b._origin?.[hpField] ?? b[hpField] ?? 0)
73
+ } else {
74
+ result = a.plus(b[field] || 0)
75
+ }
76
+ if (!hpField && b?.[field + MULTI_SUFFIX]) {
85
77
  result = result.plus(b?.[field + MULTI_SUFFIX])
86
78
  }
87
- if (b?.[field + MULTI_SUFFIX3]) {
79
+ if (!hpField && b?.[field + MULTI_SUFFIX3]) {
88
80
  result = result.plus(b?.[field + MULTI_SUFFIX3])
89
81
  }
90
82
  return result
91
83
  },
92
84
  Big(0)
93
- ).toFixed(2)
85
+ )
86
+ return formatSumWithPrecision(sum, formatter)
94
87
  }
95
88
 
96
89
  const getData = field => {
97
90
  const data = printerStore.data.common
98
91
  return data?.[field] ?? ''
99
92
  }
93
+ const formatter = printerStore.config?.payAmountFormatter
94
+ const highPrecisionMapping = printerStore.config?.highPrecisionFieldMapping
100
95
  // 每页小计
101
96
  // show 是否展示小计,fields<Array> 合计的字段和展现的name,displayName 是否显示名字
102
97
  if (show && printerStore.ready) {
103
98
  const list = tableData.slice(range.begin, range.end)
104
99
 
100
+ // 先按字段求和,再对结果做模板/内置函数渲染
101
+ const formatSumValue = valueField => {
102
+ const fieldKey = extractSumField(valueField)
103
+ const sum = sumData2(list, fieldKey, formatter, highPrecisionMapping)
104
+ return templateSumResult(valueField, sum, fieldKey)
105
+ }
106
+
105
107
  // 针对结款单的
106
108
  if (isSomeSubtotalTr) {
107
109
  const sum = {}
108
110
 
109
111
  _.each(fields, v => {
110
- sum[v.name] = sumData2(list, v.valueField)
112
+ sum[v.name] = formatSumValue(v.valueField)
111
113
  })
112
114
  let subtotalStr = ''
113
115
  for (const name in sum) {
@@ -137,6 +139,18 @@ const SubtotalTr = props => {
137
139
  return (
138
140
  <tr>
139
141
  {_.map(fields, (item, index) => {
142
+ const fieldKey = extractSumField(item.valueField)
143
+ const sumDisplay =
144
+ item.type === 'useSummarize'
145
+ ? templateSumResult(
146
+ item.valueField,
147
+ getData(fieldKey),
148
+ fieldKey
149
+ )
150
+ : index === 0
151
+ ? formatSumValue(item.valueField)
152
+ : ''
153
+
140
154
  return (
141
155
  <td colSpan={item.colSpan ?? 99} key={index}>
142
156
  <div
@@ -162,23 +176,12 @@ const SubtotalTr = props => {
162
176
  }
163
177
  >
164
178
  {/* 这样写是为了支持自定义单元,index = 1时是自定义单元格 */}
165
- {item.type === 'useSummarize'
166
- ? getData(item.valueField)
167
- : index === 0
168
- ? sumData2(list, item.valueField)
169
- : ''}
170
- {/* {index === 0 ? sumData(list, item.valueField) : ''} */}
179
+ {sumDisplay}
171
180
  </span>
172
181
  {subtotal?.needUpperCase && ( // 是否需要大写金额
173
182
  <span>
174
- {item.type === 'useSummarize'
175
- ? '大写:' +
176
- coverDigit2Uppercase(getData(item.valueField))
177
- : index === 0
178
- ? '大写:' +
179
- coverDigit2Uppercase(
180
- sumData2(list, item.valueField)
181
- )
183
+ {sumDisplay
184
+ ? '大写:' + coverDigit2Uppercase(sumDisplay)
182
185
  : ''}
183
186
  </span>
184
187
  )}