add site
This commit is contained in:
437
Site/Maintenance/MaintanceRecordsManagement.aspx
Normal file
437
Site/Maintenance/MaintanceRecordsManagement.aspx
Normal file
@ -0,0 +1,437 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="MaintanceRecordsManagement.aspx.cs" Inherits="Maintenance_MaintanceRecordsManagement" %>
|
||||
|
||||
<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: 200px;
|
||||
height: 18px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.dialog-content table td input[type="checkbox"] {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.dialog-content table td textarea {
|
||||
height: 100px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
#dialogdatatb td {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.a {
|
||||
text-decoration: none;
|
||||
color: #2140fb;
|
||||
}
|
||||
</style>
|
||||
<script src="../js/jquery.datetimepicker.full.js"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("js/inputdatactr.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var recorddata;
|
||||
var assetid = "<%=AssetID %>";
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_MAINTENANCERECORDSMANAGEMENT", "Maintenance Records Management"), true);
|
||||
InitGridData();
|
||||
|
||||
GetTypesData();
|
||||
GetRecordes();
|
||||
|
||||
$('#dialog_mdate').click(function () { $('#dateformatspan').css('display', 'none'); }).blur(function () {
|
||||
if ($.trim($(this).val()) == "") {
|
||||
$('#dateformatspan').css('display', '');
|
||||
}
|
||||
else {
|
||||
$('#dateformatspan').css('display', 'none');
|
||||
}
|
||||
})
|
||||
$('#startdatetxt').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]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#enddatetxt').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_mdate').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]);
|
||||
}
|
||||
})
|
||||
InputControl($('#dialog_hours'));
|
||||
$('#dialog_hours').change(function () { if (!inputValueFormat(this)) { $(this).val(''); } })
|
||||
$('#searchinputtxt').keydown(enterKeydown);
|
||||
$('#typeselectinput').change(function () { GetRecordes(); });
|
||||
if (!canExport) {
|
||||
$('#spExport').hide();
|
||||
}
|
||||
$(window).resize(function () {
|
||||
$("#recordlist").css("height", $(window).height() - $("#recordlist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
});
|
||||
|
||||
function enterKeydown(e) {
|
||||
if (e.keyCode == 13) {
|
||||
GetRecordes();
|
||||
}
|
||||
}
|
||||
function GetTypesData() {
|
||||
$.ajax(
|
||||
{
|
||||
type: "POST",
|
||||
async: false,
|
||||
datatype: "json",
|
||||
url: "MaintanceRecordsManagement.aspx",
|
||||
data: {
|
||||
MethodName: "GetTypesData"
|
||||
},
|
||||
success: function (data) {
|
||||
$('#typeselectinput').empty();
|
||||
$("<option></option>").val("").text(GetTextByKey("P_SELECT_ALL", "All")).appendTo($("#typeselectinput"));
|
||||
if (data != "" && data != "[]") {
|
||||
var datattype = JSON.parse(data);
|
||||
for (var i = 0; i < datattype.length; i++) {
|
||||
$("<option></option>").val(datattype[i].Key).text(datattype[i].Value).appendTo($("#typeselectinput"));
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (msg) {
|
||||
showAlert(msg.statusText, GetTextByKey("P_MRM_ERROR", 'Error'));
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
function GetRecordes() {
|
||||
showloading(true);
|
||||
$.ajax(
|
||||
{
|
||||
type: "POST",
|
||||
async: false,
|
||||
datatype: "json",
|
||||
url: "MaintanceRecordsManagement.aspx",
|
||||
data: {
|
||||
assetid: assetid,
|
||||
maintenanceType: "Hours",
|
||||
type: $('#typeselectinput').find("option:selected").val(),
|
||||
searchtxt: encodeURIComponent($.trim($('#searchinputtxt').val())),
|
||||
sortype: encodeURIComponent($.trim($('#maintance_type').val())),
|
||||
sortdata: encodeURIComponent($.trim($('#maintance_sort').val())),
|
||||
startdate: encodeURIComponent($.trim($('#startdatetxt').val())),
|
||||
enddate: encodeURIComponent($.trim($('#enddatetxt').val())),
|
||||
MethodName: "GetRecords"
|
||||
},
|
||||
success: function (datastr) {
|
||||
if (datastr != "") {
|
||||
recorddata = eval("(" + datastr + ")");
|
||||
showRecordList(recorddata);
|
||||
}
|
||||
showloading(false);
|
||||
},
|
||||
error: function (msg) {
|
||||
showAlert(msg.statusText, GetTextByKey("P_MRM_ERROR", 'Error'));
|
||||
showloading(false);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function showRecordList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
|
||||
var distype = r.LogType;
|
||||
if (r.LogType == "TimeOffRoad")
|
||||
distype = 'Time/Off-Road';
|
||||
else if (r.LogType == "TimeOverRoad")
|
||||
distype = 'Time/Over Road';
|
||||
|
||||
for (var j in r) {
|
||||
if (j === "LogType") {
|
||||
r[j] = { DisplayValue: distype, Value: r[j] };
|
||||
}
|
||||
else if (j === "MaintenanceDate") {
|
||||
r[j] = { DisplayValue: r["StrForMaintenanceDate"], Value: r[j] };
|
||||
}
|
||||
else if (j === "AlertTime") {
|
||||
r[j] = { DisplayValue: r["StrForAlertTime"], Value: r[j] };
|
||||
}
|
||||
else if (j === "AlertID") {
|
||||
r[j] = r[j] <= 0 ? "" : r[j];
|
||||
}
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#recordlist');
|
||||
grid_dt.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
var list_columns = [
|
||||
{ name: 'MachineID', caption: GetTextByKey("P_MRM_ASSETID", "Asset ID"), valueIndex: 'MachineID', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'MachinePin', caption: GetTextByKey("P_MRM_SN", "SN"), valueIndex: 'MachinePin', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'DisplayName', caption: GetTextByKey("P_MRM_NAME", "Name"), valueIndex: 'DisplayName', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'MaintenanceDate', caption: GetTextByKey("P_MRM_MAINTENANCEDATE", "Maintenance Date"), valueIndex: 'MaintenanceDate', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'LogType', caption: GetTextByKey("P_MRM_MAINTENANCETYPE", "Maintenance Type"), valueIndex: 'LogType', allowFilter: true, css: { 'width': 130, 'text-align': 'left' } },
|
||||
{ name: 'MaintenanceHours', caption: GetTextByKey("P_MRM_MAINTENANCEHOURS", "Maintenance Hours"), valueIndex: 'MaintenanceHours', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'ODOMeter', caption: GetTextByKey("P_MRM_MAINTENANCEDISTANCE", "Maintenance Distance"), valueIndex: 'ODOMeter', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'ODOMemterUOM', caption: GetTextByKey("P_MRM_DISTANCEUOM", "Distance UOM"), valueIndex: 'ODOMemterUOM', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'Cost', caption: GetTextByKey("P_MRM_COST", "Cost"), valueIndex: 'Cost', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'InvoiceNumber', caption: GetTextByKey("P_MRM_INVOICENUMBER", "Invoice Number"), valueIndex: 'InvoiceNumber', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'CompletedByName', caption: GetTextByKey("P_MRM_COMPLETEDBY", "Completed By"), valueIndex: 'CompletedByName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Notes', caption: GetTextByKey("P_MRM_DESCRIPTION", "Description"), valueIndex: 'Notes', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'MachineMake', caption: GetTextByKey("P_MRM_MAKE", "Make"), valueIndex: 'MachineMake', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'MachineModel', caption: GetTextByKey("P_MRM_MODEL", "Model"), valueIndex: 'MachineModel', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'MachineType', caption: GetTextByKey("P_MRM_ASSETTYPE", "Type"), valueIndex: 'MachineType', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'AlertID', caption: GetTextByKey("P_MRM_ALERTID", "Alert ID"), valueIndex: 'AlertID', css: { 'width': 80, 'text-align': 'left' } },
|
||||
{ name: 'AlertTitle', caption: GetTextByKey("P_MRM_ALERTTITLE", "Alert Title"), valueIndex: 'AlertTitle', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'AlertType', caption: GetTextByKey("P_MRM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'AlertTime', caption: GetTextByKey("P_MRM_ALERTTIME", "Alert Time"), valueIndex: 'AlertTime', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'Attachment', caption: "", css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
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 (col.name === "Attachment") {
|
||||
//col.isurl = true;
|
||||
col.text = "\uf0c6";
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.styleFilter = function (item) {
|
||||
return {
|
||||
display: item.HasAttachment ? '' : 'none',
|
||||
cursor: "default"
|
||||
};
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_MRM_ATTACHMENT", 'Attachment') };
|
||||
}
|
||||
else if (col.name === "Edit") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf044";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnEdit();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_MRM_EDIT", 'Edit') };
|
||||
}
|
||||
else if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_MRM_DELETE", 'Delete') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnEdit;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//执行iframe中函数
|
||||
var doIFrameFunc = function (v_mymethod, v_params, v_frmName) {
|
||||
if (document.getElementById(v_frmName)) {
|
||||
|
||||
var fn = document.getElementById(v_frmName).contentWindow[v_mymethod];
|
||||
|
||||
if (fn) {
|
||||
if (v_params == null)
|
||||
return fn();
|
||||
else {
|
||||
return fn.apply(this, v_params);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function CloseDialog(type) {
|
||||
$('#dialog_maintenancerecord').hideDialog();
|
||||
if (type == 1) {
|
||||
GetRecordes();
|
||||
}
|
||||
else {
|
||||
showmaskbg(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function OnAdd() {
|
||||
if (assetid && assetid !== "")
|
||||
window.location.href = "MachineMaintenanceInfo.aspx?InDialog=" +<%=InDialog?"1": "0"%>+"&mid=" + assetid;
|
||||
else
|
||||
window.location.href = "MachineMaintenanceInfo.aspx";
|
||||
}
|
||||
function DoubleClick(e) {
|
||||
OnEdit();
|
||||
}
|
||||
function OnEdit() {
|
||||
var record = grid_dt.source[grid_dt.selectedIndex].Values;
|
||||
|
||||
doIFrameFunc("init", [record.MachineID, record.MaintenanceID], "iframemaintenancerecord");
|
||||
|
||||
showmaskbg(true);
|
||||
$('#dialog_maintenancerecord')
|
||||
.attr('act', 'edit')
|
||||
.showDialogRight();
|
||||
}
|
||||
function OnDelete(record) {
|
||||
if (!record) {
|
||||
return;
|
||||
}
|
||||
showConfirm(GetTextByKey("P_MRM_DELETETHERECORD", "Would you like to delete the record?"), GetTextByKey("P_MRM_SYSTEMINFORMATION", "System Information"), function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
url: "MaintanceRecordsManagement.aspx",
|
||||
data: {
|
||||
maintenanceid: record.MaintenanceID,
|
||||
MethodName: "Deletemaintenance"
|
||||
},
|
||||
success: function (msg) {
|
||||
GetRecordes();
|
||||
showAlert(msg, GetTextByKey("P_MRM_SYSTEMINFORMATION", "System Information"));
|
||||
},
|
||||
error: function (msg) {
|
||||
showAlert(msg.statusText, GetTextByKey("P_MRM_ERROR", 'Error'));
|
||||
}
|
||||
})
|
||||
}, function () { return false; });
|
||||
}
|
||||
|
||||
function changeasset(aid) {//mapview调用
|
||||
assetid = aid;
|
||||
GetRecordes();
|
||||
}
|
||||
|
||||
function OnExit() {
|
||||
window.parent.CloseWorkOrderDialog();
|
||||
}
|
||||
|
||||
function OnExport() {
|
||||
var maintenancetype = "Hours";
|
||||
var type = $('#typeselectinput').find("option:selected").val();
|
||||
var searchtxt = encodeURIComponent($.trim($('#searchinputtxt').val()));
|
||||
var sortype = encodeURIComponent($.trim($('#maintance_type').val()));
|
||||
var sortdata = encodeURIComponent($.trim($('#maintance_sort').val()));
|
||||
var startdate = encodeURIComponent($.trim($('#startdatetxt').val()));
|
||||
var enddate = encodeURIComponent($.trim($('#enddatetxt').val()));
|
||||
|
||||
var p = [assetid, maintenancetype, type, searchtxt, sortype, sortdata, startdate, enddate];
|
||||
var param = htmlencode(JSON.stringify(p));
|
||||
window.open("../ExportToFile.aspx?type=maintenancerecords¶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" data-lgid="P_MAINTENANCERECORDSMANAGEMENT">Maintenance Records Management</div>
|
||||
<div class="search_bar" style="<%=InDialog?"display:none;": ""%>">
|
||||
<input type="password" autocomplete="new-password" style="display: none" />
|
||||
<span style="padding-left: 5px;" data-lgid="P_FR_BEGINDATE_COLON">Begin Date: </span>
|
||||
<span>
|
||||
<input id="startdatetxt" style="width: 100px;" value="<%=BeginDate %>" autocomplete="off" /></span>
|
||||
<span style="padding-left: 5px;" data-lgid="P_FR_ENDDATE_COLON">End Date: </span>
|
||||
<span>
|
||||
<input id="enddatetxt" style="width: 100px;" value="<%=EndDate %>" autocomplete="off" /></span>
|
||||
<span style="padding-left: 5px;" data-lgid="P_MRM_TYPE_COLON">Type:</span> <select class="selectinput" id="typeselectinput"></select>
|
||||
<input id="searchinputtxt" autocomplete="off" />
|
||||
<input class="search" type="button" onclick="GetRecordes();" value="Search" data-lgid="P_MRM_SEARCH" />
|
||||
</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_MRM_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="GetRecordes();" data-lgid="P_MRM_REFRESH">Refresh</span>
|
||||
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_UTILITY_EXPORTTOEXCEL">Export to Excel</span>
|
||||
<span class="sbutton iconexit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>" data-lgid="P_MRM_EXIT">Exit</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="recordlist"></div>
|
||||
</div>
|
||||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||||
|
||||
|
||||
<div class="dialog" id="dialog_maintenancerecord" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
|
||||
<iframe id="iframemaintenancerecord" src="AddMaintenanceRecord.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
||||
<div class="maskbg" style="display: none;"></div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
Reference in New Issue
Block a user