Explorar el Código

大屏视频监控出调整

miaofuhao hace 3 meses
padre
commit
96bc9c2cb2

+ 55 - 21
bigScreen3/src/views/dashboard/cpns/VideoSurveillance.vue

@@ -41,7 +41,6 @@
41 41
               playsinline 
42 42
               controls 
43 43
               class="video-player" 
44
-              style="width: 100%; height: 100%; object-fit: contain;"
45 44
               autoplay
46 45
               muted
47 46
             ></video>
@@ -60,6 +59,10 @@ import { getPageListData } from '@/api/index'
60 59
 import videoSrc from '@/assets/mp4/ziyuan.mp4'
61 60
 import defaultImg from '@/assets/defaultImg.png'
62 61
 import axios from 'axios'
62
+import { getToken } from '@/utils/auth'
63
+import { ElMessage } from 'element-plus'
64
+
65
+
63 66
 
64 67
 // 监控设备列表(响应式数据)
65 68
 const videoList = ref([])
@@ -86,8 +89,8 @@ const fetchDriveInfoList = async () => {
86 89
         return {
87 90
           name: device.deviceName || device.fRemark || '未知监控设备',
88 91
           time: formattedTime,
89
-          deviceId: device.id || device.deviceId || '',
90
-          streamUrl: 'rtsp://'+device.fAccount+':'+device.fPassword+'@'+device.fIp,
92
+          deviceId: device.fDriveid,
93
+          streamUrl: device.url,
91 94
           fImg: device.fImg || '' // 保存设备图片地址
92 95
         }
93 96
       })
@@ -134,14 +137,18 @@ watch(() => props.selectedProjectId, () => {
134 137
   // 重新获取数据
135 138
   fetchDriveInfoList();
136 139
 }, { immediate: true })
137
-
140
+const fDriveid = ref('')
138 141
 // 关闭所有视频并打开模态框
139 142
 function closeAllVideosAndOpenModal(video) {
140
-  
143
+  if (!video.streamUrl) {
144
+    ElMessage.warning('视频流URL为空,无法播放');
145
+
146
+    return;
147
+  }
141 148
   // 打开模态框播放当前视频
142 149
   selectedVideo.value = video
143 150
   isModalOpen.value = true
144
-  
151
+  fDriveid.value = video.deviceId
145 152
   // 等待模态框完全渲染后初始化视频元素并自动播放
146 153
   setTimeout(() => {
147 154
     if (videoElement.value) {
@@ -159,7 +166,7 @@ function closeAllVideosAndOpenModal(video) {
159 166
 // 关闭视频播放模态框
160 167
 function closeModal() {
161 168
   // 先触发截图并上传
162
-  // captureAndUploadSnapshot();
169
+  captureAndUploadSnapshot();
163 170
   
164 171
   // 停止视频播放
165 172
   if (videoElement.value) {
@@ -204,29 +211,57 @@ async function captureAndUploadSnapshot() {
204 211
           console.warn('创建截图失败');
205 212
           return;
206 213
         }
207
-        
214
+        console.log('截图创建成功,大小:', blob.size);
208 215
         try {
209
-          // 创建FormData用于上传
216
+          // 创建FormData用于上传,添加文件名参数
210 217
           const formData = new FormData();
211
-          const fileName = `${selectedVideo.value?.deviceId || 'unknown'}_${new Date().getTime()}_snapshot.jpg`;
218
+          // 为文件添加文件名参数,格式为:监控截图_时间戳.jpg
219
+          const fileName = `监控截图_${Date.now()}.jpg`;
212 220
           formData.append('file', blob, fileName);
213 221
           
214
-          // 添加其他可能需要的参数
215
-          if (selectedVideo.value) {
216
-            formData.append('deviceId', selectedVideo.value.deviceId);
217
-            formData.append('deviceName', selectedVideo.value.name);
218
-          }
219
-          
220 222
           // 上传图片到指定接口
221
-          const response = await axios.post('/file/uploadFacilityFile', formData, {
223
+          const response = await axios.post(import.meta.env.VITE_APP_BASE_API +'/file/uploadFile', formData, {
222 224
             headers: {
223 225
               'Content-Type': 'multipart/form-data',
224
-              'token': localStorage.getItem('token') || ''
226
+              'fSource':2,
227
+              'token':getToken()
225 228
             },
226 229
             timeout: 10000 // 设置10秒超时
227 230
           });
228 231
           
229 232
           console.log('截图上传成功:', response.data);
233
+          // 上传成功后保存图片路径到设备信息
234
+          if (response.data && response.data.data && response.data.data[0]) {
235
+            const fFileurl = response.data.data[0].fFileurl;
236
+            // 获取当前设备ID
237
+           
238
+            
239
+            // 调用更新设备信息接口保存图片路径
240
+            try {
241
+              if (!fDriveid.value) {
242
+                console.warn('设备ID为空,无法保存图片路径');
243
+                return;
244
+              }
245
+              await axios.post(import.meta.env.VITE_APP_BASE_API + 'tbasedriveinfo/updateDriveInfo', {
246
+                data: {
247
+                  fDriveid: fDriveid.value,
248
+                  fImg: fFileurl,
249
+                }
250
+              }, {
251
+                headers: {
252
+                  'Content-Type': 'application/json',
253
+                  'token': getToken(),
254
+                  'fSource':2
255
+                }
256
+              });
257
+              fDriveid.value = ''
258
+              fetchDriveInfoList()
259
+              console.log('图片路径保存成功');
260
+            } catch (saveError) {
261
+              console.error('图片路径保存失败:', saveError.message || saveError);
262
+            }
263
+          }
264
+
230 265
         } catch (uploadError) {
231 266
           console.error('截图上传失败:', uploadError.message || uploadError);
232 267
         }
@@ -551,7 +586,6 @@ onUnmounted(() => {
551 586
     height: 72vh;
552 587
     background-image: url('@/assets/bj2.png');
553 588
     background-size: 100% 100%;
554
-    background-size: cover;
555 589
     background-position: center;
556 590
     background-repeat: no-repeat;
557 591
     border-radius: 6px;
@@ -564,7 +598,7 @@ onUnmounted(() => {
564 598
       flex: 1;
565 599
       display: flex;
566 600
       flex-direction: column;
567
-      
601
+      height: 100%;
568 602
       .video-wrapper {
569 603
         position: relative;
570 604
         flex: 1;
@@ -577,7 +611,7 @@ onUnmounted(() => {
577 611
         .video-player {
578 612
           width: 100%;
579 613
           height: 100%;
580
-          object-fit: contain;
614
+          object-fit: cover;
581 615
           background: #000;
582 616
           cursor: pointer;
583 617
         }

+ 8 - 23
web/src/views/sbss_manage/drivelist.vue

@@ -167,17 +167,8 @@
167 167
           <el-form-item label="设备编号" prop="fNvscode" >
168 168
             <el-input  v-model="tableForm.fNvscode" placeholder="设备编号"></el-input>
169 169
           </el-form-item>
170
-          <el-form-item label="地址" prop="fIp" >
171
-            <el-input  v-model="tableForm.fIp" placeholder="设备地址"></el-input>
172
-          </el-form-item>
173
-          <el-form-item label="端口" prop="fPort" >
174
-            <el-input  v-model="tableForm.fPort" placeholder="设备端口"></el-input>
175
-          </el-form-item>
176
-          <el-form-item label="用户名" prop="fAccount" >
177
-            <el-input  v-model="tableForm.fAccount" placeholder="登录用户名"></el-input>
178
-          </el-form-item>
179
-          <el-form-item label="密码" prop="fPassword" >
180
-            <el-input  v-model="tableForm.fPassword" placeholder="登录密码" show-password></el-input>
170
+          <el-form-item label="地址" prop="url" >
171
+            <el-input  v-model="tableForm.url" placeholder="设备地址"></el-input>
181 172
           </el-form-item>
182 173
           <el-form-item label="设备名称" prop="fName" >
183 174
             <el-input  v-model="tableForm.fName" placeholder="设备名称"></el-input>
@@ -397,10 +388,7 @@
397 388
                   fIsuse: this.tableForm.fIsuse,
398 389
                   fState: this.tableForm.fState,
399 390
                   fDriveid: null,
400
-                  fIp: this.tableForm.fIp,
401
-                  fPort: this.tableForm.fPort,
402
-                  fAccount: this.tableForm.fAccount,
403
-                  fPassword: this.tableForm.fPassword
391
+                  url: this.tableForm.url
404 392
                 }
405 393
               })
406 394
               // console.log('res', res)
@@ -427,14 +415,11 @@
427 415
               fParkname: this.tableForm.fParkname,
428 416
               fParkid: this.tableForm.fParkid,
429 417
               fIsuse: this.tableForm.fIsuse,
430
-                  fX: this.tableForm.fX,
431
-                  fY: this.tableForm.fY,
432
-                  fState: this.tableForm.fState,
433
-                  fDriveid: this.tableForm.fDriveid,
434
-                  fIp: this.tableForm.fIp,
435
-                  fPort: this.tableForm.fPort,
436
-                  fAccount: this.tableForm.fAccount,
437
-                  fPassword: this.tableForm.fPassword
418
+              fX: this.tableForm.fX,
419
+              fY: this.tableForm.fY,
420
+              fState: this.tableForm.fState,
421
+              fDriveid: this.tableForm.fDriveid,
422
+              url: this.tableForm.url,
438 423
             }
439 424
           }).then(res => {
440 425
             // console.log('res修改,', res)

+ 1 - 1
web/src/views/workorder/workordercreate.vue

@@ -367,7 +367,7 @@
367 367
       resetForm() {
368 368
         // 重置表单数据
369 369
         this.fileList = []
370
-        this.sizeForm.type = ''
370
+        // this.sizeForm.type = ''
371 371
         this.sizeForm.company = ''
372 372
         this.sizeForm.director = ''
373 373
         this.sizeForm.unit = ''

+ 3 - 3
wxproject/packageA/pages/onDuty/onDuty.wxml

@@ -3,9 +3,9 @@
3 3
 	<view class="calendar">
4 4
 		<view class='bcfff'>
5 5
 			<view class="map_box">
6
-        <view class="jilu"  catchtap="nav" data-url="/packageA/pages/recordDetail/recordDetail">
7
-          打卡记录
8
-        </view>
6
+			<view class="jilu"  catchtap="nav" data-url="/packageA/pages/recordDetail/recordDetail">
7
+			打卡记录
8
+			</view>
9 9
 				<map id="map" longitude="{{posObj.longitude}}" latitude="{{posObj.latitude}}" markers='{{markers}}' scale="17" show-location class="mapSize" polyline="{{polyline}}" circles="{{circles}}" ></map>
10 10
 			</view>
11 11
 			<view class="timeactive">