Prechádzať zdrojové kódy

Merge branch 'addDefaultChannel-fjc' into 'all'

feat: 消息管理:设置未配置时的默认推送渠道

See merge request skyeye/skyeye_frontend/skyeye-admin!179
yunfeng wu 1 rok pred
rodič
commit
9d335dd0d9

+ 4 - 6
src/views/message/alarm-config/components/AlarmExample.vue

@@ -20,9 +20,9 @@
         <AlarmExampleWecom />
       </el-tab-pane> -->
 
-      <div v-for="(example, index) in noticeChannel" :key="index">
-        <el-tab-pane :label="AlarmChannelLabelMap[example]" :name="index">
-          <component :is="exampleComponentMap[example]"></component>
+      <div v-for="(channle, index) in ALARMCHANNEL_LIST" :key="channle.name">
+        <el-tab-pane :label="channle.label" :name="index">
+          <component :is="exampleComponentMap[channle.name]"></component>
         </el-tab-pane>
       </div>
     </el-tabs>
@@ -36,11 +36,9 @@
   import { ref } from 'vue';
   import { ElTooltip, ElIcon } from 'element-plus';
   import { InfoFilled } from '@element-plus/icons-vue';
-  import { useGlobSetting } from '@/hooks/setting';
-  import { AlarmChannelLabelMap } from '../types';
+  import { ALARMCHANNEL_LIST } from '../types';
 
   const activeName = ref<number>(0);
-  const { noticeChannel } = useGlobSetting();
 
   const exampleComponentMap = {
     lanxin: AlarmExampleMobile,

+ 8 - 1
src/views/message/alarm-config/types.ts

@@ -3,8 +3,15 @@ import { useGlobSetting } from '@/hooks/setting';
 const { noticeChannel } = useGlobSetting();
 
 function getAlarmChannelList() {
+  if (!noticeChannel) {
+    return [
+      { name: 'lanxin', label: '蓝信', value: AlarmChannel.lanxin },
+      { name: 'platform', label: '平台', value: AlarmChannel.platform },
+    ];
+  }
+
   return noticeChannel.map((x) => {
-    return { label: AlarmChannelLabelMap[x], value: AlarmChannel[x] };
+    return { name: x, label: AlarmChannelLabelMap[x], value: AlarmChannel[x] };
   });
 }