gm-printer-label 3.1.7 → 3.2.1-beta.0

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.
@@ -0,0 +1,46 @@
1
+ name: Release
2
+
3
+ permissions:
4
+ contents: write
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - 'v*'
10
+
11
+ jobs:
12
+ release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Set node
20
+ uses: actions/setup-node@v3
21
+ with:
22
+ node-version: 16.x
23
+ registry-url: 'https://registry.npmjs.org'
24
+
25
+ - name: ChangeLog
26
+ run: npx changelogithub
27
+ env:
28
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29
+
30
+ - name: Setup
31
+ run: npm i -g @antfu/ni
32
+
33
+ - name: Install
34
+ run: nci
35
+
36
+ - name: Release
37
+ run: |
38
+ if [[ ${{ github.ref }} == *refs/tags/*-beta* ]]; then
39
+ npm publish --tag beta
40
+ elif [[ ${{ github.ref }} == *refs/tags/*-alpha* ]]; then
41
+ npm publish --tag alpha
42
+ else
43
+ npm publish
44
+ fi
45
+ env:
46
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer-label",
3
- "version": "3.1.7",
3
+ "version": "3.2.1-beta.0",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -8,7 +8,8 @@
8
8
  "start": "webpack-dev-server",
9
9
  "publish-latest": "npm publish --force-publish --registry https://registry.npmjs.org/",
10
10
  "publish-beta": "npm publish --force-publish --dist-tag beta --preid beta --registry https://registry.npmjs.org/",
11
- "publish-alpha": "npm publish --force-publish --dist-tag alpha --preid alpha --registry https://registry.npmjs.org/"
11
+ "publish-alpha": "npm publish --force-publish --dist-tag alpha --preid alpha --registry https://registry.npmjs.org/",
12
+ "release": "bumpp"
12
13
  },
13
14
  "lint-staged": {
14
15
  "./src/**/*.js": [
@@ -31,11 +32,12 @@
31
32
  "classnames": "^2.2.5",
32
33
  "lodash": "^4.17.10",
33
34
  "moment": "^2.22.2",
35
+ "qrcode.react": "^0.9.2",
34
36
  "react": "^16.8.5",
35
- "react-dom": "^16.8.5",
36
- "qrcode.react": "^0.9.2"
37
+ "react-dom": "^16.8.5"
37
38
  },
38
39
  "dependencies": {
40
+ "bumpp": "^9.1.0",
39
41
  "clipboard": "^2.0.1",
40
42
  "gm-svg": "^0.3.10",
41
43
  "gm-util": "^5.10.4",
@@ -71,6 +73,7 @@
71
73
  "gm-util": "^5.12.3",
72
74
  "gm_static_storage": "^1.2.0",
73
75
  "husky": "^0.14.3",
76
+ "jsbarcode": "^3.11.0",
74
77
  "less": "^3.0.4",
75
78
  "less-loader": "^4.1.0",
76
79
  "lint-staged": "^7.2.2",
@@ -83,6 +86,7 @@
83
86
  "precss": "^3.1.2",
84
87
  "prop-types": "^15.6.1",
85
88
  "query-string": "^6.2.0",
89
+ "raw-loader": "^4.0.2",
86
90
  "react": "^16.8.5",
87
91
  "react-dom": "^16.8.5",
88
92
  "react-hot-loader": "^3.1.3",
@@ -91,7 +95,6 @@
91
95
  "url-loader": "^1.0.1",
92
96
  "webpack": "^4.10.1",
93
97
  "webpack-cli": "^3.3.0",
94
- "webpack-dev-server": "^3.1.4",
95
- "jsbarcode": "^3.11.0"
98
+ "webpack-dev-server": "^3.1.4"
96
99
  }
97
100
  }
@@ -23,6 +23,8 @@ class Edit extends React.Component {
23
23
 
24
24
  render () {
25
25
  const {
26
+ // 用来区分内标和分拣
27
+ type,
26
28
  data,
27
29
  initDefaultTemp,
28
30
  defaultTempList,
@@ -74,6 +76,7 @@ class Edit extends React.Component {
74
76
  >
75
77
  <ContextMenu>
76
78
  <Printer
79
+ type={type}
77
80
  selected={editStore.selected}
78
81
  config={editStore.config}
79
82
  data={data}
@@ -102,6 +102,13 @@ class EditModifyFiled extends React.Component {
102
102
  onChange={this.handleChangeBlock.bind(this, 'style')}
103
103
  />
104
104
  )}
105
+ {type === 'new_production_barcode' && (
106
+ <Size
107
+ withoutWidth
108
+ style={style}
109
+ onChange={this.handleChangeBlock.bind(this, 'style')}
110
+ />
111
+ )}
105
112
  {type === 'diyqrcode' && (
106
113
  <div>
107
114
  <Size
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line
2
- import editCSS from 'css-loader!postcss-loader!less-loader!./style.lesss'
2
+ import editCSS from '!!raw-loader!less-loader!./style.less'
3
3
 
4
4
  function getCSS () {
5
5
  return editCSS.toString()
@@ -224,6 +224,19 @@ class EditStore {
224
224
  }
225
225
  })
226
226
  break
227
+ case 'new_production_barcode':
228
+ this.config.blocks.push({
229
+ type,
230
+ new_production_barcode: i18next.t('{{新商品条码}}'),
231
+ style: {
232
+ position: 'absolute',
233
+ left: '0px',
234
+ top: '0px',
235
+ height: '30px',
236
+ width: '165px'
237
+ }
238
+ })
239
+ break
227
240
  case 'rack_barcode':
228
241
  this.config.blocks.push({
229
242
  type,
@@ -238,7 +251,6 @@ class EditStore {
238
251
  })
239
252
  break
240
253
  case 'delivery_qrcode':
241
-
242
254
  this.config.blocks.push({
243
255
  type,
244
256
  delivery_qrcode: i18next.t('{{配送单二维码}}'),
@@ -273,12 +273,30 @@
273
273
  div[data-productionbarcode] {
274
274
  outline: 1px solid red;
275
275
 
276
+ &::before {
277
+ content: attr(data-title);
278
+ position: absolute;
279
+ font-style: italic;
280
+ left: 0;
281
+ right: 0;
282
+ top: calc(50% - 0.5em);
283
+ bottom: 0;
284
+ text-align: center;
285
+ }
286
+ }
287
+
288
+ div[data-newproductionbarcode] {
289
+ outline: 1px solid red;
290
+
276
291
  &::before {
277
292
  content: '商品条码';
278
293
  position: absolute;
279
294
  font-style: italic;
280
- left: calc(50% - 1.5em);
295
+ left: 0;
296
+ right: 0;
281
297
  top: calc(50% - 0.5em);
298
+ bottom: 0;
299
+ text-align: center;
282
300
  }
283
301
  }
284
302
 
@@ -289,8 +307,11 @@
289
307
  content: '商品溯源二维码';
290
308
  position: absolute;
291
309
  font-style: italic;
292
- left: calc(50% - 1.5em);
310
+ left: 0;
311
+ right: 0;
293
312
  top: calc(50% - 0.5em);
313
+ bottom: 0;
314
+ text-align: center;
294
315
  }
295
316
  }
296
317
 
@@ -130,6 +130,7 @@ class Block extends React.Component {
130
130
  fieldType,
131
131
  fieldKey,
132
132
  production_barcode,
133
+ new_production_barcode,
133
134
  merchandise_trace_qrcode,
134
135
  rack_barcode,
135
136
  delivery_qrcode
@@ -287,8 +288,10 @@ class Block extends React.Component {
287
288
  />
288
289
  ) : (
289
290
  <div
290
- data-productionbarcode='商品条码'
291
+ data-productionbarcode={template(production_barcode, data)}
291
292
  data-name={index}
293
+ // 内标里叫做"PDA出入库条码"
294
+ data-title={this.props.type === 'inner_label' ? 'PDA出入库条码' : '商品条码'}
292
295
  style={{ width: '100%', height: '100%' }}
293
296
  >
294
297
  <svg
@@ -302,6 +305,42 @@ class Block extends React.Component {
302
305
  />
303
306
  </div>
304
307
  )
308
+ } else if (type === 'new_production_barcode') {
309
+ // 判断是否是69码
310
+ const reg = /^69[0-9]{11}$/
311
+ const is69 = reg.test(template(new_production_barcode, data))
312
+ content = isStation ? (
313
+ <BarCode
314
+ data-newproductionbarcode={template(new_production_barcode, data)}
315
+ value={template(new_production_barcode, data)}
316
+ textMargin={0}
317
+ margin={0}
318
+ height={parseInt(style.height) - 14}
319
+ width={2}
320
+ displayValue={is69}
321
+ format={is69 ? 'EAN13' : undefined}
322
+ dataName={new_production_barcode}
323
+ background='transparent'
324
+ />
325
+ ) : (
326
+ <div
327
+ data-newproductionbarcode={template(new_production_barcode, data)}
328
+ data-name={index}
329
+ style={{ width: '100%', height: '100%' }}
330
+ >
331
+ <svg
332
+ style={{ height: '100%', width: '100%' }}
333
+ data-newproductionbarcode={template(new_production_barcode, data)}
334
+ // 需要减去14才能打印出正确高度
335
+ data-doublepage={doublePage}
336
+ data-height={parseInt(style.height) - 14}
337
+ data-format={is69 ? 'EAN13' : undefined}
338
+ displayValue={is69}
339
+ data-name={index}
340
+ id={`newproduction${template(new_production_barcode, data)}`}
341
+ />
342
+ </div>
343
+ )
305
344
  } else if (type === 'package_id_qrcode') {
306
345
  content = isStation ? (
307
346
  <QrCode
@@ -7,9 +7,9 @@ import ReactDOM from 'react-dom'
7
7
  import BatchPrinter from './batch_printer'
8
8
 
9
9
  // eslint-disable-next-line
10
- import normalizeCSS from 'css-loader!./normalize.csss'
10
+ import normalizeCSS from '!!raw-loader!less-loader!./normalize.css'
11
11
  // eslint-disable-next-line
12
- import printerCSS from 'css-loader!postcss-loader!less-loader!./style.lesss'
12
+ import printerCSS from '!!raw-loader!less-loader!./style.less'
13
13
  import { afterImgAndSvgLoaded } from '../util'
14
14
 
15
15
  function getHtml (props) {
@@ -45,6 +45,7 @@ class Printer extends React.Component {
45
45
  <Page pageStyle={{ width, height }}>
46
46
  {_.map(config.blocks, (block, i) => (
47
47
  <Block
48
+ type={this.props.type}
48
49
  key={i}
49
50
  index={i}
50
51
  selected={selected}
package/.eslintcache DELETED
@@ -1 +0,0 @@
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","/Volumes/gm-project/gm-printer-label/src/util.js":"5","/Volumes/gm-project/gm-printer-label/src/printer/printer.js":"6","/Volumes/gm-project/gm-printer-label/src/printer/page.js":"7","/Volumes/gm-project/gm-printer-label/src/printer/block.js":"8","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit.js":"9","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit_select.js":"10","/Volumes/gm-project/gm-printer-label/src/printer/batch_printer.js":"11"},{"size":180,"mtime":1658462117054,"results":"12","hashOfConfig":"13"},{"size":4956,"mtime":1670828102437},{"size":1699,"mtime":1658461960259},{"size":7294,"mtime":1661759246118,"results":"14","hashOfConfig":"13"},{"size":1937,"mtime":1661225223156,"results":"15","hashOfConfig":"13"},{"size":1832,"mtime":1670827635163,"results":"16","hashOfConfig":"13"},{"size":411,"mtime":1660567552793},{"size":12581,"mtime":1670896950374},{"size":2928,"mtime":1661759246116},{"size":6103,"mtime":1661767254469},{"size":825,"mtime":1670827635162},{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"17s6x9q",{"filePath":"19","messages":"20","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Volumes/gm-project/gm-printer-label/src/index.js",[],"/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/store.js",[],"/Volumes/gm-project/gm-printer-label/src/util.js",[],"/Volumes/gm-project/gm-printer-label/src/printer/printer.js",[]]
File without changes
File without changes