Browse Source

refactor(portrait): 移除硬编码模拟数据,接入后端接口

1.  清空stationProfile页面的静态图表模拟数据
2.  新增安保相关接口api文件
3.  在runData组件中接入安保测试物品分类接口,替换静态数据
4.  添加queryParams监听以响应参数变化
5.  清理代码冗余空格与废弃变量
huoyi 4 weeks ago
parent
commit
8765afc844

+ 26 - 0
src/api/portraitManagement/portraitManagement.js

@@ -0,0 +1,26 @@
1
+import request from '@/utils/request'
2
+
3
+// 安保测试物品分类
4
+export function securityTestItemClassification(data) {
5
+    return request({ url: '/ledger/securityTest/securityTestItemClassification', method: 'post', data })
6
+}
7
+
8
+// 安保测试通过情况
9
+export function securityTestPassingStatus(data) {
10
+    return request({ url: '/ledger/securityTest/securityTestPassingStatus', method: 'post', data })
11
+}
12
+
13
+// 安保测试区域情况
14
+export function securityTestRegion(data) {
15
+    return request({ url: '/ledger/securityTest/securityTestRegion', method: 'post', data })
16
+}
17
+
18
+// 实时质控拦截物品分布
19
+export function realtimeInterceptionItem(data) {
20
+    return request({ url: '/ledger/realtimeInterception/realtimeInterceptionItem', method: 'post', data })
21
+}
22
+
23
+// 各岗位监察问题分布
24
+export function supervisionProblemPosition(data) {
25
+    return request({ url: '/ledger/supervisionProblem/supervisionProblemPosition', method: 'post', data })
26
+}

+ 3 - 15
src/views/portraitManagement/stationProfile/component/profile.vue

@@ -72,23 +72,11 @@ const politicalData = [
72 72
   { value: 138, name: '预备党员', itemStyle: { color: '#7effc4' } }
73 73
 ]
74 74
 
75
-const skillData = {
76
-  categories: ['等级1', '等级2', '等级3', '等级4', '等级5'],
77
-  values: [450, 650, 900, 750, 550],
78
-  colors: ['#ff6b9d', '#ff6b6b']
79
-}
75
+const skillData = []
80 76
 
81
-const operateData = {
82
-  categories: ['0-3', '4-7', '8-11', '12-15', '16-19'],
83
-  values: [650, 500, 400, 300, 550],
84
-  colors: ['#a55eea', '#bd03fb']
85
-}
77
+const operateData = []
86 78
 
87
-const postData = {
88
-  categories: ['仿伪', '炸探', '人身', '开包', '开检后', '开机'],
89
-  values: [450, 600, 180, 150, 650, 550],
90
-  colors: ['#ffd93d', '#ffd9b3']
91
-}
79
+const postData = []
92 80
 
93 81
 </script>
94 82
 

+ 33 - 15
src/views/portraitManagement/stationProfile/component/runData.vue

@@ -5,7 +5,7 @@
5 5
         <div ref="hourlyPassChartRef" class="hourly-pass-chart"></div>
6 6
       </InfoCard>
7 7
       <div class="info-panel">
8
-   
8
+
9 9
         <div class="panel-body">
10 10
           <div class="datetime-row">
11 11
             <span class="info-date">{{ currentDate }}</span>
@@ -16,7 +16,7 @@
16 16
             <span class="time-row">{{ currentTime }}</span>
17 17
           </div>
18 18
 
19
-       
19
+
20 20
           <div class="duty-item">
21 21
             <span class="duty-label">值班领导:</span>
22 22
             <span class="duty-value">{{ dutyLeader }}</span>
@@ -74,7 +74,7 @@
74 74
 </template>
75 75
 
76 76
 <script setup>
77
-import { ref, onMounted, onUnmounted, nextTick } from 'vue'
77
+import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue'
78 78
 import * as echarts from 'echarts'
79 79
 import InfoCard from '../../components/card.vue'
80 80
 import SeizedInfo from '../../components/SeizedInfo.vue'
@@ -87,6 +87,7 @@ import EventWorkArea from '../../components/EventWorkArea.vue'
87 87
 import TestItems from '../../components/TestItems.vue'
88 88
 import TestResult from '../../components/TestResult.vue'
89 89
 import TestArea from '../../components/TestArea.vue'
90
+import { securityTestItemClassification } from '@/api/portraitManagement/portraitManagement'
90 91
 
91 92
 const props = defineProps({
92 93
   queryParams: {
@@ -140,11 +141,31 @@ const seizedInfoData = [
140 141
   { num: 481 }
141 142
 ]
142 143
 
143
-const seizedItemsData = [
144
-  { num: 50, name: '打火机' },
145
-  { num: 30, name: '管制刀具' },
146
-  { num: 20, name: '其他' }
147
-]
144
+const seizedItemsData = ref([])
145
+const securityTestItemData = ref([])
146
+
147
+const fetchSeizedItemsData = async () => {
148
+  try {
149
+    const res = await securityTestItemClassification(props.queryParams)
150
+    if (res.code === 200 && res.data) {
151
+      securityTestItemData.value = res.data.map(item => ({
152
+        num: item.total,
153
+        name: item.name
154
+      }))
155
+    }
156
+  } catch (error) {
157
+    console.error('获取安保测试物品分类数据失败', error)
158
+  }
159
+}
160
+
161
+const fetchData = () => {
162
+  fetchSeizedItemsData()
163
+}
164
+
165
+watch(() => props.queryParams, () => {
166
+
167
+  fetchData()
168
+}, { deep: true, immediate: true })
148 169
 
149 170
 const seizedNumAllData = [
150 171
   { num: 150 }, { num: 160 }, { num: 145 }, { num: 180 }, { num: 170 },
@@ -193,12 +214,7 @@ const unsafePostDistData = [
193 214
   { num: 387, name: '开箱/货检' }
194 215
 ]
195 216
 
196
-const securityTestItemData = [
197
-  { num: 5, name: '烟花' },
198
-  { num: 8, name: '鞭炮' },
199
-  { num: 2, name: '打火机' },
200
-  { num: 3, name: '野生点火器' }
201
-]
217
+
202 218
 
203 219
 const securityTestPassData = [
204 220
   { num: 44, name: '通过' },
@@ -420,6 +436,7 @@ const handleResize = () => {
420 436
 onMounted(() => {
421 437
   updateDateTime()
422 438
   dateTimer = setInterval(updateDateTime, 1000)
439
+
423 440
   nextTick(() => {
424 441
     setTimeout(() => {
425 442
       initHourlyPassChart()
@@ -444,7 +461,7 @@ onUnmounted(() => {
444 461
   gap: 20px;
445 462
 
446 463
   .content-row {
447
-  height: 400px;
464
+    height: 400px;
448 465
     padding: 0 20px;
449 466
     display: flex;
450 467
     gap: 20px;
@@ -501,6 +518,7 @@ onUnmounted(() => {
501 518
     .date-row {
502 519
       display: flex;
503 520
       align-items: center;
521
+
504 522
       .info-date {
505 523
         font-size: 22px;
506 524
         font-weight: bold;