@nstc-business/imes 1.0.20 → 1.0.21

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.20",
3
+ "version": "1.0.21",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -101,8 +101,20 @@
101
101
  label-width="10em"
102
102
  v-if="modelData.sataMode !== 1"
103
103
  >
104
- <el-form-item label="模型得分:" v-if="modelData.type === 1">
105
- <span>{{ modelData.result.toFixed(modelData.digits) }}</span>
104
+ <el-form-item
105
+ label="模型得分:"
106
+ v-if="
107
+ modelData.type === 1 ||
108
+ (modelData.type === 3 && modelData.sataMode === 2)
109
+ "
110
+ >
111
+ <span>
112
+ {{
113
+ modelData.result || modelData.result === 0
114
+ ? Number(modelData.result).toFixed(modelData.digits)
115
+ : '--'
116
+ }}
117
+ </span>
106
118
  </el-form-item>
107
119
  <el-form-item label="模型结果:" v-if="modelData.type !== 3">
108
120
  <span>{{ modelData.resultText }}</span>
@@ -79,7 +79,8 @@ export default {
79
79
  methods: {
80
80
  displayValue(cell) {
81
81
  if (this.column.disabled) {
82
- const val = cell.result
82
+ const val =
83
+ cell.result !== '' && cell.result != null ? cell.result : cell.value
83
84
  if (val === '' || val == null) return ''
84
85
  let text = Number(val).toFixed(this.digits)
85
86
  if (cell.showStyle === 2) {
@@ -114,6 +114,30 @@ export default {
114
114
  return []
115
115
  }
116
116
  },
117
+ /** 嵌套统计模型时父模没有 modelStatsSetupVOS,按子模型 ID 拉取统计项配置 */
118
+ async ensureModelStatsSetup(modelWrap) {
119
+ const existing =
120
+ (modelWrap && modelWrap.modelStatsSetupVOS) ||
121
+ (this.subModel && this.subModel.modelStatsSetupVOS)
122
+ if (Array.isArray(existing) && existing.length) return existing
123
+ const id =
124
+ (this.subModel && (this.subModel.itemID || this.subModel.modelID)) ||
125
+ (modelWrap && modelWrap.modelID)
126
+ if (!id) return null
127
+ try {
128
+ const { code, data } = await this.$axios.post(
129
+ withRequestTimestamp('/imes/v1/indicatorModel/getModelById'),
130
+ { id }
131
+ )
132
+ if (code === 0 && data && Array.isArray(data.modelStatsSetupVOS)) {
133
+ this.$set(this.subModel, 'modelStatsSetupVOS', data.modelStatsSetupVOS)
134
+ return data.modelStatsSetupVOS
135
+ }
136
+ } catch (e) {
137
+ /* ignore */
138
+ }
139
+ return null
140
+ },
117
141
  async loadTables() {
118
142
  if (!this.subModel || !hasStatPivotNodes(this.subModel)) {
119
143
  this.tableData = []
@@ -121,10 +145,16 @@ export default {
121
145
  }
122
146
  this.loading = true
123
147
  try {
148
+ const modelWrap = this.ctx.modelWrap || {}
149
+ await this.ensureModelStatsSetup(modelWrap)
124
150
  this.tableData = await buildStatModelTables(
125
151
  this.subModel,
126
152
  id => this.fetchScoreMap(id),
127
- this.ctx.modelWrap
153
+ {
154
+ ...modelWrap,
155
+ modelStatsSetupVOS:
156
+ this.subModel.modelStatsSetupVOS || modelWrap.modelStatsSetupVOS
157
+ }
128
158
  )
129
159
  } finally {
130
160
  this.loading = false
@@ -89,9 +89,9 @@ export const SUB_MODEL_LABEL = '测算子模型'
89
89
  /** 子模型独立测算按钮文案 */
90
90
  export const SUB_MODEL_CALC_BTN = '子模型测算'
91
91
 
92
- /** 子模型测算结果展示(优先 resultText,否则格式化 result) 统计模型没有测算结果*/
92
+ /** 子模型测算结果展示(优先 resultText,否则格式化 result) */
93
93
  export function subModelResultText(row, modelWrap) {
94
- if (!row || row.itemType ===13) return ''
94
+ if (!row) return ''
95
95
  if (row.resultText != null && row.resultText !== '') {
96
96
  return row.resultText
97
97
  }
@@ -47,7 +47,7 @@
47
47
  </span>
48
48
  <span class="meta-item">
49
49
  <span class="meta-label">测算结果</span>
50
- <span class="meta-value meta-result">{{ resultText || '--' }}</span>
50
+ <span class="meta-value meta-result">{{ displayResultText }}</span>
51
51
  </span>
52
52
  </div>
53
53
 
@@ -386,18 +386,29 @@ export default {
386
386
  statRootModel() {
387
387
  return checkStatRootModel(this.model)
388
388
  },
389
- /** 顶层统计模型的根节点 */
389
+ /** 顶层统计模型的根节点(必须返回原引用,保证 _statTableVersion 能触发子表刷新) */
390
390
  statRootNode() {
391
391
  const root = this.model.modelTreeVO || {}
392
- return {
393
- ...root,
394
- itemID: root.itemID || root.modelID || this.model.modelID
392
+ const itemID = root.itemID || root.modelID || this.model.modelID
393
+ if (itemID && root.itemID !== itemID) {
394
+ this.$set(root, 'itemID', itemID)
395
395
  }
396
+ return root
396
397
  },
397
398
  modelVersionText() {
398
399
  if (this.model.version === '' || this.model.version == null) return '--'
399
400
  return `版本${this.model.version}`
400
401
  },
402
+ /** 测算结果展示:优先 resultText,统计模型计算模式可回退到 result */
403
+ displayResultText() {
404
+ if (this.resultText !== '' && this.resultText != null) {
405
+ return this.resultText
406
+ }
407
+ if (this.calcResult !== '' && this.calcResult != null) {
408
+ return this.calcResult
409
+ }
410
+ return '--'
411
+ },
401
412
  /** 评价模型展示「模型得分」,计算模型展示「模型公式」 */
402
413
  formulaRowLabel() {
403
414
  if (this.evalRootModel) return '模型得分:'
@@ -1077,7 +1088,7 @@ export default {
1077
1088
  this.businessModuleRemark =resData.businessModuleRemark
1078
1089
  this.$set(this.model, 'logId', resData.logId || '')
1079
1090
  this.$set(this.model, 'maxReportTem', resData.maxReportTem || '')
1080
- this.$emit('calcResult', resData.resultText)
1091
+ this.$emit('calcResult', this.displayResultText === '--' ? resData.resultText : this.displayResultText)
1081
1092
  this.$emit('getLogId', resData.logId)
1082
1093
  this.$emit('calcComplete', {
1083
1094
  ...resData,
@@ -112,12 +112,26 @@ export function hasStatPivotData(statNode) {
112
112
 
113
113
  /**
114
114
  * calType:0=指标取数(展示「xxx指标值/指标得分」),非 0(如 9=统计项运算)只展示统计项名。
115
- * 树节点通常只有 rankType,缺 calType 时用 rankType 推断,避免「平均」被当成指标取数导致列重复。
115
+ *
116
+ * 注意:指标取数节点落库时 rankType 常是「指标自身打分规则」,不是统计项 calType
117
+ *(见 statisticModel createIndicatorWithData: rankType = deepItem.rankType || calType)。
118
+ * 因此不能把 rankType 直接当 calType;有指标类型/itemID 时应视为指标取数(0)。
116
119
  */
117
120
  function resolveStatCalType(statLike) {
118
121
  if (!statLike) return 0
119
- if (statLike.calType !== '' && statLike.calType != null) return statLike.calType
120
- if (statLike.rankType !== '' && statLike.rankType != null) return statLike.rankType
122
+ if (statLike.calType !== '' && statLike.calType != null) {
123
+ return Number(statLike.calType)
124
+ }
125
+ const itemType = Number(statLike.itemType)
126
+ if (itemType === 21 || itemType === 22) return 0
127
+ // 无关联指标:保存时 rankType === 统计项 calType(如 9=统计项运算)
128
+ if (!statLike.itemID) {
129
+ if (statLike.rankType !== '' && statLike.rankType != null) {
130
+ return Number(statLike.rankType)
131
+ }
132
+ }
133
+ // 有 itemID 的统计项按指标取数处理
134
+ if (statLike.itemID) return 0
121
135
  return 0
122
136
  }
123
137
 
@@ -292,7 +306,8 @@ export async function buildStatModelTables(treeData, fetchScoreMap, modelWrap) {
292
306
  align: 'center',
293
307
  slotName: label
294
308
  })
295
- if (statMeta.statShow == 1 && statMeta.calType == 0) {
309
+ // 测算页始终展示指标得分列;statShow 仅约束业务端(授信等)是否展示
310
+ if (statMeta.calType == 0) {
296
311
  columns.push({
297
312
  label: item.statsName + '指标得分',
298
313
  prop: item.statsName + '指标得分',
@@ -326,12 +341,22 @@ export async function buildStatModelTables(treeData, fetchScoreMap, modelWrap) {
326
341
  statMeta.calType == 0
327
342
  ? item.statsName + '指标值'
328
343
  : item.statsName
329
- applyCellValue(item, optionList)
344
+ // 非手工填报:每次重建表格都取最新测算值;手工填报保留用户已输入
345
+ if (item.sourceType === 3) {
346
+ applyCellValue(item, optionList)
347
+ } else {
348
+ item.value = resolveCellValue(item, optionList)
349
+ }
330
350
  listItem[label] = item
331
351
  if (statMeta.calType == 0) {
352
+ const scoreVal =
353
+ item.result !== '' && item.result != null
354
+ ? item.result
355
+ : item.modifiedResult
332
356
  listItem[item.statsName + '指标得分'] = {
333
357
  ...item,
334
- value: item.result,
358
+ result: scoreVal,
359
+ value: scoreVal,
335
360
  sourceType: '',
336
361
  displayStyle: 0,
337
362
  calcState: false