feedback.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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: 'replyContent', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',},
  29. {title: '回复时间', field: 'updateTime', visible: true, align: 'center', valign: 'middle',width:200,'class': 'uitd_showTip',}
  30. ];
  31. };
  32. /**
  33. * 检查是否选中
  34. */
  35. Feedback.check = function () {
  36. var selected = $('#' + this.id).bootstrapTable('getSelections');
  37. if(selected.length == 0){
  38. Feng.info("请先选中表格中的某一记录!");
  39. return false;
  40. }else{
  41. Feedback.seItem = selected[0];
  42. return true;
  43. }
  44. };
  45. /**
  46. * 点击添加用户反馈
  47. */
  48. Feedback.openAddFeedback = function () {
  49. var index = layer.open({
  50. type: 2,
  51. title: '添加用户反馈',
  52. area: ['800px', '420px'], //宽高
  53. fix: false, //不固定
  54. maxmin: true,
  55. content: Feng.ctxPath + '/api/feedBack/feedback_add'
  56. });
  57. this.layerIndex = index;
  58. };
  59. /**
  60. * 打开查看用户反馈详情
  61. */
  62. Feedback.openFeedbackDetail = function () {
  63. if (this.check()) {
  64. var index = layer.open({
  65. type: 2,
  66. title: '用户反馈详情',
  67. area: ['800px', '420px'], //宽高
  68. fix: false, //不固定
  69. maxmin: true,
  70. content: Feng.ctxPath + '/feedback/feedback_update/' + Feedback.seItem.id
  71. });
  72. this.layerIndex = index;
  73. }
  74. };
  75. /**
  76. * 删除用户反馈
  77. */
  78. Feedback.delete = function () {
  79. if (this.check()) {
  80. var ajax = new $ax(Feng.ctxPath + "/feedback/delete", function (data) {
  81. Feng.success("删除成功!");
  82. Feedback.table.refresh();
  83. }, function (data) {
  84. Feng.error("删除失败!" + data.responseJSON.message + "!");
  85. });
  86. ajax.set("feedbackId",this.seItem.id);
  87. ajax.start();
  88. }
  89. };
  90. /**
  91. * 查询用户反馈列表
  92. */
  93. Feedback.search = function () {
  94. var queryData = {};
  95. queryData['type'] = $("#type").val();
  96. Feedback.table.refresh({query: queryData});
  97. };
  98. $(function () {
  99. var defaultColunms = Feedback.initColumn();
  100. var table = new BSTable(Feedback.id, "/api/feedBack/list", defaultColunms);
  101. table.setPaginationType("server");
  102. Feedback.table = table.init();
  103. });