@nstc-business/imes 1.0.17 → 1.0.18

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.17",
3
+ "version": "1.0.18",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -191,6 +191,12 @@
191
191
  <span v-if="section.remark" class="section-remark">
192
192
  备注:<span class="remark-html" v-html="section.remark"></span>
193
193
  </span>
194
+ <span
195
+ v-if="sectionWeightText(section)"
196
+ class="section-weight-pill"
197
+ >
198
+ {{ sectionWeightText(section) }}
199
+ </span>
194
200
  <span
195
201
  v-if="sectionScoreText(section)"
196
202
  class="section-score-pill"
@@ -644,11 +650,11 @@ export default {
644
650
  this.leafList = leafList
645
651
  this.qualList = qualList
646
652
  this.subModelList = subModelList
653
+ // 仅以模型级测算结果 / 日志为准;分组节点 result 默认 0 不能当作已测算
647
654
  this.parentCalced = !!(
648
655
  this.logId ||
649
656
  this.model.logId ||
650
- (this.model.result !== '' && this.model.result != null) ||
651
- (root.result !== '' && root.result != null)
657
+ (this.model.result !== '' && this.model.result != null)
652
658
  )
653
659
  this.qualSelectionDraft = {}
654
660
  this.resultText = this.model.resultText || root.resultText || ''
@@ -1309,11 +1315,74 @@ export default {
1309
1315
  return `总得分: ${totalText} = ${parts.join(' + ')}`
1310
1316
  },
1311
1317
 
1312
- /** 分区标题旁得分(评价模型测算后) */
1318
+ /**
1319
+ * 收集参与总权重计算的叶子:指标 / 子模型(文件夹只下钻,不参与)
1320
+ * 公式:满分值 * 占模型权重%
1321
+ */
1322
+ collectWeightContributors(nodes, bucket = []) {
1323
+ if (!Array.isArray(nodes)) return bucket
1324
+ nodes.forEach(n => {
1325
+ if (!n) return
1326
+ if (this.isSubModel(n) || isIndicator(n)) {
1327
+ if (
1328
+ (n.fullScore === 0 || n.fullScore) &&
1329
+ (n.weight === 0 || n.weight)
1330
+ ) {
1331
+ bucket.push(n)
1332
+ }
1333
+ return
1334
+ }
1335
+ if (n.children && n.children.length) {
1336
+ this.collectWeightContributors(n.children, bucket)
1337
+ }
1338
+ })
1339
+ return bucket
1340
+ },
1341
+
1342
+ /**
1343
+ * 大分组总权重文案:总权重: 75.00(不展示计算过程)
1344
+ */
1345
+ buildGroupWeightText(groupNode, children) {
1346
+ if (!groupNode) return ''
1347
+ const contributors = this.collectWeightContributors(
1348
+ children || groupNode.children || []
1349
+ )
1350
+ let total = null
1351
+ if (contributors.length) {
1352
+ total = contributors.reduce((sum, n) => {
1353
+ const full = Number(n.fullScore)
1354
+ const weight = Number(n.weight)
1355
+ return (
1356
+ sum +
1357
+ ((Number.isNaN(full) ? 0 : full) *
1358
+ (Number.isNaN(weight) ? 0 : weight)) /
1359
+ 100
1360
+ )
1361
+ }, 0)
1362
+ } else if (groupNode.fullScore === 0 || groupNode.fullScore) {
1363
+ total = groupNode.fullScore
1364
+ }
1365
+ if (total === null) return ''
1366
+ return `总权重: ${this.formatScoreNum(total)}`
1367
+ },
1368
+
1369
+ /** 分区标题旁总权重(评价模型且开启显示权重) */
1370
+ sectionWeightText(section) {
1371
+ if (!this.evalRootModel || !section) return ''
1372
+ if (this.model.showWeight !== 1) return ''
1373
+ if (!section.container || this.isSubModel(section.container)) return ''
1374
+ return this.buildGroupWeightText(section.container, section.nodes)
1375
+ },
1376
+
1377
+ /** 分区标题旁得分(评价模型:未测算显示 --) */
1313
1378
  sectionScoreText(section) {
1314
- if (!this.evalRootModel || !this.parentCalced || !section) return ''
1379
+ if (!this.evalRootModel || !section) return ''
1315
1380
  if (!section.container || this.isSubModel(section.container)) return ''
1316
- return this.buildGroupScoreText(section.container, section.nodes)
1381
+ if (!this.parentCalced) return '总得分: --'
1382
+ return (
1383
+ this.buildGroupScoreText(section.container, section.nodes) ||
1384
+ '总得分: --'
1385
+ )
1317
1386
  },
1318
1387
 
1319
1388
  /**
@@ -1514,6 +1583,7 @@ export default {
1514
1583
  padding-left: 8px;
1515
1584
  border-left: 3px solid #409eff;
1516
1585
  }
1586
+ .section-weight-pill,
1517
1587
  .section-score-pill {
1518
1588
  display: inline-block;
1519
1589
  margin-left: 4px;