CZT
2023-10-21 3e7773504d6bd15e6ed20ecf5c6236b163ba0fe8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
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;
}