Bläddra i källkod

Merge branch 'homepageLargeScreen' into dev

huoyi 3 veckor sedan
förälder
incheckning
22761a82b3

+ 4 - 1
src/views/dataBigScreen/dashboard/components/pageItems/StandardExecution.vue

@@ -262,8 +262,11 @@ useTimeOut(() => {
262 262
     })
263 263
   }
264 264
   const portraitParams = {}
265
-  if (props.type === 'department') {
265
+ 
266
+   if (props.type === 'manager') {
266 267
     portraitParams.checkedDepartmentId = params.value.deptId
268
+  } else if (props.type === 'brigade') {
269
+    portraitParams.checkedBrigadeId = params.value.deptId
267 270
   } else if (props.type === 'team') {
268 271
     portraitParams.checkedTeamId = params.value.deptId
269 272
   } else if (props.type === 'personal') {

+ 53 - 32
src/views/dataBigScreen/dashboard/components/pageItems/WorkOutput.vue

@@ -33,7 +33,7 @@
33 33
 
34 34
 <script setup>
35 35
 import ChartsContainer from '../ChartsContainer.vue';
36
-import { ref } from 'vue';
36
+import { ref, watch } from 'vue';
37 37
 import { getSiteStatistics, getModuleMetrics, getRankInfo } from '@/api/item/items'
38 38
 import { useTimeOut } from '../pageItems/useTimeOut'
39 39
 const props = defineProps({
@@ -50,49 +50,70 @@ const rowTableItem = ref({
50 50
 })
51 51
 const rank = ref({})
52 52
 const params = inject('provideParams')
53
-useTimeOut(() => {
54
-  !props.type && params.value.deptId && getSiteStatistics({ deptId: params.value.deptId }).then(res => {
55
-    tableData.value = res.data
56
-  })
53
+
54
+// 封装API请求函数
55
+const fetchData = () => {
56
+  // 站点统计请求(当没有type时)
57
+  if (!props.type && params.value.deptId) {
58
+    getSiteStatistics({ deptId: params.value.deptId }).then(res => {
59
+      tableData.value = res.data
60
+    })
61
+  }
62
+  
63
+  // 构建API参数
57 64
   let apiParams = {}
58 65
   if (props.type === 'personal') {
59 66
     apiParams = { userId: params.value.deptId }
60 67
   } else {
61 68
     apiParams = { deptId: params.value.deptId }
62 69
   }
63
-  props.type && params.value.deptId && getModuleMetrics({ ...apiParams, userTypeStr: props.type }).then(res => {
64
-    const { moduleResults } = res.data
65
-    if (!moduleResults || Object.keys(moduleResults).length === 0) {
66
-      moduleResults = {
67
-        item: {
68
-          effectiveSeizureCount: {},
69
-          referToPoliceCount: {},
70
-          willfulConcealmentCount: {},
70
+  
71
+  // 模块指标请求(当有type时)
72
+  if (props.type && params.value.deptId) {
73
+    getModuleMetrics({ ...apiParams, userTypeStr: props.type }).then(res => {
74
+      let { moduleResults } = res.data
75
+      if (!moduleResults || Object.keys(moduleResults).length === 0) {
76
+        moduleResults = {
77
+          item: {
78
+            effectiveSeizureCount: {},
79
+            referToPoliceCount: {},
80
+            willfulConcealmentCount: {},
81
+          }
71 82
         }
72 83
       }
73
-    }
74 84
 
75
-    if (props.type === 'personal') {
76
-      rowTableItem.value = {
77
-        effectiveSeizureCount: {
78
-          totalCount: moduleResults.item.effectiveSeizureCount
79
-        },
80
-        referToPoliceCount: {
81
-          count: moduleResults.item.referToPoliceCount
82
-        },
83
-        willfulConcealmentCount: {
84
-          count: moduleResults.item.willfulConcealmentCount
85
-        },
85
+      if (props.type === 'personal') {
86
+        rowTableItem.value = {
87
+          effectiveSeizureCount: {
88
+            totalCount: moduleResults.item.effectiveSeizureCount
89
+          },
90
+          referToPoliceCount: {
91
+            count: moduleResults.item.referToPoliceCount
92
+          },
93
+          willfulConcealmentCount: {
94
+            count: moduleResults.item.willfulConcealmentCount
95
+          },
96
+        }
97
+      } else {
98
+        rowTableItem.value = moduleResults.item
86 99
       }
87
-    } else {
88
-      rowTableItem.value = moduleResults.item
100
+    })
101
+    
102
+    // 排名信息请求
103
+    getRankInfo({ ...apiParams, level: 'station' }).then(res => {
104
+      rank.value = res.data || {};
105
+    })
106
+  }
107
+}
89 108
 
90
-    }
109
+// 监听props.type变化
110
+watch(() => props.type, () => {
111
+  fetchData()
112
+})
91 113
 
92
-  })
93
-  props.type && params.value.deptId && getRankInfo({ ...apiParams, level: 'station' }).then(res => {
94
-    rank.value = res.data || {};
95
-  })
114
+// 使用定时器调用fetchData
115
+useTimeOut(() => {
116
+  fetchData()
96 117
 }, [ params ])
97 118
 
98 119
 

+ 5 - 1
src/views/dataBigScreen/dashboard/components/pageView/OrganizationalPortraitSectionLevel.vue

@@ -108,7 +108,10 @@ try {
108 108
     const appendItem = (list) => {
109 109
       list.forEach(attr => {
110 110
         let type = 'department'
111
-        if (attr.deptType === 'DEPARTMENT') {
111
+         if (attr.deptType === 'BRIGADE') {
112
+          type = 'brigade'
113
+        }
114
+        if (attr.deptType === 'MANAGER') {
112 115
           type = 'department'
113 116
         }
114 117
         if (attr.deptType === 'TEAMS') {
@@ -126,6 +129,7 @@ try {
126 129
         }
127 130
       })
128 131
     }
132
+    
129 133
     departments.value = res.data.reduce((cur, acc) => {
130 134
       acc.children && acc.children.length && cur.push(...acc.children)
131 135
       appendItem(acc.children)

+ 2 - 2
src/views/dataBigScreen/dashboard/components/pageView/RealTimeStatus.vue

@@ -68,12 +68,12 @@ useTimeOut(() => {
68 68
 
69 69
     &>*:nth-child(1) {
70 70
       width: 100%;
71
-      height: 36%;
71
+      height: 50%;
72 72
     }
73 73
 
74 74
     &>*:nth-child(2) {
75 75
       width: 100%;
76
-      height: 32%;
76
+      height: 50%;
77 77
     }
78 78
 
79 79
     &>*:nth-child(3) {