/**
|
* 管理初始化
|
*/
|
var TReportLoss = {
|
id: "TReportLossTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TReportLoss.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'},
|
{title: '用户姓名', field: 'nickName', visible: true, align: 'center', valign: 'middle'},
|
{title: '联系方式', field: 'phone', visible: true, align: 'center', valign: 'middle'},
|
{title: '司机车牌号', field: 'carNumber', visible: true, align: 'center', valign: 'middle'},
|
{title: '内容', field: 'remark', visible: true, align: 'center', valign: 'middle'},
|
{title: '图片', field: 'image', visible: true, align: 'center', valign: 'middle',
|
formatter:function(data){
|
if(typeof data != "undefined"){
|
let imgs = data.split(",");
|
let htmlStr = '';
|
for (let i = 0; i < imgs.length; i++) {
|
htmlStr += '<img src="' + imgs[i] + '" style="height: 100px;" onclick="lookBigImg(\'' + imgs[i] + '\')"/> '
|
}
|
return htmlStr;
|
}
|
}
|
},
|
{title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
|
formatter:function(data){
|
if(data==1){
|
return '未处理'
|
}else {
|
return '已处理'
|
}
|
}
|
},
|
{title: '处理时间', field: 'handleTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '处理人id', field: 'handleUser', visible: true, align: 'center', valign: 'middle'},
|
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TReportLoss.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TReportLoss.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加
|
*/
|
TReportLoss.openAddTReportLoss = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tReportLoss/tReportLoss_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看详情
|
*/
|
TReportLoss.openTReportLossDetail = function () {
|
if (this.check()) {
|
let status = this.seItem.status
|
if(status==2){
|
Feng.info("该信息已经处理过了")
|
return false;
|
}
|
let id = this.seItem.id
|
layer.open({
|
type: 1
|
, title: ''
|
, area: ["400px", '300px']
|
, offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
|
, id: 'layerDemo' //防止重复弹出cge
|
, content: '<div class="form-horizontal">' +
|
' <div class="col-sm-11" style="margin-top: 30px">' +
|
' <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' +
|
' <textarea id="info" style="height: 150px;width: 250px" placeholder="多行输入,最多500字" maxlength="500"></textarea>\n' +
|
' </div>\n' +
|
' </div>\n' +
|
' </div>' +
|
' </div>' +
|
'</div>'
|
, btn: ['提交处理']
|
, btnAlign: 'c' //按钮居中
|
, shade: 0.5 //不显示遮罩
|
, yes: function () {
|
console.log(1111)
|
let info = $("#info").val()
|
var ajax = new $ax(Feng.ctxPath + "/tReportLoss/dispose", function (data) {
|
if (data.code == 200) {
|
TReportLoss.table.refresh();
|
window.parent.layer.closeAll();
|
Feng.success("处理成功!");
|
} else {
|
return Feng.error(data.msg);
|
}
|
}, function (data) {
|
return Feng.error("操作失败!");
|
});
|
ajax.set("id",id)
|
ajax.set("info",info)
|
ajax.start();
|
layer.closeAll();
|
},
|
});
|
}
|
};
|
|
/**
|
* 删除
|
*/
|
TReportLoss.delete = function () {
|
if (this.check()) {
|
var ajax = new $ax(Feng.ctxPath + "/tReportLoss/delete", function (data) {
|
Feng.success("删除成功!");
|
TReportLoss.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tReportLossId",this.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 查询列表
|
*/
|
TReportLoss.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['phone'] = $("#phone").val();
|
queryData['status'] = $("#status").val();
|
TReportLoss.table.refresh({query: queryData});
|
};
|
|
$(function () {
|
var defaultColunms = TReportLoss.initColumn();
|
var table = new BSTable(TReportLoss.id, "/tReportLoss/list", defaultColunms);
|
table.setPaginationType("client");
|
TReportLoss.table = table.init();
|
});
|