Преглед изворни кода

Merge branch 'video_split' of shuzhihua/pms-iot-vue into videoCenter

yanghao пре 2 дана
родитељ
комит
bb5aa0b5b9

+ 8 - 1
src/api/pms/video/channel.ts

@@ -43,7 +43,7 @@ export function delChannel(channelId) {
 // 开始播放
 export function startPlay(deviceId, channelId) {
   return request.get({
-    url: '/rq/sip/player/play/' + deviceId + '/' + channelId  // /rq/sip/player/play
+    url: '/rq/sip/player/play/' + deviceId + '/' + channelId // /rq/sip/player/play
   })
 }
 
@@ -112,3 +112,10 @@ export function listRelDeviceOrScene(query) {
     params: query
   })
 }
+
+// 告警图片
+export function getAlarmPic(id) {
+  return request.download({
+    url: '/rq/iot-video-alarm/pic' + '/' + id
+  })
+}

+ 21 - 9
src/views/pms/video_center/sip/splitview.vue

@@ -73,7 +73,12 @@
                 v-else
                 :ref="(el) => setPlayerRef(el, i - 1)"
                 :videourl="videoUrl[i - 1]"
-                :playerInfo="playInfoRes"
+                :playerInfo="
+                  playerInfo.filter(
+                    (item) =>
+                      videoUrl[i - 1]?.includes(item.id) && videoUrl[i - 1]?.includes(item.deviceId)
+                  )[0] || undefined
+                "
                 fluent
                 autoplay
                 @screenshot="shot"
@@ -329,9 +334,9 @@ const sendDevicePush = (itemData, targetIndex = null) => {
     .then((response) => {
       let res = response
       if (window.location.protocol === 'http:') {
-        itemData.playUrl = res.ws_flv
+        itemData.playUrl = res.playurl
       } else {
-        itemData.playUrl = res.wss_flv
+        itemData.playUrl = playurl
       }
       itemData.streamId = res.streamId
       setPlayUrl(itemData.playUrl, playIndex) // 播放URL设置到指定位置
@@ -348,13 +353,20 @@ const setPlayUrl = (url, idx) => {
   newVideoUrls[idx] = url
   videoUrl.value = newVideoUrls
 
-  playerInfo.value.forEach((item) => {
-    if (videoUrl.value[0].includes(item.id) && videoUrl.value[0].includes(item.deviceId)) {
-      playInfoRes.value = item
-    }
-  })
+  // playerInfo.value.forEach((item) => {
+  //   if (videoUrl.value[0].includes(item.id) && videoUrl.value[0].includes(item.deviceId)) {
+  //     playInfoRes.value = item
+  //   }
+  // })
+
+  // console.log('hhhhhhhhhhhhhhhhhhhhhhh', videoUrl.value)
 
-  console.log('hhhhhhhhhhhhhhhhhhhhhhh', videoUrl.value)
+  // console.log(
+  //   'xxxxxxxxxxxxxxxxxxxxx',
+  //   playerInfo.filter(
+  //     (item) => videoUrl[0].includes(item.id) && videoUrl[0].includes(item.deviceId)
+  //   )
+  // )
 
   setTimeout(() => {
     window.localStorage.setItem('videoUrl', JSON.stringify(videoUrl.value))

+ 32 - 11
src/views/pms/video_center/warn/index.vue

@@ -111,19 +111,21 @@
 
         <el-table-column label="图片" align="center" width="150">
           <template #default="{ row }">
-            <el-image
-              v-if="row.url"
-              :src="row.url"
-              :preview-src-list="[row.url]"
-              preview-teleported
-              fit="cover"
-              style="width: 80px; height: 50px; border-radius: 4px"
-            />
+            <el-link v-if="row.imageUrl" type="primary" @click="openDetail(row.id)">查看</el-link>
             <span v-else>无图片</span>
           </template>
         </el-table-column>
       </el-table>
 
+      <el-dialog v-model="dialogTableVisible" title="告警图片" width="800">
+        <el-image
+          v-if="dialogTableVisible"
+          :src="currentImageUrl"
+          style="width: 100%; height: 100%"
+          fit="contain"
+        />
+      </el-dialog>
+
       <!-- 分页 -->
       <el-pagination
         class="float-right mb-5"
@@ -148,7 +150,7 @@ import { ArrowDown } from '@element-plus/icons-vue'
 import { warnList } from '@/api/pms/video/warn'
 import { DICT_TYPE, getDictLabel, getStrDictOptions } from '@/utils/dict'
 import { Search, Refresh } from '@element-plus/icons-vue'
-import { listChannel } from '@/api/pms/video/channel'
+import { listChannel, getAlarmPic } from '@/api/pms/video/channel'
 
 // 响应式数据
 const loading = ref(false)
@@ -175,10 +177,11 @@ const initTableData = async () => {
   loading.value = true
 
   const res = await warnList({
-    pageNum: pagination.currentPage,
+    pageNo: pagination.currentPage,
     pageSize: pagination.pageSize,
     deviceName: filterForm.deviceName,
-    channelName: filterForm.channelName
+    channelName: filterForm.channelName,
+    eventType: filterForm.eventType
   })
 
   tableData.value = res.list
@@ -222,6 +225,24 @@ const handleCurrentChange = (page) => {
   initTableData()
 }
 
+let currentImageUrl = ref('')
+let dialogTableVisible = ref(false)
+const openDetail = async (id) => {
+  const res = await getAlarmPic(id)
+  console.log(res)
+
+  // // 2. 将流转换为 Blob
+  // const blob = await res.blob()
+
+  // // 3. 创建 Blob URL
+  const blobUrl = URL.createObjectURL(res)
+  currentImageUrl.value = blobUrl
+
+  console.log(blobUrl)
+
+  dialogTableVisible.value = true
+}
+
 let channelList = ref([])
 // 页面加载时初始化数据
 onMounted(() => {