gm-printer 10.41.0 → 10.41.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/build/demo.js +3 -3
- package/package.json +1 -1
- package/src/common/editor_edit_field.js +4 -10
- package/src/common/editor_store.js +0 -19
- package/src/common/util.js +4 -58
- package/src/editor_purchase/editor_special_table.js +9 -28
- package/src/editor_purchase/store.js +4 -7
- package/src/printer/long_print_table/index.js +2 -10
- package/src/printer/printer.js +2 -25
- package/src/printer/store.js +97 -45
- package/src/printer/table.js +2 -9
- package/src/printer/table_overallOrder_tr.js +37 -49
- package/src/util.js +11 -3
|
@@ -12,66 +12,54 @@ const OverallOrder = props => {
|
|
|
12
12
|
printerStore,
|
|
13
13
|
printerStore: {
|
|
14
14
|
data: { common }
|
|
15
|
-
}
|
|
16
|
-
isLastTablePage
|
|
15
|
+
}
|
|
17
16
|
} = props
|
|
18
17
|
|
|
19
|
-
// showEachPage 默认 true(老模板缺省视为每页展示);false 时仅表格最后一页渲染
|
|
20
|
-
const showEachPage = overallOrder?.showEachPage !== false
|
|
21
|
-
const shouldShow =
|
|
22
|
-
overallOrder?.show &&
|
|
23
|
-
printerStore?.ready &&
|
|
24
|
-
(showEachPage || isLastTablePage)
|
|
25
|
-
|
|
26
|
-
if (!shouldShow) return null
|
|
27
|
-
|
|
28
18
|
return (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className={
|
|
44
|
-
overallOrder?.isUpperCaseBefore
|
|
45
|
-
? 'gm-printer-subtotal-isUpperCaseBefore-inter'
|
|
46
|
-
: ''
|
|
47
|
-
}
|
|
19
|
+
overallOrder?.show &&
|
|
20
|
+
printerStore?.ready && (
|
|
21
|
+
<tr>
|
|
22
|
+
{_.map(overallOrder.fields, (item, index) => {
|
|
23
|
+
return (
|
|
24
|
+
<td colSpan={item.colSpan} key={index}>
|
|
25
|
+
<div style={{ ...item.style }} className='gm-flex-page'>
|
|
26
|
+
{item.name}
|
|
27
|
+
<div
|
|
28
|
+
className={classNames('gm-flex-page', {
|
|
29
|
+
'gm-flex-justify-between-page':
|
|
30
|
+
overallOrder?.isUpperLowerCaseSeparate,
|
|
31
|
+
'gm-flex-grow-page': overallOrder?.isUpperLowerCaseSeparate
|
|
32
|
+
})}
|
|
48
33
|
>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
<span
|
|
35
|
+
className={
|
|
36
|
+
overallOrder?.isUpperCaseBefore
|
|
37
|
+
? 'gm-printer-subtotal-isUpperCaseBefore-inter'
|
|
38
|
+
: ''
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
{common?.[item.valueField] ?? ''}
|
|
56
42
|
</span>
|
|
57
|
-
|
|
43
|
+
{overallOrder?.needUpperCase && (
|
|
44
|
+
<span>
|
|
45
|
+
{common?.[item.valueField]
|
|
46
|
+
? coverDigit2Uppercase(common[item.valueField])
|
|
47
|
+
: ''}
|
|
48
|
+
</span>
|
|
49
|
+
)}
|
|
50
|
+
</div>
|
|
58
51
|
</div>
|
|
59
|
-
</
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
</td>
|
|
53
|
+
)
|
|
54
|
+
})}
|
|
55
|
+
</tr>
|
|
56
|
+
)
|
|
64
57
|
)
|
|
65
58
|
}
|
|
66
59
|
OverallOrder.propTypes = {
|
|
67
60
|
config: PropTypes.object.isRequired,
|
|
68
61
|
range: PropTypes.object.isRequired,
|
|
69
|
-
printerStore: PropTypes.object
|
|
70
|
-
isLastTablePage: PropTypes.bool
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
OverallOrder.defaultProps = {
|
|
74
|
-
isLastTablePage: true
|
|
62
|
+
printerStore: PropTypes.object
|
|
75
63
|
}
|
|
76
64
|
|
|
77
65
|
export default observer(OverallOrder)
|
package/src/util.js
CHANGED
|
@@ -233,16 +233,24 @@ const caclSingleDetailsPageHeight = (detailsHeights, curRemainPageHeight) => {
|
|
|
233
233
|
* @param {*} arr
|
|
234
234
|
*/
|
|
235
235
|
const getArrayMid = arr => {
|
|
236
|
+
let majority = 23
|
|
237
|
+
|
|
238
|
+
if (arr.length === 0) return majority
|
|
239
|
+
|
|
240
|
+
// 行数少时直接取最小行高,跳过多轮 Map 统计
|
|
241
|
+
if (arr.length <= 30) {
|
|
242
|
+
const min = Math.min(...arr)
|
|
243
|
+
if (min / 23 > 10) return 23
|
|
244
|
+
return min
|
|
245
|
+
}
|
|
246
|
+
|
|
236
247
|
/** 数组元素出现次数的集合 */
|
|
237
248
|
const mapArr = []
|
|
238
249
|
const map = new Map()
|
|
239
|
-
let majority = 23
|
|
240
250
|
/** 次数相同的元素集合 */
|
|
241
251
|
const majorityArr = []
|
|
242
252
|
const min = Math.min(...arr)
|
|
243
253
|
|
|
244
|
-
if (arr.length === 0) return majority
|
|
245
|
-
|
|
246
254
|
_.forEach(arr, (val, key) => {
|
|
247
255
|
if (map.has(val)) {
|
|
248
256
|
map.set(val, map.get(val) + 1)
|