Pu Zhibing
7 天以前 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
 * 短信记录管理初始化
 */
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();
});