@nstc-business/imes 1.0.25 → 1.0.27

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.25",
3
+ "version": "1.0.27",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -44,8 +44,16 @@
44
44
  v-bind="{ width: '150', align: 'center', 'show-overflow-tooltip': false, ...column }"
45
45
  >
46
46
  <template slot-scope="{ row }">
47
+ <!-- 满分值列:按录入原样展示,不做位数格式化 -->
48
+ <span v-if="column.isFullScore">
49
+ {{
50
+ row[column.prop]?.value || row[column.prop]?.value === 0
51
+ ? String(row[column.prop].value)
52
+ : ''
53
+ }}
54
+ </span>
47
55
  <!-- 手工录入的时候不显示调整框,显示手工录入的框,就是 sourceType为3-->
48
- <div v-if="row[column.prop]?.sourceType === 3">
56
+ <div v-else-if="row[column.prop]?.sourceType === 3">
49
57
  <span v-if="column.disabled">
50
58
  {{
51
59
  row[column.prop]?.value || row[column.prop]?.value === 0
@@ -126,6 +126,13 @@ export default {
126
126
  return text + suffix
127
127
  },
128
128
  displayValue(cell) {
129
+ // 满分值列:按录入原样展示,不做位数格式化
130
+ if (this.column.isFullScore) {
131
+ const val =
132
+ cell.result !== '' && cell.result != null ? cell.result : cell.value
133
+ if (val === '' || val == null) return ''
134
+ return String(val)
135
+ }
129
136
  if (this.column.disabled) {
130
137
  const val =
131
138
  cell.result !== '' && cell.result != null ? cell.result : cell.value
@@ -8,24 +8,9 @@
8
8
  <span v-if="showSerial">{{ index + 1 }}.</span>
9
9
  {{ block.statIndicatorName }}
10
10
  </span>
11
- <div class="stat-title-sums">
12
- <span
13
- v-for="(statResult, i2) in block.statsResultList"
14
- :key="i2"
15
- class="stat-sum-item"
16
- >
17
- <template
18
- v-if="statResult.statCalMethod == 1 && statResult.statShow == 1"
19
- >
20
- {{ statResult.name }}合计:
21
- {{
22
- statResult.statResult || statResult.statResult === 0
23
- ? Number(statResult.statResult).toFixed(digits)
24
- : ''
25
- }}
26
- </template>
27
- </span>
28
- </div>
11
+ <span v-if="subtotalText(block)" class="section-score-pill">
12
+ {{ subtotalText(block) }}
13
+ </span>
29
14
  </div>
30
15
 
31
16
  <el-table border :data="block.list" style="width: 100%">
@@ -56,7 +41,11 @@
56
41
  </template>
57
42
 
58
43
  <script>
59
- import { buildStatModelTables, hasStatPivotNodes } from './statModelHelper'
44
+ import {
45
+ buildStatModelTables,
46
+ hasStatPivotNodes,
47
+ sumStatBlockScores
48
+ } from './statModelHelper'
60
49
  import { showLevelSerial } from './helpers'
61
50
  import { withRequestTimestamp } from './api'
62
51
  import MeasureStatCell from './MeasureStatCell.vue'
@@ -100,6 +89,12 @@ export default {
100
89
  }
101
90
  },
102
91
  methods: {
92
+ subtotalText(block) {
93
+ if (!this.ctx.parentCalced) return '得分小计: --'
94
+ const total = sumStatBlockScores(block)
95
+ if (total === null) return '得分小计: --'
96
+ return `得分小计: ${Number(total).toFixed(this.digits)}`
97
+ },
103
98
  dynamicColumns(block) {
104
99
  return (block.columns || []).filter(c => c.prop !== 'name')
105
100
  },
@@ -174,15 +169,23 @@ export default {
174
169
  .stat-title {
175
170
  display: flex;
176
171
  align-items: center;
177
- height: 30px;
178
- margin-bottom: 8px;
172
+ flex-wrap: wrap;
173
+ gap: 8px;
179
174
  font-size: 15px;
175
+ font-weight: 600;
176
+ padding-left: 8px;
177
+ margin-bottom: 8px;
178
+ border-left: 3px solid #409eff;
180
179
  }
181
- .stat-title-sums {
182
- margin-left: auto;
183
- display: flex;
184
- gap: 12px;
180
+ .section-score-pill {
181
+ display: inline-block;
182
+ padding: 2px 10px;
183
+ font-size: 14px;
184
+ font-weight: 400;
185
185
  color: #606266;
186
+ line-height: 20px;
187
+ background: #f2f3f5;
188
+ border-radius: 4px;
186
189
  }
187
190
  .stat-loading,
188
191
  .stat-empty {
@@ -253,16 +253,11 @@ export function isShowFullScore(row) {
253
253
  return !row || row.showFullScore !== 0
254
254
  }
255
255
 
256
- /** 指标满分值展示 */
256
+ /** 指标满分值展示:按录入原样显示,不做位数/千分位格式化 */
257
257
  export function fullScoreText(row, modelWrap) {
258
258
  if (!isShowFullScore(row)) return ''
259
259
  if (!row || (row.fullScore !== 0 && !row.fullScore)) return ''
260
- const digits = digitsCalc(row, modelWrap)
261
- let val = Number(row.fullScore).toFixed(digits)
262
- if (row.showStyle === 2) {
263
- val = addThousands(val)
264
- }
265
- return val
260
+ return String(row.fullScore)
266
261
  }
267
262
 
268
263
  /** 指标原始值(优先 indicatorValText) */
@@ -424,6 +424,50 @@ export async function buildStatModelTables(treeData, fetchScoreMap, modelWrap) {
424
424
  return tables
425
425
  }
426
426
 
427
+ /** 行转列单元格得分:优先调整后得分 */
428
+ function cellScoreValue(cell) {
429
+ if (!cell) return null
430
+ if (
431
+ cell.modifyRank === 1 &&
432
+ cell.modifiedResult !== '' &&
433
+ cell.modifiedResult != null
434
+ ) {
435
+ return cell.modifiedResult
436
+ }
437
+ if (cell.result !== '' && cell.result != null) return cell.result
438
+ if (cell.value !== '' && cell.value != null && typeof cell.value !== 'object') {
439
+ return cell.value
440
+ }
441
+ return null
442
+ }
443
+
444
+ /**
445
+ * 统计模型文件夹得分小计:
446
+ * 只加总「是否参与计算」的统计项得分(指标取数取 xxx指标得分,其余取该列本身)
447
+ */
448
+ export function sumStatBlockScores(block) {
449
+ if (!block || !Array.isArray(block.list)) return null
450
+ const participating = (block.statsResultList || []).filter(
451
+ s => s && Number(s.statCalMethod) === 1
452
+ )
453
+ if (!participating.length) return null
454
+ let has = false
455
+ let total = 0
456
+ block.list.forEach(row => {
457
+ participating.forEach(stat => {
458
+ const prop =
459
+ Number(stat.calType) === 0 ? `${stat.name}指标得分` : stat.name
460
+ const val = cellScoreValue(row && row[prop])
461
+ if (val === null) return
462
+ const num = Number(val)
463
+ if (Number.isNaN(num)) return
464
+ has = true
465
+ total += num
466
+ })
467
+ })
468
+ return has ? total : null
469
+ }
470
+
427
471
  /** 统计模型:isLeaf=2 节点预处理 indicatorDeepList(参考 evaluateModelCalcTest.recursionFn) */
428
472
  export function preprocessStatIndicatorDeepList(nodes) {
429
473
  if (!Array.isArray(nodes)) return