gm-printer-label 3.3.5-beta.2 → 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 +17 -51
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,26 +464,6 @@ class Block extends React.Component {
|
|
|
464
464
|
/>
|
|
465
465
|
)
|
|
466
466
|
} else if (type === 'customer_barcode') {
|
|
467
|
-
console.log(isStation, 'isStationisStationisStation')
|
|
468
|
-
// : (
|
|
469
|
-
// <div
|
|
470
|
-
// data-productionbarcode={template(customer_barcode, data)}
|
|
471
|
-
// data-name={index}
|
|
472
|
-
// data-title={'客户码'}
|
|
473
|
-
// style={{ width: '100%', height: '100%' }}
|
|
474
|
-
// >
|
|
475
|
-
// <svg
|
|
476
|
-
// style={{ height: '100%', width: '100%' }}
|
|
477
|
-
// data-productionbarcode={template(customer_barcode, data)}
|
|
478
|
-
// // 需要减去14才能打印出正确高度
|
|
479
|
-
// data-doublepage={doublePage}
|
|
480
|
-
// data-height={parseInt(style.height) - 14}
|
|
481
|
-
// data-name={index}
|
|
482
|
-
// id={`production${template(customer_barcode, data)}`}
|
|
483
|
-
// />
|
|
484
|
-
// </div>
|
|
485
|
-
// )
|
|
486
|
-
// content = isStation ? (
|
|
487
467
|
content = (
|
|
488
468
|
<BarCode
|
|
489
469
|
value={template(customer_barcode, data)}
|
|
@@ -496,20 +476,6 @@ class Block extends React.Component {
|
|
|
496
476
|
background='transparent'
|
|
497
477
|
/>
|
|
498
478
|
)
|
|
499
|
-
// )
|
|
500
|
-
// /** 浏览器端的货位标签打印 */
|
|
501
|
-
// content = (
|
|
502
|
-
// <BarCode
|
|
503
|
-
// value={template(customer_barcode, data)}
|
|
504
|
-
// textMargin={0}
|
|
505
|
-
// margin={0}
|
|
506
|
-
// height={parseInt(style.height) - 14}
|
|
507
|
-
// width={doublePage ? 2.4 : 1.2}
|
|
508
|
-
// displayValue={false}
|
|
509
|
-
// dataName={customer_barcode}
|
|
510
|
-
// background='transparent'
|
|
511
|
-
// />
|
|
512
|
-
// )
|
|
513
479
|
} else if (type === 'package_order_qrcode') {
|
|
514
480
|
content = isStation ? (
|
|
515
481
|
<QrCode
|
|
@@ -538,7 +504,7 @@ class Block extends React.Component {
|
|
|
538
504
|
`gm-printer-label-block-type-${type}`,
|
|
539
505
|
className,
|
|
540
506
|
{
|
|
541
|
-
active
|
|
507
|
+
active
|
|
542
508
|
}
|
|
543
509
|
)}
|
|
544
510
|
draggable
|
|
@@ -572,7 +538,7 @@ Block.propTypes = {
|
|
|
572
538
|
data: PropTypes.object.isRequired,
|
|
573
539
|
selected: PropTypes.number,
|
|
574
540
|
isStation: PropTypes.bool,
|
|
575
|
-
doublePage: PropTypes.bool
|
|
541
|
+
doublePage: PropTypes.bool
|
|
576
542
|
}
|
|
577
543
|
|
|
578
544
|
export default Block
|