gm-printer 10.41.9 → 10.41.10-beta.161

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.41.9",
3
+ "version": "10.41.10-beta.161",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -19,14 +19,33 @@ export function buildDataKey(prefix, suffix) {
19
19
  return `${prefix}${suffix}`
20
20
  }
21
21
 
22
- /** 下拉选中「按明细单行」时的 value(detail_one_row) */
22
+ /** 下拉选中「按明细单行」时的 value(detail_one_row),可带 category/multi 等后缀 */
23
23
  export function isDetailOneRowSelectKey(dataKey) {
24
- return getDataKeySuffix(dataKey) === 'detail_one_row'
24
+ const suffix = getDataKeySuffix(dataKey)
25
+ return suffix === 'detail_one_row' || suffix.startsWith('detail_one_row_')
25
26
  }
26
27
 
28
+ /** 独立滚动明细单行(sku/address),可带 category/multi 等后缀 */
27
29
  export function isIndependentRolDataKey(dataKey) {
28
30
  const suffix = getDataKeySuffix(dataKey)
29
- return suffix === 'independent_rol_sku' || suffix === 'independent_rol_address'
31
+ return (
32
+ suffix === 'independent_rol_sku' ||
33
+ suffix === 'independent_rol_address' ||
34
+ suffix.startsWith('independent_rol_sku_') ||
35
+ suffix.startsWith('independent_rol_address_')
36
+ )
37
+ }
38
+
39
+ /**
40
+ * 从现有 dataKey 抽出可叠加修饰后缀(category / multi)
41
+ * 用于切换 goods/merchant 排序时保留右键「商品分类」「双栏」状态
42
+ */
43
+ export function getDataKeyModifierSuffix(dataKey) {
44
+ const parts = getDataKeySuffix(dataKey).split('_').filter(Boolean)
45
+ const modifiers = []
46
+ if (parts.includes('category')) modifiers.push('category')
47
+ if (parts.includes('multi')) modifiers.push('multi')
48
+ return modifiers.length ? `_${modifiers.join('_')}` : ''
30
49
  }
31
50
 
32
51
  export function isLastColDataKey(dataKey) {
@@ -6,6 +6,7 @@ import { dispatchMsg, getBlockName, exchange, getColSpanLength } from '../util'
6
6
  import { accountRadioList } from './util'
7
7
  import {
8
8
  buildDataKey,
9
+ getDataKeyModifierSuffix,
9
10
  getDataKeyPrefix,
10
11
  isDetailOneRowSelectKey,
11
12
  isIndependentRolDataKey
@@ -1393,13 +1394,16 @@ class EditorStore {
1393
1394
  const arr = this.selectedRegion.split('.')
1394
1395
  const table = this.config.contents[arr[2]]
1395
1396
  const prefix = getDataKeyPrefix(table.dataKey)
1397
+ // 切换「按商品/按商户排序」时保留已开启的商品分类、双栏后缀,避免点完分类再切排序把 category 冲掉
1398
+ const baseSuffix = dataKey === 'goods' ? 'independent_rol_sku' : 'independent_rol_address'
1399
+ const nextDataKey = buildDataKey(
1400
+ prefix,
1401
+ `${baseSuffix}${getDataKeyModifierSuffix(table.dataKey)}`
1402
+ )
1396
1403
 
1397
1404
  set(table, {
1398
1405
  purchaseSettingKey: dataKey,
1399
- dataKey:
1400
- dataKey === 'goods'
1401
- ? buildDataKey(prefix, 'independent_rol_sku')
1402
- : buildDataKey(prefix, 'independent_rol_address'),
1406
+ dataKey: nextDataKey,
1403
1407
  detail_sort_type: 0
1404
1408
  })
1405
1409
  }
@@ -1421,7 +1425,8 @@ class EditorStore {
1421
1425
  const table = this.config.contents[arr[2]]
1422
1426
 
1423
1427
  const { dataKey } = table
1424
- if (isIndependentRolDataKey(dataKey)) {
1428
+ // independent_rol_* / detail_one_row_*(含 category、multi 后缀)在下拉里都映射回「按采购明细单行」
1429
+ if (isIndependentRolDataKey(dataKey) || isDetailOneRowSelectKey(dataKey)) {
1425
1430
  return buildDataKey(getDataKeyPrefix(dataKey), 'detail_one_row')
1426
1431
  }
1427
1432
  return dataKey
@@ -16,7 +16,9 @@ import _ from 'lodash'
16
16
  import { inject, observer } from 'mobx-react'
17
17
  import {
18
18
  buildDataKey,
19
+ getDataKeyModifierSuffix,
19
20
  getDataKeyPrefix,
21
+ getDataKeySuffix,
20
22
  isDetailOneRowSelectKey,
21
23
  } from '../common/data_key_util'
22
24
 
@@ -90,19 +92,23 @@ class TableDetailEditor extends React.Component {
90
92
  .replace(/{{([^.\s}]+)}}/g, '{{列.$1}}')
91
93
  }
92
94
  const prefix = getDataKeyPrefix(config.dataKey)
93
- const rolSkuKey = buildDataKey(prefix, 'independent_rol_sku')
94
- const rolAddressKey = buildDataKey(prefix, 'independent_rol_address')
95
+ const curSuffix = getDataKeySuffix(config.dataKey)
96
+ const modifier = getDataKeyModifierSuffix(config.dataKey)
97
+ // 已是对应 independent_rol_*(含 category/multi)则不再重设,避免冲掉商品分类
95
98
  if (
96
99
  config.purchaseSettingKey === 'goods' &&
97
- config.dataKey !== rolSkuKey
100
+ !curSuffix.startsWith('independent_rol_sku')
98
101
  ) {
99
- editStore.setPurchaseTableKey(rolSkuKey, addFields.specialTableConfig)
102
+ editStore.setPurchaseTableKey(
103
+ buildDataKey(prefix, `independent_rol_sku${modifier}`),
104
+ addFields.specialTableConfig
105
+ )
100
106
  } else if (
101
107
  config.purchaseSettingKey === 'merchant' &&
102
- config.dataKey !== rolAddressKey
108
+ !curSuffix.startsWith('independent_rol_address')
103
109
  ) {
104
110
  editStore.setPurchaseTableKey(
105
- rolAddressKey,
111
+ buildDataKey(prefix, `independent_rol_address${modifier}`),
106
112
  addFields.specialTableConfig
107
113
  )
108
114
  }
@@ -7,7 +7,10 @@ import {
7
7
  getArrayMid,
8
8
  getOverallOrderTrHeight
9
9
  } from '../util'
10
- import { isIndependentRolDataKey } from '../common/data_key_util'
10
+ import {
11
+ isDetailOneRowSelectKey,
12
+ isIndependentRolDataKey
13
+ } from '../common/data_key_util'
11
14
  import _ from 'lodash'
12
15
  import Big from 'big.js'
13
16
  import { Tip } from '../components'
@@ -628,13 +631,12 @@ class PrinterStore {
628
631
  */
629
632
  templateTableRowSpan(text, dataKey, index, begin) {
630
633
  try {
631
- // 采购 / 分拣「按明细单行」展开后才做合并单元格(后缀 independent_rol_*)
634
+ // 采购 / 分拣「按明细单行」展开后才做合并单元格(后缀 independent_rol_* / detail_one_row_*,含 category)
632
635
  const canMerge =
633
636
  isIndependentRolDataKey(dataKey) ||
637
+ isDetailOneRowSelectKey(dataKey) ||
634
638
  dataKey === 'taxRateSales' ||
635
- dataKey === 'ordinary' ||
636
- dataKey === 'purchase_detail_one_row' ||
637
- dataKey === 'sorting_detail_detail_one_row'
639
+ dataKey === 'ordinary'
638
640
  if (!canMerge) {
639
641
  return null
640
642
  }