提交 | 用户 | 时间
|
1ac2bc
|
1 |
var ActivitiRest = { |
懒 |
2 |
options: {}, |
|
3 |
getProcessDefinitionByKey: function(processDefinitionKey, callback) { |
|
4 |
var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey}); |
|
5 |
|
|
6 |
$.ajax({ |
|
7 |
url: url, |
|
8 |
dataType: 'jsonp', |
|
9 |
cache: false, |
|
10 |
async: true, |
|
11 |
success: function(data, textStatus) { |
|
12 |
var processDefinition = data; |
|
13 |
if (!processDefinition) { |
|
14 |
console.error("Process definition '" + processDefinitionKey + "' not found"); |
|
15 |
} else { |
|
16 |
callback.apply({processDefinitionId: processDefinition.id}); |
|
17 |
} |
|
18 |
} |
|
19 |
}).done(function(data, textStatus) { |
|
20 |
console.log("ajax done"); |
|
21 |
}).fail(function(jqXHR, textStatus, error){ |
|
22 |
console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, 'error: ', error, jqXHR); |
|
23 |
}); |
|
24 |
}, |
|
25 |
|
|
26 |
getProcessDefinition: function(processDefinitionId, callback) { |
|
27 |
var url = Lang.sub(this.options.processDefinitionUrl, {processDefinitionId: processDefinitionId}); |
|
28 |
|
|
29 |
$.ajax({ |
|
30 |
url: url, |
|
31 |
dataType: 'jsonp', |
|
32 |
cache: false, |
|
33 |
async: true, |
|
34 |
success: function(data, textStatus) { |
|
35 |
var processDefinitionDiagramLayout = data; |
|
36 |
if (!processDefinitionDiagramLayout) { |
|
37 |
console.error("Process definition diagram layout '" + processDefinitionId + "' not found"); |
|
38 |
return; |
|
39 |
} else { |
|
40 |
callback.apply({processDefinitionDiagramLayout: processDefinitionDiagramLayout}); |
|
41 |
} |
|
42 |
} |
|
43 |
}).done(function(data, textStatus) { |
|
44 |
console.log("ajax done"); |
|
45 |
}).fail(function(jqXHR, textStatus, error){ |
|
46 |
console.log('Get diagram layout['+processDefinitionId+'] failure: ', textStatus, jqXHR); |
|
47 |
}); |
|
48 |
}, |
|
49 |
|
|
50 |
getHighLights: function(processInstanceId, callback) { |
|
51 |
var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId}); |
|
52 |
|
|
53 |
$.ajax({ |
|
54 |
url: url, |
|
55 |
dataType: 'jsonp', |
|
56 |
cache: false, |
|
57 |
async: true, |
|
58 |
success: function(data, textStatus) { |
|
59 |
console.log("ajax returned data"); |
|
60 |
var highLights = data; |
|
61 |
if (!highLights) { |
|
62 |
console.log("highLights not found"); |
|
63 |
return; |
|
64 |
} else { |
|
65 |
callback.apply({highLights: highLights}); |
|
66 |
} |
|
67 |
} |
|
68 |
}).done(function(data, textStatus) { |
|
69 |
console.log("ajax done"); |
|
70 |
}).fail(function(jqXHR, textStatus, error){ |
|
71 |
console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR); |
|
72 |
}); |
|
73 |
} |
|
74 |
}; |