var DialogObject = { Open: function (container) { var total_height = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); $(".clearn").show().css("height", total_height + "px"); container.show(); var left = parseInt(container.width() / 2); left = -left; var top = parseInt(container.height() / 2); top = -top; container.css({ "margin-left": left + "px", "margin-top": top + "px" }); } } var mainObject = { init: function () { $("#stress_person_content").load("/static/module/childmodule/sub_bureau/stress_person.html",function (){ //加载完后的处理 }); $(".monitor_person_info").load("/static/module/childmodule/sub_bureau/basic_person.html",function (){ //加载完后的处理 }); var main_width = $(".monitor_center").width(); var screen_width = document.documentElement.clientWidth; var wRate = (main_width / screen_width).toFixed(2); var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'; var setRootFontsize = function () { document.documentElement.style.fontSize = (wRate * 8) + "px"; } if (document.addEventListener) { window.addEventListener(resizeEvt, setRootFontsize, false); document.addEventListener("DOMContentLoaded", setRootFontsize, false); } var screen_height = document.documentElement.clientHeight; $(".monitor_content").height(screen_height - 70); $(".monitor_content>div:first").show(); var content_height = screen_height - 115; $(".body_content>div").height(content_height); var one_height = Math.ceil(content_height * 0.25); $(".side_left>div:first").height(one_height); var device_area = one_height - 160 - 32; //计算设备统计内容垂直居中 $("#device_area").css("margin-top", Math.ceil(device_area / 2) + "px"); var two_height = Math.ceil(content_height * 0.24); $(".side_left>div").eq(1).height(two_height); //计算数据统计内容垂直居中 var margin_top = (two_height - 190) / 2 + 10; $(".total_field:first").css("margin-top", margin_top + "px"); var three_height = content_height - one_height - two_height - 40; $(".side_left>div:last").height(three_height); $(".place_area").height(three_height - 50); $(".header_bar>span").off("click").on("click", function () { var container = $(this); var flag = container.attr("flag"); var className = container.attr("class"); if (className != "control_active" && flag != "control_active") { DialogObject.Open($("#dialog_common")); var title = ""; if (flag == "control_center") title = "布控设置"; else if (flag == "accompany_analyze") { title = "伴随分析人像设置" } else if (flag == "collision_analysis") { title = "碰撞分析人像设置" } $("#dialog_common .layout_title").html(title); } }); //全局关闭窗口事件 $(".layout_close").off("click").on("click", function () { var container = $(this).parents(".layout_dialog"); container.hide(); if (container.css("z-index") == 10000) $(".clearn").hide(); }); //设备统计 mainObject.GetDeviceInfo(); }, //获取设备统计 GetDeviceInfo: function () { $.getJSON(Global.AccessUrl + "/api/screen/device", {}, function (returnData) { if (returnData["returncode"] == 200) { var data = returnData["data"], row = null, total = 0, online = 0, html = ""; for (var i = 0; i < data.length; i++) { row = data[i]; total = row["total"]; online = row["online"]; total = total == null ? 0 : parseInt(total); online = online == null ? 0 : parseInt(online); if (row["identifying"] == "device") { $("#device_number").html(online + "/" + total); if (online < total) { $(".scout_progress").css("width", (online / total * 100) + "%"); html = "
离线" + (total - online) + "台"; $("#offline_device").html(html); } } else if (row["identifying"] == "camera") { $("#camera_number").html(online + "/" + total); if (online < total) { $(".camera_progress").css("width", (online / total * 100) + "%"); html = "离线" + (total - online) + "台"; $("#offline_camera").html(html); } } else if (row["identifying"] == "door") { $("#door_number").html(online + "/" + total); if (online < total) { $(".door_progress").css("width", (online / total * 100) + "%"); html = "离线" + (total - online) + "台"; $("#offline_door").html(html); } } } } }); }, //获取监控人员列表 ShowPersonInfo: function (personid) { $(".body_center").hide(); $(".monitor_person_info").show(); }, AlwaysTimer: function () { var time = new Date(); var year = time.getFullYear(); var month = time.getMonth() + 1; var date = time.getDate(); var hour = time.getHours(); var minutes = time.getMinutes(); var seconds = time.getSeconds(); month = month < 10 ? "0" + month : month; date = date < 10 ? "0" + date : date; if (hour < 10) { hour = "0" + hour; } if (minutes < 10) { minutes = "0" + minutes; } if (seconds < 10) { seconds = "0" + seconds; } $(".week").html(year + "年" + month + "月" + date + "日 " + mainObject.GetWeek()); $(".hour_minute").html(hour + ":" + minutes + ":" + seconds); setTimeout('mainObject.AlwaysTimer()', 1000); }, GetWeek: function () { var time = new Date(); var day = time.getDay(); var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; return weeks[day]; } }