Преглед на файлове

feat(首页): 调整角色显示文本并增加大队相关数据展示

- 将"全科"统一改为"主管"以符合实际业务场景
- 增加大队相关数据字段(brigadePassRate/brigadeRanking等)的处理逻辑
- 完善各角色视图下的数据展示逻辑,确保大队数据正确显示
huoyi преди 2 месеца
родител
ревизия
7db7c6f490
променени са 1 файла, в които са добавени 43 реда и са изтрити 41 реда
  1. 43 41
      src/pages/home-new/index.vue

+ 43 - 41
src/pages/home-new/index.vue

@@ -256,7 +256,7 @@ export default {
256 256
         // 根据角色返回不同的出勤信息数组
257 257
         attendanceItems() {
258 258
             let res = {};
259
-            
259
+
260 260
             if (this.role.includes('kezhang') || this.isZhanZhang) {
261 261
                 // 班组长选择班组视图
262 262
                 if (this.isZhanZhang) {
@@ -265,19 +265,19 @@ export default {
265 265
                 if (this.role.includes('kezhang')) {
266 266
                     res = this.attendanceStats.sectionLeaderStats
267 267
                 }
268
-                
268
+
269 269
                 // 抽离复杂的判断逻辑
270 270
                 const isZhanZhang = this.isZhanZhang;
271
-                const firstLabel = isZhanZhang ? '在岗大队' :this.isBrigade? '执勤大队' : '在岗班组';
271
+                const firstLabel = isZhanZhang ? '在岗大队' : this.isBrigade ? '执勤大队' : '在岗班组';
272 272
                 const firstValue = isZhanZhang ? res?.dutyDeptName : res?.onDutyTeamCount;
273
-                
274
-                const secondLabel = isZhanZhang||this.isBrigade ? '在岗班组' : '在岗人员';
273
+
274
+                const secondLabel = isZhanZhang || this.isBrigade ? '在岗班组' : '在岗人员';
275 275
                 const secondValue = isZhanZhang ? res?.onDutyTeamCount : res?.onDutyPersonnelCount;
276
-                
277
-                const thirdLabel = isZhanZhang||this.isBrigade ? '在岗人员' : '出勤时间';
276
+
277
+                const thirdLabel = isZhanZhang || this.isBrigade ? '在岗人员' : '出勤时间';
278 278
                 const thirdValue = isZhanZhang ? res?.onDutyPersonnelCount : (res?.attendanceTime || res?.attendanceTimeTips);
279 279
                 const thirdLink = isZhanZhang ? '' : (res?.attendanceTime ? '' : '/pages/attendance/index');
280
-                
280
+
281 281
                 return [
282 282
                     { label: firstLabel, value: firstValue },
283 283
                     { label: secondLabel, value: secondValue },
@@ -824,7 +824,7 @@ export default {
824 824
             } else if (this.isTeamView) {
825 825
                 return '班组';
826 826
             } else if (this.role.includes('kezhang')) {
827
-                return '全科';
827
+                return '主管';
828 828
             } else if (this.isZhanZhang) {
829 829
                 return '全站';
830 830
             } else {
@@ -834,14 +834,14 @@ export default {
834 834
 
835 835
         // 根据角色获取巡检数据项数组
836 836
         getInspectionDataItems() {
837
-            const { personalPassRate, teamPassRate, departmentPassRate, stationPassRate, teamRankingList, departmentRankingList } = this.inspectionData;
837
+            const { personalPassRate, teamPassRate, departmentPassRate, stationPassRate, teamRankingList, departmentRankingList,brigadeRankingList,brigadePassRate } = this.inspectionData;
838 838
             if (this.isIndividualView) {
839 839
                 // SecurityCheck角色:本人、班平均、主管平均、站平均
840 840
                 return [
841 841
                     { label: '本人', value: ((personalPassRate || 0) * 100).toFixed(2), isImage: false },
842 842
                     { label: '班平均', value: ((teamPassRate || 0) * 100).toFixed(2), isImage: false, color: teamPassRate < personalPassRate ? '#00AE41' : '#F96060' },
843 843
                     { label: '主管平均', value: ((departmentPassRate || 0) * 100).toFixed(2), isImage: false, color: departmentPassRate < personalPassRate ? '#00AE41' : '#F96060' },
844
-                    { label: '大队平均', value: 0, isImage: false, color: departmentPassRate < personalPassRate ? '#00AE41' : '#F96060' },
844
+                    { label: '大队平均', value: ((brigadePassRate || 0) * 100).toFixed(2), isImage: false, color: brigadePassRate < personalPassRate ? '#00AE41' : '#F96060' },
845 845
                     { label: '站平均', value: ((stationPassRate || 0) * 100).toFixed(2), isImage: false, color: stationPassRate < personalPassRate ? '#00AE41' : '#F96060' }
846 846
                 ];
847 847
             } else if (this.isTeamView) {
@@ -852,19 +852,19 @@ export default {
852 852
                     { label: '站平均', value: ((stationPassRate || 0) * 100).toFixed(2), isImage: false, color: stationPassRate < teamPassRate ? '#00AE41' : '#F96060' }
853 853
                 ];
854 854
             } else if (this.role.includes('kezhang')) {
855
-                // kezhang角色:全科、站平均、前三名班组(isImage: true)
855
+                // kezhang角色:主管、站平均、前三名班组(isImage: true)
856 856
                 return [
857
-                    { label: '全科', value: ((departmentPassRate || 0) * 100).toFixed(2), isImage: false },
857
+                    { label: '主管', value: ((departmentPassRate || 0) * 100).toFixed(2), isImage: false },
858 858
                     { label: '站平均', value: ((stationPassRate || 0) * 100).toFixed(2), isImage: false, color: stationPassRate < departmentPassRate ? '#00AE41' : '#F96060' },
859 859
                     { label: this.getObjByRank(teamRankingList, 1).name, value: '/static/images/icon/one.png', isImage: true },
860 860
                     { label: this.getObjByRank(teamRankingList, 2).name, value: '/static/images/icon/two.png', isImage: true },
861 861
                     { label: this.getObjByRank(teamRankingList, 3).name, value: '/static/images/icon/three.png', isImage: true }
862 862
                 ];
863 863
             } else if (this.isBrigade) {
864
-                // brigade角色:全科、站平均、前三名班组(isImage: true)
864
+                // brigade角色:主管、站平均、前三名班组(isImage: true)
865 865
                 return [
866
-                    { label: '全科', value: ((departmentPassRate || 0) * 100).toFixed(2), isImage: false },
867
-                    { label: '大队平均', value: ((stationPassRate || 0) * 100).toFixed(2), isImage: false, color: stationPassRate < departmentPassRate ? '#00AE41' : '#F96060' },
866
+                    { label: '主管', value: ((departmentPassRate || 0) * 100).toFixed(2), isImage: false },
867
+                    { label: '大队平均', value: ((brigadePassRate || 0) * 100).toFixed(2), isImage: false, color: brigadePassRate < departmentPassRate ? '#00AE41' : '#F96060' },
868 868
                     { label: this.getObjByRank(teamRankingList, 1).name, value: '/static/images/icon/one.png', isImage: true },
869 869
                     { label: this.getObjByRank(teamRankingList, 2).name, value: '/static/images/icon/two.png', isImage: true },
870 870
                     { label: this.getObjByRank(teamRankingList, 3).name, value: '/static/images/icon/three.png', isImage: true }
@@ -905,18 +905,18 @@ export default {
905 905
                     { label: '站平均', value: (siteAvgAccuracy || 0), isImage: false, color: siteAvgAccuracy < teamAvgAccuracy ? '#00AE41' : '#F96060' }
906 906
                 ];
907 907
             } else if (this.role.includes('kezhang')) {
908
-                // kezhang角色:全科、站平均、前三名班组(isImage: true)
908
+                // kezhang角色:主管、站平均、前三名班组(isImage: true)
909 909
                 return [
910
-                    { label: '全科', value: (deptAvgAccuracy || 0), isImage: false, },
910
+                    { label: '主管', value: (deptAvgAccuracy || 0), isImage: false, },
911 911
                     { label: '站平均', value: (siteAvgAccuracy || 0), isImage: false, color: siteAvgAccuracy < deptAvgAccuracy ? '#00AE41' : '#F96060' },
912 912
                     { label: this.getObjByRank(topTeamsInDept, 1).teamName, value: '/static/images/icon/one.png', isImage: true },
913 913
                     { label: this.getObjByRank(topTeamsInDept, 2).teamName, value: '/static/images/icon/two.png', isImage: true },
914 914
                     { label: this.getObjByRank(topTeamsInDept, 3).teamName, value: '/static/images/icon/three.png', isImage: true }
915 915
                 ];
916 916
             } else if (this.isBrigade) {
917
-                // brigade角色:全科、站平均、前三名班组(isImage: true)
917
+                // brigade角色:主管、站平均、前三名班组(isImage: true)
918 918
                 return [
919
-                    { label: '全科', value: (deptAvgAccuracy || 0), isImage: false, },
919
+                    { label: '主管', value: (deptAvgAccuracy || 0), isImage: false, },
920 920
                     { label: '大队平均', value: (siteAvgAccuracy || 0), isImage: false, color: siteAvgAccuracy < deptAvgAccuracy ? '#00AE41' : '#F96060' },
921 921
                     { label: this.getObjByRank(topTeamsInDept, 1).teamName, value: '/static/images/icon/one.png', isImage: true },
922 922
                     { label: this.getObjByRank(topTeamsInDept, 2).teamName, value: '/static/images/icon/two.png', isImage: true },
@@ -945,48 +945,50 @@ export default {
945 945
             if (this.isIndividualView) {
946 946
                 // SecurityCheck角色:从securityCheckerData解构
947 947
                 const { securityCheckerData } = this.seizeData;
948
-                const { selfSeizureCount, teamAverage, departmentAverage, stationAverage } = securityCheckerData || {}
948
+                const { selfSeizureCount, teamAverage, departmentAverage, brigadeAverage, stationAverage } = securityCheckerData || {}
949 949
 
950 950
                 // SecurityCheck角色:本人、班平均、主管平均、站平均
951 951
                 return [
952 952
                     { label: '本人', value: selfSeizureCount || 0, isImage: false },
953 953
                     { label: '班平均', value: teamAverage || 0, isImage: false, color: teamAverage < selfSeizureCount ? '#00AE41' : '#F96060' },
954 954
                     { label: '主管平均', value: departmentAverage || 0, isImage: false, color: departmentAverage < selfSeizureCount ? '#00AE41' : '#F96060' },
955
-                    { label: '大队平均', value: 0, isImage: false, color: departmentAverage < selfSeizureCount ? '#00AE41' : '#F96060' },
955
+                    { label: '大队平均', value: brigadeAverage || 0, isImage: false, color: brigadeAverage < selfSeizureCount ? '#00AE41' : '#F96060' },
956 956
                     { label: '站平均', value: (stationAverage && stationAverage.toFixed(2)) || 0, isImage: false, color: stationAverage < selfSeizureCount ? '#00AE41' : '#F96060' }
957 957
                 ];
958 958
             } else if (this.isTeamView) {
959 959
                 // banzuzhang角色:从teamLeaderData解构
960 960
                 const { teamLeaderData } = this.seizeData;
961
-                const { departmentAverage, stationAverage, teamAverage } = teamLeaderData || {};
961
+                const { departmentAverage, brigadeAverage, stationAverage, teamAverage } = teamLeaderData || {};
962 962
                 // banzuzhang角色:班组、主管平均、站平均
963 963
                 return [
964 964
                     { label: '班组', value: teamAverage || 0, isImage: false },
965 965
                     { label: '主管平均', value: departmentAverage || 0, isImage: false, color: departmentAverage < teamAverage ? '#00AE41' : '#F96060' },
966
-                    { label: '大队平均', value: 0, isImage: false, color: departmentAverage < teamAverage ? '#00AE41' : '#F96060' },
966
+                    { label: '大队平均', value: brigadeAverage || 0, isImage: false, color: brigadeAverage < teamAverage ? '#00AE41' : '#F96060' },
967 967
                     { label: '站平均', value: (stationAverage && stationAverage.toFixed(2)) || 0, isImage: false, color: stationAverage < teamAverage ? '#00AE41' : '#F96060' }
968 968
                 ];
969 969
             } else if (this.role.includes('kezhang')) {
970 970
                 // kezhang角色:从securityCheckerData解构
971 971
                 const { sectionMasterData } = this.seizeData;
972
-                const { stationAverage, topThreeTeams, departmentAverage } = sectionMasterData || {}
972
+                const { teamAverage, brigadeAverage, departmentAverage,stationAverage } = sectionMasterData || {}
973 973
 
974
-                // kezhang角色:全科、站平均、前三名班组(isImage: true)
974
+                // kezhang角色:主管、站平均、前三名班组(isImage: true)
975 975
                 return [
976
-                    { label: '全科', value: departmentAverage || 0, isImage: false },
977
-                    { label: '站平均', value: stationAverage?.toFixed(2) || 0, isImage: false, color: stationAverage?.toFixed(2) < departmentAverage ? '#00AE41' : '#F96060' },
978
-                    { label: this.getObjByRank(topThreeTeams, 1).teamName, value: '/static/images/icon/one.png', isImage: true },
979
-                    { label: this.getObjByRank(topThreeTeams, 2).teamName, value: '/static/images/icon/two.png', isImage: true },
980
-                    { label: this.getObjByRank(topThreeTeams, 3).teamName, value: '/static/images/icon/three.png', isImage: true }
976
+                    { label: '主管', value: departmentAverage || 0, isImage: false },
977
+                    { label: '主管平均', value: departmentAverage || 0, isImage: false, color: departmentAverage < teamAverage ? '#00AE41' : '#F96060' },
978
+                    { label: '大队平均', value: brigadeAverage || 0, isImage: false, color: brigadeAverage < teamAverage ? '#00AE41' : '#F96060' },
979
+                    { label: '站平均', value: (stationAverage && stationAverage.toFixed(2)) || 0, isImage: false, color: stationAverage < teamAverage ? '#00AE41' : '#F96060' }
980
+                    // { label: this.getObjByRank(topThreeTeams, 1).teamName, value: '/static/images/icon/one.png', isImage: true },
981
+                    // { label: this.getObjByRank(topThreeTeams, 2).teamName, value: '/static/images/icon/two.png', isImage: true },
982
+                    // { label: this.getObjByRank(topThreeTeams, 3).teamName, value: '/static/images/icon/three.png', isImage: true }
981 983
                 ];
982 984
             } else if (this.isBrigade) {
983 985
                 // brigade角色:从securityCheckerData解构
984 986
                 const { sectionMasterData } = this.seizeData;
985 987
                 const { stationAverage, topThreeTeams, departmentAverage } = sectionMasterData || {}
986 988
 
987
-                // brigade角色:全科、站平均、前三名班组(isImage: true)
989
+                // brigade角色:主管、站平均、前三名班组(isImage: true)
988 990
                 return [
989
-                    { label: '全科', value: departmentAverage || 0, isImage: false },
991
+                    { label: '主管', value: departmentAverage || 0, isImage: false },
990 992
                     { label: '大队平均', value: stationAverage?.toFixed(2) || 0, isImage: false, color: stationAverage?.toFixed(2) < departmentAverage ? '#00AE41' : '#F96060' },
991 993
                     { label: this.getObjByRank(topThreeTeams, 1).teamName, value: '/static/images/icon/one.png', isImage: true },
992 994
                     { label: this.getObjByRank(topThreeTeams, 2).teamName, value: '/static/images/icon/two.png', isImage: true },
@@ -1028,14 +1030,14 @@ export default {
1028 1030
 
1029 1031
         // 根据角色获取巡检排名列表
1030 1032
         getRankList() {
1031
-            const { teamRanking, teamTotal, departmentRanking, departmentTotal, stationRanking, stationTotal } = this.inspectionData;
1033
+            const { teamRanking, teamTotal, departmentRanking, departmentTotal, stationRanking, stationTotal,brigadeTotal,brigadeRanking } = this.inspectionData;
1032 1034
             // 根据角色返回不同的排名数据
1033 1035
             if (this.isIndividualView) {
1034 1036
                 // 科长、SecurityCheck角色:显示班组、科级和站级排名
1035 1037
                 return [
1036 1038
                     { label: '班组排名', current: teamRanking || 0, total: teamTotal || 0, percentage: teamTotal ? ((teamRanking || 0) / teamTotal) * 100 : 0 },
1037 1039
                     { label: '主管排名', current: departmentRanking || 0, total: departmentTotal || 0, percentage: departmentTotal ? ((departmentRanking || 0) / departmentTotal) * 100 : 0 },
1038
-                    { label: '大队排名', current: departmentRanking || 0, total: departmentTotal || 0, percentage: departmentTotal ? ((departmentRanking || 0) / departmentTotal) * 100 : 0 },
1040
+                    { label: '大队排名', current: brigadeRanking || 0, total: brigadeTotal || 0, percentage: brigadeTotal ? ((brigadeRanking || 0) / brigadeTotal) * 100 : 0 },
1039 1041
                     { label: '站级排名', current: stationRanking || 0, total: stationTotal || 0, percentage: stationTotal ? ((stationRanking || 0) / stationTotal) * 100 : 0, type: 'station' }
1040 1042
                 ];
1041 1043
             } else if (this.role.includes('kezhang')) {
@@ -1100,20 +1102,20 @@ export default {
1100 1102
             // 根据角色返回不同的排名数据
1101 1103
             if (this.isIndividualView) {
1102 1104
                 const { securityCheckerData } = this.seizeData;
1103
-                const { teamRanking, departmentRanking, stationRanking } = securityCheckerData || {}
1105
+                const { teamRanking, departmentRanking, stationRanking,brigadeRanking } = securityCheckerData || {}
1104 1106
                 // 科长、SecurityCheck角色:显示班组、科级和站级排名
1105 1107
                 return [
1106 1108
                     { label: '班组排名', current: teamRanking?.currentRank || 0, total: teamRanking?.totalItems || 0, percentage: teamRanking?.totalItems ? ((teamRanking.currentRank || 0) / teamRanking.totalItems) * 100 : 0 },
1107 1109
                     { label: '主管排名', current: departmentRanking?.currentRank || 0, total: departmentRanking?.totalItems || 0, percentage: departmentRanking?.totalItems ? ((departmentRanking.currentRank || 0) / departmentRanking.totalItems) * 100 : 0 },
1108
-                    { label: '大队排名', current: departmentRanking?.currentRank || 0, total: departmentRanking?.totalItems || 0, percentage: departmentRanking?.totalItems ? ((departmentRanking.currentRank || 0) / departmentRanking.totalItems) * 100 : 0 },
1110
+                    { label: '大队排名', current: brigadeRanking?.currentRank || 0, total: brigadeRanking?.totalItems || 0, percentage: brigadeRanking?.totalItems ? ((brigadeRanking.currentRank || 0) / brigadeRanking.totalItems) * 100 : 0 },
1109 1111
                     { label: '站级排名', current: stationRanking?.currentRank || 0, total: stationRanking?.totalItems || 0, percentage: stationRanking?.totalItems ? ((stationRanking.currentRank || 0) / stationRanking.totalItems) * 100 : 0, type: 'station' }
1110 1112
                 ];
1111 1113
             } else if (this.role.includes('kezhang')) {
1112 1114
                 const { sectionMasterData } = this.seizeData;
1113
-                const { stationRanking, departmentRanking } = sectionMasterData || {};
1115
+                const { stationRanking, departmentRanking,brigadeRanking } = sectionMasterData || {};
1114 1116
                 // 科长、SecurityCheck角色:显示班组、科级和站级排名
1115 1117
                 return [
1116
-                    { label: '大队排名', current: departmentRanking?.currentRank || 0, total: departmentRanking?.totalItems || 0, percentage: departmentRanking?.totalItems ? ((departmentRanking.currentRank || 0) / departmentRanking.totalItems) * 100 : 0 },
1118
+                    { label: '大队排名', current: brigadeRanking?.currentRank || 0, total: brigadeRanking?.totalItems || 0, percentage: brigadeRanking?.totalItems ? ((brigadeRanking.currentRank || 0) / brigadeRanking.totalItems) * 100 : 0 },
1117 1119
                     { label: '站级排名', current: stationRanking?.currentRank || 0, total: stationRanking?.totalItems || 0, percentage: stationRanking?.totalItems ? ((stationRanking.currentRank || 0) / stationRanking.totalItems) * 100 : 0, type: 'station' }
1118 1120
                 ];
1119 1121
             } else if (this.isBrigade) {
@@ -1126,11 +1128,11 @@ export default {
1126 1128
                 ];
1127 1129
             } else if (this.isTeamView) {
1128 1130
                 const { teamLeaderData } = this.seizeData;
1129
-                const { departmentRanking, stationRanking } = teamLeaderData || {}
1131
+                const { departmentRanking, stationRanking,brigadeRanking } = teamLeaderData || {}
1130 1132
                 // 班组长角色:显示科级和站级排名
1131 1133
                 return [
1132 1134
                     { label: '主管排名', current: departmentRanking?.currentRank || 0, total: departmentRanking?.totalItems || 0, percentage: departmentRanking?.totalItems ? ((departmentRanking.currentRank || 0) / departmentRanking.totalItems) * 100 : 0 },
1133
-                    { label: '大队排名', current: departmentRanking?.currentRank || 0, total: departmentRanking?.totalItems || 0, percentage: departmentRanking?.totalItems ? ((departmentRanking.currentRank || 0) / departmentRanking.totalItems) * 100 : 0 },
1135
+                    { label: '大队排名', current: brigadeRanking?.currentRank || 0, total: brigadeRanking?.totalItems || 0, percentage: brigadeRanking?.totalItems ? ((brigadeRanking.currentRank || 0) / brigadeRanking.totalItems) * 100 : 0 },
1134 1136
                     { label: '站级排名', current: stationRanking?.currentRank || 0, total: stationRanking?.totalItems || 0, percentage: stationRanking?.totalItems ? ((stationRanking.currentRank || 0) / stationRanking.totalItems) * 100 : 0, type: 'station' }
1135 1137
                 ];
1136 1138
             } else {