feat: 完成视频流播放联调,历史视频列表联调完成

main
donghao 2 months ago
parent a388945e67
commit c647e6c8ab

@ -2,11 +2,27 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2024-02-22 13:38:04 * @Date: 2024-02-22 13:38:04
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2025-03-13 14:35:20 * @LastEditTime: 2025-03-14 14:03:18
* @FilePath: \General-AI-Platform-Web-Client\mock\pools\deviceStatusData.ts * @FilePath: \General-AI-Platform-Web-Client\mock\pools\deviceStatusData.ts
* @Description: * @Description:
*/ */
import { generateRandomDateTimeByYear } from "../utils/mockMoment"; import { generateRandomDateTimeByYear } from "../utils/mockMoment";
import Mock from "mockjs";
// 定义一些公开的可测试的视频链接
const videoUrls = [
"https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4",
"https://www.sample-videos.com/video123/mp4/1080/big_buck_bunny_1080p_100mb.mp4",
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
"https://www.sample-videos.com/video123/mp4/360/big_buck_bunny_360p_5mb.mp4",
"https://media.w3.org/2010/05/video/movie_300.mp4",
"https://www.w3schools.com/html/mov_bbb.mp4",
"https://media.w3.org/2010/05/sintel/trailer.mp4",
"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
"https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4",
"https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4",
];
function fetchList(): Record<string, any>[] { function fetchList(): Record<string, any>[] {
const currList: Record<string, any>[] = []; const currList: Record<string, any>[] = [];
const nameArr = [ const nameArr = [
@ -19,7 +35,7 @@ function fetchList(): Record<string, any>[] {
"边距缺陷检测设备", "边距缺陷检测设备",
"成品组装缺陷检测设备", "成品组装缺陷检测设备",
"金属工件表面缺陷检测设备", "金属工件表面缺陷检测设备",
"管材表面缺陷检测设备" "管材表面缺陷检测设备",
]; ];
const codeArr = ["MSRF", "RL0F", "TLOC", "E1AIS", "CRM"]; const codeArr = ["MSRF", "RL0F", "TLOC", "E1AIS", "CRM"];
@ -36,7 +52,7 @@ function fetchList(): Record<string, any>[] {
deviceGroupArr[Math.floor(Math.random() * 3)] + deviceGroupArr[Math.floor(Math.random() * 3)] +
(Math.floor(Math.random() * 3) + 1), (Math.floor(Math.random() * 3) + 1),
status: Math.floor(Math.random() * 3) + 1, status: Math.floor(Math.random() * 3) + 1,
remark: "" remark: "",
}); });
} }
return currList; return currList;
@ -46,117 +62,42 @@ function fetchList(): Record<string, any>[] {
// 告警代码MSRF-0 RL0F HTFIF-02 TLOC-1 E1AIS-05 // 告警代码MSRF-0 RL0F HTFIF-02 TLOC-1 E1AIS-05
// 设备组核心检测组001 无尘总装组005 送料监测线02 // 设备组核心检测组001 无尘总装组005 送料监测线02
const mockHistroyData = [ const mockHistroyData = Mock.mock({
[`list|${videoUrls.length}`]: [
{ {
id: 10, "id|+1": 10,
key: "10", key: function () {
video_url: "https://www.w3schools.com/html/mov_bbb.mp4", return this.id.toString();
created_at: "2025-03-12 14:53:36",
device: 1
}, },
{ video_url: function () {
id: 11, // 依次取出视频链接
key: "11", return videoUrls[this.id - 10];
video_url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
created_at: "2025-03-12 15:20:15",
device: 1
}, },
{ created_at: function () {
id: 12, // 定义起始和结束时间戳
key: "12", const startDate = new Date("2025-01-01").getTime();
video_url: "https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4", const endDate = new Date("2025-03-14 23:59:59").getTime();
created_at: "2025-03-13 09:45:22", // 生成随机时间戳
device: 1 const randomTimestamp =
}, startDate + Math.random() * (endDate - startDate);
{ // 根据随机时间戳创建日期对象
id: 20, const randomDate = new Date(randomTimestamp);
key: "10", // 格式化日期为 yyyy-MM-dd HH:mm:ss 格式
video_url: "https://www.w3schools.com/html/mov_bbb.mp4", const year = randomDate.getFullYear();
created_at: "2025-03-12 14:53:36", const month = String(randomDate.getMonth() + 1).padStart(2, "0");
device: 1 const day = String(randomDate.getDate()).padStart(2, "0");
}, const hours = String(randomDate.getHours()).padStart(2, "0");
{ const minutes = String(randomDate.getMinutes()).padStart(2, "0");
id: 21, const seconds = String(randomDate.getSeconds()).padStart(2, "0");
key: "11", return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
video_url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
created_at: "2025-03-12 15:20:15",
device: 1
}, },
{ device: 1,
id: 22,
key: "12",
video_url: "https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4",
created_at: "2025-03-13 09:45:22",
device: 1
}, },
// { ],
// id: 10, });
// key: "10",
// video_url: "https://www.w3schools.com/html/mov_bbb.mp4",
// created_at: "2025-03-12 14:53:36",
// device: 1
// },
// {
// id: 11,
// key: "11",
// video_url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
// created_at: "2025-03-12 15:20:15",
// device: 1
// },
// {
// id: 12,
// key: "12",
// video_url: "https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4",
// created_at: "2025-03-13 09:45:22",
// device: 1
// },
// {
// id: 10,
// key: "10",
// video_url: "https://www.w3schools.com/html/mov_bbb.mp4",
// created_at: "2025-03-12 14:53:36",
// device: 1
// },
// {
// id: 11,
// key: "11",
// video_url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
// created_at: "2025-03-12 15:20:15",
// device: 1
// },
// {
// id: 12,
// key: "12",
// video_url: "https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4",
// created_at: "2025-03-13 09:45:22",
// device: 1
// },
// {
// id: 10,
// key: "10",
// video_url: "https://www.w3schools.com/html/mov_bbb.mp4",
// created_at: "2025-03-12 14:53:36",
// device: 1
// },
// {
// id: 11,
// key: "11",
// video_url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
// created_at: "2025-03-12 15:20:15",
// device: 1
// },
// {
// id: 12,
// key: "12",
// video_url: "https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4",
// created_at: "2025-03-13 09:45:22",
// device: 1
// }
];
const currentData = fetchList(); const currentData = fetchList();
const currentHistroyData = mockHistroyData; const currentHistroyData = mockHistroyData.list;
// //
export const deviceStatusListData = { export const deviceStatusListData = {
@ -164,12 +105,10 @@ export const deviceStatusListData = {
data: currentData, data: currentData,
total: currentData.length, total: currentData.length,
current: 1, current: 1,
pageSize: 10 pageSize: 10,
} },
}; };
export const deviceHistoryListData = { export const deviceHistoryListData = {
data: currentHistroyData data: currentHistroyData,
} };

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2025-03-07 15:09:18 * @Date: 2025-03-07 15:09:18
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2025-03-13 10:13:49 * @LastEditTime: 2025-03-14 11:14:15
* @FilePath: \5G-Loading-Bay-Web\src\api\dashboard.ts * @FilePath: \5G-Loading-Bay-Web\src\api\dashboard.ts
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
@ -13,7 +13,6 @@ import { config } from "@/config";
//TODO 定义响应类型 //TODO 定义响应类型
export const getDeviceStatusApi = (params: any) => { export const getDeviceStatusApi = (params: any) => {
return request.get(`/api/v1/device/device/`, params); return request.get(`/api/v1/device/device/`, params);
}; };
@ -48,3 +47,35 @@ export const getRealTimeApi = () => {
return request.get(`/api/v1/record/get_latest_second_records/`); return request.get(`/api/v1/record/get_latest_second_records/`);
}; };
// 设备状态打开实时监控
export const playRtspApi = (data: { url: string }) => {
return request.post<LoginRes>(`/api/v1/common/play_rtsp/`, data, {
showLoading: false, // 单独关闭loading
});
};
// {
// "code": 200,
// "success": true,
// "data": {
// "process_id": 23432,
// "host": "192.168.10.14:7001"
// },
// "errorMessage": ""
// }
// 设备状态关闭实时监控
export const stopRtspApi = (data: { process_id: string | number }) => {
return request.post<LoginRes>(`/api/v1/common/stop_rtsp/`, data, {
showLoading: false, // 单独关闭loading
});
};
// 根据设备 ID 查询历史视频列表,支持日期时间过滤
export const getDeviceHistoryDetailApi = (params: {
device_id: string | number;
start_time: string;
end_time: string;
}) => {
return request.get(`/api/v1/device/device_history/`, params);
};

@ -1,3 +1,11 @@
<!--
* @Author: donghao donghao@supervision.ltd
* @Date: 2025-03-12 13:48:53
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2025-03-14 13:21:40
* @FilePath: \5G-Loading-Bay-Web\src\components\videoPlayer\RealPlayer.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template> <template>
<div class="real-video-player"> <div class="real-video-player">
<video ref="refPlayer" autoplay controls muted width="100%" height="100%" style="object-fit: fill;"></video> <video ref="refPlayer" autoplay controls muted width="100%" height="100%" style="object-fit: fill;"></video>
@ -8,31 +16,87 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick } from 'vue'; import { playRtspApi, stopRtspApi } from '@/api/dashboard';
import { isSuccessApi } from "@/utils/forApi";
interface Props {
show: boolean; //
videoSrc: string; //
}
const props = withDefaults(defineProps<Props>(), {
show: false,
videoSrc: ""
});
const webRtcServer = ref(null); const webRtcServer = ref(null);
const refPlayer = ref(null); const refPlayer = ref(null);
const videoSrc = 'rtsp://192.168.10.63:8554/mystream'; const videosInfo = ref<{ process_id: number | string, host: string }>({ process_id: null, host: '' });
function initData() { function initData() {
webRtcServer.value.connect(videoSrc || '', '', "rtptransport=tcp&timeout=60&width=320&height=0"); // const videoSrc = 'rtsp://192.168.10.63:8554/mystream';
webRtcServer.value.connect(props.videoSrc || '', '', "rtptransport=tcp&timeout=60&width=320&height=0");
} }
onMounted(() => { async function initPlayer() {
// try {
// let srvUrl = 'http://127.0.0.1:8000'; const res = await playRtspApi({
url: props.videoSrc
})
console.log(res, 'initPlayer')
if (isSuccessApi(res)) {
videosInfo.value = res.data;
nextTick(() => { nextTick(() => {
console.log(location.protocol, "refPlayer"); console.log(location.protocol, "refPlayer", videosInfo.value?.host);
// TODO // TODO
webRtcServer.value = new WebRtcStreamer(refPlayer.value, `http://192.168.10.26:9988`); // const testHost = 'http://192.168.10.14:7001';
webRtcServer.value = new WebRtcStreamer(refPlayer.value, videosInfo.value?.host || '');
nextTick(() => { nextTick(() => {
videoSrc && initData(); props.videoSrc && initData();
}) })
}) })
}) }
} catch (error) {
ElMessage.error('播放失败')
console.error('播放失败:', error)
}
}
async function stopPlayer() {
if(!videosInfo.value.process_id){
return
}
try {
const res = await stopRtspApi({
process_id: videosInfo.value.process_id
})
console.log(res, 'initPlayer')
if (isSuccessApi(res)) {
videosInfo.value = {};
}
} catch (error) {
ElMessage.error('播放失败')
console.error('播放失败:', error)
}
}
// watch(() => props.videoSrc, (newVal) => {
// console.log(newVal, 'videoSrc')
// // initPlayer()
// },{ immediate: true })
watch(() => props.show, (newVal) => {
if(newVal){
initPlayer();
} else {
stopPlayer()
}
console.log(newVal, 'show')
}, { immediate: true })
onUnmounted(() => { onUnmounted(() => {
webRtcServer.disconnect(); webRtcServer.disconnect();
webRtcServer.value = null; webRtcServer.value = null;
if(videosInfo.value.process_id){
stopPlayer();
}
}) })
</script> </script>

@ -60,7 +60,6 @@ import outLineIcon from '@/assets/common/outline_icon.png';
import errorIcon from '@/assets/common/error_icon.png'; import errorIcon from '@/assets/common/error_icon.png';
import { getDeviceStatusApi } from '@/api/dashboard'; import { getDeviceStatusApi } from '@/api/dashboard';
import { isSuccessApi } from "@/utils/forApi"; import { isSuccessApi } from "@/utils/forApi";
import { nextTick } from "vue";
defineOptions({ defineOptions({
name: "DeviceStatusIndex" name: "DeviceStatusIndex"
}); });
@ -161,10 +160,7 @@ const columns = [
} }
]; ];
const pagination = ref({ currentPage: 1, pageSize: 10, total: 0 }); const pagination = ref({ currentPage: 1, pageSize: 10, total: 0 });
const listData = ref([]); const listData = ref([]);
const getList = async () => { const getList = async () => {
try { try {
const { currentPage, pageSize } = pagination.value; const { currentPage, pageSize } = pagination.value;
@ -195,9 +191,25 @@ function openCurrent(row) {
console.log(row, "openCurrent"); console.log(row, "openCurrent");
currentRow.value = row; currentRow.value = row;
isRealOpen.value = true; isRealOpen.value = true;
} }
/**打开历史视频 */ /**打开历史视频 */
// getDeviceHistoryDetailApi
// const fetchHistoryList = async () => {
// try {
// const res = await getDeviceStatusApi({ device_id: currentRow.value?.id })
// if (isSuccessApi(res)) {
// historyVideos.value = res.data.data;
// isHistoryOpen.value = true;
// nextTick(() => {
// historyModalRef.value.loadData()
// })
// console.log(res, 'fetchHistoryList_data')
// }
// } catch (error) {
// console.error(':', error)
// }
// }
// TODO mock // TODO mock
const fetchHistoryList = async () => { const fetchHistoryList = async () => {
try { try {

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2025-03-06 15:15:01 * @Date: 2025-03-06 15:15:01
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2025-03-12 20:57:12 * @LastEditTime: 2025-03-14 11:19:33
* @FilePath: \vite-ai\data-dashboard\src\views\dashboard\PoleMonitor.vue * @FilePath: \vite-ai\data-dashboard\src\views\dashboard\PoleMonitor.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
@ -44,41 +44,51 @@
<!-- 主体内容区域 --> <!-- 主体内容区域 -->
<div class="flex justify-between pole-monitor-main"> <div class="flex justify-between pole-monitor-main">
<!-- 左侧视频与缩略图区域 --> <!-- 左侧视频与缩略图区域 -->
<div class="left-panel w-[870px]"> <div class="left-panel w-[870px] mr-[16px]">
<!-- 主图显示 --> <!-- 主图显示 -->
<div class="main-image"> <div class="main-image">
<!-- <img src="https://picsum.photos/300/200?random=1" alt="监控画面"> --> <!-- <img src="https://picsum.photos/300/200?random=1" alt="监控画面"> -->
<video ref="refVideo" controls muted :src="videoDetail" width="100%" height="100%" style="object-fit: fill;"></video> <!-- <video ref="refVideo" controls muted :src="currFile?.video_url" width="100%" height="100%" style="object-fit: fill;"></video> -->
<img src="https://picsum.photos/300/200?random=1" alt="监控画面" v-if="currFile?.image_url">
<Player :src="currFile?.video_url" v-else-if="currFile?.video_url" />
<div v-else>
<!-- //TODO -->
</div>
<div class="image-info"> <div class="image-info">
<span>: {{ detailList?.length }}cm</span> <!-- //TODO -->
<span>: {{ detailList?.width }}cm</span> <span>: {{ currFile?.length }}</span>
<span>: {{ detailList?.height }}cm</span> <span>: {{ currFile?.width }}</span>
<span>体积: {{ detailList?.weight }}</span> <span>: {{ currFile?.height }}</span>
<span>重量: {{ detailList?.weight }}kg</span> <span>体积: {{ currFile?.volume }}</span>
<span>重量: {{ currFile?.weight }}</span>
</div> </div>
</div> </div>
<!-- 缩略图区域 --> <!-- 缩略图区域 -->
<div class="thumbnail-container mt-[16px]"> <div class="thumbnail-container mt-[16px] w-[870px]">
<swiper ref="swiperRef" :modules="modules" :slides-per-view="3" :space-between="10" navigation <swiper ref="swiperRef" :modules="modules" :slides-per-view="3" :space-between="10" navigation
:scrollbar="{ draggable: false }" :centered-slides="false" :observer="true" :scrollbar="{ draggable: false }" :centered-slides="false" :observer="true"
:observeParents="true" @swiper="onSwiper" @slideChange="onSlideChange"> :observeParents="true" @swiper="onSwiper" @slideChange="onSlideChange">
<swiper-slide v-for="(image, index) in listDetail" :key="index" @click="handleSlideClick(index)" <swiper-slide v-for="(file, index) in currFileList" :key="index"
:class="{ 'active-slide': activeIndex === index }"> @click="handleSlideClick(index)" :class="{ 'active-slide': activeIndex === index }">
<!-- <img :src="image" alt="Slide" /> --> <img :src="file?.image_url" v-if="file?.image_url" />
<video ref="refVideo" :controls="false" muted :src="videoUrl" width="100%" height="100%"></video> <video ref="refVideo" :controls="false" muted :src="file?.video_url" width="100%"
height="144" v-else-if="file?.video_url" style="object-fit: fill;"></video>
<div v-else>
<!-- //TODO -->
</div>
</swiper-slide> </swiper-slide>
</swiper> </swiper>
</div> </div>
</div> </div>
<!-- 右侧表格区域 --> <!-- 右侧表格区域 -->
<div class="right-panel w-[934px]"> <div class="flex-1 right-panel">
<div class="bg-transparent baseTable_wrap"> <div class="bg-transparent baseTable_wrap">
<template v-if="pagination.total > 0"> <template v-if="pagination.total > 0">
<BaseTable class="bg-transparent baseTable_box" :total="pagination.total" <BaseTable class="bg-transparent baseTable_box" :total="pagination.total"
:pageSize="pagination.pageSize" :dataSource="listData" :isFixedPagination="true" :pageSize="pagination.pageSize" :dataSource="listData" :isFixedPagination="true"
:columns="columns" :page="pagination.currentPage" @change="handleTableChange" :row-class-name="handleRowClassName" :columns="columns" :page="pagination.currentPage" @change="handleTableChange"
@row-click="handleRowClick"> :row-class-name="handleRowClassName" @row-click="handleRowClick">
</BaseTable> </BaseTable>
</template> </template>
</div> </div>
@ -90,11 +100,13 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import Player from '@/components/videoPlayer/Player.vue'
import ContentHeader from '@/components/ContentHeader.vue'; import ContentHeader from '@/components/ContentHeader.vue';
import { BaseTable } from "@/components/CustomTable"; import { BaseTable } from "@/components/CustomTable";
import { Swiper, SwiperSlide } from "swiper/vue"; import { Swiper, SwiperSlide } from "swiper/vue";
import { Navigation, Scrollbar } from "swiper/modules"; import { Navigation, Scrollbar } from "swiper/modules";
import { getAppearanceMonitorApi, getAppearanceMonitorDetailApi } from '@/api/dashboard'; import { getAppearanceMonitorApi, getAppearanceMonitorDetailApi } from '@/api/dashboard';
import { isSuccessApi } from "@/utils/forApi";
import "swiper/css"; import "swiper/css";
import 'swiper/scss'; import 'swiper/scss';
import 'swiper/scss/navigation'; import 'swiper/scss/navigation';
@ -103,18 +115,20 @@ defineOptions({
name: "PoleMonitorIndex" name: "PoleMonitorIndex"
}); });
const modules = [Navigation, Scrollbar]; const modules = [Navigation, Scrollbar];
const images = ref([ // const images = ref([
'https://picsum.photos/300/200?random=1', // 'https://picsum.photos/300/200?random=1',
'https://picsum.photos/300/200?random=2', // 'https://picsum.photos/300/200?random=2',
'https://picsum.photos/300/200?random=3', // 'https://picsum.photos/300/200?random=3',
'https://picsum.photos/300/200?random=4', // 'https://picsum.photos/300/200?random=4',
'https://picsum.photos/300/200?random=5' // 'https://picsum.photos/300/200?random=5'
]); // ]);
// const videoUrl = ref("http://192.168.10.28:8081/%E4%BA%A4%E8%AD%A6%E6%89%A7%E6%B3%95%E8%AE%B0%E5%BD%95%E4%BB%AA%E8%A7%86%E9%A2%91/guidang/zhixingren/AB4303403_090976_20240415164239_20240415162738MEDIA_CH0_090976_4303403_00000000_003.mp4");
const activeIndex = ref(-1); const activeIndex = ref(-1);
const handleSlideClick = (index) => { const handleSlideClick = (index) => {
console.log(index); console.log(index);
activeIndex.value = index; activeIndex.value = index;
videoDetail.value = videoUrl.value currFile.value = currFileList.value[index]
}; };
const swiperRef = ref(null); const swiperRef = ref(null);
console.log(swiperRef.value); console.log(swiperRef.value);
@ -125,9 +139,6 @@ const onSwiper = (swiper) => {
const onSlideChange = () => { const onSlideChange = () => {
console.log("slide change"); console.log("slide change");
}; };
//
const currentRowIndex = ref(-1);
// const currentRow = ref<Record<string, any>>({});
const columns = [ const columns = [
{ {
label: "车号", label: "车号",
@ -165,7 +176,7 @@ const columns = [
formatter: ({ is_reviewed }) => { formatter: ({ is_reviewed }) => {
return is_reviewed === true return is_reviewed === true
? "是" ? "是"
:"否"; : "否";
}, },
width: 80, width: 80,
}, },
@ -176,46 +187,54 @@ const columns = [
] ]
const pagination = ref({ currentPage: 1, pageSize: 10, total: 0 }); const pagination = ref({ currentPage: 1, pageSize: 10, total: 0 });
const listData = ref<Record<string, any>[]>([]); //
const listData = ref([]); const currentRow = ref<Record<string, any>>({}); //
const listDetail = ref([]); const currFileList = ref<Record<string, any>[]>([]); //
const currFile = ref<Record<string, any>>({}); //
const searchForm = reactive({ const searchForm = reactive({
train_number: "", train_number: "",
train_carriage_number: "", train_carriage_number: "",
fault_type: "", fault_type: "",
type: "pole" type: "pole"
}); });
const dataLoading = ref(true); const dataLoading = ref(true);
//
const getFileList = async () => {
try {
const res = await getAppearanceMonitorDetailApi({ id: currentRow.value?.id, current: 1, pageSize: 1000 })
console.log(res.data, 'getDetailList_data')
if (isSuccessApi(res)) {
currFileList.value = res.data.data;
currFile.value = res.data.data[0]
}
} catch (error) {
console.log(error, 'getDetailList_error')
}
}
function loadDetail() {
currentRow.value = listData.value[0]
getFileList()
}
//
const getList = async () => { const getList = async () => {
try {
const { currentPage, pageSize } = pagination.value; const { currentPage, pageSize } = pagination.value;
const res = await getAppearanceMonitorApi({ ...searchForm, current: currentPage, pageSize }) const res = await getAppearanceMonitorApi({ ...searchForm, current: currentPage, pageSize })
const { data } = await res console.log(res.data, 'getList_data')
console.log(data, 'getList_data') if (isSuccessApi(res)) {
listData.value = data.data; listData.value = res.data.data;
getDetail(listData.value[0].id) loadDetail()
console.log(data.data);
pagination.value = { pagination.value = {
...pagination.value, ...pagination.value,
total: data.total total: res.data.total
}; };
dataLoading.value = false; }
} catch (error) {
console.error('获取数据失败:', error)
}
}; };
const videoDetail = ref(null)
const videoUrl = ref("http://192.168.10.28:8081/%E4%BA%A4%E8%AD%A6%E6%89%A7%E6%B3%95%E8%AE%B0%E5%BD%95%E4%BB%AA%E8%A7%86%E9%A2%91/guidang/zhixingren/AB4303403_090976_20240415164239_20240415162738MEDIA_CH0_090976_4303403_00000000_003.mp4");
const detailList = ref({})
const getDetail = async (id: any) => {
const res = await getAppearanceMonitorDetailApi({ id, current:1,})
const { data } = await res
console.log(data, 'getDetail_data')
listDetail.value = data.data;
detailList.value = data.data[0]
// images.value = images.value.push(images.value)
console.log(data.data);
}
// //
const handleQuery = () => { const handleQuery = () => {
getList() getList()
@ -227,7 +246,7 @@ const handleReset = () => {
// deviceId.value = ''; // deviceId.value = '';
getList() getList()
}; };
//
function handleTableChange(record) { function handleTableChange(record) {
console.log("handleTableChange_record", record); console.log("handleTableChange_record", record);
pagination.value = { pagination.value = {
@ -237,21 +256,17 @@ function handleTableChange(record) {
}; };
getList(); getList();
} }
// TODO
// //
const handleRowClassName = ({ row }) => { const handleRowClassName = ({ row }) => {
return row.train_number === currentRowIndex.value ? 'selected-row' : ''; return row.id === currentRow.value.id ? 'selected-row' : '';
}; };
// //
const handleRowClick = (row, event, rowIndex) => { const handleRowClick = (row, event, rowIndex) => {
currentRowIndex.value = row.train_number; currentRow.value = row;
getDetail(row.id) getFileList()
};
const handlePlay = (e) => {
e.preventDefault(); //
// alert('');
}; };
onMounted(() => { onMounted(() => {
getList(); getList();
}); });

@ -48,10 +48,9 @@ import Player from '@/components/videoPlayer/Player.vue'
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { extractUniqueDatesWithMoment, filterDataByDate } from '@/utils/array'; import { extractUniqueDatesWithMoment, filterDataByDate } from '@/utils/array';
interface Props { interface Props {
/** 弹窗显隐 */ value: boolean; /** 弹窗显隐 */
value: boolean; info: Record<string, any>; /** 设备信息 */
info: Record<string, any>; historyVideos: Record<string, any>[]; /** 历史视频列表 */
historyVideos: Record<string, any>[];
} }
interface Emits { interface Emits {
(e: "update:value", val: boolean): void; (e: "update:value", val: boolean): void;
@ -110,7 +109,6 @@ const handleItemClick = (item) => {
} else { } else {
currentVideo.value = item; currentVideo.value = item;
} }
}; };
// //

@ -12,7 +12,7 @@
</template> </template>
<!-- 视频播放区域 --> <!-- 视频播放区域 -->
<div class="video-container"> <div class="video-container">
<RealPlayer /> <RealPlayer :show="show" :videoSrc="info.url" />
</div> </div>
</el-dialog> </el-dialog>
</template> </template>

@ -104,6 +104,7 @@
} }
.custom-input { .custom-input {
background-color: transparent; /* 自定义背景色 */
.el-input__inner { .el-input__inner {
background: transparent; background: transparent;
border: none; border: none;

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd * @Author: donghao donghao@supervision.ltd
* @Date: 2025-03-06 17:57:05 * @Date: 2025-03-06 17:57:05
* @LastEditors: donghao donghao@supervision.ltd * @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2025-03-13 16:55:26 * @LastEditTime: 2025-03-14 11:16:06
* @FilePath: \5G-Loading-Bay-Web\src\views\login\Login.vue * @FilePath: \5G-Loading-Bay-Web\src\views\login\Login.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE? * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE?
--> -->

Loading…
Cancel
Save