gm-printer-label 3.3.5-beta.1 → 3.3.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/package.json +1 -1
- package/src/printer/block.js +18 -49
package/package.json
CHANGED
package/src/printer/block.js
CHANGED
|
@@ -12,12 +12,12 @@ import _ from 'lodash'
|
|
|
12
12
|
class Block extends React.Component {
|
|
13
13
|
dragBlock = React.createRef(null)
|
|
14
14
|
handleChangeDebounce = null
|
|
15
|
-
constructor(props) {
|
|
15
|
+
constructor (props) {
|
|
16
16
|
super(props)
|
|
17
17
|
this.state = {
|
|
18
18
|
clientX: null,
|
|
19
19
|
clientY: null,
|
|
20
|
-
isEdit: false
|
|
20
|
+
isEdit: false
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -26,14 +26,14 @@ class Block extends React.Component {
|
|
|
26
26
|
|
|
27
27
|
this.setState({
|
|
28
28
|
clientX,
|
|
29
|
-
clientY
|
|
29
|
+
clientY
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
window.document.dispatchEvent(
|
|
33
33
|
new window.CustomEvent('gm-printer-label-select', {
|
|
34
34
|
detail: {
|
|
35
|
-
selected: index
|
|
36
|
-
}
|
|
35
|
+
selected: index
|
|
36
|
+
}
|
|
37
37
|
})
|
|
38
38
|
)
|
|
39
39
|
}
|
|
@@ -46,7 +46,7 @@ class Block extends React.Component {
|
|
|
46
46
|
const style = getStyleWithDiff(config.style, diffX, diffY)
|
|
47
47
|
|
|
48
48
|
dispatchMsg('gm-printer-label-block-style-set', {
|
|
49
|
-
style
|
|
49
|
+
style
|
|
50
50
|
})
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -54,18 +54,18 @@ class Block extends React.Component {
|
|
|
54
54
|
const { index } = this.props
|
|
55
55
|
|
|
56
56
|
dispatchMsg('gm-printer-label-select', {
|
|
57
|
-
selected: index
|
|
57
|
+
selected: index
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
handleDoubleClick = () => {
|
|
62
62
|
const {
|
|
63
|
-
config: { type }
|
|
63
|
+
config: { type }
|
|
64
64
|
} = this.props
|
|
65
65
|
if (!type || type === 'text') {
|
|
66
66
|
this.setState(
|
|
67
67
|
{
|
|
68
|
-
isEdit: true
|
|
68
|
+
isEdit: true
|
|
69
69
|
},
|
|
70
70
|
() => {
|
|
71
71
|
this.refEdit.focus()
|
|
@@ -76,13 +76,13 @@ class Block extends React.Component {
|
|
|
76
76
|
|
|
77
77
|
handleEditBlur = () => {
|
|
78
78
|
this.setState({
|
|
79
|
-
isEdit: false
|
|
79
|
+
isEdit: false
|
|
80
80
|
})
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
handleText = (e) => {
|
|
84
84
|
dispatchMsg('gm-printer-label-block-text-set', {
|
|
85
|
-
text: e.target.value
|
|
85
|
+
text: e.target.value
|
|
86
86
|
})
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -112,7 +112,7 @@ class Block extends React.Component {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
render() {
|
|
115
|
+
render () {
|
|
116
116
|
const {
|
|
117
117
|
index,
|
|
118
118
|
selected,
|
|
@@ -136,7 +136,7 @@ class Block extends React.Component {
|
|
|
136
136
|
rack_barcode,
|
|
137
137
|
customer_barcode,
|
|
138
138
|
delivery_qrcode,
|
|
139
|
-
package_order_qrcode
|
|
139
|
+
package_order_qrcode
|
|
140
140
|
},
|
|
141
141
|
data,
|
|
142
142
|
config,
|
|
@@ -163,7 +163,7 @@ class Block extends React.Component {
|
|
|
163
163
|
const value = text.split(':')?.[1]
|
|
164
164
|
const isHtml = value && value.indexOf('_html') !== -1
|
|
165
165
|
content = isHtml ? (
|
|
166
|
-
<div dangerouslySetInnerHTML={{ __html: template(value, data) }}
|
|
166
|
+
<div dangerouslySetInnerHTML={{ __html: template(value, data) }}/>
|
|
167
167
|
) : (
|
|
168
168
|
template(text, data)
|
|
169
169
|
)
|
|
@@ -409,7 +409,7 @@ class Block extends React.Component {
|
|
|
409
409
|
)
|
|
410
410
|
} else if (type === 'diyqrcode') {
|
|
411
411
|
content = isStation ? (
|
|
412
|
-
<QrCode value={template(text, data)} size={parseInt(style.height)}
|
|
412
|
+
<QrCode value={template(text, data)} size={parseInt(style.height)}/>
|
|
413
413
|
) : (
|
|
414
414
|
<div
|
|
415
415
|
data-diyqrcode={template(text, data)}
|
|
@@ -464,7 +464,7 @@ class Block extends React.Component {
|
|
|
464
464
|
/>
|
|
465
465
|
)
|
|
466
466
|
} else if (type === 'customer_barcode') {
|
|
467
|
-
content =
|
|
467
|
+
content = (
|
|
468
468
|
<BarCode
|
|
469
469
|
value={template(customer_barcode, data)}
|
|
470
470
|
textMargin={0}
|
|
@@ -475,38 +475,7 @@ class Block extends React.Component {
|
|
|
475
475
|
dataName={customer_barcode}
|
|
476
476
|
background='transparent'
|
|
477
477
|
/>
|
|
478
|
-
) : (
|
|
479
|
-
<div
|
|
480
|
-
data-productionbarcode={template(customer_barcode, data)}
|
|
481
|
-
data-name={index}
|
|
482
|
-
// 内标里叫做"PDA出入库条码"
|
|
483
|
-
data-title={'PDA出入库条码'}
|
|
484
|
-
style={{ width: '100%', height: '100%' }}
|
|
485
|
-
>
|
|
486
|
-
<svg
|
|
487
|
-
style={{ height: '100%', width: '100%' }}
|
|
488
|
-
data-productionbarcode={template(customer_barcode, data)}
|
|
489
|
-
// 需要减去14才能打印出正确高度
|
|
490
|
-
data-doublepage={doublePage}
|
|
491
|
-
data-height={parseInt(style.height) - 14}
|
|
492
|
-
data-name={index}
|
|
493
|
-
id={`production${template(customer_barcode, data)}`}
|
|
494
|
-
/>
|
|
495
|
-
</div>
|
|
496
478
|
)
|
|
497
|
-
// /** 浏览器端的货位标签打印 */
|
|
498
|
-
// content = (
|
|
499
|
-
// <BarCode
|
|
500
|
-
// value={template(customer_barcode, data)}
|
|
501
|
-
// textMargin={0}
|
|
502
|
-
// margin={0}
|
|
503
|
-
// height={parseInt(style.height) - 14}
|
|
504
|
-
// width={doublePage ? 2.4 : 1.2}
|
|
505
|
-
// displayValue={false}
|
|
506
|
-
// dataName={customer_barcode}
|
|
507
|
-
// background='transparent'
|
|
508
|
-
// />
|
|
509
|
-
// )
|
|
510
479
|
} else if (type === 'package_order_qrcode') {
|
|
511
480
|
content = isStation ? (
|
|
512
481
|
<QrCode
|
|
@@ -535,7 +504,7 @@ class Block extends React.Component {
|
|
|
535
504
|
`gm-printer-label-block-type-${type}`,
|
|
536
505
|
className,
|
|
537
506
|
{
|
|
538
|
-
active
|
|
507
|
+
active
|
|
539
508
|
}
|
|
540
509
|
)}
|
|
541
510
|
draggable
|
|
@@ -569,7 +538,7 @@ Block.propTypes = {
|
|
|
569
538
|
data: PropTypes.object.isRequired,
|
|
570
539
|
selected: PropTypes.number,
|
|
571
540
|
isStation: PropTypes.bool,
|
|
572
|
-
doublePage: PropTypes.bool
|
|
541
|
+
doublePage: PropTypes.bool
|
|
573
542
|
}
|
|
574
543
|
|
|
575
544
|
export default Block
|