[Frontend] 修改系統監控告警 ack 狀態 | 運維保養刪除異常編號欄位 | 告警新增維修單時自動抓取該設備
This commit is contained in:
parent
bca579903b
commit
a18152e23a
@ -119,6 +119,16 @@
|
||||
<form id="alr_opeRecForm">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpNumber">表單編號</label>
|
||||
<input type="text"
|
||||
id="inpNumber"
|
||||
name=""
|
||||
class="form-control"
|
||||
disabled />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpErrCode">異常編號</label>
|
||||
@ -160,11 +170,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFixDoCode">維修項目代碼(設備編號)</label>
|
||||
<select class="form-control"
|
||||
id="inpFixDoCode"
|
||||
name="inpFixDoCode">
|
||||
<div class="form-group position-relative">
|
||||
<label class="form-label" for="inpFixDoCode">維修項目代碼(設備名稱)</label>
|
||||
<select id="inpFixDoCode"
|
||||
name="inpFixDoCode"
|
||||
class="form-control position-absolute"
|
||||
style="z-index: 999; background-color: #3f4246"
|
||||
onfocus="this.size=15;"
|
||||
onblur="this.size=1;"
|
||||
onchange="this.size=1; this.blur();">
|
||||
<option value="">未選擇</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -349,7 +363,7 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="alr_inpFixDoCode_2">維修項目代碼(設備編號)</label>
|
||||
<label class="form-label" for="alr_inpFixDoCode_2">維修項目代碼(設備名稱)</label>
|
||||
<select class="form-control"
|
||||
id="alr_inpFixDoCode_2"
|
||||
name="alr_inpFixDoCode_2"
|
||||
@ -646,16 +660,20 @@
|
||||
let alr_table = $("#alertTable").DataTable();
|
||||
let alr_elem = $(this).parent().parent();
|
||||
let alr_tableData = alr_table.row(alr_elem).data();
|
||||
$("#inpFixDo").val(alr_tableData.msgText);
|
||||
$("#inpErrCode").html(
|
||||
`<option value = ${alr_tableData.uuid}>${alr_tableData.msgText}</option>`
|
||||
`<option value = ${alr_tableData.uuid.$val}>${alr_tableData.uuid.$val.split("-")[0]
|
||||
}</option>`
|
||||
);
|
||||
$("#inpStaTime").val(
|
||||
displayDate(new Date(Date.now()), "date").replaceAll("/", "-")
|
||||
);
|
||||
|
||||
let deviceNumber = null;
|
||||
let system = $(this).data("system");
|
||||
let system = $(this).data("realsystem");
|
||||
pageAct.addSelMain = system.split("-")[0];
|
||||
pageAct.addSelSub = system.split("-")[1];
|
||||
pageAct.floor = alr_tableData.buildingFloorName_zh.split("-")[1];
|
||||
|
||||
deviceNumber =
|
||||
pageAct.AreaTag +
|
||||
@ -672,8 +690,9 @@
|
||||
"_" +
|
||||
alr_tableData.sourceName_zh.toString().split("-")[1];
|
||||
|
||||
GetFormId();
|
||||
selUser();
|
||||
selDevice();
|
||||
selDevice(alr_tableData);
|
||||
selOpeFir();
|
||||
getUser();
|
||||
|
||||
@ -709,8 +728,6 @@
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpWorTyp: { required: true },
|
||||
inpFixDo: { required: true },
|
||||
inpFixDoCode: { required: true },
|
||||
inpFixFirm: { required: true },
|
||||
inpStatus: { required: true },
|
||||
inpWorPerId: { required: true },
|
||||
@ -729,19 +746,20 @@
|
||||
});
|
||||
|
||||
fd.append("error_code", $("#inpErrCode").val());
|
||||
fd.append("location", "台北" + $("#buiActDrop").text() + pageAct.floor);
|
||||
fd.append("location", "台北" + pageAct.floor);
|
||||
fd.append(
|
||||
"location_code",
|
||||
pageAct.AreaTag + pageAct.buiTag + pageAct.floor
|
||||
);
|
||||
|
||||
fd.append("device_system_category_layer2", pageAct.addSelMain);
|
||||
fd.append("device_system_category_layer3", pageAct.addSelSub);
|
||||
fd.append("work_type", parseInt($("#inpWorTyp").val()));
|
||||
fd.append("fix_do", $("#inpFixDo").val());
|
||||
fd.append("fix_do_code", $("#inpFixDoCode").val());
|
||||
fd.append("fix_firm", parseInt($("#inpFixFirm").val()));
|
||||
fd.append("status", parseInt($("#inpStatus").val()));
|
||||
fd.append("work_person_id", $("#inpWorPerId").val());
|
||||
fd.append("work_type", parseInt($("#inpWorTyp").val()) || null);
|
||||
fd.append("fix_do", $("#inpFixDo").val() || null);
|
||||
fd.append("fix_do_code", $("#inpFixDoCode").val() || null);
|
||||
fd.append("fix_firm", parseInt($("#inpFixFirm").val()) || null);
|
||||
fd.append("status", parseInt($("#inpStatus").val()) || null);
|
||||
fd.append("work_person_id", $("#inpWorPerId").val() || null);
|
||||
fd.append(
|
||||
"start_time",
|
||||
($("#inpStaTime").val() || null) == null
|
||||
@ -1050,9 +1068,6 @@
|
||||
{
|
||||
title: "棟別-樓層",
|
||||
data: "buildingFloorName_zh",
|
||||
render: (data) => {
|
||||
return data.replace("$3", "");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "異常ID",
|
||||
@ -1078,10 +1093,12 @@
|
||||
({ building_tag }) => building_tag === data.split("_")[1]
|
||||
)?.full_name;
|
||||
|
||||
return allDevices.find((d) => d.device_number === data)?.full_name ||
|
||||
return (
|
||||
allDevices.find((d) => d.device_number === data)?.full_name ||
|
||||
(row.alarmClass === "Sys_Con_AlarmClass"
|
||||
? `${building_name}_電錶邊緣控制器_${data.split("_")[7]}`
|
||||
: "");
|
||||
: "")
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -1132,6 +1149,9 @@
|
||||
"-" +
|
||||
row.alarmClass.split("_")[1]
|
||||
: row.alarmClass
|
||||
}' data-realsystem='${row.sourceName_zh.split("_")[2] +
|
||||
"-" +
|
||||
row.sourceName_zh.split("_")[3]
|
||||
}'>+ 維修單</a></td>`;
|
||||
},
|
||||
},
|
||||
@ -1178,7 +1198,7 @@
|
||||
).send();
|
||||
}
|
||||
|
||||
function selDevice() {
|
||||
function selDevice(alr_tableData = null) {
|
||||
let url = baseApiUrl + "/operation/DevList";
|
||||
let lsst = [];
|
||||
lsst.push(pageAct.addSelSub);
|
||||
@ -1195,10 +1215,17 @@
|
||||
function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
} else {
|
||||
strHtml = ``;
|
||||
$("#inpFixDoCode").html();
|
||||
$("#alr_inpFixDoCode_2").html();
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
|
||||
let strHtml = ""
|
||||
|
||||
if (alr_tableData) {
|
||||
const currentDevice = res.data.find(({ device_number }) => device_number === alr_tableData.sourceName_zh);
|
||||
strHtml += `<option value='${currentDevice.sourceName_zh}' data-floor=${currentDevice.device_floor_tag} data-main=${currentDevice.device_system_tag} data-sub=${currentDevice.device_name_tag} hidden>${currentDevice.device_name}</option>`;
|
||||
}
|
||||
|
||||
$.each(res.data.filter(({ device_number }) => device_number !== alr_tableData?.sourceName_zh), (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.device_number}' data-floor=${roleObj.device_floor_tag} data-main=${roleObj.device_system_tag} data-sub=${roleObj.device_name_tag} hidden>${roleObj.device_name}</option>`;
|
||||
|
||||
if (index == 0) {
|
||||
@ -1210,6 +1237,7 @@
|
||||
});
|
||||
$("#inpFixDoCode").html(strHtml);
|
||||
$("#alr_inpFixDoCode_2").html(strHtml);
|
||||
|
||||
}
|
||||
},
|
||||
null,
|
||||
@ -1568,4 +1596,21 @@
|
||||
|
||||
$(loadEle).Loading("close");
|
||||
}
|
||||
|
||||
function GetFormId() {
|
||||
let url = baseApiUrl + "/operation/GetFormId";
|
||||
|
||||
ytAjax = new YourTeam.Ajax(
|
||||
url,
|
||||
objSendData,
|
||||
function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
} else {
|
||||
$("#inpNumber").val(res.data);
|
||||
}
|
||||
},
|
||||
null,
|
||||
"POST"
|
||||
).send();
|
||||
}
|
||||
</script>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1629,7 +1629,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
title: "發生/完成時間",
|
||||
data: "finishTime",
|
||||
render: function (data, type, row) {
|
||||
return row.createdAt + "<br>" + data;
|
||||
return row.createdAt + "<br>" + (data.includes("0001")? "未完工": data);
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -1758,7 +1758,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
|
||||
// Card - 異常紀錄 Table
|
||||
function callbackForErr(result) {
|
||||
// console.log("@@@",result)
|
||||
if (errRecTable) {
|
||||
errRecTable.destroy();
|
||||
}
|
||||
@ -1787,8 +1786,8 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
data: "ackState",
|
||||
},
|
||||
{
|
||||
title: "發生/完成時間",
|
||||
data: "normalTime",
|
||||
title: "發生時間",
|
||||
data: "timestamp",
|
||||
// "render": function (data, type, row) {
|
||||
// return row.timestamp + "<br>" + data;
|
||||
// },
|
||||
|
@ -212,7 +212,7 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||
//{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]}
|
||||
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 '%" +
|
||||
"local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, ackTime, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" +
|
||||
devicePath +
|
||||
"%' order by timestamp desc"
|
||||
)
|
||||
@ -237,8 +237,8 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||
// _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString();
|
||||
|
||||
//var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString();
|
||||
var _normalTime = new Date(
|
||||
record.get("normalTime").$cEncStr
|
||||
var _ackTime = new Date(
|
||||
record.get("ackTime").$cEncStr
|
||||
).toLocaleString("zh-tw", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
@ -248,9 +248,19 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||
});
|
||||
// _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString();
|
||||
|
||||
var _normalTime = new Date(
|
||||
record.get("normalTime").$cEncStr
|
||||
).toLocaleString("zh-tw", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
|
||||
var _msgText = record.get("alarmData").get("msgText"); // == 1 ? _occurrenceTime : "未確認";
|
||||
var _ackText =
|
||||
record.get("ackState") == 1 ? _occurrenceTime : "未確認";
|
||||
record.get("ackState") == 0 ? _ackTime : "未確認";
|
||||
_ss.push({
|
||||
uuid: _resultUuid[0],
|
||||
msgText: _msgText,
|
||||
|
Loading…
Reference in New Issue
Block a user