123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- /**
- * 用户反馈管理初始化
- */
- 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: 'userName', 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',},
- {title: '回复用户', field: 'updateUser', 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.search = function () {
- var queryData = {};
- queryData['type'] = $("#type").val();
- Feedback.table.refresh({query: queryData});
- };
- /**
- * 回复
- */
- Feedback.back = function(){
- if(this.check()){
- if(Feedback.seItem.replyContent != null && Feedback.seItem.replyContent != ''){
- Feng.info("已回复,无法修改");
- return;
- }
- layer.open({
- type: 1,
- id: "back",
- title: '回复',
- area: ['800px', '450px'], //宽高
- fix: false, //不固定
- shade: 0,
- maxmin: true,
- content: Feedback.createHtml(),
- btn: ['<i class="fa fa-envelope"></i> 回复', '<i class="fa fa-eraser"></i> 关闭'],
- btnAlign: 'c',
- zIndex: layer.zIndex,
- yes: function (index, layero) {
- var content = $("#content").val();
- if(content == null || content == ''){
- Feng.info("请填写回复内容");
- return ;
- }
- var operation = function(){
- var ajax = new $ax(Feng.ctxPath + "/feedback/back", function (data) {
- if(data.code==200){
- Feng.success(data.msg);
- Feedback.search();
- layer.close(index);
- }else{
- Feng.error(data.msg);
- }
- }, function (data) {
- Feng.error("回复失败!" + data.responseJSON.message + "!");
- });
- ajax.setData({"replyContent":content,"id":Feedback.seItem.id});
- ajax.start();
- }
- Feng.confirm("一旦回复无法修改,确定回复吗?", operation);
- }
- });
- }
- }
- Feedback.createHtml = function(){
- return '<form id="firstCheckForm">\n' +
- ' <div class="form-group" style="margin: 10px;">\n' +
- ' <label for="checkState" class="control-label">回复内容</label>\n' +
- ' <textarea class="form-control" id="content" rows="4"></textarea>\n' +
- ' </div>\n' +
- ' </form>';
- }
- $(function () {
- var defaultColunms = Feedback.initColumn();
- var table = new BSTable(Feedback.id, "/api/feedBack/listAdmin", defaultColunms);
- table.setPaginationType("server");
- Feedback.table = table.init();
- });
|