|
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <div class="dashboard">
|
|
|
3
|
+ <div class="header">
|
|
|
4
|
+ <div class="title-section">
|
|
|
5
|
+ <h1><i class="fas fa-shield-alt" style="color:#2c5282; margin-right: 8px;"></i>预警中枢</h1>
|
|
|
6
|
+ <p>员工综合评估(<75分红色预警 | ≥90分优秀)</p>
|
|
|
7
|
+ </div>
|
|
|
8
|
+ <div class="badge-group">
|
|
|
9
|
+ <div class="alert-badge"><i class="fas fa-exclamation-triangle"></i> 实时预警</div>
|
|
|
10
|
+ <div class="alert-badge" style="border-left-color:#f97316;"><i class="fas fa-chart-line"></i> 动态月度数据
|
|
|
11
|
+ </div>
|
|
|
12
|
+ </div>
|
|
|
13
|
+ </div>
|
|
|
14
|
+
|
|
|
15
|
+ <div class="filter-bar">
|
|
|
16
|
+ <div class="time-range">
|
|
|
17
|
+ <button class="time-btn" :class="{ active: activeRange === 'week' }"
|
|
|
18
|
+ @click="setActiveRange('week')">近一周</button>
|
|
|
19
|
+ <button class="time-btn" :class="{ active: activeRange === 'month' }"
|
|
|
20
|
+ @click="setActiveRange('month')">近一月</button>
|
|
|
21
|
+ <button class="time-btn" :class="{ active: activeRange === 'quarter' }"
|
|
|
22
|
+ @click="setActiveRange('quarter')">近三月</button>
|
|
|
23
|
+ <button class="time-btn" :class="{ active: activeRange === 'year' }"
|
|
|
24
|
+ @click="setActiveRange('year')">近一年</button>
|
|
|
25
|
+ <div class="custom-date">
|
|
|
26
|
+ <el-date-picker v-model="startDate" type="date" placeholder="开始日期" style="width: 150px;" />
|
|
|
27
|
+ <span style="margin: 0 8px;">至</span>
|
|
|
28
|
+ <el-date-picker v-model="endDate" type="date" placeholder="结束日期" style="width: 150px;" />
|
|
|
29
|
+
|
|
|
30
|
+ </div>
|
|
|
31
|
+ <el-popover trigger="click" placement="bottom" :width="480" ref="treePopoverRef">
|
|
|
32
|
+ <template #reference>
|
|
|
33
|
+ <el-input v-model="selectedOrgLabel" placeholder="组织架构/员工" clearable style="width: 480px;"
|
|
|
34
|
+ @clear="handleTreeClear" />
|
|
|
35
|
+ </template>
|
|
|
36
|
+ <el-tree
|
|
|
37
|
+ :data="cascadeOptions"
|
|
|
38
|
+ :props="treeProps"
|
|
|
39
|
+ node-key="value"
|
|
|
40
|
+ highlight-current
|
|
|
41
|
+ :current-node-key="selectedOrg"
|
|
|
42
|
+ @node-click="handleTreeNodeClick"
|
|
|
43
|
+ />
|
|
|
44
|
+ </el-popover>
|
|
|
45
|
+ </div>
|
|
|
46
|
+ <div class="filter-group">
|
|
|
47
|
+ <el-select v-model="selectedAlertLevel" placeholder="预警等级" clearable style="width: 250px;">
|
|
|
48
|
+ <el-option label="全部" value=""></el-option>
|
|
|
49
|
+ <el-option v-for="item in alert_level" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
50
|
+ </el-select>
|
|
|
51
|
+
|
|
|
52
|
+ </div>
|
|
|
53
|
+ </div>
|
|
|
54
|
+
|
|
|
55
|
+ <div class="cards-container">
|
|
|
56
|
+ <div class="cards-grid" style="overflow-x: auto; white-space: nowrap;">
|
|
|
57
|
+ <div class="card" v-for="(item, index) in summaryCards" :key="index"
|
|
|
58
|
+ style="display: inline-block; width: 200px; flex-shrink: 0;">
|
|
|
59
|
+ <div class="card-header">
|
|
|
60
|
+ <i :class="item.icon"></i>
|
|
|
61
|
+ <h3>{{ item.title }}</h3>
|
|
|
62
|
+ <span class="card-badge">{{ item.badge }}</span>
|
|
|
63
|
+ </div>
|
|
|
64
|
+ <div class="value-large" :style="{ color: item.color }">{{ item.value }}</div>
|
|
|
65
|
+ </div>
|
|
|
66
|
+ </div>
|
|
|
67
|
+ </div>
|
|
|
68
|
+
|
|
|
69
|
+ <div class="employee-section">
|
|
|
70
|
+ <div class="section-title">
|
|
|
71
|
+ <i class="fas fa-users" style="color:#dc2626;"></i> 员工综合评估预警看板
|
|
|
72
|
+ <span
|
|
|
73
|
+ style="font-size:0.7rem; background:#eef2ff; padding:4px 12px; border-radius:30px; margin-left:12px;">
|
|
|
74
|
+ 评分依据:员工配分表
|
|
|
75
|
+ </span>
|
|
|
76
|
+ </div>
|
|
|
77
|
+ <div class="employee-card">
|
|
|
78
|
+ <div style="overflow-x: auto;">
|
|
|
79
|
+ <table class="data-table" style="width:100%;">
|
|
|
80
|
+ <thead>
|
|
|
81
|
+ <tr>
|
|
|
82
|
+ <th>员工ID</th>
|
|
|
83
|
+ <th>姓名</th>
|
|
|
84
|
+ <th>所属部门</th>
|
|
|
85
|
+ <th>综合评估得分</th>
|
|
|
86
|
+ <th>预警等级</th>
|
|
|
87
|
+ <th>核心风险/优秀事迹</th>
|
|
|
88
|
+ <th>状态标签</th>
|
|
|
89
|
+ </tr>
|
|
|
90
|
+ </thead>
|
|
|
91
|
+ <tbody>
|
|
|
92
|
+ <tr v-for="emp in filteredEmployees" :key="emp.id" :class="getRowClass(emp.overallScore)">
|
|
|
93
|
+ <td>{{ emp.userId }}</td>
|
|
|
94
|
+ <td><strong>{{ emp.nickName }}</strong></td>
|
|
|
95
|
+ <td>{{ emp.deptName }}</td>
|
|
|
96
|
+ <td>
|
|
|
97
|
+ <span v-if="emp.overallScore < 75" class="score-danger">{{ emp.overallScore }}
|
|
|
98
|
+ 分</span>
|
|
|
99
|
+ <span v-else-if="emp.overallScore >= 90" class="score-excellent">{{ emp.overallScore
|
|
|
100
|
+ }}
|
|
|
101
|
+ 分</span>
|
|
|
102
|
+ <span v-else style="font-weight:600;">{{ emp.overallScore }} 分</span>
|
|
|
103
|
+ </td>
|
|
|
104
|
+ <td>
|
|
|
105
|
+ <span v-if="emp.overallScore < 75" class="status-badge"
|
|
|
106
|
+ style="animation: subtlePulse 1s infinite;"><i
|
|
|
107
|
+ class="fas fa-exclamation-triangle"></i> 红色预警</span>
|
|
|
108
|
+ <span v-else-if="emp.overallScore >= 90" class="status-excellent"
|
|
|
109
|
+ style="background:#d1fae5; color:#065f46;"><i class="fas fa-star"></i>
|
|
|
110
|
+ 优秀标杆</span>
|
|
|
111
|
+ <span v-else class="status-warning">正常范围</span>
|
|
|
112
|
+ </td>
|
|
|
113
|
+ <td style="font-size:0.75rem;">{{ emp.coreRisksOrOutstandingAchievements }}</td>
|
|
|
114
|
+ <td>
|
|
|
115
|
+ <span v-if="emp.overallScore < 75" style="color:#b91c1c;"><i
|
|
|
116
|
+ class="fas fa-bell"></i>
|
|
|
117
|
+ {{ getAlertLabel(emp.statusLabel) }}</span>
|
|
|
118
|
+ <span v-else-if="emp.overallScore >= 90" style="color:#15803d;"><i
|
|
|
119
|
+ class="fas fa-crown"></i> {{ getAlertLabel(emp.statusLabel) }}</span>
|
|
|
120
|
+ <span v-else>{{ getAlertLabel(emp.statusLabel) }}</span>
|
|
|
121
|
+ </td>
|
|
|
122
|
+ </tr>
|
|
|
123
|
+ </tbody>
|
|
|
124
|
+ </table>
|
|
|
125
|
+ </div>
|
|
|
126
|
+ <div class="warning-summary">
|
|
|
127
|
+ <div><i class="fas fa-circle" style="color:#ef4444;"></i> <strong>红色预警</strong> (综合评估 < 75分) 共计
|
|
|
128
|
+ {{ redAlertCount }} 人 → 立即约谈/培训</div>
|
|
|
129
|
+ <div><i class="fas fa-circle" style="color:#22c55e;"></i> <strong>优秀标杆</strong> (综合评估 ≥ 90分) 共计 {{
|
|
|
130
|
+ excellentCount }} 人 → 表彰激励</div>
|
|
|
131
|
+ <div><i class="fas fa-chart-simple"></i> 全员平均综合得分: <strong>{{ avgScore }}</strong> 分</div>
|
|
|
132
|
+ </div>
|
|
|
133
|
+ </div>
|
|
|
134
|
+ </div>
|
|
|
135
|
+
|
|
|
136
|
+ <footer>
|
|
|
137
|
+ <i class="far fa-bell"></i> 员工部门:旅检一/二/三部 | 阈值:<75红色预警 | ≥90优秀
|
|
|
138
|
+ </footer>
|
|
|
139
|
+ </div>
|
|
|
140
|
+</template>
|
|
|
141
|
+
|
|
|
142
|
+<script setup>
|
|
|
143
|
+import { ref, computed, onMounted, watch } from 'vue'
|
|
|
144
|
+import { getDeptUserTree } from '@/api/item/items'
|
|
|
145
|
+import { getWarningPageData, getEmployeeWarningPageData } from '@/api/warningPage/warningPage'
|
|
|
146
|
+import { useDict } from '@/utils/dict'
|
|
|
147
|
+import { useRoute } from 'vue-router'
|
|
|
148
|
+
|
|
|
149
|
+const route = useRoute()
|
|
|
150
|
+
|
|
|
151
|
+const { alert_level } = useDict('alert_level')
|
|
|
152
|
+
|
|
|
153
|
+const dateRangeInput = ref(null)
|
|
|
154
|
+const activeRange = ref('month')
|
|
|
155
|
+
|
|
|
156
|
+const startDate = ref(null)
|
|
|
157
|
+const endDate = ref(null)
|
|
|
158
|
+const selectedAlertLevel = ref('')
|
|
|
159
|
+const selectedOrg = ref('')
|
|
|
160
|
+const selectedOrgLabel = ref('')
|
|
|
161
|
+const treePopoverRef = ref(null)
|
|
|
162
|
+const treeProps = { label: 'label', children: 'children' }
|
|
|
163
|
+const cascadeOptions = ref([])
|
|
|
164
|
+
|
|
|
165
|
+const summaryCards = ref([
|
|
|
166
|
+ { icon: 'fas fa-clipboard-list', title: '部门监察问题', badge: '部门级', value: '13项', color: '#b45309' },
|
|
|
167
|
+ { icon: 'fas fa-microchip', title: '实时质控拦截', badge: '部门级', value: '347次', color: '#2563eb' },
|
|
|
168
|
+ { icon: 'fas fa-bug', title: '不安全事件', badge: '一级预警', value: '18起', color: '#dc2626' },
|
|
|
169
|
+ { icon: 'fas fa-shield-virus', title: '安保测试记录', badge: '部门级', value: '4项', color: '#e67e22' },
|
|
|
170
|
+ { icon: 'fas fa-comment-dots', title: '旅客服务投诉', badge: '服务响应', value: '11件', color: '#e67e22' },
|
|
|
171
|
+ { icon: 'fas fa-clipboard-check', title: '服务巡查', badge: '部门级', value: '5项', color: '#333' },
|
|
|
172
|
+ { icon: 'fas fa-graduation-cap', title: '培训及考试成绩', badge: '平均分数', value: '92.4分', color: '#333' },
|
|
|
173
|
+ { icon: 'fas fa-plane-departure', title: '航站楼', badge: '吞吐量', value: '2.8万', color: '#059669' },
|
|
|
174
|
+ { icon: 'fas fa-gift', title: '小额奖励', badge: '奖励次数', value: '156次', color: '#7c3aed' }
|
|
|
175
|
+])
|
|
|
176
|
+
|
|
|
177
|
+const newNames = [
|
|
|
178
|
+ "刘孟", "王苡衡", "周海涵", "何欣怡", "王崎",
|
|
|
179
|
+ "黄政", "刘韵儿", "汪安霖", "张诗敏", "张维", "陈凯琳"
|
|
|
180
|
+]
|
|
|
181
|
+const deptList = ["旅检一部", "旅检二部", "旅检三部"]
|
|
|
182
|
+const scores = [68, 92, 55, 96, 72, 88, 48, 94, 81, 63, 91]
|
|
|
183
|
+const coreRisksOrOutstandingAchievementsList = [
|
|
|
184
|
+ "违规操作2次+投诉1起,考试成绩62分",
|
|
|
185
|
+ "优秀服务案例,安保测试满分,无违规",
|
|
|
186
|
+ "安保测试未通过,不安全事件责任人",
|
|
|
187
|
+ "典型服务案例主导者,考试成绩98",
|
|
|
188
|
+ "质控拦截违规2次,考试成绩74分",
|
|
|
189
|
+ "考试成绩89分,服务巡查良好",
|
|
|
190
|
+ "严重不规范操作,安保测试未过",
|
|
|
191
|
+ "质控拦截贡献突出,考试成绩96",
|
|
|
192
|
+ "表现良好,无安全事故,考试86分",
|
|
|
193
|
+ "服务巡查扣分,投诉关联2件",
|
|
|
194
|
+ "临近预警线,服务巡查扣分1次"
|
|
|
195
|
+]
|
|
|
196
|
+
|
|
|
197
|
+const employeesData = ref([])
|
|
|
198
|
+
|
|
|
199
|
+for (let i = 0; i < newNames.length; i++) {
|
|
|
200
|
+ employeesData.value.push({
|
|
|
201
|
+ id: String(10021 + i),
|
|
|
202
|
+ name: newNames[i],
|
|
|
203
|
+ dept: deptList[i % deptList.length],
|
|
|
204
|
+ overallScore: scores[i % scores.length],
|
|
|
205
|
+ coreRisksOrOutstandingAchievements: coreRisksOrOutstandingAchievementsList[i % coreRisksOrOutstandingAchievementsList.length]
|
|
|
206
|
+ })
|
|
|
207
|
+}
|
|
|
208
|
+
|
|
|
209
|
+// 将组织架构数据转换为树形数据
|
|
|
210
|
+const transformCascadeData = (nodes) => {
|
|
|
211
|
+ if (!nodes) return []
|
|
|
212
|
+ return nodes.map(node => {
|
|
|
213
|
+ const label = node.nickName || node.deptName || node.name || node.label
|
|
|
214
|
+ const deptType = node.deptType || node.nodeType
|
|
|
215
|
+ // console.log(node,"node")
|
|
|
216
|
+ // let value
|
|
|
217
|
+ // if (deptType === 'BRIGADE') {
|
|
|
218
|
+ // value = String(node.deptId)
|
|
|
219
|
+ // } else if (deptType === 'MANAGER') {
|
|
|
220
|
+ // value = String(node.teamId)
|
|
|
221
|
+ // } else if (deptType === 'TEAMS') {
|
|
|
222
|
+ // value = String(node.groupId)
|
|
|
223
|
+ // } else {
|
|
|
224
|
+ // value = String(node.userId ?? node.id ?? node.deptId ?? '')
|
|
|
225
|
+ // }
|
|
|
226
|
+
|
|
|
227
|
+ const children = node.children && node.children.length > 0 ? transformCascadeData(node.children) : undefined
|
|
|
228
|
+
|
|
|
229
|
+ return {
|
|
|
230
|
+ label,
|
|
|
231
|
+ value:node.id,
|
|
|
232
|
+ deptType,
|
|
|
233
|
+ children
|
|
|
234
|
+ }
|
|
|
235
|
+ })
|
|
|
236
|
+}
|
|
|
237
|
+
|
|
|
238
|
+// 获取选中的部门或用户信息
|
|
|
239
|
+const getSelectedInfo = (selectedValue) => {
|
|
|
240
|
+ if (!selectedValue) return null
|
|
|
241
|
+
|
|
|
242
|
+ const findNodeByValue = (nodes, value) => {
|
|
|
243
|
+ for (const node of nodes) {
|
|
|
244
|
+ if (node.value === value) {
|
|
|
245
|
+ return node
|
|
|
246
|
+ }
|
|
|
247
|
+ if (node.children) {
|
|
|
248
|
+ const found = findNodeByValue(node.children, value)
|
|
|
249
|
+ if (found) return found
|
|
|
250
|
+ }
|
|
|
251
|
+ }
|
|
|
252
|
+ return null
|
|
|
253
|
+ }
|
|
|
254
|
+
|
|
|
255
|
+ return findNodeByValue(cascadeOptions.value, selectedValue)
|
|
|
256
|
+}
|
|
|
257
|
+
|
|
|
258
|
+const handleTreeNodeClick = (data) => {
|
|
|
259
|
+ selectedOrg.value = data.value
|
|
|
260
|
+ selectedOrgLabel.value = data.label
|
|
|
261
|
+ treePopoverRef.value?.hide()
|
|
|
262
|
+ fetchWarningData()
|
|
|
263
|
+}
|
|
|
264
|
+
|
|
|
265
|
+const handleTreeClear = () => {
|
|
|
266
|
+ selectedOrg.value = ''
|
|
|
267
|
+ selectedOrgLabel.value = ''
|
|
|
268
|
+ fetchWarningData()
|
|
|
269
|
+}
|
|
|
270
|
+
|
|
|
271
|
+const findNodeLabelByValue = (nodes, value) => {
|
|
|
272
|
+ if (!nodes) return ''
|
|
|
273
|
+ for (const node of nodes) {
|
|
|
274
|
+ if (node.value === value) return node.label
|
|
|
275
|
+ if (node.children) {
|
|
|
276
|
+ const found = findNodeLabelByValue(node.children, value)
|
|
|
277
|
+ if (found) return found
|
|
|
278
|
+ }
|
|
|
279
|
+ }
|
|
|
280
|
+ return ''
|
|
|
281
|
+}
|
|
|
282
|
+
|
|
|
283
|
+const filteredEmployees = computed(() => {
|
|
|
284
|
+ let result = employeesData.value.ledgerWarningDetailItemList
|
|
|
285
|
+
|
|
|
286
|
+
|
|
|
287
|
+
|
|
|
288
|
+ // 预警等级筛选
|
|
|
289
|
+ if (selectedAlertLevel.value) {
|
|
|
290
|
+ // 根据字典值判断筛选条件(红色预警 <75,优秀标杆 >=90,正常范围 75-89)
|
|
|
291
|
+ // 可以根据字典的 value 或 label 来判断
|
|
|
292
|
+ const alertItem = alert_level.value.find(item => item.value === selectedAlertLevel.value)
|
|
|
293
|
+ if (alertItem) {
|
|
|
294
|
+ const label = alertItem.label
|
|
|
295
|
+ if (label.includes('红色') || label.includes('预警')) {
|
|
|
296
|
+ result = result.filter(emp => emp.overallScore < 75)
|
|
|
297
|
+ } else if (label.includes('优秀') || label.includes('标杆')) {
|
|
|
298
|
+ result = result.filter(emp => emp.overallScore >= 90)
|
|
|
299
|
+ } else if (label.includes('正常')) {
|
|
|
300
|
+ result = result.filter(emp => emp.overallScore >= 75 && emp.overallScore < 90)
|
|
|
301
|
+ }
|
|
|
302
|
+ }
|
|
|
303
|
+ }
|
|
|
304
|
+
|
|
|
305
|
+
|
|
|
306
|
+
|
|
|
307
|
+ return result
|
|
|
308
|
+})
|
|
|
309
|
+
|
|
|
310
|
+const redAlertCount = computed(() => {
|
|
|
311
|
+ return employeesData.value?.redAlertNum || 0
|
|
|
312
|
+})
|
|
|
313
|
+
|
|
|
314
|
+const excellentCount = computed(() => {
|
|
|
315
|
+ return employeesData.value?.excellentBenchmarkNum || 0
|
|
|
316
|
+})
|
|
|
317
|
+
|
|
|
318
|
+const avgScore = computed(() => {
|
|
|
319
|
+ return employeesData.value?.averageComprehensiveScore || 0
|
|
|
320
|
+})
|
|
|
321
|
+
|
|
|
322
|
+const getRowClass = (score) => {
|
|
|
323
|
+ if (score < 75) return "employee-warning-row"
|
|
|
324
|
+ if (score >= 90) return "employee-excellent-row"
|
|
|
325
|
+ return ""
|
|
|
326
|
+}
|
|
|
327
|
+
|
|
|
328
|
+const getAlertLabel = (value) => {
|
|
|
329
|
+ if (!value) return ''
|
|
|
330
|
+ const item = alert_level.value.find(d => d.value === value)
|
|
|
331
|
+ return item ? item.label : value
|
|
|
332
|
+}
|
|
|
333
|
+
|
|
|
334
|
+const setActiveRange = (range) => {
|
|
|
335
|
+ activeRange.value = range
|
|
|
336
|
+ // 清除自定义日期
|
|
|
337
|
+ if (range !== 'custom') {
|
|
|
338
|
+ startDate.value = null
|
|
|
339
|
+ endDate.value = null
|
|
|
340
|
+ }
|
|
|
341
|
+}
|
|
|
342
|
+
|
|
|
343
|
+
|
|
|
344
|
+const formatDate = (d) => {
|
|
|
345
|
+ if (!d) return ''
|
|
|
346
|
+ const date = new Date(d)
|
|
|
347
|
+ const y = date.getFullYear()
|
|
|
348
|
+ const m = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
349
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
350
|
+ return `${y}-${m}-${day}`
|
|
|
351
|
+}
|
|
|
352
|
+
|
|
|
353
|
+const getDateRangeFromActive = () => {
|
|
|
354
|
+ const now = new Date()
|
|
|
355
|
+ let start = new Date(now)
|
|
|
356
|
+ if (activeRange.value === 'week') {
|
|
|
357
|
+ start.setDate(now.getDate() - 7)
|
|
|
358
|
+ } else if (activeRange.value === 'month') {
|
|
|
359
|
+ start.setMonth(now.getMonth() - 1)
|
|
|
360
|
+ } else if (activeRange.value === 'quarter') {
|
|
|
361
|
+ start.setMonth(now.getMonth() - 3)
|
|
|
362
|
+ } else {
|
|
|
363
|
+ start.setFullYear(now.getFullYear() - 1)
|
|
|
364
|
+ }
|
|
|
365
|
+ return { startDate: formatDate(start), endDate: formatDate(now) }
|
|
|
366
|
+}
|
|
|
367
|
+
|
|
|
368
|
+const warningDataMap = {
|
|
|
369
|
+ ledgerSupervisionProblem: 0,
|
|
|
370
|
+ ledgerRealtimeInterception: 1,
|
|
|
371
|
+ ledgerUnsafeEvent: 2,
|
|
|
372
|
+ ledgerSecurityTest: 3,
|
|
|
373
|
+ ledgerComplaint: 4,
|
|
|
374
|
+ ledgerServicePatrol: 5,
|
|
|
375
|
+ ledgerExamScore: 6,
|
|
|
376
|
+ ledgerTerminalBonus: 7,
|
|
|
377
|
+ ledgerRewardApproval: 8
|
|
|
378
|
+}
|
|
|
379
|
+
|
|
|
380
|
+const fetchWarningData = async () => {
|
|
|
381
|
+
|
|
|
382
|
+ let params = {}
|
|
|
383
|
+ if (startDate.value && endDate.value) {
|
|
|
384
|
+ params.startDate = formatDate(startDate.value)
|
|
|
385
|
+ params.endDate = formatDate(endDate.value)
|
|
|
386
|
+ } else {
|
|
|
387
|
+ const range = getDateRangeFromActive()
|
|
|
388
|
+ params.startDate = range.startDate
|
|
|
389
|
+ params.endDate = range.endDate
|
|
|
390
|
+ }
|
|
|
391
|
+
|
|
|
392
|
+ const selectedInfo = getSelectedInfo(selectedOrg.value)
|
|
|
393
|
+ if (selectedInfo) {
|
|
|
394
|
+ if (selectedInfo.deptType === 'BRIGADE') params.deptId = selectedInfo.value
|
|
|
395
|
+ else if (selectedInfo.deptType === 'MANAGER') params.teamId = selectedInfo.value
|
|
|
396
|
+ else if (selectedInfo.deptType === 'TEAMS') params.groupId = selectedInfo.value
|
|
|
397
|
+ else if (selectedInfo.deptType === 'user') params.userId = selectedInfo.value
|
|
|
398
|
+ }
|
|
|
399
|
+
|
|
|
400
|
+ try {
|
|
|
401
|
+ const [r1, r2] = await Promise.all([
|
|
|
402
|
+ getWarningPageData(params),
|
|
|
403
|
+ getEmployeeWarningPageData(params)
|
|
|
404
|
+ ])
|
|
|
405
|
+ if (r1.data) {
|
|
|
406
|
+ const d = r1.data
|
|
|
407
|
+ summaryCards.value.forEach((card, idx) => {
|
|
|
408
|
+ for (const [key, i] of Object.entries(warningDataMap)) {
|
|
|
409
|
+ if (i === idx) {
|
|
|
410
|
+ card.value = d[key] !== undefined ? String(d[key]) : card.value
|
|
|
411
|
+ break
|
|
|
412
|
+ }
|
|
|
413
|
+ }
|
|
|
414
|
+ })
|
|
|
415
|
+ }
|
|
|
416
|
+ if (r2.data) {
|
|
|
417
|
+ employeesData.value = r2.data
|
|
|
418
|
+ }
|
|
|
419
|
+ } catch (error) {
|
|
|
420
|
+ console.error('获取预警数据失败:', error)
|
|
|
421
|
+ }
|
|
|
422
|
+}
|
|
|
423
|
+
|
|
|
424
|
+onMounted(async () => {
|
|
|
425
|
+ try {
|
|
|
426
|
+ const res = await getDeptUserTree()
|
|
|
427
|
+ if (res.data) {
|
|
|
428
|
+ cascadeOptions.value = transformCascadeData(res.data)
|
|
|
429
|
+ }
|
|
|
430
|
+ } catch (error) {
|
|
|
431
|
+ console.error('获取组织架构数据失败:', error)
|
|
|
432
|
+ }
|
|
|
433
|
+ fetchWarningData()
|
|
|
434
|
+})
|
|
|
435
|
+
|
|
|
436
|
+watch(startDate, () => {
|
|
|
437
|
+ fetchWarningData()
|
|
|
438
|
+})
|
|
|
439
|
+watch(endDate, () => {
|
|
|
440
|
+ fetchWarningData()
|
|
|
441
|
+})
|
|
|
442
|
+watch(activeRange, () => {
|
|
|
443
|
+ fetchWarningData()
|
|
|
444
|
+})
|
|
|
445
|
+
|
|
|
446
|
+watch(cascadeOptions, (val) => {
|
|
|
447
|
+ if (val.length && selectedOrg.value) {
|
|
|
448
|
+ selectedOrgLabel.value = findNodeLabelByValue(val, selectedOrg.value)
|
|
|
449
|
+ }
|
|
|
450
|
+})
|
|
|
451
|
+
|
|
|
452
|
+// 监听路由参数变化,回显到级联选择器
|
|
|
453
|
+watch(() => route.query, (query) => {
|
|
|
454
|
+ const { id } = query
|
|
|
455
|
+ if (id) {
|
|
|
456
|
+ selectedOrg.value = id
|
|
|
457
|
+ selectedOrgLabel.value = findNodeLabelByValue(cascadeOptions.value, id)
|
|
|
458
|
+ } else {
|
|
|
459
|
+ selectedOrg.value = ''
|
|
|
460
|
+ selectedOrgLabel.value = ''
|
|
|
461
|
+ }
|
|
|
462
|
+ fetchWarningData()
|
|
|
463
|
+}, { immediate: true })
|
|
|
464
|
+</script>
|
|
|
465
|
+
|
|
|
466
|
+<style scoped>
|
|
|
467
|
+@keyframes subtlePulse {
|
|
|
468
|
+ 0% {
|
|
|
469
|
+ opacity: 0.7;
|
|
|
470
|
+ }
|
|
|
471
|
+
|
|
|
472
|
+ 50% {
|
|
|
473
|
+ opacity: 1;
|
|
|
474
|
+ background: #ffb3b3;
|
|
|
475
|
+ }
|
|
|
476
|
+
|
|
|
477
|
+ 100% {
|
|
|
478
|
+ opacity: 0.7;
|
|
|
479
|
+ }
|
|
|
480
|
+}
|
|
|
481
|
+
|
|
|
482
|
+
|
|
|
483
|
+
|
|
|
484
|
+.dashboard {
|
|
|
485
|
+ max-width: 100%;
|
|
|
486
|
+ padding: 10px;
|
|
|
487
|
+}
|
|
|
488
|
+
|
|
|
489
|
+.header {
|
|
|
490
|
+ margin-bottom: 28px;
|
|
|
491
|
+ display: flex;
|
|
|
492
|
+ justify-content: space-between;
|
|
|
493
|
+ align-items: flex-end;
|
|
|
494
|
+ flex-wrap: wrap;
|
|
|
495
|
+ gap: 16px;
|
|
|
496
|
+}
|
|
|
497
|
+
|
|
|
498
|
+.title-section h1 {
|
|
|
499
|
+ font-size: 1.7rem;
|
|
|
500
|
+ font-weight: 700;
|
|
|
501
|
+ background: linear-gradient(135deg, #1e3c72, #2a5298);
|
|
|
502
|
+ -webkit-background-clip: text;
|
|
|
503
|
+ background-clip: text;
|
|
|
504
|
+ color: transparent;
|
|
|
505
|
+ letter-spacing: -0.3px;
|
|
|
506
|
+}
|
|
|
507
|
+
|
|
|
508
|
+.title-section p {
|
|
|
509
|
+ color: #475569;
|
|
|
510
|
+ margin-top: 6px;
|
|
|
511
|
+ font-size: 0.85rem;
|
|
|
512
|
+}
|
|
|
513
|
+
|
|
|
514
|
+.badge-group {
|
|
|
515
|
+ display: flex;
|
|
|
516
|
+ gap: 12px;
|
|
|
517
|
+}
|
|
|
518
|
+
|
|
|
519
|
+.alert-badge {
|
|
|
520
|
+ background: #fff1f0;
|
|
|
521
|
+ border-left: 5px solid #ef4444;
|
|
|
522
|
+ padding: 6px 16px;
|
|
|
523
|
+ border-radius: 40px;
|
|
|
524
|
+ font-weight: 600;
|
|
|
525
|
+ font-size: 0.85rem;
|
|
|
526
|
+}
|
|
|
527
|
+
|
|
|
528
|
+.alert-badge i {
|
|
|
529
|
+ color: #ef4444;
|
|
|
530
|
+ margin-right: 6px;
|
|
|
531
|
+}
|
|
|
532
|
+
|
|
|
533
|
+.filter-bar {
|
|
|
534
|
+ background: white;
|
|
|
535
|
+ border-radius: 60px;
|
|
|
536
|
+ padding: 8px 20px;
|
|
|
537
|
+ margin-bottom: 28px;
|
|
|
538
|
+ display: flex;
|
|
|
539
|
+ flex-wrap: wrap;
|
|
|
540
|
+ align-items: center;
|
|
|
541
|
+ justify-content: space-between;
|
|
|
542
|
+ gap: 16px;
|
|
|
543
|
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.03);
|
|
|
544
|
+ border: 1px solid #eef2f6;
|
|
|
545
|
+}
|
|
|
546
|
+
|
|
|
547
|
+.time-range {
|
|
|
548
|
+ display: flex;
|
|
|
549
|
+ gap: 8px;
|
|
|
550
|
+ align-items: center;
|
|
|
551
|
+ flex-wrap: wrap;
|
|
|
552
|
+}
|
|
|
553
|
+
|
|
|
554
|
+.time-btn {
|
|
|
555
|
+ background: #f8fafc;
|
|
|
556
|
+ border: 1px solid #e2e8f0;
|
|
|
557
|
+ padding: 6px 18px;
|
|
|
558
|
+ border-radius: 40px;
|
|
|
559
|
+ font-size: 0.8rem;
|
|
|
560
|
+ font-weight: 500;
|
|
|
561
|
+ cursor: pointer;
|
|
|
562
|
+ transition: all 0.2s;
|
|
|
563
|
+ color: #1e293b;
|
|
|
564
|
+}
|
|
|
565
|
+
|
|
|
566
|
+.time-btn.active {
|
|
|
567
|
+ background: #2563eb;
|
|
|
568
|
+ border-color: #2563eb;
|
|
|
569
|
+ color: white;
|
|
|
570
|
+}
|
|
|
571
|
+
|
|
|
572
|
+.time-btn:hover {
|
|
|
573
|
+ background: #e2e8f0;
|
|
|
574
|
+}
|
|
|
575
|
+
|
|
|
576
|
+.custom-date {
|
|
|
577
|
+ display: flex;
|
|
|
578
|
+ align-items: center;
|
|
|
579
|
+ gap: 8px;
|
|
|
580
|
+}
|
|
|
581
|
+
|
|
|
582
|
+.clear-btn {
|
|
|
583
|
+ background: transparent;
|
|
|
584
|
+ border: 1px solid #e2e8f0;
|
|
|
585
|
+ padding: 4px 8px;
|
|
|
586
|
+ border-radius: 40px;
|
|
|
587
|
+ cursor: pointer;
|
|
|
588
|
+ color: #64748b;
|
|
|
589
|
+}
|
|
|
590
|
+
|
|
|
591
|
+.clear-btn:hover {
|
|
|
592
|
+ background: #f1f5f9;
|
|
|
593
|
+}
|
|
|
594
|
+
|
|
|
595
|
+.custom-date :deep(.el-date-picker) {
|
|
|
596
|
+ background: transparent;
|
|
|
597
|
+}
|
|
|
598
|
+
|
|
|
599
|
+.custom-date :deep(.el-input__wrapper) {
|
|
|
600
|
+ background: transparent;
|
|
|
601
|
+
|
|
|
602
|
+
|
|
|
603
|
+}
|
|
|
604
|
+
|
|
|
605
|
+.filter-group {
|
|
|
606
|
+ display: flex;
|
|
|
607
|
+ gap: 12px;
|
|
|
608
|
+ align-items: center;
|
|
|
609
|
+}
|
|
|
610
|
+
|
|
|
611
|
+.search-wrapper {
|
|
|
612
|
+ display: flex;
|
|
|
613
|
+ align-items: center;
|
|
|
614
|
+ gap: 8px;
|
|
|
615
|
+ background: #f8fafc;
|
|
|
616
|
+ padding: 4px 12px;
|
|
|
617
|
+ border-radius: 40px;
|
|
|
618
|
+ border: 1px solid #e2e8f0;
|
|
|
619
|
+}
|
|
|
620
|
+
|
|
|
621
|
+.search-btn {
|
|
|
622
|
+ background: #2563eb;
|
|
|
623
|
+ border: none;
|
|
|
624
|
+ color: white;
|
|
|
625
|
+ padding: 4px 14px;
|
|
|
626
|
+ border-radius: 30px;
|
|
|
627
|
+ font-size: 0.75rem;
|
|
|
628
|
+ font-weight: 500;
|
|
|
629
|
+ cursor: pointer;
|
|
|
630
|
+ transition: 0.2s;
|
|
|
631
|
+}
|
|
|
632
|
+
|
|
|
633
|
+.search-btn:hover {
|
|
|
634
|
+ background: #1d4ed8;
|
|
|
635
|
+}
|
|
|
636
|
+
|
|
|
637
|
+.cards-container {
|
|
|
638
|
+ width: 100%;
|
|
|
639
|
+ margin-bottom: 36px;
|
|
|
640
|
+ overflow-x: auto;
|
|
|
641
|
+}
|
|
|
642
|
+
|
|
|
643
|
+.cards-grid {
|
|
|
644
|
+ display: flex;
|
|
|
645
|
+
|
|
|
646
|
+ gap: 16px;
|
|
|
647
|
+ flex-wrap: nowrap;
|
|
|
648
|
+ min-width: max-content;
|
|
|
649
|
+}
|
|
|
650
|
+
|
|
|
651
|
+.card {
|
|
|
652
|
+ background: #ffffff;
|
|
|
653
|
+ border-radius: 20px;
|
|
|
654
|
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
|
655
|
+ transition: all 0.2s;
|
|
|
656
|
+ border: 1px solid #eef2f6;
|
|
|
657
|
+ padding: 1rem 0.5rem;
|
|
|
658
|
+ display: flex;
|
|
|
659
|
+ flex-direction: column;
|
|
|
660
|
+ text-align: center;
|
|
|
661
|
+ min-width: 280px;
|
|
|
662
|
+ flex-shrink: 0;
|
|
|
663
|
+}
|
|
|
664
|
+
|
|
|
665
|
+.card:hover {
|
|
|
666
|
+ transform: translateY(-3px);
|
|
|
667
|
+ box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.1);
|
|
|
668
|
+ border-color: #cbd5e1;
|
|
|
669
|
+}
|
|
|
670
|
+
|
|
|
671
|
+.card-header {
|
|
|
672
|
+ display: flex;
|
|
|
673
|
+ flex-direction: column;
|
|
|
674
|
+ align-items: center;
|
|
|
675
|
+ gap: 6px;
|
|
|
676
|
+ border-bottom: none;
|
|
|
677
|
+ padding-bottom: 0;
|
|
|
678
|
+ margin-bottom: 12px;
|
|
|
679
|
+}
|
|
|
680
|
+
|
|
|
681
|
+.card-header i {
|
|
|
682
|
+ font-size: 1.5rem;
|
|
|
683
|
+ color: #2563eb;
|
|
|
684
|
+}
|
|
|
685
|
+
|
|
|
686
|
+.card-header h3 {
|
|
|
687
|
+ font-size: 0.85rem;
|
|
|
688
|
+ font-weight: 700;
|
|
|
689
|
+ margin: 0;
|
|
|
690
|
+ white-space: nowrap;
|
|
|
691
|
+}
|
|
|
692
|
+
|
|
|
693
|
+.card-badge {
|
|
|
694
|
+ font-size: 0.6rem;
|
|
|
695
|
+ background: #f1f5f9;
|
|
|
696
|
+ padding: 2px 8px;
|
|
|
697
|
+ border-radius: 30px;
|
|
|
698
|
+ margin-top: 4px;
|
|
|
699
|
+ display: inline-block;
|
|
|
700
|
+}
|
|
|
701
|
+
|
|
|
702
|
+.value-large {
|
|
|
703
|
+ font-size: 1.8rem;
|
|
|
704
|
+ font-weight: 800;
|
|
|
705
|
+ line-height: 1.2;
|
|
|
706
|
+ margin: 8px 0 4px 0;
|
|
|
707
|
+}
|
|
|
708
|
+
|
|
|
709
|
+.employee-section {
|
|
|
710
|
+ margin-top: 20px;
|
|
|
711
|
+ width: 100%;
|
|
|
712
|
+}
|
|
|
713
|
+
|
|
|
714
|
+.section-title {
|
|
|
715
|
+ font-size: 1.2rem;
|
|
|
716
|
+ font-weight: 700;
|
|
|
717
|
+ margin-bottom: 1rem;
|
|
|
718
|
+ display: flex;
|
|
|
719
|
+ align-items: center;
|
|
|
720
|
+ gap: 8px;
|
|
|
721
|
+ border-left: 5px solid #ef4444;
|
|
|
722
|
+ padding-left: 14px;
|
|
|
723
|
+}
|
|
|
724
|
+
|
|
|
725
|
+.employee-card {
|
|
|
726
|
+ background: #ffffff;
|
|
|
727
|
+ border-radius: 24px;
|
|
|
728
|
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
|
729
|
+ border: 1px solid #eef2f6;
|
|
|
730
|
+ padding: 1rem 1.5rem;
|
|
|
731
|
+ width: 100%;
|
|
|
732
|
+}
|
|
|
733
|
+
|
|
|
734
|
+.data-table {
|
|
|
735
|
+ width: 100%;
|
|
|
736
|
+ border-collapse: collapse;
|
|
|
737
|
+ font-size: 0.8rem;
|
|
|
738
|
+}
|
|
|
739
|
+
|
|
|
740
|
+.data-table th {
|
|
|
741
|
+ text-align: left;
|
|
|
742
|
+ padding: 10px 6px 8px 0;
|
|
|
743
|
+ font-weight: 600;
|
|
|
744
|
+ color: #334155;
|
|
|
745
|
+ border-bottom: 2px solid #e2e8f0;
|
|
|
746
|
+}
|
|
|
747
|
+
|
|
|
748
|
+.data-table td {
|
|
|
749
|
+ padding: 8px 6px 8px 0;
|
|
|
750
|
+ border-bottom: 1px solid #f1f5f9;
|
|
|
751
|
+ vertical-align: middle;
|
|
|
752
|
+}
|
|
|
753
|
+
|
|
|
754
|
+.employee-warning-row {
|
|
|
755
|
+ background-color: #fff5f5;
|
|
|
756
|
+ border-left: 4px solid #ef4444;
|
|
|
757
|
+}
|
|
|
758
|
+
|
|
|
759
|
+.employee-excellent-row {
|
|
|
760
|
+ background-color: #f0fdf4;
|
|
|
761
|
+ border-left: 4px solid #22c55e;
|
|
|
762
|
+}
|
|
|
763
|
+
|
|
|
764
|
+.score-danger {
|
|
|
765
|
+ font-weight: 800;
|
|
|
766
|
+ color: #dc2626;
|
|
|
767
|
+ background: #fee2e2;
|
|
|
768
|
+ padding: 2px 8px;
|
|
|
769
|
+ border-radius: 30px;
|
|
|
770
|
+ display: inline-block;
|
|
|
771
|
+ font-size: 0.8rem;
|
|
|
772
|
+}
|
|
|
773
|
+
|
|
|
774
|
+.score-excellent {
|
|
|
775
|
+ font-weight: 800;
|
|
|
776
|
+ color: #15803d;
|
|
|
777
|
+ background: #dcfce7;
|
|
|
778
|
+ padding: 2px 8px;
|
|
|
779
|
+ border-radius: 30px;
|
|
|
780
|
+ display: inline-block;
|
|
|
781
|
+ font-size: 0.8rem;
|
|
|
782
|
+}
|
|
|
783
|
+
|
|
|
784
|
+.warning-summary {
|
|
|
785
|
+ background: #fff9f0;
|
|
|
786
|
+ border-radius: 18px;
|
|
|
787
|
+ padding: 12px 20px;
|
|
|
788
|
+ margin-top: 18px;
|
|
|
789
|
+ display: flex;
|
|
|
790
|
+ gap: 28px;
|
|
|
791
|
+ flex-wrap: wrap;
|
|
|
792
|
+ font-weight: 500;
|
|
|
793
|
+ font-size: 0.85rem;
|
|
|
794
|
+}
|
|
|
795
|
+
|
|
|
796
|
+footer {
|
|
|
797
|
+ text-align: center;
|
|
|
798
|
+ margin-top: 32px;
|
|
|
799
|
+ font-size: 0.7rem;
|
|
|
800
|
+ color: #7e8b9c;
|
|
|
801
|
+ border-top: 1px solid #e2edf7;
|
|
|
802
|
+ padding-top: 18px;
|
|
|
803
|
+}
|
|
|
804
|
+
|
|
|
805
|
+@media (max-width: 1200px) {
|
|
|
806
|
+ .cards-grid {
|
|
|
807
|
+ grid-template-columns: repeat(4, 1fr);
|
|
|
808
|
+ gap: 14px;
|
|
|
809
|
+ }
|
|
|
810
|
+}
|
|
|
811
|
+
|
|
|
812
|
+@media (max-width: 800px) {
|
|
|
813
|
+ .cards-grid {
|
|
|
814
|
+ grid-template-columns: repeat(2, 1fr);
|
|
|
815
|
+ }
|
|
|
816
|
+
|
|
|
817
|
+ body {
|
|
|
818
|
+ padding: 20px;
|
|
|
819
|
+ }
|
|
|
820
|
+
|
|
|
821
|
+ .filter-bar {
|
|
|
822
|
+ border-radius: 24px;
|
|
|
823
|
+ flex-direction: column;
|
|
|
824
|
+ align-items: stretch;
|
|
|
825
|
+ }
|
|
|
826
|
+
|
|
|
827
|
+ .org-search {
|
|
|
828
|
+ justify-content: space-between;
|
|
|
829
|
+ }
|
|
|
830
|
+}
|
|
|
831
|
+
|
|
|
832
|
+@media (max-width: 550px) {
|
|
|
833
|
+ .cards-grid {
|
|
|
834
|
+ grid-template-columns: 1fr;
|
|
|
835
|
+ }
|
|
|
836
|
+}
|
|
|
837
|
+</style>
|