Bläddra i källkod

refactor: 调整组件、图表样式与逻辑,新增团队成员表格

1. 清空ItemDistribution.vue默认示例数据,调整图表容器高度
2. 修复teamProfile/index.vue的参数获取逻辑错误
3. 优化MemberPositionDistribution.vue的轴标签样式并禁用数据缩放
4. 新增GroupMemberTable组件并重构groupProfile页面的成员表格逻辑
huoyi 1 vecka sedan
förälder
incheckning
e8fbefcce0

+ 77 - 0
src/pages/components/GroupMemberTable.vue

@@ -0,0 +1,77 @@
1
+<template>
2
+  <div class="team-member-table">
3
+    <scroll-view scroll-x class="table-scroll">
4
+      <table class="data-table">
5
+        <thead>
6
+          <tr>
7
+            <th>姓名</th>
8
+            <th>年龄</th>
9
+            <th>司龄</th>
10
+            <th>性别</th>
11
+            <th>民族</th>
12
+            <th>政治面貌</th>
13
+            <th>职务</th>
14
+            <th>职业技能等级</th>
15
+            <th>开机年限</th>
16
+            <th>综合得分</th>
17
+          </tr>
18
+        </thead>
19
+        <tbody>
20
+          <tr v-for="(item, index) in chartsData" :key="index">
21
+            <td>{{ item.personName }}</td>
22
+            <td>{{ item.age }}</td>
23
+            <td>{{ item.workYears }}</td>
24
+            <td>{{ item.sex }}</td>
25
+            <td>{{ item.nation }}</td>
26
+            <td>{{ item.politicalStatus }}</td>
27
+            <td>{{ item.roleNames }}</td>
28
+            <td>{{ item.qualificationLevel }}</td>
29
+            <td>{{ item.xrayOperatorYears }}</td>
30
+            <td>{{ item.totalScore }}</td>
31
+          </tr>
32
+        </tbody>
33
+      </table>
34
+    </scroll-view>
35
+  </div>
36
+</template>
37
+
38
+<script>
39
+export default {
40
+  name: 'TeamMemberTable',
41
+  props: {
42
+    chartsData: {
43
+      type: Array,
44
+      default: () => []
45
+    }
46
+  }
47
+}
48
+</script>
49
+
50
+<style lang="scss" scoped>
51
+.team-member-table {
52
+  .table-scroll {
53
+    width: 100%;
54
+  }
55
+  
56
+  .data-table {
57
+    width: 100%;
58
+    font-size: 24rpx;
59
+    border-collapse: collapse;
60
+    
61
+    th, td {
62
+      padding: 16rpx 8rpx;
63
+      text-align: left;
64
+      white-space: nowrap;
65
+    }
66
+    
67
+    th {
68
+      color: rgba(255, 255, 255, 0.5);
69
+      border-bottom: 1rpx solid rgba(255, 255, 255, 0.1);
70
+    }
71
+    
72
+    td {
73
+      color: rgba(255, 255, 255, 0.9);
74
+    }
75
+  }
76
+}
77
+</style>

+ 2 - 6
src/pages/components/ItemDistribution.vue

@@ -20,11 +20,7 @@ export default {
20 20
       type: Object,
21 21
       default: () => ({
22 22
         items: [
23
-          { name: '刀具', value: 836, color: '#60A5FA' },
24
-          { name: '易燃易爆', value: 718, color: '#34D399' },
25
-          { name: '枪支警械', value: 255, color: '#FBBF24' },
26
-          { name: '管制刀具', value: 1, color: '#EF4444' },
27
-          { name: '其他', value: 172, color: '#9CA3AF' }
23
+          
28 24
         ]
29 25
       })
30 26
     }
@@ -90,7 +86,7 @@ export default {
90 86
 <style lang="scss" scoped>
91 87
 .item-distribution {
92 88
   .chart-container {
93
-    height: 250rpx;
89
+    height: 300rpx;
94 90
   }
95 91
   
96 92
   .legend-grid {

+ 20 - 18
src/pages/components/MemberPositionDistribution.vue

@@ -215,7 +215,9 @@ export default {
215 215
           },
216 216
           axisLabel: {
217 217
             color: 'rgba(255, 255, 255, 0.5)',
218
-            fontSize: 10
218
+            fontSize: 10,
219
+            rotate: 30,
220
+            margin: 15
219 221
           }
220 222
         },
221 223
         yAxis: {
@@ -236,22 +238,22 @@ export default {
236 238
             fontSize: 10
237 239
           }
238 240
         },
239
-        dataZoom: [{
240
-          type: 'slider',
241
-          show: true,
242
-          xAxisIndex: 0,
243
-          height: 20,
244
-          bottom: 0,
245
-          borderColor: 'rgba(255, 255, 255, 0.1)',
246
-          backgroundColor: 'rgba(45, 42, 85, 0.8)',
247
-          fillerColor: 'rgba(167, 139, 250, 0.3)',
248
-          handleStyle: {
249
-            color: '#A78BFA'
250
-          },
251
-          labelStyle: {
252
-            color: 'rgba(255, 255, 255, 0.5)'
253
-          }
254
-        }],
241
+        // dataZoom: [{
242
+        //   type: 'slider',
243
+        //   show: true,
244
+        //   xAxisIndex: 0,
245
+        //   height: 20,
246
+        //   bottom: 0,
247
+        //   borderColor: 'rgba(255, 255, 255, 0.1)',
248
+        //   backgroundColor: 'rgba(45, 42, 85, 0.8)',
249
+        //   fillerColor: 'rgba(167, 139, 250, 0.3)',
250
+        //   handleStyle: {
251
+        //     color: '#A78BFA'
252
+        //   },
253
+        //   labelStyle: {
254
+        //     color: 'rgba(255, 255, 255, 0.5)'
255
+        //   }
256
+        // }],
255 257
         series: [{
256 258
           type: 'bar',
257 259
           data: this.chartsData.position.data,
@@ -300,7 +302,7 @@ export default {
300 302
   }
301 303
   
302 304
   .chart-container {
303
-    height: 250rpx;
305
+    height: 600rpx;
304 306
   }
305 307
 }
306 308
 </style>

+ 7 - 16
src/pages/groupProfile/index.vue

@@ -64,7 +64,7 @@
64 64
                 </SectionTitle>
65 65
 
66 66
                 <SectionTitle title="团队成员">
67
-                    <TeamMemberTable :chartsData="teamMemberData" />
67
+                    <GroupMemberTable :chartsData="GroupMemberTable" />
68 68
                 </SectionTitle>
69 69
 
70 70
                 <SectionTitle title="成员基本情况分布">
@@ -132,7 +132,7 @@
132 132
 
133 133
 <script>
134 134
 import SectionTitle from '@/components/SectionTitle.vue'
135
-import TeamMemberTable from '../components/TeamMemberTable.vue'
135
+import GroupMemberTable from '../components/GroupMemberTable.vue'
136 136
 import MemberBasicDistribution from '../components/MemberBasicDistribution.vue'
137 137
 import MemberPositionDistribution from '../components/MemberPositionDistribution.vue'
138 138
 import PassengerChart from '../components/PassengerChart.vue'
@@ -151,7 +151,7 @@ import InterceptionDistribution from '../components/InterceptionDistribution.vue
151 151
 import DeptStats from '../components/DeptStats.vue'
152 152
 import DeptSelector from '../components/DeptSelector.vue'
153 153
 import {
154
-    countStationTeamStats,
154
+    getDeptMembers,
155 155
     getDeptMemberDistribution,
156 156
     getDeptPositionDistribution,
157 157
     countStationHourlyThroughput,
@@ -180,7 +180,7 @@ export default {
180 180
     name: 'DeptProfile',
181 181
     components: {
182 182
         SectionTitle,
183
-        TeamMemberTable,
183
+        GroupMemberTable,
184 184
         MemberBasicDistribution,
185 185
         MemberPositionDistribution,
186 186
         PassengerChart,
@@ -216,7 +216,7 @@ export default {
216 216
             deptList: [],
217 217
             deptLoading: false,
218 218
             radarData: [],
219
-            teamMemberData: [],
219
+            GroupMemberTable: [],
220 220
             memberBasicData: {
221 221
                 gender: { labels: [], data: [] },
222 222
                 ethnicity: { labels: [], data: [] },
@@ -499,18 +499,9 @@ export default {
499 499
             })
500 500
         },
501 501
         fetchTeamData(params) {
502
-            countStationTeamStats(params).then(res => {
502
+            getDeptMembers(params).then(res => {
503 503
                 if (res.code === 200 && res.data) {
504
-                    this.teamMemberData = (res.data || []).map(item => ({
505
-                        department: item.deptName,
506
-                        employeeCount: item.employeeCount,
507
-                        partyMemberCount: item.partyMemberCount,
508
-                        avgAge: item.avgAge,
509
-                        avgTenure: item.avgWorkYears,
510
-                        certificateCount: item.qualificationLevel,
511
-                        machineYears: item.avgXrayOperatorYears,
512
-                        comprehensiveScore: item.totalScore
513
-                    }))
504
+                    this.GroupMemberTable = (res.data || [])
514 505
                 }
515 506
             }).catch(() => { })
516 507
         },

+ 6 - 2
src/pages/teamProfile/index.vue

@@ -424,8 +424,12 @@ export default {
424 424
         buildTimeParams() {
425 425
             const now = new Date()
426 426
             const today = this.formatDate(now)
427
-            const deptId = this.selectedDeptId || 100
428
-            const teamId = this.selectedTeamId || 100
427
+            const deptId = this.selectedDeptId;
428
+            const teamId = this.selectedDeptId;
429
+            if(!this.selectedDeptId){
430
+                return 
431
+                
432
+            }
429 433
             if (this.selectedTimeTag === 4) {
430 434
                 if (this.startDate && this.endDate) {
431 435
                     return { startDate: this.startDate, endDate: this.endDate, deptId, teamId }