gm-printer 10.37.0-beta.0 → 10.37.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/build/demo.js +9 -9
- package/package.json +1 -1
- package/src/common/editor_title.js +10 -4
- package/src/editor/index.js +0 -2
- package/src/editor_settle/editor.js +2 -1
- package/src/index.js +1 -3
- package/src/printer/store.js +4 -4
- package/src/editor/context_menu2.js +0 -335
- package/src/editor/editor2.js +0 -141
package/package.json
CHANGED
|
@@ -72,13 +72,15 @@ class EditorTitle extends React.Component {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
handleTestPrint = () => {
|
|
75
|
-
|
|
75
|
+
// 新增结款单每页合计标识,测试打印时原样透传到打印入口
|
|
76
|
+
const { mockData, editStore, isSomeSubtotalTr } = this.props
|
|
76
77
|
doPrint(
|
|
77
78
|
{
|
|
78
79
|
config: toJS(editStore.config),
|
|
79
80
|
data: mockData
|
|
80
81
|
},
|
|
81
|
-
true
|
|
82
|
+
true,
|
|
83
|
+
isSomeSubtotalTr
|
|
82
84
|
)
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -140,10 +142,14 @@ class EditorTitle extends React.Component {
|
|
|
140
142
|
EditorTitle.propTypes = {
|
|
141
143
|
onSave: PropTypes.func.isRequired,
|
|
142
144
|
isPurchase: PropTypes.bool,
|
|
143
|
-
editStore: PropTypes.object
|
|
145
|
+
editStore: PropTypes.object,
|
|
146
|
+
// 标识是否为结款单每页合计场景
|
|
147
|
+
isSomeSubtotalTr: PropTypes.bool
|
|
144
148
|
}
|
|
145
149
|
EditorTitle.defaultProps = {
|
|
146
|
-
isPurchase: false
|
|
150
|
+
isPurchase: false,
|
|
151
|
+
// 默认按非结款单每页合计场景处理
|
|
152
|
+
isSomeSubtotalTr: false
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
EditorTitle.wrappedComponent.propTypes = {
|
package/src/editor/index.js
CHANGED
|
@@ -42,7 +42,8 @@ class Editor extends React.Component {
|
|
|
42
42
|
|
|
43
43
|
{showEditor && (
|
|
44
44
|
<div className='gm-printer-edit-zone'>
|
|
45
|
-
|
|
45
|
+
{/* 透传结款单每页合计标识给标题区,用于测试打印时走对应逻辑 */}
|
|
46
|
+
<EditorTitle onSave={onSave} isSomeSubtotalTr={isSomeSubtotalTr} />
|
|
46
47
|
<Gap height='10px' />
|
|
47
48
|
<EditorSelect />
|
|
48
49
|
<Gap height='5px' />
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// ‼️优先初始化语言设置(必须先初始化语言)
|
|
2
2
|
import '../locales'
|
|
3
|
-
import Editor
|
|
4
|
-
|
|
3
|
+
import Editor from './editor'
|
|
5
4
|
import EditorPurchase from './editor_purchase'
|
|
6
5
|
import EditorStockIn from './editor_stockin'
|
|
7
6
|
import EditorStockOut from './editor_stockout'
|
|
@@ -28,7 +27,6 @@ export { setLocale } from '../locales'
|
|
|
28
27
|
|
|
29
28
|
export {
|
|
30
29
|
Editor,
|
|
31
|
-
Editor2,
|
|
32
30
|
EditorStockIn,
|
|
33
31
|
EditorStockOut,
|
|
34
32
|
EditorPurchase,
|
package/src/printer/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import i18next from '../../locales'
|
|
2
|
-
import { action, observable, computed
|
|
2
|
+
import { action, observable, computed } from 'mobx'
|
|
3
3
|
import {
|
|
4
4
|
getSumTrHeight,
|
|
5
5
|
isMultiTable,
|
|
@@ -530,7 +530,7 @@ class PrinterStore {
|
|
|
530
530
|
})({
|
|
531
531
|
...this.data.common,
|
|
532
532
|
[i18next.t('当前页码')]: pageIndex + 1,
|
|
533
|
-
[i18next.t('页码总数')]: this.pages.length,
|
|
533
|
+
[i18next.t('页码总数')]: Math.max(1, this.pages.length),
|
|
534
534
|
price: price
|
|
535
535
|
})
|
|
536
536
|
} catch (err) {
|
|
@@ -604,7 +604,7 @@ class PrinterStore {
|
|
|
604
604
|
|
|
605
605
|
[i18next.t('列')]: list[index],
|
|
606
606
|
[i18next.t('当前页码')]: pageIndex + 1,
|
|
607
|
-
[i18next.t('页码总数')]: this.pages.length,
|
|
607
|
+
[i18next.t('页码总数')]: Math.max(1, this.pages.length),
|
|
608
608
|
price: price // 提供一个价格处理函数
|
|
609
609
|
})
|
|
610
610
|
} catch (err) {
|
|
@@ -626,7 +626,7 @@ class PrinterStore {
|
|
|
626
626
|
...this.data.common,
|
|
627
627
|
[i18next.t('列')]: list[index],
|
|
628
628
|
[i18next.t('当前页码')]: pageIndex + 1,
|
|
629
|
-
[i18next.t('页码总数')]: this.pages.length,
|
|
629
|
+
[i18next.t('页码总数')]: Math.max(1, this.pages.length),
|
|
630
630
|
price: price // 提供一个价格处理函数
|
|
631
631
|
})
|
|
632
632
|
res =
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import i18next from '../../locales'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import PropTypes from 'prop-types'
|
|
4
|
-
import CommonContextMenu from '../common/common_context_menu'
|
|
5
|
-
import { inject, observer } from 'mobx-react'
|
|
6
|
-
import _ from 'lodash'
|
|
7
|
-
import { Printer } from '../printer'
|
|
8
|
-
import { isMultiTable } from '../util'
|
|
9
|
-
import { LONG_PRINT } from '../config'
|
|
10
|
-
|
|
11
|
-
const blockTypeList = [
|
|
12
|
-
{ value: '', text: i18next.t('插入文本') },
|
|
13
|
-
{ value: 'line', text: i18next.t('插入线条') },
|
|
14
|
-
{ value: 'image', text: i18next.t('插入图片') },
|
|
15
|
-
{ value: 'counter', text: i18next.t('插入分类汇总') },
|
|
16
|
-
{ value: 'tag', text: i18next.t('插入标签汇总') },
|
|
17
|
-
{ value: 'barcode', text: i18next.t('插入订单条形码') },
|
|
18
|
-
{ value: 'qrcode', text: i18next.t('插入订单溯源二维码') },
|
|
19
|
-
{
|
|
20
|
-
value: 'uniform_social_credit_code',
|
|
21
|
-
text: i18next.t('插入苏州安全监管平台二维码')
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
@inject('editStore')
|
|
26
|
-
@observer
|
|
27
|
-
class ContextMenu extends React.Component {
|
|
28
|
-
componentDidMount() {
|
|
29
|
-
const {
|
|
30
|
-
editStore,
|
|
31
|
-
editStore: {
|
|
32
|
-
config: { autoFillConfig, specialControlConfig }
|
|
33
|
-
}
|
|
34
|
-
} = this.props
|
|
35
|
-
|
|
36
|
-
if (autoFillConfig?.checked) {
|
|
37
|
-
editStore.handleChangeTableData(
|
|
38
|
-
autoFillConfig?.checked,
|
|
39
|
-
autoFillConfig?.dataKey
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
/** 初始化特殊控制的配置 */
|
|
43
|
-
if (specialControlConfig?.multiDigitDecimal) {
|
|
44
|
-
// 多位小数
|
|
45
|
-
editStore.setMultiDigitDecimal(specialControlConfig?.multiDigitDecimal)
|
|
46
|
-
}
|
|
47
|
-
if (specialControlConfig?.taxFreeProductRateDisplay !== undefined) {
|
|
48
|
-
// 免税产品税率显示
|
|
49
|
-
editStore.setTaxFreeProductRateDisplay(
|
|
50
|
-
specialControlConfig?.taxFreeProductRateDisplay || ''
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
isMenuItemEnabled = key => {
|
|
56
|
-
const { menuConfig } = this.props
|
|
57
|
-
if (!menuConfig) return true
|
|
58
|
-
if (Array.isArray(menuConfig)) return menuConfig.includes(key)
|
|
59
|
-
if (typeof menuConfig === 'object') return !!menuConfig[key]
|
|
60
|
-
return true
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 是否存在每页合计按钮,非异常明细才有按钮
|
|
65
|
-
* @param name => ContextMenu 的 this.state.name
|
|
66
|
-
* @return {boolean}
|
|
67
|
-
*/
|
|
68
|
-
hasSubtotalBtn = name => {
|
|
69
|
-
if (!name) return false
|
|
70
|
-
const noSubtotalList = ['abnormal', 'abnormalDetails']
|
|
71
|
-
const arr = name.split('.')
|
|
72
|
-
if (_.includes(arr, 'table')) {
|
|
73
|
-
const dataKey = this.props.editStore.config.contents[arr[2]].dataKey
|
|
74
|
-
return !_.includes(noSubtotalList, dataKey)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
handleChangeTableDataKey = (key, name) => {
|
|
79
|
-
const { editStore } = this.props
|
|
80
|
-
|
|
81
|
-
editStore.changeTableDataKey(name, key)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
handleSubtotal = name => {
|
|
85
|
-
const { editStore } = this.props
|
|
86
|
-
editStore.setSubtotalShow(name)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
handleCategoryConfig = (key, name) => {
|
|
90
|
-
const { editStore } = this.props
|
|
91
|
-
editStore.changeTableDataKey(name, key)
|
|
92
|
-
|
|
93
|
-
editStore.setCategoryConfigShow(name)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
handleChangeTableData = isAutoFilling => {
|
|
97
|
-
const { editStore } = this.props
|
|
98
|
-
editStore.handleChangeTableData(isAutoFilling)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
handleOverallOrder = name => {
|
|
102
|
-
const { editStore } = this.props
|
|
103
|
-
editStore.setOverallOrderShow(name)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
handleDiyOverallOrder = name => {
|
|
107
|
-
const { editStore } = this.props
|
|
108
|
-
editStore.setDiyOverallOrderShow(name)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// 通用的自定义合计菜单项处理
|
|
112
|
-
handleDiySummary = (name, configKey) => {
|
|
113
|
-
const { editStore } = this.props
|
|
114
|
-
const methodName = configKey
|
|
115
|
-
.split(/(?=[A-Z])/)
|
|
116
|
-
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
117
|
-
.join('')
|
|
118
|
-
|
|
119
|
-
const method = editStore[`set${methodName}Show`]
|
|
120
|
-
|
|
121
|
-
if (configKey === 'diyCategorySubtotal') {
|
|
122
|
-
const arr = name.split('.')
|
|
123
|
-
const dataKey = editStore.config.contents[arr[2]].dataKey
|
|
124
|
-
console.log('dataKey==> handleDiySummary', dataKey)
|
|
125
|
-
|
|
126
|
-
if (!dataKey.split('_').includes('category')) {
|
|
127
|
-
editStore.changeTableDataKey(name, 'category', {
|
|
128
|
-
type: 'diyCategorySubtotal'
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (configKey === 'diyTagSubtotal') {
|
|
133
|
-
const arr = name.split('.')
|
|
134
|
-
const dataKey = editStore.config.contents[arr[2]].dataKey
|
|
135
|
-
console.log('dataKey==> handleDiySummary', dataKey)
|
|
136
|
-
|
|
137
|
-
if (!dataKey.split('_').includes('tag')) {
|
|
138
|
-
editStore.changeTableDataKey(name, 'tag', {
|
|
139
|
-
type: 'diyTagSubtotal'
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (method) {
|
|
144
|
-
method(name)
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
renderOrderActionBtn = name => {
|
|
149
|
-
if (!this.hasSubtotalBtn(name)) {
|
|
150
|
-
return null
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const {
|
|
154
|
-
editStore: {
|
|
155
|
-
config: {
|
|
156
|
-
page: { type },
|
|
157
|
-
showDiyOverAllOrder
|
|
158
|
-
},
|
|
159
|
-
isAutoFilling
|
|
160
|
-
}
|
|
161
|
-
} = this.props
|
|
162
|
-
const arr = name.split('.')
|
|
163
|
-
const {
|
|
164
|
-
dataKey,
|
|
165
|
-
subtotal,
|
|
166
|
-
overallOrder,
|
|
167
|
-
diySubtotal,
|
|
168
|
-
diyTagSubtotal,
|
|
169
|
-
diyOverallOrder,
|
|
170
|
-
diyCategorySubtotal
|
|
171
|
-
} = this.props.editStore.config.contents[arr[2]]
|
|
172
|
-
const keyArr = dataKey.split('_')
|
|
173
|
-
|
|
174
|
-
const isMultiActive = keyArr.includes('multi')
|
|
175
|
-
const isThreeActive = keyArr.includes('multi3')
|
|
176
|
-
const isCategoryActive = keyArr.includes('category')
|
|
177
|
-
const isTagActive = keyArr.includes('tag')
|
|
178
|
-
const isNewCategoryActive = keyArr.includes('newCategory')
|
|
179
|
-
const isSubtotalActive = subtotal.show
|
|
180
|
-
const isOverallOrder = overallOrder?.show
|
|
181
|
-
const isDiyOverallOrder = diyOverallOrder?.show
|
|
182
|
-
const isDiySubtotal = diySubtotal?.show
|
|
183
|
-
const isDiyTagSubtotal = diyTagSubtotal?.show
|
|
184
|
-
const isDiyCategorySubtotal = diyCategorySubtotal?.show
|
|
185
|
-
|
|
186
|
-
// 长条打印
|
|
187
|
-
const isLongPrint = type === LONG_PRINT
|
|
188
|
-
|
|
189
|
-
return (
|
|
190
|
-
<>
|
|
191
|
-
{this.isMenuItemEnabled('multi') && !isLongPrint && (
|
|
192
|
-
<div
|
|
193
|
-
onClick={this.handleChangeTableDataKey.bind(this, 'multi', name)}
|
|
194
|
-
className={isMultiActive ? 'active' : ''}
|
|
195
|
-
>
|
|
196
|
-
{i18next.t('双栏商品')}
|
|
197
|
-
</div>
|
|
198
|
-
)}
|
|
199
|
-
{this.isMenuItemEnabled('multi3') && type !== 'A4/3' && !isLongPrint && (
|
|
200
|
-
<div
|
|
201
|
-
onClick={this.handleChangeTableDataKey.bind(this, 'multi3', name)}
|
|
202
|
-
className={isThreeActive ? 'active' : ''}
|
|
203
|
-
>
|
|
204
|
-
{i18next.t('三栏商品')}
|
|
205
|
-
</div>
|
|
206
|
-
)}
|
|
207
|
-
{this.isMenuItemEnabled('category') && (
|
|
208
|
-
<div
|
|
209
|
-
onClick={this.handleChangeTableDataKey.bind(
|
|
210
|
-
this,
|
|
211
|
-
'category',
|
|
212
|
-
name,
|
|
213
|
-
isCategoryActive
|
|
214
|
-
)}
|
|
215
|
-
className={isCategoryActive ? 'active' : ''}
|
|
216
|
-
>
|
|
217
|
-
{i18next.t('分类小计')}
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
|
-
{this.isMenuItemEnabled('categoryDiy') && (
|
|
221
|
-
<div
|
|
222
|
-
onClick={this.handleChangeTableDataKey.bind(
|
|
223
|
-
this,
|
|
224
|
-
'categoryDiy',
|
|
225
|
-
name
|
|
226
|
-
)}
|
|
227
|
-
className={isDiyCategorySubtotal ? 'active' : ''}
|
|
228
|
-
>
|
|
229
|
-
{i18next.t('自定义分类小计')}
|
|
230
|
-
</div>
|
|
231
|
-
)}
|
|
232
|
-
{this.isMenuItemEnabled('tag') && (
|
|
233
|
-
<div
|
|
234
|
-
onClick={this.handleChangeTableDataKey.bind(this, 'tag', name)}
|
|
235
|
-
className={isTagActive ? 'active' : ''}
|
|
236
|
-
>
|
|
237
|
-
{i18next.t('标签小计')}
|
|
238
|
-
</div>
|
|
239
|
-
)}
|
|
240
|
-
{this.isMenuItemEnabled('tagDiy') && (
|
|
241
|
-
<div
|
|
242
|
-
onClick={this.handleChangeTableDataKey.bind(this, 'tagDiy', name)}
|
|
243
|
-
className={isDiyTagSubtotal ? 'active' : ''}
|
|
244
|
-
>
|
|
245
|
-
{i18next.t('自定义标签小计')}
|
|
246
|
-
</div>
|
|
247
|
-
)}
|
|
248
|
-
{this.isMenuItemEnabled('newCategory') && (
|
|
249
|
-
<div
|
|
250
|
-
onClick={this.handleCategoryConfig.bind(this, 'newCategory', name)}
|
|
251
|
-
className={isNewCategoryActive ? 'active' : ''}
|
|
252
|
-
>
|
|
253
|
-
{i18next.t('商品分类')}
|
|
254
|
-
</div>
|
|
255
|
-
)}
|
|
256
|
-
{this.isMenuItemEnabled('subtotal') && (
|
|
257
|
-
<div
|
|
258
|
-
onClick={this.handleSubtotal.bind(this, name)}
|
|
259
|
-
className={isSubtotalActive ? 'active' : ''}
|
|
260
|
-
>
|
|
261
|
-
{i18next.t('每页合计')}
|
|
262
|
-
</div>
|
|
263
|
-
)}
|
|
264
|
-
{this.isMenuItemEnabled('diySubtotal') && (
|
|
265
|
-
<div
|
|
266
|
-
onClick={() => this.handleDiySummary(name, 'diySubtotal')}
|
|
267
|
-
className={isDiySubtotal ? 'active' : ''}
|
|
268
|
-
>
|
|
269
|
-
{i18next.t('自定义每页合计')}
|
|
270
|
-
</div>
|
|
271
|
-
)}
|
|
272
|
-
{this.isMenuItemEnabled('autoFill') && (
|
|
273
|
-
<div
|
|
274
|
-
onClick={this.handleChangeTableData.bind(this, !isAutoFilling)}
|
|
275
|
-
className={isAutoFilling ? 'active' : ''}
|
|
276
|
-
>
|
|
277
|
-
{i18next.t('行数填充')}
|
|
278
|
-
</div>
|
|
279
|
-
)}
|
|
280
|
-
{this.isMenuItemEnabled('overallOrder') && (
|
|
281
|
-
<div
|
|
282
|
-
onClick={this.handleOverallOrder.bind(this, name)}
|
|
283
|
-
className={isOverallOrder ? 'active' : ''}
|
|
284
|
-
>
|
|
285
|
-
{i18next.t('整单合计')}
|
|
286
|
-
</div>
|
|
287
|
-
)}
|
|
288
|
-
{this.isMenuItemEnabled('diyOverallOrder') &&
|
|
289
|
-
!isMultiTable(dataKey) &&
|
|
290
|
-
showDiyOverAllOrder && (
|
|
291
|
-
<div
|
|
292
|
-
onClick={this.handleDiyOverallOrder.bind(this, name)}
|
|
293
|
-
className={isDiyOverallOrder ? 'active' : ''}
|
|
294
|
-
>
|
|
295
|
-
{i18next.t('自定义整单合计')}
|
|
296
|
-
</div>
|
|
297
|
-
)}
|
|
298
|
-
</>
|
|
299
|
-
)
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
render() {
|
|
303
|
-
const { editStore, customTableConfigs } = this.props
|
|
304
|
-
return (
|
|
305
|
-
<CommonContextMenu
|
|
306
|
-
renderTableAction={this.renderOrderActionBtn}
|
|
307
|
-
insertBlockList={blockTypeList}
|
|
308
|
-
customTableConfigs={customTableConfigs}
|
|
309
|
-
>
|
|
310
|
-
<Printer
|
|
311
|
-
key={editStore.computedPrinterKey}
|
|
312
|
-
selected={editStore.selected}
|
|
313
|
-
selectedRegion={editStore.selectedRegion}
|
|
314
|
-
isAutoFilling={editStore.isAutoFilling}
|
|
315
|
-
fillIndex={editStore.fillIndex}
|
|
316
|
-
lineheight={editStore.computedTableCustomerRowHeight}
|
|
317
|
-
config={editStore.config}
|
|
318
|
-
data={editStore.mockData}
|
|
319
|
-
getremainpageHeight={editStore.setRemainPageHeight}
|
|
320
|
-
overallorder={editStore.overallOrderShow}
|
|
321
|
-
/>
|
|
322
|
-
</CommonContextMenu>
|
|
323
|
-
)
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
ContextMenu.propTypes = {
|
|
327
|
-
editStore: PropTypes.object,
|
|
328
|
-
mockData: PropTypes.object,
|
|
329
|
-
customTableConfigs: PropTypes.array,
|
|
330
|
-
menuConfig: PropTypes.oneOfType([
|
|
331
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
332
|
-
PropTypes.object
|
|
333
|
-
])
|
|
334
|
-
}
|
|
335
|
-
export default ContextMenu
|
package/src/editor/editor2.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import _ from 'lodash'
|
|
4
|
-
import { Flex, ToolTip } from '../components'
|
|
5
|
-
import { Gap, Title } from '../common/component'
|
|
6
|
-
import editStore from './store'
|
|
7
|
-
import { observer, inject } from 'mobx-react'
|
|
8
|
-
import EditorTitle from '../common/editor_title'
|
|
9
|
-
import EditorSelect from '../common/editor_select'
|
|
10
|
-
import SpecialField from '../common/editor_special_field'
|
|
11
|
-
import SpecialOtherField from '../common/editor_special_other_field'
|
|
12
|
-
import EditorField from '../common/editor_edit_field'
|
|
13
|
-
import EditorAddField from '../common/editor_add_field'
|
|
14
|
-
import EditorPageSummary from '../common/editor_page_summary'
|
|
15
|
-
import EditorCutomizedConfig from '../common/editor_customize_config'
|
|
16
|
-
import ContextMenu from './context_menu2'
|
|
17
|
-
import i18next from '../../locales'
|
|
18
|
-
import withStore from '../common/hoc_with_store'
|
|
19
|
-
|
|
20
|
-
// ‼️‼️🚸🚸 注意: value的命名不要用下划线! 原因是 computedTableDataKeyOfSelectedRegion 会split('_')下划线做一些事情‼️
|
|
21
|
-
// 📚hasSubtotalBtn 这种表格是否支持 双栏,分类,合计 功能
|
|
22
|
-
const tableDataKeyList = [
|
|
23
|
-
{ value: 'orders', text: i18next.t('全部商品'), hasSubtotalBtn: true },
|
|
24
|
-
{ value: 'abnormal', text: i18next.t('异常商品'), hasSubtotalBtn: false },
|
|
25
|
-
{
|
|
26
|
-
value: 'abnormalDetails',
|
|
27
|
-
text: i18next.t('异常商品(明细)'),
|
|
28
|
-
hasSubtotalBtn: false
|
|
29
|
-
},
|
|
30
|
-
{ value: 'reward', text: i18next.t('积分表格'), hasSubtotalBtn: false },
|
|
31
|
-
{ value: 'combination', text: i18next.t('组合商品'), hasSubtotalBtn: false },
|
|
32
|
-
{ value: 'turnover', text: i18next.t('周转物表格'), hasSubtotalBtn: false }
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
export const noSubtotalBtnTableDataKeySet = new Set(
|
|
36
|
-
tableDataKeyList.filter(v => !v.hasSubtotalBtn).map(o => o.value)
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
@withStore(editStore)
|
|
40
|
-
@inject('editStore')
|
|
41
|
-
@observer
|
|
42
|
-
class Editor extends React.Component {
|
|
43
|
-
render() {
|
|
44
|
-
const {
|
|
45
|
-
onSave,
|
|
46
|
-
showEditor,
|
|
47
|
-
addFields,
|
|
48
|
-
showNewDate,
|
|
49
|
-
mockData,
|
|
50
|
-
mergeClassificationAndLabel,
|
|
51
|
-
customTableConfigs,
|
|
52
|
-
menuConfig
|
|
53
|
-
} = this.props
|
|
54
|
-
console.log('menuConfig', menuConfig)
|
|
55
|
-
return (
|
|
56
|
-
<div className='gm-printer-edit'>
|
|
57
|
-
<Flex className='gm-printer-edit-title-fixed'>
|
|
58
|
-
<Title
|
|
59
|
-
title={i18next.t('模板预览')}
|
|
60
|
-
text={
|
|
61
|
-
<span className='gm-text-desc gm-padding-left-5'>
|
|
62
|
-
{i18next.t(
|
|
63
|
-
'说明:选中内容进行编辑,可拖动字段移动位置,右键使用更多功能'
|
|
64
|
-
)}
|
|
65
|
-
{/* <a
|
|
66
|
-
href='https://v.qq.com/x/page/t08044292dd.html'
|
|
67
|
-
target='_blank'
|
|
68
|
-
className='btn-link'
|
|
69
|
-
rel='noopener noreferrer'
|
|
70
|
-
>
|
|
71
|
-
{i18next.t('查看视频教程')}
|
|
72
|
-
</a> */}
|
|
73
|
-
</span>
|
|
74
|
-
}
|
|
75
|
-
/>
|
|
76
|
-
</Flex>
|
|
77
|
-
|
|
78
|
-
{showEditor && (
|
|
79
|
-
<div className='gm-printer-edit-zone'>
|
|
80
|
-
<EditorTitle onSave={onSave} />
|
|
81
|
-
<Gap height='10px' />
|
|
82
|
-
<>
|
|
83
|
-
<>{i18next.t('模版类型')}</>
|
|
84
|
-
<ToolTip text='表示该模板是针对单一商户的配送单模板(商户配送单),或是账户合并打印配送单(账户配送单)的模板。' />
|
|
85
|
-
<span>{':' + i18next.t('商户配送单')}</span>
|
|
86
|
-
</>
|
|
87
|
-
<Gap height='10px' />
|
|
88
|
-
<EditorSelect />
|
|
89
|
-
<Gap height='5px' />
|
|
90
|
-
<SpecialField addFields={addFields} mockData={mockData} />
|
|
91
|
-
<SpecialOtherField addFields={addFields} mockData={mockData} />
|
|
92
|
-
<EditorCutomizedConfig />
|
|
93
|
-
<Gap height='5px' />
|
|
94
|
-
<EditorField
|
|
95
|
-
tableDataKeyList={tableDataKeyList}
|
|
96
|
-
showNewDate={showNewDate}
|
|
97
|
-
mergeClassificationAndLabel={mergeClassificationAndLabel}
|
|
98
|
-
/>
|
|
99
|
-
<Gap height='5px' />
|
|
100
|
-
<EditorAddField addFields={addFields} />
|
|
101
|
-
<Gap height='5px' />
|
|
102
|
-
<EditorPageSummary summaryFields={addFields.summaryFields} />
|
|
103
|
-
|
|
104
|
-
<div id='gm-printer-tip' />
|
|
105
|
-
|
|
106
|
-
<div id='gm-printer-modal' />
|
|
107
|
-
</div>
|
|
108
|
-
)}
|
|
109
|
-
|
|
110
|
-
<div className='gm-printer-edit-wrap'>
|
|
111
|
-
<ContextMenu
|
|
112
|
-
customTableConfigs={customTableConfigs}
|
|
113
|
-
menuConfig={menuConfig}
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Editor.propTypes = {
|
|
122
|
-
config: PropTypes.object.isRequired,
|
|
123
|
-
onSave: PropTypes.func,
|
|
124
|
-
showEditor: PropTypes.bool,
|
|
125
|
-
mockData: PropTypes.object.isRequired,
|
|
126
|
-
addFields: PropTypes.object.isRequired,
|
|
127
|
-
showNewDate: PropTypes.bool,
|
|
128
|
-
mergeClassificationAndLabel: PropTypes.bool,
|
|
129
|
-
customTableConfigs: PropTypes.array,
|
|
130
|
-
menuConfig: PropTypes.oneOfType([
|
|
131
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
132
|
-
PropTypes.object
|
|
133
|
-
])
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
Editor.defaultProps = {
|
|
137
|
-
onSave: _.noop,
|
|
138
|
-
showNewDate: false
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export default Editor
|