@nstc-business/imes 1.1.0 → 1.1.2

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.1.0",
3
+ "version": "1.1.2",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -16,3 +16,11 @@ export function getScoreMap(params) {
16
16
  params
17
17
  )
18
18
  }
19
+
20
+ /**
21
+ * 获取全局枚举(含报表月份 reportMonth)。
22
+ * 返回完整响应,和 measureCalc 其余请求的调用方式保持一致。
23
+ */
24
+ export function getCommonEnum() {
25
+ return axios.get(withRequestTimestamp('/imes/common/enum'))
26
+ }
@@ -103,7 +103,7 @@
103
103
  </el-form-item>
104
104
  <el-form-item label="报表月份" label-width="80px">
105
105
  <el-select v-model="param.reportMonth" placeholder="请选择" :disabled="readonly">
106
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
106
+ <el-option v-for="item in reportMonthOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
107
107
  </el-select>
108
108
  </el-form-item>
109
109
  </div>
@@ -257,7 +257,7 @@ import {
257
257
  shouldApplyModifiedVal
258
258
  } from './helpers'
259
259
  import { preprocessStatIndicatorDeepList, mergeStatModelNode, statItemChildren } from './statModelHelper'
260
- import { withRequestTimestamp } from './api'
260
+ import { withRequestTimestamp ,getCommonEnum } from './api'
261
261
  import { fillQualReasonFromOption, mergeCalcResultReason } from './qualReason'
262
262
  import { formatFloat2 } from '../common'
263
263
  import { printJS } from 'n20-common-lib/src/plugins/Print'
@@ -412,21 +412,7 @@ export default {
412
412
  cltSearchTimer: null,
413
413
  initSeq: 0,
414
414
  messageStr: '',
415
- options: [
416
- { value: '13', label: '13月(已审计报表)' },
417
- { value: '12', label: '12月' },
418
- { value: '11', label: '11月' },
419
- { value: '10', label: '10月' },
420
- { value: '9', label: '9月' },
421
- { value: '8', label: '8月' },
422
- { value: '7', label: '7月' },
423
- { value: '6', label: '6月' },
424
- { value: '5', label: '5月' },
425
- { value: '4', label: '4月' },
426
- { value: '3', label: '3月' },
427
- { value: '2', label: '2月' },
428
- { value: '1', label: '1月' }
429
- ]
415
+ reportMonthOptions: []
430
416
  }
431
417
  },
432
418
  computed: {
@@ -540,6 +526,9 @@ export default {
540
526
  mounted() {
541
527
  this.init()
542
528
  },
529
+ created() {
530
+ this.loadReportMonthOptions()
531
+ },
543
532
  methods: {
544
533
  applyCondParam(val) {
545
534
  if (!val || typeof val !== 'object') return
@@ -1586,6 +1575,24 @@ export default {
1586
1575
  bumpStatTableVersion(node) {
1587
1576
  if (!node) return
1588
1577
  this.$set(node, '_statTableVersion', (node._statTableVersion || 0) + 1)
1578
+ },
1579
+ /** 加载报表月份枚举:sessionStorage 缓存优先,接口失败降级内置 1-12 月 */
1580
+ async loadReportMonthOptions() {
1581
+ try {
1582
+ const cached = window.sessionStorage.getItem('imes_reportMonthEnum')
1583
+ if (cached) {
1584
+ this.reportMonthOptions = JSON.parse(cached)
1585
+ return
1586
+ }
1587
+ const { code, data } = await getCommonEnum()
1588
+ const list = (code === 200 && data && data.reportMonth) || []
1589
+ this.reportMonthOptions = list.length
1590
+ ? list.map(item => ({ value: item.code, label: item.name }))
1591
+ : FALLBACK_MONTH_OPTIONS
1592
+ window.sessionStorage.setItem('imes_reportMonthEnum', JSON.stringify(this.reportMonthOptions))
1593
+ } catch (e) {
1594
+ console.warn('[measureCalc] 报表月份枚举加载失败,', e)
1595
+ }
1589
1596
  }
1590
1597
  }
1591
1598
  }