123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- 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 = "<div class='offline_warning'></div><span class='offline_warning_text'>离线" + (total - online) + "台</span>";
- $("#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 = "<div class='offline_warning'></div><span class='offline_warning_text'>离线" + (total - online) + "台</span>";
- $("#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 = "<div class='offline_warning'></div><span class='offline_warning_text'>离线" + (total - online) + "台</span>";
- $("#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];
- }
- }
|