/**
* 管理初始化
*/
var TDriverException = {
id: "TDriverExceptionTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
TDriverException.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: '主键', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '编号', field: 'code', visible: true, align: 'center', valign: 'middle'},
{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle'},
{title: '手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'},
{title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle',
formatter: function (value, row) {
if (row.sex === 1){
return '男'
}else if (row.sex === 2){
return '女'
}else {
return '未知'
}
}},
{title: '驾驶证号码', field: 'driverLicenseNumber', visible: true, align: 'center', valign: 'middle'},
{title: '身份证号码', field: 'idcard', visible: true, align: 'center', valign: 'middle'},
{title: '身份证', field: 'source', visible: true, align: 'center', valign: 'middle',
formatter: function (value, row) {
if (null != row.idcardFront){
return '已上传'
}else{
return '未上传'
}
}},
{title: '累计订单量', field: 'cumulativeOrderCount', visible: true, align: 'center', valign: 'middle'},
{title: '当月订单量', field: 'monthOrderCount', visible: true, align: 'center', valign: 'middle'},
{title: '积分', field: 'integral', visible: true, align: 'center', valign: 'middle'},
{title: '连续未上线(天)', field: 'refusalCount', visible: true, align: 'center', valign: 'middle'},
{title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
formatter: function (value, row) {
return '异常'
}},
{title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
{title: '操作', visible: true, align: 'center', valign: 'middle',width:150,
formatter: function (value, row) {
if (row.status === 1){
return '冻结'
}else if (row.status === 2){
return '解冻'
}
}
}
];
};
/**
* 检查是否选中
*/
TDriverException.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if(selected.length == 0){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
TDriverException.seItem = selected[0];
return true;
}
};
/**
* 点击添加
*/
TDriverException.openAddTDriver = function () {
var index = layer.open({
type: 2,
title: '添加',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/tDriver/tDriver_add'
});
this.layerIndex = index;
};
/**
* 打开查看详情
*/
TDriverException.openTDriverDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/tDriver/tDriver_update/' + TDriver.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除
*/
TDriverException.delete = function () {
if (this.check()) {
var ajax = new $ax(Feng.ctxPath + "/tDriver/delete", function (data) {
Feng.success("删除成功!");
TDriver.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("tDriverId",this.seItem.id);
ajax.start();
}
};
/**
* 停用页面
*/
TDriverException.stop = function (id) {
var index = layer.open({
type: 2,
title: '停用',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/tDriver/tDriverException_start_and_stop?id='+id
});
this.layerIndex = index;
};
/**
* 启动页面
*/
TDriverException.start = function (id) {
var index = layer.open({
type: 2,
title: '启用',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/tDriver/tDriverException_start_and_stop?id='+id
});
this.layerIndex = index;
};
/**
* 提交启用冻结
*/
TDriverException.updateStatus = function () {
var status = $("#status").val();
if(status == 1 && ($("#stopRemark").val() == '' || $("#stopRemark").val() == null)){
Feng.info("请输入冻结理由!")
return;
}
if(status == 2 && ($("#startRemark").val() == '' || $("#startRemark").val() == null)){
Feng.info("请输入解冻理由!")
return;
}
var ajax = new $ax(Feng.ctxPath + "/tDriver/update-status", function (data) {
Feng.success("修改成功!");
TDriverInfoDlg.closeException();
parent.TDriverException.table.refresh();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set("id",$("#id").val());
ajax.set("status",$("#status").val());
if($("#status").val() == 1){
ajax.set("remark",$("#stopRemark").val());
}
if($("#status").val() == 2){
ajax.set("remark",$("#startRemark").val());
}
ajax.start();
};
/**
* 司机异常信息导出
*/
TDriverException.export=function(){
var createTime=$("#createTime").val()
var phone=$("#phone").val()
var status=$("#status").val()
window.location.href=Feng.ctxPath + "/tDriver/export-exception?createTime="+createTime
+"&status="+status
+"&phone="+phone
;
}
/**
* 司机异常列表
*/
TDriverException.tDriverException = function () {
var index = layer.open({
type: 2,
title: '司机异常列表',
area: ['100%', '100%'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/tDriver/tDriver_exception'
});
this.layerIndex = index;
};
/**
* 查询列表
*/
TDriverException.search = function () {
var queryData = {};
queryData['createTime'] = $("#createTime").val();
queryData['phone'] = $("#phone").val();
queryData['status'] = $("#status").val();
TDriverException.table.refresh({query: queryData});
};
/**
* 重置
*/
TDriverException.resetSearch = function (){
$("#createTime").val('');
$("#phone").val('');
$("#status").val('');
TDriverException.search();
}
$(function () {
var defaultColunms = TDriverException.initColumn();
var table = new BSTable(TDriverException.id, "/tDriver/exceptionList", defaultColunms);
table.setPaginationType("client");
TDriverException.table = table.init();
});