提交 | 用户 | 时间
|
1ac2bc
|
1 |
layui.use(['table', 'admin', 'ax', 'laydate'], function () { |
懒 |
2 |
var $ = layui.$; |
|
3 |
var table = layui.table; |
|
4 |
var laydate = layui.laydate; |
|
5 |
var $ax = layui.ax; |
|
6 |
var admin = layui.admin; |
|
7 |
|
|
8 |
/** |
|
9 |
* 运行中流程 |
|
10 |
*/ |
|
11 |
var RuTask = { |
|
12 |
tableId: "ruTaskTable" |
|
13 |
}; |
|
14 |
|
|
15 |
/** |
|
16 |
* 初始化表格的列 |
|
17 |
*/ |
|
18 |
RuTask.initColumn = function () { |
|
19 |
return [[ |
|
20 |
{type: 'checkbox'}, |
|
21 |
{type: "numbers", align: "center", title: '序号'}, |
|
22 |
{field: 'id', hide: true, title: ''}, |
|
23 |
{field: 'pname', sort: true, title: '流程名称'}, |
|
24 |
{field: 'initator', sort: true, title: '申请人'}, |
|
25 |
{field: 'assignee', sort: true, title: '当前节点(审批人)'}, |
|
26 |
{field: 'name', sort: true, title: '当前任务'}, |
|
27 |
{field: 'createTime', sort: true, title: '创建时间'}, |
|
28 |
{ |
|
29 |
field: 'suspensionState', sort: true, title: '状态', templet: function (d) { |
|
30 |
if (d.suspensionState === 1) { |
|
31 |
return "<span style='color: #5FB878;'>正在运行</span>"; |
|
32 |
} else { |
|
33 |
return "<span style='color: #fe7300;'>已挂起</span>"; |
|
34 |
} |
|
35 |
} |
|
36 |
}, |
|
37 |
{field: 'rev', sort: true, hide: true, title: ''}, |
|
38 |
{field: 'dgrmResourceName', sort: true, hide: true, title: ''}, |
|
39 |
{field: 'executionId', sort: true, hide: true, title: ''}, |
|
40 |
{field: 'priority', sort: true, hide: true, title: ''}, |
|
41 |
{field: 'procDefId', sort: true, hide: true, title: ''}, |
|
42 |
{field: 'procInstId', sort: true, hide: true, title: ''}, |
|
43 |
{field: 'taskDefKey', sort: true, hide: true, title: ''}, |
|
44 |
{field: 'tenantId', sort: true, hide: true, title: ''}, |
|
45 |
{align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 250} |
|
46 |
]]; |
|
47 |
}; |
|
48 |
|
|
49 |
//渲染时间选择框 |
|
50 |
laydate.render({ |
|
51 |
elem: '#lastStart', |
|
52 |
range: false, |
|
53 |
max: Feng.currentDate() |
|
54 |
}); |
|
55 |
|
|
56 |
//渲染时间选择框 |
|
57 |
laydate.render({ |
|
58 |
elem: '#lastEnd', |
|
59 |
range: false, |
|
60 |
max: Feng.currentDate() |
|
61 |
}); |
|
62 |
|
|
63 |
// 渲染表格 |
|
64 |
var tableResult = table.render({ |
|
65 |
elem: '#' + RuTask.tableId, |
|
66 |
url: Feng.ctxPath + '/taskRunning/list', |
|
67 |
page: true, |
|
68 |
height: "full-158", |
|
69 |
cellMinWidth: 100, |
|
70 |
cols: RuTask.initColumn() |
|
71 |
}); |
|
72 |
|
|
73 |
/** |
|
74 |
* 点击查询按钮 |
|
75 |
*/ |
|
76 |
RuTask.search = function () { |
|
77 |
var queryData = {}; |
|
78 |
queryData['keywords'] = $("#keywords").val(); |
|
79 |
queryData['lastStart'] = $("#lastStart").val(); |
|
80 |
queryData['lastEnd'] = $("#lastEnd").val(); |
|
81 |
table.reload(RuTask.tableId, { |
|
82 |
where: queryData, page: {curr: 1} |
|
83 |
}); |
|
84 |
}; |
|
85 |
|
|
86 |
|
|
87 |
// 搜索按钮点击事件 |
|
88 |
$('#btnSearch').click(function () { |
|
89 |
RuTask.search(); |
|
90 |
}); |
|
91 |
|
|
92 |
/** |
|
93 |
* 点击流程信息 |
|
94 |
* |
|
95 |
* @param data 点击按钮时候的行数据 |
|
96 |
*/ |
|
97 |
RuTask.openInfoDlg = function (data) { |
|
98 |
layer.open({ |
|
99 |
type: 2, |
|
100 |
title: '流程信息', |
|
101 |
area: ['900px', '500px'], |
|
102 |
content: Feng.ctxPath + '/taskHistory/processInfo?ID_=' + data.id + "&DGRM_RESOURCE_NAME_=" + data.dgrmResourceName + "&PROC_INST_ID_=" + data.procInstId, |
|
103 |
end: function () { |
|
104 |
RuTask.search(); |
|
105 |
} |
|
106 |
}); |
|
107 |
}; |
|
108 |
|
|
109 |
/** |
|
110 |
* 委派 |
|
111 |
* |
|
112 |
* @param data 点击按钮时候的行数据 |
|
113 |
*/ |
|
114 |
RuTask.openDelegateDlg = function (data) { |
|
115 |
layer.open({ |
|
116 |
type: 2, |
|
117 |
title: '指定委派对象', |
|
118 |
area: ['800px', '400px'], |
|
119 |
content: Feng.ctxPath + '/taskWaiting/delegatePage?ID_=' + data.id, |
|
120 |
end: function () { |
|
121 |
Task.search(); |
|
122 |
} |
|
123 |
}); |
|
124 |
}; |
|
125 |
|
|
126 |
/** |
|
127 |
* 挂起 激活 |
|
128 |
* |
|
129 |
* @param data 点击按钮时候的行数据 |
|
130 |
*/ |
|
131 |
RuTask.openHangDlg = function (data, status) { |
|
132 |
var ajax = new $ax(Feng.ctxPath + "/process/onoffTask", function (data) { |
|
133 |
if (status === 1) { |
|
134 |
Feng.success("激活成功!"); |
|
135 |
table.reload(RuTask.tableId); |
|
136 |
} else { |
|
137 |
Feng.success("挂起成功!"); |
|
138 |
table.reload(RuTask.tableId); |
|
139 |
} |
|
140 |
table.reload(Procdef.tableId); |
|
141 |
}, function (data) { |
|
142 |
if (status === 1) { |
|
143 |
Feng.error("激活失败!" + data.responseJSON.message) |
|
144 |
} else { |
|
145 |
Feng.error("挂起失败!" + data.responseJSON.message) |
|
146 |
} |
|
147 |
}); |
|
148 |
ajax.set("id", data.id); |
|
149 |
ajax.set("status", status); |
|
150 |
ajax.start(); |
|
151 |
}; |
|
152 |
|
|
153 |
/** |
|
154 |
* 点击作废 |
|
155 |
* |
|
156 |
* @param data 点击按钮时候的行数据 |
|
157 |
*/ |
|
158 |
RuTask.onDeleteItem = function (data) { |
|
159 |
parent.layer.prompt({ |
|
160 |
title: '请输入作废理由:', |
|
161 |
formType: 2, |
|
162 |
skin: 'layui-layer-admin layui-layer-prompt', |
|
163 |
shade: .1 |
|
164 |
}, function (value, index, elem) { |
|
165 |
var ajax = new $ax(Feng.ctxPath + "/process/deleteAct", function (data) { |
|
166 |
Feng.success("操作成功"); |
|
167 |
table.reload(RuTask.tableId); |
|
168 |
}, function (data) { |
|
169 |
Feng.error("操作失败!" + data.responseJSON.message); |
|
170 |
}); |
|
171 |
ajax.set("procInstId",data.procInstId); |
|
172 |
ajax.set("reason",value); |
|
173 |
ajax.start(); |
|
174 |
parent.layer.close(index); |
|
175 |
}); |
|
176 |
}; |
|
177 |
|
|
178 |
|
|
179 |
// 工具条点击事件 |
|
180 |
table.on('tool(' + RuTask.tableId + ')', function (obj) { |
|
181 |
var data = obj.data; |
|
182 |
var layEvent = obj.event; |
|
183 |
|
|
184 |
if (layEvent === 'info') { |
|
185 |
RuTask.openInfoDlg(data); |
|
186 |
} else if (layEvent === 'delegate') { |
|
187 |
RuTask.openDelegateDlg(data); |
|
188 |
} else if (layEvent === 'hang') { |
|
189 |
RuTask.openHangDlg(data, 2); |
|
190 |
} else if (layEvent === 'active') { |
|
191 |
RuTask.openHangDlg(data, 1); |
|
192 |
} else if (layEvent === 'delete') { |
|
193 |
RuTask.onDeleteItem(data); |
|
194 |
} |
|
195 |
}); |
|
196 |
}); |