/**
|
* 短信记录管理初始化
|
*/
|
var TSmsrecord = {
|
id: "TSmsrecordTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TSmsrecord.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '序号', 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: '接收人手机号', field: 'phone', visible: true, align: 'center', valign: 'middle',
|
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: '发送内容', field: 'content', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.content != '' && row.content != null) {
|
var str = row.content;
|
if (str.length > 50){
|
str = str.substring(0,50)+'...<br><button class="btn btn-outline btn-primary" onclick="TSmsrecord.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: 'result', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="成功" onfocus="TUser.tooltip()">成功</p>']
|
return btn;
|
}
|
}
|
];
|
};
|
|
/**
|
* 查看更多按钮
|
* @param con
|
*/
|
TSmsrecord.buttonClick = function (id,type) {
|
var index = layer.open({
|
type: 2,
|
title: '查看详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSmsrecord/lookDetail/'+id+"/"+type
|
});
|
this.layerIndex = index;
|
}
|
|
/**
|
* 检查是否选中
|
*/
|
TSmsrecord.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TSmsrecord.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加短信记录
|
*/
|
TSmsrecord.openAddTSmsrecord = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加短信记录',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSmsrecord/tSmsrecord_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看短信记录详情
|
*/
|
TSmsrecord.openTSmsrecordDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '短信记录详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSmsrecord/tSmsrecord_update/' + TSmsrecord.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除短信记录
|
*/
|
TSmsrecord.delete = function () {
|
if (this.check()) {
|
var ajax = new $ax(Feng.ctxPath + "/tSmsrecord/delete", function (data) {
|
Feng.success("删除成功!");
|
TSmsrecord.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tSmsrecordId",this.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 查询短信记录列表
|
*/
|
TSmsrecord.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['phone'] = $("#phone").val();
|
TSmsrecord.table.refresh({query: queryData});
|
};
|
|
TSmsrecord.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#phone").val("");
|
TSmsrecord.search();
|
};
|
|
$(function () {
|
var defaultColunms = TSmsrecord.initColumn();
|
var table = new BSTable(TSmsrecord.id, "/tSmsrecord/list", defaultColunms);
|
table.setPaginationType("server");
|
TSmsrecord.table = table.init();
|
});
|