/** * 用户反馈管理初始化 */ var Feedback = { id: "FeedbackTable", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1 }; /** * 初始化表格的列 */ Feedback.initColumn = function () { return [ {field: 'selectItem', radio: true}, {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, {title: '反馈类型', field: 'type', visible: true, align: 'center', valign: 'middle',width:150,'class': 'uitd_showTip', formatter: function (value, row, index) { if(value == 1) { return "系统BUG"; }if(value == 2) { return "意见/建议"; } } }, {title: '反馈内容', field: 'description', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',}, {title: '反馈时间', field: 'createTime', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',}, {title: '回复内容', field: 'replyContent', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',}, {title: '回复时间', field: 'updateTime', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',} ]; }; /** * 检查是否选中 */ Feedback.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if(selected.length == 0){ Feng.info("请先选中表格中的某一记录!"); return false; }else{ Feedback.seItem = selected[0]; return true; } }; /** * 点击添加用户反馈 */ Feedback.openAddFeedback = function () { var index = layer.open({ type: 2, title: '添加用户反馈', area: ['800px', '420px'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/api/feedBack/feedback_add' }); this.layerIndex = index; }; /** * 打开查看用户反馈详情 */ Feedback.openFeedbackDetail = function () { if (this.check()) { var index = layer.open({ type: 2, title: '用户反馈详情', area: ['800px', '420px'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/feedback/feedback_update/' + Feedback.seItem.id }); this.layerIndex = index; } }; /** * 删除用户反馈 */ Feedback.delete = function () { if (this.check()) { var ajax = new $ax(Feng.ctxPath + "/feedback/delete", function (data) { Feng.success("删除成功!"); Feedback.table.refresh(); }, function (data) { Feng.error("删除失败!" + data.responseJSON.message + "!"); }); ajax.set("feedbackId",this.seItem.id); ajax.start(); } }; /** * 查询用户反馈列表 */ Feedback.search = function () { var queryData = {}; queryData['type'] = $("#type").val(); Feedback.table.refresh({query: queryData}); }; $(function () { var defaultColunms = Feedback.initColumn(); var table = new BSTable(Feedback.id, "/api/feedBack/list", defaultColunms); table.setPaginationType("server"); Feedback.table = table.init(); });