Просмотр исходного кода

feat(设备详情): 添加设备详情弹窗组件并更新API地址

重构设备详情弹窗组件,支持从父组件传入设备数据并显示
修改环境配置中的API地址为生产环境
scholar-wei 1 месяц назад
Родитель
Сommit
daa7c0849c

+ 2 - 2
bigScreen3/.env.development

@@ -8,8 +8,8 @@ VITE_APP_ENV = 'development'
8 8
 # 若依管理系统/开发环境 http://192.168.1.15:8010/  http://123.56.29.119:8080  http://192.168.1.15:8120/ 1.194.161.64:8120
9 9
 
10 10
 
11
-VITE_APP_BASE_API = 'http://192.168.1.15:9090/'  
12
-# VITE_APP_BASE_API = 'http://39.164.159.226:9090/'   
11
+# VITE_APP_BASE_API = 'http://192.168.1.15:9090/'  
12
+VITE_APP_BASE_API = 'http://39.164.159.226:9090/'   
13 13
 
14 14
 # VITE_APP_BASE_API = 'http://1.194.161.64:8120/'    
15 15
 # VITE_APP_BASE_API = 'http://222.139.29.127:8120/'

+ 228 - 120
bigScreen3/src/views/dashboard/cpns/EquipmentDetail.vue

@@ -1,70 +1,76 @@
1 1
 <template>
2
-  <div class="equipment-detail-container">
3
-    <!-- 左侧设备信息区域 -->
4
-    <div class="equipment-info-section">
5
-      <h3 class="section-title">• 设备基本信息</h3>
6
-      <div class="info-content">
7
-        <div class="info-grid">
8
-          <div class="info-item">
9
-            <span class="info-label">项目名称:</span>
10
-            <span class="info-value">{{ equipmentData.projectName }}</span>
11
-          </div>
12
-          <div class="info-item">
13
-            <span class="info-label">申请单位:</span>
14
-            <span class="info-value">{{ equipmentData.applicantUnit }}</span>
15
-          </div>
16
-          <div class="info-item">
17
-            <span class="info-label">项目地点:</span>
18
-            <span class="info-value">{{ equipmentData.projectLocation }}</span>
19
-          </div>
20
-          <div class="info-item">
21
-            <span class="info-label">地址:</span>
22
-            <span class="info-value">{{ equipmentData.address }}</span>
23
-          </div>
24
-          <div class="info-item">
25
-            <span class="info-label">开始时间:</span>
26
-            <span class="info-value">{{ equipmentData.startTime }}</span>
27
-          </div>
28
-          <div class="info-item">
29
-            <span class="info-label">联系人:</span>
30
-            <span class="info-value">{{ equipmentData.contactPerson }}</span>
31
-          </div>
32
-          <div class="info-item">
33
-            <span class="info-label">结束时间:</span>
34
-            <span class="info-value">{{ equipmentData.endTime }}</span>
35
-          </div>
36
-          <div class="info-item">
37
-            <span class="info-label">联系电话:</span>
38
-            <span class="info-value">{{ equipmentData.contactPhone }}</span>
39
-          </div>
40
-          <div class="info-item">
41
-            <span class="info-label">许可时间:</span>
42
-            <span class="info-value">{{ equipmentData.permitTime }}</span>
43
-          </div>
44
-          <div class="info-item">
45
-            <span class="info-label">借用绿地面积:</span>
46
-            <span class="info-value">{{ equipmentData.greenArea }}</span>
47
-          </div>
48
-          <div class="info-item">
49
-            <span class="info-label">许可文号:</span>
50
-            <span class="info-value">{{ equipmentData.permitNumber }}</span>
51
-          </div>
52
-          <div class="info-item full-width">
53
-            <span class="info-label">备注:</span>
54
-            <span class="info-value">{{ equipmentData.remarks }}</span>
2
+  <div v-if="visible" class="equipment-detail-container">
3
+    <div class="work-order-detail-header">
4
+      <h2>工单详情</h2>
5
+      <button class="work-order-detail-close" @click="handleClose">×</button>
6
+    </div>
7
+    <div class="equipment-detail-content">
8
+      <!-- 左侧设备信息区域 -->
9
+      <div class="equipment-info-section">
10
+        <h3 class="section-title">• 设备基本信息</h3>
11
+        <div class="info-content">
12
+          <div class="info-grid">
13
+            <div class="info-item">
14
+              <span class="info-label">设备名称:</span>
15
+              <span class="info-value">{{ equipmentData.name }}</span>
16
+            </div>
17
+            <div class="info-item">
18
+              <span class="info-label">申请项目:</span>
19
+              <span class="info-value">{{ equipmentData.parkName }}</span>
20
+            </div>
21
+            <div class="info-item">
22
+              <span class="info-label">设备地点:</span>
23
+              <span class="info-value">{{ equipmentData.latitude + ',' + equipmentData.longitude }}</span>
24
+            </div>
25
+            <div class="info-item">
26
+              <span class="info-label">地址:</span>
27
+              <span class="info-value">{{ equipmentData.address }}</span>
28
+            </div>
29
+            <div class="info-item">
30
+              <span class="info-label">添加时间:</span>
31
+              <span class="info-value">{{ equipmentData.createdTime || '' }}</span>
32
+            </div>
33
+            <div class="info-item">
34
+              <span class="info-label">修改人:</span>
35
+              <span class="info-value">{{ equipmentData.updatedName || '' }}</span>
36
+            </div>
37
+            <div class="info-item">
38
+              <span class="info-label">修改时间:</span>
39
+              <span class="info-value">{{ equipmentData.updatedTime || '' }}</span>
40
+            </div>
41
+            <!-- <div class="info-item">
42
+              <span class="info-label">联系电话:</span>
43
+              <span class="info-value">{{ equipmentData.contactPhone }}</span>
44
+            </div>
45
+            <div class="info-item">
46
+              <span class="info-label">许可时间:</span>
47
+              <span class="info-value">{{ equipmentData.permitTime }}</span>
48
+            </div>
49
+            <div class="info-item">
50
+              <span class="info-label">借用绿地面积:</span>
51
+              <span class="info-value">{{ equipmentData.greenArea }}</span>
52
+            </div> -->
53
+            <!-- <div class="info-item">
54
+              <span class="info-label">许可文号:</span>
55
+              <span class="info-value">{{ equipmentData.permitNumber }}</span>
56
+            </div> -->
57
+            <div class="info-item full-width">
58
+              <span class="info-label">备注:</span>
59
+              <span class="info-value">{{ equipmentData.remarks }}</span>
60
+            </div>
55 61
           </div>
56 62
         </div>
57 63
       </div>
58
-    </div>
59
-    
60
-    <!-- 右侧设备图片区域 -->
61
-    <div class="equipment-image-section">
62
-      <h3 class="section-title">• 设备图片</h3>
63
-      <div class="image-container">
64
-        <div class="image-scroll-area">
65
-          <div class="image-grid">
66
-            <div v-for="(image, index) in equipmentImages" :key="index" class="image-item">
67
-              <img :src="image.url" :alt="`设备图片 ${index + 1}`" class="equipment-image" />
64
+
65
+      <!-- 右侧设备图片区域 -->
66
+      <div class="equipment-image-section">
67
+        <h3 class="section-title">• 设备图片</h3>
68
+        <div class="image-container">
69
+          <div class="image-scroll-area">
70
+            <div class="image-grid">
71
+              <div v-for="(image, index) in equipmentData.images" :key="index" class="image-item">
72
+                <img :src="image.url" :alt="`设备图片 ${index + 1}`" class="equipment-image" />
73
+              </div>
68 74
             </div>
69 75
           </div>
70 76
         </div>
@@ -74,24 +80,47 @@
74 80
 </template>
75 81
 
76 82
 <script setup>
77
-import { ref } from 'vue'
83
+import { ref, defineProps, defineEmits, watch } from 'vue'
84
+
85
+// 定义 props
86
+const props = defineProps({
87
+  visible: {
88
+    type: Boolean,
89
+    default: false
90
+  },
91
+  equipmentDetail: {
92
+    type: Object,
93
+    default: {},
94
+  }
95
+})
96
+
97
+// 定义 emit
98
+const emit = defineEmits(['close'])
99
+
100
+// 关闭弹窗方法
101
+const handleClose = () => {
102
+  emit('close')
103
+}
78 104
 
79 105
 // 设备基本信息数据
80
-const equipmentData = ref({
81
-  projectName: '巡检机器人',
82
-  applicantUnit: '绿州世博园',
83
-  projectLocation: '踏北侧(路往东70米后左转)',
84
-  address: '河南省郑州市航空港经济综合实验区苑陵路140号',
85
-  startTime: '2025-10-10',
86
-  endTime: '2025-11-30',
87
-  permitTime: '2025-10-10',
88
-  permitNumber: '[2025] 第372号',
89
-  contactPerson: '张三',
90
-  contactPhone: '18292904942',
91
-  greenArea: '112',
92
-  remarks: '设备用于园区安全巡检,每小时自动巡检一次'
106
+const equipmentData = ref({});
107
+
108
+// 监听visible变化,当显示时获取数据
109
+watch(() => props.visible, (newVal) => {
110
+  if (newVal) {
111
+    equipmentData.value = props.equipmentDetail;
112
+  }
93 113
 })
94 114
 
115
+// 监听工单ID变化,重新获取数据
116
+watch(() => props.equipmentDetail, (newId) => {
117
+  equipmentData.value = props.equipmentDetail;
118
+    console.log(props.equipmentDetail, 'props.equipmentDetail');
119
+
120
+}, true)
121
+
122
+
123
+
95 124
 // 设备图片数据
96 125
 const equipmentImages = ref([
97 126
   {
@@ -127,46 +156,119 @@ const equipmentImages = ref([
127 156
 
128 157
 <style scoped>
129 158
 .equipment-detail-container {
159
+  position: fixed;
160
+  z-index: 9999;
161
+  inset: 0;
162
+  /* background: rgba(0, 10, 30, 0.8); */
163
+  display: flex;
164
+  flex-direction: column;
165
+  align-items: center;
166
+  justify-content: center;
167
+}
168
+
169
+.equipment-detail-content {
170
+    position: relative;
171
+    width: min(90vw, 1400px);
172
+    max-height: calc(90vh - 60px); /* 减去头部高度,避免超出视口 */
173
+    margin-top: 0;
174
+    background: linear-gradient(135deg, #001a33 0%, #003366 100%);
175
+    border: 2px solid #0099ff;
176
+    border-top-left-radius: 0;
177
+    border-top-right-radius: 0;
178
+    border-top: none; /* 移除顶部边框,与头部对接 */
179
+    overflow: hidden;
180
+    box-shadow: 0 0 30px rgba(0, 153, 255, 0.3);
181
+    backdrop-filter: blur(10px);
182
+    /* 添加flex布局使其子元素水平排列 */
130 183
     display: flex;
131 184
     gap: 20px;
132
-    width: 100%;
133
-    height: 70vh;
134
-    padding: 20px;
135
-    box-sizing: border-box;
136
-    background-color: #031542;
137
-  }
138
-
139
-/* 左侧设备信息样式 */
140
-  .equipment-info-section {
141
-    flex: 2;
142
-    background-color: #031542;
143
-    border: 1px solid #056DC5;
144
-    border-radius: 8px;
145 185
     padding: 20px;
146
-    box-shadow: inset 0 0 10px rgba(5, 109, 197, 0.3);
147
-    height: 100%;
148
-    box-sizing: border-box;
149 186
     overflow-y: auto;
150
-    /* 隐藏左侧滚动条 */
151
-    -ms-overflow-style: none;
152
-    scrollbar-width: none;
153
-  }
154
-  
155
-  .equipment-info-section::-webkit-scrollbar {
156
-    display: none;
157 187
   }
158 188
 
159
-  /* 右侧设备图片样式 */
160
-  .equipment-image-section {
161
-    flex: 1;
162
-    background-color: #031542;
163
-    border: 1px solid #056DC5;
164
-    border-radius: 8px;
165
-    padding: 20px;
166
-    box-shadow: inset 0 0 10px rgba(5, 109, 197, 0.3);
167
-    height: 100%;
168
-    box-sizing: border-box;
169
-  }
189
+.work-order-detail-header {
190
+      position: relative;
191
+      width: min(90vw, 1400px);
192
+      box-sizing: border-box;
193
+      z-index: 10000;
194
+      padding: 12px 20px;
195
+      background: linear-gradient(135deg, #001a33 0%, #003366 100%);
196
+      border: 2px solid #0099ff;
197
+      border-bottom: none;
198
+      border-top-left-radius: 8px;
199
+      border-top-right-radius: 8px;
200
+      display: flex;
201
+      align-items: center;
202
+      justify-content: center;
203
+    }
204
+
205
+.work-order-detail-header h2 {
206
+  color: #ffffff;
207
+  font-size: 18px;
208
+  font-weight: 600;
209
+  margin: 0;
210
+  padding: 4px 45px;
211
+  background: linear-gradient(90deg, rgba(0, 153, 255, 0.05) 0%, rgba(0, 153, 255, 0.9) 50%, rgba(0, 153, 255, 0.05) 100%);
212
+  text-shadow: 0 0 8px rgba(0, 153, 255, 0.6);
213
+  border-radius: 4px;
214
+  display: inline-block;
215
+}
216
+
217
+.work-order-detail-close {
218
+  position: absolute;
219
+  right: 20px;
220
+  top: 50%;
221
+  transform: translateY(-50%);
222
+  width: 30px;
223
+  height: 30px;
224
+  border: none;
225
+  background: transparent;
226
+  color: #ffffff;
227
+  font-size: 20px;
228
+  line-height: 30px;
229
+  text-align: center;
230
+  border-radius: 4px;
231
+  cursor: pointer;
232
+  transition: all 0.3s ease;
233
+  padding: 0;
234
+}
235
+
236
+.work-order-detail-close:hover {
237
+  background: rgba(0, 40, 80, 0.8);
238
+  box-shadow: 0 0 10px rgba(0, 153, 255, 0.6);
239
+}
240
+
241
+/* 左侧设备信息样式 - 占三分之二宽度 */
242
+.equipment-info-section {
243
+  flex: 2; /* 确保占总宽度的2/3 */
244
+  background-color: #031542;
245
+  border: 1px solid #056DC5;
246
+  border-radius: 8px;
247
+  padding: 20px;
248
+  box-shadow: inset 0 0 10px rgba(5, 109, 197, 0.3);
249
+  height: 100%;
250
+  box-sizing: border-box;
251
+  overflow-y: auto;
252
+  /* 隐藏左侧滚动条 */
253
+  -ms-overflow-style: none;
254
+  scrollbar-width: none;
255
+}
256
+
257
+.equipment-info-section::-webkit-scrollbar {
258
+  display: none;
259
+}
260
+
261
+/* 右侧设备图片样式 - 占三分之一宽度 */
262
+.equipment-image-section {
263
+  flex: 1; /* 确保占总宽度的1/3 */
264
+  background-color: #031542;
265
+  border: 1px solid #056DC5;
266
+  border-radius: 8px;
267
+  padding: 20px;
268
+  box-shadow: inset 0 0 10px rgba(5, 109, 197, 0.3);
269
+  height: 100%;
270
+  box-sizing: border-box;
271
+}
170 272
 
171 273
 /* 区域标题样式 */
172 274
 .section-title {
@@ -190,11 +292,11 @@ const equipmentImages = ref([
190 292
 }
191 293
 
192 294
 .info-item {
193
-    display: flex;
194
-    flex-direction: row;
195
-    align-items: center;
196
-    gap: 10px;
197
-  }
295
+  display: flex;
296
+  flex-direction: row;
297
+  align-items: center;
298
+  gap: 10px;
299
+}
198 300
 
199 301
 .info-item.full-width {
200 302
   grid-column: span 2;
@@ -227,8 +329,10 @@ const equipmentImages = ref([
227 329
   overflow-y: auto;
228 330
   overflow-x: hidden;
229 331
   /* 隐藏滚动条的基础设置 */
230
-  -ms-overflow-style: none; /* IE和Edge */
231
-  scrollbar-width: none; /* Firefox */
332
+  -ms-overflow-style: none;
333
+  /* IE和Edge */
334
+  scrollbar-width: none;
335
+  /* Firefox */
232 336
 }
233 337
 
234 338
 /* 隐藏Chrome、Safari等浏览器的滚动条 */
@@ -270,11 +374,15 @@ const equipmentImages = ref([
270 374
   .equipment-detail-container {
271 375
     flex-direction: column;
272 376
   }
273
-  
377
+
378
+  .equipment-detail-content {
379
+    flex-direction: column;
380
+  }
381
+
274 382
   .info-grid {
275 383
     grid-template-columns: 1fr;
276 384
   }
277
-  
385
+
278 386
   .info-item.full-width {
279 387
     grid-column: span 1;
280 388
   }

+ 13 - 2
bigScreen3/src/views/dashboard/cpns/SmartOperation.vue

@@ -308,6 +308,11 @@
308 308
       </div>
309 309
     </div>
310 310
   </div>
311
+  <EquipmentDetail
312
+      :visible="equipmentDetailVisible"
313
+      :equipmentDetail="equipmentInfo"
314
+      @close="equipmentDetailVisible = false"  
315
+    />
311 316
 </template>
312 317
 
313 318
 <style scoped>
@@ -406,7 +411,7 @@ import { getPageListData } from '@/api/index'
406 411
 import icon8_1 from '@/assets/icon4.png'
407 412
 import markerIcon from '@/assets/icon4.png'
408 413
 import personnelIcon from '@/assets/icon5.png'
409
-
414
+import EquipmentDetail from '@/views/dashboard/cpns/EquipmentDetail.vue'
410 415
 // 定义 props
411 416
 const props = defineProps({
412 417
   selectedProjectId: {
@@ -425,6 +430,8 @@ const popupVisible = ref(false)
425 430
 const popupPosition = ref({ x: 0, y: 0 })
426 431
 const popupData = ref({})
427 432
 
433
+const equipmentDetailVisible = ref(false)
434
+
428 435
 // 设备数据
429 436
 const deviceData = ref([
430 437
   { name: '传感器在线率', value: '502/520个' },  // 传感器在线率
@@ -664,6 +671,7 @@ const showPersonnelInfo = (personnelData, pixel) => {
664 671
   popupVisible.value = true
665 672
 }
666 673
 
674
+const equipmentInfo = ref({})
667 675
 // 显示设备信息悬浮框
668 676
 const showEquipmentInfo = (equipmentData, pixel) => {
669 677
   const rect = mapContainer.value.getBoundingClientRect()
@@ -679,7 +687,10 @@ const showEquipmentInfo = (equipmentData, pixel) => {
679 687
   popupPosition.value = { x, y }
680 688
   popupData.value = equipmentData
681 689
   console.log("设备信息:", equipmentData)
682
-  popupVisible.value = true
690
+  equipmentInfo.value = equipmentData
691
+  equipmentDetailVisible.value = true
692
+  // popupVisible.value = true
693
+  // 弹出设备详情页面
683 694
 }
684 695
 
685 696
 // 关闭弹出框