fix:跟车病害调整,跟车视频调整

This commit is contained in:
SunTao 2024-12-03 15:24:58 +08:00
parent bfd8d39ecf
commit 7b745c6f4c
7 changed files with 159 additions and 66 deletions

View File

@ -48,6 +48,7 @@
"echarts-gl": "^2.0.9", "echarts-gl": "^2.0.9",
"element-ui": "2.15.14", "element-ui": "2.15.14",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"flv.js": "^1.6.2",
"fuse.js": "6.4.3", "fuse.js": "6.4.3",
"highlight.js": "9.18.5", "highlight.js": "9.18.5",
"js-beautify": "1.13.0", "js-beautify": "1.13.0",

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-21 09:59:32 * @Date: 2024-10-21 09:59:32
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-21 09:05:48 * @LastEditTime: 2024-12-03 14:52:09
* @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\traffic-safety.vue * @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\traffic-safety.vue
* @Description: 病害巡检大屏-今日巡查 * @Description: 病害巡检大屏-今日巡查
--> -->
@ -635,7 +635,7 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding-left: 1.5rem; padding-left: 1.5rem;
font-size: 2rem; font-size: 1.5rem;
// background-image: url("../../../assets/screen/traffic/traffic-left.png"); // background-image: url("../../../assets/screen/traffic/traffic-left.png");
background-image: url("~@/assets/screen/disease/today-left.png"); background-image: url("~@/assets/screen/disease/today-left.png");
background-repeat: no-repeat; background-repeat: no-repeat;

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-15 13:14:03 * @Date: 2024-11-15 13:14:03
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 13:10:46 * @LastEditTime: 2024-12-03 14:32:34
* @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\components\inspection-follow.vue * @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\components\inspection-follow.vue
* @Description: 总览大屏-巡检车辆-跟车弹窗 * @Description: 总览大屏-巡检车辆-跟车弹窗
--> -->
@ -32,6 +32,8 @@ export default {
return { return {
// //
carLayerSource: null, carLayerSource: null,
//
defectLayerSource: null,
}; };
}, },
created() { created() {
@ -47,8 +49,7 @@ export default {
if (item.type === "carPosition") { if (item.type === "carPosition") {
if (!this.carMapPointSource) { if (!this.carMapPointSource) {
this.drawCarMapPoint(item.data); this.drawCarMapPoint(item.data);
} } else {
else {
// //
const currentLocation = this.carMapPointSource const currentLocation = this.carMapPointSource
.getFeatures()[0] .getFeatures()[0]
@ -90,7 +91,16 @@ export default {
}, 10); }, 10);
} }
} else if (item.type === "defect") { } else if (item.type === "defect") {
console.log(item, "生成得病害"); if (!this.defectLayerSource) {
this.drawDefectMapPoint(item.data);
} else {
const feature = new Feature({
geometry: new Point(item.geometry.coordinates),
data: item,
type: "defectPoint",
});
this.defectLayerSource.addFeature(feature);
}
} }
}); });
}, },
@ -135,6 +145,45 @@ export default {
map.addLayer(carMapPointLayer); map.addLayer(carMapPointLayer);
}); });
}, },
/**
* @description: 绘制病害地图点位
* @param {object} item
* @return {void}
*/
drawDefectMapPoint(item) {
const features = [];
const feature = new Feature({
geometry: new Point(item.geometry.coordinates),
data: item,
type: "defectPoint",
});
//
feature.setStyle([
new Style({
image: new Icon({
crossOrigin: "anonymous",
src: require(`@/assets/screen/index/${item.defecttype}.png`),
//
scale: 0.5,
}),
}),
]);
features.push(feature);
this.defectLayerSource = new VectorSource({
features,
});
const carMapPointLayer = new VectorLayer({
source: this.defectLayerSource,
properties: {
type: "defectPoint",
},
});
this.$nextTick(() => {
const map = this.$refs.carMap.instance.get("map");
map.addLayer(carMapPointLayer);
});
},
}, },
}; };
</script> </script>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-15 14:23:21 * @Date: 2024-11-15 14:23:21
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 13:35:29 * @LastEditTime: 2024-12-03 14:14:14
* @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\components\inspection-view.vue * @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\components\inspection-view.vue
* @Description: 总览大屏-巡检车辆-视频查看弹窗 * @Description: 总览大屏-巡检车辆-视频查看弹窗
--> -->
@ -10,18 +10,20 @@
<template> <template>
<div class="view-content"> <div class="view-content">
<video <video
id="mmiid" id="videoElement"
class="video-js vjs-big-play-centered vjs-fluid" crossOrigin="anonymous"
controls controls
preload="auto" autoplay
muted
width="100%" width="100%"
height="100%" height="800px"
></video> ></video>
</div> </div>
</template> </template>
<script> <script>
import { getVideoUrl } from "@/api/xj/screen/disease-screen"; import { getVideoUrl } from "@/api/xj/screen/disease-screen";
import flvjs from "flv.js";
export default { export default {
name: "InspectionView", name: "InspectionView",
props: { props: {
@ -34,6 +36,9 @@ export default {
return { return {
// //
vedioUrl: "", vedioUrl: "",
isPlay: false,
player: null,
timerId: null,
}; };
}, },
created() { created() {
@ -42,40 +47,76 @@ export default {
methods: { methods: {
/* 获取视频url地址 */ /* 获取视频url地址 */
getVideo() { getVideo() {
// getVideoUrl({ id: this.dialogItem.clientId }).then(({ code, msg }) => {
getVideoUrl({ id: this.dialogItem.clientId }).then(({ code, data }) => {
if (code === 200) { if (code === 200) {
// this.$nextTick(() => {
if (!data) { this.createVideo(msg);
this.$message.error('获取视频流失败'); });
return;
}
// flv.js
if (flvjs.isSupported()) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: "http://1011.hlsplay.aodianyun.com/demo/game.flv",
isLive: true,
hasAudio: true,
hasVideo: true
});
flvPlayer.attachMediaElement(document.querySelector("#mmiid"));
flvPlayer.load();
flvPlayer.play();
} else {
this.$message.error('当前浏览器不支持FLV播放');
}
} }
}); });
// getVideoUrl({ id: this.dialogItem.clientId }).then(({ code, data }) => {
// if (code === 200) {
// console.log(data, "data");
// }
// });
}, },
createVideo(url) {
if (flvjs.isSupported()) {
const videoElement = document.getElementById("videoElement");
this.player = flvjs.createPlayer(
{
type: "flv",
isLive: true,
hasAudio: false,
url, // flv
enableWorker: false, // Web Worker
stashInitialSize: 32 * 1024, // 1024kb
stashInitialTime: 2, // 200
seekType: "range", // range便
lazyLoad: false, //false
lazyLoadMaxDuration: 2, // 200
deferLoadAfterSourceOpen: false,
},
{
cors: true, //
// enableWorker: true, // 线
enableStashBuffer: false, //
// stashInitialSize: 128, // (kb) 384kb
autoCleanupSourceBuffer: true, //
}
);
this.player.attachMediaElement(videoElement); //
this.player.load(); //
this.player.play(); //
//
// if (this.timerId !== null) {
// clearInterval(this.timerId);
// }
// this.timerId = setInterval(() => {
// if (videoElement.buffered.length > 0) {
// const end = videoElement.buffered.end(0); //
// const current = videoElement.currentTime; //
// const diff = end - current; //
// // console.log(diff);
// const diffCritical = 4; // 4
// const diffSpeedUp = 1; // 1
// const maxPlaybackRate = 4; //
// let playbackRate = 1.0; //
// if (diff > diffCritical) {
// // console.log("4");
// videoElement.currentTime = end - 1.5;
// playbackRate = Math.max(1, Math.min(diffCritical, 16));
// } else if (diff > diffSpeedUp) {
// // console.log("1");
// playbackRate = Math.max(1, Math.min(diff, maxPlaybackRate, 16));
// }
// videoElement.playbackRate = playbackRate;
// if (videoElement.paused) {
// this.videoForm.player.play();
// }
// }
// }, 1000);
}
},
},
destroyed() {
clearInterval(this.timerId);
}, },
}; };
</script> </script>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-08 09:40:18 * @Date: 2024-11-08 09:40:18
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-03 13:19:02 * @LastEditTime: 2024-12-03 14:10:16
* @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\inspection-vehicles.vue * @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\inspection-vehicles.vue
* @Description: 总览大屏-巡检车辆 * @Description: 总览大屏-巡检车辆
--> -->
@ -132,7 +132,7 @@
<el-dialog <el-dialog
:title="viewTitle" :title="viewTitle"
:visible.sync="showViewVisible" :visible.sync="showViewVisible"
width="60rem" width="90rem"
append-to-body append-to-body
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-18 09:42:49 * @Date: 2024-10-18 09:42:49
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-20 16:27:24 * @LastEditTime: 2024-12-03 14:51:42
* @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\today-inspection.vue * @FilePath: \znxjxt-ui\src\views\big-screen\overview-components\today-inspection.vue
* @Description: 总览大屏-今日巡查 * @Description: 总览大屏-今日巡查
--> -->
@ -622,7 +622,7 @@ export default {
span { span {
cursor: pointer; cursor: pointer;
font-size: 2rem; font-size: 1.5rem;
font-weight: 800; font-weight: 800;
font-family: "DouYu"; font-family: "DouYu";
background: linear-gradient( background: linear-gradient(

View File

@ -2,8 +2,8 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-01 17:25:06 * @Date: 2024-11-01 17:25:06
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-14 15:00:35 * @LastEditTime: 2024-12-03 15:14:12
* @FilePath: \znxjxt-ui\src\views\xj\inspection\confirmation-management\image-dialog.vue * @FilePath: \znxjxt-ui\src\views\xj\inspection\confirmation-management\components\image-dialog.vue
* @Description: 病害确认-影像模式弹窗 * @Description: 病害确认-影像模式弹窗
--> -->
@ -139,10 +139,10 @@
</div> </div>
</div> </div>
<div class="footer"> <div class="footer">
<el-button type="success" size="mini" @click="changeDefect(1)" <el-button type="success" size="mini" @click="changeDefect(2)"
>是病害(Y)</el-button >是病害(Y)</el-button
> >
<el-button type="warning" size="mini" @click="changeDefect(0)" <el-button type="warning" size="mini" @click="changeDefect(3)"
>不是病害(N)</el-button >不是病害(N)</el-button
> >
</div> </div>
@ -416,21 +416,23 @@ export default {
/* 是病害/不是病害点击事件 */ /* 是病害/不是病害点击事件 */
changeDefect(value) { changeDefect(value) {
mergeDefect({ if (this.defectData.length > 0) {
status: value, mergeDefect({
snapShotIds: [this.defectData[this.currentIndex].snapshotId], status: value,
}) snapShotIds: [this.defectData[this.currentIndex].snapshotId],
.then(({ code, msg }) => {
if (code === 200) {
this.showImage(this.currentIndex);
this.$modal.msgSuccess("修改成功");
} else {
this.$modal.msgWarning(msg);
}
}) })
.finally(() => { .then(({ code, msg }) => {
this.getList(); if (code === 200) {
}); this.showImage(this.currentIndex);
this.$modal.msgSuccess("修改成功");
} else {
this.$modal.msgWarning(msg);
}
})
.finally(() => {
this.getList();
});
}
}, },
/* 键盘事件 */ /* 键盘事件 */
@ -457,10 +459,10 @@ export default {
} }
} else if (event.keyCode === 89) { } else if (event.keyCode === 89) {
// //
this.changeDefect(1); this.changeDefect(2);
} else if (event.keyCode === 78) { } else if (event.keyCode === 78) {
// //
this.changeDefect(0); this.changeDefect(3);
} }
}, },
}, },