modelList.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <script>
  3. $(document).ready(function() {
  4. $('#actModelTable').bootstrapTable({
  5. method: 'post',
  6. //类型json
  7. dataType: "json",
  8. contentType: "application/x-www-form-urlencoded",
  9. //显示检索按钮
  10. showSearch: true,
  11. //显示刷新按钮
  12. showRefresh: true,
  13. //显示切换手机试图按钮
  14. showToggle: true,
  15. //显示 内容列下拉框
  16. showColumns: true,
  17. //显示到处按钮
  18. showExport: true,
  19. //显示切换分页按钮
  20. showPaginationSwitch: true,
  21. //最低显示2行
  22. minimumCountColumns: 2,
  23. //是否显示行间隔色
  24. striped: true,
  25. //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  26. cache: false,
  27. //是否显示分页(*)
  28. pagination: true,
  29. //排序方式
  30. sortOrder: "asc",
  31. //初始化加载第一页,默认第一页
  32. pageNumber:1,
  33. //每页的记录行数(*)
  34. pageSize: 10,
  35. //可供选择的每页的行数(*)
  36. pageList: [10, 25, 50, 100],
  37. //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
  38. url: "${ctx}/act/model/data",
  39. //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
  40. //queryParamsType:'',
  41. ////查询参数,每次调用是会带上这个参数,可自定义
  42. queryParams : function(params) {
  43. var searchParam = $("#searchForm").serializeJSON();
  44. searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
  45. searchParam.pageSize = params.limit === undefined? -1 : params.limit;
  46. searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
  47. return searchParam;
  48. },
  49. onShowSearch: function () {
  50. $("#search-collapse").slideToggle();
  51. },
  52. //分页方式:client客户端分页,server服务端分页(*)
  53. sidePagination: "server",
  54. contextMenuTrigger:"right",//pc端 按右键弹出菜单
  55. contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
  56. contextMenu: '#context-menu',
  57. onContextMenuItem: function(row, $el){
  58. if($el.data("item") == "delete"){
  59. del(row.id);
  60. }
  61. },
  62. onClickRow: function(row, $el){
  63. },
  64. columns: [{
  65. checkbox: true
  66. }
  67. ,{
  68. field: 'category',
  69. title: '流程分类',
  70. sortable: false,
  71. formatter:function(value, row , index){
  72. return jp.getDictLabel(${fns:toJson(fns:getDictList('act_category'))}, value, "-");
  73. }
  74. }
  75. ,{
  76. field: 'key',
  77. title: '模型标识',
  78. sortable: false
  79. }
  80. ,{
  81. field: 'name',
  82. title: '模型名称',
  83. sortable: true
  84. }
  85. ,{
  86. field: 'version',
  87. title: '版本号',
  88. sortable: false
  89. }
  90. ,{
  91. field: 'createTime',
  92. title: '创建时间',
  93. sortable: false,
  94. formatter:function (value, row, index) {
  95. return jp.dateFormat(value,"yyyy-MM-dd hh:mm:ss");
  96. }
  97. }
  98. ,{
  99. field: 'lastUpdateTime',
  100. title: '最后更新时间',
  101. sortable: false,
  102. formatter:function (value, row, index) {
  103. return jp.dateFormat(value,"yyyy-MM-dd hh:mm:ss");
  104. }
  105. }, {
  106. field: 'operate',
  107. title: '操作',
  108. align: 'center',
  109. events: {
  110. 'click .deploy': function (e, value, row, index) {
  111. jp.confirm('确认要部署该模型吗?',function () {
  112. jp.get("${ctx}/act/model/deploy?id="+row.id,function (data) {
  113. if(data.success){
  114. jp.success(data.msg);
  115. $('#actModelTable').bootstrapTable('refresh');
  116. }else{
  117. jp.error(data.msg);
  118. }
  119. })
  120. })
  121. },
  122. 'click .del': function (e, value, row, index) {
  123. del(row.id);
  124. }
  125. },
  126. formatter: function operateFormatter(value, row, index) {
  127. return [
  128. <shiro:hasPermission name="act:model:edit">
  129. '<a class="" href="${pageContext.request.contextPath}/act/rest/modeler.html?modelId='+row.id+'" target="_blank">【在线设计】</a>',
  130. </shiro:hasPermission>
  131. <shiro:hasPermission name="act:model:deploy">
  132. '<a class="deploy" href="#">【部署】</a>',
  133. </shiro:hasPermission>
  134. <shiro:hasPermission name="act:model:export">
  135. '<a class="" href="${ctx}/act/model/export?id='+row.id+'" target="_blank">【导出】</a>',
  136. </shiro:hasPermission>
  137. <shiro:hasPermission name="act:model:del">
  138. '<a href="#" class="del">【删除】</a>'
  139. </shiro:hasPermission>
  140. ].join('');
  141. }
  142. }
  143. ]
  144. });
  145. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
  146. $('#actModelTable').bootstrapTable("toggleView");
  147. }
  148. $('#actModelTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
  149. 'check-all.bs.table uncheck-all.bs.table', function () {
  150. $('#remove').prop('disabled', ! $('#actModelTable').bootstrapTable('getSelections').length);
  151. });
  152. $("#search").click("click", function() {// 绑定查询按扭
  153. $('#actModelTable').bootstrapTable('refresh');
  154. });
  155. $("#reset").click("click", function() {// 绑定查询按扭
  156. $("#searchForm input").val("");
  157. $("#searchForm select").val("");
  158. $("#searchForm .select-item").html("");
  159. $('#actModelTable').bootstrapTable('refresh');
  160. });
  161. });
  162. Date.prototype.format = function(format) {
  163. };
  164. function getIdSelections() {
  165. return $.map($("#actModelTable").bootstrapTable('getSelections'), function (row) {
  166. return row.id
  167. });
  168. }
  169. function deleteAll(){
  170. jp.confirm('确认要删除该模型记录吗?', function(){
  171. jp.loading();
  172. jp.get("${ctx}/act/model/deleteAll?ids=" + getIdSelections(), function(data){
  173. if(data.success){
  174. $('#actModelTable').bootstrapTable('refresh');
  175. jp.success(data.msg);
  176. }else{
  177. jp.error(data.msg);
  178. }
  179. })
  180. })
  181. }
  182. function del(id) {
  183. jp.confirm('确认要删除该模型记录吗?', function() {
  184. jp.loading();
  185. jp.get("${ctx}/act/model/delete?id=" + id, function (data) {
  186. if (data.success) {
  187. $('#actModelTable').bootstrapTable('refresh');
  188. jp.success(data.msg);
  189. } else {
  190. jp.error(data.msg);
  191. }
  192. })
  193. })
  194. }
  195. function add(){
  196. jp.openSaveDialog('新增模型', "${ctx}/act/model/create",'800px', '500px');
  197. };
  198. function refresh() {
  199. $('#actModelTable').bootstrapTable('refresh');
  200. }
  201. </script>