@nstc-business/imes 1.0.14 → 1.0.15

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": "@nstc-business/imes",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  * modifyRank:0 不调整 1 调整指标得分 2 调整指标值
10
10
  */
11
11
  import { toFixedTrunc, addThousands } from '../common'
12
- import { statItemChildren } from './statModelHelper'
12
+ import { resolveManualFillValue, statItemChildren } from './statModelHelper'
13
13
 
14
14
  export const ITEM_TYPE = {
15
15
  CALC_MODEL: 11,
@@ -362,6 +362,12 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
362
362
  node.modifiedResult = node.result
363
363
  }
364
364
  }
365
+ // 手工填报:输入框绑定 value,需从接口字段回填(旧版 itemDataFn 同逻辑)
366
+ if (node.sourceType === 3 && !isQualIndicator(node)) {
367
+ if (node.value === '' || node.value == null) {
368
+ node.value = resolveManualFillValue(node)
369
+ }
370
+ }
365
371
  if (node.modifyRank === 2 && !isQualIndicator(node)) {
366
372
  if (node.value === '' || node.value == null) {
367
373
  node.value = node.indicatorResult
@@ -377,10 +383,7 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
377
383
  if (!item.itemID) return
378
384
  if (!item._rowKey) item._rowKey = `mk_${_uid++}`
379
385
  if (item.sourceType === 3 && (item.value === '' || item.value == null)) {
380
- item.value =
381
- item.indicatorResult != null && item.indicatorResult !== ''
382
- ? item.indicatorResult
383
- : item.defaultVal ?? ''
386
+ item.value = resolveManualFillValue(item)
384
387
  }
385
388
  if (item.modifyRank === 2 && !isQualIndicator(item)) {
386
389
  if (item.value === '' || item.value == null) {
@@ -4,11 +4,29 @@
4
4
  * statCalResult 仅作辅助元数据(列配置/标题/合计),不作为是否行转列的判断条件
5
5
  */
6
6
 
7
+ function hasFilledValue(val) {
8
+ return val !== '' && val != null && val !== undefined
9
+ }
10
+
11
+ /**
12
+ * 手工填报指标值回显:
13
+ * 优先 indicatorValText / indicatorResult(与旧版 itemDataFn 一致),
14
+ * 测算日志场景常只落 result,最后回退 defaultVal。
15
+ */
16
+ export function resolveManualFillValue(item) {
17
+ if (!item) return ''
18
+ if (hasFilledValue(item.indicatorValText)) return item.indicatorValText
19
+ if (hasFilledValue(item.indicatorResult)) return item.indicatorResult
20
+ if (hasFilledValue(item.result)) return item.result
21
+ if (hasFilledValue(item.defaultVal)) return item.defaultVal
22
+ return item.defaultVal ?? ''
23
+ }
24
+
7
25
  function resolveCellValue(item, optionList) {
8
26
  let value = ''
9
27
  switch (item.sourceType) {
10
28
  case 3:
11
- value = item.indicatorResult
29
+ value = resolveManualFillValue(item)
12
30
  break
13
31
  case 0:
14
32
  value = {}
@@ -38,10 +56,7 @@ function resolveCellValue(item, optionList) {
38
56
  function applyCellValue(item, optionList) {
39
57
  if (item.sourceType === 3) {
40
58
  if (item.value === '' || item.value == null || item.value === undefined) {
41
- item.value =
42
- item.indicatorResult != null && item.indicatorResult !== ''
43
- ? item.indicatorResult
44
- : item.defaultVal ?? ''
59
+ item.value = resolveManualFillValue(item)
45
60
  }
46
61
  return
47
62
  }
package/src/index.js CHANGED
@@ -19,7 +19,7 @@ if (typeof window !== 'undefined' && window.Vue) {
19
19
  }
20
20
 
21
21
  export default {
22
- version: '1.0.14',
22
+ version: '1.0.15',
23
23
  install,
24
24
  ModelCalculate,
25
25
  MeasureCalc,