Sfoglia il codice sorgente

设施环境总览标题根据全局配置facilityEnv.typeList的label中获取

cyy 1 giorno fa
parent
commit
785e14b7d1
1 ha cambiato i file con 16 aggiunte e 1 eliminazioni
  1. 16 1
      src/views/system/fasc/index.vue

+ 16 - 1
src/views/system/fasc/index.vue

@@ -11,7 +11,7 @@
         class="clearfix fasc-card-hearder"
         @click="goToDetailPage(card)"
       >
-        <span>{{ card.facs_type.split('-')[1] }}</span>
+        <span>{{ getFacsTypeTitle(card.facs_type) }}</span>
       </div>
 
       <el-collapse v-model="card.activeName" accordion>
@@ -60,6 +60,13 @@ export default {
       cardInfos: []
     }
   },
+  computed: {
+    // 设施环境类型配置(来自全局配置 facilityEnv.typeList)
+    facilityEnvTypeList() {
+      const { setting = {} } = this.$store.getters
+      return setting?.facilityEnv?.typeList || {}
+    }
+  },
   mounted() {
     getFacsDaily().then((res) => {
       const list = {
@@ -144,6 +151,14 @@ export default {
     })
   },
   methods: {
+    // 设施环境类型标题:优先取 facilityEnv.typeList 中配置的 label,没有则取 key 中 '-' 后面的名称
+    getFacsTypeTitle(facs_type) {
+      if (!facs_type) return ''
+      const typeList = this.facilityEnvTypeList
+      const label = typeList[facs_type]?.label
+      if (label) return label
+      return facs_type.split('-')[1] || facs_type
+    },
     goToDetailPage(card) {
       if (!card.pagePath) {
         this.$message.warning('该卡片暂未配置页面路径')