.
This commit is contained in:
@ -80,90 +80,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
//admin用户 获取所有contractor
|
||||
function getContractors() {
|
||||
devicerequest('GetContractors', '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_MR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (data && data.length > 0) {
|
||||
var sel_search = $('#sel_contractor').empty();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var kv = data[i];
|
||||
var op_search = $('<option></option>').val(kv.Key).text(kv.Value);
|
||||
if (kv.Key == contractorid)
|
||||
op_search.prop('selected', true);
|
||||
sel_search.append(op_search);
|
||||
}
|
||||
if (contractorid !== "")
|
||||
sel_search.val(contractorid);
|
||||
}
|
||||
|
||||
GetMachines();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//普通用户 获取可操作的contractor
|
||||
function GetContractorsByUser() {
|
||||
devicerequest('GetContractorsByUser', '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_MR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (data && data.length > 0) {
|
||||
var sel_search = $('#sel_contractor').empty();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var kv = data[i];
|
||||
var op_search = $('<option></option>').val(kv.Key).text(kv.Value);
|
||||
sel_search.append(op_search);
|
||||
}
|
||||
|
||||
if (contractorid !== "")
|
||||
sel_search.val(contractorid);
|
||||
}
|
||||
GetMachines();
|
||||
});
|
||||
}
|
||||
|
||||
function GetMachines() {
|
||||
contractorid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
|
||||
devicerequest("GetSelectMachinesByCompany", contractorid, function (data) {
|
||||
if (data && data.length > 0) {
|
||||
machines = data;
|
||||
listeditableSelectMachine.datasource = machines;
|
||||
listeditableSelectMachine.valuepath = "MachineID"
|
||||
listeditableSelectMachine.displaypath = "DisplayName";
|
||||
//if (MachineID !== "")//暂时不过滤机器
|
||||
//listeditableSelectMachine.val(MachineID);
|
||||
}
|
||||
|
||||
OnRefresh();
|
||||
|
||||
}, function (err) {
|
||||
});
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
|
||||
var cid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (cid && cid != '')
|
||||
contractorid = cid;
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
|
||||
var machine = listeditableSelectMachine.selecteditem();
|
||||
if (machine != null)
|
||||
MachineID = machine.MachineID;
|
||||
else
|
||||
MachineID = "";
|
||||
|
||||
|
||||
devicerequest("SearchRentalChangeHistory", contractorid + String.fromCharCode(170) + searchtxt
|
||||
+ String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate
|
||||
+ String.fromCharCode(170) + MachineID + String.fromCharCode(170) + RentalID, function (data) {
|
||||
@ -181,16 +105,11 @@
|
||||
}
|
||||
|
||||
function OnExport() {
|
||||
var cid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (cid && cid != '')
|
||||
contractorid = cid;
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var from = htmlencode($('#startdatetxt').val());
|
||||
var to = htmlencode($('#enddatetxt').val());
|
||||
|
||||
mid = listeditableSelectMachine.val();
|
||||
if (mid === undefined) mid = "";
|
||||
var mid = "";
|
||||
|
||||
var sortPath = grid_dt.sortKey;
|
||||
if (sortPath === undefined) sortPath = "";
|
||||
@ -200,16 +119,11 @@
|
||||
}
|
||||
|
||||
function OnPrint() {
|
||||
var cid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (cid && cid != '')
|
||||
contractorid = cid;
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var from = htmlencode($('#startdatetxt').val());
|
||||
var to = htmlencode($('#enddatetxt').val());
|
||||
|
||||
mid = listeditableSelectMachine.val();
|
||||
if (mid === undefined) mid = "";
|
||||
var mid = "";
|
||||
|
||||
var sortPath = grid_dt.sortKey;
|
||||
if (sortPath === undefined) sortPath = "";
|
||||
@ -298,22 +212,6 @@
|
||||
$('#tr_search').css('display', 'none');
|
||||
}
|
||||
|
||||
//if (IsDealer == true) {
|
||||
// $('#span_contractor').css('display', '');
|
||||
// $('#span_contractor').parent().css('display', '');
|
||||
// if (IsAdmin)
|
||||
// getContractors();
|
||||
// else {
|
||||
// GetContractorsByUser();
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
// GetMachines();
|
||||
|
||||
//$("#sel_contractor").change(function () {
|
||||
// GetMachines();
|
||||
//});
|
||||
|
||||
OnRefresh();
|
||||
|
||||
$('#searchinputtxt').keydown(searchEnter);
|
||||
|
Reference in New Issue
Block a user