gm-printer 10.28.8-beta → 10.28.8-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/.nvmrc +1 -0
- package/build/demo.js +54 -0
- package/build/index.html +1 -0
- package/package.json +1 -1
- package/src/common/editor_store.js +13 -1
- package/src/common/editor_title.js +2 -15
- package/src/editor/context_menu.js +4 -0
- package/src/printer/printer.js +0 -7
- package/src/printer/store.js +0 -25
- package/.eslintcache +0 -1
package/build/index.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><html><head></head><body><div id="appContainer"></div><script src="/demo.js"></script><script src="/demo.js"></script></body></html>
|
package/package.json
CHANGED
|
@@ -503,7 +503,7 @@ class EditorStore {
|
|
|
503
503
|
} else {
|
|
504
504
|
return
|
|
505
505
|
}
|
|
506
|
-
|
|
506
|
+
console.log('type')
|
|
507
507
|
switch (type) {
|
|
508
508
|
case '':
|
|
509
509
|
case 'text':
|
|
@@ -589,6 +589,18 @@ class EditorStore {
|
|
|
589
589
|
text: `{{uniform_social_credit_code}}`
|
|
590
590
|
})
|
|
591
591
|
break
|
|
592
|
+
case 'qrcode_order_id':
|
|
593
|
+
blocks.push({
|
|
594
|
+
type: 'qrcode',
|
|
595
|
+
style: {
|
|
596
|
+
left: '0px',
|
|
597
|
+
top: '5px',
|
|
598
|
+
width: '75px',
|
|
599
|
+
height: '75px'
|
|
600
|
+
},
|
|
601
|
+
text: `{{qrcode_order_id}}`
|
|
602
|
+
})
|
|
603
|
+
break
|
|
592
604
|
default:
|
|
593
605
|
window.alert(i18next.t('出错啦,未识别类型,此信息不应该出现'))
|
|
594
606
|
}
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
DropDown,
|
|
8
8
|
DropDownItem,
|
|
9
9
|
DropDownItems,
|
|
10
|
-
Dialog
|
|
11
|
-
Tip
|
|
10
|
+
Dialog
|
|
12
11
|
} from '../components'
|
|
13
12
|
import { doPrint } from '../printer'
|
|
14
13
|
import { toJS } from 'mobx'
|
|
@@ -47,13 +46,6 @@ class EditorTitle extends React.Component {
|
|
|
47
46
|
handleSave = () => {
|
|
48
47
|
const { editStore, isPurchase } = this.props
|
|
49
48
|
const result = editStore.config
|
|
50
|
-
console.log(result, 'result')
|
|
51
|
-
if (result.isSave) {
|
|
52
|
-
Tip.warning(
|
|
53
|
-
i18next.t('检测到当前页面高度不足,无法完整渲染,请重新设置页面高度!')
|
|
54
|
-
)
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
49
|
if (!isPurchase && result.batchPrintConfig) {
|
|
58
50
|
delete result.batchPrintConfig
|
|
59
51
|
}
|
|
@@ -84,12 +76,7 @@ class EditorTitle extends React.Component {
|
|
|
84
76
|
|
|
85
77
|
handleSaveAs = () => {
|
|
86
78
|
const { editStore } = this.props
|
|
87
|
-
|
|
88
|
-
Tip.warning(
|
|
89
|
-
i18next.t('检测到当前页面高度不足,无法完整渲染,请重新设置页面高度!')
|
|
90
|
-
)
|
|
91
|
-
return
|
|
92
|
-
}
|
|
79
|
+
|
|
93
80
|
Dialog.render({
|
|
94
81
|
title: i18next.t('另存为'),
|
|
95
82
|
children: <DialogChildren editStore={editStore} />,
|
package/src/printer/printer.js
CHANGED
|
@@ -78,10 +78,6 @@ class Printer extends React.Component {
|
|
|
78
78
|
nextProps.isAutoFilling !== this.props.isAutoFilling ||
|
|
79
79
|
nextProps.fillIndex !== this.props.printerStore.fillIndex
|
|
80
80
|
) {
|
|
81
|
-
// 连续打印计算导致死循环 所以这里做了判断 五年前的提交记录是这样写的 我跟着写 在componentDidMount里写了
|
|
82
|
-
if (nextProps.config.batchPrintConfig == 2) {
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
81
|
await this.props.printerStore.setAutofillConfig(nextProps.isAutoFilling)
|
|
86
82
|
await this.props.printerStore.setFillIndex(nextProps.fillIndex)
|
|
87
83
|
await this.props.printerStore.setData(nextProps.data)
|
|
@@ -239,9 +235,6 @@ class Printer extends React.Component {
|
|
|
239
235
|
<>
|
|
240
236
|
{_.map(printerStore.pages, (page, i) => {
|
|
241
237
|
const isLastPage = i === printerStore.pages.length - 1
|
|
242
|
-
if (page.length === 0) {
|
|
243
|
-
return null
|
|
244
|
-
}
|
|
245
238
|
return (
|
|
246
239
|
<Page key={i}>
|
|
247
240
|
<Header config={config.header} pageIndex={i} />
|
package/src/printer/store.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from '../util'
|
|
10
10
|
import _ from 'lodash'
|
|
11
11
|
import Big from 'big.js'
|
|
12
|
-
import { Tip } from '../components'
|
|
13
12
|
|
|
14
13
|
export const TR_BASE_HEIGHT = 23
|
|
15
14
|
const price = (n, f = 2) => {
|
|
@@ -34,7 +33,6 @@ class PrinterStore {
|
|
|
34
33
|
|
|
35
34
|
/** 当前页剩余空白高度 */
|
|
36
35
|
@observable remainPageHeight = 0
|
|
37
|
-
@observable isSave = false
|
|
38
36
|
|
|
39
37
|
data = {}
|
|
40
38
|
|
|
@@ -63,12 +61,6 @@ class PrinterStore {
|
|
|
63
61
|
this.isMultiDigitDecimal = bool
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
@action
|
|
67
|
-
setIsSave(bool) {
|
|
68
|
-
this.isSave = bool
|
|
69
|
-
this.config.isSave = bool
|
|
70
|
-
}
|
|
71
|
-
|
|
72
64
|
@action
|
|
73
65
|
init(config, data) {
|
|
74
66
|
this.ready = false
|
|
@@ -262,17 +254,12 @@ class PrinterStore {
|
|
|
262
254
|
|
|
263
255
|
@action
|
|
264
256
|
computedPages() {
|
|
265
|
-
this.setIsSave(false)
|
|
266
257
|
// 每次先初始化置空
|
|
267
258
|
this.pages = []
|
|
268
259
|
// 每页必有 页眉header, 页脚footer , 签名
|
|
269
260
|
const allPagesHaveThisHeight = this.height.header + this.height.footer
|
|
270
261
|
// 退出计算! 因为页眉 + 页脚 > currentPageHeight,页面装不下其他东西
|
|
271
262
|
if (allPagesHaveThisHeight > this.pageHeight) {
|
|
272
|
-
Tip.warning(
|
|
273
|
-
i18next.t('检测到当前页面高度不足,无法完整渲染,请重新设置页面高度!')
|
|
274
|
-
)
|
|
275
|
-
this.setIsSave(true)
|
|
276
263
|
return
|
|
277
264
|
}
|
|
278
265
|
|
|
@@ -377,18 +364,6 @@ class PrinterStore {
|
|
|
377
364
|
end++
|
|
378
365
|
}
|
|
379
366
|
}
|
|
380
|
-
// 第一页一点表格都放不下时,什么都不展示
|
|
381
|
-
if (begin === 0 && end === 0 && index === 0) {
|
|
382
|
-
index++
|
|
383
|
-
this.pages = []
|
|
384
|
-
this.setIsSave(true)
|
|
385
|
-
Tip.warning(
|
|
386
|
-
i18next.t(
|
|
387
|
-
'检测到当前页面高度不足,无法完整渲染,请重新设置页面高度!'
|
|
388
|
-
)
|
|
389
|
-
)
|
|
390
|
-
break
|
|
391
|
-
}
|
|
392
367
|
// 第一条极端会有问题
|
|
393
368
|
if (end !== 0) {
|
|
394
369
|
page.push({
|
package/.eslintcache
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"/Users/joke/work_code/gm-printer/src/printer/table.js":"1","/Users/joke/work_code/gm-printer/src/printer/store.js":"2","/Users/joke/work_code/gm-printer/src/printer/table_subtotal_tr.js":"3","/Users/joke/work_code/gm-printer/src/common/util.js":"4","/Users/joke/work_code/gm-printer/src/common/editor_store.js":"5","/Users/joke/work_code/gm-printer/src/common/editor_edit_field.js":"6","/Users/joke/work_code/gm-printer/src/printer/printer.js":"7"},{"size":10861,"mtime":1722841015622},{"size":18403,"mtime":1709723362583,"results":"8","hashOfConfig":"9"},{"size":6329,"mtime":1722840447954,"results":"10","hashOfConfig":"11"},{"size":648,"mtime":1722840447954,"results":"12","hashOfConfig":"11"},{"size":49196,"mtime":1722840447953,"results":"13","hashOfConfig":"11"},{"size":23532,"mtime":1722840447952,"results":"14","hashOfConfig":"11"},{"size":13809,"mtime":1743492201549,"results":"15","hashOfConfig":"16"},{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1akqze6",{"filePath":"19","messages":"20","errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"12qfxi0",{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","errorCount":1,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"27","messages":"28","errorCount":3,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"zc0ygz","/Users/joke/work_code/gm-printer/src/printer/store.js",[],"/Users/joke/work_code/gm-printer/src/printer/table_subtotal_tr.js",["29"],"/Users/joke/work_code/gm-printer/src/common/util.js",[],"/Users/joke/work_code/gm-printer/src/common/editor_store.js",[],"/Users/joke/work_code/gm-printer/src/common/editor_edit_field.js",["30","31","32","33","34","35"],"/Users/joke/work_code/gm-printer/src/printer/printer.js",["36","37","38"],{"ruleId":"39","severity":2,"message":"40","line":49,"column":9,"nodeType":"41","endLine":49,"endColumn":16},{"ruleId":"42","severity":1,"message":"43","line":344,"column":13,"nodeType":"44","endLine":344,"endColumn":49},{"ruleId":"42","severity":1,"message":"43","line":362,"column":13,"nodeType":"44","endLine":362,"endColumn":56},{"ruleId":"42","severity":1,"message":"43","line":528,"column":15,"nodeType":"44","endLine":528,"endColumn":53},{"ruleId":"42","severity":1,"message":"43","line":595,"column":11,"nodeType":"44","endLine":595,"endColumn":53},{"ruleId":"42","severity":1,"message":"43","line":645,"column":19,"nodeType":"44","endLine":645,"endColumn":64},{"ruleId":"45","severity":2,"message":"46","line":712,"column":22,"nodeType":"47","messageId":"48","endLine":712,"endColumn":31},{"ruleId":"49","severity":2,"message":"50","line":26,"column":24,"nodeType":"41","endLine":26,"endColumn":28},{"ruleId":"49","severity":2,"message":"50","line":44,"column":24,"nodeType":"41","endLine":44,"endColumn":28},{"ruleId":"51","severity":2,"message":"52","line":82,"column":45,"nodeType":"53","messageId":"54","endLine":82,"endColumn":47},"no-unused-vars","'sumData' is assigned a value but never used.","Identifier","react/jsx-handler-names","Handler function for onChange prop key must begin with 'handle'","JSXAttribute","gmfe/i18n-check","t函数的key只能为字符串常量(Literal),请使用单引号或双引号包裹","MemberExpression","isVariable","react/prop-types","'flag' is missing in props validation","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected"]
|