gm-printer 10.14.2-alpha.3 → 10.14.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 +1 -1
- package/build/demo.js +54 -0
- package/package.json +1 -1
- package/src/common/editor_edit_field.js +12 -120
- package/src/common/editor_store.js +8 -290
- package/src/components/flex/index.js +43 -72
- package/src/components/flex/style.less +1 -5
- package/src/editor/context_menu.js +2 -18
- package/src/editor_settle/editor.js +3 -7
- package/src/printer/printer.js +1 -5
- package/src/printer/store.js +7 -17
- package/src/printer/style.lesss +0 -12
- package/src/printer/table.js +7 -10
- package/src/printer/table_subtotal_tr.js +66 -56
- package/src/util.js +1 -22
- package/src/printer/table_overallOrder_tr.js +0 -65
- package/yarn-error.log +0 -9663
|
@@ -3,87 +3,63 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
|
|
5
5
|
class Flex extends React.Component {
|
|
6
|
-
render() {
|
|
6
|
+
render () {
|
|
7
7
|
const {
|
|
8
8
|
flex,
|
|
9
9
|
|
|
10
|
-
auto,
|
|
11
|
-
none,
|
|
12
|
-
width,
|
|
13
|
-
height,
|
|
10
|
+
auto, none, width, height,
|
|
14
11
|
|
|
15
|
-
row,
|
|
16
|
-
column,
|
|
12
|
+
row, column,
|
|
17
13
|
|
|
18
|
-
wrap,
|
|
19
|
-
nowrap,
|
|
20
|
-
flexGrow,
|
|
14
|
+
wrap, nowrap,
|
|
21
15
|
|
|
22
|
-
justifyStart,
|
|
23
|
-
justifyEnd,
|
|
24
|
-
justifyCenter,
|
|
25
|
-
justifyBetween,
|
|
26
|
-
justifyAround,
|
|
16
|
+
justifyStart, justifyEnd, justifyCenter, justifyBetween, justifyAround,
|
|
27
17
|
|
|
28
|
-
alignStart,
|
|
29
|
-
alignEnd,
|
|
30
|
-
alignCenter,
|
|
31
|
-
alignBaseline,
|
|
32
|
-
alignStretch,
|
|
18
|
+
alignStart, alignEnd, alignCenter, alignBaseline, alignStretch,
|
|
33
19
|
|
|
34
|
-
alignContentStart,
|
|
35
|
-
alignContentEnd,
|
|
36
|
-
alignContentCenter,
|
|
37
|
-
alignContentBetween,
|
|
38
|
-
alignContentAround,
|
|
39
|
-
alignContentStretch,
|
|
20
|
+
alignContentStart, alignContentEnd, alignContentCenter, alignContentBetween, alignContentAround, alignContentStretch,
|
|
40
21
|
|
|
41
|
-
className,
|
|
42
|
-
style,
|
|
22
|
+
className, style,
|
|
43
23
|
|
|
44
24
|
...rest
|
|
45
25
|
} = this.props
|
|
46
|
-
const cn = classNames(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'gm-flex-align-content-stretch': alignContentStretch
|
|
79
|
-
},
|
|
80
|
-
className
|
|
81
|
-
)
|
|
26
|
+
const cn = classNames({
|
|
27
|
+
'gm-flex': true,
|
|
28
|
+
|
|
29
|
+
'gm-flex-flex': flex,
|
|
30
|
+
'gm-flex-auto': auto,
|
|
31
|
+
'gm-flex-none': none || width || height,
|
|
32
|
+
|
|
33
|
+
'gm-flex-row': row,
|
|
34
|
+
'gm-flex-column': column,
|
|
35
|
+
|
|
36
|
+
'gm-flex-wrap': wrap,
|
|
37
|
+
'gm-flex-nowrap': nowrap,
|
|
38
|
+
|
|
39
|
+
'gm-flex-justify-start': justifyStart,
|
|
40
|
+
'gm-flex-justify-end': justifyEnd,
|
|
41
|
+
'gm-flex-justify-center': justifyCenter,
|
|
42
|
+
'gm-flex-justify-between': justifyBetween,
|
|
43
|
+
'gm-flex-justify-around': justifyAround,
|
|
44
|
+
|
|
45
|
+
'gm-flex-align-start': alignStart,
|
|
46
|
+
'gm-flex-align-end': alignEnd,
|
|
47
|
+
'gm-flex-align-center': alignCenter,
|
|
48
|
+
'gm-flex-align-baseline': alignBaseline,
|
|
49
|
+
'gm-flex-align-stretch': alignStretch,
|
|
50
|
+
|
|
51
|
+
'gm-flex-align-content-start': alignContentStart,
|
|
52
|
+
'gm-flex-align-content-end': alignContentEnd,
|
|
53
|
+
'gm-flex-align-content-center': alignContentCenter,
|
|
54
|
+
'gm-flex-align-content-between': alignContentBetween,
|
|
55
|
+
'gm-flex-align-content-around': alignContentAround,
|
|
56
|
+
'gm-flex-align-content-stretch': alignContentStretch
|
|
57
|
+
}, className)
|
|
82
58
|
|
|
83
59
|
let s = Object.assign({}, style)
|
|
84
60
|
if (flex) {
|
|
85
|
-
s.flex = typeof flex === 'boolean' ? 1 : flex
|
|
86
|
-
s.WebKitFlex = typeof flex === 'boolean' ? 1 : flex
|
|
61
|
+
s.flex = (typeof flex === 'boolean') ? 1 : flex
|
|
62
|
+
s.WebKitFlex = (typeof flex === 'boolean') ? 1 : flex
|
|
87
63
|
}
|
|
88
64
|
if (height) {
|
|
89
65
|
s.height = height
|
|
@@ -92,11 +68,7 @@ class Flex extends React.Component {
|
|
|
92
68
|
s.width = width
|
|
93
69
|
}
|
|
94
70
|
|
|
95
|
-
return
|
|
96
|
-
<div {...rest} className={cn} style={s}>
|
|
97
|
-
{this.props.children}
|
|
98
|
-
</div>
|
|
99
|
-
)
|
|
71
|
+
return <div {...rest} className={cn} style={s}>{this.props.children}</div>
|
|
100
72
|
}
|
|
101
73
|
}
|
|
102
74
|
|
|
@@ -109,7 +81,6 @@ Flex.propTypes = {
|
|
|
109
81
|
row: PropTypes.bool,
|
|
110
82
|
column: PropTypes.bool,
|
|
111
83
|
wrap: PropTypes.bool,
|
|
112
|
-
flexGrow: PropTypes.bool,
|
|
113
84
|
nowrap: PropTypes.bool,
|
|
114
85
|
justifyStart: PropTypes.bool,
|
|
115
86
|
justifyEnd: PropTypes.bool,
|
|
@@ -19,10 +19,6 @@
|
|
|
19
19
|
align-items: stretch;
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
|
|
22
|
-
&.gm-flex-grow {
|
|
23
|
-
flex-grow: 1;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
22
|
&.gm-flex-wrap {
|
|
27
23
|
flex-wrap: wrap;
|
|
28
24
|
}
|
|
@@ -102,4 +98,4 @@
|
|
|
102
98
|
&.gm-flex-align-content-stretch {
|
|
103
99
|
align-content: stretch;
|
|
104
100
|
}
|
|
105
|
-
}
|
|
101
|
+
}
|
|
@@ -61,6 +61,7 @@ class ContextMenu extends React.Component {
|
|
|
61
61
|
|
|
62
62
|
handleSubtotal = name => {
|
|
63
63
|
const { editStore } = this.props
|
|
64
|
+
|
|
64
65
|
editStore.setSubtotalShow(name)
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -69,11 +70,6 @@ class ContextMenu extends React.Component {
|
|
|
69
70
|
editStore.handleChangeTableData(isAutoFilling)
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
handleOverallOrder = name => {
|
|
73
|
-
const { editStore } = this.props
|
|
74
|
-
editStore.setOverallOrderShow(name)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
73
|
renderOrderActionBtn = name => {
|
|
78
74
|
if (!this.hasSubtotalBtn(name)) {
|
|
79
75
|
return null
|
|
@@ -88,18 +84,13 @@ class ContextMenu extends React.Component {
|
|
|
88
84
|
}
|
|
89
85
|
} = this.props
|
|
90
86
|
const arr = name.split('.')
|
|
91
|
-
const {
|
|
92
|
-
dataKey,
|
|
93
|
-
subtotal,
|
|
94
|
-
overallOrder
|
|
95
|
-
} = this.props.editStore.config.contents[arr[2]]
|
|
87
|
+
const { dataKey, subtotal } = this.props.editStore.config.contents[arr[2]]
|
|
96
88
|
const keyArr = dataKey.split('_')
|
|
97
89
|
|
|
98
90
|
const isMultiActive = keyArr.includes('multi')
|
|
99
91
|
const isThreeActive = keyArr.includes('multi3')
|
|
100
92
|
const isCategoryActive = keyArr.includes('category')
|
|
101
93
|
const isSubtotalActive = subtotal.show
|
|
102
|
-
const isOverallOrder = overallOrder?.show
|
|
103
94
|
|
|
104
95
|
return (
|
|
105
96
|
<>
|
|
@@ -136,12 +127,6 @@ class ContextMenu extends React.Component {
|
|
|
136
127
|
>
|
|
137
128
|
{i18next.t('行数填充')}
|
|
138
129
|
</div>
|
|
139
|
-
<div
|
|
140
|
-
onClick={this.handleOverallOrder.bind(this, name)}
|
|
141
|
-
className={isOverallOrder ? 'active' : ''}
|
|
142
|
-
>
|
|
143
|
-
{i18next.t('整单合计')}
|
|
144
|
-
</div>
|
|
145
130
|
</>
|
|
146
131
|
)
|
|
147
132
|
}
|
|
@@ -162,7 +147,6 @@ class ContextMenu extends React.Component {
|
|
|
162
147
|
config={editStore.config}
|
|
163
148
|
data={editStore.mockData}
|
|
164
149
|
getremainpageHeight={editStore.setRemainPageHeight}
|
|
165
|
-
overallorder={editStore.overallOrderShow}
|
|
166
150
|
/>
|
|
167
151
|
</CommonContextMenu>
|
|
168
152
|
)
|
|
@@ -23,7 +23,7 @@ const tableDataKeyList = [
|
|
|
23
23
|
@observer
|
|
24
24
|
class Editor extends React.Component {
|
|
25
25
|
render() {
|
|
26
|
-
const { onSave, showEditor, addFields
|
|
26
|
+
const { onSave, showEditor, addFields } = this.props
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<div className='gm-printer-edit'>
|
|
@@ -46,10 +46,7 @@ class Editor extends React.Component {
|
|
|
46
46
|
<Gap height='10px' />
|
|
47
47
|
<EditorSelect />
|
|
48
48
|
<Gap height='5px' />
|
|
49
|
-
<EditorField
|
|
50
|
-
tableDataKeyList={tableDataKeyList}
|
|
51
|
-
isSomeSubtotalTr={isSomeSubtotalTr}
|
|
52
|
-
/>
|
|
49
|
+
<EditorField tableDataKeyList={tableDataKeyList} />
|
|
53
50
|
<Gap height='5px' />
|
|
54
51
|
<EditorAddField addFields={addFields} />
|
|
55
52
|
|
|
@@ -72,8 +69,7 @@ Editor.propTypes = {
|
|
|
72
69
|
onSave: PropTypes.func,
|
|
73
70
|
showEditor: PropTypes.bool,
|
|
74
71
|
mockData: PropTypes.object.isRequired,
|
|
75
|
-
addFields: PropTypes.object.isRequired
|
|
76
|
-
isSomeSubtotalTr: PropTypes.bool
|
|
72
|
+
addFields: PropTypes.object.isRequired
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
Editor.defaultProps = {
|
package/src/printer/printer.js
CHANGED
|
@@ -81,9 +81,6 @@ class Printer extends React.Component {
|
|
|
81
81
|
this.props.printerStore.remainPageHeight
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
|
-
if (nextProps.overallorder !== this.props.overallorder) {
|
|
85
|
-
this.props.printerStore.setOverallOrder(nextProps.config)
|
|
86
|
-
}
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
componentDidMount() {
|
|
@@ -327,8 +324,7 @@ Printer.propTypes = {
|
|
|
327
324
|
config: PropTypes.object.isRequired,
|
|
328
325
|
onReady: PropTypes.func,
|
|
329
326
|
isSomeSubtotalTr: PropTypes.bool,
|
|
330
|
-
getremainpageHeight: PropTypes.func
|
|
331
|
-
overallorder: PropTypes.bool
|
|
327
|
+
getremainpageHeight: PropTypes.func
|
|
332
328
|
}
|
|
333
329
|
|
|
334
330
|
Printer.defaultProps = {
|
package/src/printer/store.js
CHANGED
|
@@ -4,14 +4,16 @@ import {
|
|
|
4
4
|
getSumTrHeight,
|
|
5
5
|
isMultiTable,
|
|
6
6
|
caclSingleDetailsPageHeight,
|
|
7
|
-
getArrayMid
|
|
8
|
-
getOverallOrderTrHeight
|
|
7
|
+
getArrayMid
|
|
9
8
|
} from '../util'
|
|
10
9
|
import _ from 'lodash'
|
|
11
10
|
import Big from 'big.js'
|
|
12
11
|
|
|
13
12
|
export const TR_BASE_HEIGHT = 23
|
|
14
|
-
const price = (n, f = 2) =>
|
|
13
|
+
const price = (n, f = 2) => {
|
|
14
|
+
if (isNaN(n)) return null
|
|
15
|
+
return Big(n || 0).toFixed(f)
|
|
16
|
+
}
|
|
15
17
|
class PrinterStore {
|
|
16
18
|
@observable ready = false
|
|
17
19
|
|
|
@@ -170,11 +172,6 @@ class PrinterStore {
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
@action
|
|
174
|
-
setOverallOrder(config) {
|
|
175
|
-
this.config = config || {}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
175
|
@action
|
|
179
176
|
computedData(dataKey, table, end, currentRemainTableHeight) {
|
|
180
177
|
/** 当前数据 */
|
|
@@ -246,13 +243,9 @@ class PrinterStore {
|
|
|
246
243
|
tableCount++
|
|
247
244
|
// 表格原始的高度和宽度信息
|
|
248
245
|
const table = this.tablesInfo[`contents.table.${index}`]
|
|
249
|
-
const { subtotal, dataKey, summaryConfig
|
|
246
|
+
const { subtotal, dataKey, summaryConfig } = content
|
|
250
247
|
// 如果显示每页合计,那么table高度多预留一行高度
|
|
251
248
|
const subtotalTrHeight = subtotal.show ? getSumTrHeight(subtotal) : 0
|
|
252
|
-
// 如果显示整单合计,那么table高度多预留一行高度
|
|
253
|
-
const overallOrderTrHeight = overallOrder?.show
|
|
254
|
-
? getOverallOrderTrHeight(overallOrder)
|
|
255
|
-
: 0
|
|
256
249
|
// 如果每页合计(新的),那么table高度多预留一行高度
|
|
257
250
|
const pageSummaryTrHeight =
|
|
258
251
|
summaryConfig?.pageSummaryShow && !isMultiTable(dataKey) // 双栏table没有每页合计
|
|
@@ -260,10 +253,7 @@ class PrinterStore {
|
|
|
260
253
|
: 0
|
|
261
254
|
// 每个表格都具有的高度
|
|
262
255
|
const allTableHaveThisHeight =
|
|
263
|
-
table.head.height +
|
|
264
|
-
subtotalTrHeight +
|
|
265
|
-
pageSummaryTrHeight +
|
|
266
|
-
overallOrderTrHeight
|
|
256
|
+
table.head.height + subtotalTrHeight + pageSummaryTrHeight
|
|
267
257
|
/** 当前page页面的最小高度 */
|
|
268
258
|
const currentPageMinimumHeight =
|
|
269
259
|
allPagesHaveThisHeight + allTableHaveThisHeight
|
package/src/printer/style.lesss
CHANGED
|
@@ -166,15 +166,3 @@
|
|
|
166
166
|
flex-grow: 1;
|
|
167
167
|
justify-content: space-between;
|
|
168
168
|
}
|
|
169
|
-
.gm-printer-subtotal-isUpperCaseBefore-inter{
|
|
170
|
-
order:2;
|
|
171
|
-
}
|
|
172
|
-
.gm-flex-justify-between-page{
|
|
173
|
-
justify-content: space-between;
|
|
174
|
-
}
|
|
175
|
-
.gm-flex-grow-page{
|
|
176
|
-
flex-grow: 1;
|
|
177
|
-
}
|
|
178
|
-
.gm-flex-page{
|
|
179
|
-
display:flex
|
|
180
|
-
}
|
package/src/printer/table.js
CHANGED
|
@@ -16,7 +16,6 @@ import { MULTI_SUFFIX } from '../config'
|
|
|
16
16
|
import SpecialTr from './table_special_tr'
|
|
17
17
|
import SubtotalTr from './table_subtotal_tr'
|
|
18
18
|
import PageSummary from './page_summary'
|
|
19
|
-
import OverallOrder from './table_overallOrder_tr'
|
|
20
19
|
|
|
21
20
|
@inject('printerStore')
|
|
22
21
|
@observer
|
|
@@ -117,14 +116,17 @@ class Table extends React.Component {
|
|
|
117
116
|
/{{(price\()?列\.([^{{]+)}}/g,
|
|
118
117
|
(s, s1, s2) => {
|
|
119
118
|
if (s1) {
|
|
120
|
-
// 有price
|
|
121
|
-
const
|
|
122
|
-
|
|
119
|
+
// 有price函数插进来, 匹配‘ _基本单位 ’类似的字符串并添加后缀,生成三栏或者双栏数据
|
|
120
|
+
const _s = s.replace(
|
|
121
|
+
/_[\u4e00-\u9fa5]*/g,
|
|
122
|
+
match => `${match}${MULTI_SUFFIX}${colNum}`
|
|
123
|
+
)
|
|
124
|
+
return _s
|
|
123
125
|
} else {
|
|
124
126
|
return `{{列.${s2}${MULTI_SUFFIX}${colNum}}}`
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
|
-
)
|
|
129
|
+
)
|
|
128
130
|
}
|
|
129
131
|
// 多栏商品的明细取 __details_MULTI_SUFFIX
|
|
130
132
|
if (val.specialDetailsKey)
|
|
@@ -291,11 +293,6 @@ class Table extends React.Component {
|
|
|
291
293
|
{this.props.config.subtotal.isCommutationPlace
|
|
292
294
|
? PageSummarySubtotalTr()
|
|
293
295
|
: subtotalTrPageSummary()}
|
|
294
|
-
<OverallOrder
|
|
295
|
-
range={range}
|
|
296
|
-
config={config}
|
|
297
|
-
printerStore={printerStore}
|
|
298
|
-
/>
|
|
299
296
|
</tbody>
|
|
300
297
|
</table>
|
|
301
298
|
)
|
|
@@ -7,18 +7,11 @@ import Big from 'big.js'
|
|
|
7
7
|
import { coverDigit2Uppercase, getDataKey } from '../util'
|
|
8
8
|
import { observer } from 'mobx-react'
|
|
9
9
|
import { get } from 'mobx'
|
|
10
|
-
import classNames from 'classnames'
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* 每页合计组件,分页计算后,根据range来统计每页合计数据
|
|
14
12
|
* @param props
|
|
15
13
|
* @returns {*}
|
|
16
14
|
*/
|
|
17
|
-
const flexStyle = {
|
|
18
|
-
left: 'flex-start',
|
|
19
|
-
center: 'center',
|
|
20
|
-
right: 'flex-end'
|
|
21
|
-
}
|
|
22
15
|
const SubtotalTr = props => {
|
|
23
16
|
const {
|
|
24
17
|
config: {
|
|
@@ -32,7 +25,7 @@ const SubtotalTr = props => {
|
|
|
32
25
|
style,
|
|
33
26
|
fields = [
|
|
34
27
|
{
|
|
35
|
-
name: i18next.t('
|
|
28
|
+
name: i18next.t('出库金额'),
|
|
36
29
|
valueField: 'real_item_price'
|
|
37
30
|
}
|
|
38
31
|
],
|
|
@@ -43,6 +36,7 @@ const SubtotalTr = props => {
|
|
|
43
36
|
printerStore,
|
|
44
37
|
isSomeSubtotalTr
|
|
45
38
|
} = props
|
|
39
|
+
|
|
46
40
|
const tableData = printerStore.data._table[getDataKey(dataKey, arrange)] || []
|
|
47
41
|
// 计算合计
|
|
48
42
|
const sumData = (list, field) => {
|
|
@@ -73,14 +67,18 @@ const SubtotalTr = props => {
|
|
|
73
67
|
if (show && printerStore.ready) {
|
|
74
68
|
const list = tableData.slice(range.begin, range.end)
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
const sum = {}
|
|
71
|
+
|
|
72
|
+
_.each(fields, v => {
|
|
73
|
+
sum[v.name] = sumData(list, v.valueField)
|
|
74
|
+
})
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
// 定义每页小记的左右两侧内容
|
|
77
|
+
let subtotalLeftContent
|
|
78
|
+
let subtotalRightContent
|
|
79
|
+
let subtotalStr = ''
|
|
80
|
+
// 结款单
|
|
81
|
+
if (isSomeSubtotalTr) {
|
|
84
82
|
for (const name in sum) {
|
|
85
83
|
const price = sum[name]
|
|
86
84
|
const priceUpperCase = get(subtotal, 'needUpperCase') // needUpperCase在初始模板中undefined,所以必须用这个方法
|
|
@@ -105,49 +103,61 @@ const SubtotalTr = props => {
|
|
|
105
103
|
</tr>
|
|
106
104
|
)
|
|
107
105
|
} else {
|
|
106
|
+
for (const name in sum) {
|
|
107
|
+
const price = sum[name]
|
|
108
|
+
const priceUpperCase = get(subtotal, 'needUpperCase') // needUpperCase在初始模板中undefined,所以必须用这个方法
|
|
109
|
+
? '大写:' + coverDigit2Uppercase(price)
|
|
110
|
+
: ''
|
|
111
|
+
if (displayName) {
|
|
112
|
+
// 大写金额是否在前
|
|
113
|
+
if (isUpperCaseBefore) {
|
|
114
|
+
subtotalLeftContent = `${name}${priceUpperCase}`
|
|
115
|
+
subtotalRightContent = `${price}`
|
|
116
|
+
} else {
|
|
117
|
+
subtotalLeftContent = `${price}`
|
|
118
|
+
subtotalRightContent = `${name} ${priceUpperCase}`
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
if (isUpperCaseBefore) {
|
|
122
|
+
subtotalLeftContent = `${priceUpperCase}`
|
|
123
|
+
subtotalRightContent = `${price}`
|
|
124
|
+
} else {
|
|
125
|
+
subtotalLeftContent = `${price}`
|
|
126
|
+
subtotalRightContent = `${priceUpperCase}`
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
108
131
|
return (
|
|
109
132
|
<tr>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
{subtotal?.needUpperCase && ( // 是否需要大写金额
|
|
139
|
-
<span>
|
|
140
|
-
{index === 0
|
|
141
|
-
? '大写:' +
|
|
142
|
-
coverDigit2Uppercase(sumData(list, item.valueField))
|
|
143
|
-
: ''}
|
|
144
|
-
</span>
|
|
145
|
-
)}
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
</td>
|
|
149
|
-
)
|
|
150
|
-
})}
|
|
133
|
+
<td
|
|
134
|
+
colSpan={99}
|
|
135
|
+
style={{ fontWeight: 'bold', ...style }}
|
|
136
|
+
// dangerouslySetInnerHTML={{
|
|
137
|
+
// __html: `${i18next.t('每页合计')}:${subtotalStr}`
|
|
138
|
+
// }}flex-grow: 1
|
|
139
|
+
>
|
|
140
|
+
{/* 大写金额和小写金额分开在表格的两侧,通过控制类名实现,添加类名后,覆盖原来的居中、靠右靠左 */}
|
|
141
|
+
<div
|
|
142
|
+
className={
|
|
143
|
+
isUpperLowerCaseSeparate
|
|
144
|
+
? 'gm-printer-subtotal-UpperLowerCaseSeparate-outer'
|
|
145
|
+
: ''
|
|
146
|
+
}
|
|
147
|
+
>
|
|
148
|
+
{i18next.t('每页合计')}:
|
|
149
|
+
<span
|
|
150
|
+
className={
|
|
151
|
+
isUpperLowerCaseSeparate
|
|
152
|
+
? 'gm-printer-subtotal-UpperLowerCaseSeparate-inter'
|
|
153
|
+
: ''
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<span> {subtotalLeftContent} </span>
|
|
157
|
+
<span> {subtotalRightContent} </span>
|
|
158
|
+
</span>
|
|
159
|
+
</div>
|
|
160
|
+
</td>
|
|
151
161
|
</tr>
|
|
152
162
|
)
|
|
153
163
|
}
|
package/src/util.js
CHANGED
|
@@ -108,14 +108,6 @@ function getSumTrHeight(SumTr) {
|
|
|
108
108
|
return (parseInt(fontSize) - 12) * 1.5 + 26
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function getOverallOrderTrHeight(overallOrder) {
|
|
112
|
-
const { fields = [] } = overallOrder
|
|
113
|
-
const fontSize = fields?.[0]?.style?.fontSize || '12px'
|
|
114
|
-
|
|
115
|
-
// 12px => 26, 14px => 29, 16px => 33, ...
|
|
116
|
-
return (parseInt(fontSize) - 12) * 1.5 + 26
|
|
117
|
-
}
|
|
118
|
-
|
|
119
111
|
// eslint-disable-next-line
|
|
120
112
|
const coverDigit2Uppercase = n => {
|
|
121
113
|
if (_.isNil(n) || _.isNaN(n)) {
|
|
@@ -282,17 +274,6 @@ const getArrayMid = arr => {
|
|
|
282
274
|
return majority
|
|
283
275
|
}
|
|
284
276
|
|
|
285
|
-
/**
|
|
286
|
-
* 获取整单合计colSpan合并的个数
|
|
287
|
-
* @param {*} table
|
|
288
|
-
* @returns number
|
|
289
|
-
*/
|
|
290
|
-
const getColSpanLength = table => {
|
|
291
|
-
return /multi/.test(table.dataKey)
|
|
292
|
-
? getMultiNumber(table.dataKey) * table.columns.length
|
|
293
|
-
: table.columns.length
|
|
294
|
-
}
|
|
295
|
-
|
|
296
277
|
export {
|
|
297
278
|
getHeight,
|
|
298
279
|
getWidth,
|
|
@@ -310,7 +291,5 @@ export {
|
|
|
310
291
|
isMultiTable,
|
|
311
292
|
getMultiNumber,
|
|
312
293
|
caclSingleDetailsPageHeight,
|
|
313
|
-
getArrayMid
|
|
314
|
-
getColSpanLength,
|
|
315
|
-
getOverallOrderTrHeight
|
|
294
|
+
getArrayMid
|
|
316
295
|
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import _ from 'lodash'
|
|
4
|
-
// import Big from 'big.js'
|
|
5
|
-
import { coverDigit2Uppercase } from '../util'
|
|
6
|
-
import { observer } from 'mobx-react'
|
|
7
|
-
import classNames from 'classnames'
|
|
8
|
-
|
|
9
|
-
const OverallOrder = props => {
|
|
10
|
-
const {
|
|
11
|
-
config: { overallOrder },
|
|
12
|
-
printerStore,
|
|
13
|
-
printerStore: {
|
|
14
|
-
data: { common }
|
|
15
|
-
}
|
|
16
|
-
} = props
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
overallOrder?.show &&
|
|
20
|
-
printerStore?.ready && (
|
|
21
|
-
<tr>
|
|
22
|
-
{_.map(overallOrder.fields, (item, index) => {
|
|
23
|
-
return (
|
|
24
|
-
<td colSpan={item.colSpan} key={index}>
|
|
25
|
-
<div style={{ ...item.style }} className='gm-flex-page'>
|
|
26
|
-
{item.name}
|
|
27
|
-
<div
|
|
28
|
-
className={classNames('gm-flex-page', {
|
|
29
|
-
'gm-flex-justify-between-page':
|
|
30
|
-
overallOrder?.isUpperLowerCaseSeparate,
|
|
31
|
-
'gm-flex-grow-page': overallOrder?.isUpperLowerCaseSeparate
|
|
32
|
-
})}
|
|
33
|
-
>
|
|
34
|
-
<span
|
|
35
|
-
className={
|
|
36
|
-
overallOrder?.isUpperCaseBefore
|
|
37
|
-
? 'gm-printer-subtotal-isUpperCaseBefore-inter'
|
|
38
|
-
: ''
|
|
39
|
-
}
|
|
40
|
-
>
|
|
41
|
-
{common?.[item.valueField] ?? ''}
|
|
42
|
-
</span>
|
|
43
|
-
{overallOrder?.needUpperCase && (
|
|
44
|
-
<span>
|
|
45
|
-
{common?.[item.valueField]
|
|
46
|
-
? coverDigit2Uppercase(common[item.valueField])
|
|
47
|
-
: ''}
|
|
48
|
-
</span>
|
|
49
|
-
)}
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</td>
|
|
53
|
-
)
|
|
54
|
-
})}
|
|
55
|
-
</tr>
|
|
56
|
-
)
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
OverallOrder.propTypes = {
|
|
60
|
-
config: PropTypes.object.isRequired,
|
|
61
|
-
range: PropTypes.object.isRequired,
|
|
62
|
-
printerStore: PropTypes.object
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default observer(OverallOrder)
|