puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/**
 * 投诉列表管理初始化
 */
var TComplaint = {
    id: "TComplaintTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
var language =$("#language").val()
/**
 * 初始化表格的列
 */
TComplaint.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
        {title: language==1?'投诉时间':(language==2?'Complaint time':'Waktu keluhan'), field: 'insert_time', visible: true, align: 'center', valign: 'middle',width:'10%',
        },
        {title: language==1?'投诉人昵称':(language==2?'Nickname of complainants':'Nama panggilan pengadu'), field: 'userName', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'投诉人<br/>电话':(language==2?'Telephone number of complainants':'Nomor telepon pengadu'), field: 'userPhone', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'投诉司机<br/>电话':(language==2?'Complaint driver telephone':'Telepon pengemudi pengaduan'), field: 'driverPhone', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'投诉<br/>原因':(language==2?'Reasons for complaint':'Alasan keluhan'), field: 'reason', visible: true, align: 'center', valign: 'middle',
        },
        {title:  language==1?'描述':(language==2?'Description':'Keterangan'), field: 'description', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.description != '' && row.description != null) {
                    var str = row.description;
                    if (str.length > 20){
                        if(language==1){
                            str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 2+ ')">查看更多</button>';
 
                        }else if(language==2){
                            str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 2+ ')">view more</button>';
 
                        }else {
                            str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 2+ ')">lihat lebih</button>';
                        }
                    }
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.description + '" onfocus="TUser.tooltip()">' + str + '</p>']
                }
                return btn;
            }
        },
        {title: language==1?'备注':(language==2?'Remarks':'Catatan'), field: 'handleResult', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.handleResult != '' && row.handleResult != null) {
                    var str = row.handleResult;
                    if (str.length > 20){
                        if(language==1){
                            str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 3+ ')">查看更多</button>';
                        }else if(language==2){
                            str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 3+ ')">view more</button>';
                        }else {
                            str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 3+ ')">lihat lebih</button>';
                        }
 
                    }
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleResult + '" onfocus="TUser.tooltip()">' + str + '</p>']
                }
                return btn;
            }
        },
        {title:  language==1?'状态':(language==2?'State':'Status'), field: 'isHandle', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                var btn = "";
                if(language==1){
                    if(row.isHandle != '' && row.isHandle != null) {
                        if (row.isHandle == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已处理" onfocus="TUser.tooltip()">已处理</p>']
                        }
                    }else{
                        btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="未处理" onfocus="TUser.tooltip()">未处理</p>']
                    }
                }else if(language==2){
                    if(row.isHandle != '' && row.isHandle != null) {
                        if (row.isHandle == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Has been processed" onfocus="TUser.tooltip()">Has been processed</p>']
                        }
                    }else{
                        btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="Fail to be disposed" onfocus="TUser.tooltip()">Fail to be disposed</p>']
                    }
                }else {
                    if(row.isHandle != '' && row.isHandle != null) {
                        if (row.isHandle == 1){
                            btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="Telah diproses" onfocus="TUser.tooltip()">Telah diproses</p>']
                        }
                    }else{
                        btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="Gagal untuk dibuang" onfocus="TUser.tooltip()">Gagal untuk dibuang</p>']
                    }
                }
 
                return btn;
            }
        },
        {title: language==1?'处理时间':(language==2?'Processing time':'Waktu memproses'), field: 'handleTime', visible: true, align: 'center', valign: 'middle',width:'10%',
        },
        {title: language==1?'处理人':(language==2?'Dealer':'Pedagang'), field: 'handleUser', visible: true, align: 'center', valign: 'middle',width:'10%',
        }
    ];
};
 
/**
 * 查看更多按钮
 * @param con
 */
TComplaint.buttonClick = function (id,type) {
    var index = layer.open({
        type: 2,
         title: language==1?'查看详情':(language==2?'View details':'Melihat rincian'),
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tComplaint/lookDetail/'+id+"/"+type
    });
    this.layerIndex = index;
}
 
 
 
/**
 * 检查是否选中
 */
TComplaint.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        TComplaint.seItem = selected[0];
        return true;
    }
};
 
/**
 * 立即处理
 */
TComplaint.immediately = function(){
    if (this.check()) {
        if (TComplaint.seItem.isHandle == 1) {
            if(language==1){
                swal("处理失败", "【未处理】状态下才能执行此操作", "warning");
            }else if(language==2){
                swal("Fail", "This operation can only be performed in processing failre [unprocessed] status.", "warning");
            }else {
                swal("Gagal", "Operasi ini hanya dapat dilakukan dalam status pemrosesan failre [yang tidak diproses].", "warning");
            }
 
            return;
        }
        var index = layer.open({
            type: 2,
            title: language==1?'立即处理':(language==2?'Immediately processe':'Segera memproses'),
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tComplaint/tComplaint_immediately/' + TComplaint.seItem.id
        });
        this.layerIndex = index;
    }
}
 
/**
 * 删除投诉列表
 */
TComplaint.delete = function () {
    if (this.check()) {
        if (TComplaint.seItem.isHandle != 1) {
            if(language==1){
                swal("删除失败", "【已处理】状态下才能执行此操作", "warning");
            }else if(language==2){
                swal("Failed to delete", "This operation can only be performed in the [processed] state", "warning");
            }else {
                swal("Hapus Gagal", "Operasi ini hanya dapat dilakukan dalam keadaan [proses]", "warning");
            }
 
            return;
        }
        swal({
            title: language==1?"您是否确认删除该投诉记录":(language==2?'Do you confirm to delete the complaint record':'Apakah Anda mengkonfirmasi untuk menghapus catatan keluhan'),
            text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'),
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'),
            closeOnConfirm: false
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/tComplaint/delete", function (data) {
                if(language==1){
                    swal("删除成功", "您已经删除了该投诉记录。", "success");
                }else if(language==2){
                    swal("Success", "You have deleted the complaint record。", "success");
                }else {
                    swal("Success", "Anda telah menghapus catatan keluhan。", "success");
                }
 
                TComplaint.table.refresh();
            }, function (data) {
                if(language==1){
                    swal("删除失败", data.responseJSON.message + "!", "warning");
                }else if(language==2){
                    swal("Failed to delete", data.responseJSON.message + "!", "warning");
                }else {
                    swal("Hapus Gagal", data.responseJSON.message + "!", "warning");
                }
            });
            ajax.set("tComplaintId", TComplaint.seItem.id);
            ajax.start();
        });
    }
};
 
/**
 * 查询投诉列表列表
 */
TComplaint.search = function () {
    var queryData = {};
    queryData['insertTime'] = $("#insertTime").val();
    queryData['userName'] = $("#userName").val();
    queryData['userPhone'] = $("#userPhone").val();
    queryData['driverPhone'] = $("#driverPhone").val();
    queryData['isHandle'] = $("#isHandle").val();
    TComplaint.table.refresh({query: queryData});
};
 
TComplaint.resetSearch = function () {
    $("#insertTime").val("");
    $("#userName").val("");
    $("#userPhone").val("");
    $("#driverPhone").val("");
    $("#isHandle").val("");
    TComplaint.search();
};
 
$(function () {
    var defaultColunms = TComplaint.initColumn();
    var table = new BSTable(TComplaint.id, "/tComplaint/list", defaultColunms);
    table.setPaginationType("server");
    TComplaint.table = table.init();
});