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
159
160
161
162
163
164
165
166
/**
 * 管理初始化
 */
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] + '\')"/>&nbsp;&nbsp;&nbsp;&nbsp;'
                    }
                    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();
});