feedback.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /**
  2. * 用户反馈管理初始化
  3. */
  4. var Feedback = {
  5. id: "FeedbackTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. Feedback.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
  17. {title: '反馈类型', field: 'type', visible: true, align: 'center', valign: 'middle',width:150,'class': 'uitd_showTip',
  18. formatter: function (value, row, index) {
  19. if(value == 1) {
  20. return "系统BUG";
  21. }if(value == 2) {
  22. return "意见/建议";
  23. }
  24. }
  25. },
  26. {title: '反馈内容', field: 'description', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',},
  27. {title: '反馈时间', field: 'createTime', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',},
  28. {title: '反馈用户', field: 'userName', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',},
  29. {title: '回复内容', field: 'replyContent', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',},
  30. {title: '回复时间', field: 'updateTime', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',},
  31. {title: '回复用户', field: 'updateUser', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',},
  32. ];
  33. };
  34. /**
  35. * 检查是否选中
  36. */
  37. Feedback.check = function () {
  38. var selected = $('#' + this.id).bootstrapTable('getSelections');
  39. if(selected.length == 0){
  40. Feng.info("请先选中表格中的某一记录!");
  41. return false;
  42. }else{
  43. Feedback.seItem = selected[0];
  44. return true;
  45. }
  46. };
  47. /**
  48. * 查询用户反馈列表
  49. */
  50. Feedback.search = function () {
  51. var queryData = {};
  52. queryData['type'] = $("#type").val();
  53. Feedback.table.refresh({query: queryData});
  54. };
  55. /**
  56. * 回复
  57. */
  58. Feedback.back = function(){
  59. if(this.check()){
  60. if(Feedback.seItem.replyContent != null && Feedback.seItem.replyContent != ''){
  61. Feng.info("已回复,无法修改");
  62. return;
  63. }
  64. layer.open({
  65. type: 1,
  66. id: "back",
  67. title: '回复',
  68. area: ['800px', '450px'], //宽高
  69. fix: false, //不固定
  70. shade: 0,
  71. maxmin: true,
  72. content: Feedback.createHtml(),
  73. btn: ['<i class="fa fa-envelope"></i>&nbsp;&nbsp;回复', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  74. btnAlign: 'c',
  75. zIndex: layer.zIndex,
  76. yes: function (index, layero) {
  77. var content = $("#content").val();
  78. if(content == null || content == ''){
  79. Feng.info("请填写回复内容");
  80. return ;
  81. }
  82. var operation = function(){
  83. var ajax = new $ax(Feng.ctxPath + "/feedback/back", function (data) {
  84. if(data.code==200){
  85. Feng.success(data.msg);
  86. Feedback.search();
  87. layer.close(index);
  88. }else{
  89. Feng.error(data.msg);
  90. }
  91. }, function (data) {
  92. Feng.error("回复失败!" + data.responseJSON.message + "!");
  93. });
  94. ajax.setData({"replyContent":content,"id":Feedback.seItem.id});
  95. ajax.start();
  96. }
  97. Feng.confirm("一旦回复无法修改,确定回复吗?", operation);
  98. }
  99. });
  100. }
  101. }
  102. Feedback.createHtml = function(){
  103. return '<form id="firstCheckForm">\n' +
  104. ' <div class="form-group" style="margin: 10px;">\n' +
  105. ' <label for="checkState" class="control-label">回复内容</label>\n' +
  106. ' <textarea class="form-control" id="content" rows="4"></textarea>\n' +
  107. ' </div>\n' +
  108. ' </form>';
  109. }
  110. $(function () {
  111. var defaultColunms = Feedback.initColumn();
  112. var table = new BSTable(Feedback.id, "/api/feedBack/listAdmin", defaultColunms);
  113. table.setPaginationType("server");
  114. Feedback.table = table.init();
  115. });