gm-printer 10.42.3-beta.4 → 10.42.4-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.
@@ -4,7 +4,7 @@ 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, maskedSum } from '../util'
7
+ import { coverDigit2Uppercase, getDataKey } from '../util'
8
8
  import { observer } from 'mobx-react'
9
9
  import { get } from 'mobx'
10
10
  import classNames from 'classnames'
@@ -76,18 +76,21 @@ const SubtotalTr = props => {
76
76
  if (field === 'real_item_price') field = '出库金额'
77
77
  if (field === 'settle_money2') field = '结算金额'
78
78
  if (field === 'total_money2') field = '金额'
79
- // 收集本列所有值(含多栏后缀列),任一脱敏 '***' 则合计显 '***',否则 Big('***') 会崩溃
80
- const values = []
81
- _.each(list, b => {
82
- values.push(b[field])
83
- if (b?.[field + MULTI_SUFFIX]) {
84
- values.push(b[field + MULTI_SUFFIX])
85
- }
86
- if (b?.[field + MULTI_SUFFIX3]) {
87
- values.push(b[field + MULTI_SUFFIX3])
88
- }
89
- })
90
- return maskedSum(values)
79
+ return _.reduce(
80
+ list,
81
+ (a, b) => {
82
+ let result = a
83
+ result = a.plus(b[field] || 0)
84
+ if (b?.[field + MULTI_SUFFIX]) {
85
+ result = result.plus(b?.[field + MULTI_SUFFIX])
86
+ }
87
+ if (b?.[field + MULTI_SUFFIX3]) {
88
+ result = result.plus(b?.[field + MULTI_SUFFIX3])
89
+ }
90
+ return result
91
+ },
92
+ Big(0)
93
+ ).toFixed(2)
91
94
  }
92
95
 
93
96
  const getData = field => {
package/src/util.js CHANGED
@@ -120,23 +120,7 @@ function getOverallOrderTrHeight(overallOrder) {
120
120
  }
121
121
 
122
122
  // eslint-disable-next-line
123
- // 成本权限脱敏值:后端对无成本权限用户的金额字段返回 '***'(商品维度混合脱敏)
124
- const MASKED_VALUE = '***'
125
- const isMaskedValue = v => v === MASKED_VALUE
126
-
127
- /**
128
- * 脱敏感知求和:任一值为 '***' 则整体返回 '***'(口径:合计不能暴露脱敏行的贡献)
129
- * 非数字值按 0 容错,同时兼容原始数值字段与渲染后字符串
130
- * @param {Array} values 参与求和的值
131
- */
132
- const maskedSum = values => {
133
- if (values.some(isMaskedValue)) return MASKED_VALUE
134
- return values.reduce((a, b) => a.plus(+b || 0), Big(0)).toFixed(2)
135
- }
136
-
137
123
  const coverDigit2Uppercase = n => {
138
- // 脱敏值直接透传:否则 Math.abs('***') 得 NaN,Big(NaN) 会抛异常
139
- if (isMaskedValue(n)) return MASKED_VALUE
140
124
  if (_.isNil(n) || _.isNaN(n)) {
141
125
  return '-'
142
126
  }
@@ -400,8 +384,5 @@ export {
400
384
  caclSingleDetailsPageHeight,
401
385
  getArrayMid,
402
386
  getColSpanLength,
403
- getOverallOrderTrHeight,
404
- MASKED_VALUE,
405
- isMaskedValue,
406
- maskedSum
387
+ getOverallOrderTrHeight
407
388
  }