appLeaveList.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <script>
  3. $(document).ready(function() {
  4. $('#appLeaveTable').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/leave/appLeave/dataList",
  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. contextMenuTrigger:"right",//pc端 按右键弹出菜单
  53. contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
  54. contextMenu: '#context-menu',
  55. onContextMenuItem: function(row, $el){
  56. },
  57. onClickRow: function(row, $el){
  58. },
  59. onShowSearch: function () {
  60. $("#search-collapse").slideToggle();
  61. },
  62. columns: [{
  63. checkbox: true
  64. }
  65. ,{
  66. field: 'applyName',
  67. title: '申请人姓名',
  68. sortable: true,
  69. sortName: 'applyName'
  70. ,formatter:function(value, row , index){
  71. value = jp.unescapeHTML(value);
  72. <c:choose>
  73. <c:when test="${fns:hasPermission('app:leave:appLeave:view')}">
  74. return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
  75. </c:when>
  76. <c:otherwise>
  77. return value;
  78. </c:otherwise>
  79. </c:choose>
  80. }
  81. },{
  82. field: 'title',
  83. title: '请假类型',
  84. sortable: true,
  85. sortName: 'title'
  86. },{
  87. field: 'content',
  88. title: '请假事由',
  89. sortable: true,
  90. sortName: 'content'
  91. },{
  92. field: 'comment',
  93. title: '审批意见',
  94. sortable: true,
  95. sortName: 'comment'
  96. },{
  97. field: 'status',
  98. title: '审批状态',
  99. sortable: true,
  100. sortName: 'status',
  101. formatter:function(value, row , index){
  102. return jp.getDictLabel(${fns:toJson(fns:getDictList('status'))}, value, "-");
  103. }
  104. },{
  105. field: 'leaveStartTime',
  106. title: '请假开始时间',
  107. sortable: true,
  108. sortName: 'leaveStartTime'
  109. },{
  110. field: 'leaveEndTime',
  111. title: '请假结束时间',
  112. sortable: true,
  113. sortName: 'leaveEndTime'
  114. }
  115. ]
  116. });
  117. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
  118. $('#appLeaveTable').bootstrapTable("toggleView");
  119. }
  120. $('#appLeaveTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
  121. 'check-all.bs.table uncheck-all.bs.table', function () {
  122. $('#remove').prop('disabled', ! $('#appLeaveTable').bootstrapTable('getSelections').length);
  123. $('#view,#edit').prop('disabled', $('#appLeaveTable').bootstrapTable('getSelections').length!=1);
  124. });
  125. $("#search").click("click", function() {// 绑定查询按扭
  126. $('#appLeaveTable').bootstrapTable('refresh');
  127. });
  128. $("#reset").click("click", function() {// 绑定查询按扭
  129. $("#searchForm input").val("");
  130. $("#searchForm select").val("");
  131. $("#searchForm .select-item").html("");
  132. $('#appLeaveTable').bootstrapTable('refresh');
  133. });
  134. });
  135. function getIdSelections() {
  136. return $.map($("#appLeaveTable").bootstrapTable('getSelections'), function (row) {
  137. return row.id
  138. });
  139. }
  140. /*function deleteAll(){
  141. jp.confirm('确认要删除该奖惩公告记录吗?', function(){
  142. jp.loading();
  143. jp.get("${ctx}/leader/awards/appLeave/deleteAll?ids=" + getIdSelections(), function(data){
  144. if(data.success){
  145. $('#appLeaveTable').bootstrapTable('refresh');
  146. jp.success(data.msg);
  147. }else{
  148. jp.error(data.msg);
  149. }
  150. })
  151. })
  152. }
  153. function refresh(){
  154. $('#appLeaveTable').bootstrapTable('refresh');
  155. }
  156. function add(){
  157. jp.go("${ctx}/leader/awards/appLeave/form/add");
  158. }
  159. */
  160. function view(id) {
  161. if(id == undefined){
  162. id = getIdSelections();
  163. }
  164. jp.go("${ctx}/app/leave/appLeave/form/view?oprType=view&id=" + id);
  165. }
  166. </script>