/**
|
* 选择车辆
|
*/
|
var SelectCar = {
|
id: "SelectCarTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
SelectCar.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '车牌号', field: 'carLicensePlate', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.carLicensePlate != '' && row.carLicensePlate != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.carLicensePlate + '" onfocus="TUser.tooltip()">' + row.carLicensePlate + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '车辆照片', field: 'carPhoto', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
if (row.carPhoto == null || row.carPhoto == '') {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></a>';
|
} else {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 90px;height:50px;" src="' + row.carPhoto + '" /></a>';
|
}
|
},
|
events: 'operateEvents'
|
},
|
{title: '车辆品牌', field: 'brandName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.brandName != '' && row.brandName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.brandName + '" onfocus="TUser.tooltip()">' + row.brandName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '车辆类型', field: 'modelName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.modelName != '' && row.modelName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.modelName + '" onfocus="TUser.tooltip()">' + row.modelName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '车辆颜色', field: 'carColor', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.carColor != '' && row.carColor != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.carColor + '" onfocus="TUser.tooltip()">' + row.carColor + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '服务模式', field: 'serverStr', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.serverStr != '' && row.serverStr != null) {
|
var labelStr = "";
|
var labelStrs = "";
|
var labelArray = row.serverStr.split(",");
|
for(var i=0;i<labelArray.length;i++){
|
labelStr += labelArray[i] +"<br>";
|
labelStrs += labelArray[i] + " ";
|
}
|
labelStr = labelStr.substring(0,labelStr.length-4);
|
labelStrs = labelStrs.substring(0,labelStrs.length-5);
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + labelStrs + '" onfocus="TUser.tooltip()">' + labelStr + '</p>']
|
}
|
return btn;
|
}
|
},
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
SelectCar.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
SelectCar.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 查询司机审核列表列表
|
*/
|
SelectCar.search = function () {
|
var queryData = {};
|
queryData['carLicensePlate'] = $("#carLicensePlate").val();
|
queryData['brandName'] = $("#brandName").val();
|
queryData['modelName'] = $("#modelName").val();
|
queryData['color'] = $("#color").val();
|
queryData['serverStr'] = $("#serverStr").val();
|
SelectCar.table.refresh({query: queryData});
|
};
|
SelectCar.resetSearch = function () {
|
$("#carLicensePlate").val("");
|
$("#brandName").val("");
|
$("#modelName").val("");
|
$("#color").val("");
|
$("#serverStr").val("");
|
SelectCar.search();
|
};
|
|
$(function () {
|
var tDriverId = $("#tDriverId").val();
|
var defaultColunms = SelectCar.initColumn();
|
var table = new BSTable(SelectCar.id, "/tDriver/selectCarList/"+tDriverId, defaultColunms);
|
table.setPaginationType("server");
|
SelectCar.table = table.init();
|
});
|
|
/**
|
* 关闭选择用户页面
|
*/
|
SelectCar.close = function () {
|
parent.layer.close(window.parent.YesDriver.layerIndex);
|
}
|
|
/**
|
* 选择车辆操作
|
*/
|
SelectCar.selectCarOpt = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/selectCarOpt", function(data){
|
Feng.success("操作成功!");
|
window.parent.YesDriver.table.refresh();
|
SelectCar.close();
|
},function(data){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tDriverId",$("#tDriverId").val());
|
ajax.set("carId",selected[0].id);
|
ajax.start();
|
}
|