Selaa lähdekoodia

feat(warning): 添加预警管理页面模块

- 新增预警管理页面,展示符合预警条件的应用列表
- 使用uni-grid组件实现3列布局,支持点击跳转
- 调用API获取应用列表并过滤预警相关应用
- 引入HomeContainer组件并设置定制样式
- 添加页面样式,提升界面视觉效果和交互体验
- 实现点击图标导航到对应子页功能
- 处理API请求异常,保证页面稳定性
huoyi 13 tuntia sitten
vanhempi
commit
3444336f92

+ 6 - 0
src/pages.json

@@ -364,6 +364,12 @@
364 364
       }
365 365
     },
366 366
     {
367
+      "path": "pages/warningManage/index",
368
+      "style": {
369
+        "navigationBarTitleText": "预警管理"
370
+      }
371
+    },
372
+    {
367 373
       "path": "pages/statisticalAnalysis/index",
368 374
       "style": {
369 375
         "navigationBarTitleText": "统计分析"

+ 18 - 2
src/pages/employeeDimensionDetails/index.vue

@@ -135,9 +135,9 @@ export default {
135 135
             timeTags: ['近一周', '近一月', '近三月', '近一年'],
136 136
             beginTime: '',
137 137
             endTime: '',
138
-            selectedOrgId: null,
138
+            selectedOrgId: 143,
139 139
             selectedOrgName: '',
140
-            selectedDeptType: '',
140
+            selectedDeptType: 'TEAMS',
141 141
             selectedDimension: '',
142 142
             selectedDimName: '全部',
143 143
             showOrgPicker: false,
@@ -241,12 +241,28 @@ export default {
241 241
             }
242 242
             traverse(nodes)
243 243
         },
244
+        findNodeInTree(nodes, id) {
245
+            for (const node of nodes) {
246
+                if (node.id === id) return node
247
+                if (node.children && node.children.length > 0) {
248
+                    const found = this.findNodeInTree(node.children, id)
249
+                    if (found) return found
250
+                }
251
+            }
252
+            return null
253
+        },
244 254
         loadDeptTree() {
245 255
             getDeptUserTree({}).then(res => {
246 256
                 if (res.code === 200) {
247 257
                     this.deptTreeData = res.data || []
248 258
                     this.orgList = this.flattenDeptTree(this.deptTreeData).filter(u => u.nodeType === 'user')
249 259
                     this.expandAllDepts(this.deptTreeData)
260
+                    if (this.selectedOrgId) {
261
+                        const node = this.findNodeInTree(this.deptTreeData, this.selectedOrgId)
262
+                        if (node) {
263
+                            this.selectedOrgName = node.nickName || node.label || node.userName || ''
264
+                        }
265
+                    }
250 266
                 }
251 267
             }).catch(() => { })
252 268
         },

+ 2 - 1
src/pages/profileManage/index.vue

@@ -19,8 +19,9 @@
19 19
 <script>
20 20
 import HomeContainer from '@/components/HomeContainer.vue'
21 21
 import { getAppList } from '@/api/system/user'
22
+import {profileAppNames} from "@/utils/common.js";
22 23
 
23
-const profileAppNames = ['全站综合信息', '部门画像', '班组画像', '小组画像', '员工画像']
24
+// const profileAppNames = ['全站综合信息', '部门画像', '班组画像', '小组画像', '员工画像', '部门仪表盘']
24 25
 
25 26
 export default {
26 27
   components: { HomeContainer },

+ 3 - 3
src/pages/redLineWarning/index.vue

@@ -2,7 +2,7 @@
2 2
     <view class="redline-page">
3 3
         <view class="page-header">
4 4
             <view class="header-title">红线指标预警</view>
5
-            <view class="header-subtitle">员工综合评估(<75分红色预警 | ≥90分优秀)</view>
5
+            <view class="header-subtitle">员工综合评估(平均每月>=3次触发预警)</view>
6 6
             <view class="badge-group">
7 7
                 <view class="alert-badge">红色预警</view>
8 8
                 <view class="alert-badge orange">动态月度数据</view>
@@ -77,7 +77,7 @@
77 77
                 <uni-pagination :current="pageNum" :total="total" :page-size="pageSize" simple @change="onPageChange" />
78 78
             </view>
79 79
 
80
-            <view class="warning-summary">
80
+            <!-- <view class="warning-summary">
81 81
                 <view class="summary-item">
82 82
                     <view class="dot red"></view>
83 83
                     <text><strong>红色预警</strong> 共计 {{ redAlertCount }} 人</text>
@@ -89,7 +89,7 @@
89 89
                 <view class="summary-item">
90 90
                     <text>全员平均得分: <strong>{{ avgScore }}</strong> 分</text>
91 91
                 </view>
92
-            </view>
92
+            </view> -->
93 93
         </view>
94 94
 
95 95
         <!-- 组织架构选择弹窗 -->

+ 106 - 0
src/pages/warningManage/index.vue

@@ -0,0 +1,106 @@
1
+<template>
2
+  <home-container :customStyle="{ background: 'none', backgroundColor: '#f5f5f5' }">
3
+    <view class="profile-manage-container">
4
+      <view class="grid-body">
5
+        <uni-section title="预警管理" type="line" class="uni-section-custom"></uni-section>
6
+        <uni-grid :column="3" :showBorder="false">
7
+          <uni-grid-item v-for="(item, index) in items" :key="index">
8
+            <view class="grid-item-box" @click="handleGridClick(item.appUrl)">
9
+              <img alt="" :src="item.workbenchIcon">
10
+              <text class="text">{{ item.appName }}</text>
11
+            </view>
12
+          </uni-grid-item>
13
+        </uni-grid>
14
+      </view>
15
+    </view>
16
+  </home-container>
17
+</template>
18
+
19
+<script>
20
+import HomeContainer from '@/components/HomeContainer.vue'
21
+import { getAppList } from '@/api/system/user'
22
+import { warningAppNames } from "@/utils/common.js";
23
+
24
+
25
+
26
+export default {
27
+  components: { HomeContainer },
28
+  data() {
29
+    return {
30
+      appList: []
31
+    }
32
+  },
33
+  computed: {
34
+    items() {
35
+      return this.appList.filter(item => warningAppNames.includes(item.appName))
36
+    }
37
+  },
38
+  onLoad() {
39
+    this.loadAppList()
40
+  },
41
+  methods: {
42
+    async loadAppList() {
43
+      try {
44
+        const res = await getAppList({ homePage: 0 })
45
+        if (res.code === 200) {
46
+          this.appList = res.data || []
47
+        }
48
+      } catch (error) {
49
+        console.error('获取画像应用列表失败:', error)
50
+        this.appList = []
51
+      }
52
+    },
53
+    handleGridClick(url) {
54
+      if (!url) return
55
+      uni.navigateTo({ url })
56
+    }
57
+  }
58
+}
59
+</script>
60
+
61
+<style lang="scss" scoped>
62
+.profile-manage-container {
63
+  padding: 20rpx;
64
+  background-color: #f5f5f5;
65
+}
66
+
67
+.grid-body {
68
+  background-color: #fff;
69
+  border-radius: 16rpx;
70
+  padding: 20rpx;
71
+  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
72
+
73
+  .uni-section-custom {
74
+    ::v-deep .uni-section-header {
75
+      padding: 12rpx 10rpx !important;
76
+    }
77
+  }
78
+}
79
+
80
+.grid-item-box {
81
+  flex: 1;
82
+  display: flex;
83
+  flex-direction: column;
84
+  align-items: center;
85
+  justify-content: center;
86
+  padding: 30rpx 0;
87
+
88
+  img {
89
+    display: inline-block;
90
+    width: 88rpx;
91
+    height: 88rpx;
92
+  }
93
+
94
+  &:active {
95
+    background-color: #f5f5f5;
96
+    border-radius: 12rpx;
97
+  }
98
+}
99
+
100
+.text {
101
+  text-align: center;
102
+  font-size: 25rpx;
103
+  margin-top: 15rpx;
104
+  color: #333;
105
+}
106
+</style>

+ 11 - 12
src/pages/work/index.vue

@@ -34,14 +34,15 @@
34 34
       </view>
35 35
     </div>
36 36
 
37
-   
37
+
38 38
   </home-container>
39 39
 </template>
40 40
 <script>
41 41
 import HomeContainer from "@/components/HomeContainer.vue";
42 42
 import { checkRolePermission } from "@/utils/common.js";
43
-import { getUserProfile, getAppListByRoleId,getAppList } from "@/api/system/user";
44
-const profileAppNames = ['全站综合信息', '部门画像', '班组画像', '小组画像', '员工画像']
43
+import { getUserProfile, getAppListByRoleId, getAppList } from "@/api/system/user";
44
+import { profileAppNames, warningAppNames } from "@/utils/common.js";
45
+
45 46
 export default {
46 47
   components: { HomeContainer },
47 48
   data() {
@@ -55,7 +56,7 @@ export default {
55 56
       return this.$store?.state?.user?.roles[0]
56 57
     },
57 58
     items() {
58
-      return this.appList.filter(item => !profileAppNames.includes(item.appName))
59
+      return this.appList.filter(item => !profileAppNames.includes(item.appName) && !warningAppNames.includes(item.appName))
59 60
     }
60 61
   },
61 62
   onShow() {
@@ -74,11 +75,11 @@ export default {
74 75
 
75 76
       try {
76 77
         // if (roleId) {
77
-          const res = await getAppList({homePage:0});
78
-          if (res.code === 200) {
79
-            //全部应用
80
-            this.appList = res.data;
81
-          }
78
+        const res = await getAppList({ homePage: 0 });
79
+        if (res.code === 200) {
80
+          //全部应用
81
+          this.appList = res.data;
82
+        }
82 83
         // }
83 84
       } catch (error) {
84 85
         console.error('获取应用列表失败:', error);
@@ -95,7 +96,7 @@ export default {
95 96
     updateCurrentDate() {
96 97
       this.currentDate = this.formatDate(new Date());
97 98
     },
98
-   
99
+
99 100
     handleGridClick(url) {
100 101
       console.log('点击了宫格:', url, this.role);
101 102
       uni.navigateTo({
@@ -221,6 +222,4 @@ export default {
221 222
   font-size: 24rpx;
222 223
   color: #999;
223 224
 }
224
-
225
-
226 225
 </style>

+ 3 - 0
src/utils/common.js

@@ -526,3 +526,6 @@ export function checkRolePermission(role, path) {
526 526
 
527 527
 
528 528
 
529
+export const profileAppNames = ['全站综合信息', '部门画像', '班组画像', '小组画像', '员工画像', '部门仪表盘'];
530
+
531
+export const warningAppNames = ['综合预警信息', '员工维度明细', '红线指标预警'];