gm-printer 10.14.2 → 10.14.4-alpha.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.
@@ -2,7 +2,7 @@ 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 { dispatchMsg, getBlockName, exchange } from '../util'
5
+ import { dispatchMsg, getBlockName, exchange, getColSpanLength } from '../util'
6
6
  import React from 'react'
7
7
 
8
8
  class EditorStore {
@@ -61,6 +61,28 @@ class EditorStore {
61
61
  this.isAutoFilling = bol
62
62
  }
63
63
 
64
+ @observable
65
+ overallOrderShow = false
66
+
67
+ // 整单合计自定义合并单元格
68
+ @observable
69
+ overallOrderConfigFields = {
70
+ name: '',
71
+ valueField: '',
72
+ colSpan: 3, // 产品说3个
73
+ style: {
74
+ fontWeight: 'bold'
75
+ }
76
+ }
77
+
78
+ // 每页合计自定义合并单元格
79
+ @observable
80
+ subtotalConfigFields = {
81
+ name: '',
82
+ valueField: '',
83
+ colSpan: 3 // 产品说3个,开启自定义单元格
84
+ }
85
+
64
86
  @computed
65
87
  get computedPrinterKey() {
66
88
  return _.map(this.config, (v, k) => {
@@ -134,14 +156,19 @@ class EditorStore {
134
156
 
135
157
  set(this.config, {
136
158
  autoFillConfig: {
137
- region: this.selectedRegion,
159
+ region: this.selectedRegion || autoFillConfig?.region,
138
160
  dataKey,
139
161
  checked: isAutoFilling
140
162
  }
141
163
  })
142
- if (isAutoFilling) {
164
+
165
+ const hasHadEmptyData = _.some(table, data => data?._isEmptyData)
166
+
167
+ // 开关打开,且之前数组不包含空数据,再进行填充
168
+ if (isAutoFilling && !hasHadEmptyData) {
143
169
  table.push(...this.getFilledTableData(table))
144
- } else {
170
+ }
171
+ if (!isAutoFilling) {
145
172
  this.clearExtraTableData(dataKey)
146
173
  return
147
174
  }
@@ -511,11 +538,64 @@ class EditorStore {
511
538
  setSubtotalShow(name) {
512
539
  const arr = name.split('.')
513
540
  const table = this.config.contents[arr[2]]
514
-
541
+ this.overallOrderShow = !this.overallOrderShow
515
542
  // 切换的时候,要把对应table的多余空数据清掉
516
543
  this.clearExtraTableData(table.dataKey)
517
- table.subtotal.show = !table.subtotal.show
544
+
518
545
  this.setAutoFillingConfig(!this.isAutoFilling)
546
+ // 获取td的colSpan
547
+ const colSpanLength = getColSpanLength(table)
548
+ set(table.subtotal, {
549
+ show: !table.subtotal.show
550
+ })
551
+ // 兼容存在后端的模板,subtotal配置没有fields
552
+ if (!table.subtotal?.fields) {
553
+ set(table.subtotal, {
554
+ fields: [
555
+ {
556
+ name: '每页合计:',
557
+ valueField: 'real_item_price',
558
+ colSpan: colSpanLength
559
+ }
560
+ ]
561
+ })
562
+ } else {
563
+ table.subtotal.fields[0].colSpan =
564
+ colSpanLength - (table.subtotal.fields?.[1]?.colSpan ?? 0)
565
+ }
566
+ }
567
+
568
+ @action
569
+ setOverallOrderShow(name) {
570
+ const arr = name.split('.')
571
+ const table = this.config.contents[arr[2]]
572
+ this.overallOrderShow = !this.overallOrderShow
573
+ const colSpanLength = getColSpanLength(table)
574
+ if (table.overallOrder) {
575
+ set(table.overallOrder, {
576
+ show: !table.overallOrder.show
577
+ })
578
+ table.overallOrder.fields[0].colSpan =
579
+ colSpanLength - (table.overallOrder.fields?.[1]?.colSpan ?? 0)
580
+ } else {
581
+ // 兼容已经存在的配送单据,他们的配置存在后端的,没有overallOrder这个配置,给加上
582
+ set(table, {
583
+ overallOrder: {
584
+ show: true,
585
+ fields: [
586
+ {
587
+ name: '整单合计:',
588
+ valueField: '出库金额',
589
+ style: {
590
+ fontWeight: 'bold'
591
+ },
592
+ colSpan: colSpanLength
593
+ }
594
+ ]
595
+ }
596
+ })
597
+ }
598
+ this.config = toJS(this.config)
519
599
  }
520
600
 
521
601
  @action
@@ -530,7 +610,7 @@ class EditorStore {
530
610
  @action
531
611
  changeTableDataKey(name, key) {
532
612
  const arr = name.split('.')
533
- const { dataKey } = this.config.contents[arr[2]]
613
+ const { dataKey, overallOrder, subtotal } = this.config.contents[arr[2]]
534
614
  const keyArr = dataKey.split('_')
535
615
  let newDataKey
536
616
  // 当前有这个key则去掉
@@ -554,6 +634,10 @@ class EditorStore {
554
634
  ])
555
635
 
556
636
  this.config.contents[arr[2]].dataKey = newDataKey.join('_')
637
+ // 整单合计不显示
638
+ if (overallOrder?.show) overallOrder.show = false
639
+ // 每页合计不显示
640
+ if (subtotal?.show) subtotal.show = false
557
641
  }
558
642
 
559
643
  @action
@@ -782,14 +866,17 @@ class EditorStore {
782
866
  // 获得表格自定义行高
783
867
  @computed
784
868
  get computedTableCustomerRowHeight() {
785
- if (this.selectedRegion) {
786
- const arr = this.selectedRegion.split('.')
869
+ const _defaultRegion = this.config?.autoFillConfig?.region
870
+ let resHeight = 23
871
+ if (this.selectedRegion || _defaultRegion) {
872
+ const _selectedRegion = this.selectedRegion || _defaultRegion
873
+ const arr = _selectedRegion.split('.')
787
874
  if (arr.includes('table')) {
788
875
  const height = this.config.contents[arr[2]].customerRowHeight
789
- return height === undefined ? 23 : height
876
+ resHeight = height === undefined ? 23 : height
790
877
  }
791
878
  }
792
- return 23
879
+ return resHeight
793
880
  }
794
881
 
795
882
  @action.bound
@@ -924,6 +1011,7 @@ class EditorStore {
924
1011
  @action.bound
925
1012
  setSubtotalStyle(value) {
926
1013
  if (this.selectedRegion) {
1014
+ this.overallOrderShow = !this.overallOrderShow
927
1015
  const arr = this.selectedRegion.split('.')
928
1016
  const subtotalConfig = this.config.contents[arr[2]].subtotal
929
1017
 
@@ -937,10 +1025,11 @@ class EditorStore {
937
1025
  }
938
1026
  }
939
1027
 
940
- // 设置大写金额
1028
+ // 每页合计设置大写金额
941
1029
  @action.bound
942
1030
  setSubtotalUpperCase() {
943
1031
  if (this.selectedRegion) {
1032
+ this.overallOrderShow = !this.overallOrderShow
944
1033
  const arr = this.selectedRegion.split('.')
945
1034
  const subtotalConfig = this.config.contents[arr[2]].subtotal
946
1035
 
@@ -956,10 +1045,11 @@ class EditorStore {
956
1045
  }
957
1046
  }
958
1047
 
959
- // 设置大写金额在前
1048
+ // 每页合计设置大写金额在前
960
1049
  @action.bound
961
1050
  setSubtotalUpperCaseBefore() {
962
1051
  if (this.selectedRegion) {
1052
+ this.overallOrderShow = !this.overallOrderShow
963
1053
  const arr = this.selectedRegion.split('.')
964
1054
  const subtotalConfig = this.config.contents[arr[2]].subtotal
965
1055
 
@@ -968,10 +1058,11 @@ class EditorStore {
968
1058
  }
969
1059
  }
970
1060
 
971
- // 设置大小写金额分开
1061
+ // 每页合计设置大小写金额分开
972
1062
  @action.bound
973
1063
  setSubtotalUpperLowerCaseSeparate() {
974
1064
  if (this.selectedRegion) {
1065
+ this.overallOrderShow = !this.overallOrderShow
975
1066
  const arr = this.selectedRegion.split('.')
976
1067
  const subtotalConfig = this.config.contents[arr[2]].subtotal
977
1068
 
@@ -982,7 +1073,210 @@ class EditorStore {
982
1073
  }
983
1074
  }
984
1075
 
985
- // 设置交换位置
1076
+ // 每页合计开启自定义单元格
1077
+ @action.bound
1078
+ setSubtotalCustomCells() {
1079
+ if (this.selectedRegion) {
1080
+ // 作用:触发组件的更新
1081
+ this.overallOrderShow = !this.overallOrderShow
1082
+ const arr = this.selectedRegion.split('.')
1083
+ const table = this.config.contents[arr[2]]
1084
+ const subtotalConfig = table?.subtotal
1085
+ // 没有显示每页合计的时候不可以设置自定义单元格
1086
+ if (!subtotalConfig?.show) return
1087
+ // 多栏表格情况,计算colSpan
1088
+ const colSpanLength = getColSpanLength(table)
1089
+ const oldCustomCells = subtotalConfig?.isCustomCells
1090
+
1091
+ set(subtotalConfig, {
1092
+ isCustomCells: !oldCustomCells
1093
+ })
1094
+ // 兼容已经存在后端的模板,每页合计直接是显示的,导致每页合计配置没有fields,isCustomCells,手动添加上
1095
+ if (oldCustomCells === undefined && !subtotalConfig.fields) {
1096
+ set(subtotalConfig, {
1097
+ fields: [
1098
+ {
1099
+ name: '每页合计:',
1100
+ valueField: 'real_item_price',
1101
+ colSpan: colSpanLength
1102
+ }
1103
+ ]
1104
+ })
1105
+ }
1106
+ // 开启自定义单元格
1107
+ if (subtotalConfig?.isCustomCells) {
1108
+ // fields添加自定义单元格
1109
+ subtotalConfig.fields = [
1110
+ subtotalConfig.fields[0],
1111
+ {
1112
+ ...this.subtotalConfigFields
1113
+ }
1114
+ ]
1115
+ // 重新计算合并单元格的个数
1116
+ subtotalConfig.fields[0].colSpan =
1117
+ colSpanLength - subtotalConfig.fields[1].colSpan
1118
+ } else {
1119
+ // 关闭自定义单元格,fields只有一个
1120
+ subtotalConfig.fields = [subtotalConfig.fields[0]]
1121
+ // 重新计算合并单元格的个数
1122
+ subtotalConfig.fields[0].colSpan = colSpanLength
1123
+ }
1124
+ }
1125
+ }
1126
+
1127
+ // 每页合计自定义单元格文本输入
1128
+ @action.bound
1129
+ setSubtotalFields(value) {
1130
+ if (this.selectedRegion) {
1131
+ const arr = this.selectedRegion.split('.')
1132
+ const table = this.config.contents[arr[2]]
1133
+ const subtotalConfig = table?.subtotal
1134
+
1135
+ if (subtotalConfig.isCustomCells) {
1136
+ const subtotalConfig = table?.subtotal.fields
1137
+ subtotalConfig[1].name = value
1138
+ }
1139
+ }
1140
+ }
1141
+
1142
+ // 整单合计设置大写金额
1143
+ @action.bound
1144
+ setOverallOrderUpperCase() {
1145
+ if (this.selectedRegion) {
1146
+ this.overallOrderShow = !this.overallOrderShow
1147
+ const arr = this.selectedRegion.split('.')
1148
+ const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
1149
+
1150
+ const oldNeedUpperCase = overallOrderConfig?.needUpperCase
1151
+ this.config.contents[arr[2]]?.overallOrder &&
1152
+ set(overallOrderConfig, { needUpperCase: !oldNeedUpperCase })
1153
+ // 没有大写金额时,将大写在前和大小写分开的多选框设置为false
1154
+ if (
1155
+ this.config.contents[arr[2]]?.overallOrder &&
1156
+ overallOrderConfig.needUpperCase === false
1157
+ ) {
1158
+ overallOrderConfig.isUpperCaseBefore &&
1159
+ set(overallOrderConfig, { isUpperCaseBefore: false })
1160
+ overallOrderConfig.isUpperLowerCaseSeparate &&
1161
+ set(overallOrderConfig, { isUpperLowerCaseSeparate: false })
1162
+ }
1163
+ }
1164
+ }
1165
+
1166
+ // 整单合计设置大写金额在前
1167
+ @action.bound
1168
+ setOverallOrderUpperCaseBefore() {
1169
+ if (this.selectedRegion) {
1170
+ this.overallOrderShow = !this.overallOrderShow
1171
+ const arr = this.selectedRegion.split('.')
1172
+ const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
1173
+
1174
+ const oldUpperCaseBefore = overallOrderConfig?.isUpperCaseBefore
1175
+ this.config.contents[arr[2]]?.overallOrder &&
1176
+ set(overallOrderConfig, { isUpperCaseBefore: !oldUpperCaseBefore })
1177
+ }
1178
+ }
1179
+
1180
+ // 整单合计设置大小写金额分开
1181
+ @action.bound
1182
+ setOverallOrderUpperLowerCaseSeparate() {
1183
+ if (this.selectedRegion) {
1184
+ this.overallOrderShow = !this.overallOrderShow
1185
+ const arr = this.selectedRegion.split('.')
1186
+ const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
1187
+
1188
+ const oldUpperLowerCaseSeparate =
1189
+ overallOrderConfig.isUpperLowerCaseSeparate
1190
+ set(overallOrderConfig, {
1191
+ isUpperLowerCaseSeparate: !oldUpperLowerCaseSeparate
1192
+ })
1193
+ }
1194
+ }
1195
+
1196
+ // 整单合计开启自定义单元格
1197
+ @action.bound
1198
+ setOverallOrderCustomCells() {
1199
+ if (this.selectedRegion) {
1200
+ // 作用:触发tableoverallordertr组件的更新
1201
+ this.overallOrderShow = !this.overallOrderShow
1202
+ const arr = this.selectedRegion.split('.')
1203
+ const table = this.config.contents[arr[2]]
1204
+ const overallOrderConfig = table?.overallOrder
1205
+ if (!overallOrderConfig || !overallOrderConfig?.show) return
1206
+ // 多栏表格情况
1207
+ const colSpanLength = getColSpanLength(table)
1208
+ const oldCustomCells = overallOrderConfig?.isCustomCells
1209
+
1210
+ set(overallOrderConfig, {
1211
+ isCustomCells: !oldCustomCells
1212
+ })
1213
+
1214
+ if (overallOrderConfig?.isCustomCells) {
1215
+ // fields添加自定义单元格
1216
+ overallOrderConfig.fields = [
1217
+ overallOrderConfig.fields[0],
1218
+ {
1219
+ ...this.overallOrderConfigFields,
1220
+ // 和之前保持一样的样式
1221
+ style: { ...overallOrderConfig.fields[0].style }
1222
+ }
1223
+ ]
1224
+ // 重新计算合并单元格的个数
1225
+ overallOrderConfig.fields[0].colSpan =
1226
+ colSpanLength - overallOrderConfig.fields[1].colSpan
1227
+ } else {
1228
+ // 关闭自定义单元格
1229
+ overallOrderConfig.fields = [overallOrderConfig.fields[0]]
1230
+ // 重新计算合并单元格的个数
1231
+ overallOrderConfig.fields[0].colSpan = colSpanLength
1232
+ }
1233
+
1234
+ this.config = toJS(this.config)
1235
+ }
1236
+ }
1237
+
1238
+ // 整单合计自定义单元格文本输入
1239
+ @action.bound
1240
+ setOverallOrderFields(value) {
1241
+ if (this.selectedRegion) {
1242
+ const arr = this.selectedRegion.split('.')
1243
+ const table = this.config.contents[arr[2]]
1244
+ const overallOrderConfig = table?.overallOrder
1245
+
1246
+ if (overallOrderConfig.isCustomCells) {
1247
+ const overallOrderConfigFields = table?.overallOrder.fields
1248
+ overallOrderConfigFields[1].name = value
1249
+ }
1250
+ }
1251
+ }
1252
+
1253
+ // 整单合计样式设置
1254
+ @action.bound
1255
+ setOverallOrderStyle(value) {
1256
+ if (this.selectedRegion) {
1257
+ const flexStyle = {
1258
+ left: 'flex-start',
1259
+ center: 'center',
1260
+ right: 'flex-end'
1261
+ }
1262
+ const arr = this.selectedRegion.split('.')
1263
+ const overallOrderConfigFields = this.config.contents[arr[2]]
1264
+ ?.overallOrder.fields
1265
+ _.forEach(overallOrderConfigFields, item => {
1266
+ const oldStyle = item.style || {}
1267
+ set(item, {
1268
+ style: {
1269
+ ...oldStyle,
1270
+ ...value,
1271
+ // 整单合计里使用的flex布局,textAlign不生效
1272
+ 'justify-content': flexStyle[value.textAlign]
1273
+ }
1274
+ })
1275
+ })
1276
+ }
1277
+ }
1278
+
1279
+ // 合计和每页合计设置交换位置
986
1280
  @action.bound
987
1281
  setSubtotalCommutationPlace() {
988
1282
  if (this.selectedRegion) {
@@ -3,63 +3,87 @@ 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, none, width, height,
10
+ auto,
11
+ none,
12
+ width,
13
+ height,
11
14
 
12
- row, column,
15
+ row,
16
+ column,
13
17
 
14
- wrap, nowrap,
18
+ wrap,
19
+ nowrap,
20
+ flexGrow,
15
21
 
16
- justifyStart, justifyEnd, justifyCenter, justifyBetween, justifyAround,
22
+ justifyStart,
23
+ justifyEnd,
24
+ justifyCenter,
25
+ justifyBetween,
26
+ justifyAround,
17
27
 
18
- alignStart, alignEnd, alignCenter, alignBaseline, alignStretch,
28
+ alignStart,
29
+ alignEnd,
30
+ alignCenter,
31
+ alignBaseline,
32
+ alignStretch,
19
33
 
20
- alignContentStart, alignContentEnd, alignContentCenter, alignContentBetween, alignContentAround, alignContentStretch,
34
+ alignContentStart,
35
+ alignContentEnd,
36
+ alignContentCenter,
37
+ alignContentBetween,
38
+ alignContentAround,
39
+ alignContentStretch,
21
40
 
22
- className, style,
41
+ className,
42
+ style,
23
43
 
24
44
  ...rest
25
45
  } = this.props
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)
46
+ const cn = classNames(
47
+ {
48
+ 'gm-flex': true,
49
+
50
+ 'gm-flex-grow': flexGrow,
51
+ 'gm-flex-flex': flex,
52
+ 'gm-flex-auto': auto,
53
+ 'gm-flex-none': none || width || height,
54
+
55
+ 'gm-flex-row': row,
56
+ 'gm-flex-column': column,
57
+
58
+ 'gm-flex-wrap': wrap,
59
+ 'gm-flex-nowrap': nowrap,
60
+
61
+ 'gm-flex-justify-start': justifyStart,
62
+ 'gm-flex-justify-end': justifyEnd,
63
+ 'gm-flex-justify-center': justifyCenter,
64
+ 'gm-flex-justify-between': justifyBetween,
65
+ 'gm-flex-justify-around': justifyAround,
66
+
67
+ 'gm-flex-align-start': alignStart,
68
+ 'gm-flex-align-end': alignEnd,
69
+ 'gm-flex-align-center': alignCenter,
70
+ 'gm-flex-align-baseline': alignBaseline,
71
+ 'gm-flex-align-stretch': alignStretch,
72
+
73
+ 'gm-flex-align-content-start': alignContentStart,
74
+ 'gm-flex-align-content-end': alignContentEnd,
75
+ 'gm-flex-align-content-center': alignContentCenter,
76
+ 'gm-flex-align-content-between': alignContentBetween,
77
+ 'gm-flex-align-content-around': alignContentAround,
78
+ 'gm-flex-align-content-stretch': alignContentStretch
79
+ },
80
+ className
81
+ )
58
82
 
59
83
  let s = Object.assign({}, style)
60
84
  if (flex) {
61
- s.flex = (typeof flex === 'boolean') ? 1 : flex
62
- s.WebKitFlex = (typeof flex === 'boolean') ? 1 : flex
85
+ s.flex = typeof flex === 'boolean' ? 1 : flex
86
+ s.WebKitFlex = typeof flex === 'boolean' ? 1 : flex
63
87
  }
64
88
  if (height) {
65
89
  s.height = height
@@ -68,7 +92,11 @@ class Flex extends React.Component {
68
92
  s.width = width
69
93
  }
70
94
 
71
- return <div {...rest} className={cn} style={s}>{this.props.children}</div>
95
+ return (
96
+ <div {...rest} className={cn} style={s}>
97
+ {this.props.children}
98
+ </div>
99
+ )
72
100
  }
73
101
  }
74
102
 
@@ -81,6 +109,7 @@ Flex.propTypes = {
81
109
  row: PropTypes.bool,
82
110
  column: PropTypes.bool,
83
111
  wrap: PropTypes.bool,
112
+ flexGrow: PropTypes.bool,
84
113
  nowrap: PropTypes.bool,
85
114
  justifyStart: PropTypes.bool,
86
115
  justifyEnd: PropTypes.bool,
@@ -19,6 +19,10 @@
19
19
  align-items: stretch;
20
20
  box-sizing: border-box;
21
21
 
22
+ &.gm-flex-grow {
23
+ flex-grow: 1;
24
+ }
25
+
22
26
  &.gm-flex-wrap {
23
27
  flex-wrap: wrap;
24
28
  }
@@ -98,4 +102,4 @@
98
102
  &.gm-flex-align-content-stretch {
99
103
  align-content: stretch;
100
104
  }
101
- }
105
+ }
@@ -61,7 +61,6 @@ class ContextMenu extends React.Component {
61
61
 
62
62
  handleSubtotal = name => {
63
63
  const { editStore } = this.props
64
-
65
64
  editStore.setSubtotalShow(name)
66
65
  }
67
66
 
@@ -70,6 +69,11 @@ class ContextMenu extends React.Component {
70
69
  editStore.handleChangeTableData(isAutoFilling)
71
70
  }
72
71
 
72
+ handleOverallOrder = name => {
73
+ const { editStore } = this.props
74
+ editStore.setOverallOrderShow(name)
75
+ }
76
+
73
77
  renderOrderActionBtn = name => {
74
78
  if (!this.hasSubtotalBtn(name)) {
75
79
  return null
@@ -84,13 +88,18 @@ class ContextMenu extends React.Component {
84
88
  }
85
89
  } = this.props
86
90
  const arr = name.split('.')
87
- const { dataKey, subtotal } = this.props.editStore.config.contents[arr[2]]
91
+ const {
92
+ dataKey,
93
+ subtotal,
94
+ overallOrder
95
+ } = this.props.editStore.config.contents[arr[2]]
88
96
  const keyArr = dataKey.split('_')
89
97
 
90
98
  const isMultiActive = keyArr.includes('multi')
91
99
  const isThreeActive = keyArr.includes('multi3')
92
100
  const isCategoryActive = keyArr.includes('category')
93
101
  const isSubtotalActive = subtotal.show
102
+ const isOverallOrder = overallOrder?.show
94
103
 
95
104
  return (
96
105
  <>
@@ -127,6 +136,12 @@ class ContextMenu extends React.Component {
127
136
  >
128
137
  {i18next.t('行数填充')}
129
138
  </div>
139
+ <div
140
+ onClick={this.handleOverallOrder.bind(this, name)}
141
+ className={isOverallOrder ? 'active' : ''}
142
+ >
143
+ {i18next.t('整单合计')}
144
+ </div>
130
145
  </>
131
146
  )
132
147
  }
@@ -147,6 +162,7 @@ class ContextMenu extends React.Component {
147
162
  config={editStore.config}
148
163
  data={editStore.mockData}
149
164
  getremainpageHeight={editStore.setRemainPageHeight}
165
+ overallorder={editStore.overallOrderShow}
150
166
  />
151
167
  </CommonContextMenu>
152
168
  )
@@ -23,7 +23,7 @@ const tableDataKeyList = [
23
23
  @observer
24
24
  class Editor extends React.Component {
25
25
  render() {
26
- const { onSave, showEditor, addFields } = this.props
26
+ const { onSave, showEditor, addFields, isSomeSubtotalTr } = this.props
27
27
 
28
28
  return (
29
29
  <div className='gm-printer-edit'>
@@ -46,7 +46,10 @@ class Editor extends React.Component {
46
46
  <Gap height='10px' />
47
47
  <EditorSelect />
48
48
  <Gap height='5px' />
49
- <EditorField tableDataKeyList={tableDataKeyList} />
49
+ <EditorField
50
+ tableDataKeyList={tableDataKeyList}
51
+ isSomeSubtotalTr={isSomeSubtotalTr}
52
+ />
50
53
  <Gap height='5px' />
51
54
  <EditorAddField addFields={addFields} />
52
55
 
@@ -69,7 +72,8 @@ Editor.propTypes = {
69
72
  onSave: PropTypes.func,
70
73
  showEditor: PropTypes.bool,
71
74
  mockData: PropTypes.object.isRequired,
72
- addFields: PropTypes.object.isRequired
75
+ addFields: PropTypes.object.isRequired,
76
+ isSomeSubtotalTr: PropTypes.bool
73
77
  }
74
78
 
75
79
  Editor.defaultProps = {