gm-printer 10.14.2 → 10.14.4
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/package.json +1 -1
- package/src/common/editor_edit_field.js +120 -12
- package/src/common/editor_store.js +294 -8
- package/src/components/flex/index.js +72 -43
- package/src/components/flex/style.less +5 -1
- package/src/editor/context_menu.js +18 -2
- package/src/editor_settle/editor.js +7 -3
- package/src/printer/printer.js +5 -1
- package/src/printer/store.js +16 -3
- package/src/printer/style.lesss +12 -0
- package/src/printer/table.js +6 -0
- package/src/printer/table_overallOrder_tr.js +65 -0
- package/src/printer/table_subtotal_tr.js +56 -66
- package/src/util.js +22 -1
- package/yarn-error.log +9663 -0
- package/build/demo.js +0 -54
|
@@ -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) => {
|
|
@@ -511,11 +533,64 @@ class EditorStore {
|
|
|
511
533
|
setSubtotalShow(name) {
|
|
512
534
|
const arr = name.split('.')
|
|
513
535
|
const table = this.config.contents[arr[2]]
|
|
514
|
-
|
|
536
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
515
537
|
// 切换的时候,要把对应table的多余空数据清掉
|
|
516
538
|
this.clearExtraTableData(table.dataKey)
|
|
517
|
-
|
|
539
|
+
|
|
518
540
|
this.setAutoFillingConfig(!this.isAutoFilling)
|
|
541
|
+
// 获取td的colSpan
|
|
542
|
+
const colSpanLength = getColSpanLength(table)
|
|
543
|
+
set(table.subtotal, {
|
|
544
|
+
show: !table.subtotal.show
|
|
545
|
+
})
|
|
546
|
+
// 兼容存在后端的模板,subtotal配置没有fields
|
|
547
|
+
if (!table.subtotal?.fields) {
|
|
548
|
+
set(table.subtotal, {
|
|
549
|
+
fields: [
|
|
550
|
+
{
|
|
551
|
+
name: '每页合计:',
|
|
552
|
+
valueField: 'real_item_price',
|
|
553
|
+
colSpan: colSpanLength
|
|
554
|
+
}
|
|
555
|
+
]
|
|
556
|
+
})
|
|
557
|
+
} else {
|
|
558
|
+
table.subtotal.fields[0].colSpan =
|
|
559
|
+
colSpanLength - (table.subtotal.fields?.[1]?.colSpan ?? 0)
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
@action
|
|
564
|
+
setOverallOrderShow(name) {
|
|
565
|
+
const arr = name.split('.')
|
|
566
|
+
const table = this.config.contents[arr[2]]
|
|
567
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
568
|
+
const colSpanLength = getColSpanLength(table)
|
|
569
|
+
if (table.overallOrder) {
|
|
570
|
+
set(table.overallOrder, {
|
|
571
|
+
show: !table.overallOrder.show
|
|
572
|
+
})
|
|
573
|
+
table.overallOrder.fields[0].colSpan =
|
|
574
|
+
colSpanLength - (table.overallOrder.fields?.[1]?.colSpan ?? 0)
|
|
575
|
+
} else {
|
|
576
|
+
// 兼容已经存在的配送单据,他们的配置存在后端的,没有overallOrder这个配置,给加上
|
|
577
|
+
set(table, {
|
|
578
|
+
overallOrder: {
|
|
579
|
+
show: true,
|
|
580
|
+
fields: [
|
|
581
|
+
{
|
|
582
|
+
name: '整单合计:',
|
|
583
|
+
valueField: '出库金额',
|
|
584
|
+
style: {
|
|
585
|
+
fontWeight: 'bold'
|
|
586
|
+
},
|
|
587
|
+
colSpan: colSpanLength
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
})
|
|
592
|
+
}
|
|
593
|
+
this.config = toJS(this.config)
|
|
519
594
|
}
|
|
520
595
|
|
|
521
596
|
@action
|
|
@@ -530,7 +605,7 @@ class EditorStore {
|
|
|
530
605
|
@action
|
|
531
606
|
changeTableDataKey(name, key) {
|
|
532
607
|
const arr = name.split('.')
|
|
533
|
-
const { dataKey } = this.config.contents[arr[2]]
|
|
608
|
+
const { dataKey, overallOrder, subtotal } = this.config.contents[arr[2]]
|
|
534
609
|
const keyArr = dataKey.split('_')
|
|
535
610
|
let newDataKey
|
|
536
611
|
// 当前有这个key则去掉
|
|
@@ -554,6 +629,10 @@ class EditorStore {
|
|
|
554
629
|
])
|
|
555
630
|
|
|
556
631
|
this.config.contents[arr[2]].dataKey = newDataKey.join('_')
|
|
632
|
+
// 整单合计不显示
|
|
633
|
+
if (overallOrder?.show) overallOrder.show = false
|
|
634
|
+
// 每页合计不显示
|
|
635
|
+
if (subtotal?.show) subtotal.show = false
|
|
557
636
|
}
|
|
558
637
|
|
|
559
638
|
@action
|
|
@@ -924,6 +1003,7 @@ class EditorStore {
|
|
|
924
1003
|
@action.bound
|
|
925
1004
|
setSubtotalStyle(value) {
|
|
926
1005
|
if (this.selectedRegion) {
|
|
1006
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
927
1007
|
const arr = this.selectedRegion.split('.')
|
|
928
1008
|
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
929
1009
|
|
|
@@ -937,10 +1017,11 @@ class EditorStore {
|
|
|
937
1017
|
}
|
|
938
1018
|
}
|
|
939
1019
|
|
|
940
|
-
//
|
|
1020
|
+
// 每页合计设置大写金额
|
|
941
1021
|
@action.bound
|
|
942
1022
|
setSubtotalUpperCase() {
|
|
943
1023
|
if (this.selectedRegion) {
|
|
1024
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
944
1025
|
const arr = this.selectedRegion.split('.')
|
|
945
1026
|
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
946
1027
|
|
|
@@ -956,10 +1037,11 @@ class EditorStore {
|
|
|
956
1037
|
}
|
|
957
1038
|
}
|
|
958
1039
|
|
|
959
|
-
//
|
|
1040
|
+
// 每页合计设置大写金额在前
|
|
960
1041
|
@action.bound
|
|
961
1042
|
setSubtotalUpperCaseBefore() {
|
|
962
1043
|
if (this.selectedRegion) {
|
|
1044
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
963
1045
|
const arr = this.selectedRegion.split('.')
|
|
964
1046
|
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
965
1047
|
|
|
@@ -968,10 +1050,11 @@ class EditorStore {
|
|
|
968
1050
|
}
|
|
969
1051
|
}
|
|
970
1052
|
|
|
971
|
-
//
|
|
1053
|
+
// 每页合计设置大小写金额分开
|
|
972
1054
|
@action.bound
|
|
973
1055
|
setSubtotalUpperLowerCaseSeparate() {
|
|
974
1056
|
if (this.selectedRegion) {
|
|
1057
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
975
1058
|
const arr = this.selectedRegion.split('.')
|
|
976
1059
|
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
977
1060
|
|
|
@@ -982,7 +1065,210 @@ class EditorStore {
|
|
|
982
1065
|
}
|
|
983
1066
|
}
|
|
984
1067
|
|
|
985
|
-
//
|
|
1068
|
+
// 每页合计开启自定义单元格
|
|
1069
|
+
@action.bound
|
|
1070
|
+
setSubtotalCustomCells() {
|
|
1071
|
+
if (this.selectedRegion) {
|
|
1072
|
+
// 作用:触发组件的更新
|
|
1073
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1074
|
+
const arr = this.selectedRegion.split('.')
|
|
1075
|
+
const table = this.config.contents[arr[2]]
|
|
1076
|
+
const subtotalConfig = table?.subtotal
|
|
1077
|
+
// 没有显示每页合计的时候不可以设置自定义单元格
|
|
1078
|
+
if (!subtotalConfig?.show) return
|
|
1079
|
+
// 多栏表格情况,计算colSpan
|
|
1080
|
+
const colSpanLength = getColSpanLength(table)
|
|
1081
|
+
const oldCustomCells = subtotalConfig?.isCustomCells
|
|
1082
|
+
|
|
1083
|
+
set(subtotalConfig, {
|
|
1084
|
+
isCustomCells: !oldCustomCells
|
|
1085
|
+
})
|
|
1086
|
+
// 兼容已经存在后端的模板,每页合计直接是显示的,导致每页合计配置没有fields,isCustomCells,手动添加上
|
|
1087
|
+
if (oldCustomCells === undefined && !subtotalConfig.fields) {
|
|
1088
|
+
set(subtotalConfig, {
|
|
1089
|
+
fields: [
|
|
1090
|
+
{
|
|
1091
|
+
name: '每页合计:',
|
|
1092
|
+
valueField: 'real_item_price',
|
|
1093
|
+
colSpan: colSpanLength
|
|
1094
|
+
}
|
|
1095
|
+
]
|
|
1096
|
+
})
|
|
1097
|
+
}
|
|
1098
|
+
// 开启自定义单元格
|
|
1099
|
+
if (subtotalConfig?.isCustomCells) {
|
|
1100
|
+
// fields添加自定义单元格
|
|
1101
|
+
subtotalConfig.fields = [
|
|
1102
|
+
subtotalConfig.fields[0],
|
|
1103
|
+
{
|
|
1104
|
+
...this.subtotalConfigFields
|
|
1105
|
+
}
|
|
1106
|
+
]
|
|
1107
|
+
// 重新计算合并单元格的个数
|
|
1108
|
+
subtotalConfig.fields[0].colSpan =
|
|
1109
|
+
colSpanLength - subtotalConfig.fields[1].colSpan
|
|
1110
|
+
} else {
|
|
1111
|
+
// 关闭自定义单元格,fields只有一个
|
|
1112
|
+
subtotalConfig.fields = [subtotalConfig.fields[0]]
|
|
1113
|
+
// 重新计算合并单元格的个数
|
|
1114
|
+
subtotalConfig.fields[0].colSpan = colSpanLength
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// 每页合计自定义单元格文本输入
|
|
1120
|
+
@action.bound
|
|
1121
|
+
setSubtotalFields(value) {
|
|
1122
|
+
if (this.selectedRegion) {
|
|
1123
|
+
const arr = this.selectedRegion.split('.')
|
|
1124
|
+
const table = this.config.contents[arr[2]]
|
|
1125
|
+
const subtotalConfig = table?.subtotal
|
|
1126
|
+
|
|
1127
|
+
if (subtotalConfig.isCustomCells) {
|
|
1128
|
+
const subtotalConfig = table?.subtotal.fields
|
|
1129
|
+
subtotalConfig[1].name = value
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// 整单合计设置大写金额
|
|
1135
|
+
@action.bound
|
|
1136
|
+
setOverallOrderUpperCase() {
|
|
1137
|
+
if (this.selectedRegion) {
|
|
1138
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1139
|
+
const arr = this.selectedRegion.split('.')
|
|
1140
|
+
const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
|
|
1141
|
+
|
|
1142
|
+
const oldNeedUpperCase = overallOrderConfig?.needUpperCase
|
|
1143
|
+
this.config.contents[arr[2]]?.overallOrder &&
|
|
1144
|
+
set(overallOrderConfig, { needUpperCase: !oldNeedUpperCase })
|
|
1145
|
+
// 没有大写金额时,将大写在前和大小写分开的多选框设置为false
|
|
1146
|
+
if (
|
|
1147
|
+
this.config.contents[arr[2]]?.overallOrder &&
|
|
1148
|
+
overallOrderConfig.needUpperCase === false
|
|
1149
|
+
) {
|
|
1150
|
+
overallOrderConfig.isUpperCaseBefore &&
|
|
1151
|
+
set(overallOrderConfig, { isUpperCaseBefore: false })
|
|
1152
|
+
overallOrderConfig.isUpperLowerCaseSeparate &&
|
|
1153
|
+
set(overallOrderConfig, { isUpperLowerCaseSeparate: false })
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
// 整单合计设置大写金额在前
|
|
1159
|
+
@action.bound
|
|
1160
|
+
setOverallOrderUpperCaseBefore() {
|
|
1161
|
+
if (this.selectedRegion) {
|
|
1162
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1163
|
+
const arr = this.selectedRegion.split('.')
|
|
1164
|
+
const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
|
|
1165
|
+
|
|
1166
|
+
const oldUpperCaseBefore = overallOrderConfig?.isUpperCaseBefore
|
|
1167
|
+
this.config.contents[arr[2]]?.overallOrder &&
|
|
1168
|
+
set(overallOrderConfig, { isUpperCaseBefore: !oldUpperCaseBefore })
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// 整单合计设置大小写金额分开
|
|
1173
|
+
@action.bound
|
|
1174
|
+
setOverallOrderUpperLowerCaseSeparate() {
|
|
1175
|
+
if (this.selectedRegion) {
|
|
1176
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1177
|
+
const arr = this.selectedRegion.split('.')
|
|
1178
|
+
const overallOrderConfig = this.config.contents[arr[2]]?.overallOrder
|
|
1179
|
+
|
|
1180
|
+
const oldUpperLowerCaseSeparate =
|
|
1181
|
+
overallOrderConfig.isUpperLowerCaseSeparate
|
|
1182
|
+
set(overallOrderConfig, {
|
|
1183
|
+
isUpperLowerCaseSeparate: !oldUpperLowerCaseSeparate
|
|
1184
|
+
})
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// 整单合计开启自定义单元格
|
|
1189
|
+
@action.bound
|
|
1190
|
+
setOverallOrderCustomCells() {
|
|
1191
|
+
if (this.selectedRegion) {
|
|
1192
|
+
// 作用:触发tableoverallordertr组件的更新
|
|
1193
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1194
|
+
const arr = this.selectedRegion.split('.')
|
|
1195
|
+
const table = this.config.contents[arr[2]]
|
|
1196
|
+
const overallOrderConfig = table?.overallOrder
|
|
1197
|
+
if (!overallOrderConfig || !overallOrderConfig?.show) return
|
|
1198
|
+
// 多栏表格情况
|
|
1199
|
+
const colSpanLength = getColSpanLength(table)
|
|
1200
|
+
const oldCustomCells = overallOrderConfig?.isCustomCells
|
|
1201
|
+
|
|
1202
|
+
set(overallOrderConfig, {
|
|
1203
|
+
isCustomCells: !oldCustomCells
|
|
1204
|
+
})
|
|
1205
|
+
|
|
1206
|
+
if (overallOrderConfig?.isCustomCells) {
|
|
1207
|
+
// fields添加自定义单元格
|
|
1208
|
+
overallOrderConfig.fields = [
|
|
1209
|
+
overallOrderConfig.fields[0],
|
|
1210
|
+
{
|
|
1211
|
+
...this.overallOrderConfigFields,
|
|
1212
|
+
// 和之前保持一样的样式
|
|
1213
|
+
style: { ...overallOrderConfig.fields[0].style }
|
|
1214
|
+
}
|
|
1215
|
+
]
|
|
1216
|
+
// 重新计算合并单元格的个数
|
|
1217
|
+
overallOrderConfig.fields[0].colSpan =
|
|
1218
|
+
colSpanLength - overallOrderConfig.fields[1].colSpan
|
|
1219
|
+
} else {
|
|
1220
|
+
// 关闭自定义单元格
|
|
1221
|
+
overallOrderConfig.fields = [overallOrderConfig.fields[0]]
|
|
1222
|
+
// 重新计算合并单元格的个数
|
|
1223
|
+
overallOrderConfig.fields[0].colSpan = colSpanLength
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
this.config = toJS(this.config)
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
// 整单合计自定义单元格文本输入
|
|
1231
|
+
@action.bound
|
|
1232
|
+
setOverallOrderFields(value) {
|
|
1233
|
+
if (this.selectedRegion) {
|
|
1234
|
+
const arr = this.selectedRegion.split('.')
|
|
1235
|
+
const table = this.config.contents[arr[2]]
|
|
1236
|
+
const overallOrderConfig = table?.overallOrder
|
|
1237
|
+
|
|
1238
|
+
if (overallOrderConfig.isCustomCells) {
|
|
1239
|
+
const overallOrderConfigFields = table?.overallOrder.fields
|
|
1240
|
+
overallOrderConfigFields[1].name = value
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
// 整单合计样式设置
|
|
1246
|
+
@action.bound
|
|
1247
|
+
setOverallOrderStyle(value) {
|
|
1248
|
+
if (this.selectedRegion) {
|
|
1249
|
+
const flexStyle = {
|
|
1250
|
+
left: 'flex-start',
|
|
1251
|
+
center: 'center',
|
|
1252
|
+
right: 'flex-end'
|
|
1253
|
+
}
|
|
1254
|
+
const arr = this.selectedRegion.split('.')
|
|
1255
|
+
const overallOrderConfigFields = this.config.contents[arr[2]]
|
|
1256
|
+
?.overallOrder.fields
|
|
1257
|
+
_.forEach(overallOrderConfigFields, item => {
|
|
1258
|
+
const oldStyle = item.style || {}
|
|
1259
|
+
set(item, {
|
|
1260
|
+
style: {
|
|
1261
|
+
...oldStyle,
|
|
1262
|
+
...value,
|
|
1263
|
+
// 整单合计里使用的flex布局,textAlign不生效
|
|
1264
|
+
'justify-content': flexStyle[value.textAlign]
|
|
1265
|
+
}
|
|
1266
|
+
})
|
|
1267
|
+
})
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
// 合计和每页合计设置交换位置
|
|
986
1272
|
@action.bound
|
|
987
1273
|
setSubtotalCommutationPlace() {
|
|
988
1274
|
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,
|
|
10
|
+
auto,
|
|
11
|
+
none,
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
11
14
|
|
|
12
|
-
row,
|
|
15
|
+
row,
|
|
16
|
+
column,
|
|
13
17
|
|
|
14
|
-
wrap,
|
|
18
|
+
wrap,
|
|
19
|
+
nowrap,
|
|
20
|
+
flexGrow,
|
|
15
21
|
|
|
16
|
-
justifyStart,
|
|
22
|
+
justifyStart,
|
|
23
|
+
justifyEnd,
|
|
24
|
+
justifyCenter,
|
|
25
|
+
justifyBetween,
|
|
26
|
+
justifyAround,
|
|
17
27
|
|
|
18
|
-
alignStart,
|
|
28
|
+
alignStart,
|
|
29
|
+
alignEnd,
|
|
30
|
+
alignCenter,
|
|
31
|
+
alignBaseline,
|
|
32
|
+
alignStretch,
|
|
19
33
|
|
|
20
|
-
alignContentStart,
|
|
34
|
+
alignContentStart,
|
|
35
|
+
alignContentEnd,
|
|
36
|
+
alignContentCenter,
|
|
37
|
+
alignContentBetween,
|
|
38
|
+
alignContentAround,
|
|
39
|
+
alignContentStretch,
|
|
21
40
|
|
|
22
|
-
className,
|
|
41
|
+
className,
|
|
42
|
+
style,
|
|
23
43
|
|
|
24
44
|
...rest
|
|
25
45
|
} = this.props
|
|
26
|
-
const cn = classNames(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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 =
|
|
62
|
-
s.WebKitFlex =
|
|
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
|
|
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 {
|
|
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
|
|
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 = {
|
package/src/printer/printer.js
CHANGED
|
@@ -81,6 +81,9 @@ 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
|
+
}
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
componentDidMount() {
|
|
@@ -324,7 +327,8 @@ Printer.propTypes = {
|
|
|
324
327
|
config: PropTypes.object.isRequired,
|
|
325
328
|
onReady: PropTypes.func,
|
|
326
329
|
isSomeSubtotalTr: PropTypes.bool,
|
|
327
|
-
getremainpageHeight: PropTypes.func
|
|
330
|
+
getremainpageHeight: PropTypes.func,
|
|
331
|
+
overallorder: PropTypes.bool
|
|
328
332
|
}
|
|
329
333
|
|
|
330
334
|
Printer.defaultProps = {
|