appPartyBuildingList.js 8.7 KB

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