gm-printer 10.39.4-beta.2 → 10.39.4-beta.21
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/build/demo.js +9 -9
- package/locales/en.json +3 -0
- package/locales/th.json +3 -0
- package/locales/zh-HK.json +3 -0
- package/package.json +1 -1
- package/src/common/common_context_menu.js +6 -4
- package/src/common/component.js +64 -8
- package/src/common/data_key_util.js +35 -0
- package/src/common/editor_edit_field.js +288 -167
- package/src/common/editor_store.js +230 -42
- package/src/common/hoc_with_store.js +9 -0
- package/src/common/style.lesss +43 -0
- package/src/common/util.js +58 -4
- package/src/editor/context_menu.js +17 -0
- package/src/editor/store.js +13 -0
- package/src/editor_purchase/editor.js +2 -1
- package/src/editor_purchase/editor_special_table.js +39 -17
- package/src/editor_purchase/editor_sum_table.js +5 -1
- package/src/editor_purchase/store.js +48 -45
- package/src/finance_voucher/components/table_subtotal_tr.js +12 -18
- package/src/index.js +6 -2
- package/src/printer/block.js +154 -4
- package/src/printer/compute_pages.js +122 -0
- package/src/printer/index.js +3 -1
- package/src/printer/long_print_table/index.js +14 -4
- package/src/printer/multi_column.js +1 -0
- package/src/printer/page_summary.js +3 -1
- package/src/printer/printer.js +23 -3
- package/src/printer/store.js +141 -91
- package/src/printer/table.js +11 -3
- package/src/printer/table_diy_overallOrder_tr.js +8 -15
- package/src/printer/table_diy_summary_tr.js +18 -35
- package/src/printer/table_overallOrder_tr.js +49 -37
- package/src/printer/table_special_tr.js +17 -2
- package/src/printer/table_subtotal_tr.js +100 -16
- package/src/util.js +34 -8
- package/yarn-error.log +372 -152
|
@@ -12,6 +12,12 @@ import {
|
|
|
12
12
|
getMultiNumber
|
|
13
13
|
} from '../util'
|
|
14
14
|
import { accountRadioList } from './util'
|
|
15
|
+
import {
|
|
16
|
+
buildDataKey,
|
|
17
|
+
getDataKeyPrefix,
|
|
18
|
+
isDetailOneRowSelectKey,
|
|
19
|
+
isIndependentRolDataKey
|
|
20
|
+
} from './data_key_util'
|
|
15
21
|
import React from 'react'
|
|
16
22
|
import { createDiySummaryStoreMethods } from './diy_summary_helper'
|
|
17
23
|
import {
|
|
@@ -31,6 +37,10 @@ class EditorStore {
|
|
|
31
37
|
@observable
|
|
32
38
|
tableCustomStyle = 'default'
|
|
33
39
|
|
|
40
|
+
// 插入图片增强配置(电子签章),null 时保持旧行为(500Kb/image/*)
|
|
41
|
+
// { maxSize, maxSizeLabel, accept, acceptHint, resizable }
|
|
42
|
+
imageConfig = null
|
|
43
|
+
|
|
34
44
|
@observable
|
|
35
45
|
emptyTableData = []
|
|
36
46
|
|
|
@@ -300,18 +310,15 @@ class EditorStore {
|
|
|
300
310
|
return
|
|
301
311
|
}
|
|
302
312
|
|
|
303
|
-
const sourceItems = flattenHorizontalPackedRows(
|
|
304
|
-
sourceRows,
|
|
305
|
-
sourceColNumber
|
|
306
|
-
)
|
|
313
|
+
const sourceItems = flattenHorizontalPackedRows(sourceRows, sourceColNumber)
|
|
307
314
|
const baseRowCount = sourceItems.length
|
|
308
315
|
? Math.max(1, Math.ceil(sourceItems.length / colNumber))
|
|
309
316
|
: 0
|
|
310
317
|
this.mockData._table[dataKey] = !baseRowCount
|
|
311
318
|
? []
|
|
312
319
|
: isVertical
|
|
313
|
-
|
|
314
|
-
|
|
320
|
+
? packVerticalNewspaper(sourceItems, colNumber, baseRowCount, false)
|
|
321
|
+
: packHorizontalRowMajor(sourceItems, colNumber)
|
|
315
322
|
}
|
|
316
323
|
|
|
317
324
|
@action.bound
|
|
@@ -368,8 +375,8 @@ class EditorStore {
|
|
|
368
375
|
const sourceColNumber = isMultiTable(singleKey)
|
|
369
376
|
? getMultiNumber(singleKey)
|
|
370
377
|
: isMultiTable(sourceKey)
|
|
371
|
-
|
|
372
|
-
|
|
378
|
+
? colNumber
|
|
379
|
+
: 1
|
|
373
380
|
const sourceItems = flattenHorizontalPackedRows(
|
|
374
381
|
sourceRows,
|
|
375
382
|
sourceColNumber
|
|
@@ -710,18 +717,13 @@ class EditorStore {
|
|
|
710
717
|
const singleKey = sourceKey.replace(/_multi3?/, '')
|
|
711
718
|
const colNumber = getMultiNumber(sourceKey)
|
|
712
719
|
const sourceRows =
|
|
713
|
-
this.mockData._table[singleKey] ||
|
|
714
|
-
this.mockData._table[sourceKey] ||
|
|
715
|
-
[]
|
|
720
|
+
this.mockData._table[singleKey] || this.mockData._table[sourceKey] || []
|
|
716
721
|
const sourceColNumber = isMultiTable(singleKey)
|
|
717
722
|
? getMultiNumber(singleKey)
|
|
718
723
|
: isMultiTable(sourceKey)
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
const sourceItems = flattenHorizontalPackedRows(
|
|
722
|
-
sourceRows,
|
|
723
|
-
sourceColNumber
|
|
724
|
-
)
|
|
724
|
+
? colNumber
|
|
725
|
+
: 1
|
|
726
|
+
const sourceItems = flattenHorizontalPackedRows(sourceRows, sourceColNumber)
|
|
725
727
|
const baseRowCount = sourceItems.length
|
|
726
728
|
? Math.max(1, Math.ceil(sourceItems.length / colNumber))
|
|
727
729
|
: 0
|
|
@@ -731,7 +733,7 @@ class EditorStore {
|
|
|
731
733
|
}
|
|
732
734
|
|
|
733
735
|
@action
|
|
734
|
-
addConfigBlock(name, type, pos = {}, link = '') {
|
|
736
|
+
addConfigBlock(name, type, pos = {}, link = '', ratio) {
|
|
735
737
|
let blocks
|
|
736
738
|
const arr = name.split('.')
|
|
737
739
|
|
|
@@ -775,6 +777,8 @@ class EditorStore {
|
|
|
775
777
|
blocks.push({
|
|
776
778
|
type: 'image',
|
|
777
779
|
link: link,
|
|
780
|
+
// 电子签章:记录原图宽高比,锁比例用;旧数据无此字段则不锁
|
|
781
|
+
ratio: ratio,
|
|
778
782
|
style: {
|
|
779
783
|
position: 'absolute',
|
|
780
784
|
left: pos.left || '0px',
|
|
@@ -861,7 +865,6 @@ class EditorStore {
|
|
|
861
865
|
// 切换的时候,要把对应table的多余空数据清掉
|
|
862
866
|
this.clearExtraTableData(table.dataKey)
|
|
863
867
|
|
|
864
|
-
this.setAutoFillingConfig(!this.isAutoFilling)
|
|
865
868
|
// 获取td的colSpan
|
|
866
869
|
const colSpanLength = getColSpanLength(table)
|
|
867
870
|
set(table.subtotal, {
|
|
@@ -954,13 +957,34 @@ class EditorStore {
|
|
|
954
957
|
set(table.overallOrder, {
|
|
955
958
|
show: !table.overallOrder.show
|
|
956
959
|
})
|
|
957
|
-
|
|
958
|
-
|
|
960
|
+
// 老模板补默认:每页展示默认勾选
|
|
961
|
+
if (table.overallOrder.showEachPage === undefined) {
|
|
962
|
+
set(table.overallOrder, { showEachPage: true })
|
|
963
|
+
}
|
|
964
|
+
// 兼容存量/测试模板 overallOrder 只存了 {show:false} 没有 fields,补默认结构,否则 fields[0] 取值崩溃
|
|
965
|
+
if (!table.overallOrder.fields?.length) {
|
|
966
|
+
set(table.overallOrder, {
|
|
967
|
+
fields: [
|
|
968
|
+
{
|
|
969
|
+
name: '整单合计:',
|
|
970
|
+
valueField: '出库金额',
|
|
971
|
+
style: {
|
|
972
|
+
fontWeight: 'bold'
|
|
973
|
+
},
|
|
974
|
+
colSpan: colSpanLength
|
|
975
|
+
}
|
|
976
|
+
]
|
|
977
|
+
})
|
|
978
|
+
} else {
|
|
979
|
+
table.overallOrder.fields[0].colSpan =
|
|
980
|
+
colSpanLength - (table.overallOrder.fields?.[1]?.colSpan ?? 0)
|
|
981
|
+
}
|
|
959
982
|
} else {
|
|
960
983
|
// 兼容已经存在的配送单据,他们的配置存在后端的,没有overallOrder这个配置,给加上
|
|
961
984
|
set(table, {
|
|
962
985
|
overallOrder: {
|
|
963
986
|
show: true,
|
|
987
|
+
showEachPage: true,
|
|
964
988
|
fields: [
|
|
965
989
|
{
|
|
966
990
|
name: '整单合计:',
|
|
@@ -977,6 +1001,19 @@ class EditorStore {
|
|
|
977
1001
|
this.config = toJS(this.config)
|
|
978
1002
|
}
|
|
979
1003
|
|
|
1004
|
+
// 整单合计「每页展示」
|
|
1005
|
+
@action.bound
|
|
1006
|
+
setOverallOrderShowEachPage() {
|
|
1007
|
+
if (!this.selectedRegion) return
|
|
1008
|
+
const arr = this.selectedRegion.split('.')
|
|
1009
|
+
const table = this.config.contents[arr[2]]
|
|
1010
|
+
if (!table?.overallOrder) return
|
|
1011
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1012
|
+
const next = !(table.overallOrder.showEachPage !== false)
|
|
1013
|
+
set(table.overallOrder, { showEachPage: next })
|
|
1014
|
+
this.config = toJS(this.config)
|
|
1015
|
+
}
|
|
1016
|
+
|
|
980
1017
|
@action
|
|
981
1018
|
setDiyOverallOrderShow(name) {
|
|
982
1019
|
const arr = name.split('.')
|
|
@@ -1079,6 +1116,54 @@ class EditorStore {
|
|
|
1079
1116
|
) {
|
|
1080
1117
|
newDataKey = _.without(newDataKey, 'tag', 'tagDiy')
|
|
1081
1118
|
}
|
|
1119
|
+
// 标签小计和三级分类小计互斥
|
|
1120
|
+
if (
|
|
1121
|
+
newDataKey.includes('category3') &&
|
|
1122
|
+
(key === 'tag' || key === 'tagDiy')
|
|
1123
|
+
) {
|
|
1124
|
+
newDataKey = _.without(newDataKey, 'category3')
|
|
1125
|
+
} else if (
|
|
1126
|
+
(newDataKey.includes('tag') || newDataKey.includes('tagDiy')) &&
|
|
1127
|
+
key === 'category3'
|
|
1128
|
+
) {
|
|
1129
|
+
newDataKey = _.without(newDataKey, 'tag', 'tagDiy')
|
|
1130
|
+
}
|
|
1131
|
+
// 标签小计和商品三级分类互斥
|
|
1132
|
+
if (
|
|
1133
|
+
newDataKey.includes('newCategory3') &&
|
|
1134
|
+
(key === 'tag' || key === 'tagDiy')
|
|
1135
|
+
) {
|
|
1136
|
+
newDataKey = _.without(newDataKey, 'newCategory3')
|
|
1137
|
+
} else if (
|
|
1138
|
+
(newDataKey.includes('tag') || newDataKey.includes('tagDiy')) &&
|
|
1139
|
+
key === 'newCategory3'
|
|
1140
|
+
) {
|
|
1141
|
+
newDataKey = _.without(newDataKey, 'tag', 'tagDiy')
|
|
1142
|
+
}
|
|
1143
|
+
// 商品三级分类和商品分类互斥(标题维度一级/三级二选一)
|
|
1144
|
+
if (newDataKey.includes('newCategory3') && key === 'newCategory') {
|
|
1145
|
+
newDataKey = _.without(newDataKey, 'newCategory3')
|
|
1146
|
+
} else if (newDataKey.includes('newCategory') && key === 'newCategory3') {
|
|
1147
|
+
newDataKey = _.without(newDataKey, 'newCategory')
|
|
1148
|
+
}
|
|
1149
|
+
// 三级分类小计和分类小计互斥(小计维度一级/三级二选一)
|
|
1150
|
+
if (newDataKey.includes('category3') && key === 'category') {
|
|
1151
|
+
newDataKey = _.without(newDataKey, 'category3')
|
|
1152
|
+
} else if (newDataKey.includes('category') && key === 'category3') {
|
|
1153
|
+
newDataKey = _.without(newDataKey, 'category')
|
|
1154
|
+
}
|
|
1155
|
+
// 跨层级混搭互斥:商品三级分类(三级标题)不配一级分类小计
|
|
1156
|
+
if (newDataKey.includes('newCategory3') && key === 'category') {
|
|
1157
|
+
newDataKey = _.without(newDataKey, 'newCategory3')
|
|
1158
|
+
} else if (newDataKey.includes('category') && key === 'newCategory3') {
|
|
1159
|
+
newDataKey = _.without(newDataKey, 'category')
|
|
1160
|
+
}
|
|
1161
|
+
// 跨层级混搭互斥:三级分类小计(三级小计)不配一级商品分类
|
|
1162
|
+
if (newDataKey.includes('category3') && key === 'newCategory') {
|
|
1163
|
+
newDataKey = _.without(newDataKey, 'category3')
|
|
1164
|
+
} else if (newDataKey.includes('newCategory') && key === 'category3') {
|
|
1165
|
+
newDataKey = _.without(newDataKey, 'newCategory')
|
|
1166
|
+
}
|
|
1082
1167
|
|
|
1083
1168
|
if (newDataKey.includes('categoryDiy')) {
|
|
1084
1169
|
if (!diyCategorySubtotal?.show) {
|
|
@@ -1105,7 +1190,10 @@ class EditorStore {
|
|
|
1105
1190
|
o => o === 'tag',
|
|
1106
1191
|
o => o === 'multi3',
|
|
1107
1192
|
o => o === 'multi',
|
|
1193
|
+
// 三级 token 紧跟对应一级 token 之后,保证拼串顺序 orders → category → category3 → newCategory → newCategory3 → multi → multi3 → tag → categoryDiy → tagDiy
|
|
1194
|
+
o => o === 'newCategory3',
|
|
1108
1195
|
o => o === 'newCategory',
|
|
1196
|
+
o => o === 'category3',
|
|
1109
1197
|
o => o === 'category',
|
|
1110
1198
|
o => o === 'orders'
|
|
1111
1199
|
])
|
|
@@ -1121,12 +1209,17 @@ class EditorStore {
|
|
|
1121
1209
|
this.ensureMockMultiTable(getDataKey(joinedKey, 'vertical'))
|
|
1122
1210
|
}
|
|
1123
1211
|
|
|
1124
|
-
//
|
|
1125
|
-
|
|
1126
|
-
//
|
|
1127
|
-
if (
|
|
1128
|
-
|
|
1129
|
-
|
|
1212
|
+
// 三级分类相关 token(商品三级分类/三级分类小计)是纯分组、标题能力,
|
|
1213
|
+
// 与每页/整单合计可共存,切换时不再强制关闭合计开关;
|
|
1214
|
+
// 其余 token(多栏/一级分类/标签等)保持历史行为:切换时强制关闭
|
|
1215
|
+
if (!['newCategory3', 'category3'].includes(key)) {
|
|
1216
|
+
// 整单合计不显示
|
|
1217
|
+
if (overallOrder?.show) overallOrder.show = false
|
|
1218
|
+
// 每页合计不显示
|
|
1219
|
+
if (subtotal?.show) subtotal.show = false
|
|
1220
|
+
// 自定义每页合计不显示
|
|
1221
|
+
if (diyOverallOrder?.show) diyOverallOrder.show = false
|
|
1222
|
+
}
|
|
1130
1223
|
|
|
1131
1224
|
// 分类/多栏切换:清空旧空行并同步 autoFillConfig.dataKey,Printer 重挂载后会重补
|
|
1132
1225
|
if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
|
|
@@ -1454,16 +1547,17 @@ class EditorStore {
|
|
|
1454
1547
|
const table = this.config.contents[arr[2]]
|
|
1455
1548
|
|
|
1456
1549
|
const getDataKey = () => {
|
|
1457
|
-
if (dataKey
|
|
1550
|
+
if (isDetailOneRowSelectKey(dataKey)) {
|
|
1458
1551
|
if (!table.purchaseSettingKey) {
|
|
1459
1552
|
this.setPurchasePrintSettingKey()
|
|
1460
1553
|
return dataKey
|
|
1461
1554
|
}
|
|
1555
|
+
const prefix = getDataKeyPrefix(dataKey)
|
|
1462
1556
|
if (table.purchaseSettingKey === 'goods') {
|
|
1463
|
-
return '
|
|
1557
|
+
return buildDataKey(prefix, 'independent_rol_sku')
|
|
1464
1558
|
}
|
|
1465
1559
|
if (table.purchaseSettingKey === 'merchant') {
|
|
1466
|
-
return '
|
|
1560
|
+
return buildDataKey(prefix, 'independent_rol_address')
|
|
1467
1561
|
}
|
|
1468
1562
|
}
|
|
1469
1563
|
return dataKey
|
|
@@ -1483,14 +1577,14 @@ class EditorStore {
|
|
|
1483
1577
|
@action.bound setPurchasePrintSettingKey(dataKey = 'goods') {
|
|
1484
1578
|
const arr = this.selectedRegion.split('.')
|
|
1485
1579
|
const table = this.config.contents[arr[2]]
|
|
1580
|
+
const prefix = getDataKeyPrefix(table.dataKey)
|
|
1486
1581
|
|
|
1487
1582
|
set(table, {
|
|
1488
1583
|
purchaseSettingKey: dataKey,
|
|
1489
1584
|
dataKey:
|
|
1490
1585
|
dataKey === 'goods'
|
|
1491
|
-
? '
|
|
1492
|
-
: '
|
|
1493
|
-
// 切换打印设置时,重置明细行排序为默认值(候选值列表会变化)
|
|
1586
|
+
? buildDataKey(prefix, 'independent_rol_sku')
|
|
1587
|
+
: buildDataKey(prefix, 'independent_rol_address'),
|
|
1494
1588
|
detail_sort_type: 0
|
|
1495
1589
|
})
|
|
1496
1590
|
}
|
|
@@ -1512,11 +1606,8 @@ class EditorStore {
|
|
|
1512
1606
|
const table = this.config.contents[arr[2]]
|
|
1513
1607
|
|
|
1514
1608
|
const { dataKey } = table
|
|
1515
|
-
if (
|
|
1516
|
-
dataKey
|
|
1517
|
-
dataKey === 'purchase_independent_rol_address'
|
|
1518
|
-
) {
|
|
1519
|
-
return 'purchase_detail_one_row'
|
|
1609
|
+
if (isIndependentRolDataKey(dataKey)) {
|
|
1610
|
+
return buildDataKey(getDataKeyPrefix(dataKey), 'detail_one_row')
|
|
1520
1611
|
}
|
|
1521
1612
|
return dataKey
|
|
1522
1613
|
}
|
|
@@ -1587,7 +1678,7 @@ class EditorStore {
|
|
|
1587
1678
|
arrange: val
|
|
1588
1679
|
}
|
|
1589
1680
|
// 只改排列并清掉旧空行;保持填充开关,交给 Printer 重挂载后
|
|
1590
|
-
|
|
1681
|
+
// 「先补空 → 再重新分页」恢复空行(勿在此处用旧 remainHeight 立刻补)
|
|
1591
1682
|
if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
|
|
1592
1683
|
this.clearAllTableEmptyData()
|
|
1593
1684
|
this.setAutoFillingConfig(true)
|
|
@@ -1767,6 +1858,42 @@ class EditorStore {
|
|
|
1767
1858
|
}
|
|
1768
1859
|
}
|
|
1769
1860
|
|
|
1861
|
+
// 分类/标签 小计 - 显示分类名称(商品分类/商品三级分类小计行是否展示分类名,默认展示)
|
|
1862
|
+
@action.bound setShowCategoryName() {
|
|
1863
|
+
// 作用:触发组件的更新(小计行前缀由渲染层按 specialConfig 实时重拼,需触发预览重渲染)
|
|
1864
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1865
|
+
if (this.selectedRegion) {
|
|
1866
|
+
const arr = this.selectedRegion.split('.')
|
|
1867
|
+
const tableConfig = this.config.contents[arr[2]]
|
|
1868
|
+
|
|
1869
|
+
set(tableConfig, {
|
|
1870
|
+
specialConfig: {
|
|
1871
|
+
...tableConfig.specialConfig,
|
|
1872
|
+
showCategoryName: !(
|
|
1873
|
+
tableConfig.specialConfig?.showCategoryName ?? true
|
|
1874
|
+
)
|
|
1875
|
+
}
|
|
1876
|
+
})
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
// 分类/标签 小计 - 小计文案修改(默认"小计",允许为空;缺失时由数据层兜底默认值)
|
|
1881
|
+
@action.bound setSubtotalText(value) {
|
|
1882
|
+
// 作用:触发组件的更新(小计行前缀由渲染层按 specialConfig 实时重拼,需触发预览重渲染)
|
|
1883
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
1884
|
+
if (this.selectedRegion) {
|
|
1885
|
+
const arr = this.selectedRegion.split('.')
|
|
1886
|
+
const tableConfig = this.config.contents[arr[2]]
|
|
1887
|
+
|
|
1888
|
+
set(tableConfig, {
|
|
1889
|
+
specialConfig: {
|
|
1890
|
+
...tableConfig.specialConfig,
|
|
1891
|
+
subtotalText: value
|
|
1892
|
+
}
|
|
1893
|
+
})
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1770
1897
|
@action.bound
|
|
1771
1898
|
setSpecialUpperCase() {
|
|
1772
1899
|
if (this.selectedRegion) {
|
|
@@ -1962,6 +2089,8 @@ class EditorStore {
|
|
|
1962
2089
|
}
|
|
1963
2090
|
// 开启自定义单元格
|
|
1964
2091
|
if (subtotalConfig?.isCustomCells) {
|
|
2092
|
+
// 互斥:开启自定义单元格时关闭单元格拆分展示
|
|
2093
|
+
set(subtotalConfig, { isSplitCells: false })
|
|
1965
2094
|
// 同时还开启了自定义单元格选项
|
|
1966
2095
|
if (subtotalConfig?.fields?.length === 2) {
|
|
1967
2096
|
// fields添加自定义单元格
|
|
@@ -2009,6 +2138,8 @@ class EditorStore {
|
|
|
2009
2138
|
}
|
|
2010
2139
|
|
|
2011
2140
|
// 每页合计自定义单元格文本输入
|
|
2141
|
+
// Text 组件的 onChange 实际收到事件对象(handleChange 被 spread 覆盖),直接绑定时需防御式取 e.target.value,否则事件对象存进 fields[n].name 会导致页面崩溃
|
|
2142
|
+
// ⚠️ 不能用 `value?.target?.value || value`:清空输入时 e.target.value 为空串(falsy),|| 会错把事件对象存进去(清空即崩),必须用 value?.target 判别
|
|
2012
2143
|
@action.bound
|
|
2013
2144
|
setSubtotalFields(value) {
|
|
2014
2145
|
if (this.selectedRegion) {
|
|
@@ -2017,10 +2148,64 @@ class EditorStore {
|
|
|
2017
2148
|
const subtotalConfig = table?.subtotal
|
|
2018
2149
|
|
|
2019
2150
|
if (subtotalConfig.isCustomCells) {
|
|
2151
|
+
const text = value?.target ? value.target.value : value ?? ''
|
|
2020
2152
|
const subtotalConfig = table?.subtotal.fields
|
|
2021
2153
|
subtotalConfig.length === 3
|
|
2022
|
-
? (subtotalConfig[2].name =
|
|
2023
|
-
: (subtotalConfig[1].name =
|
|
2154
|
+
? (subtotalConfig[2].name = text)
|
|
2155
|
+
: (subtotalConfig[1].name = text)
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
// 每页合计单元格拆分展示("每页合计/数值"拆分为两个单元格,与开启自定义单元格互斥)
|
|
2161
|
+
@action.bound
|
|
2162
|
+
setSubtotalSplitCells() {
|
|
2163
|
+
if (this.selectedRegion) {
|
|
2164
|
+
// 作用:触发组件的更新
|
|
2165
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
2166
|
+
const arr = this.selectedRegion.split('.')
|
|
2167
|
+
const table = this.config.contents[arr[2]]
|
|
2168
|
+
const subtotalConfig = table?.subtotal
|
|
2169
|
+
// 没有显示每页合计的时候不可以设置
|
|
2170
|
+
if (!subtotalConfig?.show) return
|
|
2171
|
+
// 多栏表格情况,计算colSpan
|
|
2172
|
+
const colSpanLength = getColSpanLength(table)
|
|
2173
|
+
const oldSplitCells = subtotalConfig?.isSplitCells
|
|
2174
|
+
|
|
2175
|
+
set(subtotalConfig, {
|
|
2176
|
+
isSplitCells: !oldSplitCells
|
|
2177
|
+
})
|
|
2178
|
+
// 兼容已经存在后端的模板,每页合计配置没有fields,手动补上
|
|
2179
|
+
if (!subtotalConfig.fields) {
|
|
2180
|
+
set(subtotalConfig, {
|
|
2181
|
+
fields: [
|
|
2182
|
+
{
|
|
2183
|
+
name: '每页合计:',
|
|
2184
|
+
valueField: 'real_item_price',
|
|
2185
|
+
colSpan: colSpanLength
|
|
2186
|
+
}
|
|
2187
|
+
]
|
|
2188
|
+
})
|
|
2189
|
+
}
|
|
2190
|
+
// 互斥:开启拆分展示时关闭自定义单元格(复用其关闭时的 fields 重排逻辑)
|
|
2191
|
+
if (!oldSplitCells && subtotalConfig?.isCustomCells) {
|
|
2192
|
+
this.setSubtotalCustomCells()
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
// 每页合计左侧文案修改(默认"每页合计",允许为空,每页合计统一展示输入框内容)
|
|
2198
|
+
@action.bound
|
|
2199
|
+
setSubtotalLeftText(value) {
|
|
2200
|
+
if (this.selectedRegion) {
|
|
2201
|
+
// 作用:触发组件的更新(预览渲染不直接观察 fields[0].name,需强制重渲染)
|
|
2202
|
+
this.overallOrderShow = !this.overallOrderShow
|
|
2203
|
+
const arr = this.selectedRegion.split('.')
|
|
2204
|
+
const table = this.config.contents[arr[2]]
|
|
2205
|
+
const subtotalConfig = table?.subtotal
|
|
2206
|
+
|
|
2207
|
+
if (subtotalConfig?.fields?.[0]) {
|
|
2208
|
+
set(subtotalConfig.fields[0], { name: value })
|
|
2024
2209
|
}
|
|
2025
2210
|
}
|
|
2026
2211
|
}
|
|
@@ -2038,6 +2223,7 @@ class EditorStore {
|
|
|
2038
2223
|
set(table, {
|
|
2039
2224
|
overallOrder: {
|
|
2040
2225
|
show: true,
|
|
2226
|
+
showEachPage: true,
|
|
2041
2227
|
fields: [
|
|
2042
2228
|
{
|
|
2043
2229
|
name: '整单合计:',
|
|
@@ -2155,6 +2341,7 @@ class EditorStore {
|
|
|
2155
2341
|
}
|
|
2156
2342
|
|
|
2157
2343
|
// 整单合计自定义单元格文本输入
|
|
2344
|
+
// Text 组件直接绑定时收到事件对象(同 setSubtotalFields);⚠️ 不能用 `||` 兜底,清空输入时空串 falsy 会错存事件对象导致页面崩溃,用 value?.target 判别
|
|
2158
2345
|
@action.bound
|
|
2159
2346
|
setOverallOrderFields(value) {
|
|
2160
2347
|
if (this.selectedRegion) {
|
|
@@ -2163,8 +2350,9 @@ class EditorStore {
|
|
|
2163
2350
|
const overallOrderConfig = table?.overallOrder
|
|
2164
2351
|
|
|
2165
2352
|
if (overallOrderConfig.isCustomCells) {
|
|
2353
|
+
const text = value?.target ? value.target.value : value ?? ''
|
|
2166
2354
|
const overallOrderConfigFields = table?.overallOrder.fields
|
|
2167
|
-
overallOrderConfigFields[1].name =
|
|
2355
|
+
overallOrderConfigFields[1].name = text
|
|
2168
2356
|
}
|
|
2169
2357
|
}
|
|
2170
2358
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
2
3
|
import { Provider } from 'mobx-react'
|
|
3
4
|
import { getStyleWithDiff } from '../util'
|
|
4
5
|
|
|
5
6
|
const withStore = store => WrapComponent =>
|
|
6
7
|
class extends React.Component {
|
|
8
|
+
static propTypes = {
|
|
9
|
+
config: PropTypes.object,
|
|
10
|
+
mockData: PropTypes.object,
|
|
11
|
+
imageConfig: PropTypes.object
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
constructor(props) {
|
|
8
15
|
super(props)
|
|
9
16
|
this.store = store
|
|
10
17
|
this.store.init(props.config, props.mockData)
|
|
18
|
+
// 插入图片增强配置(电子签章):由业务侧 props 传入,不传为 null 保持旧行为
|
|
19
|
+
this.store.imageConfig = props.imageConfig || null
|
|
11
20
|
}
|
|
12
21
|
|
|
13
22
|
componentDidMount() {
|
package/src/common/style.lesss
CHANGED
|
@@ -166,6 +166,18 @@
|
|
|
166
166
|
color: white;
|
|
167
167
|
background: rgb(82, 146, 247);
|
|
168
168
|
}
|
|
169
|
+
|
|
170
|
+
// 电子签章:插入图片菜单项下的格式提示小字
|
|
171
|
+
.gm-printer-contextmenu-hint {
|
|
172
|
+
font-size: 10px;
|
|
173
|
+
color: #f5222d;
|
|
174
|
+
line-height: 1.4;
|
|
175
|
+
padding: 0;
|
|
176
|
+
&:hover {
|
|
177
|
+
color: #f5222d;
|
|
178
|
+
background: transparent;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
169
181
|
}
|
|
170
182
|
}
|
|
171
183
|
|
|
@@ -244,6 +256,37 @@
|
|
|
244
256
|
outline: 1px solid rgb(82, 146, 247);
|
|
245
257
|
z-index: 11;
|
|
246
258
|
}
|
|
259
|
+
|
|
260
|
+
// 电子签章:图片四角黑色加粗拖拽手柄
|
|
261
|
+
.gm-printer-resize-handle {
|
|
262
|
+
position: absolute;
|
|
263
|
+
width: 10px;
|
|
264
|
+
height: 10px;
|
|
265
|
+
background: #000;
|
|
266
|
+
border: 2px solid #fff;
|
|
267
|
+
z-index: 12;
|
|
268
|
+
|
|
269
|
+
&.gm-printer-resize-lt {
|
|
270
|
+
left: -6px;
|
|
271
|
+
top: -6px;
|
|
272
|
+
cursor: nwse-resize;
|
|
273
|
+
}
|
|
274
|
+
&.gm-printer-resize-rt {
|
|
275
|
+
right: -6px;
|
|
276
|
+
top: -6px;
|
|
277
|
+
cursor: nesw-resize;
|
|
278
|
+
}
|
|
279
|
+
&.gm-printer-resize-lb {
|
|
280
|
+
left: -6px;
|
|
281
|
+
bottom: -6px;
|
|
282
|
+
cursor: nesw-resize;
|
|
283
|
+
}
|
|
284
|
+
&.gm-printer-resize-rb {
|
|
285
|
+
right: -6px;
|
|
286
|
+
bottom: -6px;
|
|
287
|
+
cursor: nwse-resize;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
247
290
|
}
|
|
248
291
|
|
|
249
292
|
.gm-printer-table {
|
package/src/common/util.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import i18next from '../../locales'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* id
|
|
4
|
+
* 每页合计金额单选
|
|
5
|
+
* id 与 data_to_key 中文 key 对齐,用于对本页行求和,不要轻易改 id
|
|
6
6
|
*/
|
|
7
|
-
// 整单合计和每页合计栏都使用的这个
|
|
8
7
|
const subtotalRadioList = [
|
|
9
8
|
{
|
|
10
9
|
value: i18next.t('下单金额'),
|
|
@@ -17,6 +16,61 @@ const subtotalRadioList = [
|
|
|
17
16
|
{
|
|
18
17
|
value: i18next.t('实际金额'),
|
|
19
18
|
id: '实际金额'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: i18next.t('变化前金额'),
|
|
22
|
+
id: '变化前金额'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: i18next.t('下单金额(不含税)'),
|
|
26
|
+
id: '下单金额_不含税'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: i18next.t('实收金额'),
|
|
30
|
+
id: '实收金额'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: i18next.t('实收金额(不含税)'),
|
|
34
|
+
id: '实收金额_不含税'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 整单合计金额单选(比每页合计多「出库金额(不含税)」)
|
|
40
|
+
* id 与 data.common 中文 key 对齐,取订单已算金额,不重算
|
|
41
|
+
*/
|
|
42
|
+
const overallOrderRadioList = [
|
|
43
|
+
{
|
|
44
|
+
value: i18next.t('下单金额'),
|
|
45
|
+
id: '下单金额'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: i18next.t('出库金额'),
|
|
49
|
+
id: '出库金额'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: i18next.t('实际金额'),
|
|
53
|
+
id: '实际金额'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: i18next.t('变化前金额'),
|
|
57
|
+
id: '变化前金额'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: i18next.t('下单金额(不含税)'),
|
|
61
|
+
id: '下单金额_不含税'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: i18next.t('出库金额(不含税)'),
|
|
65
|
+
id: '出库金额_不含税'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: i18next.t('实收金额'),
|
|
69
|
+
id: '实收金额'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
value: i18next.t('实收金额(不含税)'),
|
|
73
|
+
id: '实收金额_不含税'
|
|
20
74
|
}
|
|
21
75
|
]
|
|
22
76
|
|
|
@@ -26,4 +80,4 @@ const accountRadioList = {
|
|
|
26
80
|
实际金额: i18next.t('实际金额')
|
|
27
81
|
}
|
|
28
82
|
|
|
29
|
-
export { subtotalRadioList, accountRadioList }
|
|
83
|
+
export { subtotalRadioList, overallOrderRadioList, accountRadioList }
|
|
@@ -166,8 +166,11 @@ class ContextMenu extends React.Component {
|
|
|
166
166
|
const isMultiActive = keyArr.includes('multi')
|
|
167
167
|
const isThreeActive = keyArr.includes('multi3')
|
|
168
168
|
const isCategoryActive = keyArr.includes('category')
|
|
169
|
+
// 三级分类小计(category3)/ 商品三级分类(newCategory3)token 状态
|
|
170
|
+
const isCategory3Active = keyArr.includes('category3')
|
|
169
171
|
const isTagActive = keyArr.includes('tag')
|
|
170
172
|
const isNewCategoryActive = keyArr.includes('newCategory')
|
|
173
|
+
const isNewCategory3Active = keyArr.includes('newCategory3')
|
|
171
174
|
const isSubtotalActive = subtotal.show
|
|
172
175
|
const isOverallOrder = overallOrder?.show
|
|
173
176
|
const isDiyOverallOrder = diyOverallOrder?.show
|
|
@@ -208,6 +211,13 @@ class ContextMenu extends React.Component {
|
|
|
208
211
|
>
|
|
209
212
|
{i18next.t('分类小计')}
|
|
210
213
|
</div>
|
|
214
|
+
{/* 三级分类小计:按三级分类(品类)拆分汇总小计,互斥规则见 changeTableDataKey */}
|
|
215
|
+
<div
|
|
216
|
+
onClick={this.handleChangeTableDataKey.bind(this, 'category3', name)}
|
|
217
|
+
className={isCategory3Active ? 'active' : ''}
|
|
218
|
+
>
|
|
219
|
+
{i18next.t('三级分类小计')}
|
|
220
|
+
</div>
|
|
211
221
|
<div
|
|
212
222
|
// onClick={() =>
|
|
213
223
|
// this.handleDiySummary(
|
|
@@ -244,6 +254,13 @@ class ContextMenu extends React.Component {
|
|
|
244
254
|
>
|
|
245
255
|
{i18next.t('商品分类')}
|
|
246
256
|
</div>
|
|
257
|
+
{/* 商品三级分类:按三级分类(品类)拆分并新增列表标题行,复用 categoryConfig 标题样式配置 */}
|
|
258
|
+
<div
|
|
259
|
+
onClick={this.handleCategoryConfig.bind(this, 'newCategory3', name)}
|
|
260
|
+
className={isNewCategory3Active ? 'active' : ''}
|
|
261
|
+
>
|
|
262
|
+
{i18next.t('商品三级分类')}
|
|
263
|
+
</div>
|
|
247
264
|
<div
|
|
248
265
|
onClick={this.handleSubtotal.bind(this, name)}
|
|
249
266
|
className={isSubtotalActive ? 'active' : ''}
|
package/src/editor/store.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import EditorStore from '../common/editor_store'
|
|
2
2
|
import i18next from '../../locales'
|
|
3
3
|
|
|
4
|
+
// 配送单"电子签章"插入图片增强预设(1056076):2M/指定格式/锁比例/四角拖拽
|
|
5
|
+
// 由业务侧显式传入 <Editor imageConfig={imageConfigDelivery} /> 才生效,不传保持旧行为
|
|
6
|
+
export const imageConfigDelivery = {
|
|
7
|
+
maxSize: 2 * 1024 * 1024,
|
|
8
|
+
maxSizeLabel: '2M',
|
|
9
|
+
accept: 'image/jpeg,image/jpg,image/png',
|
|
10
|
+
acceptTypes: ['image/jpeg', 'image/jpg', 'image/png'],
|
|
11
|
+
acceptHint: i18next.t('支持插入2M以内的jpg、jpeg、png格式图片'),
|
|
12
|
+
overSizeTip: i18next.t('图片大小不能超过2M'),
|
|
13
|
+
wrongTypeTip: i18next.t('仅支持jpg、jpeg、png格式的图片'),
|
|
14
|
+
resizable: true
|
|
15
|
+
}
|
|
16
|
+
|
|
4
17
|
class Store extends EditorStore {
|
|
5
18
|
// 复写父类方法
|
|
6
19
|
setTableDataKeyEffect(target, dataKey) {
|