gm-printer-label 3.0.10-beta.0 → 3.0.11-beta.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/.eslintcache +1 -1
- package/package.json +1 -1
- package/src/common/config.js +34 -4
- package/src/common/editor_compoents/edit_modify_filed.js +72 -49
- package/src/common/editor_compoents/store.js +5 -5
- package/src/common/editor_compoents/style.lesss +2 -2
- package/src/index.js +2 -0
- package/src/printer/block.js +1 -3
- package/src/util.js +1 -1
package/.eslintcache
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"/
|
|
1
|
+
[{"/Volumes/gm-project/gm-printer-label/src/index.js":"1","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit_modify_filed.js":"2","/Volumes/gm-project/gm-printer-label/src/common/config.js":"3","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/store.js":"4"},{"size":180,"mtime":1658462117054,"results":"5","hashOfConfig":"6"},{"size":4629,"mtime":1658462013375},{"size":1699,"mtime":1658461960259},{"size":7246,"mtime":1658890340157},{"filePath":"7","messages":"8","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"17s6x9q","/Volumes/gm-project/gm-printer-label/src/index.js",[]]
|
package/package.json
CHANGED
package/src/common/config.js
CHANGED
|
@@ -41,7 +41,37 @@ const borderStyleList = [
|
|
|
41
41
|
{ value: 'dotted', text: i18next.t('圆点') }
|
|
42
42
|
]
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
const DiyTimeType = [
|
|
45
|
+
{
|
|
46
|
+
type: '',
|
|
47
|
+
text: '格式“2022-01-01 19:00:00”,输入“单据日期:{{单据日期}}”;',
|
|
48
|
+
format: 'YYYY-MM-DD HH:mm:ss'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: '时分',
|
|
52
|
+
text: '格式“2022-01-01 19:00”,输入“单据日期:{{单据日期_时分}}”;',
|
|
53
|
+
format: 'YYYY-MM-DD HH:mm'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: '日期',
|
|
57
|
+
text: '格式“2022-01-01”,输入“单据日期:{{单据日期_日期}}”;',
|
|
58
|
+
format: 'YYYY-MM-DD'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: '无年份',
|
|
62
|
+
text: '格式“01-01 19:00:00”,输入“单据日期:{{单据日期_无年份}}”;',
|
|
63
|
+
format: 'MM-DD HH:mm:ss'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: '日期_无年份',
|
|
67
|
+
text: '格式“01-01”,输入“单据日期:{{单据日期_日期_无年份}}";',
|
|
68
|
+
format: 'MM-DD'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: '时间',
|
|
72
|
+
text: '格式“19:00:00",输入“单据日期:{{单据日期_时间}}";',
|
|
73
|
+
format: 'HH:mm:ss'
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
export { DiyTimeType, borderStyleList, pageTypeMap }
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from './component'
|
|
15
15
|
import i18next from '../../../locales'
|
|
16
16
|
import _ from 'lodash'
|
|
17
|
+
import { DiyTimeType } from '../config'
|
|
17
18
|
|
|
18
19
|
@inject('editStore')
|
|
19
20
|
@observer
|
|
@@ -48,93 +49,115 @@ class EditModifyFiled extends React.Component {
|
|
|
48
49
|
<React.Fragment>
|
|
49
50
|
<Title title={i18next.t('编辑字段')}/>
|
|
50
51
|
<Gap/>
|
|
51
|
-
<Position
|
|
52
|
-
|
|
52
|
+
<Position
|
|
53
|
+
style={style}
|
|
54
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
55
|
+
/>
|
|
53
56
|
<Gap/>
|
|
54
57
|
|
|
55
58
|
{(!type || type === 'text') && (
|
|
56
59
|
<div>
|
|
57
|
-
<Fonter
|
|
58
|
-
|
|
60
|
+
<Fonter
|
|
61
|
+
style={style}
|
|
62
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
63
|
+
/>
|
|
59
64
|
<Separator/>
|
|
60
|
-
<TextAlign
|
|
61
|
-
|
|
65
|
+
<TextAlign
|
|
66
|
+
style={style}
|
|
67
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
68
|
+
/>
|
|
62
69
|
<Gap/>
|
|
63
70
|
|
|
64
|
-
<Textarea
|
|
65
|
-
|
|
71
|
+
<Textarea
|
|
72
|
+
value={text}
|
|
73
|
+
placeholder='请输入填充内容'
|
|
74
|
+
onChange={this.handleChangeBlock.bind(this, 'text')}
|
|
75
|
+
/>
|
|
66
76
|
</div>
|
|
67
77
|
)}
|
|
68
|
-
{type === 'line' &&
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
{type === 'line' && (
|
|
79
|
+
<Line
|
|
80
|
+
style={style}
|
|
81
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
{(type === 'qrcode' ||
|
|
85
|
+
type === 'order_qrcode' ||
|
|
86
|
+
type === 'package_id_qrcode' ||
|
|
87
|
+
type === 'image') && (
|
|
73
88
|
<div>
|
|
74
|
-
<Size
|
|
75
|
-
|
|
89
|
+
<Size
|
|
90
|
+
style={style}
|
|
91
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
92
|
+
/>
|
|
76
93
|
</div>
|
|
77
94
|
)}
|
|
78
95
|
{type === 'diyqrcode' && (
|
|
79
96
|
<div>
|
|
80
|
-
<Size
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
<Size
|
|
98
|
+
style={style}
|
|
99
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
100
|
+
/>
|
|
101
|
+
<Textarea
|
|
102
|
+
value={text}
|
|
103
|
+
placeholder='请输入填充内容'
|
|
104
|
+
onChange={this.handleChangeBlock.bind(this, 'text')}
|
|
105
|
+
/>
|
|
84
106
|
</div>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
107
|
+
)}
|
|
87
108
|
{type === 'barcode' && (
|
|
88
109
|
<div>
|
|
89
|
-
<Size
|
|
90
|
-
|
|
110
|
+
<Size
|
|
111
|
+
style={style}
|
|
112
|
+
withoutWidth
|
|
113
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
114
|
+
/>
|
|
91
115
|
<div>
|
|
92
|
-
<button onClick={this.handleRotateBarcode}>
|
|
93
|
-
'旋转')}
|
|
116
|
+
<button onClick={this.handleRotateBarcode}>
|
|
117
|
+
{i18next.t('旋转')}
|
|
118
|
+
</button>
|
|
94
119
|
</div>
|
|
95
120
|
</div>
|
|
96
121
|
)}
|
|
97
122
|
{type === 'in_stock_barcode' && (
|
|
98
123
|
<div>
|
|
99
|
-
<Size
|
|
100
|
-
|
|
124
|
+
<Size
|
|
125
|
+
style={style}
|
|
126
|
+
withoutWidth
|
|
127
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
128
|
+
/>
|
|
101
129
|
<div>
|
|
102
|
-
<button onClick={this.handleRotateBarcode}>
|
|
103
|
-
'旋转')}
|
|
130
|
+
<button onClick={this.handleRotateBarcode}>
|
|
131
|
+
{i18next.t('旋转')}
|
|
132
|
+
</button>
|
|
104
133
|
</div>
|
|
105
134
|
</div>
|
|
106
135
|
)}
|
|
107
136
|
{type === 'diycode' && (
|
|
108
137
|
<div>
|
|
109
|
-
<Size
|
|
110
|
-
|
|
138
|
+
<Size
|
|
139
|
+
style={style}
|
|
140
|
+
withoutWidth
|
|
141
|
+
onChange={this.handleChangeBlock.bind(this, 'style')}
|
|
142
|
+
/>
|
|
111
143
|
<div>
|
|
112
|
-
<button onClick={this.handleRotateBarcode}>
|
|
113
|
-
'旋转')}
|
|
144
|
+
<button onClick={this.handleRotateBarcode}>
|
|
145
|
+
{i18next.t('旋转')}
|
|
146
|
+
</button>
|
|
114
147
|
</div>
|
|
115
148
|
</div>
|
|
116
149
|
)}
|
|
117
|
-
<TipInfo
|
|
150
|
+
<TipInfo
|
|
151
|
+
text={i18next.t('说明:请勿修改{}中的内容,避免出现数据异常')}
|
|
152
|
+
/>
|
|
118
153
|
{editStore.computedIsTime && (
|
|
119
154
|
<div>
|
|
120
155
|
<TipInfo
|
|
121
156
|
text={i18next.t('注:可通过修改“{{}}”中的内容更改时间格式。')}
|
|
122
157
|
/>
|
|
123
|
-
|
|
124
|
-
text={
|
|
125
|
-
|
|
126
|
-
)}
|
|
127
|
-
/>
|
|
128
|
-
<TipInfo
|
|
129
|
-
text={i18next.t(
|
|
130
|
-
'2. 格式“1970-01-01”,输入“时间: {{当前时间_年月日}}”;'
|
|
131
|
-
)}
|
|
132
|
-
/>
|
|
133
|
-
<TipInfo
|
|
134
|
-
text={i18next.t(
|
|
135
|
-
'3. 格式“19:00:00",输入“时间: {{当前时间_时间}}";'
|
|
136
|
-
)}
|
|
137
|
-
/>
|
|
158
|
+
{_.map(DiyTimeType, (v, k) => (
|
|
159
|
+
<TipInfo text={`${k + 1}。${v.text}`}/>
|
|
160
|
+
))}
|
|
138
161
|
</div>
|
|
139
162
|
)}
|
|
140
163
|
</React.Fragment>
|
|
@@ -4,18 +4,18 @@ import i18next from '../../../locales'
|
|
|
4
4
|
|
|
5
5
|
class EditStore {
|
|
6
6
|
@observable
|
|
7
|
-
config = null
|
|
7
|
+
config = null
|
|
8
8
|
|
|
9
9
|
@observable
|
|
10
|
-
selected = null
|
|
10
|
+
selected = null
|
|
11
11
|
|
|
12
12
|
@observable
|
|
13
13
|
// 载入模板下拉框选中的值
|
|
14
|
-
tempKey = null
|
|
14
|
+
tempKey = null
|
|
15
15
|
|
|
16
16
|
@observable
|
|
17
17
|
// 初始模板
|
|
18
|
-
originConfig = null
|
|
18
|
+
originConfig = null
|
|
19
19
|
|
|
20
20
|
@action.bound
|
|
21
21
|
init (config, initDefaultTemp) {
|
|
@@ -277,7 +277,7 @@ class EditStore {
|
|
|
277
277
|
const block = this.config.blocks[this.selected]
|
|
278
278
|
if (
|
|
279
279
|
(!block.type || block.type === 'text') &&
|
|
280
|
-
_.includes(block.text, '时间')
|
|
280
|
+
(_.includes(block.text, '时间') || _.includes(block.text, '日期'))
|
|
281
281
|
) {
|
|
282
282
|
return true
|
|
283
283
|
}
|
package/src/index.js
CHANGED
package/src/printer/block.js
CHANGED
|
@@ -108,7 +108,6 @@ class Block extends React.Component {
|
|
|
108
108
|
isStation,
|
|
109
109
|
...rest
|
|
110
110
|
} = this.props
|
|
111
|
-
console.log('test', merchandise_trace_qrcode)
|
|
112
111
|
const { isEdit } = this.state
|
|
113
112
|
let content = null
|
|
114
113
|
if (!type || type === 'text') {
|
|
@@ -159,7 +158,6 @@ class Block extends React.Component {
|
|
|
159
158
|
/>
|
|
160
159
|
)
|
|
161
160
|
} else if (type === 'merchandise_trace_qrcode') {
|
|
162
|
-
console.log('template(merchandise_trace_qrcode, data)', merchandise_trace_qrcode, data, template(merchandise_trace_qrcode, data))
|
|
163
161
|
content = isStation ? (
|
|
164
162
|
<QrCode
|
|
165
163
|
value={miniAppLink + template(merchandise_trace_qrcode, data)}
|
|
@@ -167,7 +165,7 @@ class Block extends React.Component {
|
|
|
167
165
|
/>
|
|
168
166
|
) : (
|
|
169
167
|
<div
|
|
170
|
-
data-
|
|
168
|
+
data-traceqrcode={template(merchandise_trace_qrcode, data)}
|
|
171
169
|
data-width={style.width}
|
|
172
170
|
data-height={style.height}
|
|
173
171
|
data-name={index}
|
package/src/util.js
CHANGED
|
@@ -75,7 +75,7 @@ function afterImgAndSvgLoaded (callback, $printer) {
|
|
|
75
75
|
timer = setTimeout(afterImgAndSvgLoaded.bind(this, callback, $printer), 300)
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const miniAppLink = 'https://
|
|
78
|
+
const miniAppLink = 'https://miniapp.guanmai.cn/traceability/?id='
|
|
79
79
|
export {
|
|
80
80
|
pxAdd,
|
|
81
81
|
getStyleWithDiff,
|