@nstc-business/imes 1.1.3 → 1.1.4

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.1.3",
3
+ "version": "1.1.4",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -521,7 +521,36 @@ export function isQualOnlyNodes(nodes) {
521
521
  if (!Array.isArray(nodes) || !nodes.length) return false
522
522
  return nodes.every(isQualIndicator)
523
523
  }
524
+ /**
525
+ * 调整项=指标得分:未调整(modifiedResult 为空)时默认回显计算得分
526
+ * 时间:2026-10-22 人员:Qoder && 辛善露
527
+ * 入参:node 指标节点
528
+ * 出参:无(就地回填 modifiedResult)
529
+ * 方法内容:仅处理 modifyRank===1 且存在计算得分的节点;已调整值(含 0)不覆盖
530
+ */
531
+ export function fillDefaultModifiedResult(node) {
532
+ if (!node) return
533
+ if (node.modifyRank !== 1) return
534
+ if (node.result === '' || node.result == null) return
535
+ if (node.modifiedResult === '' || node.modifiedResult == null) {
536
+ node.modifiedResult = node.result
537
+ }
538
+ }
524
539
 
540
+ /**
541
+ * 判断两个得分是否相同(按展示精度)
542
+ * 时间:2026-10-22 人员:Qoder && 辛善露
543
+ * 入参:a、b 得分值(字符串或数字)
544
+ * 出参:boolean
545
+ * 方法内容:任一为空返回 false;转数字后按 SCORE_DIGITS 位四舍五入比较,避免 5 与 5.00 被判为不同
546
+ */
547
+ export function isSameScore(a, b) {
548
+ if (a === '' || a == null || b === '' || b == null) return false
549
+ const na = Number(a)
550
+ const nb = Number(b)
551
+ if (Number.isNaN(na) || Number.isNaN(nb)) return false
552
+ return na.toFixed(SCORE_DIGITS) === nb.toFixed(SCORE_DIGITS)
553
+ }
525
554
  let _uid = 0
526
555
  /**
527
556
  * 归一化整棵树:
@@ -536,11 +565,7 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
536
565
  node._rowKey = `mk_${_uid++}`
537
566
  node.children = Array.isArray(node.children) ? node.children : []
538
567
  if (isIndicator(node)) {
539
- if (node.modifyRank === 1 && (node.result || node.result === 0)) {
540
- if (node.modifiedResult === '' || node.modifiedResult == null) {
541
- node.modifiedResult = node.result
542
- }
543
- }
568
+ fillDefaultModifiedResult(node)
544
569
  // 手工填报:输入框绑定 value,需从接口字段回填(旧版 itemDataFn 同逻辑)
545
570
  if (node.sourceType === 3 && !isQualIndicator(node)) {
546
571
  if (node.value === '' || node.value == null) {
@@ -563,6 +588,7 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
563
588
  statItemChildren(node).forEach(item => {
564
589
  if (!item.itemID) return
565
590
  if (!item._rowKey) item._rowKey = `mk_${_uid++}`
591
+ fillDefaultModifiedResult(item)
566
592
  if (item.sourceType === 3 && (item.value === '' || item.value == null)) {
567
593
  item.value = resolveManualFillValue(item)
568
594
  }
@@ -254,7 +254,9 @@ import {
254
254
  formatScoreText,
255
255
  formatDisplayModelResult,
256
256
  resolveCalcEchoValue,
257
- shouldApplyModifiedVal
257
+ shouldApplyModifiedVal,
258
+ fillDefaultModifiedResult,
259
+ isSameScore
258
260
  } from './helpers'
259
261
  import { preprocessStatIndicatorDeepList, mergeStatModelNode, statItemChildren } from './statModelHelper'
260
262
  import { withRequestTimestamp ,getCommonEnum } from './api'
@@ -981,7 +983,8 @@ export default {
981
983
  item.result !== '' &&
982
984
  item.result !== null &&
983
985
  item.modifyRank === 1 &&
984
- (item.modifiedResult || item.modifiedResult === 0)
986
+ (item.modifiedResult || item.modifiedResult === 0) &&
987
+ !isSameScore(item.modifiedResult, item.result)
985
988
  ) {
986
989
  calcItem.modifiedResult = item.modifiedResult
987
990
  hasCalc = true
@@ -1400,6 +1403,8 @@ export default {
1400
1403
  if (echoValue !== undefined) {
1401
1404
  this.$set(target, 'value', echoValue)
1402
1405
  }
1406
+ // 调整项=指标得分:未调整时默认回显计算得分,避免被后端 null 覆盖为空白
1407
+ fillDefaultModifiedResult(target)
1403
1408
  },
1404
1409
 
1405
1410
  /** 整体测算结果回填:叶子指标 + 子模型节点 */
@@ -1576,7 +1581,7 @@ export default {
1576
1581
  if (!node) return
1577
1582
  this.$set(node, '_statTableVersion', (node._statTableVersion || 0) + 1)
1578
1583
  },
1579
- /** 加载报表月份枚举:sessionStorage 缓存优先,接口失败降级内置 1-12 月 */
1584
+ /** 加载报表月份枚举:sessionStorage 缓存优先*/
1580
1585
  async loadReportMonthOptions() {
1581
1586
  try {
1582
1587
  const cached = window.sessionStorage.getItem('imes_reportMonthEnum')
@@ -1588,8 +1593,10 @@ export default {
1588
1593
  const list = (code === 200 && data && data.reportMonth) || []
1589
1594
  this.reportMonthOptions = list.length
1590
1595
  ? list.map(item => ({ value: item.code, label: item.name }))
1591
- : FALLBACK_MONTH_OPTIONS
1592
- window.sessionStorage.setItem('imes_reportMonthEnum', JSON.stringify(this.reportMonthOptions))
1596
+ : []
1597
+ if(this.reportMonthOptions?.length > 0){
1598
+ window.sessionStorage.setItem('imes_reportMonthEnum', JSON.stringify(this.reportMonthOptions))
1599
+ }
1593
1600
  } catch (e) {
1594
1601
  console.warn('[measureCalc] 报表月份枚举加载失败,', e)
1595
1602
  }