提交 | 用户 | 时间
|
8286c6
|
1 |
layui.use(['table', 'ax', 'laydate'], function () { |
懒 |
2 |
var $ = layui.$; |
|
3 |
var table = layui.table; |
|
4 |
var laydate = layui.laydate; |
|
5 |
var $ax = layui.ax; |
|
6 |
|
|
7 |
/** |
|
8 |
* 管理 |
|
9 |
*/ |
|
10 |
var Procinst = { |
|
11 |
tableId: "procinstTable" |
|
12 |
}; |
|
13 |
|
|
14 |
/** |
|
15 |
* 初始化表格的列 |
|
16 |
*/ |
|
17 |
Procinst.initColumn = function () { |
|
18 |
return [[ |
|
19 |
{type: 'checkbox'}, |
|
20 |
{field: 'id_', hide: true, title: ''}, |
|
21 |
{field: 'proc_inst_id_', hide: true, sort: true, title: ''}, |
|
22 |
{field: 'dgrm_resource_name_', hide: true, sort: true, title: ''}, |
|
23 |
{field: 'deployment_id_', hide: true, sort: true, title: ''}, |
|
24 |
{field: 'pname_', sort: true, title: '流程名称'}, |
|
25 |
{field: 'initator', sort: true, title: '申请人'}, |
|
26 |
{field: 'version_', sort: true, title: '流程版本'}, |
|
27 |
{field: 'start_time_', sort: true, title: '开始时间'}, |
|
28 |
{field: 'end_time_', sort: true, title: '结束时间'}, |
|
29 |
{field: 'ztime', sort: true, title: '用时'}, |
|
30 |
{ |
|
31 |
field: 'delete_reason_', sort: true, title: '状态', templet: function (d) { |
|
32 |
if (d.delete_reason_ === null) { |
|
33 |
return "<span style='color: #87B87F;'>正常完成</span>"; |
|
34 |
} else { |
|
35 |
return "<span style='color: red;'>作废</span>"; |
|
36 |
} |
|
37 |
} |
|
38 |
}, |
|
39 |
{align: 'center', toolbar: '#tableBar', title: '操作'} |
|
40 |
]]; |
|
41 |
}; |
|
42 |
|
|
43 |
//渲染时间选择框 |
|
44 |
laydate.render({ |
|
45 |
elem: '#lastStart', |
|
46 |
range: false, |
|
47 |
max: Feng.currentDate() |
|
48 |
}); |
|
49 |
|
|
50 |
//渲染时间选择框 |
|
51 |
laydate.render({ |
|
52 |
elem: '#lastEnd', |
|
53 |
range: false, |
|
54 |
max: Feng.currentDate() |
|
55 |
}); |
|
56 |
|
|
57 |
/** |
|
58 |
* 点击查询按钮 |
|
59 |
*/ |
|
60 |
Procinst.search = function () { |
|
61 |
var queryData = {}; |
|
62 |
queryData['keywords'] = $("#keywords").val(); |
|
63 |
queryData['lastStart'] = $("#lastStart").val(); |
|
64 |
queryData['lastEnd'] = $("#lastEnd").val(); |
|
65 |
table.reload(Procinst.tableId, { |
|
66 |
where: queryData, page: {curr: 1} |
|
67 |
}); |
|
68 |
}; |
|
69 |
|
|
70 |
/** |
|
71 |
* 点击流程信息 |
|
72 |
* |
|
73 |
* @param data 点击按钮时候的行数据 |
|
74 |
*/ |
|
75 |
Procinst.openDetailDlg = function (data) { |
|
76 |
layer.open({ |
|
77 |
type: 2, |
|
78 |
title: '流程信息', |
|
79 |
area: ['900px', '500px'], |
|
80 |
content: Feng.ctxPath + '/taskHistory/processInfo?ID_=' + data.id_ + "&DGRM_RESOURCE_NAME_=" + data.dgrm_resource_name_ + "&PROC_INST_ID_=" + data.proc_inst_id_, |
|
81 |
end: function () { |
|
82 |
Procinst.search(); |
|
83 |
} |
|
84 |
}); |
|
85 |
}; |
|
86 |
|
|
87 |
/** |
|
88 |
* 点击删除 |
|
89 |
* |
|
90 |
* @param data 点击按钮时候的行数据 |
|
91 |
*/ |
|
92 |
Procinst.onDeleteItem = function (data) { |
|
93 |
var operation = function () { |
|
94 |
var ajax = new $ax(Feng.ctxPath + "/historyProc/delete", function (data) { |
|
95 |
Feng.success("删除成功!"); |
|
96 |
table.reload(Procinst.tableId); |
|
97 |
}, function (data) { |
|
98 |
Feng.error("删除失败!" + data.responseJSON.message + "!"); |
|
99 |
}); |
|
100 |
ajax.set("procinstId", data.proc_inst_id_); |
|
101 |
ajax.start(); |
|
102 |
}; |
|
103 |
Feng.confirm("是否删除?", operation); |
|
104 |
}; |
|
105 |
|
|
106 |
// 渲染表格 |
|
107 |
var tableResult = table.render({ |
|
108 |
elem: '#' + Procinst.tableId, |
|
109 |
url: Feng.ctxPath + '/historyProc/list', |
|
110 |
page: true, |
|
111 |
height: "full-158", |
|
112 |
cellMinWidth: 100, |
|
113 |
cols: Procinst.initColumn() |
|
114 |
}); |
|
115 |
|
|
116 |
// 搜索按钮点击事件 |
|
117 |
$('#btnSearch').click(function () { |
|
118 |
Procinst.search(); |
|
119 |
}); |
|
120 |
|
|
121 |
// 工具条点击事件 |
|
122 |
table.on('tool(' + Procinst.tableId + ')', function (obj) { |
|
123 |
var data = obj.data; |
|
124 |
var layEvent = obj.event; |
|
125 |
|
|
126 |
if (layEvent === 'detail') { |
|
127 |
Procinst.openDetailDlg(data); |
|
128 |
} else if (layEvent === 'delete') { |
|
129 |
Procinst.onDeleteItem(data); |
|
130 |
} |
|
131 |
}); |
|
132 |
}); |