注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建
        (2)创建流程模型:activiti自定义流程之Spring整合activiti-modeler5.16实例(二):创建流程模型

1.maven导包及spring的一些基本配置与创建流程模型时候的没有什么变化,依旧沿用就好;前端的首页也不用有太大变化,只需要把之后新创建的js引入进来即可。

2.acitivit流程定义有必要的24张表。
  创建模型时相关的有act_re_model和act_ge_bytearray两个。
  成功创建模型后可以看到model表中会有一条数据,同时在bytearray表中也会同时生成两条对应的数据。而model表中会存入这两条数据的id,从而产生关联。
  因此流程模型列表查询时就需要在这两张表中进行操作。

3.模型属于资源文件,因此操作的时候用到repositoryService来调用相关的方法,activiti也提供了相关的方法createModelQuery以及ActivitiModel实体类。

4.结合上述,后台业务代码如下,为了便于前台获取数据,我自己也定义了model实体类,只取自己想要展示的数据:

/**
	 * 模型列表
	 *
	 * @author:tuzongxun
	 * @Title: modelList
	 * @param @return
	 * @return Object
	 * @date Mar 17, 2016 12:29:52 PM
	 * @throws
	 */
	@RequestMapping(value = "/modelList.do", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
	@ResponseBody
	public Object modelList(HttpServletRequest req) {
		Map<String, Object> map = new HashMap<String, Object>();
		boolean isLogin = this.isLogin(req);
		if (isLogin) {
			List<ActivitiModel> modelList = new ArrayList<ActivitiModel>();
			try {
				List<Model> modelList1 = repositoryService.createModelQuery()
						.list();
				if (modelList1 != null && modelList1.size() > 0) {
					for (Model model : modelList1) {
						ActivitiModel activitiModel = new ActivitiModel();
						activitiModel.setId(model.getId());
						activitiModel.setCreateTime(model.getCreateTime());
						activitiModel.setDescription(model.getMetaInfo());
						activitiModel.setKey(model.getKey());
						activitiModel.setLastUpdateTime(model
								.getLastUpdateTime());
						activitiModel.setName(model.getName());
						activitiModel.setVersion(model.getVersion());
						modelList.add(activitiModel);
					}
				}
				map.put("isLogin", "yes");
				map.put("userName",
						(String) req.getSession().getAttribute("userName"));
				map.put("result", "success");
				map.put("data", modelList);

			} catch (Exception e) {
				e.getStackTrace();
			}
		} else {
			map.put("isLogin", "no");
		}
		return map;
	}

5.前台app.js加入代码:

$stateProvider
    .state('modelList', {
    url: "/modelList",
    views: {
       'view': {
        templateUrl: 'activi_views/modelList.html',
        controller: 'modelCtr'
       }
    }
   });  

6.前台创建新的控制层js(注意在首页index.html中导入这个js,我的首页是activiti.html),modelCtr.js:

angular.module('activitiApp')
.controller('modelCtr', ['$rootScope','$scope','$http','$location', function($rootScope,$scope,$http,$location){
$scope.init=function(){
        $http.post("./modelList.do").success(function(result) {
        	if(result.isLogin==="yes"){
        		$rootScope.userName=result.userName;
        	    console.log(result.data);
    	        $scope.modelList=result.data;
        	}else{
        		$location.path("/login");
        	}
        });
}
        $scope.deploye=function(model){
        	console.log(model);
        	$http.post("./deploye.do",model).success(function(deployResult){
        		$location.path("/processList");
        	});
        }

        $scope.update=function(modelId){
        	window.open("http://localhost:8080/activitiTest1/service/editor?id="+modelId);
        }

}])  

7.modelList页面,modelList.html:

<div id="logdiv1" ng-init="init();">
    <p style="font-size:24px;margin-top:10px">模型列表</p>
    <center>
   <table border="1px" style="width:87%;font-size:18px;text-align:center;margin-left:2px;margin-top:auto;position:relative;float:left;" cellSpacing="0px" cellPadding="0px">
      <tr style="background-color:#ccc">
         <td>ID</td>
         <td>NAME</td>
         <td>KEY</td>
         <td>描 述</td>
         <td>版本</td>
         <td>创建时间</td>
         <td>修改时间</td>
         <td>操 作</td>
      </tr>
      <tr ng-repeat="model in modelList | orderBy:'id'" >
         <td>{{model.id}}</td>
         <td>{{model.name}}</td>
         <td>{{model.key}}</td>
         <td>{{model.metaInfo}}</td>
         <td>{{model.version}}</td>
         <td>{{model.createTime | date:"yyyy-MM-dd HH:mm:ss"}}</td>
         <td>{{model.lastUpdateTime | date:"yyyy-MM-dd HH:mm:ss"}}</td>
         <td><a href="script:;" ng-click="deploye(model)">部署</a> 
         <a href="script:;" ng-click="delete(model)">删除</a> 
         <a href="script:;" ng-click="update(model.id)">修改</a>
         </td>
      </tr>
   </table>
   </center>
</div>  

8.页面展示效果如下:

 
 

activiti自定义流程之Spring整合activiti-modeler5.16实例(三):流程模型列表展示的更多相关文章

  1. activiti自定义流程之Spring整合activiti-modeler5.16实例(九):历史任务查询

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  2. activiti自定义流程之Spring整合activiti-modeler5.16实例(八):完成个人任务

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  3. activiti自定义流程之Spring整合activiti-modeler5.16实例(七):任务列表展示

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  4. activiti自定义流程之Spring整合activiti-modeler5.16实例(六):启动流程

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  5. activiti自定义流程之Spring整合activiti-modeler5.16实例(五):流程定义列表

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  6. activiti自定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  7. activiti自定义流程之Spring整合activiti-modeler5.16实例(二):创建流程模型

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 1.maven导包,这里就没有什么多的好说了,直接代码: <depe ...

  8. activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建

    项目中需要整合activiti-modeler自定义流程,找了很多资料后,终于成功的跳转到activiti-modeler流程设计界面,以下是记录: 一.整合基础:eclipse4.4.1.tomca ...

  9. activiti自己定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义

    注:(1)环境搭建:activiti自己定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建         (2)创建流程模型:activiti自己定义流程之Spr ...

随机推荐

  1. Java 存储过程调用

    //配置文件 private static ClientServiceConfigUtil configUtil = new ClientServiceConfigUtil("/Databa ...

  2. 关于 Ajax 提交参数格式,及返回类型json

    function Login() {                   $.ajax({                           //提交方式               type:&q ...

  3. 转载:奇异值分解(SVD) --- 线性变换几何意义(上)

    本文转载自他人: PS:一直以来对SVD分解似懂非懂,此文为译文,原文以细致的分析+大量的可视化图形演示了SVD的几何意义.能在有限的篇幅把这个问题讲解的如此清晰,实属不易.原文举了一个简单的图像处理 ...

  4. H5标签-canvas实现颜色拾取功能

    HTML5 <canvas> 标签是用于绘制图像,不过,<canvas> 元素本身并没有绘制能力(它仅仅是图形的容器),必须使用脚本(通常是 JS)来完成实际的绘图任务. &l ...

  5. 机器翻译 2010年NOIP全国联赛提高组

    题目描述 Description 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义 来替换.对于每个英 ...

  6. matlab:对一个向量进行排序,返回每一个数据的rank 序号 。。。

    %% Rank the entropy_loss     % for iiii = 1:size(Group_age, 1)  %     count_1 = 0 ;%     tmp = Group ...

  7. JNI学习2:android 调用C语言方法与C语言调用android方法

    #include <jni.h> #include <stdio.h> #include <stdlib.h> #include <jni.h> #in ...

  8. sql server行级锁,排它锁,共享锁的使用

    锁的概述 一. 为什么要引入锁 多个用户同时对数据库的并发操作时会带来以下数据不一致的问题: 丢失更新 A,B两个用户读同一数据并进行修改,其中一个用户的修改结果破坏了另一个修改的结果,比如订票系统 ...

  9. linux包之nc之nc命令

    nc-1.84-22.el6.x86_64不用系统上提供的nc版本会有所不同,其提供的参数使用方法也略有差异 nc -v -w 1 192.168.2.10 -z 1-65535|grep succe ...

  10. 【转】Apache Options Indexes FollowSymLinks详解

    禁止显示Apache目录列表-Indexes FollowSymLinks如何修改目录的配置以禁止显示 Apache 目录列表.缺省情况下如果你在浏览器输入地址: http://localhost:8 ...