[Frontend] 修改首頁系統異常閃爍條件(跟隨棟別) | 異常維修名稱欄位 undefined 修正

This commit is contained in:
Celeste 2023-10-13 11:38:16 +08:00
parent c2bb9cb199
commit fa81c4df0f
4 changed files with 6202 additions and 6179 deletions

View File

@ -692,7 +692,9 @@
GetFormId();
selUser();
selDevice(alr_tableData);
selDevice({
sourceName_zh: $(this).data("devicenumber"),
});
selOpeFir();
getUser();
@ -1124,7 +1126,9 @@
let btnCol = data == "1" ? "warning" : "info";
return data == "1"
? `<td><button onclick="chgAck('${row.uuid}')" class="btn btn-${btnCol}">${confirm}</button></td>`
: `<td><span>${displayDate(row.ackedTime)}</span></td>` /*`<td><button class="btn btn-${btnCol}">${confirm}</button></td>`*/;
: `<td><span>${displayDate(
row.ackedTime
)}</span></td>` /*`<td><button class="btn btn-${btnCol}">${confirm}</button></td>`*/;
},
},
{
@ -1132,7 +1136,7 @@
data: "formId",
render: function (data, type, row, meta) {
return data != null
? `<td><a href="#" id="readOpeRecBtn" data-toggle="modal" data-target="#alr_opeRecModal_2" data-formid="${data}">${data}</a></td>`
? `<td><a href="#" id="readOpeRecBtn" data-toggle="modal" data-target="#alr_opeRecModal_2" data-formid="${data}" data-devicenumber="${row.sourceName_zh}">${data}</a></td>`
: `<td><a href="#" id="alr_recModal" class="btn btn-info" data-toggle="modal" data-target="#alr_opeRecModal" data-system='${row.alarmClass.includes("_")
? row.alarmClass.split("_")[0] +
"-" +
@ -1141,7 +1145,7 @@
}' data-realsystem='${row.sourceName_zh.split("_")[2] +
"-" +
row.sourceName_zh.split("_")[3]
}'>+ 維修單</a></td>`;
}' data-devicenumber="${row.sourceName_zh}">+ 維修單</a></td>`;
},
},
];
@ -1207,14 +1211,22 @@
$("#inpFixDoCode").html();
$("#alr_inpFixDoCode_2").html();
let strHtml = ""
let strHtml = "";
console.log("@alr_tableData", alr_tableData);
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>`;
const currentDevice = res.data.find(
({ device_number }) =>
device_number === alr_tableData.sourceName_zh
);
strHtml += `<option value='${currentDevice.device_number}' 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) => {
$.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) {
@ -1223,10 +1235,10 @@
pageAct.floor = roleObj.device_floor_tag;
pageAct.number = roleObj.device_number;
}
});
}
);
$("#inpFixDoCode").html(strHtml);
$("#alr_inpFixDoCode_2").html(strHtml);
}
},
null,
@ -1408,11 +1420,15 @@
function (res) {
if (!res || res.code != "0000" || !res.data) {
} else {
const deviceNumber = $(this).data("devicenumber");
console.log("@", $(this), deviceNumber);
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();
selDevice({
sourceName_zh: deviceNumber,
});
selOpeFir();
errCodeList();
$("#alr_inpNumber_2").val(res.data.formId);

View File

@ -268,11 +268,15 @@
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="inpErrCode_2">異常編號</label>
<select class="form-control"
<!--<select class="form-control"
id="inpErrCode_2"
name="inpErrCode_2">
<option value="">未選擇</option>
</select>
</select>-->
<input type="text"
id="inpErrCode_2"
name="inpErrCode_2"
class="form-control" />
</div>
</div>
<div class="col-md-6">
@ -875,9 +879,9 @@
{ targets: [5], width: "3%", sortable: true },
{ targets: [6], width: "5%", sortable: true },
{ targets: [7], width: "6%", sortable: true },
{ targets: [8], width: "15%", sortable: false },
{ targets: [8], width: "13%", sortable: false },
{ targets: [9], width: "6%", sortable: false },
{ targets: [10], width: "8%", sortable: true },
{ targets: [10], width: "10%", sortable: true },
{ targets: [11], width: "8%", sortable: false },
];
@ -901,18 +905,22 @@
{
title: "表單號",
data: "formId",
className: "text-nowrap",
},
{
title: "設備名稱",
data: "device_name",
className: "text-nowrap",
},
{
title: "狀態",
data: "status_name",
className: "text-nowrap",
},
{
title: "處理人員",
data: "user_full_name",
className: "text-nowrap",
},
{
title: "預計施工時間",
@ -1014,6 +1022,7 @@
{
title: "完成時間",
data: "finish_time",
className: "text-nowrap",
render: function (data) {
return displayDate(data, "datetime");
},
@ -1057,11 +1066,11 @@
{ targets: [0], width: "2%", sortable: true },
{ targets: [1], width: "6%", sortable: true },
//{ targets: [2], width: "6%", sortable: true },
{ targets: [2], width: "6%", sortable: true },
{ targets: [3], width: "8%", sortable: true },
{ targets: [4], width: "5%", sortable: true },
{ targets: [2], width: "7%", sortable: true },
{ targets: [3], width: "10%", sortable: true },
{ targets: [4], width: "8%", sortable: true },
{ targets: [5], width: "6%", sortable: true },
{ targets: [6], width: "13%", sortable: false },
{ targets: [6], width: "10%", sortable: false },
{ targets: [7], width: "6%", sortable: false },
{ targets: [8], width: "8%", sortable: false },
{ targets: [9], width: "8%", sortable: true },
@ -1084,10 +1093,12 @@
{
title: "表單號",
data: "formId",
className: "text-nowrap",
},
{
title: "設備名稱",
data: "device_name",
className: "text-nowrap",
},
{
title: "狀態",
@ -1197,6 +1208,7 @@
{
title: "完成時間",
data: "finish_time",
className: "text-nowrap",
render: function (data) {
return displayDate(data, "datetime");
},
@ -2174,11 +2186,12 @@
: "";
strHtml += `<option value=${v.uuid}>${v.uuid.split("-")[0]}</option>`;
});
if (res.count > 0)
$(pageAct.work_type == "1" ? "#inpErrCode" : "#inpErrCode_2").html(
strHtml
);
else $(pageAct.work_type == "1" ? "#inpErrCode" : "#inpErrCode_2").html("");
//if (res.count > 0)
// $(pageAct.work_type == "1" ? "#inpErrCode" : "#inpErrCode_2").html(
// strHtml
// );
//else
$(pageAct.work_type == "1" ? "#inpErrCode" : "#inpErrCode_2").html("");
$(loadEle).Loading("close");
}

View File

@ -1638,10 +1638,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
return (
displayDate(row.createdAt) +
"<br>" +
(data.includes("0001")
? "未完工"
: displayDate(data)
)
(data.includes("0001") ? "未完工" : displayDate(data))
);
},
},
@ -1802,7 +1799,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
data: "ackState",
className: "text-nowrap",
render: function (data, type, row) {
return data === 1
return data.$ordinal === 1
? "未確認"
: displayDate(row.ackedTime);
},
@ -2359,6 +2356,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
let titleHtml = `異常通知`;
let notices = [];
// 遍歷每個告警資料
if (datas.length === 0) {
$("#noticeBlock").innerHTML = "";
} else {
$.each(datas ?? [], (idx, data) => {
if (noticeOptArr.findIndex((x) => x.id == data.uuid) == -1) {
// 針對該告警對象的設備,從 allDevices 找出設備名稱
@ -2368,8 +2368,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
)?.full_name;
datas[idx].full_name =
allDevices.filter((x) => x.device_number == data.devicePath)[0]
?.full_name ||
allDevices.filter(
(x) => x.device_number == data.devicePath
)[0]?.full_name ||
(data.alarmClass === "Sys_Con_AlarmClass"
? `${building_name}_電錶邊緣控制器_${data.split("_")[7]}`
: "");
@ -2415,9 +2416,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
"add_many",
notices.oSort("id").reverse()
);
} else {
$("#noticeBlock").innerHTML = "";
$("#noticeBlock").css({ display: "none", opacity: "0" });
}
}
});
}

View File

@ -241,12 +241,11 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
)
var _msgText = record.get("alarmData").get("msgText"); // == 1 ? _occurrenceTime : "未確認";
var _ackText =
record.get("ackState")
_ss.push({
uuid: _resultUuid[0],
msgText: _msgText,
ackState: _ackText,
ackState: record.get("ackState"),
timestamp: _occurrenceTime,
normalTime: _normalTime,
ackedTime: _ackTime
@ -592,13 +591,9 @@ function getSystemAlarmByBaja(callback) {
var _index = 0;
require(["baja!"], function (baja) {
// console.log("local:|foxs:"+ port +"|alarm:|bql:select alarmClass where isAlarm")
//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'"
)
/* console.log(`local:|foxs:${port}|alarm:|bql:select alarmClass where sourceState='offnormal' and alarmData.sourceName like '%${pageAct.AreaTag}_${pageAct.buiTag}%'`)*/
baja.Ord.make(`local:|foxs:${port}|alarm:|bql:select alarmClass where sourceState='offnormal' and alarmData.sourceName like '%${pageAct.AreaTag}_${pageAct.buiTag}%'`)
.get()
.then(function (table) {
return table.cursor({