ソースを参照

fix(home-new): 修复大队角色相关显示逻辑和数据展示问题

- 添加大队领导考勤统计逻辑
- 修正大队角色下的排名和数据显示
- 优化部分条件判断和样式
huoyi 2 ヶ月 前
コミット
022283ea11
共有1 個のファイルを変更した19 個の追加15 個の削除を含む
  1. 19 15
      src/pages/home-new/index.vue

+ 19 - 15
src/pages/home-new/index.vue

@@ -262,17 +262,20 @@ export default {
262
                 if (this.role.includes('kezhang')) {
262
                 if (this.role.includes('kezhang')) {
263
                     res = this.attendanceStats.sectionLeaderStats
263
                     res = this.attendanceStats.sectionLeaderStats
264
                 }
264
                 }
265
+                if (this.isBrigade) {
266
+                    res = this.attendanceStats.brigadeLeaderStats
267
+                }
265
 
268
 
266
                 // 抽离复杂的判断逻辑
269
                 // 抽离复杂的判断逻辑
267
                 const isZhanZhang = this.isZhanZhang;
270
                 const isZhanZhang = this.isZhanZhang;
268
                 const firstLabel = isZhanZhang ? '在岗大队' : this.isBrigade ? '执勤大队' : '在岗班组';
271
                 const firstLabel = isZhanZhang ? '在岗大队' : this.isBrigade ? '执勤大队' : '在岗班组';
269
-                const firstValue = isZhanZhang ? res?.dutyDeptName : res?.onDutyTeamCount;
272
+                const firstValue = (isZhanZhang || this.isBrigade) ? (res?.dutyDeptName || '暂无') : res?.onDutyTeamCount;
270
 
273
 
271
                 const secondLabel = isZhanZhang || this.isBrigade ? '在岗班组' : '在岗人员';
274
                 const secondLabel = isZhanZhang || this.isBrigade ? '在岗班组' : '在岗人员';
272
-                const secondValue = isZhanZhang ? res?.onDutyTeamCount : res?.onDutyPersonnelCount;
275
+                const secondValue = isZhanZhang || this.isBrigade ? res?.onDutyTeamCount : res?.onDutyPersonnelCount;
273
 
276
 
274
                 const thirdLabel = isZhanZhang || this.isBrigade ? '在岗人员' : '出勤时间';
277
                 const thirdLabel = isZhanZhang || this.isBrigade ? '在岗人员' : '出勤时间';
275
-                const thirdValue = isZhanZhang ? res?.onDutyPersonnelCount : (res?.attendanceTime || res?.attendanceTimeTips);
278
+                const thirdValue = (isZhanZhang || this.isBrigade) ? res?.onDutyPersonnelCount : (res?.attendanceTime || res?.attendanceTimeTips);
276
                 const thirdLink = isZhanZhang ? '' : (res?.attendanceTime ? '' : '/pages/attendance/index');
279
                 const thirdLink = isZhanZhang ? '' : (res?.attendanceTime ? '' : '/pages/attendance/index');
277
 
280
 
278
                 return [
281
                 return [
@@ -884,7 +887,7 @@ export default {
884
         },
887
         },
885
         //获取抽问抽答
888
         //获取抽问抽答
886
         getQuestionDataItems() {
889
         getQuestionDataItems() {
887
-            const { personalAccuracy, teamAvgAccuracy, deptAvgAccuracy, siteAvgAccuracy, topDepts, topTeamsInDept,brigadeAvgAccuracy } = this.accuracyStatistics;
890
+            const { personalAccuracy, teamAvgAccuracy, deptAvgAccuracy, siteAvgAccuracy, topDepts, topTeamsInDept, brigadeAvgAccuracy, brigadeRankingList } = this.accuracyStatistics;
888
             if (this.isIndividualView) {
891
             if (this.isIndividualView) {
889
                 // SecurityCheck角色:本人、班平均、主管平均、站平均
892
                 // SecurityCheck角色:本人、班平均、主管平均、站平均
890
                 return [
893
                 return [
@@ -919,13 +922,13 @@ export default {
919
                     { label: this.getObjByRank(topTeamsInDept, 3).teamName, value: '/static/images/icon/three.png', isImage: true }
922
                     { label: this.getObjByRank(topTeamsInDept, 3).teamName, value: '/static/images/icon/three.png', isImage: true }
920
                 ];
923
                 ];
921
             } else if (this.isZhanZhang) {
924
             } else if (this.isZhanZhang) {
922
-                console.log(this.accuracyStatistics, "topDepts")
925
+
923
                 // test/zhijianke角色:全站、前三名的科室(isImage: true)
926
                 // test/zhijianke角色:全站、前三名的科室(isImage: true)
924
                 return [
927
                 return [
925
                     { label: '全站', value: (siteAvgAccuracy || 0), isImage: false },
928
                     { label: '全站', value: (siteAvgAccuracy || 0), isImage: false },
926
-                    { label: this.getObjByRank(topDepts, 1).name, value: '/static/images/icon/one.png', isImage: true },
927
-                    { label: this.getObjByRank(topDepts, 2).name, value: '/static/images/icon/two.png', isImage: true },
928
-                    { label: this.getObjByRank(topDepts, 3).name, value: '/static/images/icon/three.png', isImage: true }
929
+                    { label: this.getObjByRank(brigadeRankingList, 1).name, value: '/static/images/icon/one.png', isImage: true },
930
+                    { label: this.getObjByRank(brigadeRankingList, 2).name, value: '/static/images/icon/two.png', isImage: true },
931
+                    { label: this.getObjByRank(brigadeRankingList, 3).name, value: '/static/images/icon/three.png', isImage: true }
929
                 ];
932
                 ];
930
             } else {
933
             } else {
931
                 // 默认角色:检查项、完成率
934
                 // 默认角色:检查项、完成率
@@ -1036,7 +1039,7 @@ export default {
1036
                 ];
1039
                 ];
1037
             } else if (this.role.includes('kezhang')) {
1040
             } else if (this.role.includes('kezhang')) {
1038
                 return [
1041
                 return [
1039
-                    { label: '大队排名', current: departmentRanking || 0, total: departmentTotal || 0, percentage: departmentTotal ? ((departmentRanking || 0) / departmentTotal) * 100 : 0 },
1042
+                    { label: '大队排名', current: brigadeRanking || 0, total: brigadeTotal || 0, percentage: brigadeTotal ? ((brigadeRanking || 0) / brigadeTotal) * 100 : 0 },
1040
                     { label: '站级排名', current: stationRanking || 0, total: stationTotal || 0, percentage: stationTotal ? ((stationRanking || 0) / stationTotal) * 100 : 0, type: 'station' }
1043
                     { label: '站级排名', current: stationRanking || 0, total: stationTotal || 0, percentage: stationTotal ? ((stationRanking || 0) / stationTotal) * 100 : 0, type: 'station' }
1041
                 ];
1044
                 ];
1042
             } else if (this.isBrigade) {
1045
             } else if (this.isBrigade) {
@@ -1069,22 +1072,22 @@ export default {
1069
                     { label: '站级排名', current: siteRanking?.rank || 0, total: siteRanking?.total || 0, percentage: siteRanking?.total ? ((siteRanking.rank || 0) / siteRanking.total) * 100 : 0, type: 'station' }
1072
                     { label: '站级排名', current: siteRanking?.rank || 0, total: siteRanking?.total || 0, percentage: siteRanking?.total ? ((siteRanking.rank || 0) / siteRanking.total) * 100 : 0, type: 'station' }
1070
                 ];
1073
                 ];
1071
             } else if (this.role.includes('kezhang')) {
1074
             } else if (this.role.includes('kezhang')) {
1072
-                const { deptInSiteRanking, deptRanking } = this.accuracyStatistics;
1075
+                const { deptInSiteRanking, deptInBrigadeRanking } = this.accuracyStatistics;
1073
                 return [
1076
                 return [
1074
-                    { label: '大队排名', current: deptRanking?.rank || 0, total: deptRanking?.total || 0, percentage: deptRanking?.total ? ((deptRanking.rank || 0) / deptRanking.total) * 100 : 0 },
1077
+                    { label: '大队排名', current: deptInBrigadeRanking?.rank || 0, total: deptInBrigadeRanking?.total || 0, percentage: deptInBrigadeRanking?.total ? ((deptInBrigadeRanking.rank || 0) / deptInBrigadeRanking.total) * 100 : 0 },
1075
                     { label: '站级排名', current: deptInSiteRanking?.rank || 0, total: deptInSiteRanking?.total || 0, percentage: deptInSiteRanking?.total ? ((deptInSiteRanking?.rank || 0) / deptInSiteRanking?.total) * 100 : 0, type: 'station' }
1078
                     { label: '站级排名', current: deptInSiteRanking?.rank || 0, total: deptInSiteRanking?.total || 0, percentage: deptInSiteRanking?.total ? ((deptInSiteRanking?.rank || 0) / deptInSiteRanking?.total) * 100 : 0, type: 'station' }
1076
                 ];
1079
                 ];
1077
             } else if (this.isBrigade) {
1080
             } else if (this.isBrigade) {
1078
-                const { deptInSiteRanking } = this.accuracyStatistics;
1081
+                const { brigadeInSiteRanking } = this.accuracyStatistics;
1079
                 return [
1082
                 return [
1080
-                    { label: '站级排名', current: deptInSiteRanking?.rank || 0, total: deptInSiteRanking?.total || 0, percentage: deptInSiteRanking?.total ? ((deptInSiteRanking?.rank || 0) / deptInSiteRanking?.total) * 100 : 0, type: 'station' }
1083
+                    { label: '站级排名', current: brigadeInSiteRanking?.rank || 0, total: brigadeInSiteRanking?.total || 0, percentage: brigadeInSiteRanking?.total ? ((brigadeInSiteRanking?.rank || 0) / brigadeInSiteRanking?.total) * 100 : 0, type: 'station' }
1081
                 ];
1084
                 ];
1082
             } else if (this.isTeamView) {
1085
             } else if (this.isTeamView) {
1083
-                const { teamInDeptRanking, deptRanking, teamInSiteRanking } = this.accuracyStatistics;
1086
+                const { teamInDeptRanking, deptRanking, teamInSiteRanking,teamInBrigadeRanking } = this.accuracyStatistics;
1084
                 // 班组长角色:显示科级和站级排名
1087
                 // 班组长角色:显示科级和站级排名
1085
                 return [
1088
                 return [
1086
                     { label: '主管排名', current: teamInDeptRanking?.rank || 0, total: teamInDeptRanking?.total || 0, percentage: teamInDeptRanking?.total ? ((teamInDeptRanking.rank || 0) / teamInDeptRanking.total) * 100 : 0 },
1089
                     { label: '主管排名', current: teamInDeptRanking?.rank || 0, total: teamInDeptRanking?.total || 0, percentage: teamInDeptRanking?.total ? ((teamInDeptRanking.rank || 0) / teamInDeptRanking.total) * 100 : 0 },
1087
-                    { label: '大队排名', current: deptRanking?.rank || 0, total: deptRanking?.total || 0, percentage: deptRanking?.total ? ((deptRanking.rank || 0) / deptRanking.total) * 100 : 0 },
1090
+                    { label: '大队排名', current: teamInBrigadeRanking?.rank || 0, total: teamInBrigadeRanking?.total || 0, percentage: teamInBrigadeRanking?.total ? ((teamInBrigadeRanking.rank || 0) / teamInBrigadeRanking.total) * 100 : 0 },
1088
                     { label: '站级排名', current: teamInSiteRanking?.rank || 0, total: teamInSiteRanking?.total || 0, percentage: teamInSiteRanking?.total ? ((teamInSiteRanking.rank || 0) / teamInSiteRanking.total) * 100 : 0, type: 'station' }
1091
                     { label: '站级排名', current: teamInSiteRanking?.rank || 0, total: teamInSiteRanking?.total || 0, percentage: teamInSiteRanking?.total ? ((teamInSiteRanking.rank || 0) / teamInSiteRanking.total) * 100 : 0, type: 'station' }
1089
                 ];
1092
                 ];
1090
             } else {
1093
             } else {
@@ -1380,6 +1383,7 @@ img {
1380
 }
1383
 }
1381
 
1384
 
1382
 .item-value {
1385
 .item-value {
1386
+    line-height: 1;
1383
     font-size: 32rpx;
1387
     font-size: 32rpx;
1384
     font-weight: bold;
1388
     font-weight: bold;
1385
     color: #FFFFFF;
1389
     color: #FFFFFF;