procdef-tmpl-list.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>列表页面</title>
  5. <!--#include file="common/_header.html"-->
  6. <style>
  7. .table .center{
  8. text-align:center;
  9. }
  10. </style>
  11. </head>
  12. <body>
  13. <nav class="breadcrumb">
  14. <i class="Hui-iconfont">&#xe67f;</i>
  15. 首页
  16. <span class="c-gray en">&gt;</span> <label id="processName"></label>
  17. <span class="c-gray en">&gt;</span> 模板列表
  18. <a class="btn btn-success radius r"
  19. style="line-height: 1.6em; margin-top: 3px"
  20. href="javascript:location.replace(location.href);" title="刷新">
  21. <i class="Hui-iconfont">&#xe68f;</i></a>
  22. </nav>
  23. <div class="page-container">
  24. <div class="container mb-10">
  25. <form>
  26. <div class="row mb-10">
  27. <input type="text" class="input-text" style="width: 250px" placeholder="输入标题" id="title" name="title">
  28. <button id="btnSearch" type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
  29. <button id="btnReset" type="reset" class="btn btn-default"><i class="Hui-iconfont">&#xe68f;</i> 重置</button>
  30. </div>
  31. </form>
  32. </div>
  33. <div class="cl pd-5 bg-1 bk-gray">
  34. <span class="l">
  35. <!-- <a href="javascript:batch_del();" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i>批量删除</a> -->
  36. <a href="javascript:item_add();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>添加</a>
  37. </span>
  38. </div>
  39. <div class="mt-20">
  40. <table id="grid1" class="table table-border table-bordered table-bg">
  41. <thead>
  42. <tr class="text-c">
  43. <th width="100">模板名称</th>
  44. <th width="100">是否默认模板</th>
  45. <th width="100">创建时间</th>
  46. <th width="100">更新时间</th>
  47. <th width="100">操作</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. <!--_footer 作为公共模版分离出去-->
  56. <!--#include file="common/_footer.html"-->
  57. <!--/_footer 作为公共模版分离出去-->
  58. <!--请在下方写此页面业务相关的脚本-->
  59. <script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
  60. <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
  61. <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
  62. <script id="rowTmpl" type="text/template">
  63. <a href="javascript:item_edit('{{id}}','{{key}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i>编辑</a>
  64. <a href="javascript:step_set('{{id}}','{{key}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i>步骤</a>
  65. <a href="javascript:item_copy('{{id}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6ea;</i>复制</a>
  66. <a href="javascript:item_del('{{id}}','{{name}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i>删除</a>
  67. </script>
  68. <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
  69. <script type="text/javascript" src="scripts/global.js"></script>
  70. <script type="text/javascript">
  71. var path = global_backend_url;
  72. var procDefKey = null;
  73. function initList(){
  74. $('#grid1').dataTable({
  75. ajax: {
  76. url: path + "/procDefTmpl/list",
  77. type: 'post',
  78. dataFilter: function(responseText){
  79. var jsonData = JSON.parse(responseText);
  80. // 处理返回json
  81. if(jsonData.result){
  82. return JSON.stringify(jsonData.data);
  83. }
  84. else{
  85. processError(jsonData);
  86. return null;
  87. }
  88. },
  89. data: function(searchParams){
  90. // 查询json
  91. searchParams["procDefKey"] = procDefKey;
  92. searchParams["title"] = $("#title").val();
  93. }
  94. },
  95. serverSide: true,
  96. searching : false,
  97. ordering: false,
  98. columns: [
  99. {data:'title'},
  100. {data:'defaultFlag'},
  101. {data:'createDate'},
  102. {data:'updateDate'},
  103. {"data":null}
  104. ],
  105. columnDefs: [
  106. {
  107. targets:1,
  108. sClass:'center',
  109. bSortable:false,
  110. render: function (data, type, row) {
  111. if(!!data){
  112. return "是";
  113. }else {
  114. return "<button class='btn btn-primary-outline radius' onclick='setDefault(\""
  115. + row.procDefKey + "\",\"" + row.id + "\")'>设为默认</button>";
  116. }
  117. }
  118. },
  119. {
  120. targets:4,
  121. sClass:'center',
  122. bSortable:false,
  123. render: function (data, type, row) {
  124. return template("rowTmpl",{
  125. id: row.id,
  126. key: data.procDefKey
  127. });
  128. }
  129. }
  130. ]
  131. });
  132. }
  133. $(document).ready(function(){
  134. $("#btnSearch").click(function(){
  135. event.preventDefault();
  136. var table = $('#grid1').DataTable();
  137. table.ajax.reload();
  138. });
  139. var id = getQueryString("id");
  140. var loadingIndex = layer.load(1, {shade: [0.1,'#fff']});
  141. //获取流程定义
  142. $.get(path + "/procDef/detail/" + id,null,function(json){
  143. layer.close(loadingIndex);
  144. var process = json.data;
  145. procDefKey = process.key;
  146. $("#processName").html("流程:" + process.description);
  147. initList(procDefKey);
  148. },"json");
  149. });
  150. function item_add(){
  151. layer_show("添加","procdef-tmpl-detail.html?procDefKey=" + procDefKey,600,400);
  152. }
  153. function item_edit(id){
  154. layer_show("编辑","procdef-tmpl-detail.html?id=" + id + "&procDefKey=" + procDefKey,600,400);
  155. }
  156. function setDefault(procDefKey,templateId){
  157. $.post(path + "/procDefTmpl/setDefault",{
  158. procDefKey : procDefKey,
  159. templateId : templateId
  160. },function(json){
  161. if(json.result){
  162. reloadList();
  163. }
  164. else{
  165. layer.msg("设置失败!" + json.message);
  166. }
  167. });
  168. }
  169. function step_set(templateId,procDefKey){
  170. var index = window.top.layer.open({
  171. type: 2,
  172. fix: false, //不固定
  173. maxmin: true,
  174. shade:0.4,
  175. title: "设置步骤",
  176. content: "procdef-diagram.html?procDefKey=" + procDefKey + "&templateId=" + templateId
  177. });
  178. window.top.layer.full(index);
  179. }
  180. function item_del(id){
  181. layer.confirm("是否删除?",{
  182. btns:["是","否"]
  183. },function(){
  184. var loadingIndex = layer.load(0, {shade: [0.4,'#fff']});
  185. $.post(path + "/procDefTmpl/delete/" + id,null,function(json){
  186. layer.close(loadingIndex);
  187. if(json.result){
  188. layer.msg("删除成功!",{icon:1,time:2000});
  189. reloadList();
  190. }
  191. else{
  192. layer.msg("删除失败!" + json.message);
  193. }
  194. });
  195. });
  196. }
  197. function item_copy(id){
  198. var tmplName = prompt("请输入新模板名");
  199. if(tmplName!=null && tmplName.length>0){
  200. var loadingIndex = layer.load(0, {shade: [0.4,'#fff']});
  201. $.post(path + "/procDefTmpl/copy",{
  202. srcTmplId : id,
  203. tmplName : tmplName
  204. },function(json){
  205. layer.close(loadingIndex);
  206. if(json.result){
  207. layer.msg("复制成功!",{icon:1,time:2000});
  208. reloadList();
  209. }
  210. else{
  211. layer.msg("复制失败!" + json.message);
  212. }
  213. });
  214. }
  215. }
  216. function reloadList(){
  217. $('#grid1').DataTable().ajax.reload(null,false);
  218. }
  219. </script>
  220. </body>
  221. </html>