appComplaintInfoList.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <script>
  3. $(document).ready(function() {
  4. $('#appComplaintInfoTable').bootstrapTable({
  5. //请求方法
  6. method: 'post',
  7. //类型json
  8. dataType: "json",
  9. contentType: "application/x-www-form-urlencoded",
  10. //显示检索按钮
  11. showSearch: true,
  12. //显示刷新按钮
  13. showRefresh: true,
  14. //显示切换手机试图按钮
  15. showToggle: true,
  16. //显示 内容列下拉框
  17. showColumns: true,
  18. //显示到处按钮
  19. showExport: false,
  20. //显示切换分页按钮
  21. showPaginationSwitch: true,
  22. //最低显示2行
  23. minimumCountColumns: 2,
  24. //是否显示行间隔色
  25. striped: true,
  26. //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  27. cache: false,
  28. //是否显示分页(*)
  29. pagination: true,
  30. //排序方式
  31. sortOrder: "asc",
  32. //初始化加载第一页,默认第一页
  33. pageNumber:1,
  34. //每页的记录行数(*)
  35. pageSize: 10,
  36. //可供选择的每页的行数(*)
  37. pageList: [10, 25, 50, 100],
  38. //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
  39. url: "${ctx}/app/complaint/appComplaintInfo/data",
  40. //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
  41. //queryParamsType:'',
  42. ////查询参数,每次调用是会带上这个参数,可自定义
  43. queryParams : function(params) {
  44. var searchParam = $("#searchForm").serializeJSON();
  45. searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
  46. searchParam.pageSize = params.limit === undefined? -1 : params.limit;
  47. searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
  48. return searchParam;
  49. },
  50. //分页方式:client客户端分页,server服务端分页(*)
  51. sidePagination: "server",
  52. onClickRow: function(row, $el){
  53. },
  54. onShowSearch: function () {
  55. $("#search-collapse").slideToggle();
  56. },
  57. columns: [{
  58. checkbox: true
  59. }
  60. ,{
  61. field: 'title',
  62. title: '标题',
  63. sortable: true,
  64. sortName: 'title'
  65. ,formatter:function(value, row , index){
  66. value = jp.unescapeHTML(value);
  67. return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
  68. }
  69. }
  70. ,{
  71. field: 'content',
  72. title: '内容',
  73. sortable: true,
  74. sortName: 'content'
  75. }
  76. ,{
  77. field: 'createDate',
  78. title: '创建时间',
  79. sortable: true,
  80. sortName: 'createDate'
  81. }
  82. ]
  83. });
  84. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
  85. $('#appComplaintInfoTable').bootstrapTable("toggleView");
  86. }
  87. $('#appComplaintInfoTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
  88. 'check-all.bs.table uncheck-all.bs.table', function () {
  89. $('#remove').prop('disabled', ! $('#appComplaintInfoTable').bootstrapTable('getSelections').length);
  90. $('#view,#edit').prop('disabled', $('#appComplaintInfoTable').bootstrapTable('getSelections').length!=1);
  91. });
  92. $("#btnImport").click(function(){
  93. jp.open({
  94. type: 2,
  95. area: [500, 200],
  96. auto: true,
  97. title:"导入数据",
  98. content: "${ctx}/tag/importExcel" ,
  99. btn: ['下载模板','确定', '关闭'],
  100. btn1: function(index, layero){
  101. jp.downloadFile('${ctx}/app/complaint/appComplaintInfo/import/template');
  102. },
  103. btn2: function(index, layero){
  104. var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
  105. iframeWin.contentWindow.importExcel('${ctx}/app/complaint/appComplaintInfo/import', function (data) {
  106. if(data.success){
  107. jp.success(data.msg);
  108. refresh();
  109. }else{
  110. jp.error(data.msg);
  111. }
  112. });//调用保存事件
  113. jp.close(index);
  114. },
  115. btn3: function(index){
  116. jp.close(index);
  117. }
  118. });
  119. });
  120. $("#export").click(function(){//导出Excel文件
  121. jp.downloadFile('${ctx}/app/complaint/appComplaintInfo/export');
  122. });
  123. $("#search").click("click", function() {// 绑定查询按扭
  124. $('#appComplaintInfoTable').bootstrapTable('refresh');
  125. });
  126. $("#reset").click("click", function() {// 绑定查询按扭
  127. $("#searchForm input").val("");
  128. $("#searchForm select").val("");
  129. $("#searchForm .select-item").html("");
  130. $('#appComplaintInfoTable').bootstrapTable('refresh');
  131. });
  132. });
  133. function getIdSelections() {
  134. return $.map($("#appComplaintInfoTable").bootstrapTable('getSelections'), function (row) {
  135. return row.id
  136. });
  137. }
  138. function deleteAll(){
  139. jp.confirm('确认要删除该12380举报信箱记录吗?', function(){
  140. jp.loading();
  141. jp.get("${ctx}/app/complaint/appComplaintInfo/deleteAll?ids=" + getIdSelections(), function(data){
  142. if(data.success){
  143. $('#appComplaintInfoTable').bootstrapTable('refresh');
  144. jp.success(data.msg);
  145. }else{
  146. jp.error(data.msg);
  147. }
  148. })
  149. })
  150. }
  151. //刷新列表
  152. function refresh(){
  153. $('#appComplaintInfoTable').bootstrapTable('refresh');
  154. }
  155. function add(){
  156. jp.openSaveDialog('新增12380举报信箱', "${ctx}/app/complaint/appComplaintInfo/form",'800px', '500px');
  157. }
  158. function edit(id){//没有权限时,不显示确定按钮
  159. if(id == undefined){
  160. id = getIdSelections();
  161. }
  162. jp.openSaveDialog('编辑12380举报信箱', "${ctx}/app/complaint/appComplaintInfo/form?id=" + id, '800px', '500px');
  163. }
  164. function view(id){//没有权限时,不显示确定按钮
  165. if(id == undefined){
  166. id = getIdSelections();
  167. }
  168. jp.openViewDialog('查看12380举报信箱', "${ctx}/app/complaint/appComplaintInfo/form?oprType=view&id=" + id, '800px', '500px');
  169. }
  170. </script>