home.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. var errorTable;
  2. var sites = {};
  3. $.ajaxSettings.async = false;
  4. var jqxhr = $.getJSON("/BIM-Monitor/assets/errorTable.json", function (json) {
  5. errorTable = json;
  6. });
  7. var C3Json = $.getJSON("/BIM-Monitor/assets/json/c3-monitorList.json", function (json) {
  8. sites["c3"] = json;
  9. });
  10. var R03Json = $.getJSON("/BIM-Monitor/assets/json/r03-monitorList.json", function (json) {
  11. sites["r03"] = json;
  12. });
  13. $.ajaxSettings.async = true;
  14. var lastNode;
  15. var errorArray = [];
  16. function GetCheckAllAJAXValue() {
  17. errorArray = [];
  18. var phase
  19. if(document.getElementById("phase") !== null){
  20. phase = document.getElementById("phase").value;
  21. }else{
  22. phase = 7;
  23. }
  24. for (i = 0; i < errorTable.length; i++) {
  25. var method = errorTable[i].method;
  26. var option = errorTable[i].table_name;
  27. var table_name = errorTable[i].table_name + "data";
  28. var warning1 = errorTable[i].warning1;
  29. var warning2 = errorTable[i].warning2;
  30. var warning_Count = errorTable[i].warning_Count;
  31. $.ajax({
  32. url: "/BIM-Monitor/script/php/checkValue2.php",
  33. data: {
  34. method: method,
  35. table_name: table_name,
  36. warning1: warning1,
  37. warning2: warning2,
  38. warning_Count: warning_Count,
  39. phase: phase
  40. },
  41. async: false,
  42. contentType: "application/json",
  43. dataType: "json"
  44. })
  45. .success(function (response) {
  46. var normal_count = response['normal_count'];
  47. var abnormal_count = response['abnormal_count'];
  48. var all_count = 0 + normal_count + abnormal_count;
  49. document.getElementById(option).innerHTML = "(<font color='#FF0000'>" + abnormal_count + "</font>/" + all_count + ")";
  50. errorArray.push(abnormal_count);
  51. })
  52. .error(function () {
  53. alert("錯誤統計未正常獲取");
  54. })
  55. .complete(function () {});
  56. }
  57. }
  58. $(document).ready(function() {
  59. $(".monitor").on('click', function() {
  60. let site = $(this).parent().parent().parent().attr("monitor");
  61. location.href = `./${site}/Index.php`;
  62. });
  63. })