/**
|
* 司机审核列表管理初始化
|
*/
|
var YesDriver = {
|
id: "YesDriverTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
var language =$("#language").val()
|
/**
|
* 初始化表格的列
|
*/
|
YesDriver.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: language==1?'添加时间':(language==2?'Add Time':'Tambahkan waktu'), field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'7%',
|
},
|
{title: language==1?'姓名':(language==2?'name':'Nama Lengkap'), field: 'driverName', visible: true, align: 'center', valign: 'middle',width:'5%',
|
},
|
{title: language==1?'头像':(language==2?'portrait':'potret'), field: 'headImgUrl', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
if (row.headImgUrl == null || row.headImgUrl == '') {
|
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.headImgUrl + '" /></a>';
|
}
|
},
|
events: 'operateEvents'
|
},
|
{title: language == 1 ? '手机号' : ( language == 2 ? 'phone' : 'nomor ponsel'), field: 'phone', visible: true, align: 'center', valign: 'middle',width:'5%',
|
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: language==1?'性别':(language==2?'Gender':'Jenis kelamin'), field: 'sex', visible: true, align: 'center', valign: 'middle',width:'3%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.sex != '' && row.sex != null) {
|
if(language==1){
|
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>']
|
}
|
}
|
}else if(language==2){
|
if(row.sex != '' && row.sex != null) {
|
if (row.sex == 1) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="man" onfocus="TUser.tooltip()">man</p>']
|
}else if (row.sex == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="woman" onfocus="TUser.tooltip()">woman</p>']
|
}
|
}
|
}else {
|
if(row.sex != '' && row.sex != null) {
|
if (row.sex == 1) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="laki-laki" onfocus="TUser.tooltip()">laki-laki</p>']
|
}else if (row.sex == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="wanita" onfocus="TUser.tooltip()">wanita</p>']
|
}
|
}
|
}
|
}
|
return btn;
|
}
|
},
|
{title: language==1?'所属机构':(language==2?'Affiliated organization':'Organisasi Afiliasi'), field: 'name', visible: true, align: 'center', valign: 'middle',width:'8%',
|
},
|
{title: language==1?'当前车辆':(language==2?'Current vehicle':'Kendaraan saat ini'), field: 'carId', visible: true, align: 'center', valign: 'middle',width:'7%',
|
},
|
{title: language==1?'服务模式':(language==2?'Service mode':'Mode Layanan'), field: 'type', visible: true, align: 'center', valign: 'middle',width:'7%',
|
formatter: function (value, row) {
|
if(language==1){
|
if(value==1){
|
return '摩托车';
|
}else {
|
return "同城快送";
|
}
|
}else if(language==2){
|
if(value==1){
|
return 'motorcycle';
|
}else {
|
return "Intra-city express delivery";
|
}
|
}else {
|
if(value==1){
|
return 'sepeda motor';
|
}else {
|
return "Pengiriman Ekspres Dalam Kota";
|
}
|
}
|
|
}
|
},
|
{title: language==1?'评分':(language==2?'Rate':'Kecepatan'), field: 'score', visible: true, align: 'center', valign: 'middle',width:'7%',
|
},
|
{title: language==1?'司机等级':(language==2?'Driver grade':'Nilai pengemudi'), field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'7%',
|
formatter: function (value, row) {
|
return value;
|
}
|
},
|
{title: language==1?'历史接单数':(language==2?'Numebr of historical order':'Numebr of Historical Order'), field: 'orderNum', visible: true, align: 'center', valign: 'middle',width:'7%',
|
},
|
{title: language==1?'历史订单总金额':(language==2?'Total historical order amount':'Jumlah perintah sejarah total'), field: 'money', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter:function (data){
|
return "Rp"+data;
|
}
|
},
|
{title: language==1?'当前钱包余额':(language==2?'Current wallet balance':'Balansi dompet saat ini'), field: 'balance', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
return "Rp"+value;
|
}
|
},
|
{title: language==1?'状态':(language==2?'State':'Status'), field: 'authState', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.authState != '' && row.authState != null) {
|
if(language==1){
|
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>']
|
}
|
}else if(language==2){
|
if (row.authState == 2) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="正常" onfocus="TUser.tooltip()">normal</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()">freeze</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()">Pending review</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()">Has been rejected</p>']
|
}
|
}else {
|
if (row.authState == 2) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="正常" onfocus="TUser.tooltip()">normal</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()">Membekukan</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()">Tinjauan tertunda</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()">Telah ditolak</p>']
|
}
|
}
|
|
}
|
return btn;
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
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: language==1?'添加':(language==2?'Add':'Tambahkan'),
|
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: language==1?'编辑':(language==2?'Edit':'Edit'),
|
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: language==1?'更换车辆':(language==2?'Replace the vehicle':'Ganti kendaraan'),
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_changeCar/' + YesDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
|
YesDriver.selectUserOpt = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
|
return false;
|
}
|
var id = selected[0].id;
|
var companyName = selected[0].companyName;
|
if(companyName==undefined)companyName="";
|
var nickName = selected[0].driverName;
|
var phone = selected[0].phone;
|
if ("" == id || null == id || undefined == id){
|
Feng.info("请先选中表格中的某一记录!");
|
|
return ;
|
}
|
var obj = $("#obj").val();
|
window.parent.DriverActivityInfoDlg.selecUserOpt1(id,companyName,nickName,phone);
|
YesDriver.close();
|
}
|
YesDriver.close = function () {
|
parent.layer.close(window.parent.DriverActivityInfoDlg.layerIndex);
|
}
|
function deleteSub1(e) {
|
$(e).parent().parent().remove();
|
}
|
/**
|
* 冻结司机
|
*/
|
YesDriver.freeze = function(){
|
if (this.check()) {
|
var nickname = YesDriver.seItem.name;
|
if (YesDriver.seItem.authState == 3 ){
|
if(language==1){
|
swal("冻结失败", "【正常】状态下才能执行此操作", "warning");
|
}else if(language==2){
|
swal("Fail","This operation can only be performed in unfreezing failed [normal] status", "warning");
|
}else {
|
swal("Gagal", "Operasi ini hanya dapat dilakukan dalam status unfreezing gagal [normal].", "warning");
|
}
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: language==1?'冻结司机'+"【"+nickname+"】":(language==2?'Freeze drivers'+"【"+nickname+"】":'Driver beku'+"【"+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 ){
|
if(language==1){
|
swal("解冻失败", "【冻结】状态下才能执行此操作", "warning");
|
}else if(language==2){
|
swal("Fail", "This operation can only be performed in the unfreezing failure [frozen] status.", "warning");
|
}else {
|
swal("Gagal", "Operasi ini hanya dapat dilakukan dalam status kegagalan [beku] yang tidak bebas.", "warning");
|
}
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: language==1?'解冻司机'+"【"+nickname+"】":(language==2?'Unfreeze drivers'+"【"+nickname+"】":'Pembalap pembekuan'+"【"+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) {
|
if(language==1){
|
nickname = "该司机";
|
}else if(language==2){
|
nickname = "The driver";
|
}else {
|
nickname = "Pemandu";
|
}
|
} else {
|
nickname = "【" + nickname + "】";
|
}
|
swal({
|
title: language==1?"您是否确认删除" + nickname + "?":(language==2?"Are you sure to delete the" + nickname + "?":"Apakah Anda pasti akan menghapus" + nickname + "?"),
|
text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'),
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'),
|
closeOnConfirm: false
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/delete", function (data) {
|
if(language==1){
|
swal("删除成功", "您已经删除了" + nickname + "。", "success");
|
}else if(language==2){
|
swal("Success", "You have deleted it" + nickname + "。", "success");
|
}else {
|
swal("Success", "Anda telah menghapusnya" + nickname + "。", "success");
|
}
|
YesDriver.table.refresh();
|
}, function (data) {
|
if(language==1){
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
}else if(language==2){
|
swal("Failed to delete", data.responseJSON.message + "!", "warning");
|
}else {
|
swal("Hapus Gagal", 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: language==1?'添加':(language==2?'Add':'Tambahkan'),
|
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: language==1?'添加':(language==2?'Add':'Tambahkan'),
|
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 == ''){
|
if(language==1){
|
Feng.info("请选择Excel,再上传");
|
}else if(language==2){
|
Feng.info("Please select Excel and upload");
|
}else {
|
Feng.info("Silakan pilih Excel dan upload");
|
}
|
}else if(uploadEventFile.lastIndexOf(".xls")<0){//可判断以.xls和.xlsx结尾的excel
|
if(language==1){
|
Feng.info("只能上传Excel文件");
|
}else if(language==2){
|
Feng.info("Only Excel files can be uploaded");
|
}else {
|
Feng.info("Hanya berkas Excel yang dapat diunggah");
|
}
|
}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 {
|
if(language==1){
|
Feng.success("导入成功!");
|
}else if(language==2){
|
Feng.success("SUCCESSFUL IMPORT!");
|
}else {
|
Feng.success("Import berhasil!");
|
}
|
|
}
|
YesDriver.table.refresh();
|
},
|
error : function() {
|
if(language==1){
|
Feng.error("excel上传失败!");
|
}else if(language==2){
|
Feng.error("Uploading excel Fails. Procedure!");
|
}else {
|
Feng.error("Gagal mengunggah 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";
|
};
|
if(language==1){
|
Feng.confirm("是否确认导出司机信息?", operation);
|
}else if(language==2){
|
Feng.confirm("Are you sure to export driver information?", operation);
|
}else {
|
Feng.confirm("Apakah Anda pasti akan mengekspor informasi pengemudi?", operation);
|
}
|
|
}
|