StartProcessDialog.js
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/// <reference path="../jquery-1.11.1.js" />
/// <reference path="../jquery-easyui-1.4.1/jquery.easyui.min.js" />
/// <reference path="../jquery-easyui-ext.js" />
/// <reference path="../global.js" />
/// <reference path="../global.modelctls.js" />
/// <reference path="../global.enums.js" />
/// <reference path="../global.extension.js" />
function StartProcessDialog(options) {
this._options = options || {};
this._dialog = null;
this._callback = this._options.callback;
this.showDialog = function () {
var thidpd = this;
$.post(global.contextPath + global.modelctls.project.list.start, function (data) {
data = data[0] || [];
for (var i = 0; i < data.length; i++) {
data[i].text = data[i].name;
data[i].type = 'flow';
}
thidpd._showDialog([{ id: '流程列表', text: '流程列表', type: 'dir', children: data }]);
});
};
this._showDialog = function (data) {
var thispd = this;
var tree = thispd._tree = $('<ul/>');
var dialog = this._dialog = $('<div style="padding-left:0px;padding-top:0px;"/>').append(tree).dialog({
title: '选择流程', width: 300, height: 400, modal: true, onOpen: function () {
$(tree).tree({
data: data, checkbox: false, onBeforeCheck: function (node, checked) {
}, onClick: function (node) {
}
});
}, buttons: [{
text: '确定', iconCls: 'icon-ok', handler: function () {
var selected = $(tree).tree('getSelected');
if (!selected || selected.type != 'flow') {
$.messager.alert('提示', '请选择流程!');
return;
}
if (thispd._callback) thispd._callback(selected);
$(dialog).dialog('close');
}
}, {
text: '取消', iconCls: 'icon-cancel', handler: function () {
$(dialog).dialog('close');
}
}],
onClose: function () {
thispd._tree = null;
thispd._dialog = null;
$(this).dialog('destroy');
}
});
};
}