/**
|
* 投诉列表管理初始化
|
*/
|
var TComplaintDriver = {
|
id: "TComplaintDriverTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TComplaintDriver.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '投诉时间', field: 'insert_time', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.insert_time != '' && row.insert_time != null) {
|
var time = row.insert_time.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.insert_time + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '投诉司机', field: 'driverName', visible: true, align: 'center', valign: 'middle',},
|
{title: '被投诉用户', field: 'userName', visible: true, align: 'center', valign: 'middle',},
|
{title: '用户被投诉次数', field: 'count', visible: true, align: 'center', valign: 'middle',},
|
{title: '投诉内容', field: 'reason', visible: true, align: 'center', valign: 'middle',},
|
{title: '投诉图片', field: 'img', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.img == null || row.img == '') {
|
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.img;
|
var res = "";
|
temp.split(',').map(function (item) {
|
res = res + '<button onclick="lookBigImg(\'' + item + '\')"><img style="width: 90px;height:50px;" src="' + item + '" /></button>';
|
})
|
return res;
|
}
|
},
|
events: 'operateEvents'
|
},
|
{title: '状态', field: 'isHandle', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.isHandle != '' && row.isHandle != null) {
|
if (row.isHandle == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已处理" onfocus="TUser.tooltip()">已处理</p>']
|
}
|
}else{
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="未处理" onfocus="TUser.tooltip()">未处理</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '是否加入黑名单', field: 'isBlack', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if (row.isBlack == 0){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="否" onfocus="TUser.tooltip()">否</p>']
|
}else{
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="是" onfocus="TUser.tooltip()">是</p>']
|
|
}
|
return btn;
|
}
|
},
|
{title: '处理时间', field: 'handleTime', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.handleTime != '' && row.handleTime != null) {
|
var time = row.handleTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '处理人', field: 'handleUserName', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.handleUserName != '' && row.handleUserName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleUserName + '" onfocus="TUser.tooltip()">' + row.handleUserName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '备注', field: 'handleResult', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.handleResult != '' && row.handleResult != null) {
|
var str = row.handleResult;
|
if (str.length > 20){
|
str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' + row.id+','+ 3+ ')">查看更多</button>';
|
}
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleResult + '" onfocus="TUser.tooltip()">' + str + '</p>']
|
}
|
return btn;
|
}
|
},
|
];
|
};
|
/**
|
* 黑名单列表
|
*/
|
TComplaintDriver.blackList = function() {
|
var index = layer.open({
|
type: 2,
|
title: '黑名单列表',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tComplaintDriver/blackList1'
|
});
|
this.layerIndex = index;
|
}
|
/**
|
* 查看更多按钮
|
* @param con
|
*/
|
TComplaintDriver.buttonClick = function (id,type) {
|
var index = layer.open({
|
type: 2,
|
title: '查看详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tComplaintDriver/lookDetail/'+id+"/"+type
|
});
|
this.layerIndex = index;
|
}
|
|
|
|
/**
|
* 检查是否选中
|
*/
|
TComplaintDriver.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TComplaintDriver.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 立即处理
|
*/
|
TComplaintDriver.immediately = function(){
|
if (this.check()) {
|
if (TComplaintDriver.seItem.isHandle == 1) {
|
swal("处理失败", "【未处理】状态下才能执行此操作", "warning");
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '立即处理',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tComplaintDriver/tComplaint_immediately/' + TComplaintDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
|
/**
|
* 删除投诉列表
|
*/
|
TComplaintDriver.delete = function () {
|
if (this.check()) {
|
if (TComplaintDriver.seItem.isHandle != 1) {
|
swal("删除失败", "【已处理】状态下才能执行此操作", "warning");
|
return;
|
}
|
swal({
|
title: "您是否确认删除该投诉记录?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: false
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tComplaintDriver/delete", function (data) {
|
TComplaintDriver.table.refresh();
|
TComplaintDriver.search()
|
swal("删除成功", "您已经删除了该投诉记录。", "success");
|
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tComplaintId", TComplaintDriver.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
|
/**
|
* 查询投诉列表列表
|
*/
|
TComplaintDriver.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['userName'] = $("#userName").val();
|
queryData['userPhone'] = "";
|
queryData['driverName'] = $("#driverName").val();
|
queryData['isHandle'] = $("#isHandle").val();
|
TComplaintDriver.table.refresh({query: queryData});
|
};
|
|
TComplaintDriver.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#userName").val("");
|
$("#driverName").val("");
|
$("#isHandle").val("");
|
TComplaintDriver.search();
|
};
|
|
$(function () {
|
var defaultColunms = TComplaintDriver.initColumn();
|
var table = new BSTable(TComplaintDriver.id, "/tComplaintDriver/list", defaultColunms);
|
table.setPaginationType("server");
|
TComplaintDriver.table = table.init();
|
});
|