gm-printer 10.14.3-alpha.1 → 10.14.4-alpha.1

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-alpha.1",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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 {
@@ -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) {