gm-printer 10.14.3-alpha.1 → 10.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.14.3-alpha.1",
3
+ "version": "10.14.4-beta.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,10 +12,17 @@ class EditorCutomizedConfig extends React.Component {
12
12
  editStore.handleChangeTableData(value)
13
13
  }
14
14
 
15
+ handleMultiDigitDecimal = value => {
16
+ const { editStore } = this.props
17
+ editStore.setMultiDigitDecimal(value)
18
+ }
19
+
20
+
21
+
15
22
  render() {
16
23
  const {
17
24
  editStore,
18
- editStore: { isAutoFilling }
25
+ editStore: { isAutoFilling,isMultiDigitDecimal }
19
26
  } = this.props
20
27
  // 是table
21
28
  if (editStore.computedRegionIsTable) {
@@ -28,6 +35,10 @@ class EditorCutomizedConfig extends React.Component {
28
35
  <Flex className='gm-padding-top-5 gm-text-red' column>
29
36
  {i18next.t('注意:填充仅支持单栏数据使用')}
30
37
  </Flex>
38
+ <Flex alignCenter className='gm-padding-top-5'>
39
+ <div>{i18next.t('是否开启多位小数')}:</div>
40
+ <Switch checked={isMultiDigitDecimal} onChange={this.handleMultiDigitDecimal} />
41
+ </Flex>
31
42
  </>
32
43
  )
33
44
  } else {
@@ -13,7 +13,8 @@ import {
13
13
  ColumnWidth,
14
14
  Textarea,
15
15
  Title,
16
- TipInfo
16
+ TipInfo,
17
+ Text
17
18
  } from '../common/component'
18
19
  import { get, toJS } from 'mobx'
19
20
  import PropTypes from 'prop-types'
@@ -73,6 +74,11 @@ class EditorField extends React.Component {
73
74
  editStore.setSubtotalStyle(value)
74
75
  }
75
76
 
77
+ handleOverallOrderStyleChange = value => {
78
+ const { editStore } = this.props
79
+ editStore.setOverallOrderStyle(value)
80
+ }
81
+
76
82
  renderBlocks() {
77
83
  const { editStore, showNewDate } = this.props
78
84
  const { type, text, style, link } = editStore.computedSelectedInfo
@@ -178,10 +184,15 @@ class EditorField extends React.Component {
178
184
  }
179
185
 
180
186
  renderTable() {
181
- const { tableDataKeyList, editStore } = this.props
187
+ const { tableDataKeyList, editStore, isSomeSubtotalTr } = this.props
182
188
  const { head, headStyle, text, style } = editStore.computedSelectedInfo
183
189
 
184
- const { specialConfig, subtotal } = editStore.computedTableSpecialConfig
190
+ const {
191
+ specialConfig,
192
+ subtotal,
193
+ overallOrder
194
+ } = editStore.computedTableSpecialConfig
195
+
185
196
  // 小计样式,specialConfig可能是undefined
186
197
  const specialStyle =
187
198
  toJS(editStore.computedTableSpecialConfig)?.specialConfig?.style || {}
@@ -195,16 +206,45 @@ class EditorField extends React.Component {
195
206
  (editStore.computedTableSpecialConfig.subtotal &&
196
207
  get(subtotal, 'needUpperCase')) ||
197
208
  false
198
- // 大写的金额是否在前
209
+ // 每页合计大写的金额是否在前
199
210
  const subtotalUpperCaseBefore =
200
211
  (editStore.computedTableSpecialConfig.subtotal &&
201
212
  get(subtotal, 'isUpperCaseBefore')) ||
202
213
  false
203
- // 大写和小写的金额是否分开
214
+ // 每页合计大写和小写的金额是否分开
204
215
  const subtotalUpperLowerCaseSeparate =
205
216
  (editStore.computedTableSpecialConfig.subtotal &&
206
217
  get(subtotal, 'isUpperLowerCaseSeparate')) ||
207
218
  false
219
+ // 每页合计样式
220
+ const overallOrderStyle =
221
+ (overallOrder && overallOrder?.fields[0].style) || {}
222
+ // 每页合计自定义单元格
223
+ const subtotalUpperCustomCell =
224
+ (editStore.computedTableSpecialConfig?.subtotal &&
225
+ get(subtotal, 'isCustomCells')) ||
226
+ false
227
+ // 整单合计是否大写
228
+ const overallOrderNeedUpperCase =
229
+ (editStore.computedTableSpecialConfig?.overallOrder &&
230
+ get(overallOrder, 'needUpperCase')) ||
231
+ false
232
+ // 整单合计大写的金额是否在前
233
+ const overallOrderCaseBefore =
234
+ (editStore.computedTableSpecialConfig?.overallOrder &&
235
+ get(overallOrder, 'isUpperCaseBefore')) ||
236
+ false
237
+ // 整单合计大写和小写的金额是否分开
238
+ const overallOrderUpperLowerCaseSeparate =
239
+ (editStore.computedTableSpecialConfig?.overallOrder &&
240
+ get(overallOrder, 'isUpperLowerCaseSeparate')) ||
241
+ false
242
+ // 整单合计自定义单元格
243
+ const overallOrderUpperCustomCell =
244
+ (editStore.computedTableSpecialConfig?.overallOrder &&
245
+ get(overallOrder, 'isCustomCells')) ||
246
+ false
247
+
208
248
  return (
209
249
  <div>
210
250
  <Title title={i18next.t('编辑字段')} />
@@ -376,18 +416,85 @@ class EditorField extends React.Component {
376
416
  subtotalCheckOnChange={editStore.setSubtotalUpperCase}
377
417
  subtotalCheckText='显示大写金额'
378
418
  />
419
+ {/* 结款单不需要这些配置 */}
420
+ {!isSomeSubtotalTr && (
421
+ <>
422
+ <EditorSubtotalCheck
423
+ subtotalCheckDisabled={subtotalNeedUpperCase}
424
+ subtotalChecked={subtotalUpperCaseBefore}
425
+ subtotalCheckOnChange={editStore.setSubtotalUpperCaseBefore}
426
+ subtotalCheckText='大写金额在前'
427
+ />
428
+ <EditorSubtotalCheck
429
+ subtotalCheckDisabled={subtotalNeedUpperCase}
430
+ subtotalChecked={subtotalUpperLowerCaseSeparate}
431
+ subtotalCheckOnChange={
432
+ editStore.setSubtotalUpperLowerCaseSeparate
433
+ }
434
+ subtotalCheckText='大、小写金额分左右两边展示'
435
+ />
436
+ <EditorSubtotalCheck
437
+ subtotalCheckDisabled
438
+ subtotalChecked={subtotalUpperCustomCell}
439
+ subtotalCheckOnChange={editStore.setSubtotalCustomCells}
440
+ subtotalCheckText='开启自定义单元格'
441
+ />
442
+ <Text
443
+ value={
444
+ subtotal && subtotal?.fields?.[1] ? subtotal.fields[1].name : ''
445
+ }
446
+ onChange={editStore.setSubtotalFields}
447
+ style={{ width: '65px', margin: '5px 0 5px 80px' }}
448
+ />
449
+ </>
450
+ )}
451
+ <Flex>
452
+ <Flex>{i18next.t('整单合计')}:</Flex>
453
+ <Fonter
454
+ style={overallOrderStyle}
455
+ onChange={this.handleOverallOrderStyleChange}
456
+ />
457
+ <Separator />
458
+ <TextAlign
459
+ style={overallOrderStyle}
460
+ onChange={this.handleOverallOrderStyleChange}
461
+ />
462
+ </Flex>
463
+ <EditorSubtotalCheck
464
+ subtotalCheckDisabled
465
+ subtotalChecked={overallOrderNeedUpperCase}
466
+ subtotalCheckOnChange={editStore.setOverallOrderUpperCase}
467
+ subtotalCheckText='显示大写金额'
468
+ />
379
469
  <EditorSubtotalCheck
380
- subtotalCheckDisabled={subtotalNeedUpperCase}
381
- subtotalChecked={subtotalUpperCaseBefore}
382
- subtotalCheckOnChange={editStore.setSubtotalUpperCaseBefore}
470
+ subtotalCheckDisabled={overallOrderNeedUpperCase}
471
+ subtotalChecked={overallOrderCaseBefore}
472
+ subtotalCheckOnChange={editStore.setOverallOrderUpperCaseBefore}
383
473
  subtotalCheckText='大写金额在前'
384
474
  />
385
475
  <EditorSubtotalCheck
386
- subtotalCheckDisabled={subtotalNeedUpperCase}
387
- subtotalChecked={subtotalUpperLowerCaseSeparate}
388
- subtotalCheckOnChange={editStore.setSubtotalUpperLowerCaseSeparate}
476
+ subtotalCheckDisabled={overallOrderNeedUpperCase}
477
+ subtotalChecked={overallOrderUpperLowerCaseSeparate}
478
+ subtotalCheckOnChange={
479
+ editStore.setOverallOrderUpperLowerCaseSeparate
480
+ }
389
481
  subtotalCheckText='大、小写金额分左右两边展示'
390
482
  />
483
+ <EditorSubtotalCheck
484
+ subtotalCheckDisabled
485
+ subtotalChecked={overallOrderUpperCustomCell}
486
+ subtotalCheckOnChange={editStore.setOverallOrderCustomCells}
487
+ subtotalCheckText='开启自定义单元格'
488
+ />
489
+ <Text
490
+ value={
491
+ overallOrder && overallOrder?.fields?.[1]
492
+ ? overallOrder.fields[1].name
493
+ : ''
494
+ }
495
+ onChange={editStore.setOverallOrderFields}
496
+ style={{ width: '65px', margin: '5px 0 5px 80px' }}
497
+ />
391
498
  </div>
392
499
  )
393
500
  }
@@ -408,7 +515,8 @@ class EditorField extends React.Component {
408
515
  EditorField.propTypes = {
409
516
  editStore: PropTypes.object,
410
517
  tableDataKeyList: PropTypes.array,
411
- showNewDate: PropTypes.bool
518
+ showNewDate: PropTypes.bool,
519
+ isSomeSubtotalTr: PropTypes.bool
412
520
  }
413
521
  EditorField.defaultProps = {
414
522
  showNewDate: false
@@ -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 {
@@ -49,6 +49,10 @@ class EditorStore {
49
49
  @observable
50
50
  isAutoFilling = false
51
51
 
52
+ /** 是否开启多位小数,默认不开启,取两位 */
53
+ @observable
54
+ isMultiDigitDecimal = false
55
+
52
56
  defaultTableDataKey = 'orders'
53
57
 
54
58
  // 默认table的dataKey
@@ -61,6 +65,33 @@ class EditorStore {
61
65
  this.isAutoFilling = bol
62
66
  }
63
67
 
68
+ @action
69
+ setMultiDigitDecimal(bool) {
70
+ this.isMultiDigitDecimal = bool
71
+ }
72
+
73
+ @observable
74
+ overallOrderShow = false
75
+
76
+ // 整单合计自定义合并单元格
77
+ @observable
78
+ overallOrderConfigFields = {
79
+ name: '',
80
+ valueField: '',
81
+ colSpan: 3, // 产品说3个
82
+ style: {
83
+ fontWeight: 'bold'
84
+ }
85
+ }
86
+
87
+ // 每页合计自定义合并单元格
88
+ @observable
89
+ subtotalConfigFields = {
90
+ name: '',
91
+ valueField: '',
92
+ colSpan: 3 // 产品说3个,开启自定义单元格
93
+ }
94
+
64
95
  @computed
65
96
  get computedPrinterKey() {
66
97
  return _.map(this.config, (v, k) => {
@@ -511,11 +542,64 @@ class EditorStore {
511
542
  setSubtotalShow(name) {
512
543
  const arr = name.split('.')
513
544
  const table = this.config.contents[arr[2]]
514
-
545
+ this.overallOrderShow = !this.overallOrderShow
515
546
  // 切换的时候,要把对应table的多余空数据清掉
516
547
  this.clearExtraTableData(table.dataKey)
517
- table.subtotal.show = !table.subtotal.show
548
+
518
549
  this.setAutoFillingConfig(!this.isAutoFilling)
550
+ // 获取td的colSpan
551
+ const colSpanLength = getColSpanLength(table)
552
+ set(table.subtotal, {
553
+ show: !table.subtotal.show
554
+ })
555
+ // 兼容存在后端的模板,subtotal配置没有fields
556
+ if (!table.subtotal?.fields) {
557
+ set(table.subtotal, {
558
+ fields: [
559
+ {
560
+ name: '每页合计:',
561
+ valueField: 'real_item_price',
562
+ colSpan: colSpanLength
563
+ }
564
+ ]
565
+ })
566
+ } else {
567
+ table.subtotal.fields[0].colSpan =
568
+ colSpanLength - (table.subtotal.fields?.[1]?.colSpan ?? 0)
569
+ }
570
+ }
571
+
572
+ @action
573
+ setOverallOrderShow(name) {
574
+ const arr = name.split('.')
575
+ const table = this.config.contents[arr[2]]
576
+ this.overallOrderShow = !this.overallOrderShow
577
+ const colSpanLength = getColSpanLength(table)
578
+ if (table.overallOrder) {
579
+ set(table.overallOrder, {
580
+ show: !table.overallOrder.show
581
+ })
582
+ table.overallOrder.fields[0].colSpan =
583
+ colSpanLength - (table.overallOrder.fields?.[1]?.colSpan ?? 0)
584
+ } else {
585
+ // 兼容已经存在的配送单据,他们的配置存在后端的,没有overallOrder这个配置,给加上
586
+ set(table, {
587
+ overallOrder: {
588
+ show: true,
589
+ fields: [
590
+ {
591
+ name: '整单合计:',
592
+ valueField: '出库金额',
593
+ style: {
594
+ fontWeight: 'bold'
595
+ },
596
+ colSpan: colSpanLength
597
+ }
598
+ ]
599
+ }
600
+ })
601
+ }
602
+ this.config = toJS(this.config)
519
603
  }
520
604
 
521
605
  @action
@@ -530,7 +614,7 @@ class EditorStore {
530
614
  @action
531
615
  changeTableDataKey(name, key) {
532
616
  const arr = name.split('.')
533
- const { dataKey } = this.config.contents[arr[2]]
617
+ const { dataKey, overallOrder, subtotal } = this.config.contents[arr[2]]
534
618
  const keyArr = dataKey.split('_')
535
619
  let newDataKey
536
620
  // 当前有这个key则去掉
@@ -554,6 +638,10 @@ class EditorStore {
554
638
  ])
555
639
 
556
640
  this.config.contents[arr[2]].dataKey = newDataKey.join('_')
641
+ // 整单合计不显示
642
+ if (overallOrder?.show) overallOrder.show = false
643
+ // 每页合计不显示
644
+ if (subtotal?.show) subtotal.show = false
557
645
  }
558
646
 
559
647
  @action
@@ -924,6 +1012,7 @@ class EditorStore {
924
1012
  @action.bound
925
1013
  setSubtotalStyle(value) {
926
1014
  if (this.selectedRegion) {
1015
+ this.overallOrderShow = !this.overallOrderShow
927
1016
  const arr = this.selectedRegion.split('.')
928
1017
  const subtotalConfig = this.config.contents[arr[2]].subtotal
929
1018
 
@@ -937,10 +1026,11 @@ class EditorStore {
937
1026
  }
938
1027
  }
939
1028
 
940
- // 设置大写金额
1029
+ // 每页合计设置大写金额
941
1030
  @action.bound
942
1031
  setSubtotalUpperCase() {
943
1032
  if (this.selectedRegion) {
1033
+ this.overallOrderShow = !this.overallOrderShow
944
1034
  const arr = this.selectedRegion.split('.')
945
1035
  const subtotalConfig = this.config.contents[arr[2]].subtotal
946
1036
 
@@ -956,10 +1046,11 @@ class EditorStore {
956
1046
  }
957
1047
  }
958
1048
 
959
- // 设置大写金额在前
1049
+ // 每页合计设置大写金额在前
960
1050
  @action.bound
961
1051
  setSubtotalUpperCaseBefore() {
962
1052
  if (this.selectedRegion) {
1053
+ this.overallOrderShow = !this.overallOrderShow
963
1054
  const arr = this.selectedRegion.split('.')
964
1055
  const subtotalConfig = this.config.contents[arr[2]].subtotal
965
1056
 
@@ -968,10 +1059,11 @@ class EditorStore {
968
1059
  }
969
1060
  }
970
1061
 
971
- // 设置大小写金额分开
1062
+ // 每页合计设置大小写金额分开
972
1063
  @action.bound
973
1064
  setSubtotalUpperLowerCaseSeparate() {
974
1065
  if (this.selectedRegion) {
1066
+ this.overallOrderShow = !this.overallOrderShow
975
1067
  const arr = this.selectedRegion.split('.')
976
1068
  const subtotalConfig = this.config.contents[arr[2]].subtotal
977
1069
 
@@ -982,7 +1074,210 @@ class EditorStore {
982
1074
  }
983
1075
  }
984
1076
 
985
- // 设置交换位置
1077
+ // 每页合计开启自定义单元格
1078
+ @action.bound
1079
+ setSubtotalCustomCells() {
1080
+ if (this.selectedRegion) {
1081
+ // 作用:触发组件的更新
1082
+ this.overallOrderShow = !this.overallOrderShow
1083
+ const arr = this.selectedRegion.split('.')
1084
+ const table = this.config.contents[arr[2]]
1085
+ const subtotalConfig = table?.subtotal
1086
+ // 没有显示每页合计的时候不可以设置自定义单元格
1087
+ if (!subtotalConfig?.show) return
1088
+ // 多栏表格情况,计算colSpan
1089
+ const colSpanLength = getColSpanLength(table)
1090
+ const oldCustomCells = subtotalConfig?.isCustomCells
1091
+
1092
+ set(subtotalConfig, {
1093
+ isCustomCells: !oldCustomCells
1094
+ })
1095
+ // 兼容已经存在后端的模板,每页合计直接是显示的,导致每页合计配置没有fields,isCustomCells,手动添加上
1096
+ if (oldCustomCells === undefined && !subtotalConfig.fields) {
1097
+ set(subtotalConfig, {
1098
+ fields: [
1099
+ {
1100
+ name: '每页合计:',
1101
+ valueField: 'real_item_price',
1102
+ colSpan: colSpanLength
1103
+ }
1104
+ ]
1105
+ })
1106
+ }
1107
+ // 开启自定义单元格
1108
+ if (subtotalConfig?.isCustomCells) {
1109
+ // fields添加自定义单元格
1110
+ subtotalConfig.fields = [
1111
+ subtotalConfig.fields[0],
1112
+ {
1113
+ ...this.subtotalConfigFields
1114
+ }
1115
+ ]
1116
+ // 重新计算合并单元格的个数
1117
+ subtotalConfig.fields[0].colSpan =
1118
+ colSpanLength - subtotalConfig.fields[1].colSpan
1119
+ } else {
1120
+ // 关闭自定义单元格,fields只有一个
1121
+ subtotalConfig.fields = [subtotalConfig.fields[0]]
1122
+ // 重新计算合并单元格的个数
1123
+ subtotalConfig.fields[0].colSpan = colSpanLength
1124
+ }
1125
+ }
1126
+ }
1127
+
1128
+ // 每页合计自定义单元格文本输入
1129
+ @action.bound
1130
+ setSubtotalFields(value) {
1131
+ if (this.selectedRegion) {
1132
+ const arr = this.selectedRegion.split('.')
1133
+ const table = this.config.contents[arr[2]]
1134
+ const subtotalConfig = table?.subtotal
1135
+
1136
+ if (subtotalConfig.isCustomCells) {
1137
+ const subtotalConfig = table?.subtotal.fields
1138
+ subtotalConfig[1].name = value
1139
+ }
1140
+ }
1141
+ }
1142
+
1143
+ // 整单合计设置大写金额
1144
+ @action.bound
1145
+ setOverallOrderUpperCase() {
1146
+ if (this.selectedRegion) {
1147
+ this.overallOrderShow = !this.overallOrderShow
1148
+ const arr = this.selectedRegion.split('.')
1149
+ const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
1150
+
1151
+ const oldNeedUpperCase = overallOrderConfig?.needUpperCase
1152
+ this.config.contents[arr[2]]?.overallOrder &&
1153
+ set(overallOrderConfig, { needUpperCase: !oldNeedUpperCase })
1154
+ // 没有大写金额时,将大写在前和大小写分开的多选框设置为false
1155
+ if (
1156
+ this.config.contents[arr[2]]?.overallOrder &&
1157
+ overallOrderConfig.needUpperCase === false
1158
+ ) {
1159
+ overallOrderConfig.isUpperCaseBefore &&
1160
+ set(overallOrderConfig, { isUpperCaseBefore: false })
1161
+ overallOrderConfig.isUpperLowerCaseSeparate &&
1162
+ set(overallOrderConfig, { isUpperLowerCaseSeparate: false })
1163
+ }
1164
+ }
1165
+ }
1166
+
1167
+ // 整单合计设置大写金额在前
1168
+ @action.bound
1169
+ setOverallOrderUpperCaseBefore() {
1170
+ if (this.selectedRegion) {
1171
+ this.overallOrderShow = !this.overallOrderShow
1172
+ const arr = this.selectedRegion.split('.')
1173
+ const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
1174
+
1175
+ const oldUpperCaseBefore = overallOrderConfig?.isUpperCaseBefore
1176
+ this.config.contents[arr[2]]?.overallOrder &&
1177
+ set(overallOrderConfig, { isUpperCaseBefore: !oldUpperCaseBefore })
1178
+ }
1179
+ }
1180
+
1181
+ // 整单合计设置大小写金额分开
1182
+ @action.bound
1183
+ setOverallOrderUpperLowerCaseSeparate() {
1184
+ if (this.selectedRegion) {
1185
+ this.overallOrderShow = !this.overallOrderShow
1186
+ const arr = this.selectedRegion.split('.')
1187
+ const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
1188
+
1189
+ const oldUpperLowerCaseSeparate =
1190
+ overallOrderConfig.isUpperLowerCaseSeparate
1191
+ set(overallOrderConfig, {
1192
+ isUpperLowerCaseSeparate: !oldUpperLowerCaseSeparate
1193
+ })
1194
+ }
1195
+ }
1196
+
1197
+ // 整单合计开启自定义单元格
1198
+ @action.bound
1199
+ setOverallOrderCustomCells() {
1200
+ if (this.selectedRegion) {
1201
+ // 作用:触发tableoverallordertr组件的更新
1202
+ this.overallOrderShow = !this.overallOrderShow
1203
+ const arr = this.selectedRegion.split('.')
1204
+ const table = this.config.contents[arr[2]]
1205
+ const overallOrderConfig = table?.overallOrder
1206
+ if (!overallOrderConfig || !overallOrderConfig?.show) return
1207
+ // 多栏表格情况
1208
+ const colSpanLength = getColSpanLength(table)
1209
+ const oldCustomCells = overallOrderConfig?.isCustomCells
1210
+
1211
+ set(overallOrderConfig, {
1212
+ isCustomCells: !oldCustomCells
1213
+ })
1214
+
1215
+ if (overallOrderConfig?.isCustomCells) {
1216
+ // fields添加自定义单元格
1217
+ overallOrderConfig.fields = [
1218
+ overallOrderConfig.fields[0],
1219
+ {
1220
+ ...this.overallOrderConfigFields,
1221
+ // 和之前保持一样的样式
1222
+ style: { ...overallOrderConfig.fields[0].style }
1223
+ }
1224
+ ]
1225
+ // 重新计算合并单元格的个数
1226
+ overallOrderConfig.fields[0].colSpan =
1227
+ colSpanLength - overallOrderConfig.fields[1].colSpan
1228
+ } else {
1229
+ // 关闭自定义单元格
1230
+ overallOrderConfig.fields = [overallOrderConfig.fields[0]]
1231
+ // 重新计算合并单元格的个数
1232
+ overallOrderConfig.fields[0].colSpan = colSpanLength
1233
+ }
1234
+
1235
+ this.config = toJS(this.config)
1236
+ }
1237
+ }
1238
+
1239
+ // 整单合计自定义单元格文本输入
1240
+ @action.bound
1241
+ setOverallOrderFields(value) {
1242
+ if (this.selectedRegion) {
1243
+ const arr = this.selectedRegion.split('.')
1244
+ const table = this.config.contents[arr[2]]
1245
+ const overallOrderConfig = table?.overallOrder
1246
+
1247
+ if (overallOrderConfig.isCustomCells) {
1248
+ const overallOrderConfigFields = table?.overallOrder.fields
1249
+ overallOrderConfigFields[1].name = value
1250
+ }
1251
+ }
1252
+ }
1253
+
1254
+ // 整单合计样式设置
1255
+ @action.bound
1256
+ setOverallOrderStyle(value) {
1257
+ if (this.selectedRegion) {
1258
+ const flexStyle = {
1259
+ left: 'flex-start',
1260
+ center: 'center',
1261
+ right: 'flex-end'
1262
+ }
1263
+ const arr = this.selectedRegion.split('.')
1264
+ const overallOrderConfigFields = this.config.contents[arr[2]]
1265
+ ?.overallOrder.fields
1266
+ _.forEach(overallOrderConfigFields, item => {
1267
+ const oldStyle = item.style || {}
1268
+ set(item, {
1269
+ style: {
1270
+ ...oldStyle,
1271
+ ...value,
1272
+ // 整单合计里使用的flex布局,textAlign不生效
1273
+ 'justify-content': flexStyle[value.textAlign]
1274
+ }
1275
+ })
1276
+ })
1277
+ }
1278
+ }
1279
+
1280
+ // 合计和每页合计设置交换位置
986
1281
  @action.bound
987
1282
  setSubtotalCommutationPlace() {
988
1283
  if (this.selectedRegion) {