var form;
|
var layer;
|
var deptId;
|
$(function () {
|
layui.use(['tree', 'layer', 'form', 'laydate'], function () {
|
var tree = layui.tree;
|
form = layui.form;
|
layer = layui.layer;
|
var laydate = layui.laydate;
|
laydate.render({
|
elem: '#time1',
|
type: 'date',
|
theme: '#7b8e9f',
|
value: time
|
});
|
laydate.render({
|
elem: '#time2',
|
type: 'date',
|
theme: '#7b8e9f',
|
value: time
|
});
|
|
test();
|
});
|
});
|
|
//查询巡更照片
|
function query() {
|
// var index = layer.load();
|
// var param = form.val("form-param");
|
// // console.log(param);
|
// param.deptId = deptId;
|
// if(!param.time){
|
// param.time = time;
|
// }
|
// $.ajax({
|
// type: "POST",
|
// url: "../../basic/security/list-patrol-img",
|
// dataType: 'JSON',
|
// contentType: "application/json;charset=UTF-8",
|
// data: JSON.stringify(param),
|
// success: function (result) {
|
// layer.close(index);
|
// if (result.code != "0000") {
|
// renderInoutImg(result.data);
|
// layer.msg(result.msg);
|
// } else {
|
// renderInoutImg(result.data);
|
// }
|
// },
|
// error: function (result) {
|
// layer.close(index);
|
// renderInoutImg(result.data);
|
// layer.msg("获取数据失败,请重新尝试!");
|
// }
|
// });
|
}
|
|
function test() {
|
var imgList = [];
|
for(var i = 0; i < 9; i++){
|
var data = {
|
"userName":"1号仓-仓内摄像头",
|
"createTime":"2022-05-06 14:25:35",
|
"pointName":"中心粮库-1号仓"
|
};
|
if(i<8){
|
data.filePath = "../../static/testImg/cn/cn00" + (i+1) + ".png";
|
}
|
imgList.push(data);
|
}
|
renderInoutImg(imgList);
|
}
|
|
//渲染图片列表
|
function renderInoutImg(imgList) {
|
// console.log(imgList);
|
var mainDiv = $("#listImg");
|
mainDiv.empty();
|
var html;
|
if (imgList && imgList.length > 0) {
|
$.each(imgList, function (index, data) {
|
html = '';
|
html += '<div class="layui-col-md4 layui-col-sm6">';
|
html += '<div class="box2-con"><div class="box2-con-d">';
|
if (data.filePath) {
|
//文件流加载图片
|
// html += '<img src="../../basic/common/getImg?filePath=' + data.filePath + '"/>';
|
html += '<img src="'+data.filePath+'" ondblclick="queryDetail(this.src)"/>';
|
} else {
|
html += '<img src="../../static/images/fail.png" style="height: 90px; padding: 90px 0 0 0;"/>';
|
html += '<div style="height: 110px;font-size: 16px;color: #7fb9e6;">图片加载失败</div>';
|
}
|
html += '</div><div class="box2-text"><div class="layui-row">';
|
html += '<div class="layui-col-md6">';
|
html += '<span>' + data.userName + '</span></div>';
|
html += '<div class="layui-col-md6">';
|
html += '<span style="float: right">' + dateFtt("hh:mm:ss", new Date(data.createTime)) + '</span></div></div>';
|
html += '<div class="layui-row"><div class="layui-col-md12" style="font-size: 14px;color: #9E9E9E;">';
|
html += '<span>' + (data.pointName == null?"未获取到地点":data.pointName) + '</span></div>';
|
html += '</div></div></div></div>';
|
mainDiv.append(html);
|
});
|
} else {
|
|
}
|
}
|
|
/**
|
* 自定义抓拍时间
|
*/
|
function captureTime() {
|
layer.alert("没有相关权限,请联系管理员!");
|
}
|
|
function queryDetail(img) {
|
var src = img;
|
$("#detailImg0").attr("src",src);
|
//弹出密码验证框
|
layer.open({
|
type: 1,
|
title: '记录详情',
|
area: ['70%', '80%'],
|
content: $('#detailImg'),
|
closeBtn: 0
|
});
|
}
|
function closeImg() {
|
layer.closeAll();
|
}
|
|
// 表单清空
|
function resetForm() {
|
$("#form-param")[0].reset();
|
form.val("form-param",{
|
time : dateFtt("yyyy-MM-dd", new Date())
|
});
|
form.render();
|
query();
|
}
|
|
//fmt 时间格式化例如:yyyy-MM-dd hh:mm:ss date 时间 return 字符串
|
function dateFtt(fmt, date) {
|
var o = {
|
"M+": date.getMonth() + 1, // 月份
|
"d+": date.getDate(), // 日
|
"h+": date.getHours(), // 小时
|
"m+": date.getMinutes(), // 分
|
"s+": date.getSeconds(), // 秒
|
"q+": Math.floor((date.getMonth() + 3) / 3), // 季度
|
"S": date.getMilliseconds()
|
// 毫秒
|
};
|
if (/(y+)/.test(fmt))
|
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "")
|
.substr(4 - RegExp.$1.length));
|
for (var k in o)
|
if (new RegExp("(" + k + ")").test(fmt))
|
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k])
|
: (("00" + o[k]).substr(("" + o[k]).length)));
|
return fmt;
|
}
|