This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -75,21 +75,22 @@
showAlert('An unknown error occurred. Please refresh page.', 'Query');
showAlert(GetTextByKey('P_PM_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_PM_QUERY', 'Query'));
});
}
}
function getIntervalLabel(type, unit) {
switch (type) {
case "TBM": return "Days"; break;
case "TBM": return GetTextByKey("P_WO_DAYS", 'Days'); break;
case "ADM":
case "RDM":
if (unit === "Kilometre")
return "Kilometres"
return GetTextByKey("P_PM_KILOMETERS", 'Kilometers');
else
return "Miles";
return GetTextByKey("P_PM_MILES", 'Miles');
break;
default: return "Hours"; break;
default: return GetTextByKey("P_PM_HOURS", 'Hours');
}
}
function OnAdd() {
window.location.href = 'ScheduleDetail.aspx?TP=ADM';
}
@ -159,26 +160,45 @@
showloading(false);
});
}
function getPmScheduleTypeText(pmtype) {
var text = "";
if (pmtype === 'ADM')
text = GetTextByKey('P_PM_ABSOLUTEDISTANCE', 'Absolute Distance');
if (pmtype === 'PM')
text = GetTextByKey('P_PM_ABSOLUTEHOURS', 'Absolute Hours');
if (pmtype === 'RDM')
text = GetTextByKey('P_PM_RELATIVEDISTANCE', 'Relative Distance');
if (pmtype === 'HM')
text = GetTextByKey('P_PM_RELATIVEEHOURS', 'Relative Hours');
if (pmtype === 'TBM')
text = GetTextByKey('P_PM_RELATIVEETIME', 'Relative Time');
return text;
}
function createItem(trs, item) {
var tr = $('<tr></tr>').attr('data-id', item.PmScheduleID);
var td = $('<td></td>').css('width', 340);
td.append($('<em class="icon collapse"></em>').click(collapse));
td.append($('<em class="icon collapse" style="line-height:20px;"></em>').click(collapse));
td.append($('<div class="item_name"></div>').html(getText(item.PmScheduleName)).attr('title', item.PmScheduleName));
tr.append(td);
td = $('<td></td>');
td.append($('<div class="item_desc"></div>').html(getText(item.Notes)).attr('title', item.Notes));
tr.append(td);
td = $('<td></td>');
td.append($('<div class="item_type"></div>').html(getText(item.PmScheduleTypeStr)).attr('title', item.PmScheduleTypeStr));
var pmscheduletypetext = getPmScheduleTypeText(item.PmScheduleType);
td.append($('<div class="item_type"></div>').html(getText(pmscheduletypetext)).attr('title', pmscheduletypetext));
tr.append(td);
td = $('<td class="td_funcs"></td>').css({ 'width': 70, 'min-width': 70 });
td = $('<td></td>');
td.append($('<div class="item_type" style="color: red"></div>').text(item.Enabled ? '' : GetTextByKey("P_PM_DISABLED", "Disabled")));
tr.append(td);
td = $('<td class="td_funcs"></td>').css({ 'width': 70, 'min-width': 70, 'padding-right': 10 });
td.append($('<a onclick="return false;">' + GetTextByKey("P_PM_DELETE", "Delete") + '</a>').click(deleteItem));
tr.append(td);
td = $('<td class="td_funcs"></td>').css({ 'width': 120, 'min-width': 120 });
td = $('<td class="td_funcs"></td>').css({ 'width': 120, 'min-width': 120, 'padding-right': 10 });
td.append($('<a onclick="return false;">' + GetTextByKey("P_PM_MANAGESCHEDULE", "Manage schedule") + '</a>').click(editItem));
tr.append(td);
td = $('<td class="td_funcs"></td>').css({ 'width': 120, 'min-width': 120 });
td = $('<td class="td_funcs"></td>').css({ 'width': 120, 'min-width': 120, 'padding-right': 10 });
var a = $('<a onclick="return false;">' + GetTextByKey("P_PM_MANAGEASSETS", "Manage assets") + '</a>');
if (item.Intervals && item.Intervals.length > 0) {
a.click(editItemMachine);
@ -282,6 +302,24 @@
}
}
function CloseWOPlansDialog(type) {
$('#dialog_plans').hideDialog();
showmaskbg(false);
//refreshData();
}
function ShowWOPlansDialog(type) {
showmaskbg(true);
$('#dialog_plans')
.attr('act', type)
.showDialogRight();
}
function openPlans() {
$('#iframeworkorderplans').attr('src', 'WorkOrderPlansManagement.aspx');
ShowWOPlansDialog();
}
$(function () {
setPageTitle(GetTextByKey("P_PM_MAINTENANCESCHEDULES", "Maintenance Schedules"), true);
$('#sel_plantype').change(refreshData);
@ -289,19 +327,21 @@
$("#expandintervals").click(function (e) {
var btn = $(this);
if (btn.text() == "Expand Intervals") {
if (btn.attr("Expand") !== "0") {
btn.attr("Expand", "0");
btn.removeClass("iconadd");
btn.addClass("iconreduce");
btn.text("Collapse Intervals");
btn.text(GetTextByKey("P_PM_COLLAPSEINTERVALS", "Collapse Intervals"));
$('#pm_tbody').find(".icon").each(function () {
if ($(this).hasClass("collapse"))
$(this).click();
});
}
else {
btn.attr("Expand", "1");
btn.removeClass("iconreduce");
btn.addClass("iconadd");
btn.text("Expand Intervals");
btn.text(GetTextByKey("P_PM_EXPANDINTERVALS", "Expand Intervals"));
$('#pm_tbody').find(".icon").each(function () {
if ($(this).hasClass("expand"))
$(this).click();
@ -325,18 +365,26 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="min-width: 850px;">
<div class="page_title" data-lgid="P_PM_MAINTENANCESCHEDULES">Maintenance Schedules</div>
<div class="page_title">
<span data-lgid="P_PM_MAINTENANCESCHEDULES">Maintenance Schedules</span>
<% if (!IsForesightUser)
{ %>
<span class="sbutton iconcog" style="float: right; font-size: 14px; cursor: pointer" onclick="openPlans();">
<label data-lgid="P_WO_PLANS">Plans</label></span>
<% } %>
<div style="clear: both;"></div>
</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span style="padding-left: 5px;" data-lgid="P_PM_PLAN_COLON">Plan:</span>&nbsp;&nbsp;<select class="selectinput" id="sel_plan"></select>
<span style="padding-left: 5px;" data-lgid="P_PM_PLANTYPE_COLON">Plan Type:</span>&nbsp;&nbsp;
<select class="selectinput" id="sel_plantype">
<option value=""></option>
<option value="ADM">Absolute Distance</option>
<option value="PM">Absolute Hours</option>
<option value="RDM">Relative Distance</option>
<option value="HM">Relative Hours</option>
<option value="TBM">Relative Time</option>
<option value="ADM" data-lgid="P_PM_ABSOLUTEDISTANCE">Absolute Distance</option>
<option value="PM" data-lgid="P_PM_ABSOLUTEHOURS">Absolute Hours</option>
<option value="RDM" data-lgid="P_PM_RELATIVEDISTANCE">Relative Distance</option>
<option value="HM" data-lgid="P_PM_RELATIVEEHOURS">Relative Hours</option>
<option value="TBM" data-lgid="P_PM_RELATIVEETIME">Relative Time</option>
</select>
<span style="padding-left: 5px;" data-lgid="P_PM_ASSET_COLON">Asset:</span>&nbsp;&nbsp;
<input id="searchinputtxt" type="text" autocomplete="off" />
@ -353,9 +401,11 @@
<tbody id="pm_tbody"></tbody>
</table>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</div>
<div class="dialog" id="dialog_interval" style="display: none; ">
<div class="dialog" id="dialog_interval" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_PM_ADDABSOLUTEHOURSINTERVAL">Add Absolute Hours Interval</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table class="dialog_table">
@ -403,5 +453,10 @@
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_plans" style="display: none; height: 100%; border-bottom: 0; border-top: 0">
<iframe id="iframeworkorderplans" style="width: 100%; height: 100%; display: block; border: none"></iframe>
<div class="maskbg" style="display: none"></div>
</div>
</asp:Content>