@nstc-business/imes 1.0.13 → 1.0.15

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.13",
3
+ "version": "1.0.15",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -58,6 +58,7 @@
58
58
  <script>
59
59
  import { buildStatModelTables, hasStatPivotNodes } from './statModelHelper'
60
60
  import { showLevelSerial } from './helpers'
61
+ import { withRequestTimestamp } from './api'
61
62
  import MeasureStatCell from './MeasureStatCell.vue'
62
63
 
63
64
  export default {
@@ -103,10 +104,9 @@ export default {
103
104
  return (block.columns || []).filter(c => c.prop !== 'name')
104
105
  },
105
106
  async fetchScoreMap(itemID) {
106
- const randomNumStr = `${Date.now()}${Math.floor(Math.random() * 1000000)}`
107
107
  try {
108
108
  const { code, data } = await this.$axios.post(
109
- `/imes/v1/indicator/getScoreMap?randomNumStr=${randomNumStr}`,
109
+ withRequestTimestamp('/imes/v1/indicator/getScoreMap'),
110
110
  { id: itemID }
111
111
  )
112
112
  return code === 0 && Array.isArray(data) ? data : []
@@ -1,9 +1,18 @@
1
1
  import { axios } from 'n20-common-lib'
2
2
 
3
+ export function withRequestTimestamp(url) {
4
+ const separator = url.includes('?') ? '&' : '?'
5
+ const randomNumStr = `${Date.now()}${Math.floor(Math.random() * 1000000)}`
6
+ return `${url}${separator}randomNumStr=${randomNumStr}`
7
+ }
8
+
3
9
  /**
4
10
  * 获取不可量化指标的评分选项。
5
11
  * 返回完整响应,和 measureCalc 其余请求的调用方式保持一致。
6
12
  */
7
13
  export function getScoreMap(params) {
8
- return axios.post('/imes/v1/indicator/getScoreMap', params)
14
+ return axios.post(
15
+ withRequestTimestamp('/imes/v1/indicator/getScoreMap'),
16
+ params
17
+ )
9
18
  }
@@ -9,7 +9,7 @@
9
9
  * modifyRank:0 不调整 1 调整指标得分 2 调整指标值
10
10
  */
11
11
  import { toFixedTrunc, addThousands } from '../common'
12
- import { statItemChildren } from './statModelHelper'
12
+ import { resolveManualFillValue, statItemChildren } from './statModelHelper'
13
13
 
14
14
  export const ITEM_TYPE = {
15
15
  CALC_MODEL: 11,
@@ -362,6 +362,12 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
362
362
  node.modifiedResult = node.result
363
363
  }
364
364
  }
365
+ // 手工填报:输入框绑定 value,需从接口字段回填(旧版 itemDataFn 同逻辑)
366
+ if (node.sourceType === 3 && !isQualIndicator(node)) {
367
+ if (node.value === '' || node.value == null) {
368
+ node.value = resolveManualFillValue(node)
369
+ }
370
+ }
365
371
  if (node.modifyRank === 2 && !isQualIndicator(node)) {
366
372
  if (node.value === '' || node.value == null) {
367
373
  node.value = node.indicatorResult
@@ -377,10 +383,7 @@ export function normalizeTree(nodes, leafList = [], qualList = []) {
377
383
  if (!item.itemID) return
378
384
  if (!item._rowKey) item._rowKey = `mk_${_uid++}`
379
385
  if (item.sourceType === 3 && (item.value === '' || item.value == null)) {
380
- item.value =
381
- item.indicatorResult != null && item.indicatorResult !== ''
382
- ? item.indicatorResult
383
- : item.defaultVal ?? ''
386
+ item.value = resolveManualFillValue(item)
384
387
  }
385
388
  if (item.modifyRank === 2 && !isQualIndicator(item)) {
386
389
  if (item.value === '' || item.value == null) {
@@ -247,6 +247,7 @@ import {
247
247
  mergeStatModelNode,
248
248
  statItemChildren
249
249
  } from './statModelHelper'
250
+ import { withRequestTimestamp } from './api'
250
251
  import { formatFloat2 } from '../common'
251
252
 
252
253
  export default {
@@ -615,7 +616,7 @@ export default {
615
616
  this.loading = true
616
617
  try {
617
618
  const res = await this.$axios.post(
618
- '/imes/v1/indicatorModel/getModelTree',
619
+ withRequestTimestamp('/imes/v1/indicatorModel/getModelTree'),
619
620
  { code, id, logId }
620
621
  )
621
622
  if (seq !== this.initSeq) return
@@ -731,12 +732,9 @@ export default {
731
732
  async fetchQualOptions() {
732
733
  await Promise.all(
733
734
  this.qualList.map(async row => {
734
- const randomNumStr = `${Date.now()}${Math.floor(
735
- Math.random() * 1000000
736
- )}`
737
735
  try {
738
736
  const { code, data } = await this.$axios.post(
739
- `/imes/v1/indicator/getScoreMap?randomNumStr=${randomNumStr}`,
737
+ withRequestTimestamp('/imes/v1/indicator/getScoreMap'),
740
738
  { id: row.itemID }
741
739
  )
742
740
  if (code === 0 && Array.isArray(data)) {
@@ -772,7 +770,7 @@ export default {
772
770
  this.cltLoading = true
773
771
  try {
774
772
  const res = await this.$axios.post(
775
- '/custman-core/customer/findSimpleList',
773
+ withRequestTimestamp('/custman-core/customer/findSimpleList'),
776
774
  { keyword: query }
777
775
  )
778
776
  this.cltOptions = res.code == 200 ? res.data || [] : []
@@ -1041,7 +1039,10 @@ export default {
1041
1039
 
1042
1040
  this.calcLoading = true
1043
1041
  try {
1044
- const res = await this.$axios.post('/imes/v2/models/calcModelTree', param)
1042
+ const res = await this.$axios.post(
1043
+ withRequestTimestamp('/imes/v2/models/calcModelTree'),
1044
+ param
1045
+ )
1045
1046
  if (res.code === 0) {
1046
1047
  const resData = res.data || {}
1047
1048
  if (this.statRootModel) {
@@ -1115,7 +1116,10 @@ export default {
1115
1116
 
1116
1117
  this.$set(subModel, '_calcing', true)
1117
1118
  try {
1118
- const res = await this.$axios.post('/imes/v2/models/calcModelTree', param)
1119
+ const res = await this.$axios.post(
1120
+ withRequestTimestamp('/imes/v2/models/calcModelTree'),
1121
+ param
1122
+ )
1119
1123
  if (res.code === 0) {
1120
1124
  const data = res.data || {}
1121
1125
  if (isStatModel(subModel)) {
@@ -4,11 +4,29 @@
4
4
  * statCalResult 仅作辅助元数据(列配置/标题/合计),不作为是否行转列的判断条件
5
5
  */
6
6
 
7
+ function hasFilledValue(val) {
8
+ return val !== '' && val != null && val !== undefined
9
+ }
10
+
11
+ /**
12
+ * 手工填报指标值回显:
13
+ * 优先 indicatorValText / indicatorResult(与旧版 itemDataFn 一致),
14
+ * 测算日志场景常只落 result,最后回退 defaultVal。
15
+ */
16
+ export function resolveManualFillValue(item) {
17
+ if (!item) return ''
18
+ if (hasFilledValue(item.indicatorValText)) return item.indicatorValText
19
+ if (hasFilledValue(item.indicatorResult)) return item.indicatorResult
20
+ if (hasFilledValue(item.result)) return item.result
21
+ if (hasFilledValue(item.defaultVal)) return item.defaultVal
22
+ return item.defaultVal ?? ''
23
+ }
24
+
7
25
  function resolveCellValue(item, optionList) {
8
26
  let value = ''
9
27
  switch (item.sourceType) {
10
28
  case 3:
11
- value = item.indicatorResult
29
+ value = resolveManualFillValue(item)
12
30
  break
13
31
  case 0:
14
32
  value = {}
@@ -38,10 +56,7 @@ function resolveCellValue(item, optionList) {
38
56
  function applyCellValue(item, optionList) {
39
57
  if (item.sourceType === 3) {
40
58
  if (item.value === '' || item.value == null || item.value === undefined) {
41
- item.value =
42
- item.indicatorResult != null && item.indicatorResult !== ''
43
- ? item.indicatorResult
44
- : item.defaultVal ?? ''
59
+ item.value = resolveManualFillValue(item)
45
60
  }
46
61
  return
47
62
  }
package/src/index.js CHANGED
@@ -19,7 +19,7 @@ if (typeof window !== 'undefined' && window.Vue) {
19
19
  }
20
20
 
21
21
  export default {
22
- version: '1.0.13',
22
+ version: '1.0.15',
23
23
  install,
24
24
  ModelCalculate,
25
25
  MeasureCalc,