Преглед изворни кода

Merge branch 'newNoticeChannel-fjc' into 'all'

feat: 消息管理:中建材新增定制推送渠道

See merge request skyeye/skyeye_frontend/skyeye-admin!176
楼航飞 пре 1 година
родитељ
комит
7d7c57519e

+ 4 - 0
src/hooks/setting/index.ts

@@ -19,6 +19,8 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
     VITE_GLOB_QUESTION_LIST_VERSION,
     VITE_GLOB_DISABLE_DEPARTMENT_EDIT,
     VITE_GLOB_HIDE_REPORT_MESSAGE_TABS,
+    VITE_GLOB_NOTICE_CHANNEL,
+    ...rest
   } = getAppEnvConfig();
 
   // Take global configuration
@@ -37,6 +39,8 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
     questionListVersion: VITE_GLOB_QUESTION_LIST_VERSION,
     disableDepartmentEdit: VITE_GLOB_DISABLE_DEPARTMENT_EDIT,
     hideReportMessageTabs: VITE_GLOB_HIDE_REPORT_MESSAGE_TABS,
+    noticeChannel: VITE_GLOB_NOTICE_CHANNEL,
+    ...rest,
   };
   return glob as Readonly<GlobConfig>;
 };

+ 56 - 19
src/views/message/alarm-config/components/AlarmExample.vue

@@ -1,38 +1,75 @@
 <template>
   <div>
-    <div class="alarm-example">示例样式</div>
+    <div class="alarm-example">
+      <div>示例样式</div>
+      <div class="exampleTip">
+        <el-tooltip placement="top-start" content="示例样式仅供参考,最终展示以线上为准">
+          <el-icon size="16px"><InfoFilled /></el-icon>
+        </el-tooltip>
+      </div>
+    </div>
+
     <el-tabs v-model="activeName" class="alarm-example-tabs">
-      <el-tab-pane label="平台侧" :name="0">
+      <!-- <el-tab-pane label="平台侧" :name="0">
         <AlarmExamplePlatform />
       </el-tab-pane>
       <el-tab-pane label="蓝信侧" :name="1">
         <AlarmExampleMobile />
       </el-tab-pane>
+      <el-tab-pane label="企业微信侧" :name="2">
+        <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>
+        </el-tab-pane>
+      </div>
     </el-tabs>
   </div>
 </template>
 
 <script setup lang="ts">
-import AlarmExamplePlatform from './AlarmExamplePlatform.vue';
-import AlarmExampleMobile from './AlarmExampleMobile.vue';
-import { ref } from 'vue';
+  import AlarmExamplePlatform from './AlarmExamplePlatform.vue';
+  import AlarmExampleMobile from './AlarmExampleMobile.vue';
+  import AlarmExampleWecom from './AlarmExampleWecom.vue';
+  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';
+
+  const activeName = ref<number>(0);
+  const { noticeChannel } = useGlobSetting();
 
-const activeName = ref<number>(0);
+  const exampleComponentMap = {
+    lanxin: AlarmExampleMobile,
+    platform: AlarmExamplePlatform,
+    wecom: AlarmExampleWecom,
+  };
 </script>
 
 <style lang="scss" scoped>
-.alarm-example {
-  padding: 18px 0 0 20px;
-  font-weight: 500;
-  font-size: 14px;
-  color: rgba(0, 0, 0, 0.85);
-  line-height: 22px;
-}
+  .alarm-example {
+    padding: 18px 0 0 20px;
+    font-weight: 500;
+    font-size: 14px;
+    color: rgba(0, 0, 0, 0.85);
+    line-height: 22px;
+    display: flex;
+    flex-wrap: wrap;
+    .exampleTip {
+      display: flex;
+      align-items: center;
+      color: #8c8c8c;
+      margin-left: 5px;
+    }
+  }
 
-:deep(.el-tabs__nav-scroll) {
-  padding: 0 20px 0;
-}
-:deep(.el-tabs__nav-wrap::after) {
-  height: 0px;
-}
+  :deep(.el-tabs__nav-scroll) {
+    padding: 0 20px 0;
+  }
+  :deep(.el-tabs__nav-wrap::after) {
+    height: 0px;
+  }
 </style>

+ 80 - 0
src/views/message/alarm-config/components/AlarmExampleWecom.vue

@@ -0,0 +1,80 @@
+<template>
+  <div style="width: 450px">
+    <div class="alarm-example-title"> <div class="alarm-example-block"></div>卡片页</div>
+    <div class="alarm-example-info-title">违规告警提醒</div>
+    <div class="alarm-example-info">
+      <div>【类型】人员缺岗</div>
+      <div>【时间】2024-11-17 12:00:00</div>
+      <div>【地点】110kv变电站-东侧值班室门口外侧区域</div>
+      <div>请及时关注!并前往天眼平台进行查看!</div>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+</script>
+
+<style scoped lang="scss">
+  .alarm-example-title {
+    padding-left: 20px;
+    font-size: 14px;
+    color: #303133;
+    line-height: 20px;
+    .alarm-example-block {
+      margin-right: 20px;
+      width: 4px;
+      height: 12px;
+      background: #1777ff;
+      border-radius: 3px;
+      display: inline-block;
+    }
+  }
+
+  .alarm-example-info-title {
+    padding: 10px 44px;
+    font-weight: 600;
+    font-size: 14px;
+    color: #303133;
+  }
+
+  .alarm-example-info {
+    padding: 0 44px;
+    font-weight: 400;
+    font-size: 12px;
+    color: #606266;
+    div:last-child {
+      padding-top: 10px;
+    }
+  }
+
+  .alarm-example-card {
+    margin: 10px 20px;
+    border: 1px solid rgba(0, 0, 0, 0.06);
+    border-radius: 4px;
+
+    .alarm-example-card-content {
+      border-bottom: 1px solid rgba(0, 0, 0, 0.06);
+      img {
+        width: 100%;
+      }
+
+      .alarm-example-card-info {
+        padding: 4px 8px;
+        font-weight: 600;
+        font-size: 17px;
+        color: #303133;
+      }
+    }
+    .alarm-example-card-footer {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      padding: 4px 16px;
+      .alarm-example-card-footer-btn {
+        font-weight: 400;
+        font-size: 14px;
+        color: rgba(0, 0, 0, 0.65);
+      }
+    }
+  }
+</style>

+ 24 - 4
src/views/message/alarm-config/types.ts

@@ -1,3 +1,13 @@
+import { useGlobSetting } from '@/hooks/setting';
+
+const { noticeChannel } = useGlobSetting();
+
+function getAlarmChannelList() {
+  return noticeChannel.map((x) => {
+    return { label: AlarmChannelLabelMap[x], value: AlarmChannel[x] };
+  });
+}
+
 export enum AlarmLevel {
   normal = 1,
   warning = 2,
@@ -13,12 +23,22 @@ export const ALARMLEVEL_LIST = [
 export enum AlarmChannel {
   lanxin = 1,
   platform = 2,
+  wecom = 3,
 }
 
-export const ALARMCHANNEL_LIST = [
-  { label: '蓝信', value: AlarmChannel.lanxin },
-  { label: '平台', value: AlarmChannel.platform },
-];
+export enum AlarmChannelLabelMap {
+  lanxin = '蓝信',
+  platform = '平台',
+  wecom = '企业微信',
+}
+
+// export const ALARMCHANNEL_LIST = [
+//   { label: '蓝信', value: AlarmChannel.lanxin },
+//   { label: '平台', value: AlarmChannel.platform },
+//   { label: '企业微信', value: AlarmChannel.wecom },
+// ];
+
+export const ALARMCHANNEL_LIST = getAlarmChannelList();
 
 export enum AlarmPhase {
   occurs = 1,

+ 7 - 0
types/config.d.ts

@@ -46,6 +46,9 @@ export interface ImultiTabsSetting {
   fixed: boolean;
   show: boolean;
 }
+
+export type NoticeChannelAppConfig = 'lanxin' | 'platform' | 'wecom';
+
 export interface GlobConfig {
   title: string;
   apiUrl: string;
@@ -60,6 +63,7 @@ export interface GlobConfig {
   questionListVersion: string;
   disableDepartmentEdit?: boolean;
   hideReportMessageTabs?: boolean;
+  noticeChannel: NoticeChannelAppConfig[];
 }
 
 export interface GlobEnvConfig {
@@ -93,6 +97,9 @@ export interface GlobEnvConfig {
 
   // 是否隐藏掉平台违规报警 平台访问统计和人员访问数据的tab, 默认不隐藏
   VITE_GLOB_HIDE_REPORT_MESSAGE_TABS: boolean;
+
+  // 消息管理可选择的推送渠道
+  VITE_GLOB_NOTICE_CHANNEL: NoticeChannelAppConfig[];
 }
 export interface GlobConfig {
   // 标题

+ 2 - 0
utils/devProxy/local/app.config.js

@@ -13,6 +13,8 @@ window.__PRODUCTION__SKYEYEADMIN__CONF__ = {
   "VITE_GLOB_APP_PC": "/skyeyev3pc/",
   /** 问题闭环处理,简单处理 */
   "VITE_GLOB_QUESTION_LIST_VERSION": 'v2',
+  // 消息管理可选择的推送渠道
+  "VITE_GLOB_NOTICE_CHANNEL": ['lanxin', 'platform', 'wecom',]
 
 };
 

+ 2 - 1
utils/devProxy/shangfei/app.config.js

@@ -17,7 +17,8 @@ window.__PRODUCTION__SKYEYEADMIN__CONF__ = {
   "VITE_GLOB_QUESTION_LIST_VERSION": '',
   // 为上飞定制的是否允许修改组织结构编辑,上飞不允许编辑,其他项目允许编辑
   "VITE_GLOB_DISABLE_DEPARTMENT_EDIT": true,
-
+  // 消息管理可选择的推送渠道
+  "VITE_GLOB_NOTICE_CHANNEL": ['lanxin', 'platform',]
 };
 
 

+ 2 - 1
utils/devProxy/yubei/app.config.js

@@ -15,7 +15,8 @@ window.__PRODUCTION__SKYEYEADMIN__CONF__ = {
 
   'VITE_GLOB_QUESTION_LIST_VERSION': 'simple',
 
-
+  // 消息管理可选择的推送渠道
+  "VITE_GLOB_NOTICE_CHANNEL": ['lanxin', 'platform',]
 };
 Object.freeze(window.__PRODUCTION__SKYEYEADMIN__CONF__);
 Object.defineProperty(window, "__PRODUCTION__SKYEYEADMIN__CONF__", {

+ 2 - 0
utils/devProxy/zhongjiancai/app.config.js

@@ -14,6 +14,8 @@ window.__PRODUCTION__SKYEYEADMIN__CONF__ = {
   "VITE_GLOB_APP_PC": "/skyeyev3pc/",
   /** 问题闭环处理,简单处理 */
   "VITE_GLOB_QUESTION_LIST_VERSION": 'simple',
+  // 消息管理可选择的推送渠道
+  "VITE_GLOB_NOTICE_CHANNEL": ['platform', 'wecom',]
 
 };
 

+ 2 - 0
utils/devProxy/zongbu/app.config.js

@@ -17,6 +17,8 @@ window.__PRODUCTION__SKYEYEADMIN__CONF__ = {
 
   VITE_GLOB_HIDE_REPORT_MESSAGE_TABS: true,
 
+  // 消息管理可选择的推送渠道
+  "VITE_GLOB_NOTICE_CHANNEL": ['lanxin', 'platform',]
 
 };
 Object.freeze(window.__PRODUCTION__SKYEYEADMIN__CONF__);