1351 lines
62 KiB
Plaintext
1351 lines
62 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="AlertsManagement.aspx.cs" Inherits="Maintenance_AlertsManagement" %>
|
||
|
||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
|
||
<style type="text/css">
|
||
.selectinput {
|
||
width: 150px;
|
||
margin-right: 10px;
|
||
}
|
||
|
||
.dialog-content table {
|
||
border-collapse: collapse;
|
||
width: 100%;
|
||
}
|
||
|
||
.dialog-content table td.label {
|
||
width: 150px;
|
||
text-align: right;
|
||
padding-right: 10px;
|
||
line-height: 24px;
|
||
height: 24px;
|
||
vertical-align: top;
|
||
}
|
||
|
||
.dialog-content table td input,
|
||
.dialog-content table td textarea {
|
||
border: 1px solid #a9a9a9;
|
||
width: 400px;
|
||
height: 18px;
|
||
padding: 1px;
|
||
}
|
||
|
||
.dialog-content table td select {
|
||
width: 403px;
|
||
}
|
||
|
||
.dialog-content table td input[type="checkbox"] {
|
||
border: none;
|
||
}
|
||
|
||
|
||
#dialogdatatb td {
|
||
padding-top: 5px;
|
||
}
|
||
|
||
.a {
|
||
text-decoration: none;
|
||
color: #2140fb;
|
||
}
|
||
|
||
.main_table tbody tr.no-hover:hover {
|
||
background: inherit;
|
||
}
|
||
|
||
.iconplus:before {
|
||
font-family: 'FontAwesome';
|
||
content: '\f067';
|
||
font-size: 10px;
|
||
}
|
||
|
||
.iconminus:before {
|
||
font-family: 'FontAwesome';
|
||
content: '\f068';
|
||
/*font-size: 10px;*/
|
||
}
|
||
|
||
.div_filter .dropdown {
|
||
width: 100px;
|
||
}
|
||
|
||
.assettr {
|
||
background: #f1f4f8;
|
||
}
|
||
|
||
.assettr:hover {
|
||
background: #e1e1e1;
|
||
}
|
||
|
||
.alerttr {
|
||
background: #e1e4e8;
|
||
}
|
||
|
||
.alerttr:hover {
|
||
background: #e1e1e1;
|
||
}
|
||
|
||
.tabheader {
|
||
padding-top: 2px;
|
||
padding-bottom: 2px;
|
||
padding-left: 5px;
|
||
padding-right: 5px;
|
||
border: 1px solid #bbb;
|
||
z-index: 10;
|
||
background-color: #ddd;
|
||
}
|
||
|
||
.tabheader:hover {
|
||
cursor: pointer;
|
||
}
|
||
|
||
.tabheaderselected {
|
||
padding-top: 2px;
|
||
padding-bottom: 2px;
|
||
padding-left: 5px;
|
||
padding-right: 5px;
|
||
border: 1px solid #bbb;
|
||
border-bottom: 0;
|
||
z-index: 10;
|
||
background-color: white;
|
||
}
|
||
|
||
.tabheaderselected:hover {
|
||
cursor: pointer;
|
||
}
|
||
|
||
.autoacknowledge:before {
|
||
font-family: CalciteWebCoreIcons, FontAwesome;
|
||
content: '\e670';
|
||
}
|
||
|
||
.export:before {
|
||
font-family: CalciteWebCoreIcons, FontAwesome;
|
||
content: '\f56e';
|
||
}
|
||
|
||
#div_autoacknowledgelist input[type="checkbox"] {
|
||
width: unset;
|
||
}
|
||
</style>
|
||
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>" type="text/javascript"></script>
|
||
<script src="<%=GetFileUrlWithVersion("js/inputdatactr.js")%>" type="text/javascript"></script>
|
||
<script type="text/javascript">
|
||
var CanEditWorkOrder = <%=CanEditWorkOrder?"true":"false"%>;
|
||
var allmachinealertdata;
|
||
var allalertdata;
|
||
var allAcknowledgedalertdata;
|
||
|
||
var lastClickCheckbox = undefined;
|
||
var selectedMachineID = undefined;//已选择的MachineID
|
||
var selectedWorkOrderIDs = undefined;
|
||
var selectedAlerts = [];//已选择的AlertID
|
||
var selectedAlertData = [];//已选择的Alert
|
||
var selectedAssetGroups = [];
|
||
var alerttypeparam;
|
||
var assetgroupparam;
|
||
var alertstatusparam;
|
||
var jobsitesparam;
|
||
var isalertview = true;
|
||
var isacknowledgingalerts = false;
|
||
|
||
var tabIndex = 0;
|
||
var assetid = "<%=AssetID %>";
|
||
|
||
function alertrequest(method, param, callback, error) {
|
||
_network.request("Maintenance/AlertsManagement.aspx", -1, method, param, callback, error || function (e) {
|
||
console.log(e);
|
||
showmaskbg(false, true);
|
||
showAlert(GetTextByKey('P_AM_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_AM_QUERY', 'Query'));
|
||
});
|
||
}
|
||
|
||
function worequest(method, param, callback, error) {
|
||
_network.request("Maintenance/WorkOrderMaintenance.aspx", -1, method, param, callback, error || function (e) {
|
||
console.log(e);
|
||
showmaskbg(false, true);
|
||
showAlert(GetTextByKey('P_AM_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_AM_QUERY', 'Query'));
|
||
});
|
||
}
|
||
|
||
function GetAlerts() {
|
||
showloading(true);
|
||
$('#chk_all_ackalert').prop('checked', false);
|
||
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||
//var showCompleted = $('#chkShowCompleted').prop("checked") ? 1 : 0;
|
||
var beginDate = $('#txtbegindate').val();
|
||
var endDate = $('#txtenddate').val();
|
||
var alerttypes = [];
|
||
var assetgroups = [];
|
||
var alertstatus = [];
|
||
var jobsites = [];
|
||
if (alerttypeparam)
|
||
alerttypes = alerttypeparam.selectedvalue;
|
||
if (assetgroupparam)
|
||
assetgroups = assetgroupparam.selectedvalue;
|
||
if (alertstatusparam)
|
||
alertstatus = alertstatusparam.selectedvalue;
|
||
if (jobsitesparam)
|
||
jobsites = jobsitesparam.selectedvalue;
|
||
var item = {
|
||
AssetID: assetid == "" ? -1 : eval(assetid),
|
||
SearchText: searchtxt,
|
||
AlertStatus: alertstatus,
|
||
AssetGroups: assetgroups,
|
||
AlertTypes: alerttypes,
|
||
JobSites: jobsites,
|
||
BeginDate: beginDate,
|
||
EndDate: endDate,
|
||
IncludeunCompleted: $('#chk_includeuncompleted').prop("checked"),
|
||
}
|
||
|
||
if (tabIndex == 0) {
|
||
$('#alertviewlist').data("dataloaded", true);
|
||
alertrequest("GETALERTS", JSON.stringify(item), function (data) {
|
||
showloading(false);
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
if (data && data.length > 0)
|
||
allalertdata = data;
|
||
else
|
||
allalertdata = [];
|
||
|
||
showAlerts(allalertdata);
|
||
}, function (err) {
|
||
showloading(false);
|
||
});
|
||
}
|
||
else if (tabIndex == 1) {
|
||
$('#machineviewlist').data("dataloaded", true);
|
||
alertrequest("GETMACHINEALERTS", JSON.stringify(item), function (data) {
|
||
showloading(false);
|
||
$('#tbody_alerts').empty();
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
if (data && data.length > 0)
|
||
allmachinealertdata = data;
|
||
else
|
||
allmachinealertdata = [];
|
||
|
||
sortTableData($('#tbRecordList'), allmachinealertdata);
|
||
showMachineAlerts(allmachinealertdata);
|
||
}, function (err) {
|
||
console.log(err);
|
||
showloading(false);
|
||
});
|
||
}
|
||
else {
|
||
$('#acknowledgedalertslist').data("dataloaded", true);
|
||
alertrequest("GetAcknowledgedAlerts", JSON.stringify(item), function (data) {
|
||
showloading(false);
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
if (data && data.length > 0)
|
||
allAcknowledgedalertdata = data;
|
||
else
|
||
allAcknowledgedalertdata = [];
|
||
|
||
showAcknowledgedAlerts(allAcknowledgedalertdata);
|
||
}, function (err) {
|
||
showloading(false);
|
||
});
|
||
}
|
||
}
|
||
|
||
function showAlerts(data) {
|
||
var rows = [];
|
||
for (var i = 0; i < data.length; i++) {
|
||
var r = data[i];
|
||
r.Enabled = true;
|
||
r.Selected = false;
|
||
for (var j in r) {
|
||
if (j === "AlertLocalTime") {
|
||
r[j] = { DisplayValue: r["AlertLocalTimeStr"], Value: r[j] };
|
||
}
|
||
if (j === "WorkOrderID" && r[j] <= 0) {
|
||
r[j] = { DisplayValue: "", Value: r[j] };
|
||
}
|
||
if (j === "AlertType") {
|
||
r[j] = { DisplayValue: ($.trim(r[j]) == "" ? GetTextByKey("P_XXXXX", '(Blank)') : r[j]), Value: $.trim(r[j]) };
|
||
}
|
||
}
|
||
var fr = { Values: r };
|
||
rows.push(fr);
|
||
}
|
||
|
||
alertview_dt.SelectedCount = 0;
|
||
alertview_dt.setData(rows);
|
||
}
|
||
|
||
function CheckAcknowledgeAlert(e) {
|
||
selectedWorkOrderIDs = "";
|
||
lastClickCheckbox = e;
|
||
selectedAlerts = [];
|
||
selectedAlertData = [];
|
||
var chk = $(e);
|
||
var name = chk.attr("name");
|
||
var index = chk.attr("index");
|
||
if (name === "ack" + index) {
|
||
var tr = chk.parents('tr').next();
|
||
var ma = chk.data("alert");
|
||
var chksub = tr.find("[name='acksub" + index + "']");
|
||
if (chksub.length === 0) {//Sub没有展开
|
||
if (ma && ma.Alerts) {
|
||
var selectedWOIDS = [];
|
||
for (var i in ma.Alerts) {
|
||
var alert = ma.Alerts[i];
|
||
if (alert.WorkOrderID <= 0 && !alert.Completed) {
|
||
selectedAlerts.push(alert.AlertID);
|
||
if (alert.RepeatedAlerts) {
|
||
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
|
||
selectedAlerts.push(alert.RepeatedAlerts[j]);
|
||
}
|
||
}
|
||
selectedAlertData.push(alert);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
chksub.prop("checked", e.checked).each(function () {
|
||
var tempchk = $(this);
|
||
var alert = tempchk.data("alert");
|
||
if (alert && tempchk.prop("checked")) {
|
||
selectedAlerts.push(alert.AlertID);
|
||
if (alert.RepeatedAlerts) {
|
||
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
|
||
selectedAlerts.push(alert.RepeatedAlerts[j]);
|
||
}
|
||
}
|
||
selectedAlertData.push(alert);
|
||
}
|
||
});
|
||
}
|
||
$('#tbody_alerts').find("input[index!='" + index + "']").prop("disabled", e.checked);
|
||
|
||
//selectedMachineID,selectedworkorderids获取
|
||
if (ma && ma.Alerts) {
|
||
var selectedWOIDS = [];
|
||
for (var i in ma.Alerts) {
|
||
var alert = ma.Alerts[i];
|
||
if (alert.WorkOrderID > 0 && e.checked) {
|
||
if (alert.WorkOrderStatus === "Completed" || selectedWOIDS.indexOf(alert.WorkOrderID) >= 0)
|
||
continue;
|
||
selectedWOIDS.push(alert.WorkOrderID);
|
||
if (!selectedWorkOrderIDs || selectedWorkOrderIDs === "")
|
||
selectedWorkOrderIDs = alert.WorkOrderID;
|
||
else
|
||
selectedWorkOrderIDs = selectedWorkOrderIDs + ", " + alert.WorkOrderID;
|
||
}
|
||
}
|
||
}
|
||
if (e.checked) {
|
||
selectedMachineID = ma.MachineID;
|
||
}
|
||
else {
|
||
selectedAlerts = [];
|
||
selectedAlertData = [];
|
||
selectedMachineID = "";
|
||
selectedWorkOrderIDs = "";
|
||
}
|
||
|
||
}
|
||
else if (name === "acksub" + index) {
|
||
if (e.checked) {
|
||
var allState = true;
|
||
var subs = $('#tbody_alerts').find("[name='acksub" + index + "']").each(function () {
|
||
var tempchk = $(this);
|
||
var alert = tempchk.data("alert");
|
||
if (alert && tempchk.prop("checked")) {
|
||
selectedAlerts.push(alert.AlertID);
|
||
if (alert.RepeatedAlerts) {
|
||
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
|
||
selectedAlerts.push(alert.RepeatedAlerts[j]);
|
||
}
|
||
}
|
||
selectedAlertData.push(alert);
|
||
}
|
||
allState = allState && tempchk.prop("checked");
|
||
});
|
||
if (allState)
|
||
$('#tbody_alerts').find("[name='ack" + index + "']").prop("checked", true);
|
||
$('#tbody_alerts').find("input[index!='" + index + "']").prop("disabled", true);
|
||
}
|
||
else {
|
||
var allState = false;
|
||
var subs = $('#tbody_alerts').find("[name='acksub" + index + "']").each(function () {
|
||
var tempchk = $(this);
|
||
var alert = tempchk.data("alert");
|
||
if (alert && tempchk.prop("checked")) {
|
||
selectedAlerts.push(alert.AlertID);
|
||
if (alert.RepeatedAlerts) {
|
||
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
|
||
selectedAlerts.push(alert.RepeatedAlerts[j]);
|
||
}
|
||
}
|
||
selectedAlertData.push(alert);
|
||
}
|
||
allState = allState || tempchk.prop("checked");
|
||
});
|
||
$('#tbody_alerts').find("[name='ack" + index + "']").prop("checked", false);
|
||
if (!allState)
|
||
$('#tbody_alerts').find("input[index!='" + index + "']").prop("disabled", false);
|
||
}
|
||
|
||
//selectedMachineID,selectedworkorderids获取
|
||
var ma = $('#tbody_alerts').find("[name='ack" + index + "']").data("alert");
|
||
var checkedcount = $('#tbody_alerts').find("[name='acksub" + index + "']:checked").length;
|
||
if (checkedcount > 0 && ma && ma.Alerts) {
|
||
selectedMachineID = ma.MachineID;
|
||
var selectedWOIDS = [];
|
||
for (var i in ma.Alerts) {
|
||
var alert = ma.Alerts[i];
|
||
if (alert.WorkOrderID > 0) {
|
||
if (alert.WorkOrderStatus === "Completed" || selectedWOIDS.indexOf(alert.WorkOrderID) >= 0)
|
||
continue;
|
||
selectedWOIDS.push(alert.WorkOrderID);
|
||
if (!selectedWorkOrderIDs || selectedWorkOrderIDs === "")
|
||
selectedWorkOrderIDs = alert.WorkOrderID;
|
||
else
|
||
selectedWorkOrderIDs = selectedWorkOrderIDs + ", " + alert.WorkOrderID;
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
selectedAlerts = [];
|
||
selectedAlertData = [];
|
||
selectedMachineID = "";
|
||
selectedWorkOrderIDs = "";
|
||
}
|
||
}
|
||
}
|
||
|
||
function showMachineAlerts(data) {
|
||
lastClickCheckbox = undefined;
|
||
selectedMachineID = undefined;
|
||
selectedAlerts = [];
|
||
selectedAlertData = [];
|
||
$('#tbody_alerts').empty();
|
||
for (var i = 0; i < data.length; i++) {
|
||
var ma = data[i];
|
||
ma.index = i;
|
||
var tr = $('<tr class="ma"></tr>').data("alert", ma);
|
||
if (i % 2 == 1)
|
||
tr.addClass("alerttr");
|
||
|
||
var icontd = $('<td style="width: 12px;"></td>');
|
||
var icon = $("<span class='iconplus'></span>");
|
||
icontd.append(icon);
|
||
tr.append(icontd);
|
||
|
||
var chktd = $('<td style="width: 12px;"></td>');
|
||
var ackchk = $('<input type="checkbox" onclick="CheckAcknowledgeAlert(this); "/>');
|
||
ackchk.attr("name", "ack" + i).attr("index", i).data("alert", ma);
|
||
chktd.append(ackchk);
|
||
tr.append(chktd);
|
||
|
||
tr.append($('<td style="width: 150px;"></td>').html(replaceHtmlText(ma.MachineName)));
|
||
tr.append($('<td style="width: 120px;"></td>').text(ma.Make));
|
||
tr.append($('<td style="width: 120px;"></td>').text(ma.Model));
|
||
tr.append($('<td style="width: 200px;"></td>').html(replaceHtmlText(ma.VIN)));
|
||
tr.append($('<td style="width: 150px;"></td>').text(ma.EngineHours == 0 ? "" : ma.EngineHours));
|
||
tr.append($('<td style="width: 80px;"></td>').text(ma.DTCAlertCount));
|
||
tr.append($('<td style="width: 80px;"></td>').text(ma.PMAlertCount));
|
||
tr.append($('<td style="width: 80px;"></td>').text(ma.InspectAlertCount));
|
||
tr.append($('<td style="width: 120px;"></td>').text(ma.OpenWorkOrders));
|
||
tr.append($('<td style="width: 130px;"></td>').text(ma.LatestAlertDateTimeStr));
|
||
tr.append($('<td></td>'));
|
||
$('#tbody_alerts').append(tr);
|
||
var subtr = $('<tr class="no-hover"></tr>').data("alert", ma).css("display", "none");
|
||
var subtd = $('<td colspan="13"></td>');
|
||
subtr.append(subtd);
|
||
$('#tbody_alerts').append(subtr);
|
||
icontd.click(subtr, iconclick);
|
||
}
|
||
}
|
||
|
||
function iconclick(e) {
|
||
var t = $(e.target);
|
||
if (!t.is('span'))
|
||
t = t.find("span");
|
||
var subtr = e.data;
|
||
var subtd = subtr.children().first();
|
||
if (subtr.is(":visible")) {
|
||
subtr.hide();
|
||
t.removeClass("iconminus").addClass("iconplus");
|
||
}
|
||
else {
|
||
if (subtd.attr("loaded") !== "1") {
|
||
var ma = subtr.data("alert");
|
||
if (ma) {
|
||
subtd.append(createAlertsTable(ma.Alerts, ma.index));
|
||
subtd.attr("loaded", "1");
|
||
if (lastClickCheckbox)//控制没有加载的checkbox
|
||
CheckAcknowledgeAlert(lastClickCheckbox);
|
||
}
|
||
}
|
||
subtr.show();
|
||
t.removeClass("iconplus").addClass("iconminus");
|
||
}
|
||
}
|
||
|
||
function createAlertsTable(alerts, index) {
|
||
var table = $("<table class='main_table'></table>");
|
||
var thr = $("<tr></tr>").appendTo(table);
|
||
$("<th style='width: 54px;'></th>").appendTo(thr);
|
||
$("<th style='width: 100px;' data-lgid='P_AM_WORKORDERID'>Work Order ID</th>").appendTo(thr);
|
||
$("<th style='width: 110px;' data-lgid='P_AM_WORKORDERSTATUS'>Work Order Status</th>").appendTo(thr);
|
||
$("<th style='width: 120px;' data-lgid='P_AM_ALERTTYPE'>Alert Type</th>").appendTo(thr);
|
||
$("<th style='width: 300px;' data-lgid='P_AM_DESCRIPTION'>Description</th>").appendTo(thr);
|
||
$("<th style='width: 150px;' data-lgid='P_AM_ENGINEHOURS'>Engine Hours</th>").appendTo(thr);
|
||
$("<th style='width: 120px;' data-lgid='P_AM_ALERTDATETIME'>Alert DateTime</th>").appendTo(thr);
|
||
$("<th style='width: 70px;' data-lgid='P_AM_ALERTCOUNT'>Alert Count</th>").appendTo(thr);
|
||
$("<th style='white-space:nowrap;' data-lgid='P_AM_SERVICEDESCRIPTION'>Service Description</th>").appendTo(thr);
|
||
//$("<th style='width: 50px;'>Completed</th>").appendTo(thr);
|
||
var pmalertsarray = [];
|
||
for (var i = 0; i < alerts.length; i++) {
|
||
var alert = alerts[i];
|
||
var tr = $('<tr></tr>').data("alert", alert);
|
||
if (i % 2 == 1)
|
||
tr.addClass("assettr");
|
||
|
||
var tdacksubchk = $('<td style="text-align:right;"></td>');
|
||
if (alert.WorkOrderID <= 0 && !alert.Completed) {
|
||
var acksubchk = $('<input type="checkbox" onclick="CheckAcknowledgeAlert(this); "/>');
|
||
acksubchk.attr("name", "acksub" + index).attr("index", index).data("alert", alert);
|
||
tdacksubchk.append(acksubchk);
|
||
}
|
||
tr.append(tdacksubchk);
|
||
|
||
tr.append($('<td></td>').text(alert.WorkOrderID > 0 ? alert.WorkOrderID : ""));
|
||
tr.append($('<td></td>').text(alert.WorkOrderStatus));
|
||
tr.append($('<td></td>').text($.trim(alert.AlertType) == "" ? GetTextByKey("P_XXXXX", '(Blank)') : alert.AlertType));
|
||
var tdnote = $('<td style="word-wrap:break-word;"></td>').text(alert.Description).attr('title', alert.Description);
|
||
tr.append(tdnote);
|
||
tr.append($('<td></td>').text(alert.EngineHours == 0 ? "" : alert.EngineHours));
|
||
tr.append($('<td></td>').text(alert.AlertLocalTimeStr));
|
||
tr.append($('<td></td>').text(alert.AlertCount));
|
||
var text = alert.ServiceDescription.length > 80 ? alert.ServiceDescription.substring(0, 80) + " ..." : alert.ServiceDescription;
|
||
var tdsnote = $('<td style="word-wrap:break-word;"></td>').text(text).attr('title', alert.ServiceDescription);
|
||
tr.append(tdsnote);
|
||
//tr.append($('<td></td>').html(alert.Completed ? "Yes" : "No"));
|
||
table.append(tr);
|
||
|
||
if (alert.AlertType == "Preventative Maintenance")
|
||
pmalertsarray.push({ AlertID: alert.AlertID, Ctrl: tdsnote });
|
||
}
|
||
getPMAlertServiceDescriptions(pmalertsarray);
|
||
return table;
|
||
}
|
||
|
||
function getPMAlertServiceDescriptions(pmalertsarray) {
|
||
if (!pmalertsarray || pmalertsarray.length == 0) return;
|
||
var alertids = pmalertsarray.map(function (a) { return a.AlertID; });
|
||
alertrequest("GetPMAlertServiceDescriptions", JSON.stringify(alertids), function (data) {
|
||
if (typeof (data) === "string") {
|
||
return;
|
||
}
|
||
if (data) {
|
||
for (var i = 0; i < data.length; i++) {
|
||
var adesc = data[i];
|
||
for (var j = 0; j < pmalertsarray.length; j++) {
|
||
if (pmalertsarray[i].AlertID = adesc.AlertId) {
|
||
var text = adesc.ServiceDescription.length > 80 ? adesc.ServiceDescription.substring(0, 80) + " ..." : adesc.ServiceDescription;
|
||
pmalertsarray[i].Ctrl.text(text).attr('title', adesc.ServiceDescription);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}, function (err) {
|
||
});
|
||
}
|
||
|
||
|
||
function sortTable(sortPath, desc) {
|
||
var result = allmachinealertdata.sort(dataSort(sortPath, desc));
|
||
showMachineAlerts(result);
|
||
}
|
||
|
||
var acknowledgealerts;
|
||
function OnSaveAcknowledgeAlert() {
|
||
acknowledgealerts = [];
|
||
if (isalertview) {
|
||
for (var i in allalertdata) {
|
||
var alert = allalertdata[i];
|
||
if (alert.Selected) {
|
||
acknowledgealerts.push(alert.AlertID);
|
||
if (alert.RepeatedAlerts) {
|
||
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
|
||
acknowledgealerts.push(alert.RepeatedAlerts[j]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
acknowledgealerts = selectedAlerts;
|
||
|
||
if (acknowledgealerts.length < 1) {
|
||
showAlert(GetTextByKey("P_AM_SELECTANALERT", 'Please select an Alert.'), GetTextByKey("P_AM_ALERT", 'Alert'));
|
||
return;
|
||
}
|
||
|
||
$('#dialog_acknowledgmentcomment').val('');
|
||
showmaskbg(true);
|
||
$('#dialog_acknowledgingalerts')
|
||
.attr('act', 'add')
|
||
.css({
|
||
'top': (document.documentElement.clientHeight - $('#dialog_acknowledgingalerts').height()) / 3,
|
||
'left': (document.documentElement.clientWidth - $('#dialog_acknowledgingalerts').width()) / 2
|
||
})
|
||
.showDialogfixed();
|
||
}
|
||
|
||
function SaveAcknowledgeAlert() {
|
||
var acknowledgmentcomment = $('#dialog_acknowledgmentcomment').val();
|
||
if (isacknowledgingalerts && (!acknowledgmentcomment || acknowledgmentcomment.length == 0)) {
|
||
showAlert(GetTextByKey("P_AM_ACKNOWLEDGMENTCOMMENTREQUIRED", 'Acknowledgment Comment is required.'), GetTextByKey("P_AM_ALERT", 'Alert'));
|
||
$('#dialog_comment').focus();
|
||
return;
|
||
}
|
||
|
||
alertrequest('SaveAcknowledgeAlert', JSON.stringify(acknowledgealerts) + String.fromCharCode(170) + acknowledgmentcomment, function (data) {
|
||
if (data !== 'OK') {
|
||
showAlert(data, GetTextByKey("P_AM_ALERT", 'Alert'));
|
||
} else {
|
||
$('#dialog_acknowledgingalerts').hideDialog();
|
||
OnSearchClick();
|
||
}
|
||
});
|
||
}
|
||
|
||
function CloseDialog(type) {
|
||
$('#dialog_workorder').hideDialog();
|
||
if (type == 1) {
|
||
OnSearchClick();
|
||
}
|
||
else {
|
||
showmaskbg(false);
|
||
}
|
||
}
|
||
|
||
var avselectedMachineID = undefined;
|
||
function AssignedWorkOrder() {
|
||
avselectedMachineID = "";
|
||
var machineid = "";
|
||
|
||
if (isalertview) {
|
||
for (var i in allalertdata) {
|
||
var alert = allalertdata[i];
|
||
if (alert.Selected) {
|
||
avselectedMachineID = alert.MachineID;
|
||
break;
|
||
}
|
||
}
|
||
machineid = avselectedMachineID;
|
||
}
|
||
else
|
||
machineid = selectedMachineID;
|
||
|
||
var meterType = "";
|
||
var hacount = 0;
|
||
var dacount = 0;
|
||
if (selectedAlertData && selectedAlertData.length > 0) {
|
||
for (var i in selectedAlertData) {
|
||
var alert = selectedAlertData[i];
|
||
if (alert.PMType == "PM_ALERT" || alert.PMType == "TBM_ALERT" || alert.PMType == "HM_ALERT")
|
||
hacount++;
|
||
if (alert.PMType == "RDM_ALERT" || alert.PMType == "ADM_ALERT")
|
||
dacount++;
|
||
}
|
||
if (hacount > 0 && dacount > 0)
|
||
meterType = "Both";
|
||
else if (hacount > 0)
|
||
meterType = "HourMeter";
|
||
else if (dacount > 0)
|
||
meterType = "Odometer";
|
||
}
|
||
|
||
if (!machineid)
|
||
machineid = "";
|
||
|
||
if (machineid === "")
|
||
selectedAlerts = [];
|
||
|
||
$('#iframeworkorder').attr('src', 'AddWorkOrder.aspx?mid=' + machineid + "&aids=" + selectedAlerts + "&metertype=" + meterType);
|
||
$('#dialog_workorder .dialog-title span.title').text(GetTextByKey("P_AM_ASSIGNWORKORDER", 'Assign Work Order'));
|
||
showmaskbg(true);
|
||
$('#dialog_workorder')
|
||
.attr('act', 'add')
|
||
.showDialogRight();
|
||
return;
|
||
}
|
||
|
||
var showworkorder = false;
|
||
function GetAlertsLisence() {
|
||
alertrequest("GetAlertsLisence", '', function (data) {
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
if (data) {
|
||
showworkorder = data.WorkOrder;
|
||
isacknowledgingalerts = data.AcknowledgingAlerts;
|
||
}
|
||
if (showworkorder && CanEditWorkOrder)
|
||
$('#btnassignworkorder').css('display', '');
|
||
else
|
||
$('#btnassignworkorder').css('display', 'none');
|
||
}, function (err) {
|
||
})
|
||
}
|
||
|
||
function ExpandAll(e) {
|
||
var btn = $(e);
|
||
var expanded = false;
|
||
if (btn.attr("expandall") == "1") {
|
||
expanded = true;
|
||
btn.attr("expandall", "0").text(GetTextByKey("P_AM_EXPANDALL", "Expand All")).removeClass("iconcollapse").addClass("iconexpand");
|
||
}
|
||
else {
|
||
expanded = false;
|
||
btn.attr("expandall", "1").text(GetTextByKey("P_AM_COLLAPSEALL", "Collapse All")).removeClass("iconexpand").addClass("iconcollapse");
|
||
}
|
||
$("#tbody_alerts").find(".ma").each(function () {
|
||
var mtr = $(this);
|
||
var icontd = mtr.children().first();
|
||
var iconspan = icontd.find("span");
|
||
|
||
var subtr = mtr.next();
|
||
var subtd = subtr.children().first();
|
||
if (expanded) {
|
||
subtr.hide();
|
||
iconspan.removeClass("iconminus").addClass("iconplus");
|
||
}
|
||
else {
|
||
if (subtd.attr("loaded") !== "1") {
|
||
var ma = subtr.data("alert");
|
||
if (ma) {
|
||
subtd.append(createAlertsTable(ma.Alerts, ma.index));
|
||
subtd.attr("loaded", "1");
|
||
if (lastClickCheckbox)//控制没有加载的checkbox
|
||
CheckAcknowledgeAlert(lastClickCheckbox);
|
||
}
|
||
}
|
||
subtr.show();
|
||
iconspan.removeClass("iconplus").addClass("iconminus");
|
||
}
|
||
});
|
||
}
|
||
|
||
var alerttypesdata;
|
||
function GetAlertTypes() {
|
||
alertrequest('GetAlertTypes', '', function (data) {
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
data.splice(0, 0, { Key: "", Value: GetTextByKey("P_XXXXX", '(Blank)') });
|
||
alerttypeparam = {
|
||
items: data,
|
||
selectedvalue: []
|
||
};
|
||
alerttypesdata = data;
|
||
var iptalertype = editmultiselect(alerttypeparam);
|
||
$('#div_alerttype').append(iptalertype);
|
||
iptalertype.change(function () {
|
||
showIncludeunCompleted(false);
|
||
if (alerttypeparam) {
|
||
var alerttypes = alerttypeparam.selectedvalue;
|
||
if (alerttypes && alerttypes.length > 0) {
|
||
if (alerttypes.indexOf("Preventative Maintenance") >= 0 || alerttypes.indexOf("Yellow-Inspect") >= 0 || alerttypes.indexOf("Red-Inspect") >= 0) {
|
||
showIncludeunCompleted(true);
|
||
}
|
||
}
|
||
else
|
||
showIncludeunCompleted(true);
|
||
}
|
||
})
|
||
});
|
||
}
|
||
function GetAssetGroups() {
|
||
alertrequest('GetAssetGroups', '', function (data) {
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
assetgroupparam = {
|
||
items: data,
|
||
selectedvalue: []
|
||
};
|
||
var iptalertype = editmultiselect(assetgroupparam);
|
||
$('#div_assetgroup').append(iptalertype);
|
||
});
|
||
}
|
||
|
||
function GetJobsites() {
|
||
alertrequest('GetJobsites', '', function (data) {
|
||
if (typeof (data) === "string") {
|
||
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
|
||
return;
|
||
}
|
||
|
||
jobsitesparam = {
|
||
items: data,
|
||
selectedvalue: []
|
||
};
|
||
var ipt = editmultiselect(jobsitesparam);
|
||
$('#div_jobsites').append(ipt);
|
||
});
|
||
}
|
||
|
||
function GetAlertStatus() {
|
||
var data = [
|
||
{ 'Key': "Unassigned", 'Value': "Show Unassigned" },
|
||
{ 'Key': "Assigned", 'Value': "Show Assigned" },
|
||
{ 'Key': "Completed", 'Value': "Show Completed" },
|
||
{ 'Key': "Uncompleted", 'Value': "Show Uncompleted" }
|
||
];
|
||
alertstatusparam = {
|
||
items: data,
|
||
selectedvalue: []
|
||
};
|
||
var iptalertype = editmultiselect(alertstatusparam);
|
||
$('#div_alertstatus').append(iptalertype);
|
||
}
|
||
|
||
var alertview_dt;
|
||
function InitGridData() {
|
||
alertview_dt = new GridView('#alertviewlist');
|
||
alertview_dt.lang = {
|
||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||
};
|
||
var list_columns = [
|
||
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
|
||
{ name: 'WorkOrderID', caption: GetTextByKey("P_AM_WORKORDERID", "Work Order ID"), valueIndex: 'WorkOrderID', css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'WorkOrderStatus', caption: GetTextByKey("P_AM_WORKORDERSTATUS", "Work Order Status"), valueIndex: 'WorkOrderStatus', allowFilter: true, css: { 'width': 140, 'text-align': 'left' } },
|
||
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', css: { 'width': 180, 'text-align': 'left' } },
|
||
{ name: 'Make', caption: GetTextByKey("P_AM_MAKE", "Make"), valueIndex: 'Make', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'Model', caption: GetTextByKey("P_AM_MODEL", "Model"), valueIndex: 'Model', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'VIN', caption: GetTextByKey("P_AM_VIN", "SN/VIN"), valueIndex: 'VIN', css: { 'width': 180, 'text-align': 'left' } },
|
||
{ name: 'CurrentHours', caption: GetTextByKey("P_AM_CURRENTHOURS", "Current Hours"), valueIndex: 'CurrentHours', css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'EngineHours', caption: GetTextByKey("P_AM_HOURS", "Hours"), valueIndex: 'EngineHours', css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'AlertType', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'Description', caption: GetTextByKey("P_AM_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 240, 'text-align': 'left' } },
|
||
{ name: 'AlertCount', caption: GetTextByKey("P_AM_ALERTCOUNT", "Alert Count"), valueIndex: 'AlertCount', css: { 'width': 80, 'text-align': 'left' } },
|
||
{ name: 'AlertLocalTime', caption: GetTextByKey("P_AM_LATESTALERTDATETIME", "Latest Alert DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } },
|
||
{ name: 'OpenWorkOrderCount', caption: GetTextByKey("P_AM_OPENWORKORDERS", "Open Work Orders"), valueIndex: 'OpenWorkOrderCount', css: { 'width': 130, 'text-align': 'left' } },
|
||
];
|
||
var columns = [];
|
||
// head
|
||
for (var hd in list_columns) {
|
||
var col = {};
|
||
col.name = list_columns[hd].name;
|
||
col.caption = list_columns[hd].caption;
|
||
col.visible = true;
|
||
col.sortable = true;
|
||
col.width = list_columns[hd].css.width;
|
||
col.align = list_columns[hd].css["text-align"]
|
||
col.key = list_columns[hd].valueIndex;
|
||
col.allowFilter = list_columns[hd].allowFilter;
|
||
if (list_columns[hd].type) {
|
||
col.type = list_columns[hd].type;
|
||
}
|
||
columns.push(col);
|
||
if (col.name === "Selected") {
|
||
col.enabled = "Enabled";
|
||
col.events = {
|
||
onchange: function () {
|
||
if (this.Selected) {
|
||
if (alertview_dt.SelectedCount == undefined || alertview_dt.SelectedCount == null)
|
||
alertview_dt.SelectedCount = 0;
|
||
alertview_dt.SelectedCount++;
|
||
for (var i in allalertdata) {
|
||
var a = allalertdata[i];
|
||
if (a.MachineID !== this.MachineID)
|
||
a.Enabled = false;
|
||
}
|
||
alertview_dt.reload();
|
||
}
|
||
else {
|
||
alertview_dt.SelectedCount--;
|
||
if (alertview_dt.SelectedCount == 0) {
|
||
for (var i in allalertdata) {
|
||
var a = allalertdata[i];
|
||
a.Enabled = true;
|
||
}
|
||
alertview_dt.reload();
|
||
}
|
||
}
|
||
}
|
||
};
|
||
}
|
||
if (col.name === "Selected") {
|
||
col.styleFilter = function (item) {
|
||
return {
|
||
display: (item.WorkOrderID > 0 || item.Completed) ? 'none' : ''
|
||
};
|
||
}
|
||
}
|
||
}
|
||
alertview_dt.canMultiSelect = false;
|
||
alertview_dt.columns = columns;
|
||
alertview_dt.init();
|
||
//alertview_dt.rowdblclick = OnEdit;
|
||
|
||
alertview_dt.selectedrowchanged = function (rowindex) {
|
||
var rowdata = alertview_dt.source[rowindex];
|
||
if (rowdata) {
|
||
workOrderID = rowdata.Values.workOrderID;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
function showAcknowledgedAlerts(data) {
|
||
var rows = [];
|
||
for (var i = 0; i < data.length; i++) {
|
||
var r = data[i];
|
||
for (var j in r) {
|
||
if (j === "AlertLocalTime") {
|
||
r[j] = { DisplayValue: r["AlertLocalTimeStr"], Value: r[j] };
|
||
}
|
||
if (j === "AcknowledgedTime_Local") {
|
||
r[j] = { DisplayValue: r["AcknowledgedTime_LocalStr"], Value: r[j] };
|
||
}
|
||
if (j === "AlertType") {
|
||
r[j] = { DisplayValue: ($.trim(r[j]) == "" ? GetTextByKey("P_XXXXX", '(Blank)') : r[j]), Value: $.trim(r[j]) };
|
||
}
|
||
}
|
||
var fr = { Values: r };
|
||
rows.push(fr);
|
||
}
|
||
|
||
acknowledgedalerts_dt.SelectedCount = 0;
|
||
acknowledgedalerts_dt.setData(rows);
|
||
}
|
||
|
||
var acknowledgedalerts_dt;
|
||
function InitAcknowledgedAlertsGridData() {
|
||
acknowledgedalerts_dt = new GridView('#acknowledgedalertslist');
|
||
acknowledgedalerts_dt.lang = {
|
||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||
};
|
||
var list_columns = [
|
||
{ name: 'AcknowledgedByName', caption: GetTextByKey("P_AM_ACKNOWLEDGEDBY", "Acknowledged By"), valueIndex: 'AcknowledgedByName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||
{ name: 'AcknowledgedTime_Local', caption: GetTextByKey("P_AM_ACKNOWLEDGEDDATETIME", "Acknowledged DateTime"), valueIndex: 'AcknowledgedTime_Local', css: { 'width': 150, 'text-align': 'left' } },
|
||
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', css: { 'width': 180, 'text-align': 'left' } },
|
||
{ name: 'Make', caption: GetTextByKey("P_AM_MAKE", "Make"), valueIndex: 'Make', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'Model', caption: GetTextByKey("P_AM_MODEL", "Model"), valueIndex: 'Model', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'VIN', caption: GetTextByKey("P_AM_VIN", "SN/VIN"), valueIndex: 'VIN', css: { 'width': 180, 'text-align': 'left' } },
|
||
{ name: 'EngineHours', caption: GetTextByKey("P_AM_HOURS", "Hours"), valueIndex: 'EngineHours', css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'AlertType', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||
{ name: 'Description', caption: GetTextByKey("P_AM_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 240, 'text-align': 'left' } },
|
||
{ name: 'AlertCount', caption: GetTextByKey("P_AM_ALERTCOUNT", "Alert Count"), valueIndex: 'AlertCount', css: { 'width': 80, 'text-align': 'left' } },
|
||
{ name: 'AlertLocalTime', caption: GetTextByKey("P_AM_LATESTALERTDATETIME", "Latest Alert DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } },
|
||
{ name: 'OpenWorkOrderCount', caption: GetTextByKey("P_AM_OPENWORKORDERS", "Open Work Orders"), valueIndex: 'OpenWorkOrderCount', css: { 'width': 130, 'text-align': 'left' } },
|
||
{ name: 'AcknowledgedComment', caption: GetTextByKey("P_AM_ACKNOWLEDGEDCOMMENT", "Acknowledged Comment"), valueIndex: 'AcknowledgedComment', css: { 'width': 200, 'text-align': 'left' } },
|
||
];
|
||
var columns = [];
|
||
// head
|
||
for (var hd in list_columns) {
|
||
var col = {};
|
||
col.name = list_columns[hd].name;
|
||
col.caption = list_columns[hd].caption;
|
||
col.visible = true;
|
||
col.sortable = true;
|
||
col.width = list_columns[hd].css.width;
|
||
col.align = list_columns[hd].css["text-align"]
|
||
col.key = list_columns[hd].valueIndex;
|
||
col.allowFilter = list_columns[hd].allowFilter;
|
||
if (list_columns[hd].type) {
|
||
col.type = list_columns[hd].type;
|
||
}
|
||
//if (col.name === "AcknowledgedComment") {
|
||
// col.visible = isacknowledgingalerts;
|
||
//}
|
||
columns.push(col);
|
||
}
|
||
acknowledgedalerts_dt.canMultiSelect = false;
|
||
acknowledgedalerts_dt.columns = columns;
|
||
acknowledgedalerts_dt.init();
|
||
//acknowledgedalerts_dt.rowdblclick = OnEdit;
|
||
|
||
acknowledgedalerts_dt.selectedrowchanged = function (rowindex) {
|
||
var rowdata = acknowledgedalerts_dt.source[rowindex];
|
||
if (rowdata) {
|
||
}
|
||
}
|
||
}
|
||
|
||
function switchPage(index) {
|
||
tabIndex = index;
|
||
if (index === 0) {
|
||
showIncludeunCompleted(true);
|
||
isalertview = true;
|
||
$('#alertviewlist').show();
|
||
$('#machineviewlist').hide();
|
||
$('#acknowledgedalertslist').hide();
|
||
|
||
$(".tabheaderselected").addClass("tabheader");
|
||
$(".tabheaderselected").removeClass("tabheaderselected");
|
||
$("#tabAlertView").removeClass("tabheader").addClass("tabheaderselected");
|
||
|
||
$('#search_alertstatus').show();
|
||
$('#div_function').show();
|
||
$('#btnExpandAll').hide();
|
||
$(window).resize();
|
||
|
||
if (!$('#alertviewlist').data("dataloaded"))
|
||
GetAlerts();
|
||
} else if (index === 1) {
|
||
showIncludeunCompleted(true);
|
||
isalertview = false;
|
||
$('#alertviewlist').hide();
|
||
$('#machineviewlist').show();
|
||
$('#acknowledgedalertslist').hide();
|
||
$('#search_alertstatus').show();
|
||
$('#div_function').show();
|
||
$('#btnExpandAll').show();
|
||
|
||
$(".tabheaderselected").addClass("tabheader");
|
||
$(".tabheaderselected").removeClass("tabheaderselected");
|
||
$("#tabAssetView").removeClass("tabheader").addClass("tabheaderselected");
|
||
|
||
$('.content_main').css('min-height', $(window).height() - $('.content_main').offset().top - 4);
|
||
$('#listDiv').css('min-height', $(window).height() - $('#listDiv').offset().top - 4);
|
||
|
||
if (!$('#machineviewlist').data("dataloaded"))
|
||
GetAlerts();
|
||
}
|
||
else if (index === 2) {
|
||
showIncludeunCompleted(false);
|
||
$('#alertviewlist').hide();
|
||
$('#machineviewlist').hide();
|
||
$('#acknowledgedalertslist').show();
|
||
|
||
$(".tabheaderselected").addClass("tabheader");
|
||
$(".tabheaderselected").removeClass("tabheaderselected");
|
||
$("#tabAcknowledgedAlertsView").removeClass("tabheader").addClass("tabheaderselected");
|
||
|
||
$('#search_alertstatus').hide();
|
||
$('#div_function').hide();
|
||
$(window).resize();
|
||
|
||
if (!$('#acknowledgedalertslist').data("dataloaded"))
|
||
GetAlerts();
|
||
}
|
||
}
|
||
|
||
$(function () {
|
||
setPageTitle(GetTextByKey("P_ALERTSMANAGEMENT", "Alerts Management"), true);
|
||
setTableSort("tbalertlist", sortTable);
|
||
GetAlertsLisence();
|
||
GetAlerts();
|
||
|
||
GetAlertTypes();
|
||
GetAssetGroups();
|
||
GetAlertStatus();
|
||
GetJobsites();
|
||
|
||
|
||
InitGridData();
|
||
InitAcknowledgedAlertsGridData();
|
||
switchPage(tabIndex);
|
||
|
||
$('#dialog_workorder').prop('iframe', true).dialog(function () {
|
||
showmaskbg(false);
|
||
});
|
||
|
||
$('#dialog_workorder').dialog(function () {
|
||
showmaskbg(false);
|
||
});
|
||
$('#dialog_acknowledgingalerts').dialog(function () {
|
||
showmaskbg(false);
|
||
});
|
||
|
||
$('#searchinputtxt').keydown(enterKeydown);
|
||
$('#chk_all_ackalert').change(function (e) {
|
||
var checked = $(this).prop('checked');
|
||
$('#tbody_alerts').find("input:checkbox[name='acknowledge']").each(function () {
|
||
if (!$(this).prop('disabled')) {
|
||
$(this).prop('checked', checked);
|
||
var ev = $(this).parents('tr');
|
||
ev.data('ackchanged', true).data('ackchecked', checked);
|
||
}
|
||
});
|
||
});
|
||
|
||
$('#dialog_duedate').datetimepicker({
|
||
timepicker: false,
|
||
format: 'm/d/Y',
|
||
enterLikeTab: false,
|
||
onSelectDate: function (v, inp) {
|
||
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
||
inp.parent().data('val', [date]);
|
||
}
|
||
});
|
||
|
||
$('#dialog_completeddate').datetimepicker({
|
||
timepicker: false,
|
||
format: 'm/d/Y',
|
||
enterLikeTab: false,
|
||
onSelectDate: function (v, inp) {
|
||
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
||
inp.parent().data('val', [date]);
|
||
}
|
||
});
|
||
|
||
$("#listDiv").scroll(null, function (e) {
|
||
var t = $(e.target);
|
||
$('#tbalertlist').css('margin-left', -(t.scrollLeft()));
|
||
});
|
||
|
||
$(window).resize(function () {
|
||
$("#alertviewlist").css("height", $(window).height() - $("#alertviewlist").offset().top - 4);
|
||
alertview_dt && alertview_dt.resize();
|
||
$("#acknowledgedalertslist").css("height", $(window).height() - $("#acknowledgedalertslist").offset().top - 4);
|
||
acknowledgedalerts_dt && acknowledgedalerts_dt.resize();
|
||
//$("#div_autoacknowledgelist").css("height", $(window).height() - $("#div_autoacknowledgelist").offset().top - 4);
|
||
//autoacknowledge_dt && autoacknowledge_dt.resize();
|
||
//$("#machineviewlist").css("height", $(window).height() - $("#alertviewlist").offset().top - 4);
|
||
$('#listDiv').css('height', $(window).height() - $('#alertviewlist').offset().top - 40);
|
||
}).resize();
|
||
|
||
$("#txtbegindate").datetimepicker({
|
||
timepicker: false,
|
||
format: 'm/d/Y'
|
||
});
|
||
$("#txtenddate").datetimepicker({
|
||
timepicker: false,
|
||
format: 'm/d/Y'
|
||
});
|
||
|
||
if (!canExport) {
|
||
$('#spExport').hide();
|
||
}
|
||
});
|
||
|
||
function enterKeydown(e) {
|
||
if (e.keyCode == 13) {
|
||
OnSearchClick();
|
||
}
|
||
}
|
||
|
||
function OnSearchClick() {
|
||
$('#alertviewlist').data("dataloaded", false);
|
||
$('#machineviewlist').data("dataloaded", false);
|
||
$('#acknowledgedalertslist').data("dataloaded", false);
|
||
GetAlerts();
|
||
}
|
||
|
||
function changeasset(aid) {
|
||
assetid = aid;
|
||
GetAlerts();
|
||
}
|
||
function OnExit() {
|
||
window.parent.CloseAlertsManagementDialog();
|
||
}
|
||
|
||
function showIncludeunCompleted(show) {
|
||
if (show)
|
||
$('#div_includeuncompleted').show();
|
||
else
|
||
$('#div_includeuncompleted').hide();
|
||
}
|
||
|
||
function openOpenAutoAcknowled() {
|
||
$('#iframealertautomation').attr('src', 'AlertAutomationManagement.aspx');
|
||
ShowAlertAutomationDialog();
|
||
}
|
||
|
||
function CloseAlertAutomationDialog() {
|
||
$('#dialog_alertautomation').hideDialog();
|
||
showmaskbg(false);
|
||
}
|
||
|
||
function ShowAlertAutomationDialog(type) {
|
||
showmaskbg(true);
|
||
$('#dialog_alertautomation')
|
||
.attr('act', type)
|
||
.showDialogRight();
|
||
}
|
||
|
||
function OnViewAutoAcknowledChangeHistory() {
|
||
window.open("AutoAcknowledChangeHistory.aspx");
|
||
}
|
||
|
||
|
||
|
||
function OnExport() {
|
||
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||
var beginDate = $('#txtbegindate').val();
|
||
var endDate = $('#txtenddate').val();
|
||
var alerttypes = [];
|
||
var assetgroups = [];
|
||
var alertstatus = [];
|
||
var jobsites = [];
|
||
if (alerttypeparam)
|
||
alerttypes = alerttypeparam.selectedvalue;
|
||
if (assetgroupparam)
|
||
assetgroups = assetgroupparam.selectedvalue;
|
||
if (alertstatusparam)
|
||
alertstatus = alertstatusparam.selectedvalue;
|
||
if (jobsitesparam)
|
||
jobsites = jobsitesparam.selectedvalue;
|
||
var item = {
|
||
AssetID: assetid == "" ? -1 : eval(assetid),
|
||
SearchText: searchtxt,
|
||
AlertStatus: alertstatus,
|
||
AssetGroups: assetgroups,
|
||
AlertTypes: alerttypes,
|
||
JobSites: jobsites,
|
||
BeginDate: beginDate,
|
||
EndDate: endDate,
|
||
IncludeunCompleted: $('#chk_includeuncompleted').prop("checked"),
|
||
}
|
||
|
||
var param = JSON.stringify(item);
|
||
window.open("../ExportToFile.aspx?type=alerts&tab=" + tabIndex + "¶m=" + param);
|
||
}
|
||
|
||
</script>
|
||
</asp:Content>
|
||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||
<div id="recordcontent" style="padding: 0px; margin: 0px;">
|
||
<div class="page_title">
|
||
<span data-lgid="P_ALERTSMANAGEMENT">Alerts Management</span>
|
||
<span id="spExport" class="export" style="float: right; font-size: 14px; margin-right: 10px; cursor: pointer;" onclick="OnExport();">
|
||
<label data-lgid="P_AM_EXPORT" style="padding-left: 2px;">Export</label>
|
||
</span>
|
||
<span class="autoacknowledge" style="<%=InDialog?"display:none;": ""%>; float: right; font-size: 14px; margin-right: 15px; cursor: pointer;" onclick="openOpenAutoAcknowled();">
|
||
<label data-lgid="P_AM_ALERTAUTOMATION">Alert Automation</label></span>
|
||
</div>
|
||
<div class="setting" style="float: right;"></div>
|
||
<table style="border-collapse: collapse; border-spacing: 0; width: 100%; line-height: 20px; margin-top: 3px;">
|
||
<tr style="height: 24px;">
|
||
<td style="border-bottom: 1px solid #bbb; width: 10px;"> </td>
|
||
<td class="tabheaderselected" id="tabAlertView" onclick="switchPage(0)" style="width: 106px;" data-lgid="P_AM_ALERTVIEW">Alert View</td>
|
||
<td class="tabheader notfirsttab" id="tabAssetView" onclick="switchPage(1)" style="width: 90px;" data-lgid="P_AM_ASSETVIEW">Asset View</td>
|
||
<td class="tabheader notfirsttab" id="tabAcknowledgedAlertsView" onclick="switchPage(2)" style="width: 120px;" data-lgid="P_AM_ACKNOWLEDGEDALERTS">Acknowledged Alerts</td>
|
||
<td style="border-bottom: 1px solid #bbb;"> </td>
|
||
</tr>
|
||
</table>
|
||
<div class="search_bar" style="margin-top: 10px;margin-bottom: 0px; min-width: 1320px;">
|
||
<input type="password" autocomplete="new-password" style="display: none" />
|
||
<span data-lgid="P_AM_BEGINDATE_COLON">Begin Date:</span>
|
||
<div>
|
||
<input type="text" style="margin-left: 5px; width: 70px;" id="txtbegindate" value="<%=BeginDate %>" />
|
||
</div>
|
||
<span data-lgid="P_AM_ENDDATE_COLON">End Date:</span>
|
||
<div>
|
||
<input type="text" style="margin-left: 5px; width: 70px;" id="txtenddate" value="<%=EndDate %>" />
|
||
</div>
|
||
<div style="<%=InDialog?"display:none;": ""%>; display: flex;">
|
||
<span data-lgid="P_AM_ALERTTYPE_COLON">Alert Type:</span>
|
||
<div id="div_alerttype"></div>
|
||
<span data-lgid="P_AM_ASSETGROUP_COLON">Asset Group:</span>
|
||
<div id="div_assetgroup"></div>
|
||
<div id="search_alertstatus" style="display: flex;">
|
||
<span data-lgid="P_AM_ALERSTATUS_COLON">Alert Status:</span>
|
||
<div id="div_alertstatus"></div>
|
||
</div>
|
||
<span data-lgid="P_AM_JOBSITES_COLON">Jobsites:</span>
|
||
<div id="div_jobsites"></div>
|
||
<input style="margin-left: 5px; width: 140px;" type="text" id="searchinputtxt" autocomplete="off" />
|
||
</div>
|
||
<input class="search" type="button" style="margin-left: 8px;" onclick="OnSearchClick();" value="Search" data-lgid="P_AM_SEARCH" />
|
||
<%--<input id="chkShowCompleted" type="checkbox" onclick="GetAlerts();" /><span>Show Completed Alerts</span>--%>
|
||
</div>
|
||
<div class="search_bar" style="margin-top: 5px;"">
|
||
<div id="div_includeuncompleted">
|
||
<input id="chk_includeuncompleted" type="checkbox" onclick="OnSearchClick();" />
|
||
<span data-lgid="P_AM_INCLUDEUNCOMPLETED">Display triggered/incomplete PM and red/yellow inspect alerts despite date selection</span>
|
||
</div>
|
||
</div>
|
||
<div class="function_title" id="div_function">
|
||
<span class="sbutton iconcheck" onclick="OnSaveAcknowledgeAlert();" data-lgid="P_AM_ACKNOWLEDGEALERTS">Acknowledge Alert(s)</span>
|
||
<span class="sbutton iconadd" id="btnassignworkorder" onclick="AssignedWorkOrder();" data-lgid="P_AM_CREATEWORKORDER">Create Work Order</span>
|
||
<span class="sbutton iconrefresh" onclick="GetAlerts();" data-lgid="P_AM_REFRESH">Refresh</span>
|
||
<span class="sbutton iconexpand" id="btnExpandAll" onclick="ExpandAll(this);" data-lgid="P_AM_EXPANDALL">Expand All</span>
|
||
<span class="sbutton iconexit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>" data-lgid="P_WO_EXIT">Exit</span>
|
||
</div>
|
||
<div class="clear"></div>
|
||
<div id="alertviewlist" style="min-width: 1280px;"></div>
|
||
<div id="machineviewlist" class="content_main" style="overflow-x: auto; display: none;">
|
||
<div style="overflow: hidden;">
|
||
<table id="tbalertlist" class="main_table" style="min-width: 1280px; width: 100%; table-layout: fixed;">
|
||
<thead>
|
||
<tr>
|
||
<th style="width: 12px;"></th>
|
||
<th style="width: 12px;"></th>
|
||
<th style="width: 150px;" sort="MachineName" data-lgid="P_AM_ASSETNAME">Asset Name</th>
|
||
<th style="width: 120px;" sort="Make" data-lgid="P_AM_MAKE">Make</th>
|
||
<th style="width: 120px;" sort="Model" data-lgid="P_AM_MODEL">Model</th>
|
||
<th style="width: 200px;" sort="VIN" data-lgid="P_AM_VIN">VIN/SN</th>
|
||
<th style="width: 150px;" sort="EngineHours" data-lgid="P_AM_ENGINEHOURS">Engine Hours</th>
|
||
<th style="width: 80px;" sort="DTCAlertCount" data-lgid="P_AM_DTCALERTS">DTC Alerts</th>
|
||
<th style="width: 80px;" sort="PMAlertCount" data-lgid="P_AM_PMALERTS">PM Alerts</th>
|
||
<th style="width: 80px;" sort="InspectAlertCount" data-lgid="P_AM_INSPECTALERTS">Inspect Alerts</th>
|
||
<th style="width: 120px;" sort="OpenWorkOrders" data-lgid="P_AM_OPENWORKORDERS">Open Work Orders</th>
|
||
<th style="width: 130px;" sort="LatestAlertDateTime" data-lgid="P_AM_LATESTALERTDATETIME">Latest Alert DateTime</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
</table>
|
||
</div>
|
||
<div id="listDiv" class="content_div">
|
||
<table class="main_table" style="min-width: 1280px; width: 100%; table-layout: fixed;">
|
||
<tbody id="tbody_alerts">
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="acknowledgedalertslist" style="min-width: 1280px;"></div>
|
||
|
||
</div>
|
||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||
<div class="dialog" id="dialog_workorder" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
|
||
<iframe id="iframeworkorder" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
||
<div class="maskbg" style="display: none;"></div>
|
||
</div>
|
||
|
||
<div class="dialog" id="dialog_acknowledgingalerts" style="display: none; width: 500px;">
|
||
<div class="dialog-title"><span class="title" data-lgid="P_AM_ACKNOWLEDGEALERTS">Acknowledge Alert(s)</span><em class="dialog-close"></em></div>
|
||
<div class="dialog-content">
|
||
<table>
|
||
<tr>
|
||
<td class="label" data-lgid="P_AM_COMMENT_COLON">Comment:</td>
|
||
<td>
|
||
<textarea id="dialog_acknowledgmentcomment" class="inputbox" maxlength="1000" tabindex="1" style="width: 400px; height: 120px;"></textarea>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="dialog-func">
|
||
<input type="button" value="Cancel" data-lgid="P_AM_CANCEL" class="dialog-close" tabindex="3" />
|
||
<input type="button" onclick="SaveAcknowledgeAlert();" value="OK" data-lgid="P_AM_OK" tabindex="2" />
|
||
<div class="clear"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="dialog" id="dialog_alertautomation" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
|
||
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
|
||
<iframe id="iframealertautomation" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
||
<div class="maskbg" style="display: none;"></div>
|
||
</div>
|
||
|
||
</asp:Content>
|
||
|