Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/timeefficiency/patrolRecordViewCameraDetails.jsp
2026-01-16 14:13:44 +08:00

216 lines
9.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.sipai.entity.timeefficiency.PatrolRecord"%>
<%@page import="com.sipai.entity.timeefficiency.TimeEfficiencyCommStr"%>
<% request.setAttribute("Status_Issue", com.sipai.entity.timeefficiency.PatrolRecord.Status_Issue); %>
<% request.setAttribute("Status_Start", com.sipai.entity.timeefficiency.PatrolRecord.Status_Start); %>
<% request.setAttribute("Status_Finish", com.sipai.entity.timeefficiency.PatrolRecord.Status_Finish); %>
<% request.setAttribute("Status_PartFinish", com.sipai.entity.timeefficiency.PatrolRecord.Status_PartFinish); %>
<% request.setAttribute("Status_Undo", com.sipai.entity.timeefficiency.PatrolRecord.Status_Undo); %>
<script type="text/javascript">
var nowid = '';
$(function() {
$("#cameras").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/timeEfficiency/patrolRecord/getCameras.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: false, // 在表格底部显示分页组件默认false
pageList: [10, 20,50], // 设置页面可以显示的数据条数
pageSize: 50, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'client', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset/params.limit+1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
patrolRecordId: '${patrolRecordId}'
}
},
responseHandler: function(res){
return res.result
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
field: 'name', // 返回json数据中的name
title: '摄像机名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '15%',
formatter: function (value, row, index) {
return row.camera.name;
}
},
{
field: 'status', // 返回json数据中的name
title: '状态', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
var str = "";
if("${Status_Issue}"==value){
//str = '<span style="color:#c12e2a;"><i class="fa fa-times-circle-o" aria-hidden="true"></i> 已下发</span>';
str = '<span style="color:#c12e2a;"><i class="fa fa-close" aria-hidden="true"></i>未打卡</span>';
}
if("${Status_Finish}"==value){
//str = '<span style="color:#3e8f3e"><i class="fa fa-check-circle-o" aria-hidden="true"></i> 已完成</span>';
str = '<span style="color:#3e8f3e"><i class="fa fa-check" aria-hidden="true"></i>已打卡</span>';
}
return str;
}
}
],
onLoadSuccess: function(){ //加载成功时执行
adjustBootstrapTableView("table_patrolPoint");
},
onLoadError: function(){ //加载失败时执行
console.info("加载数据失败");
},
onDblClickRow: function(row){
$.post(ext.contextPath + '/work/camera/closeRPCWebSocket.do',{id:nowid,time:'now',uuid:'${uuid}'},function(){
})
showVideo(row.camera.id,row.id);
}
});
var cameraid = '${patrolPointId}';
var paid = '${cid}';
console.log('cameraid:'+cameraid);
console.log('paid:'+paid);
showVideo(cameraid,paid);
// showVideo('${id}','${patrolPointId}');
nowid = '${patrolPointId}';
//getCamerasByProcessSectionId('${patrolRecordId}');
//getCamerasByProcessSectionId('d9016deabd2749be8b381159f29fc0dc');
});
function getCamerasByProcessSectionId(patrolRecordId) {
$.post(ext.contextPath +"/timeEfficiency/patrolRecord/getCamerasByPatrolRecordId.do", {patrolRecordId: patrolRecordId}, function(data) {
/*alert('摄像头数据:' + data);*/
var res = JSON.parse(data);
for(var i = 0, len = res.length; i < len; i++) {
var videoIframe = document.createElement('iframe');
videoIframe.id = 'videoIframe-' + res[i].id;
videoIframe.style.cssText = 'width:510px;height:320px;border:0;margin:2px;top:0;z-index:9999;float:left;';
switch(res[i].type){
case 'dahua':
videoIframe.src = ext.contextPath +"/work/camera/cameraview_dahua_new.do?id=" + res[i].id;
break;
default:
videoIframe.src = ext.contextPath +"/work/camera/cameraview_new.do?id=" + res[i].id;
}
document.querySelector('#camerasFrame').appendChild(videoIframe);
}
});
}
var websocket = null;
function showVideo(cameraid,pid){
if(websocket != null){
websocket.close();
$.post(ext.contextPath + '/work/camera/closeRPCWebSocket.do',{id:nowid,time:'now',uuid:'${uuid}'},function(data){
});
}
nowid = cameraid;
//var websocket = null;
var restartDialog;
//判断当前浏览器是否支持WebSocket
if ('WebSocket' in window) {
var time = '${time}';
if(time==null || time==''){
time="now";
}
$.post(ext.contextPath + '/work/camera/getCameraById.do',{id:cameraid},function(data){
var camera = JSON.parse(data);
websocket = new WebSocket("${ws}/videoWebSocket/"+camera.type+"/"+camera.url+"/"+camera.username+"/"+camera.password+"/"+camera.channel+"/"+time+"/${uuid}");
websocket.onerror = function () {
};
//连接成功建立的回调方法
websocket.onopen = function () {
console.info('消息滚动websocker开启');
}
//接收到消息的回调方法
websocket.onmessage = function (event) {
var result= JSON.parse(event.data);
$("#show_video").attr("src", "data:image/*;base64," + result.data);
}
websocket.onclose = function () {
closeWebSocket();
}
})
//websocket = new WebSocket(ext.basePath.replace("http","ws")+"/videoWebSocket/${id}/"+time+"/${uuid}");
}
else {
alert('当前浏览器 Not support websocket')
}
setTimeout(function(){
var k = 0;
var interval = setInterval(function(){
if(k<11){
$('#time').html('倒计时:'+(10-k)+'s后完成该摄像头视频巡检');
k++;
}else{
$('#time').html('该摄像头视频巡检完成,可切换下一个视频');
$.post(ext.contextPath+'/timeEfficiency/patrolRecord/finishCameraPatrol_New.do',{id: pid},function(data){
$("#table_patrolPoint").bootstrapTable('refresh');
$("#cameras").bootstrapTable('refresh');
});
clearInterval(interval);
}
},1000);
},10000);
}
var closecamera=function(){
if(websocket != null){
websocket.close();
$.post(ext.contextPath + '/work/camera/closeRPCWebSocket.do',{id:nowid,time:'now',uuid:'${uuid}'},function(data){
});
}
$('#camerasFrame').html('');
}
</script>
</head>
<div class="modal fade" id="subModal_contents">
<div class="modal-dialog modal-lg">
<div class="modal-content" style="width: 950px;">
<div class="modal-header">
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close"> -->
<!-- <span aria-hidden="true">&times;</span></button> -->
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<div class="box box-primary" >
<div class="box-header with-border">
双击摄像头列表可切换摄像头<h3 class="box-title" id="time">倒计时10s后完成该摄像头视频巡检</h3>
</div>
<!-- /.box-header -->
<div class="box-body ">
<div style="width:100%;padding:2px;background:rgba(255,255,255,0);float:left;">
<div style="width:30%;padding:2px;background:rgba(255,255,255,0);float:left;">
<table id="cameras"></table>
</div>
<div id="camerasFrame" style="width:68%;padding:2px;background:rgba(255,255,255,0);float:left;">
<img id="show_video" style="width: 100%;border:1px solid black;" src="" alt="正在加载。。。">
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="closecamera()">关闭</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>