Commit 026bd786 authored by 胡占生's avatar 胡占生 🇨🇳

fix: 视频管理,左侧树联调,视频联调

parent 387ebb07
...@@ -9,6 +9,23 @@ export function listAiRegionManage(query) { ...@@ -9,6 +9,23 @@ export function listAiRegionManage(query) {
}) })
} }
// 获取左侧树
export function videoTreeListManage(query) {
return request({
url: '/yunshou/aiRegionManage/videoTreeList',
method: 'get',
params: query
})
}
// 获取根据点位ID获取设备
export function idDevice(id) {
return request({
url: `/yunshou/aiRegionManage/getVideoInfoById/${id}`,
method: 'get',
})
}
// 查询设备列表x详情 // 查询设备列表x详情
export function detailDevice(id) { export function detailDevice(id) {
return request({ return request({
...@@ -62,3 +79,4 @@ export function exportDevice(data) { ...@@ -62,3 +79,4 @@ export function exportDevice(data) {
data: data data: data
}) })
} }
...@@ -103,7 +103,6 @@ watch(() => props.modelValue, val => { ...@@ -103,7 +103,6 @@ watch(() => props.modelValue, val => {
if (typeof item === "string") { if (typeof item === "string") {
if (item.indexOf(baseUrl) === -1) { if (item.indexOf(baseUrl) === -1) {
item = { name: baseUrl + item, url: baseUrl + item }; item = { name: baseUrl + item, url: baseUrl + item };
console.log("🚀 ~ watch ~ item:", item)
} else { } else {
item = { name: item, url: item }; item = { name: item, url: item };
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
:before-remove="handleDelete" :before-remove="handleDelete"
:show-file-list="false" :show-file-list="false"
:headers="headers" :headers="headers"
:file-list="fileList"
:on-preview="handlePictureCardPreview" :on-preview="handlePictureCardPreview"
:class="{ hide: fileList.length >= limit }" :class="{ hide: fileList.length >= limit }"
> >
...@@ -61,6 +62,7 @@ ...@@ -61,6 +62,7 @@
append-to-body append-to-body
> >
<video <video
width="100%"
v-if="getFileType(dialogImageUrl)=='video'" v-if="getFileType(dialogImageUrl)=='video'"
:src="dialogImageUrl" :src="dialogImageUrl"
controls controls
...@@ -151,6 +153,7 @@ watch(() => props.modelValue, val => { ...@@ -151,6 +153,7 @@ watch(() => props.modelValue, val => {
// 上传前loading加载 // 上传前loading加载
function handleBeforeUpload(file) { function handleBeforeUpload(file) {
console.log("🚀 ~ handleBeforeUpload ~ file:", file)
let isImg = false; let isImg = false;
if (props.fileType.length) { if (props.fileType.length) {
let fileExtension = ""; let fileExtension = "";
......
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
</el-row> </el-row>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="24"> <el-col :span="24">
<el-form-item label-width="130px" label="在线体验案例图片/视频" prop="algorithmBannerVideo"> <el-form-item label-width="130px" label="在线体验案例图片/视频" prop="imgVideoData">
<ImgVideoUpload <ImgVideoUpload
:modelValue="imgVideoData" :modelValue="imgVideoData"
:fileType="['png', 'jpg', 'mp4']" :fileType="['png', 'jpg', 'mp4']"
...@@ -515,6 +515,7 @@ function getImageUrl(url){ ...@@ -515,6 +515,7 @@ function getImageUrl(url){
form.value.cardImg=url form.value.cardImg=url
} }
function getAlgorithmBannerVideo(url){ function getAlgorithmBannerVideo(url){
console.log("🚀 ~ getAlgorithmBanner ~ url:", url)
form.value.algorithmBannerVideo=url form.value.algorithmBannerVideo=url
} }
function getAlgorithmBanner(url){ function getAlgorithmBanner(url){
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
</video> </video>
</div> </div>
<ImgVideoUpload <ImgVideoUpload
v-if="form.algorithmStatus=='0'"
style="position: absolute;bottom: 5px;left: 26%;" style="position: absolute;bottom: 5px;left: 26%;"
:modelValue="uploadUrl" :modelValue="uploadUrl"
:fileType="['png', 'jpg', 'mp4']" :fileType="['png', 'jpg', 'mp4']"
...@@ -77,6 +78,9 @@ ...@@ -77,6 +78,9 @@
:isShowTip="false" :isShowTip="false"
@update:modelObj="getImgObj" @update:modelObj="getImgObj"
/> />
<div v-else style="position: absolute;bottom: 5px;left: 26%;" class="text-style">
请开启算法
</div>
<!-- <ImageUpload :limit='1' :fileSize="5" :isShowTip="false" @update:modelObj="getImgObj"/> --> <!-- <ImageUpload :limit='1' :fileSize="5" :isShowTip="false" @update:modelObj="getImgObj"/> -->
</div> </div>
</el-card> </el-card>
...@@ -93,7 +97,7 @@ ...@@ -93,7 +97,7 @@
<source :src="'http://192.168.3.82'+nowImg" type="video/mp4" /> <source :src="'http://192.168.3.82'+nowImg" type="video/mp4" />
</video> </video>
</div> </div>
<el-button type="primary" plain @click="openIdentify" style="margin: 10px 0;">开始识别</el-button> <el-button v-if="form.algorithmStatus=='0'" type="primary" plain @click="openIdentify" style="margin: 10px 0;">开始识别</el-button>
</el-card> </el-card>
<el-card > <el-card >
<div class="text-style" style="margin: 10px 0;"> <div class="text-style" style="margin: 10px 0;">
...@@ -110,8 +114,10 @@ ...@@ -110,8 +114,10 @@
</video> </video>
</div> </div>
<div style="display: flex;justify-content: space-between;margin: 10px 0;"> <div style="display: flex;justify-content: space-between;margin: 10px 0;">
<el-button type="primary" plain>重置区域</el-button> <!-- <el-button type="primary" plain>重置区域</el-button> -->
<el-button type="primary" plain>下载识别视频</el-button> <div></div>
<el-button type="primary" plain @click="downVideo">下载识别视频</el-button>
<!-- <el-button v-if="getFileType(outFilePath)=='1'" type="primary" plain @click="downVideo">下载识别视频</el-button> -->
</div> </div>
</el-card> </el-card>
</div> </div>
...@@ -269,6 +275,12 @@ function getFileType(fileName) { ...@@ -269,6 +275,12 @@ function getFileType(fileName) {
return "0"; return "0";
} }
} }
function downVideo(){
window.open(baseUrl+'/algorithm/images/ResDir/2024/9/2/1830503463524630529/Safety helmet wearing detection/1725261009531_1.mp4')
}
getDetials() getDetials()
</script> </script>
......
...@@ -53,30 +53,35 @@ ...@@ -53,30 +53,35 @@
<el-button <el-button
type="primary" type="primary"
plain plain
@click="handState('')"
>全部</el-button> >全部</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
@click="handState('0')"
>运行中</el-button> >运行中</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
@click="handState('1')"
>已禁用</el-button> >已禁用</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
@click="handState('2')"
>已下载</el-button> >已下载</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
@click="handState('3')"
>已删除</el-button> >已删除</el-button>
</el-col> </el-col>
</el-row> </el-row>
...@@ -187,14 +192,9 @@ ...@@ -187,14 +192,9 @@
// console.log("🚀 ~ handDetails ~ row:", row) // console.log("🚀 ~ handDetails ~ row:", row)
router.push("/algorithmList/details/info/" + row.id); router.push("/algorithmList/details/info/" + row.id);
} }
function handleSetSize(row) { function handState(state) {
// reset(); queryParams.value.algorithmStatus=state
// const postId = row.postId || ids.value; getList()
// getPost(postId).then(response => {
// form.value = response.data;
// open.value = true;
// title.value = "修改岗位";
// });
} }
function handleUpdate(row) { function handleUpdate(row) {
algorithmDownRef.value.handleUpdate(row) algorithmDownRef.value.handleUpdate(row)
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
import { ArrowDown } from "@element-plus/icons-vue"; import { ArrowDown } from "@element-plus/icons-vue";
import { Search } from "@element-plus/icons-vue"; import { Search } from "@element-plus/icons-vue";
import '@/utils/jsmpeg.min' import '@/utils/jsmpeg.min'
import { listAiRegionManage } from "@/api/videoControl/videoPreview"; import { listAiRegionManage,videoTreeListManage,idDevice } from "@/api/videoControl/videoPreview";
import { listAlarm } from "@/api/alarmControl/index.js"; import { listAlarm } from "@/api/alarmControl/index.js";
import { onMounted, reactive, ref, } from "vue"; import { onMounted, reactive, ref, } from "vue";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
...@@ -110,48 +110,8 @@ const nowText = ref("视频预览"); ...@@ -110,48 +110,8 @@ const nowText = ref("视频预览");
const deptTreeRef = ref(null); const deptTreeRef = ref(null);
const deptName = ref(""); const deptName = ref("");
const deptOptions = ref(undefined); const deptOptions = ref(undefined);
const algorithmList = ref([ const algorithmList = ref([]);
{ const player=ref(null);
name: "我的算法",
value: 1,
},
{
name: "最新算法",
value: 2,
},
{
name: "基础算法",
value: 3,
},
{
name: "智慧煤矿",
value: 4,
},
{
name: "智慧能源",
value: 5,
},
{
name: "智慧校园",
value: 6,
},
{
name: "智慧港口",
value: 7,
},
{
name: "智慧煤矿",
value: 8,
},
{
name: "智慧能源",
value: 9,
},
{
name: "智慧校园",
value: 10,
},
]);
const data = reactive({ const data = reactive({
form: { form: {
title:'测试测试测试' title:'测试测试测试'
...@@ -180,7 +140,8 @@ const filterNode = (value, data) => { ...@@ -180,7 +140,8 @@ const filterNode = (value, data) => {
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}; };
function getTreeData() { function getTreeData() {
listAiRegionManage().then((res) => { videoTreeListManage().then((res) => {
console.log("🚀 ~ videoTreeListManage ~ res:", res)
deptOptions.value=res.data deptOptions.value=res.data
}) })
} }
...@@ -191,12 +152,26 @@ function getWaringData() { ...@@ -191,12 +152,26 @@ function getWaringData() {
} }
getTreeData() getTreeData()
getWaringData() getWaringData()
function getVideos(){ function getVideos(str){
let canvas = document.getElementById('video') let canvas = document.getElementById('video')
let url = 'rtsp://192.168.20.211:554/av0_0' let url = str?str:'rtsp://192.168.20.211:554/av0_0'
let player = new JSMpeg.Player("ws://192.168.4.232:9999/rtsp?url="+btoa(url), {canvas: canvas}) player.value = new JSMpeg.Player("ws://192.168.4.232:9999/rtsp?url="+btoa(url), {canvas: canvas})
player.value.play()
} }
// // 当需要重新加载视频流时,可以调用以下函数
// function reloadVideoStream(str) {
// let canvas = document.getElementById('video')
// var ctx = canvas.getContext('2d');
// ctx.clearRect(0, 0, canvas.width, canvas.height);
// // 更新视频流URL
// player.value = new JSMpeg.Player("ws://192.168.4.232:9999/rtsp?url="+btoa(str), {canvas: canvas})
// // 开始解码新的视频流
// player.value.play();
// }
onMounted(() => { onMounted(() => {
// player.value.play()//播放
getVideos() getVideos()
}) })
...@@ -205,6 +180,11 @@ watch(deptName, (val) => { ...@@ -205,6 +180,11 @@ watch(deptName, (val) => {
}) })
function handleNodeClick(row) { function handleNodeClick(row) {
const treeType = row.id.split("-")[0];
const treeID = row.id.split("-")[1];
if(treeType=='点位'){
handlvideoPath(treeID)
}
} }
function handAdd(row) { function handAdd(row) {
...@@ -216,9 +196,10 @@ function handleSetSize(row) { ...@@ -216,9 +196,10 @@ function handleSetSize(row) {
function handleUpdate(row) { function handleUpdate(row) {
} }
/** 删除按钮操作 */ function handlvideoPath(id) {
function handleDelete(row) { idDevice(id).then((res) => {
getVideos(res.data.videoUrl)
})
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment