@nstc-business/imes 1.0.14 → 1.0.16

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.16",
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,
@@ -152,12 +152,9 @@ export function digitsCalc(row, modelWrap) {
152
152
  return modelWrap ? modelWrap.digits : 2
153
153
  }
154
154
 
155
- /** 指标得分展示 */
155
+ /** 指标得分 / 模型指标系数数值展示(始终用 result,字段值只在「指标值」列展示) */
156
156
  export function resultByShowStyle(row, modelWrap) {
157
157
  let val = ''
158
- if (row.sourceType === 5 && row.showValueType === 1) {
159
- return row.fieldValue
160
- }
161
158
  const digits = digitsCalc(row, modelWrap)
162
159
  if (row.showStyle === 2) {
163
160
  val =
@@ -362,6 +359,12 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
362
359
  node.modifiedResult = node.result
363
360
  }
364
361
  }
362
+ // 手工填报:输入框绑定 value,需从接口字段回填(旧版 itemDataFn 同逻辑)
363
+ if (node.sourceType === 3 && !isQualIndicator(node)) {
364
+ if (node.value === '' || node.value == null) {
365
+ node.value = resolveManualFillValue(node)
366
+ }
367
+ }
365
368
  if (node.modifyRank === 2 && !isQualIndicator(node)) {
366
369
  if (node.value === '' || node.value == null) {
367
370
  node.value = node.indicatorResult
@@ -377,10 +380,7 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
377
380
  if (!item.itemID) return
378
381
  if (!item._rowKey) item._rowKey = `mk_${_uid++}`
379
382
  if (item.sourceType === 3 && (item.value === '' || item.value == null)) {
380
- item.value =
381
- item.indicatorResult != null && item.indicatorResult !== ''
382
- ? item.indicatorResult
383
- : item.defaultVal ?? ''
383
+ item.value = resolveManualFillValue(item)
384
384
  }
385
385
  if (item.modifyRank === 2 && !isQualIndicator(item)) {
386
386
  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.16',
23
23
  install,
24
24
  ModelCalculate,
25
25
  MeasureCalc,