/**
|
* 用户留言管理管理初始化
|
*/
|
var TProblem = {
|
id: "TProblemTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TProblem.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: '用户id', field: 'userId', visible: false, align: 'center', valign: 'middle'},
|
{title: '留言用户', field: 'userName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.userName != '' && row.userName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.userName + '" onfocus="TUser.tooltip()">' + row.userName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '留言用户<br/>电话', field: 'userPhone', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.userPhone != '' && row.userPhone != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.userPhone + '" onfocus="TUser.tooltip()">' + row.userPhone + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '提问<br/>内容', field: 'content', visible: true, align: 'center', valign: 'middle',width:'20%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.content != '' && row.content != null) {
|
var str = row.content;
|
if (str.length > 20){
|
str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TProblem.buttonClick(' + row.id+','+ 1+ ')">查看更多</button>';
|
}
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.content + '" onfocus="TUser.tooltip()">' + str + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '处理状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.state != '' && row.state != null) {
|
if (row.state == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待处理" onfocus="AppUserInfo.tooltip()">待处理</p>']
|
} else if (row.state == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已处理" onfocus="AppUserInfo.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: 'answer', visible: true, align: 'center', valign: 'middle',width:'20%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.answer != '' && row.answer != null) {
|
var str = row.answer;
|
if (str.length > 20){
|
str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TProblem.buttonClick(' + row.id+','+ 2+ ')">查看更多</button>';
|
}
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.answer + '" onfocus="TUser.tooltip()">' + str + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '处理人id', field: 'handleUserId', visible: false, align: 'center', valign: 'middle'},
|
{title: '处理人', field: 'handleUserName', visible: true, align: 'center', valign: 'middle',
|
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;
|
}
|
}
|
];
|
};
|
|
/**
|
* 查看更多按钮
|
* @param con
|
*/
|
TProblem.buttonClick = function (id,type) {
|
var index = layer.open({
|
type: 2,
|
title: '查看详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tProblem/lookDetail/'+id+"/"+type
|
});
|
this.layerIndex = index;
|
}
|
|
/**
|
* 检查是否选中
|
*/
|
TProblem.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TProblem.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 立即处理
|
*/
|
TProblem.immediately = function () {
|
if (this.check()) {
|
var state = TProblem.seItem.state;
|
if (2 == state){
|
swal("操作失败", "【待处理】状态下才能执行此操作", "warning");
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '立即处理',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tProblem/tProblem_immediately/' + TProblem.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 查询用户留言管理列表
|
*/
|
TProblem.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['userName'] = $("#userName").val();
|
queryData['state'] = $("#state").val();
|
TProblem.table.refresh({query: queryData});
|
};
|
TProblem.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#userName").val("");
|
$("#state").val("");
|
TProblem.search();
|
};
|
$(function () {
|
var defaultColunms = TProblem.initColumn();
|
var table = new BSTable(TProblem.id, "/tProblem/list", defaultColunms);
|
table.setPaginationType("server");
|
TProblem.table = table.init();
|
});
|