@nstc-business/imes 1.0.12 → 1.0.14

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/README.md CHANGED
@@ -27,15 +27,29 @@ export default {
27
27
  :code="modelCode"
28
28
  :log-id="logId"
29
29
  :model-data="modelData"
30
+ :readonly="isReadonly"
30
31
  :show-measure-cond="true"
31
32
  :cond-param="condParam"
32
33
  @calcResult="handleCalcResult"
33
34
  @getLogId="handleLogId"
35
+ @modelLoaded="handleModelLoaded"
36
+ @calcComplete="handleCalcComplete"
34
37
  />
35
38
  ```
36
39
 
37
40
  `modelData` 和 `id/code/logId` 二选一;传入 `modelData` 时优先使用完整模型数据。执行测算时必须提供 `condParam.cltNo`,或开启 `showMeasureCond` 由用户填写单位编号。
38
41
 
42
+ `readonly` 会隐藏整体和子模型测算按钮,并禁用所有录入项,展开、收起和锚点查看仍然可用。`modelLoaded` 返回组件归一化后的模型值,`calcComplete` 返回完整测算结果;原有的 `calcResult` 和 `getLogId` 事件继续兼容。
43
+
44
+ 宿主保存或提交前可通过公开方法完成校验和取值:
45
+
46
+ ```js
47
+ const validation = this.$refs.measureCalc.validate({ silent: true })
48
+ const value = this.$refs.measureCalc.getValue()
49
+ ```
50
+
51
+ `getValue()` 包含模型编号、版本、日志 ID、结果、测算入参以及兼容旧评级申报书的 `qualitativeData` 字符串。
52
+
39
53
  宿主项目需要先安装 Element UI 和 n20-common-lib。`Vue.use(n20)` 会注入组件使用的 `$axios`:
40
54
 
41
55
  ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nstc-business/imes",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
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
  }
@@ -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 {
@@ -438,8 +439,7 @@ export default {
438
439
  modelData: {
439
440
  handler() {
440
441
  this.init()
441
- },
442
- deep: true
442
+ }
443
443
  }
444
444
  },
445
445
  mounted() {
@@ -616,7 +616,7 @@ export default {
616
616
  this.loading = true
617
617
  try {
618
618
  const res = await this.$axios.post(
619
- '/imes/v1/indicatorModel/getModelTree',
619
+ withRequestTimestamp('/imes/v1/indicatorModel/getModelTree'),
620
620
  { code, id, logId }
621
621
  )
622
622
  if (seq !== this.initSeq) return
@@ -732,12 +732,9 @@ export default {
732
732
  async fetchQualOptions() {
733
733
  await Promise.all(
734
734
  this.qualList.map(async row => {
735
- const randomNumStr = `${Date.now()}${Math.floor(
736
- Math.random() * 1000000
737
- )}`
738
735
  try {
739
736
  const { code, data } = await this.$axios.post(
740
- `/imes/v1/indicator/getScoreMap?randomNumStr=${randomNumStr}`,
737
+ withRequestTimestamp('/imes/v1/indicator/getScoreMap'),
741
738
  { id: row.itemID }
742
739
  )
743
740
  if (code === 0 && Array.isArray(data)) {
@@ -773,7 +770,7 @@ export default {
773
770
  this.cltLoading = true
774
771
  try {
775
772
  const res = await this.$axios.post(
776
- '/custman-core/customer/findSimpleList',
773
+ withRequestTimestamp('/custman-core/customer/findSimpleList'),
777
774
  { keyword: query }
778
775
  )
779
776
  this.cltOptions = res.code == 200 ? res.data || [] : []
@@ -1042,7 +1039,10 @@ export default {
1042
1039
 
1043
1040
  this.calcLoading = true
1044
1041
  try {
1045
- 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
+ )
1046
1046
  if (res.code === 0) {
1047
1047
  const resData = res.data || {}
1048
1048
  if (this.statRootModel) {
@@ -1116,7 +1116,10 @@ export default {
1116
1116
 
1117
1117
  this.$set(subModel, '_calcing', true)
1118
1118
  try {
1119
- 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
+ )
1120
1123
  if (res.code === 0) {
1121
1124
  const data = res.data || {}
1122
1125
  if (isStatModel(subModel)) {
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.12',
22
+ version: '1.0.14',
23
23
  install,
24
24
  ModelCalculate,
25
25
  MeasureCalc,