bonus-ui/src/views/kitchen/environment/videoMonitoring/index.vue

223 lines
8.7 KiB
Vue
Raw Normal View History

2025-06-26 16:20:38 +08:00
<template>
<div id="video">
2025-07-08 15:56:21 +08:00
<div style="width: 100%;">
<div class="header"><span>视频监控</span></div>
<div style="width: 100%;display: flex;justify-content: space-between;">
<div style="width: 20%;">
<el-tree style="height: 700px; overflow: scroll"
:data="devicesOptions" :props="defaultProps"
:default-expand-all="true"
:expand-on-click-node="false" @node-click="handleNodeClick"
ref="typeTree" node-key="deviceId" highlight-current
></el-tree>
</div>
<div class="contant">
<div style="width: 100%;height: 700px;margin-bottom: 10px; overflow: hidden;position: relative;margin-right: 10px;">
<!-- <div style="width: 100%;height: 100%;position: fixed;"></div> -->
<iframe src="monitor/iframe.html" ref="videoIframe1" frameborder="0" style="width: 100%;height:700px;"></iframe>
</div>
</div>
</div>
2025-06-30 14:18:52 +08:00
</div>
2025-06-27 16:48:42 +08:00
2025-06-26 16:20:38 +08:00
</div>
</template>
2025-07-08 16:08:32 +08:00
<script src="./codebase/webVideoCtrl.js"></script>
2025-06-26 16:20:38 +08:00
<script>
import $ from 'jquery';
2025-06-27 16:48:42 +08:00
import { getKitchenDeviceSelectApi } from "@/api/kitchen/devices";
2025-06-26 16:20:38 +08:00
export default {
name: 'videoMonitoring',
components: {
},
data() {
return {
2025-07-08 15:56:21 +08:00
activeName:'2',
2025-06-26 16:20:38 +08:00
deviceData:[
2025-07-08 15:56:21 +08:00
],
2025-06-27 16:48:42 +08:00
titleList:[],
devicesOptions:[],
defaultProps: {
children: "children",
label: "deviceName",
id: "deviceId"
2025-07-08 15:56:21 +08:00
},
2025-07-08 09:13:29 +08:00
chosenWinNo:0,
2025-07-08 15:56:21 +08:00
chosenChannel:null,
2025-06-26 16:20:38 +08:00
};
2025-07-08 15:56:21 +08:00
},
2025-06-26 16:20:38 +08:00
mounted() {
2025-06-27 16:48:42 +08:00
this.getKitchenDeviceSelect();
2025-06-30 14:18:52 +08:00
this.videoLogin();
2025-06-26 16:20:38 +08:00
},
methods:{
2025-06-27 16:48:42 +08:00
// 门禁设备选项
getKitchenDeviceSelect(){
getKitchenDeviceSelectApi({deviceType:1}).then((response) => {
this.devicesOptions = response.data
})
},
2025-06-30 14:18:52 +08:00
// 初始化监控列表
2025-07-08 15:56:21 +08:00
videoLogin(){
setTimeout(() => {
this.iframeLogin('1')
}, 500);
2025-07-08 09:13:29 +08:00
},
2025-07-08 15:56:21 +08:00
iframeLogin(domId){
2025-06-27 16:48:42 +08:00
var oLiveView = {
iProtocol: 1, // protocol 1<><31>http, 2:https
szIP: "192.168.1.10", // protocol ip
szPort: "80", // protocol port
szUsername: "admin", // device username
szPassword: "hzx12345", // device password
iStreamType: 2, // stream 1<><31>main stream 2<><32>sub-stream 3<><33>third stream 4<><34>transcode stream
iChannelID: 1, // channel no
bZeroChannel: false // zero channel
2025-07-08 15:56:21 +08:00
}
var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
var that = this;
if(domId=='1'){
var oWebVideoCtrl1 = this.$refs.videoIframe1.contentWindow.WebVideoCtrl;
oWebVideoCtrl1.I_InitPlugin(1300,700, {
bWndFull: true,//<2F>Ƿ<EFBFBD>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>˫<EFBFBD><CBAB>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>֧<EFBFBD><D6A7> true:֧<><D6A7> false:<3A><>֧<EFBFBD><D6A7>
iWndowType: 2,
cbInitPluginComplete: function () {
oWebVideoCtrl1.I_InsertOBJECTPlugin("divPlugin");
oWebVideoCtrl1.I_Login(oLiveView.szIP,oLiveView.iProtocol, oLiveView.szPort, oLiveView.szUsername, oLiveView.szPassword, {
success: function (xmlDoc) {
setTimeout(function () {
oWebVideoCtrl1.I_StartRealPlay(szDeviceIdentify, {
iRtspPort: oLiveView.szPort,
iWndIndex:0,
iStreamType: oLiveView.iStreamType,
iChannelID: 15,
bZeroChannel: oLiveView.bZeroChannel
});
oWebVideoCtrl1.I_StartRealPlay(szDeviceIdentify, {
iRtspPort: oLiveView.szPort,
iWndIndex:1,
iStreamType: oLiveView.iStreamType,
iChannelID: 16,
bZeroChannel: oLiveView.bZeroChannel
});
oWebVideoCtrl1.I_StartRealPlay(szDeviceIdentify, {
iRtspPort: oLiveView.szPort,
iWndIndex:2,
iStreamType: oLiveView.iStreamType,
iChannelID: 21,
bZeroChannel: oLiveView.bZeroChannel
});
oWebVideoCtrl1.I_StartRealPlay(szDeviceIdentify, {
iRtspPort: oLiveView.szPort,
iWndIndex:3,
iStreamType: oLiveView.iStreamType,
iChannelID: 22,
bZeroChannel: oLiveView.bZeroChannel
});
}, 500);
}
});
},
cbSelWnd: function (xmlDoc) {
let WndIndex = parseInt($(xmlDoc).find("SelectWnd").eq(0).text(), 10);
var szInfo = "当前选择的窗口编号:" + WndIndex;
that.chosenWinNo = WndIndex;
},
});
}
2025-06-27 16:48:42 +08:00
},
2025-07-08 15:56:21 +08:00
iframeLogout(domId){
2025-06-27 16:48:42 +08:00
var oLiveView = {
iProtocol: 1, // protocol 1<><31>http, 2:https
szIP: "192.168.1.10", // protocol ip
szPort: "80", // protocol port
szUsername: "admin", // device username
szPassword: "hzx12345", // device password
iStreamType: 2, // stream 1<><31>main stream 2<><32>sub-stream 3<><33>third stream 4<><34>transcode stream
iChannelID: 1, // channel no
bZeroChannel: false // zero channel
2025-07-08 15:56:21 +08:00
}
var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
if(domId=='1'){
var oWebVideoCtrl1 = this.$refs.videoIframe1.contentWindow.WebVideoCtrl;
var iRet = oWebVideoCtrl1.I_Logout(szDeviceIdentify);
var szInfo = ""
if (0 == iRet) {
szInfo = "退出成功!";
} else {
szInfo = "退出失败!";
}
console.log(szInfo)
}
},
async handleNodeClick(data) {
2025-07-08 09:13:29 +08:00
if(data.deviceExtendInfo&&data.deviceExtendInfo!=""){
2025-07-08 15:56:21 +08:00
let obj = JSON.parse(data.deviceExtendInfo)
2025-07-08 16:08:32 +08:00
this.chosenChannel = 15
2025-07-08 15:56:21 +08:00
setTimeout(() => {
this.iframeLoaded(this.chosenWinNo,this.chosenChannel)
2025-07-08 09:13:29 +08:00
}, 500);
}else{
this.$modal.msgError("设备未绑定通道号");
2025-06-27 16:48:42 +08:00
}
2025-07-08 15:56:21 +08:00
},
iframeLoaded(WinNo,Channel){
2025-07-08 09:13:29 +08:00
var oLiveView = {
iProtocol: 1, // protocol 1<><31>http, 2:https
szIP: "192.168.1.10", // protocol ip
szPort: "80", // protocol port
szUsername: "admin", // device username
szPassword: "hzx12345", // device password
iStreamType: 2, // stream 1<><31>main stream 2<><32>sub-stream 3<><33>third stream 4<><34>transcode stream
iChannelID: 1, // channel no
bZeroChannel: false // zero channel
2025-07-08 15:56:21 +08:00
}
var szDeviceIdentify = oLiveView.szIP;
2025-07-08 09:13:29 +08:00
var oWebVideoCtrl1 = this.$refs.videoIframe1.contentWindow.WebVideoCtrl;
2025-07-08 15:56:21 +08:00
oWebVideoCtrl1.I_Stop({
iWndIndex:WinNo
})
setTimeout(function () {
oWebVideoCtrl1.I_StartRealPlay(szDeviceIdentify, {
iRtspPort: oLiveView.szPort,
iWndIndex:WinNo,
iStreamType: oLiveView.iStreamType,
iChannelID: Channel,
bZeroChannel: oLiveView.bZeroChannel
});
}, 800);
},
2025-06-30 14:18:52 +08:00
2025-06-26 16:20:38 +08:00
}
}
</script>
<style lang="scss" scoped>
#video{
width: 100%;
height: 100%;
margin: 0 0.2rem;
.header{
display: flex;
align-items: center;
color: #000;
2025-07-08 15:56:21 +08:00
margin-top: 10px;
2025-06-26 16:20:38 +08:00
span{
margin-left: 40px;
font-size: 20px;
font-weight: bold;
}
}
.contant{
2025-07-08 15:56:21 +08:00
width: 1350px;
2025-06-26 16:20:38 +08:00
height: auto;
// height: 85%;
display: flex;
justify-content: center;
align-content: center;
2025-07-08 09:13:29 +08:00
flex-wrap: wrap;
2025-06-26 16:20:38 +08:00
}
}
</style>