/**
|
* 车辆管理管理初始化
|
*/
|
var AuditCarRental = {
|
id: "AuditCarRentalTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
AuditCarRental.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '发布时间', field: 'createTime', visible: true, align: 'center', valign: 'middle',width:'150px'},
|
{title: '发布者类型', field: 'userType', visible: true, align: 'center', valign: 'middle',width:'100px',
|
formatter: function (value, row) {
|
switch (value) {
|
case 1:
|
return '个人用户';
|
case 2:
|
return '司机用户';
|
case 3:
|
return '企业用户';
|
}
|
}
|
},
|
{title: '发布者名称', field: 'pushUser', visible: true, align: 'center', valign: 'middle',width:'150px'},
|
{title: '发布者电话', field: 'pushPhone', visible: true, align: 'center', valign: 'middle',width:'150px'},
|
{title: '标题', field: 'title', visible: true, align: 'center', valign: 'middle',width:'200px',
|
formatter: function (value, row) {
|
value = (typeof value == "undefined" ? '-':value);
|
return '<span title="' + value + '">' + value + '</span>';
|
}
|
},
|
{title: '车辆图片', field: 'imgUrl', visible: true, align: 'center', valign: 'middle',width:'300px',
|
formatter: function (value, row) {
|
if(value == '' || typeof value == "undefined"){
|
return ""
|
}
|
let imgs = value.split(",")
|
let str = '';
|
// for(let i in imgs){
|
// str += '<img src="' + imgs[i] + '" width="50px;" onclick="lookBigImg(\'' + imgs[i] + '\')"/> '
|
// }
|
str = '<img src="' + imgs[0] + '" width="50px;" onclick="lookBigImg(\'' + imgs[0] + '\')"/> '
|
return str;
|
}
|
},
|
{title: '车辆品牌', field: 'brandName', visible: true, align: 'center', valign: 'middle',width:'100px'},
|
{title: '座位', field: 'seat', visible: true, align: 'center', valign: 'middle',width:'100px'},
|
{title: '取车证件', field: 'pickUpCarCarCertificates', visible: true, align: 'center', valign: 'middle',width:'200px'},
|
{title: '价格', field: 'rentMoney', visible: true, align: 'center', valign: 'middle',width:'150px'},
|
{title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',width:'100px',
|
formatter: function (value, row) {
|
switch (value) {
|
case 1:
|
return '待审核';
|
case 2:
|
return '上架中';
|
case 3:
|
return '已下架';
|
case 4:
|
return '待上架';
|
case 5:
|
return '已拒绝';
|
}
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
AuditCarRental.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
AuditCarRental.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
AuditCarRental.showAuditCarRentalInfo = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '出租车辆详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/carRental/showCarRentalInfo?id=' + AuditCarRental.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
|
|
/**
|
* 删除车辆管理
|
*/
|
AuditCarRental.deleteAuditCarRental = function () {
|
if (this.check()) {
|
swal({
|
title: "您是否确认删除该租车信息?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/carRental/deleteCarRental", function (res) {
|
if(res.code == 200){
|
swal("删除成功", "您已经成功删除了该租车信息。", "success");
|
AuditCarRental.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",AuditCarRental.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
|
/**
|
* 审核
|
*/
|
AuditCarRental.openAuditCarRental = function (status) {
|
if (this.check()) {
|
if(AuditCarRental.seItem.status != 1){
|
Feng.info("不能重复操作");
|
return
|
}
|
var index = layer.open({
|
type: 2,
|
title: '出租车辆审核',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/carRental/openAuditCarRental?id=' + AuditCarRental.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
|
|
/**
|
* 查询车辆管理列表
|
*/
|
AuditCarRental.search = function () {
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['title'] = $("#title").val();
|
queryData['brandId'] = $("#brandId").val();
|
queryData['insertUser'] = $("#insertUser").val();
|
queryData['status'] = $("#status").val();
|
queryData['userType'] = $("#userType").val();
|
AuditCarRental.table.setQueryParams(queryData);
|
AuditCarRental.table.refresh({query: queryData});
|
};
|
|
AuditCarRental.resetSearch = function () {
|
$("#createTime").val("");
|
$("#title").val("");
|
$("#brandId").val("");
|
$("#insertUser").val("");
|
$("#status").val("");
|
$("#userType").val("");
|
AuditCarRental.search();
|
};
|
|
$(function () {
|
var defaultColunms = AuditCarRental.initColumn();
|
var table = new BSTable(AuditCarRental.id, "/carRental/listAuditCarRental", defaultColunms);
|
table.setPaginationType("server");
|
AuditCarRental.table = table.init();
|
});
|