@nstc-business/imes 1.0.29 → 1.0.30

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.29",
3
+ "version": "1.0.30",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -505,3 +505,30 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
505
505
  })
506
506
  return { leafList, qualList }
507
507
  }
508
+
509
+ function hasEchoValue(val) {
510
+ return val !== '' && val != null && val !== undefined
511
+ }
512
+
513
+ /**
514
+ * 测算结果回写到输入框的值。
515
+ * 手工填报必须回显 indicatorResult;不能用 modifiedVal。
516
+ * 后端日志在未调整时会把 null 格式化成 0,若写回 value 会把已填指标值冲成 0。
517
+ * 时间:2026-09-05;人员:AI && 徐红飞;入参:target/source 节点;出参:回显值或 undefined;方法内容:按取数来源/调整项选择回显字段
518
+ */
519
+ export function resolveCalcEchoValue(target, source) {
520
+ if (!target || !source) return undefined
521
+ if (target.sourceType === 3 && !isQualIndicator(target)) {
522
+ if (hasEchoValue(source.indicatorResult)) return source.indicatorResult
523
+ return undefined
524
+ }
525
+ if (target.itemType !== 22 && Number(target.modifyRank) === 2 && hasEchoValue(source.modifiedVal)) {
526
+ return source.modifiedVal
527
+ }
528
+ return undefined
529
+ }
530
+
531
+ /** 非「调整指标值」时,日志里的 modifiedVal=0 不是真实调整,不能覆盖到节点 */
532
+ export function shouldApplyModifiedVal(target, source) {
533
+ return !!(target && source && Number(target.modifyRank) === 2 && hasEchoValue(source.modifiedVal))
534
+ }
@@ -215,7 +215,9 @@ import {
215
215
  isStatRootModel as checkStatRootModel,
216
216
  subModelResultText as formatSubModelResult,
217
217
  saveSubModelValueText,
218
- formatScoreText
218
+ formatScoreText,
219
+ resolveCalcEchoValue,
220
+ shouldApplyModifiedVal
219
221
  } from './helpers'
220
222
  import { preprocessStatIndicatorDeepList, mergeStatModelNode, statItemChildren } from './statModelHelper'
221
223
  import { withRequestTimestamp } from './api'
@@ -1290,7 +1292,6 @@ export default {
1290
1292
  'calcLogs',
1291
1293
  'relFormula',
1292
1294
  'displayFormula',
1293
- 'modifiedVal',
1294
1295
  'modifiedResult'
1295
1296
  ]
1296
1297
  fields.forEach(key => {
@@ -1298,8 +1299,13 @@ export default {
1298
1299
  this.$set(target, key, source[key])
1299
1300
  }
1300
1301
  })
1301
- if (target.itemType !== 22 && (source.modifiedVal || source.modifiedVal === 0)) {
1302
- this.$set(target, 'value', source.modifiedVal)
1302
+ // 未调整时后端 modifiedVal 常为 0,不能覆盖手工填报的指标值
1303
+ if (shouldApplyModifiedVal(target, source)) {
1304
+ this.$set(target, 'modifiedVal', source.modifiedVal)
1305
+ }
1306
+ const echoValue = resolveCalcEchoValue(target, source)
1307
+ if (echoValue !== undefined) {
1308
+ this.$set(target, 'value', echoValue)
1303
1309
  }
1304
1310
  },
1305
1311