123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>列表页面</title>
- <!--#include file="common/_header.html"-->
- <style>
- .table .center{
- text-align:center;
- }
- </style>
- </head>
- <body>
- <nav class="breadcrumb">
- <i class="Hui-iconfont"></i>
- 首页
- <span class="c-gray en">></span> <label id="processName"></label>
- <span class="c-gray en">></span> 模板列表
- <a class="btn btn-success radius r"
- style="line-height: 1.6em; margin-top: 3px"
- href="javascript:location.replace(location.href);" title="刷新">
- <i class="Hui-iconfont"></i></a>
- </nav>
- <div class="page-container">
- <div class="container mb-10">
- <form>
- <div class="row mb-10">
- <input type="text" class="input-text" style="width: 250px" placeholder="输入标题" id="title" name="title">
- <button id="btnSearch" type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont"></i> 查询</button>
- <button id="btnReset" type="reset" class="btn btn-default"><i class="Hui-iconfont"></i> 重置</button>
- </div>
- </form>
- </div>
- <div class="cl pd-5 bg-1 bk-gray">
- <span class="l">
- <!-- <a href="javascript:batch_del();" class="btn btn-danger radius"><i class="Hui-iconfont"></i>批量删除</a> -->
- <a href="javascript:item_add();" class="btn btn-primary radius"><i class="Hui-iconfont"></i>添加</a>
- </span>
- </div>
- <div class="mt-20">
- <table id="grid1" class="table table-border table-bordered table-bg">
- <thead>
- <tr class="text-c">
- <th width="100">模板名称</th>
- <th width="100">是否默认模板</th>
- <th width="100">创建时间</th>
- <th width="100">更新时间</th>
- <th width="100">操作</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- </div>
- <!--_footer 作为公共模版分离出去-->
- <!--#include file="common/_footer.html"-->
- <!--/_footer 作为公共模版分离出去-->
- <!--请在下方写此页面业务相关的脚本-->
- <script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
- <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
- <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
- <script id="rowTmpl" type="text/template">
- <a href="javascript:item_edit('{{id}}','{{key}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i>编辑</a>
- <a href="javascript:step_set('{{id}}','{{key}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i>步骤</a>
- <a href="javascript:item_copy('{{id}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i>复制</a>
- <a href="javascript:item_del('{{id}}','{{name}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i>删除</a>
- </script>
- <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
- <script type="text/javascript" src="scripts/global.js"></script>
- <script type="text/javascript">
- var path = global_backend_url;
- var procDefKey = null;
- function initList(){
- $('#grid1').dataTable({
- ajax: {
- url: path + "/procDefTmpl/list",
- type: 'post',
- dataFilter: function(responseText){
- var jsonData = JSON.parse(responseText);
- // 处理返回json
- if(jsonData.result){
- return JSON.stringify(jsonData.data);
- }
- else{
- processError(jsonData);
- return null;
- }
- },
- data: function(searchParams){
- // 查询json
- searchParams["procDefKey"] = procDefKey;
- searchParams["title"] = $("#title").val();
- }
- },
- serverSide: true,
- searching : false,
- ordering: false,
- columns: [
- {data:'title'},
- {data:'defaultFlag'},
- {data:'createDate'},
- {data:'updateDate'},
- {"data":null}
- ],
- columnDefs: [
- {
- targets:1,
- sClass:'center',
- bSortable:false,
- render: function (data, type, row) {
- if(!!data){
- return "是";
- }else {
- return "<button class='btn btn-primary-outline radius' onclick='setDefault(\""
- + row.procDefKey + "\",\"" + row.id + "\")'>设为默认</button>";
- }
- }
- },
- {
- targets:4,
- sClass:'center',
- bSortable:false,
- render: function (data, type, row) {
- return template("rowTmpl",{
- id: row.id,
- key: data.procDefKey
- });
- }
- }
- ]
- });
- }
- $(document).ready(function(){
- $("#btnSearch").click(function(){
- event.preventDefault();
- var table = $('#grid1').DataTable();
- table.ajax.reload();
- });
- var id = getQueryString("id");
-
- var loadingIndex = layer.load(1, {shade: [0.1,'#fff']});
- //获取流程定义
- $.get(path + "/procDef/detail/" + id,null,function(json){
- layer.close(loadingIndex);
-
- var process = json.data;
- procDefKey = process.key;
- $("#processName").html("流程:" + process.description);
- initList(procDefKey);
- },"json");
- });
-
- function item_add(){
- layer_show("添加","procdef-tmpl-detail.html?procDefKey=" + procDefKey,600,400);
- }
-
- function item_edit(id){
- layer_show("编辑","procdef-tmpl-detail.html?id=" + id + "&procDefKey=" + procDefKey,600,400);
- }
- function setDefault(procDefKey,templateId){
- $.post(path + "/procDefTmpl/setDefault",{
- procDefKey : procDefKey,
- templateId : templateId
- },function(json){
- if(json.result){
- reloadList();
- }
- else{
- layer.msg("设置失败!" + json.message);
- }
- });
- }
- function step_set(templateId,procDefKey){
- var index = window.top.layer.open({
- type: 2,
- fix: false, //不固定
- maxmin: true,
- shade:0.4,
- title: "设置步骤",
- content: "procdef-diagram.html?procDefKey=" + procDefKey + "&templateId=" + templateId
- });
- window.top.layer.full(index);
- }
-
- function item_del(id){
- layer.confirm("是否删除?",{
- btns:["是","否"]
- },function(){
- var loadingIndex = layer.load(0, {shade: [0.4,'#fff']});
- $.post(path + "/procDefTmpl/delete/" + id,null,function(json){
- layer.close(loadingIndex);
- if(json.result){
- layer.msg("删除成功!",{icon:1,time:2000});
- reloadList();
- }
- else{
- layer.msg("删除失败!" + json.message);
- }
- });
- });
- }
-
- function item_copy(id){
- var tmplName = prompt("请输入新模板名");
- if(tmplName!=null && tmplName.length>0){
- var loadingIndex = layer.load(0, {shade: [0.4,'#fff']});
-
- $.post(path + "/procDefTmpl/copy",{
- srcTmplId : id,
- tmplName : tmplName
- },function(json){
- layer.close(loadingIndex);
-
- if(json.result){
- layer.msg("复制成功!",{icon:1,time:2000});
- reloadList();
- }
- else{
- layer.msg("复制失败!" + json.message);
- }
- });
- }
- }
- function reloadList(){
- $('#grid1').DataTable().ajax.reload(null,false);
- }
- </script>
- </body>
- </html>
|