|
发表于 2016-7-6 16:13:09
|
显示全部楼层
1.获取需要的task的值
action对应的java定义
- public static List<String> getTask(){
- String sql = "select sID from SA_Task where (sStatusID='tesReady' or SA_Task.sStatusID='tesExecuting') and sprocess='/demo/process/process/batch/batchProcess' and sactivity='businessActivity2' and sflowid is not null and sexecutorfid is not null";
- HashMap<String,String> sqlMap = new HashMap<String,String>();
- sqlMap.put("ORACLE",sql);
- Table table = SQL.select(sqlMap,null,"/system/data");
- Iterator<Row> rows = table.iterator();
- List<String> list = new ArrayList<String>();
- while (rows.hasNext()) {
- Row row = rows.next();
- list.add(row.getValue("SID").toString());
- }
- return list;
- }
复制代码 js中的调用
定义了一个实例遍历taks2
- var Model = function() {
- this.callParent();
- this.tasks = [];
- this.tasks2 = [];
- };
复制代码 调用action给tasks2赋值
- Model.prototype.button6Click = function(event){
- var self = this;
- var context = self.getContext();
- var options = {};
- options.process = context.getCurrentProcess();
- options.activity = context.getCurrentActivity();
- options.action = "getTaskAction";
- options.contentType = "json";
- options.callback = function(data){
- if (data.state) {
- self.tasks2 = data.response.slice();
- }
- }
- biz.Request.sendBizRequest(options);
- };
复制代码
然后通过获取的taks2中的task值进行批了流转
action对应的java定义如下,action中有一个list参数
- public static void batchAdvanceBIZ(List<String> tasks){
- for (String task : tasks){
- ProcessUtils.advanceProcess(task, null);
- }
- }
复制代码 js中调用action执行后端流转
- Model.prototype.button5Click = function(event){
- var context = this.getContext();
- var options = {};
- options.process = context.getCurrentProcess();
- options.activity = context.getCurrentActivity();
- options.action = "batchAdvanceBIZAction";
- options.parameters = new biz.Request.ActionParam();
- var taskParam = new biz.Request.ListParam();
- for (var i = 0; i < this.tasks2.length; i++) {
- taskParam.add(this.tasks2[i]);
- }
- options.parameters.setList("tasks", taskParam);
- options.contentType = "json";
- biz.Request.sendBizRequest(options);
- };
复制代码
|
|