@@ -704,7 +889,7 @@
}
$.each(v.history_Sub_systems, function (i2, v2) {
- var firDis = (i == 0) ? "" : display;
+ var firDis = i == 0 ? "" : display;
subStrHtml += `
@@ -715,22 +900,20 @@
if (i2 == 0 && i == 0) {
firstMain = v.main_system_tag;
firstSub = v2.sub_system_tag;
- console.log(v.main_system_tag, v2.sub_system_tag)
+ console.log(v.main_system_tag, v2.sub_system_tag);
}
});
});
- subStrHtml += `
-
-
-
`
+ subStrHtml += `
+
+
+
`;
if (pageAct.mainStatus) {
- $('#alr_mainList').html(mainStrHtml);
- $('#alr_subList').html(subStrHtml);
- console.log($('input[data-type=main][id=' + firstMain + ']'))
- $('input[data-type=main][id=' + firstMain + ']').click();
- }
- else {
- $('#alr_mainList').html(subStrHtml);
+ $("#alr_mainList").html(mainStrHtml);
+ $("#alr_subList").html(subStrHtml);
+ $("input[data-type=main][id=" + firstMain + "]").click();
+ } else {
+ $("#alr_mainList").html(subStrHtml);
}
// $('input[data-type=sub][id=' + firstSub + ']').click();
}
@@ -739,31 +922,28 @@
function selAllSysVal(elem) {
pageAct.selAllSysSub = true;
- if ($(elem).html() == '全選類別') {
- $('#alr_mainList input').map(function (i, v) {
- if (!$(v).is(':checked')) {
+ if ($(elem).html() == "全選類別") {
+ $("#alr_mainList input").map(function (i, v) {
+ if (!$(v).is(":checked")) {
$(v).click();
}
});
- $('#alr_subList input').map(function (i, v) {
- if (!$(v).is(':checked')) {
+ $("#alr_subList input").map(function (i, v) {
+ if (!$(v).is(":checked")) {
$(v).click();
}
});
- $(elem).html('取消全選');
+ $(elem).html("取消全選");
- pageAct.SysType = 'all';
- }
- else {
- $('#alr_mainList input').map(function (i, v) {
- if ($(v).is(':checked'))
- $(v).click();
+ pageAct.SysType = "all";
+ } else {
+ $("#alr_mainList input").map(function (i, v) {
+ if ($(v).is(":checked")) $(v).click();
});
- $('#alr_subList input').map(function (i, v) {
- if ($(v).is(':checked'))
- $(v).click();
+ $("#alr_subList input").map(function (i, v) {
+ if ($(v).is(":checked")) $(v).click();
});
- $(elem).html('全選類別');
+ $(elem).html("全選類別");
pageAct.SysType = null;
}
@@ -777,53 +957,66 @@
let enddate = new Date(pageAct.alr_enddate + " 23:59:59").getTime();
let startdate = new Date(pageAct.alr_startdate + " 00:00:00").getTime();
- if (pageAct.SysType == "all") {
- getAllDeviceAlarmByBaja(startdate, enddate, pageAct.return, pageAct.confirm, callBackFromAllDeviceAlert);
- }
- else {
- let elem = $('input[type=checkbox][data-type=sub]:checked');
- elemIndex = 0;
- index = 0;
- if (elem && elem.length > 0) {
- elemIndex = elem.length;
- elem.each(function (i, v) {
- if (v?.id === "other") {
- console.log(v?.id)
- getOtherAlarmByBaja(startdate, enddate, pageAct.return, pageAct.confirm, stackData);
- }
- else {
- pageAct.selSysMain = $(v).parent().data('main');
- pageAct.selSysSub = $(v).prop('id');
- getAlarmByBaja(startdate, enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", stackData);
- }
- });
- }
- else {
- $('#alertTable').DataTable().clear().draw();
- $(loadEle).Loading("close");
- }
+ // if (pageAct.SysType == "all") {
+ // getAllDeviceAlarmByBaja(
+ // startdate,
+ // enddate,
+ // pageAct.return,
+ // pageAct.confirm,
+ // callBackFromAllDeviceAlert
+ // );
+ // } else {
+ let elem = $("input[type=checkbox][data-type=sub]:checked");
+ elemIndex = 0;
+ index = 0;
+ if (elem && elem.length > 0) {
+ elemIndex = elem.length;
+ elem.each(function (i, v) {
+ if (v?.id === "other") {
+ getOtherAlarmByBaja(
+ startdate,
+ enddate,
+ pageAct.return,
+ pageAct.confirm,
+ stackData
+ );
+ } else {
+ pageAct.selSysMain = $(v).parent().data("main");
+ pageAct.selSysSub = $(v).prop("id");
+ getAlarmByBaja(
+ startdate,
+ enddate,
+ pageAct.return,
+ pageAct.confirm,
+ pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass",
+ stackData
+ );
+ }
+ });
+ } else {
+ $("#alertTable").DataTable().clear().draw();
}
+ $(loadEle).Loading("close");
+ // }
}
function stackData(res) {
- res.data.forEach(v => {
+ res.data.forEach((v) => {
dataAlarm.push(v);
});
index++;
- if (elemIndex == index)
- callBackFromOneDeviceAlert(dataAlarm);
+ if (elemIndex == index) callBackFromOneDeviceAlert(dataAlarm);
}
function callBackFromAllDeviceAlert(res) {
AlertList(res.data);
if (historyTable != null) {
- let t = $('#alertTable').dataTable();
+ let t = $("#alertTable").dataTable();
t.fnClearTable();
- if (res.data.length > 0)
- t.fnAddData(res.data);
+ if (res.data.length > 0) t.fnAddData(res.data);
}
}
@@ -831,11 +1024,10 @@
AlertList(res);
if (historyTable != null) {
- let t = $('#alertTable').dataTable();
+ let t = $("#alertTable").dataTable();
t.fnClearTable();
- if (res.length > 0)
- t.fnAddData(res);
+ if (res.length > 0) t.fnAddData(res);
}
}
@@ -843,106 +1035,142 @@
let tag = "#alertTable";
let column_defs = [
- { "targets": [0], "width": "5%", "sortable": true },
- { "targets": [1], "width": "5%", "sortable": true },
- { "targets": [2], "width": "5%", "sortable": true },
- { "targets": [3], "width": "5%", "sortable": true },
- { "targets": [4], "width": "5%", "sortable": true },
- { "targets": [5], "width": "5%", "sortable": true },
- { "targets": [6], "width": "5%", "sortable": true },
- { "targets": [7], "width": "5%", "sortable": true },
- { "targets": [8], "width": "5%", "sortable": true },
+ { targets: [0], width: "5%", sortable: true },
+ { targets: [1], width: "5%", sortable: true },
+ { targets: [2], width: "5%", sortable: true },
+ { targets: [3], width: "5%", sortable: true },
+ { targets: [4], width: "5%", sortable: true },
+ { targets: [5], width: "5%", sortable: true },
+ { targets: [6], width: "5%", sortable: true },
+ { targets: [7], width: "5%", sortable: true },
+ { targets: [8], width: "5%", sortable: true },
];
let columns = [
{
- "title": "棟別-樓層",
- "data": "buildingFloorName_zh"
+ title: "棟別-樓層",
+ data: "buildingFloorName_zh",
},
{
- "title": "異常ID",
- "data": "uuid",
+ title: "異常ID",
+ data: "uuid",
render: (data) => {
- return data.$val ? data.$val.split("-")[0] : data.split("-")[0]
- }
+ return data.$val ? data.$val.split("-")[0] : data.split("-")[0];
+ },
},
{
- "title": "異常類別",
- "data": "alarmClass",
- "render": function (data) {
- return data.includes("_") ? data.split('_')[0] + "-" + data.split('_')[1] : data;
- }
+ title: "異常類別",
+ data: "alarmClass",
+ render: function (data) {
+ return data.includes("_")
+ ? data.split("_")[0] + "-" + data.split("_")[1]
+ : data;
+ },
},
{
- "title": "設備名稱",
- "data": "sourceName_zh",
- "render": function (data) {
- return allDevices.find(d => d.device_number === data)?.full_name || ""
- }
+ title: "設備名稱",
+ data: "sourceName_zh",
+ render: function (data) {
+ return (
+ allDevices.find((d) => d.device_number === data)?.full_name || ""
+ );
+ },
},
{
- "title": "設備編號",
- "data": "sourceTmp",
+ title: "設備編號",
+ data: "sourceTmp",
},
{
- "title": "發生時間",
- "data": "timestamp",
- "render": function (data) {
- return new Date(data).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }), displayDate(data, "datetime");
- }
+ title: "發生時間",
+ data: "timestamp",
+ render: function (data) {
+ return (
+ new Date(data).toLocaleString("zh-tw", {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ hour: "2-digit",
+ minute: "2-digit",
+ }),
+ displayDate(data, "datetime")
+ );
+ },
},
{
- "title": "異常原因",
- "data": "msgText",
- "render": function (data) {
- return data.split(':')[0];
- }
+ title: "異常原因",
+ data: "msgText",
+ render: function (data) {
+ return data.split(":")[0];
+ },
},
{
- "title": "Ack 確認",
- "data": "ackState",
- "render": function (data, type, row, meta) {
+ title: "Ack 確認",
+ data: "ackState",
+ render: function (data, type, row, meta) {
let confirm = data == "1" ? "待確認" : "確認";
let btnCol = data == "1" ? "warning" : "info";
- return data == "1" ? `
| ` :
- `
${new Date(row.ackedTime
- ).toLocaleString('zh-tw')} | ` /*`
| `*/;
- }
+ return data == "1"
+ ? `
| `
+ : `
${new Date(row.ackedTime).toLocaleString(
+ "zh-tw"
+ )} | ` /*`
| `*/;
+ },
},
{
- "title": "派工/維運單號",
- "data": "formId",
- "render": function (data, type, row, meta) {
-
+ title: "派工/維運單號",
+ data: "formId",
+ render: function (data, type, row, meta) {
return data != null
? `
${data} | `
- : `
+ 維修單 | `;
- }
- }
+ : `
+ 維修單 | `;
+ },
+ },
];
- historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
- $('#alertTable').DataTable().order([5, 'desc']);
+ historyTable = new YourTeam.JqDataTables.getTableByStatic(
+ tag,
+ data,
+ columns,
+ column_defs,
+ null,
+ null,
+ null,
+ null,
+ "tpi"
+ );
+ $("#alertTable").DataTable().order([5, "desc"]);
$(loadEle).Loading("close");
}
-
function AlertList(data) {
objSendData.Data = [];
$.each(data, function (i, v) {
- objSendData.Data.push({ uuid: v.uuid.$val || v.uuid })
+ objSendData.Data.push({ uuid: v.uuid.$val || v.uuid });
});
url = baseApiUrl + "/Alert/AlertList";
- ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
- if (rel.code == "0000") {
- $.each(rel.data, function (i, v) {
- let index = data.findIndex(x => (x.uuid.$val || x.uuid) === v.uuid);
- data[index].formId = v.formId;
- });
- refTable(data)
- }
- }, null, "POST").send();
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ function (rel) {
+ if (rel.code == "0000") {
+ $.each(rel.data, function (i, v) {
+ let index = data.findIndex(
+ (x) => (x.uuid.$val || x.uuid) === v.uuid
+ );
+ data[index].formId = v.formId;
+ });
+ refTable(data);
+ }
+ },
+ null,
+ "POST"
+ ).send();
}
function selDevice() {
@@ -956,46 +1184,56 @@
list_sub_system_tag: lsst,
};
objSendData.Data = sendData;
- ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
- if (!res || res.code != "0000" || !res.data) {
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ function (res) {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ strHtml = ``;
+ $("#inpFixDoCode").html();
+ $("#alr_inpFixDoCode_2").html();
+ $.each(res.data, (index, roleObj) => {
+ strHtml += `
`;
- } else {
- strHtml = ``;
- $("#inpFixDoCode").html();
- $("#alr_inpFixDoCode_2").html();
- $.each(res.data, (index, roleObj) => {
- strHtml += `
`;
-
- if (index == 0) {
- pageAct.sysMain = roleObj.device_system_tag;
- pageAct.sysSub = roleObj.device_name_tag;
- pageAct.floor = roleObj.device_floor_tag;
- pageAct.number = roleObj.device_number;
- }
- })
- $("#inpFixDoCode").html(strHtml);
- $("#alr_inpFixDoCode_2").html(strHtml);
- }
- }, null, "POST").send();
+ if (index == 0) {
+ pageAct.sysMain = roleObj.device_system_tag;
+ pageAct.sysSub = roleObj.device_name_tag;
+ pageAct.floor = roleObj.device_floor_tag;
+ pageAct.number = roleObj.device_number;
+ }
+ });
+ $("#inpFixDoCode").html(strHtml);
+ $("#alr_inpFixDoCode_2").html(strHtml);
+ }
+ },
+ null,
+ "POST"
+ ).send();
}
function selUser() {
let url = baseApiUrl + "/User/UserManagerList";
- ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
- if (!res || res.code != "0000" || !res.data) {
-
- } else {
- $("#inpWorPerId").html();
- $("#alr_inpWorPerId_2").html();
- strHtml = ``;
- strHtml += `
`;
- $.each(res.data, (index, roleObj) => {
- strHtml += `
`;
- })
- $("#inpWorPerId").html(strHtml);
- $("#alr_inpWorPerId_2").html(strHtml);
- }
- }, null, "POST").send();
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ function (res) {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ $("#inpWorPerId").html();
+ $("#alr_inpWorPerId_2").html();
+ strHtml = ``;
+ strHtml += `
`;
+ $.each(res.data, (index, roleObj) => {
+ strHtml += `
`;
+ });
+ $("#inpWorPerId").html(strHtml);
+ $("#alr_inpWorPerId_2").html(strHtml);
+ }
+ },
+ null,
+ "POST"
+ ).send();
}
function selOpeFir() {
@@ -1005,27 +1243,32 @@
objSendData.Data = { sub_system_tag: lsst };
//objSendData.Data = { sub_system_tag: $('input[data-type=sub]').map(function (i, v) { return $(v).prop('id'); }).toArray() };
// console.log(objSendData.Data)
- ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
- if (!res || res.code != "0000" || !res.data) {
-
- } else {
- $("#inpFixFirm").html();
- $("#alr_inpFixFirm_2").html();
- strHtml = ``;
- strHtml += `
`;
- $.each(res.data, (index, roleObj) => {
- strHtml += `
`;
- })
- $("#inpFixFirm").html(strHtml);
- $("#alr_inpFixFirm_2").html(strHtml);
- }
- }, null, "POST").send();
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ function (res) {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ $("#inpFixFirm").html();
+ $("#alr_inpFixFirm_2").html();
+ strHtml = ``;
+ strHtml += `
`;
+ $.each(res.data, (index, roleObj) => {
+ strHtml += `
`;
+ });
+ $("#inpFixFirm").html(strHtml);
+ $("#alr_inpFixFirm_2").html(strHtml);
+ }
+ },
+ null,
+ "POST"
+ ).send();
}
//上傳檔案 dropzone
function initDropzone() {
uploader = $("#alr_dropZone").dropzone({
- url: baseApiUrl + '/api/Upload',
+ url: baseApiUrl + "/api/Upload",
previewsContainer: false,
addRemoveLinks: false,
dictRemoveFile: `
delete`,
@@ -1035,141 +1278,269 @@
maxFilesize: 3,
filesizeBase: 1024,
maxFiles: 50,
- acceptedFiles: ".pdf, .docx, .doc, .xls, .xlsm, .xlsx, .ppt, .pptx, .gif, .png, .jpg, .jpeg",
- headers: { "Authorization": 'Bearer ' + cookies.get("JWT-Authorization") },
+ acceptedFiles:
+ ".pdf, .docx, .doc, .xls, .xlsm, .xlsx, .ppt, .pptx, .gif, .png, .jpg, .jpeg",
+ headers: { Authorization: "Bearer " + cookies.get("JWT-Authorization") },
accept: function (file, done) {
let fileHelper = new YourTeam.Utility.File();
tmpGuidArr = [];
if (/\.(jpe?g|png|gif)$/i.test(file.name)) {
- fileHelper.readAndPreviewImages(file, 'alr_forImage', 70, 70, '
', '');
+ fileHelper.readAndPreviewImages(
+ file,
+ "alr_forImage",
+ 70,
+ 70,
+ '
',
+ ''
+ );
- pageAct.imageFile.map(function (v, i) { tmpGuidArr.push(v.file.guid) });
- if (jQuery.inArray(file.guid, tmpGuidArr) == -1) { //not in array
+ pageAct.imageFile.map(function (v, i) {
+ tmpGuidArr.push(v.file.guid);
+ });
+ if (jQuery.inArray(file.guid, tmpGuidArr) == -1) {
+ //not in array
let fd = new FormData();
let f = file;
- fd.append('file', f);
- pageAct.imageFile.push({ "ori_file_name": f.name, "save_file_name": f.guid, "file": fd.get("file") });
+ fd.append("file", f);
+ pageAct.imageFile.push({
+ ori_file_name: f.name,
+ save_file_name: f.guid,
+ file: fd.get("file"),
+ });
}
- }
- else if (/\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(file.name)) {
- fileHelper.readAndPreviewFiles(file, 'alr_forFile', 70, 70, "
", "
");
+ } else if (
+ /\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(
+ file.name
+ )
+ ) {
+ fileHelper.readAndPreviewFiles(
+ file,
+ "alr_forFile",
+ 70,
+ 70,
+ "
",
+ "
"
+ );
- pageAct.imageFile.map(function (v, i) { tmpGuidArr.push(v.file.guid) });
- if (jQuery.inArray(file.guid, tmpGuidArr) == -1) { //not in array
+ pageAct.imageFile.map(function (v, i) {
+ tmpGuidArr.push(v.file.guid);
+ });
+ if (jQuery.inArray(file.guid, tmpGuidArr) == -1) {
+ //not in array
let fd = new FormData();
let f = file;
- fd.append('file', f);
- pageAct.imageFile.push({ "ori_file_name": f.name, "save_file_name": f.guid, "file": fd.get("file") });
+ fd.append("file", f);
+ pageAct.imageFile.push({
+ ori_file_name: f.name,
+ save_file_name: f.guid,
+ file: fd.get("file"),
+ });
}
}
- }
+ },
});
}
function getUser() {
- ytAjax = new YourTeam.Ajax(baseApiUrl + "/api/getUser", null, function (res) {
- if (!res || res.code != "0000" || !res.data) {
-
- } else {
- $(pageAct.work_type == '1' ? '#inpWorPerId' : '#inpWorPerId_2').val(res.data);
- }
- }, null, "POST").send();
+ ytAjax = new YourTeam.Ajax(
+ baseApiUrl + "/api/getUser",
+ null,
+ function (res) {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ $(pageAct.work_type == "1" ? "#inpWorPerId" : "#inpWorPerId_2").val(
+ res.data
+ );
+ }
+ },
+ null,
+ "POST"
+ ).send();
}
function chgAck(devUuid) {
- $.post(window.location.origin + '/obix/alarm/' + devUuid + '/ack', '
', null, "text");
+ $.post(
+ window.location.origin + "/obix/alarm/" + devUuid + "/ack",
+ '
',
+ null,
+ "text"
+ );
getData();
}
- onEvent('click', '#readOpeRecBtn', function () {
-
-
- $('#alr_ope_forImage').html('');
- $('#alr_ope_forFile').html('');
- $('#alr_ope_forImage_2').html('');
- $('#alr_ope_forFile_2').html('');
- $('#alr_inpStatus_2 [name=alr_inpSta_2]').prop("disabled", false);
+ onEvent("click", "#readOpeRecBtn", function () {
+ $("#alr_ope_forImage").html("");
+ $("#alr_ope_forFile").html("");
+ $("#alr_ope_forImage_2").html("");
+ $("#alr_ope_forFile_2").html("");
+ $("#alr_inpStatus_2 [name=alr_inpSta_2]").prop("disabled", false);
pageAct.imageFile = [];
- $('#alr_opeRecTitle').html("讀取維修");
+ $("#alr_opeRecTitle").html("讀取維修");
let url = baseApiUrl + "/operation/OpeRecRead";
objSendData.Data = { formId: $(this).data("formid") };
- ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
- if (!res || res.code != "0000" || !res.data) {
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ function (res) {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ pageAct.sysSub = res.data.device_system_category_layer3;
+ pageAct.number = res.data.fix_do_code;
+ pageAct.addSelSub = res.data.device_system_category_layer3;
+ selUser();
+ selDevice();
+ selOpeFir();
+ errCodeList();
+ $("#alr_inpNumber_2").val(res.data.formId);
+ $("#alr_inpWorTyp_2").val(res.data.work_type);
+ $("#alr_inpFixDo_2").val(res.data.fix_do);
+ $("#alr_inpFixDoCode_2").val(res.data.fix_do_code);
+ $("#alr_inpFixFirm_2").val(res.data.fix_firm);
+ $(
+ "#alr_inpStatus_2 [name=alr_inpSta_2][data-value=" +
+ res.data.status +
+ "]"
+ ).click();
+ $(
+ "#alr_inpStatus_2 [name=alr_inpSta_2][data-value=" +
+ (res.data.status > 0 ? 0 : 1) +
+ "]"
+ ).prop("disabled", true);
+ $("#alr_inpWorPerId_2").val(res.data.work_person_id);
+ $("#alr_inpStaTime_2").val(
+ displayDate(res.data.start_time, "date").replaceAll("/", "-")
+ );
+ $("#alr_inpNotice_2").val(
+ res.data.notice == null ? "" : res.data.notice
+ );
+ $("#alr_inpDescription_2").val(
+ res.data.description == null ? "" : res.data.description
+ );
- } else {
- pageAct.sysSub = res.data.device_system_category_layer3;
- pageAct.number = res.data.fix_do_code;
- pageAct.addSelSub = res.data.device_system_category_layer3;
- selUser();
- selDevice();
- selOpeFir();
- errCodeList();
- $('#alr_inpNumber_2').val(res.data.formId);
- $('#alr_inpWorTyp_2').val(res.data.work_type);
- $('#alr_inpFixDo_2').val(res.data.fix_do);
- $('#alr_inpFixDoCode_2').val(res.data.fix_do_code);
- $('#alr_inpFixFirm_2').val(res.data.fix_firm);
- $('#alr_inpStatus_2 [name=alr_inpSta_2][data-value=' + res.data.status + ']').click();
- $('#alr_inpStatus_2 [name=alr_inpSta_2][data-value=' + (res.data.status > 0 ? 0 : 1) + ']').prop("disabled", true);
- $('#alr_inpWorPerId_2').val(res.data.work_person_id);
- $('#alr_inpStaTime_2').val(displayDate(res.data.start_time, 'date').replaceAll('/', '-'));
- $('#alr_inpNotice_2').val(res.data.notice == null ? "" : res.data.notice);
- $('#alr_inpDescription_2').val(res.data.description == null ? "" : res.data.description);
+ ope_imgHtml = null;
+ $.each(res.data.lorf, function (i, v) {
+ let extName = v.ori_file_name.split(".")[1];
- ope_imgHtml = null;
- $.each(res.data.lorf, function (i, v) {
+ if (/\.(jpe?g|png|gif)$/i.test(v.ori_file_name)) {
+ ope_colI = creEle("i", null, null, null, ["fa fa-times"]);
+ ope_colBtn = creBtn(null, null, "btnDelImg", ["btn-dark m-1"]);
+ ope_colImg = creImg(
+ "img",
+ null,
+ null,
+ null,
+ null,
+ { filename: v.ori_file_name, savename: v.save_file_name },
+ {
+ style: "margin-left: 30px; margin-top: 10px",
+ height: "70px",
+ width: "70px",
+ src:
+ baseApiUrl +
+ "/upload/operation/" +
+ v.save_file_name +
+ "." +
+ extName,
+ }
+ );
+ ope_colA = creEle("a", null, null, null, null, null, {
+ href:
+ baseApiUrl +
+ "/upload/operation/" +
+ v.save_file_name +
+ "." +
+ extName,
+ download: v.ori_file_name,
+ target: "_blank",
+ });
+ ope_imgHtml = creEle(
+ "span",
+ null,
+ null,
+ null,
+ ["file-item m-1"],
+ { id: v.id },
+ null
+ );
- let extName = v.ori_file_name.split('.')[1];
+ ope_colA.append(ope_colImg);
+ ope_imgHtml.append(ope_colA);
+ ope_colBtn.append(ope_colI);
+ ope_imgHtml.append(ope_colBtn);
+ $("#alr_ope_forImage_2").append(
+ ope_imgHtml ? ope_imgHtml.outerHtml() : null
+ );
+ } else if (
+ /\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(
+ v.ori_file_name
+ )
+ ) {
+ icons = null;
+ if (extName == "xlsx" || extName == "xls")
+ icons = "fas fa-file-excel";
+ else if (extName == "pdf" || extName == "ods")
+ icons = "fas fa-file-pdf";
+ else if (extName == "doc" || extName == "docx")
+ icons = "fas fa-file-word";
+ else icons = "fas fa-file-alt";
- if (/\.(jpe?g|png|gif)$/i.test(v.ori_file_name)) {
+ ope_colI = creEle("i", null, null, null, ["fa fa-times"]);
+ ope_colBtn = creBtn(null, null, "btnDelImg", ["btn-dark m-1"]);
+ ope_colBtn.append(ope_colI);
- ope_colI = creEle("i", null, null, null, ["fa fa-times"]);
- ope_colBtn = creBtn(null, null, "btnDelImg", ["btn-dark m-1"]);
- ope_colImg = creImg("img", null, null, null, null, { filename: v.ori_file_name, savename: v.save_file_name }, { style: "margin-left: 30px; margin-top: 10px", height: "70px", width: "70px", src: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName });
- ope_colA = creEle("a", null, null, null, null, null, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, target: "_blank" });
- ope_imgHtml = creEle("span", null, null, null, ["file-item m-1"], { id: v.id }, null);
+ ope_colI = creEle("i", null, null, null, [icons + " fa-3x m-1"]);
+ ope_colA = creEle("a", v.ori_file_name, null, null, null, null, {
+ href:
+ baseApiUrl +
+ "/upload/operation/" +
+ v.save_file_name +
+ "." +
+ extName,
+ download: v.ori_file_name,
+ target: "_blank",
+ });
+ ope_imgHtml = creEle(
+ "div",
+ null,
+ null,
+ null,
+ ["file-item"],
+ { id: v.id },
+ null
+ );
- ope_colA.append(ope_colImg);
- ope_imgHtml.append(ope_colA);
- ope_colBtn.append(ope_colI);
- ope_imgHtml.append(ope_colBtn);
- $('#alr_ope_forImage_2').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
- }
- else if (/\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(v.ori_file_name)) {
- icons = null
- if (extName == "xlsx" || extName == "xls")
- icons = "fas fa-file-excel";
- else if (extName == "pdf" || extName == "ods")
- icons = "fas fa-file-pdf";
- else if (extName == "doc" || extName == "docx")
- icons = "fas fa-file-word";
- else
- icons = "fas fa-file-alt";
-
- ope_colI = creEle("i", null, null, null, ["fa fa-times"]);
- ope_colBtn = creBtn(null, null, "btnDelImg", ["btn-dark m-1"]);
- ope_colBtn.append(ope_colI);
-
- ope_colI = creEle("i", null, null, null, [icons + " fa-3x m-1"]);
- ope_colA = creEle("a", v.ori_file_name, null, null, null, null, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, target: "_blank" });
- ope_imgHtml = creEle("div", null, null, null, ["file-item"], { id: v.id }, null);
-
- ope_imgHtml.append(ope_colI);
- ope_imgHtml.append(ope_colA);
- ope_imgHtml.append(ope_colBtn);
- $('#alr_ope_forFile_2').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
- }
- });
- }
- }, null, "POST").send()
+ ope_imgHtml.append(ope_colI);
+ ope_imgHtml.append(ope_colA);
+ ope_imgHtml.append(ope_colBtn);
+ $("#alr_ope_forFile_2").append(
+ ope_imgHtml ? ope_imgHtml.outerHtml() : null
+ );
+ }
+ });
+ }
+ },
+ null,
+ "POST"
+ ).send();
});
function errCodeList() {
$(loadEle).Loading("start");
let _pathArr = pageAct.number.split("_"); //TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
- let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5];
+ let _devicePath =
+ _pathArr[0] +
+ "_" +
+ _pathArr[1] +
+ "_" +
+ _pathArr[2] +
+ "_" +
+ _pathArr[3] +
+ "_" +
+ _pathArr[4] +
+ "_" +
+ _pathArr[5];
getOneDeviceAlarmTop10ByBaja(_devicePath, callbackForErr);
$(loadEle).Loading("close");
}
@@ -1179,13 +1550,17 @@
strHtml = ``;
$.each(res.data, function (i, v) {
- msg = v.msgText != null ? ($.trim(v.msgText.toString()).length > 0 ? v.msgText.split(':')[0] : '') : '';
+ msg =
+ v.msgText != null
+ ? $.trim(v.msgText.toString()).length > 0
+ ? v.msgText.split(":")[0]
+ : ""
+ : "";
strHtml += `
`;
});
- if (res.count > 0)
- $('#alr_inpErrCode_2').html(strHtml);
+ if (res.count > 0) $("#alr_inpErrCode_2").html(strHtml);
$(loadEle).Loading("close");
}
-
\ No newline at end of file
+
diff --git a/Frontend/_dashboard.html b/Frontend/_dashboard.html
index fdbb03a..ef63b61 100644
--- a/Frontend/_dashboard.html
+++ b/Frontend/_dashboard.html
@@ -441,11 +441,11 @@
let devPath = tarElePath.split("/")[1]?.split("_").slice(0, 8).join("/");
let tempOrdPath = { devicePath: devPath };
let myBaja = new subscriptionElectricmeter();
-
+ const deviceTag = devPath.split("/")[devPath.split("/").length - 1]
myBaja.setSubscribeElectricmeterByBql(tempOrdPath);
- myBaja.setSubscribeElectricmeterCallBack(function (data) {
- if (data.point_name == "P") {
- let value = parseFloat(data.value).roundDecimal(2);
+ myBaja.setSubscribeElectricmeterCallBack(function (data) {
+ if (data.point_name === "P" && data.device_number === deviceTag) {
+ let value = parseFloat(data.value.replaceAll(",", "")).roundDecimal(2);
$("#insPower").text(value);
// $("#insPowerPer").text((value / 4).roundDecimal(2));
$("#insPowerPer").text((value / contractCapacity).roundDecimal(2));
diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js
index 64e1c26..7e2f95e 100644
--- a/Frontend/js/n4js/alarmbaja.js
+++ b/Frontend/js/n4js/alarmbaja.js
@@ -99,20 +99,32 @@ function getAlarmByBaja(
var _index = 0;
var _recoverState = isRecover ? "= 'normal'" : "= 'offnormal'";
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
- //console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")
+ // console.log('@@@@@@@@@',
+ // "local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmClass = '" +
+ // alarmClass +
+ // "' and timestamp.millis > " +
+ // startDate_millisecond +
+ // " and timestamp.millis < " +
+ // endDate_millisecond +
+ // " and sourceState " +
+ // _recoverState +
+ // " and ackState " +
+ // _ackState +
+ // " order by timestamp asc"
+ // );
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmClass = '" +
- alarmClass +
- "' and timestamp.millis > " +
- startDate_millisecond +
- " and timestamp.millis < " +
- endDate_millisecond +
- " and sourceState " +
- _recoverState +
- " and ackState " +
- _ackState +
- " order by timestamp asc"
+ alarmClass +
+ "' and timestamp.millis > " +
+ startDate_millisecond +
+ " and timestamp.millis < " +
+ endDate_millisecond +
+ " and sourceState " +
+ _recoverState +
+ " and ackState " +
+ _ackState +
+ " order by timestamp asc"
)
.get()
.then(function (table) {
@@ -121,25 +133,24 @@ function getAlarmByBaja(
const alarmDisplayName =
record.get("alarmData").get("sourceName").split(":")[1] ??
record.get("alarmData").get("sourceName").split(":")[0];
- //console.log(alarmDisplayName)
_sourceTmp = alarmDisplayName.split("_");
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
_sourceName = _sourceTmp.slice(0, 8).join("_");
_sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8];
- if (!_sourceTmp.includes("undefined")) {
- _ss.push({
- buildingFloorName_zh: _bfName,
- uuid: record.get("uuid"),
- timestamp: record.get("timestamp").$cEncStr,
- alarmClass: record.get("alarmClass"),
- sourceName_zh: _sourceName,
- sourceTmp: _sourceTmp,
- msgText: record.get("alarmData").get("msgText"),
- ackState: record.get("ackState"),
- normalTime: record.get("normalTime"),
- ackedTime: record.get("ackTime").$cEncStr,
- });
- }
+ // if (!_sourceTmp.includes("undefined")) {
+ _ss.push({
+ buildingFloorName_zh: _bfName,
+ uuid: record.get("uuid"),
+ timestamp: record.get("timestamp").$cEncStr,
+ alarmClass: record.get("alarmClass"),
+ sourceName_zh: _sourceName,
+ sourceTmp: _sourceTmp,
+ msgText: record.get("alarmData").get("msgText"),
+ ackState: record.get("ackState"),
+ normalTime: record.get("normalTime"),
+ ackedTime: record.get("ackTime").$cEncStr,
+ });
+ // }
_index++;
},
after: function () {
@@ -202,8 +213,8 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" +
- devicePath +
- "%' order by timestamp desc"
+ devicePath +
+ "%' order by timestamp desc"
)
.get()
.then(function (table) {
@@ -262,7 +273,6 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
})
.catch(() => {
$(loadEle).Loading("close");
-
});
});
}
@@ -305,8 +315,8 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" +
- systemPath +
- "%' order by timestamp desc"
+ systemPath +
+ "%' order by timestamp desc"
)
.get()
.then(function (table) {
@@ -360,10 +370,10 @@ function getOneSystemStateByBaja(systemPath, callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:" +
- port +
- "|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" +
- systemPath +
- "%' order by timestamp desc"
+ port +
+ "|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" +
+ systemPath +
+ "%' order by timestamp desc"
)
.get()
.then(function (table) {
@@ -420,8 +430,8 @@ function getAlarmCountByBaja(callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:" +
- port +
- "|alarm:|bql:select COUNT(*) where sourceState = 'offnormal'"
+ port +
+ "|alarm:|bql:select COUNT(*) where sourceState = 'offnormal'"
)
.get()
.then(function (table) {
@@ -468,8 +478,8 @@ function getRecoverCountByBaja(callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:" +
- port +
- "|alarm:|bql:select COUNT(*) where normalTime != null"
+ port +
+ "|alarm:|bql:select COUNT(*) where normalTime != null"
)
.get()
.then(function (table) {
@@ -515,8 +525,8 @@ function getCheckedAckedCountByBaja(callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:" +
- port +
- "|alarm:|bql:select COUNT(*) where ackState='acked'"
+ port +
+ "|alarm:|bql:select COUNT(*) where ackState='acked'"
)
.get()
.then(function (table) {
@@ -562,8 +572,8 @@ function getUnCheckedAckedCountByBaja(callback) {
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:" +
- port +
- "|alarm:|bql:select COUNT(*) where ackState='unacked'"
+ port +
+ "|alarm:|bql:select COUNT(*) where ackState='unacked'"
)
.get()
.then(function (table) {
@@ -593,8 +603,8 @@ function getSystemAlarmByBaja(callback) {
//baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where isAlarm").get()
baja.Ord.make(
"local:|foxs:" +
- port +
- "|alarm:|bql:select alarmClass where sourceState = 'offnormal'"
+ port +
+ "|alarm:|bql:select alarmClass where sourceState = 'offnormal'"
)
.get()
.then(function (table) {
@@ -709,8 +719,8 @@ function getOneDeviceAlarmByBaja(devicePath, callback) {
// console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");
baja.Ord.make(
"local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmData.sourceName like '%" +
- devicePath +
- "%' order by timestamp desc"
+ devicePath +
+ "%' order by timestamp desc"
)
.get()
.then(function (table) {
@@ -770,6 +780,18 @@ function getOtherAlarmByBaja(
console.log(
"告警2",
"local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " +
+ startUrl +
+ "timestamp.millis <= " +
+ endDate_millisecond +
+ " and sourceState " +
+ _recoverState +
+ " and ackState " +
+ _ackState +
+ " order by timestamp desc"
+ );
+ require(["baja!"], function (baja) {
+ baja.Ord.make(
+ "local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " +
startUrl +
"timestamp.millis <= " +
endDate_millisecond +
@@ -778,18 +800,6 @@ function getOtherAlarmByBaja(
" and ackState " +
_ackState +
" order by timestamp desc"
- );
- require(["baja!"], function (baja) {
- baja.Ord.make(
- "local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " +
- startUrl +
- "timestamp.millis <= " +
- endDate_millisecond +
- " and sourceState " +
- _recoverState +
- " and ackState " +
- _ackState +
- " order by timestamp desc"
)
.get()
.then(function (table) {
@@ -868,14 +878,14 @@ function getAllDeviceAlarmByBaja(
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " +
- startUrl +
- "timestamp.millis <= " +
- endDate_millisecond +
- " and sourceState " +
- _recoverState +
- " and ackState " +
- _ackState +
- " order by timestamp desc"
+ startUrl +
+ "timestamp.millis <= " +
+ endDate_millisecond +
+ " and sourceState " +
+ _recoverState +
+ " and ackState " +
+ _ackState +
+ " order by timestamp desc"
)
.get()
.then(function (table) {
@@ -951,14 +961,14 @@ function getDeviceAlarmCardByBaja(
require(["baja!"], function (baja) {
baja.Ord.make(
"local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " +
- startUrl +
- "timestamp.millis <= " +
- endDate_millisecond +
- " and sourceState " +
- _recoverState +
- " and ackState " +
- _ackState +
- " order by timestamp desc"
+ startUrl +
+ "timestamp.millis <= " +
+ endDate_millisecond +
+ " and sourceState " +
+ _recoverState +
+ " and ackState " +
+ _ackState +
+ " order by timestamp desc"
)
.get()
.then(function (table) {