gm-printer 10.42.3-beta.0 → 10.42.3
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/build/demo.js +9 -9
- package/locales/en.json +0 -3
- package/locales/th.json +0 -3
- package/locales/zh-HK.json +0 -3
- package/package.json +1 -1
- package/src/common/common_context_menu.js +4 -6
- package/src/common/component.js +8 -64
- package/src/common/editor_edit_field.js +1 -6
- package/src/common/editor_store.js +3 -13
- package/src/common/hoc_with_store.js +0 -9
- package/src/common/style.lesss +0 -43
- package/src/editor/store.js +0 -13
- package/src/finance_voucher/components/table_subtotal_tr.js +18 -12
- package/src/index.js +0 -2
- package/src/printer/block.js +4 -154
- package/src/printer/multi_column.js +0 -1
- package/src/printer/page_summary.js +1 -3
- package/src/printer/printer.js +1 -1
- package/src/printer/store.js +6 -8
- package/src/printer/table_diy_overallOrder_tr.js +15 -8
- package/src/printer/table_diy_summary_tr.js +35 -18
- package/src/printer/table_subtotal_tr.js +16 -13
- package/src/util.js +1 -20
- package/yarn-error.log +152 -372
package/src/printer/printer.js
CHANGED
|
@@ -132,7 +132,7 @@ class Printer extends React.Component {
|
|
|
132
132
|
printerStore.changeTableData()
|
|
133
133
|
printerStore.computedPages()
|
|
134
134
|
}
|
|
135
|
-
// 获取剩余空白高度,传到
|
|
135
|
+
// 获取剩余空白高度,传到editor
|
|
136
136
|
getremainpageHeight && getremainpageHeight(printerStore.remainPageHeight)
|
|
137
137
|
}
|
|
138
138
|
printerStore.setReady(true)
|
package/src/printer/store.js
CHANGED
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
getDataKey,
|
|
8
8
|
caclSingleDetailsPageHeight,
|
|
9
9
|
getArrayMid,
|
|
10
|
-
getOverallOrderTrHeight
|
|
11
|
-
isMaskedValue
|
|
10
|
+
getOverallOrderTrHeight
|
|
12
11
|
} from '../util'
|
|
13
12
|
import {
|
|
14
13
|
isDetailOneRowSelectKey,
|
|
@@ -47,8 +46,6 @@ const canSplitRowDetails = (dataKey, row) => {
|
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
const price = (n, f = 2) => {
|
|
50
|
-
// 脱敏值 '***' 原样返回(不能走 isNaN 判空,空单元格仍需显空)
|
|
51
|
-
if (isMaskedValue(n)) return n
|
|
52
49
|
if (isNaN(n)) return null
|
|
53
50
|
return Big(n || 0).toFixed(f)
|
|
54
51
|
}
|
|
@@ -398,7 +395,7 @@ class PrinterStore {
|
|
|
398
395
|
const currentPageMinimumHeight =
|
|
399
396
|
allPagesHaveThisHeight + allTableHaveThisHeight
|
|
400
397
|
// 最后一项是表格时,末页仍要渲染签名:装行可用高度预留签名,避免空行顶进签名区
|
|
401
|
-
const isLastContent = index ===
|
|
398
|
+
const isLastContent = index === this.config.contents.length - 1
|
|
402
399
|
const signReserve = isLastContent ? this.getSignHeight() : 0
|
|
403
400
|
/** 当前page可容纳的table高度 */
|
|
404
401
|
let pageAccomodateTableHeight = roundHeight(
|
|
@@ -490,7 +487,7 @@ class PrinterStore {
|
|
|
490
487
|
)
|
|
491
488
|
break
|
|
492
489
|
}
|
|
493
|
-
//
|
|
490
|
+
// 行无法拆分(普通长文本列)或拆分失败
|
|
494
491
|
if (end === begin) {
|
|
495
492
|
// 新一页可容纳的 table 高度(页高 - 页眉页脚)
|
|
496
493
|
const fullPageAccomodateTableHeight = roundHeight(
|
|
@@ -609,8 +606,9 @@ class PrinterStore {
|
|
|
609
606
|
currentPageHeight += this.getSignHeight()
|
|
610
607
|
}
|
|
611
608
|
|
|
612
|
-
this.remainPageHeight = Math.
|
|
613
|
-
|
|
609
|
+
this.remainPageHeight = Math.max(
|
|
610
|
+
0,
|
|
611
|
+
Math.round(pageHeight - currentPageHeight)
|
|
614
612
|
)
|
|
615
613
|
this.isSave = false
|
|
616
614
|
this.config.isSave = false
|
|
@@ -2,9 +2,10 @@ 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
|
|
5
|
+
import { coverDigit2Uppercase, getDataKey } from '../util'
|
|
6
6
|
import { observer } from 'mobx-react'
|
|
7
7
|
import classNames from 'classnames'
|
|
8
|
+
import Big from 'big.js'
|
|
8
9
|
|
|
9
10
|
const DiyOverallOrder = props => {
|
|
10
11
|
const {
|
|
@@ -14,14 +15,20 @@ const DiyOverallOrder = props => {
|
|
|
14
15
|
} = props
|
|
15
16
|
const tableData = printerStore.data._table[getDataKey(dataKey)] || []
|
|
16
17
|
|
|
17
|
-
//
|
|
18
|
+
// 计算合计
|
|
18
19
|
const sumData = field => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
return _.reduce(
|
|
21
|
+
tableData,
|
|
22
|
+
(a, b, i) => {
|
|
23
|
+
let result = a
|
|
24
|
+
const bRes = printerStore
|
|
25
|
+
.templateTable(field, dataKey, i, pageIndex)
|
|
26
|
+
.replace(/\(\)/g, '')
|
|
27
|
+
result = a.plus(+bRes || 0)
|
|
28
|
+
return result
|
|
29
|
+
},
|
|
30
|
+
Big(0)
|
|
31
|
+
).toFixed(2)
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
if (!diyOverallOrder?.show || !printerStore?.ready) {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import _ from 'lodash'
|
|
4
|
-
import {
|
|
5
|
-
coverDigit2Uppercase,
|
|
6
|
-
getDataKey,
|
|
7
|
-
isMultiTable,
|
|
8
|
-
maskedSum
|
|
9
|
-
} from '../util'
|
|
4
|
+
import { coverDigit2Uppercase, getDataKey, isMultiTable } from '../util'
|
|
10
5
|
import { MULTI_SUFFIX, MULTI_SUFFIX3 } from '../config'
|
|
11
6
|
import { observer } from 'mobx-react'
|
|
12
7
|
import classNames from 'classnames'
|
|
8
|
+
import Big from 'big.js'
|
|
13
9
|
|
|
14
10
|
function buildTemplateField(fieldStr, suffix) {
|
|
15
11
|
// 如果 field 是 "{{列.下单数}}",提取出 "下单数"
|
|
@@ -49,18 +45,39 @@ const DiySummary = props => {
|
|
|
49
45
|
|
|
50
46
|
// 计算合计
|
|
51
47
|
const sumData = field => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
if (isMulti) {
|
|
49
|
+
return _.reduce(
|
|
50
|
+
tableData,
|
|
51
|
+
(a, b, i) => {
|
|
52
|
+
let result = a
|
|
53
|
+
// 先通过 templateTable 获取原始字段的值
|
|
54
|
+
const bRes = getRes(field, i)
|
|
55
|
+
result = a.plus(+bRes || 0)
|
|
56
|
+
|
|
57
|
+
// 双栏
|
|
58
|
+
const multiField = buildTemplateField(field, MULTI_SUFFIX)
|
|
59
|
+
result = result.plus(+getRes(multiField, i) || 0)
|
|
60
|
+
|
|
61
|
+
// 三栏
|
|
62
|
+
const multiField3 = buildTemplateField(field, MULTI_SUFFIX3)
|
|
63
|
+
result = result.plus(+getRes(multiField3, i) || 0)
|
|
64
|
+
|
|
65
|
+
return result
|
|
66
|
+
},
|
|
67
|
+
Big(0)
|
|
68
|
+
).toFixed(2)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return _.reduce(
|
|
72
|
+
tableData,
|
|
73
|
+
(a, b, i) => {
|
|
74
|
+
let result = a
|
|
75
|
+
const bRes = getRes(field, i)
|
|
76
|
+
result = a.plus(+bRes || 0)
|
|
77
|
+
return result
|
|
78
|
+
},
|
|
79
|
+
Big(0)
|
|
80
|
+
).toFixed(2)
|
|
64
81
|
|
|
65
82
|
function getRes(field, i) {
|
|
66
83
|
return printerStore
|
|
@@ -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
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
}
|