/**
|
* 司机审核列表管理初始化
|
*/
|
var YesDriver = {
|
id: "YesDriverTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
YesDriver.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.insertTime != '' && row.insertTime != null) {
|
var time = row.insertTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.insertTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.name != '' && row.name != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.name + '" onfocus="TUser.tooltip()">' + row.name + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '头像', field: 'headImgUrl', visible: true, align: 'center', valign: 'middle',width:'12%',
|
formatter: function (value, row) {
|
if (row.headImgUrl == null || row.headImgUrl == '') {
|
return '<button onclick="lookBigImg(\'${ctxPath}/static/img/NoPIC.png\')"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></button>';
|
} else {
|
var temp = row.headImgUrl
|
return '<button onclick="lookBigImg(\'' + temp + '\')"><img style="width: 90px;height:50px;" src="' + row.headImgUrl + '" /></button>';
|
}
|
},
|
events: 'operateEvents'
|
},
|
{title: '登录账号<br/>【手机号】', field: 'phone', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.phone != '' && row.phone != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.phone + '" onfocus="TUser.tooltip()">' + row.phone + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle',width:'5%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.sex != '' && row.sex != null) {
|
if (row.sex == 1) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="男" onfocus="TUser.tooltip()">男</p>']
|
}else if (row.sex == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="女" onfocus="TUser.tooltip()">女</p>']
|
}
|
}
|
return btn;
|
}
|
},
|
{title: '司机来源', field: 'addType', visible: true, align: 'center', valign: 'middle',width:'12%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.addType != '' && row.addType != null) {
|
if(row.addType == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="司机注册" onfocus="TUser.tooltip()">司机注册</p>']
|
}else if (row.addType == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="平台添加" onfocus="TUser.tooltip()">平台添加</p>']
|
}else if (row.addType == 3){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="分公司添加" onfocus="TUser.tooltip()">分公司添加</p>']
|
}else if (row.addType == 4){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="加盟商添加" onfocus="TUser.tooltip()">加盟商添加</p>']
|
}
|
}
|
return btn;
|
}
|
},
|
{title: '企业id', field: 'companyId', visible: false, align: 'center', valign: 'middle'},
|
{title: '当前车辆', field: 'carLicensePlate', visible: true, align: 'center', valign: 'middle',width:'9%',
|
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>']
|
}else{
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="-" onfocus="TUser.tooltip()">-</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '评分', field: 'fraction', visible: true, align: 'center', valign: 'middle',width:'8%'},
|
|
{title: '历史<br/>接单数', field: 'historyNum', visible: true, align: 'center', valign: 'middle',width:'7%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.historyNum != '' && row.historyNum != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.historyNum + '" onfocus="TUser.tooltip()">' + row.historyNum + '</p>']
|
}else{
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="0" onfocus="TUser.tooltip()">0</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '备注', field: 'remark', visible: true, align: 'center', valign: 'middle',width:'10%'},
|
{title: '状态', field: 'authState', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.authState != '' && row.authState != null) {
|
if (row.authState == 2) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="正常" onfocus="TUser.tooltip()">正常</p>']
|
}else if (row.authState == 3){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="冻结" onfocus="TUser.tooltip()">冻结</p>']
|
}else if (row.authState == 1) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: #4858ff;" title="待审核" onfocus="TUser.tooltip()">待审核</p>']
|
}else if (row.authState == 4){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: rgba(60,70,63,0.54)" title="已拒绝" onfocus="TUser.tooltip()">已拒绝</p>']
|
}
|
}
|
return btn;
|
}
|
}
|
];
|
};
|
|
/**
|
* 余额修改
|
*/
|
YesDriver.changeMoney = function () {
|
if (this.check()) {
|
// 所选司机余额
|
var balance = YesDriver.seItem.balance;
|
var index = layer.load(1,{
|
type: 1
|
, title: '余额修改'
|
, area: ['50%', '50%']
|
, offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
|
, id: 'layerDemo' //防止重复弹出cge
|
, content: '<div class="form-horizontal">' +
|
' <div class="col-sm-11" >' +
|
' <div class="col-sm-11">' +
|
' <div class="form-group">\n' +
|
' <label class="col-sm-3 control-label">当前余额:</label>\n' +
|
' <div class="col-sm-9">\n' +
|
' <label > '+balance+'元'+'</label> '+
|
' </div>\n' +
|
' </div>\n' +
|
|
' <div class="form-group">\n' +
|
' <label class="col-sm-3 control-label">操作类型:</label>\n' +
|
'<div class="col-sm-3">'+
|
|
'<select id = "type" class="form-control">'+
|
'<option value="1">增加</option>'+
|
'<option value="2">减少</option>'+
|
'</select>'+
|
'</div>\n'+
|
'</div>\n'+
|
' <div class="form-group">\n' +
|
' <label class="col-sm-3 control-label">操作金额:</label>\n' +
|
' <div class="col-sm-9">\n' +
|
' <input type="number" id="mount" value=""> 元 '+
|
' </div>\n' +
|
' </div>\n' +
|
' </div>' +
|
' </div>' +
|
'</div>'
|
, btn: ['关闭', '保存']
|
, btnAlign: 'c' //按钮居中
|
, shade: 0.5 //不显示遮罩
|
,load:1
|
, yes: function () {
|
layer.closeAll();
|
},
|
btn2:function () {
|
var id = YesDriver.seItem.id;
|
var mount = $("#mount").val();
|
var type = $("#type").val();
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/changeMoney", function (data) {
|
if (data == 502){
|
Feng.error("司机余额小于扣除的金额!");
|
return;
|
}
|
if (data.code == 200) {
|
Feng.success("操作成功!");
|
window.location.reload();
|
window.parent.layer.closeAll();
|
}
|
}, function (data) {
|
Feng.error("操作失败!")
|
window.location.reload();
|
window.parent.layer.closeAll();
|
return Feng.error("操作失败!");
|
});
|
ajax.set("id", id);
|
ajax.set("mount", mount);
|
ajax.set("type", type);
|
ajax.start();
|
layer.closeAll();
|
}
|
});
|
this.layerIndex = index;
|
}
|
};
|
/**
|
* 检查是否选中
|
*/
|
YesDriver.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
YesDriver.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 添加司机
|
*/
|
YesDriver.add = function(){
|
var index = layer.open({
|
type: 2,
|
title: '添加司机',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_add'
|
});
|
this.layerIndex = index;
|
}
|
|
/**
|
* 编辑司机
|
*/
|
YesDriver.update = function(){
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑司机',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_update/' + YesDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
|
/**
|
* 跳转至更换车辆页面
|
*/
|
YesDriver.changeCar = function(){
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '更换车辆',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_changeCar/' + YesDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
|
/**
|
* 冻结司机
|
*/
|
YesDriver.freeze = function(){
|
if (this.check()) {
|
var nickname = YesDriver.seItem.name;
|
if (YesDriver.seItem.authState == 3 ){
|
swal("冻结失败", "【正常】状态下才能执行此操作", "warning");
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '冻结司机'+"【"+nickname+"】",
|
area: ['720px', '450px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_optDriver/' + YesDriver.seItem.id +"/"+2
|
});
|
this.layerIndex = index;
|
|
/*var nickname = YesDriver.seItem.name;
|
if (nickname == "" || nickname == null || nickname == undefined){
|
nickname = "该司机";
|
}else{
|
nickname = "【"+nickname+"】";
|
}
|
if (YesDriver.seItem.authState == 3 ){
|
swal("冻结失败", "【正常】状态下才能执行此操作", "warning");
|
return;
|
}else{
|
swal({
|
title: "您是否确认冻结"+ nickname + "?",
|
text: "请谨慎操作!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "冻结",
|
closeOnConfirm: true
|
}, function () {
|
/!*var ajax = new $ax(Feng.ctxPath + "/tDriver/optDriver", function (data) {
|
swal("冻结成功", "您已经冻结了"+ nickname + "。", "success");
|
YesDriver.table.refresh();
|
}, function (data) {
|
swal("冻结失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("driverId",YesDriver.seItem.id);
|
ajax.set("optType",2);
|
ajax.start();*!/
|
});
|
}*/
|
}
|
}
|
|
/**
|
* 解冻司机
|
*/
|
YesDriver.thaw = function(){
|
if (this.check()) {
|
var nickname = YesDriver.seItem.name;
|
if (YesDriver.seItem.authState == 2 ){
|
swal("解冻失败", "【冻结】状态下才能执行此操作", "warning");
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '解冻司机'+"【"+nickname+"】",
|
area: ['720px', '450px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_optDriver/' + YesDriver.seItem.id +"/"+1
|
});
|
this.layerIndex = index;
|
/*var nickname = YesDriver.seItem.name;
|
if (nickname == "" || nickname == null || nickname == undefined){
|
nickname = "该司机";
|
}else{
|
nickname = "【"+nickname+"】";
|
}
|
if (YesDriver.seItem.authState == 2 ){
|
swal("解冻失败", "【冻结】状态下才能执行此操作", "warning");
|
return;
|
}else{
|
swal({
|
title: "您是否确认解冻"+ nickname + "?",
|
text: "请谨慎操作!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "解冻",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/optDriver", function (data) {
|
swal("解冻成功", "您已经解冻了"+ nickname + "。", "success");
|
YesDriver.table.refresh();
|
}, function (data) {
|
swal("解冻失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("driverId",YesDriver.seItem.id);
|
ajax.set("optType",1);
|
ajax.start();
|
});
|
}*/
|
}
|
}
|
|
/**
|
* 删除司机
|
*/
|
YesDriver.deleteDriver = function(){
|
if (this.check()) {
|
var nickname = YesDriver.seItem.name;
|
if (nickname == "" || nickname == null || nickname == undefined) {
|
nickname = "该司机";
|
} else {
|
nickname = "【" + nickname + "】";
|
}
|
swal({
|
title: "您是否确认删除" + nickname + "?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: false
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/delete", function (data) {
|
swal("删除成功", "您已经删除了" + nickname + "。", "success");
|
YesDriver.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tDriverId", YesDriver.seItem.id);
|
ajax.start();
|
});
|
}
|
}
|
|
YesDriver.training = function(){
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '添加培训',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/showTraining?id=' + YesDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
|
|
YesDriver.punish = function(){
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '添加处罚',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/showPunish?id=' + YesDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
|
|
/**
|
* 查询司机审核列表列表
|
*/
|
YesDriver.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['companyName'] = $("#companyName").val();
|
queryData['phone'] = $("#phone").val();
|
queryData['name'] = $("#name").val();
|
queryData['addType'] = $("#addType").val();
|
queryData['authState'] = $("#authState").val();
|
YesDriver.table.refresh({query: queryData});
|
};
|
YesDriver.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#companyName").val("");
|
$("#phone").val("");
|
$("#name").val("");
|
$("#addType").val("");
|
$("#authState").val("");
|
YesDriver.search();
|
};
|
|
$(function () {
|
var defaultColunms = YesDriver.initColumn();
|
var table = new BSTable(YesDriver.id, "/tDriver/listYesDriver", defaultColunms);
|
table.setPaginationType("server");
|
YesDriver.table = table.init();
|
});
|
|
/**
|
* 下载模板
|
*/
|
YesDriver.uploadDriverModel = function () {
|
window.location.href = Feng.ctxPath + "/tDriver/uploadDriverModel";
|
}
|
|
var agreement = function(){
|
this.init = function(){
|
//模拟上传excel
|
$("#uploadEventBtn").unbind("click").bind("click",function(){
|
$("#uploadEventFile").click();
|
});
|
};
|
}
|
/**
|
* 导入合同
|
*/
|
YesDriver.exportDriver = function () {
|
var uploadEventFile = $("#uploadEventFile").val();
|
if(uploadEventFile == ''){
|
Feng.info("请选择Excel,再上传");
|
}else if(uploadEventFile.lastIndexOf(".xls")<0){//可判断以.xls和.xlsx结尾的excel
|
Feng.info("只能上传Excel文件");
|
}else{
|
var url = Feng.ctxPath + '/tDriver/exportDriver';
|
var file = document.querySelector('input[name=file]').files[0];
|
var reader = new FileReader();
|
if (file) {
|
var formData = new FormData();
|
formData.append("myfile", file);
|
this.sendAjaxRequest(url, 'POST', formData);
|
}
|
}
|
}
|
YesDriver.sendAjaxRequest = function(url,type,data){
|
$.ajax({
|
url : url,
|
type : type,
|
data : data,
|
success : function(result) {
|
if(result.code==500) {
|
Feng.info(result.message);
|
$('input[name=file]').val('');
|
}else {
|
Feng.success("导入成功!");
|
}
|
YesDriver.table.refresh();
|
},
|
error : function() {
|
Feng.error("excel上传失败!");
|
},
|
cache : false,
|
contentType : false,
|
processData : false
|
});
|
};
|
|
var agreement;
|
$(function(){
|
agreement = new agreement();
|
agreement.init();
|
});
|
|
/**
|
* 导出司机操作
|
*/
|
YesDriver.outDriver = function () {
|
var operation = function() {
|
window.location.href = Feng.ctxPath + "/tDriver/outDriver";
|
};
|
Feng.confirm("是否确认导出司机信息?", operation);
|
}
|