/** * 反馈管理管理初始化 */ var TFeedback = { id: "TFeedbackTable", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1 }; var language =$("#language").val() /** * 初始化表格的列 */ TFeedback.initColumn = function () { return [ {field: 'selectItem', radio: true}, {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, {title: language==1?'反馈时间':(language==2?'Feedback time':'Waktu umpan balik'), field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'10%', formatter: function (value, row) { return currentTime(value); } }, {title: language==1?'反馈人ID':(language==2?'Feedback person ID':'ID orang balas balik'), field: 'userId', visible: false, align: 'center', valign: 'middle'}, {title: language==1?'反馈人':(language==2?'Feedback person':'Orang umpan balik'), field: 'userName', visible: true, align: 'center', valign: 'middle', }, {title: language==1?'反馈人
手机号':(language==2?'Feedback mobile phone number':'Umpan Balik Nomor Ponsel'), field: 'userPhone', visible: true, align: 'center', valign: 'middle', }, {title:language==1?'反馈内容':(language==2?'Feedback contents':'Isi Umpan Balik') , field: 'content', visible: true, align: 'center', valign: 'middle',width:'15%', formatter: function (value, row) { var btn = ""; if(row.content != '' && row.content != null) { var str = row.content; if (str.length > 20){ if(language==1){ str = str.substring(0,20)+'...
'; }else if (language==2){ str = str.substring(0,20)+'...
'; }else { str = str.substring(0,20)+'...
'; } } btn = ['

' + str + '

'] } return btn; } }, {title: language==1?'备注':(language==2?'Remarks':'Catatan'), field: 'remark', visible: true, align: 'center', valign: 'middle',width:'15%', formatter: function (value, row) { var btn = ""; if(row.remark != '' && row.remark != null) { var str = row.remark; if (str.length > 20){ if(language==1){ str = str.substring(0,20)+'...
'; }else if (language==2){ str = str.substring(0,20)+'...
'; }else { str = str.substring(0,20)+'...
'; } } btn = ['

' + str + '

'] } return btn; } }, {title:language==1?'状态':(language==2?'State':'Status'), field: 'state', visible: true, align: 'center', valign: 'middle', formatter: function (value, row) { var btn = ""; if(row.state != '' && row.state != null) { if(language==1){ if (row.state == 1){ btn = ['

未处理

'] } else if (row.state == 2){ btn = ['

已处理

'] } }else if (language==2){ if (row.state == 1){ btn = ['

Fail to be disposed

'] } else if (row.state == 2){ btn = ['

Has been processed

'] } }else { if (row.state == 1){ btn = ['

Gagal untuk dibuang

'] } else if (row.state == 2){ btn = ['

Telah diproses

'] } } } return btn; } }, {title: language==1?'处理时间':(language==2?'Processing time':'Waktu memproses'), field: 'cldate', visible: true, align: 'center', valign: 'middle',width:'10%', formatter: function (value, row) { if (value == null || value == '') { return ""; } else { return currentTime(value); } } }, {title: language==1?'处理人Id':(language==2?'Handler Id':'ID Pengendali'), field: 'handleUserId', visible: false, align: 'center', valign: 'middle'}, {title:language==1?'处理人':(language==2?'Dealer':'Pedagang'), field: 'handleUserName', visible: true, align: 'center', valign: 'middle', formatter: function (value, row) { var btn = ""; if(row.handleUserName != '' && row.handleUserName != null) { btn = ['

' + row.handleUserName+ '

'] } return btn; } } ]; }; function currentTime(timestamp){ var time = timestamp + ''; if(time.length != 13){ timestamp = timestamp * 1000; } var date = new Date(timestamp);; var Y = date.getFullYear() + '-'; var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' '; var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':'; var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':'; var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()); var strDate = Y + M + D + h + m + s; return strDate } /** * 查看更多按钮 * @param con */ TFeedback.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 + '/tFeedback/lookDetail/'+id+"/"+type }); this.layerIndex = index; } /** * 检查是否选中 */ TFeedback.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if(selected.length == 0){ Feng.info("请先选中表格中的某一记录!"); return false; }else{ TFeedback.seItem = selected[0]; return true; } }; /** * 立即处理 */ TFeedback.immediately = function(){ if (this.check()) { if (TFeedback.seItem.state != 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 + '/tFeedback/tFeedback_immediately/' + TFeedback.seItem.id+"/"+2 }); this.layerIndex = index; } } /** * 删除反馈管理 */ TFeedback.delete = function () { if (this.check()) { var ajax = new $ax(Feng.ctxPath + "/tFeedback/delete", function (data) { Feng.success("删除成功!"); TFeedback.table.refresh(); }, function (data) { Feng.error("删除失败!" + data.responseJSON.message + "!"); }); ajax.set("tFeedbackId",this.seItem.id); ajax.start(); } }; /** * 查询反馈管理列表 */ TFeedback.search = function () { var queryData = {}; queryData['insertTime'] = $("#insertTime").val(); queryData['driverName'] = $("#driverName").val(); queryData['driverPhone'] = $("#driverPhone").val(); queryData['state'] = $("#state").val(); TFeedback.table.refresh({query: queryData}); }; TFeedback.resetSearch = function () { $("#insertTime").val(""); $("#driverName").val(""); $("#driverPhone").val(""); $("#state").val(""); TFeedback.search(); }; $(function () { var defaultColunms = TFeedback.initColumn(); var table = new BSTable(TFeedback.id, "/tFeedback/list", defaultColunms); table.setPaginationType("server"); TFeedback.table = table.init(); });