gm-printer 10.11.5-beta2 → 10.11.5
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/README.md +102 -7
- package/build/demo.js +54 -0
- package/locales/en.json +1 -0
- package/locales/th.json +1 -0
- package/locales/zh-HK.json +1 -0
- package/package.json +10 -8
- package/src/common/editor_edit_field.js +82 -16
- package/src/common/editor_store.js +58 -0
- package/src/components/index.js +3 -1
- package/src/components/index.less +1 -0
- package/src/components/tip/index.js +19 -35
- package/src/components/tooltip/index.js +26 -0
- package/src/components/tooltip/style.less +16 -0
- package/src/editor/context_menu.js +16 -16
- package/src/editor/editor.js +16 -9
- package/src/editor/store.js +97 -12
- package/src/{editor_cannibalize → editor_account}/context_menu.js +42 -16
- package/src/{editor_cannibalize → editor_account}/editor.js +24 -9
- package/src/editor_account/index.js +4 -0
- package/src/editor_account/store.js +263 -0
- package/src/editor_purchase/context_menu.js +0 -1
- package/src/editor_purchase/editor_special_table.js +5 -2
- package/src/editor_purchase/store.js +27 -5
- package/src/index.js +2 -2
- package/src/printer/block.js +18 -10
- package/src/printer/printer.js +2 -2
- package/src/printer/qrcode.js +5 -2
- package/src/printer/store.js +116 -30
- package/src/printer/style.lesss +13 -3
- package/src/printer/table.js +57 -16
- package/src/printer/table_special_tr.js +1 -0
- package/src/printer/table_subtotal_tr.js +47 -7
- package/src/svg/question-circle-o.svg +1 -0
- package/src/util.js +53 -2
- package/webpack.config.js +19 -1
- package/global.d.ts +0 -67
- package/src/editor_cannibalize/index.js +0 -4
- package/src/editor_cannibalize/store.js +0 -29
- package/yarn-error.log +0 -9770
package/locales/en.json
CHANGED
package/locales/th.json
CHANGED
package/locales/zh-HK.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-printer",
|
|
3
|
-
"version": "10.11.5
|
|
3
|
+
"version": "10.11.5",
|
|
4
4
|
"description": "diy printer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/gmfe/gm-printer.git"
|
|
21
21
|
},
|
|
22
|
-
"types": "global.d.ts",
|
|
23
22
|
"author": "",
|
|
24
23
|
"license": "ISC",
|
|
25
24
|
"bugs": {
|
|
@@ -29,9 +28,10 @@
|
|
|
29
28
|
"parser": "babel-eslint"
|
|
30
29
|
},
|
|
31
30
|
"homepage": "https://github.com/gmfe/gm-printer#readme",
|
|
32
|
-
"
|
|
31
|
+
"peerDependencies": {
|
|
33
32
|
"big.js": "^5.1.2",
|
|
34
33
|
"classnames": "^2.2.6",
|
|
34
|
+
"gm-svg": "^0.3.0",
|
|
35
35
|
"gm-util": "^5.12.2",
|
|
36
36
|
"jsbarcode": "^3.11.0",
|
|
37
37
|
"lodash": "^4.17.10",
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
"react-dom": "^16.13.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/
|
|
50
|
-
"@babel/
|
|
51
|
-
"@babel/
|
|
52
|
-
"@babel/
|
|
53
|
-
"@babel/runtime": "^7.11.2",
|
|
49
|
+
"@babel/cli": "^7.6.0",
|
|
50
|
+
"@babel/core": "^7.5.5",
|
|
51
|
+
"@babel/preset-env": "^7.5.4",
|
|
52
|
+
"@babel/runtime": "^7.5.5",
|
|
54
53
|
"@svgr/webpack": "^4.3.2",
|
|
55
54
|
"@types/react": "^16.9.16",
|
|
56
55
|
"add-asset-html-webpack-plugin": "^3.1.3",
|
|
@@ -109,5 +108,8 @@
|
|
|
109
108
|
"webpack": "^4.17.2",
|
|
110
109
|
"webpack-cli": "^3.1.0",
|
|
111
110
|
"webpack-dev-server": "^3.1.7"
|
|
111
|
+
},
|
|
112
|
+
"dependencies": {
|
|
113
|
+
"qrcode.react": "^0.9.2"
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -113,6 +113,12 @@ class EditorField extends React.Component {
|
|
|
113
113
|
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
114
114
|
/>
|
|
115
115
|
)}
|
|
116
|
+
{type === 'qrcode' && (
|
|
117
|
+
<Size
|
|
118
|
+
style={style}
|
|
119
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
116
122
|
{type === 'image' && (
|
|
117
123
|
<div>
|
|
118
124
|
<Size
|
|
@@ -189,6 +195,21 @@ class EditorField extends React.Component {
|
|
|
189
195
|
(editStore.computedTableSpecialConfig.subtotal &&
|
|
190
196
|
get(subtotal, 'needUpperCase')) ||
|
|
191
197
|
false
|
|
198
|
+
// 大写的金额是否在前
|
|
199
|
+
const subtotalUpperCaseBefore =
|
|
200
|
+
(editStore.computedTableSpecialConfig.subtotal &&
|
|
201
|
+
get(subtotal, 'isUpperCaseBefore')) ||
|
|
202
|
+
false
|
|
203
|
+
// 大写和小写的金额是否分开
|
|
204
|
+
const subtotalUpperLowerCaseSeparate =
|
|
205
|
+
(editStore.computedTableSpecialConfig.subtotal &&
|
|
206
|
+
get(subtotal, 'isUpperLowerCaseSeparate')) ||
|
|
207
|
+
false
|
|
208
|
+
// 位置交换
|
|
209
|
+
const subtotalCommutationPlace =
|
|
210
|
+
(editStore.computedTableSpecialConfig.subtotal &&
|
|
211
|
+
get(subtotal, 'isCommutationPlace')) ||
|
|
212
|
+
false
|
|
192
213
|
|
|
193
214
|
return (
|
|
194
215
|
<div>
|
|
@@ -336,16 +357,12 @@ class EditorField extends React.Component {
|
|
|
336
357
|
/>
|
|
337
358
|
</Flex>
|
|
338
359
|
|
|
339
|
-
<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
/>
|
|
346
|
-
</Flex>
|
|
347
|
-
<Flex> {i18next.t('显示大写金额')}</Flex>
|
|
348
|
-
</Flex>
|
|
360
|
+
<EditorSubtotalCheck
|
|
361
|
+
subtotalCheckDisabled
|
|
362
|
+
subtotalChecked={specialTrNeedUpperCase}
|
|
363
|
+
subtotalCheckOnChange={editStore.setSpecialUpperCase}
|
|
364
|
+
subtotalCheckText='显示大写金额'
|
|
365
|
+
/>
|
|
349
366
|
|
|
350
367
|
<Flex>
|
|
351
368
|
<Flex>{i18next.t('合计设置')}:</Flex>
|
|
@@ -359,17 +376,34 @@ class EditorField extends React.Component {
|
|
|
359
376
|
onChange={this.handleSubtotalStyleChange}
|
|
360
377
|
/>
|
|
361
378
|
</Flex>
|
|
362
|
-
|
|
363
|
-
<Flex style={{ margin: '5px 0 5px 62px' }}>
|
|
379
|
+
{/* <Flex style={{ margin: '5px 0 5px 62px' }}>
|
|
364
380
|
<Flex alignCenter>
|
|
365
381
|
<input
|
|
366
382
|
type='checkbox'
|
|
367
|
-
checked={
|
|
368
|
-
onChange={editStore.
|
|
383
|
+
checked={subtotalCommutationPlace}
|
|
384
|
+
onChange={editStore.setSubtotalCommutationPlace}
|
|
369
385
|
/>
|
|
370
386
|
</Flex>
|
|
371
|
-
<Flex> {i18next.t('
|
|
372
|
-
</Flex>
|
|
387
|
+
<Flex> {i18next.t('合计、每页合计交换位置')}</Flex>
|
|
388
|
+
</Flex> */}
|
|
389
|
+
<EditorSubtotalCheck
|
|
390
|
+
subtotalCheckDisabled
|
|
391
|
+
subtotalChecked={subtotalNeedUpperCase}
|
|
392
|
+
subtotalCheckOnChange={editStore.setSubtotalUpperCase}
|
|
393
|
+
subtotalCheckText='显示大写金额'
|
|
394
|
+
/>
|
|
395
|
+
<EditorSubtotalCheck
|
|
396
|
+
subtotalCheckDisabled={subtotalNeedUpperCase}
|
|
397
|
+
subtotalChecked={subtotalUpperCaseBefore}
|
|
398
|
+
subtotalCheckOnChange={editStore.setSubtotalUpperCaseBefore}
|
|
399
|
+
subtotalCheckText='大写金额在前'
|
|
400
|
+
/>
|
|
401
|
+
<EditorSubtotalCheck
|
|
402
|
+
subtotalCheckDisabled={subtotalNeedUpperCase}
|
|
403
|
+
subtotalChecked={subtotalUpperLowerCaseSeparate}
|
|
404
|
+
subtotalCheckOnChange={editStore.setSubtotalUpperLowerCaseSeparate}
|
|
405
|
+
subtotalCheckText='大、小写金额分左右两边展示'
|
|
406
|
+
/>
|
|
373
407
|
</div>
|
|
374
408
|
)
|
|
375
409
|
}
|
|
@@ -396,4 +430,36 @@ EditorField.defaultProps = {
|
|
|
396
430
|
showNewDate: false
|
|
397
431
|
}
|
|
398
432
|
|
|
433
|
+
class EditorSubtotalCheck extends React.Component {
|
|
434
|
+
render() {
|
|
435
|
+
const {
|
|
436
|
+
subtotalCheckDisabled,
|
|
437
|
+
subtotalChecked,
|
|
438
|
+
subtotalCheckOnChange,
|
|
439
|
+
subtotalCheckText
|
|
440
|
+
} = this.props
|
|
441
|
+
|
|
442
|
+
return (
|
|
443
|
+
<Flex style={{ margin: '5px 0 5px 62px' }}>
|
|
444
|
+
<Flex alignCenter>
|
|
445
|
+
<input
|
|
446
|
+
type='checkbox'
|
|
447
|
+
disabled={!subtotalCheckDisabled}
|
|
448
|
+
checked={subtotalChecked}
|
|
449
|
+
onChange={subtotalCheckOnChange}
|
|
450
|
+
/>
|
|
451
|
+
</Flex>
|
|
452
|
+
<Flex> {i18next.t(`${subtotalCheckText}`)}</Flex>
|
|
453
|
+
</Flex>
|
|
454
|
+
)
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
EditorSubtotalCheck.propTypes = {
|
|
459
|
+
subtotalCheckDisabled: PropTypes.bool,
|
|
460
|
+
subtotalChecked: PropTypes.bool,
|
|
461
|
+
subtotalCheckOnChange: PropTypes.func,
|
|
462
|
+
subtotalCheckText: PropTypes.string
|
|
463
|
+
}
|
|
464
|
+
|
|
399
465
|
export default EditorField
|
|
@@ -370,6 +370,18 @@ class EditorStore {
|
|
|
370
370
|
text: `{{qrcode}}`
|
|
371
371
|
})
|
|
372
372
|
break
|
|
373
|
+
case 'uniform_social_credit_code':
|
|
374
|
+
blocks.push({
|
|
375
|
+
type: 'qrcode',
|
|
376
|
+
style: {
|
|
377
|
+
left: '0px',
|
|
378
|
+
top: '5px',
|
|
379
|
+
width: '75px',
|
|
380
|
+
height: '75px'
|
|
381
|
+
},
|
|
382
|
+
text: `{{uniform_social_credit_code}}`
|
|
383
|
+
})
|
|
384
|
+
break
|
|
373
385
|
default:
|
|
374
386
|
window.alert(i18next.t('出错啦,未识别类型,此信息不应该出现'))
|
|
375
387
|
}
|
|
@@ -792,6 +804,7 @@ class EditorStore {
|
|
|
792
804
|
}
|
|
793
805
|
}
|
|
794
806
|
|
|
807
|
+
// 设置大写金额
|
|
795
808
|
@action.bound
|
|
796
809
|
setSubtotalUpperCase() {
|
|
797
810
|
if (this.selectedRegion) {
|
|
@@ -800,6 +813,51 @@ class EditorStore {
|
|
|
800
813
|
|
|
801
814
|
const oldNeedUpperCase = subtotalConfig.needUpperCase
|
|
802
815
|
set(subtotalConfig, { needUpperCase: !oldNeedUpperCase })
|
|
816
|
+
// 没有大写金额时,将大写在前和大小写分开的多选框设置为false
|
|
817
|
+
if (subtotalConfig.needUpperCase === false) {
|
|
818
|
+
subtotalConfig.isUpperCaseBefore &&
|
|
819
|
+
set(subtotalConfig, { isUpperCaseBefore: false })
|
|
820
|
+
subtotalConfig.isUpperLowerCaseSeparate &&
|
|
821
|
+
set(subtotalConfig, { isUpperLowerCaseSeparate: false })
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// 设置大写金额在前
|
|
827
|
+
@action.bound
|
|
828
|
+
setSubtotalUpperCaseBefore() {
|
|
829
|
+
if (this.selectedRegion) {
|
|
830
|
+
const arr = this.selectedRegion.split('.')
|
|
831
|
+
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
832
|
+
|
|
833
|
+
const oldUpperCaseBefore = subtotalConfig.isUpperCaseBefore
|
|
834
|
+
set(subtotalConfig, { isUpperCaseBefore: !oldUpperCaseBefore })
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// 设置大小写金额分开
|
|
839
|
+
@action.bound
|
|
840
|
+
setSubtotalUpperLowerCaseSeparate() {
|
|
841
|
+
if (this.selectedRegion) {
|
|
842
|
+
const arr = this.selectedRegion.split('.')
|
|
843
|
+
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
844
|
+
|
|
845
|
+
const oldUpperLowerCaseSeparate = subtotalConfig.isUpperLowerCaseSeparate
|
|
846
|
+
set(subtotalConfig, {
|
|
847
|
+
isUpperLowerCaseSeparate: !oldUpperLowerCaseSeparate
|
|
848
|
+
})
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// 设置交换位置
|
|
853
|
+
@action.bound
|
|
854
|
+
setSubtotalCommutationPlace() {
|
|
855
|
+
if (this.selectedRegion) {
|
|
856
|
+
const arr = this.selectedRegion.split('.')
|
|
857
|
+
const subtotalConfig = this.config.contents[arr[2]].subtotal
|
|
858
|
+
|
|
859
|
+
const oldCommutationPlace = subtotalConfig.isCommutationPlace
|
|
860
|
+
set(subtotalConfig, { isCommutationPlace: !oldCommutationPlace })
|
|
803
861
|
}
|
|
804
862
|
}
|
|
805
863
|
|
package/src/components/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import Tip from './tip'
|
|
|
4
4
|
import { DropDown, DropDownItem, DropDownItems } from './dropdown'
|
|
5
5
|
import Dialog from './dialog'
|
|
6
6
|
import Switch from './switch'
|
|
7
|
+
import ToolTip from './tooltip'
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
Flex,
|
|
@@ -14,5 +15,6 @@ export {
|
|
|
14
15
|
DropDownItem,
|
|
15
16
|
DropDownItems,
|
|
16
17
|
Dialog,
|
|
17
|
-
Switch
|
|
18
|
+
Switch,
|
|
19
|
+
ToolTip
|
|
18
20
|
}
|
|
@@ -1,48 +1,32 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import ReactDOM from 'react-dom'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
|
+
import { SvgInfoCircle } from 'gm-svg'
|
|
4
5
|
import Flex from '../flex'
|
|
5
6
|
import _ from 'lodash'
|
|
6
7
|
|
|
7
8
|
const tips = []
|
|
8
9
|
|
|
9
|
-
const Tip = props => {
|
|
10
|
+
const Tip = (props) => {
|
|
10
11
|
const { list } = props
|
|
11
12
|
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</div>
|
|
27
|
-
)
|
|
28
|
-
})}
|
|
29
|
-
</React.Fragment>
|
|
30
|
-
)
|
|
13
|
+
return <React.Fragment>
|
|
14
|
+
{_.map(list, (item, index) => {
|
|
15
|
+
return (
|
|
16
|
+
<div key={index} className='gm-animated gm-animated-fade-in-right-100'>
|
|
17
|
+
<Flex alignCenter className='gm-tip'>
|
|
18
|
+
<SvgInfoCircle className='gm-svg-info'/>
|
|
19
|
+
<div style={{ paddingLeft: '10px' }}>
|
|
20
|
+
<div>{item}</div>
|
|
21
|
+
</div>
|
|
22
|
+
</Flex>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
})}
|
|
26
|
+
</React.Fragment>
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
<svg
|
|
35
|
-
{...props}
|
|
36
|
-
width='1em'
|
|
37
|
-
height='1em'
|
|
38
|
-
viewBox='0 0 1024 1024'
|
|
39
|
-
fill='currentColor'
|
|
40
|
-
className={'gm-svg-icon ' + (props.className || '')}
|
|
41
|
-
>
|
|
42
|
-
<path d='M512 4.445c-276.763 0-501.095 224.331-501.095 501.094S235.237 1006.634 512 1006.634c276.763 0 501.095-224.331 501.095-501.095S788.763 4.445 512 4.445zM494.065 218.68c29.892 0 54.294 24.306 54.294 54.295s-24.305 54.197-54.295 54.197-54.295-24.305-54.295-54.295c.098-29.891 24.403-54.197 54.295-54.197zm89.479 573.716H440.458c-20.091 0-36.359-16.268-36.359-36.359s16.27-36.359 36.36-36.359h35.183V471.435H440.36c-19.993 0-36.359-16.269-36.359-36.359s16.268-36.359 36.36-36.359h72.13c19.798 0 35.772 16.073 35.772 35.771V719.68h35.282c20.091 0 36.359 16.27 36.359 36.36s-16.269 36.358-36.359 36.358z' />
|
|
43
|
-
</svg>
|
|
44
|
-
)
|
|
45
|
-
function getTipDOM(id) {
|
|
29
|
+
function getTipDOM (id) {
|
|
46
30
|
return window.shadowRoot.getElementById(id)
|
|
47
31
|
}
|
|
48
32
|
|
|
@@ -51,10 +35,10 @@ Tip.warning = (message = '') => {
|
|
|
51
35
|
|
|
52
36
|
setTimeout(() => {
|
|
53
37
|
tips.shift()
|
|
54
|
-
ReactDOM.render(<Tip list={tips}
|
|
38
|
+
ReactDOM.render(<Tip list={tips}/>, getTipDOM('gm-printer-tip'))
|
|
55
39
|
}, 3000)
|
|
56
40
|
|
|
57
|
-
ReactDOM.render(<Tip list={tips}
|
|
41
|
+
ReactDOM.render(<Tip list={tips}/>, getTipDOM('gm-printer-tip'))
|
|
58
42
|
}
|
|
59
43
|
|
|
60
44
|
Tip.propTypes = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import SVGQuestionCircle from '../../svg/question-circle-o.svg'
|
|
4
|
+
|
|
5
|
+
const ToolTip = ({ text }) => {
|
|
6
|
+
const [active, setActive] = useState(false)
|
|
7
|
+
return (
|
|
8
|
+
<span
|
|
9
|
+
onMouseEnter={() => {
|
|
10
|
+
setActive(true)
|
|
11
|
+
}}
|
|
12
|
+
onMouseLeave={() => {
|
|
13
|
+
setActive(false)
|
|
14
|
+
}}
|
|
15
|
+
className='b-editor-tooltip'
|
|
16
|
+
>
|
|
17
|
+
{active && <span className='b-editor-tooltip-text'>{text}</span>}
|
|
18
|
+
<SVGQuestionCircle />
|
|
19
|
+
</span>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
ToolTip.PropTypes = {
|
|
23
|
+
text: PropTypes.string.isRequired
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default ToolTip
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.b-editor-tooltip {
|
|
2
|
+
position: relative;
|
|
3
|
+
padding: 0px 3px;
|
|
4
|
+
.b-editor-tooltip-text {
|
|
5
|
+
width: 320px;
|
|
6
|
+
position: absolute;
|
|
7
|
+
top: 20px;
|
|
8
|
+
left: -65px;
|
|
9
|
+
color: #000;
|
|
10
|
+
border-radius: 2px;
|
|
11
|
+
background-color: white;
|
|
12
|
+
border: 1px solid #eee;
|
|
13
|
+
padding: 5px 5px;
|
|
14
|
+
z-index: 100;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -12,12 +12,16 @@ const blockTypeList = [
|
|
|
12
12
|
{ value: 'image', text: i18next.t('插入图片') },
|
|
13
13
|
{ value: 'counter', text: i18next.t('插入分类汇总') },
|
|
14
14
|
{ value: 'barcode', text: i18next.t('插入订单条形码') },
|
|
15
|
-
{ value: 'qrcode', text: i18next.t('
|
|
15
|
+
{ value: 'qrcode', text: i18next.t('插入订单溯源二维码') },
|
|
16
|
+
{
|
|
17
|
+
value: 'uniform_social_credit_code',
|
|
18
|
+
text: i18next.t('插入苏州安全监管平台二维码')
|
|
19
|
+
}
|
|
16
20
|
]
|
|
17
21
|
|
|
18
|
-
@inject(
|
|
22
|
+
@inject(stores => ({
|
|
19
23
|
editStore: stores.editStore,
|
|
20
|
-
mockData: stores.mockData
|
|
24
|
+
mockData: stores.mockData
|
|
21
25
|
}))
|
|
22
26
|
@observer
|
|
23
27
|
class ContextMenu extends React.Component {
|
|
@@ -26,7 +30,7 @@ class ContextMenu extends React.Component {
|
|
|
26
30
|
* @param name => ContextMenu 的 this.state.name
|
|
27
31
|
* @return {boolean}
|
|
28
32
|
*/
|
|
29
|
-
hasSubtotalBtn =
|
|
33
|
+
hasSubtotalBtn = name => {
|
|
30
34
|
if (!name) return false
|
|
31
35
|
const noSubtotalList = ['abnormal', 'abnormalDetails']
|
|
32
36
|
const arr = name.split('.')
|
|
@@ -42,13 +46,13 @@ class ContextMenu extends React.Component {
|
|
|
42
46
|
editStore.changeTableDataKey(name, key)
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
handleSubtotal =
|
|
49
|
+
handleSubtotal = name => {
|
|
46
50
|
const { editStore } = this.props
|
|
47
51
|
|
|
48
52
|
editStore.setSubtotalShow(name)
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
renderOrderActionBtn =
|
|
55
|
+
renderOrderActionBtn = name => {
|
|
52
56
|
if (!this.hasSubtotalBtn(name)) {
|
|
53
57
|
return null
|
|
54
58
|
}
|
|
@@ -60,7 +64,6 @@ class ContextMenu extends React.Component {
|
|
|
60
64
|
const isMultiActive = keyArr.includes('multi')
|
|
61
65
|
const isCategoryActive = keyArr.includes('category')
|
|
62
66
|
const isSubtotalActive = subtotal.show
|
|
63
|
-
const isCombine = keyArr.includes('combination')
|
|
64
67
|
|
|
65
68
|
return (
|
|
66
69
|
<>
|
|
@@ -70,15 +73,12 @@ class ContextMenu extends React.Component {
|
|
|
70
73
|
>
|
|
71
74
|
{i18next.t('双栏商品')}
|
|
72
75
|
</div>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{i18next.t('商品分类')}
|
|
80
|
-
</div>
|
|
81
|
-
)}
|
|
76
|
+
<div
|
|
77
|
+
onClick={this.handleChangeTableDataKey.bind(this, 'category', name)}
|
|
78
|
+
className={isCategoryActive ? 'active' : ''}
|
|
79
|
+
>
|
|
80
|
+
{i18next.t('商品分类')}
|
|
81
|
+
</div>
|
|
82
82
|
<div
|
|
83
83
|
onClick={this.handleSubtotal.bind(this, name)}
|
|
84
84
|
className={isSubtotalActive ? 'active' : ''}
|
package/src/editor/editor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import _ from 'lodash'
|
|
4
|
-
import { Flex } from '../components'
|
|
4
|
+
import { Flex, ToolTip } from '../components'
|
|
5
5
|
import { Gap, Title } from '../common/component'
|
|
6
6
|
import editStore from './store'
|
|
7
7
|
import { observer, inject } from 'mobx-react'
|
|
@@ -18,14 +18,15 @@ import withStore from '../common/hoc_with_store'
|
|
|
18
18
|
// 📚hasSubtotalBtn 这种表格是否支持 双栏,分类,合计 功能
|
|
19
19
|
const tableDataKeyList = [
|
|
20
20
|
{ value: 'orders', text: i18next.t('全部商品'), hasSubtotalBtn: true },
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{ value: 'combination', text: i18next.t('组合商品'), hasSubtotalBtn: false }
|
|
21
|
+
{ value: 'abnormal', text: i18next.t('异常商品'), hasSubtotalBtn: false },
|
|
22
|
+
{
|
|
23
|
+
value: 'abnormalDetails',
|
|
24
|
+
text: i18next.t('异常商品(明细)'),
|
|
25
|
+
hasSubtotalBtn: false
|
|
26
|
+
},
|
|
27
|
+
{ value: 'reward', text: i18next.t('积分表格'), hasSubtotalBtn: false },
|
|
28
|
+
{ value: 'combination', text: i18next.t('组合商品'), hasSubtotalBtn: false },
|
|
29
|
+
{ value: 'turnover', text: i18next.t('周转物表格'), hasSubtotalBtn: false }
|
|
29
30
|
]
|
|
30
31
|
|
|
31
32
|
export const noSubtotalBtnTableDataKeySet = new Set(
|
|
@@ -66,6 +67,12 @@ class Editor extends React.Component {
|
|
|
66
67
|
<div className='gm-printer-edit-zone'>
|
|
67
68
|
<EditorTitle onSave={onSave} />
|
|
68
69
|
<Gap height='10px' />
|
|
70
|
+
<>
|
|
71
|
+
<>{i18next.t('模版类型')}</>
|
|
72
|
+
<ToolTip text='表示该模板是针对单一商户的配送单模板(商户配送单),或是账户合并打印配送单(账户配送单)的模板。' />
|
|
73
|
+
<span>{':' + i18next.t('商户配送单')}</span>
|
|
74
|
+
</>
|
|
75
|
+
<Gap height='10px' />
|
|
69
76
|
<EditorSelect />
|
|
70
77
|
<Gap height='5px' />
|
|
71
78
|
<EditorField
|