var errorTable;
var sites = {};
$.ajaxSettings.async = false;
var jqxhr = $.getJSON("/BIM-Monitor/assets/errorTable.json", function (json) {
errorTable = json;
});
var C3Json = $.getJSON("/BIM-Monitor/assets/json/c3-monitorList.json", function (json) {
sites["c3"] = json;
});
var R03Json = $.getJSON("/BIM-Monitor/assets/json/r03-monitorList.json", function (json) {
sites["r03"] = json;
});
$.ajaxSettings.async = true;
var lastNode;
var errorArray = [];
function GetCheckAllAJAXValue() {
for (i = 0; i < sites["r03"].length; i++) {
var option = sites["r03"][i].code;
$.ajax({
url: "/BIM-Monitor/script/php/get_abnormal.php",
data: {
type: option
},
async: false,
contentType: "application/json",
dataType: "json"
})
.success(function (response) {
var normal_count = response['normal_count'];
var abnormal_count = response['abnormal_count'];
var all_count = 0 + normal_count + abnormal_count;
$(`.${option}`).html("(" + abnormal_count + "/" + all_count + ")");
})
.error(function () {
console.log("錯誤統計未正常獲取");
})
.complete(function () {});
}
errorArray = [];
var phase
if (document.getElementById("phase") !== null) {
phase = document.getElementById("phase").value;
} else {
phase = 7;
}
for (i = 0; i < errorTable.length; i++) {
var method = errorTable[i].method;
var option = errorTable[i].table_name;
var table_name = errorTable[i].table_name + "data";
var warning1 = errorTable[i].warning1;
var warning2 = errorTable[i].warning2;
var warning_Count = errorTable[i].warning_Count;
$.ajax({
url: "/BIM-Monitor/script/php/checkValue2.php",
data: {
method: method,
table_name: table_name,
warning1: warning1,
warning2: warning2,
warning_Count: warning_Count,
phase: phase
},
async: false,
contentType: "application/json",
dataType: "json"
})
.success(function (response) {
var normal_count = response['normal_count'];
var abnormal_count = response['abnormal_count'];
var all_count = 0 + normal_count + abnormal_count;
document.getElementById(option).innerHTML = "(" + abnormal_count + "/" + all_count + ")";
errorArray.push(abnormal_count);
})
.error(function () {
alert("錯誤統計未正常獲取");
})
.complete(function () {});
}
}
$(document).ready(function () {
$(".monitor").on('click', function () {
let site = $(this).parent().parent().parent().attr("monitor");
location.href = `./${site}/Index.php`;
});
})