activiti扩展节点属性(在UserTask节点上添加附件上传功能)
给节点添加属性:
1.首先在stencilset.json上模仿其他属性添加新的节点属性的基础配置 注意type属性前端根据这个属性值去确认改节点属性在页面上所要表现得形式
{"name": "approveTypepackage","properties": [{"id": "approveType","type": "zidingyi","title": "附件","value": "附件管理","description": "附件","popular": true,"refToView": "text_name"}]},
加入需要扩展的节点这里我们的属性是 approveTypepackage,所以在propertyPackages数组中加入这个属性就好了
{"type" : "node","id" : "UserTask","title" : "用户活动","description" : "分配给特定人的任务 ","view" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns:oryx=\"http://www.b3mn.org/oryx\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n\n width=\"102\"\n height=\"82\"\n version=\"1.0\">\n <defs></defs>\n <oryx:magnets>\n \t<oryx:magnet oryx:cx=\"1\" oryx:cy=\"20\" oryx:anchors=\"left\" />\n \t<oryx:magnet oryx:cx=\"1\" oryx:cy=\"40\" oryx:anchors=\"left\" />\n \t<oryx:magnet oryx:cx=\"1\" oryx:cy=\"60\" oryx:anchors=\"left\" />\n \t\n \t<oryx:magnet oryx:cx=\"25\" oryx:cy=\"79\" oryx:anchors=\"bottom\" />\n \t<oryx:magnet oryx:cx=\"50\" oryx:cy=\"79\" oryx:anchors=\"bottom\" />\n \t<oryx:magnet oryx:cx=\"75\" oryx:cy=\"79\" oryx:anchors=\"bottom\" />\n \t\n \t<oryx:magnet oryx:cx=\"99\" oryx:cy=\"20\" oryx:anchors=\"right\" />\n \t<oryx:magnet oryx:cx=\"99\" oryx:cy=\"40\" oryx:anchors=\"right\" />\n \t<oryx:magnet oryx:cx=\"99\" oryx:cy=\"60\" oryx:anchors=\"right\" />\n \t\n \t<oryx:magnet oryx:cx=\"25\" oryx:cy=\"1\" oryx:anchors=\"top\" />\n \t<oryx:magnet oryx:cx=\"50\" oryx:cy=\"1\" oryx:anchors=\"top\" />\n \t<oryx:magnet oryx:cx=\"75\" oryx:cy=\"1\" oryx:anchors=\"top\" />\n \t\n \t<oryx:magnet oryx:cx=\"50\" oryx:cy=\"40\" oryx:default=\"yes\" />\n </oryx:magnets>\n <g pointer-events=\"fill\" oryx:minimumSize=\"50 40\">\n\t<rect id=\"text_frame\" oryx:anchors=\"bottom top right left\" x=\"1\" y=\"1\" width=\"94\" height=\"79\" rx=\"10\" ry=\"10\" stroke=\"none\" stroke-width=\"0\" fill=\"none\" />\n\t<rect id=\"bg_frame\" oryx:resize=\"vertical horizontal\" x=\"0\" y=\"0\" width=\"100\" height=\"80\" rx=\"10\" ry=\"10\" stroke=\"#bbbbbb\" stroke-width=\"1\" fill=\"#f9f9f9\" />\n\t\t<text \n\t\t\tfont-size=\"12\" \n\t\t\tid=\"text_name\" \n\t\t\tx=\"50\" \n\t\t\ty=\"40\" \n\t\t\toryx:align=\"middle center\"\n\t\t\toryx:fittoelem=\"text_frame\"\n\t\t\tstroke=\"#373e48\">\n\t\t</text>\n\t\n\t<g id=\"userTask\" transform=\"translate(3,3)\">\n\t\t<path oryx:anchors=\"top left\"\n \t\tstyle=\"fill:#d1b575;stroke:none;\"\n \t\t d=\"m 1,17 16,0 0,-1.7778 -5.333332,-3.5555 0,-1.7778 c 1.244444,0 1.244444,-2.3111 1.244444,-2.3111 l 0,-3.0222 C 12.555557,0.8221 9.0000001,1.0001 9.0000001,1.0001 c 0,0 -3.5555556,-0.178 -3.9111111,3.5555 l 0,3.0222 c 0,0 0,2.3111 1.2444443,2.3111 l 0,1.7778 L 1,15.2222 1,17 17,17\" \n />\n\t\t\n\t</g>\n \n\t<g id=\"parallel\">\n\t\t<path oryx:anchors=\"bottom\" fill=\"none\" stroke=\"#bbbbbb\" d=\"M46 70 v8 M50 70 v8 M54 70 v8\" stroke-width=\"2\" />\n\t</g>\n\t\n\t<g id=\"sequential\">\n\t\t<path oryx:anchors=\"bottom\" fill=\"none\" stroke=\"#bbbbbb\" stroke-width=\"2\" d=\"M46,76h10M46,72h10 M46,68h10\"/>\n\t</g>\n\t\n\n\t<g id=\"compensation\">\n\t\t<path oryx:anchors=\"bottom\" fill=\"none\" stroke=\"#bbbbbb\" d=\"M 62 74 L 66 70 L 66 78 L 62 74 L 62 70 L 58 74 L 62 78 L 62 74\" stroke-width=\"1\" />\n\t</g>\n </g>\n</svg>","icon" : "activity/list/type.user.png","groups" : [ "活动列表" ],"propertyPackages" : [ "overrideidpackage","isforcompensationpackage","multiinstance_typepackage", "namepackage", "documentationpackage", "multiinstance_conditionpackage","usertaskassignmentpackage","duedatedefinitionpackage", "prioritydefinitionpackage","approveTypepackage"],"hiddenPropertyPackages" : [ ],"roles" : [ "Activity", "sequence_start", "sequence_end", "ActivitiesMorph", "all" ]},
2.在editor-app/configuration/properties.js上增加
“zidingyi”: {
“readModeTemplateUrl”: “editor-app/configuration/properties/default-value-display-template.html”,
“writeModeTemplateUrl”: “editor-app/configuration/properties/zidingyi-property-write-template.html”
}
,这两个页面主要是用来表现出该属性在前端页面上的效果
zidingyi-properties-write-template.html
<!-- Just need to instantiate the controller, and it will take care of showing the modal dialog -->
<span ng-controller="KisBpmZDYPropertyCtrl">
</span>
查看控制器 editor-app/configuration/properties-default-controller.js
ar KisBpmZDYPropertyCtrl = [ '$scope', '$modal',"$rootScope", function($scope, $modal,$rootScope) {var opts = {template: 'editor-app/configuration/properties/zidingyi-popup.html?version=' + Date.now(),scope: $scope};// Open the dialog$modal(opts);
}];
该控制器只是用来打开我们自定义的第二个页面的(这个页面主要是用来做附件上传的)
zidingyi-popup.html
<div class="modal" ng-controller="KisBpmZDYPropertyPopupCtrl" ng-init="getData()"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">×</button><h3>附件管理</h3></div><div class="modal-body"><button type="button" class="btn btn-primary" id="upload" ng-click="upload()">附件上传</button><input name="file" type="file" id="file" onchange="angular.element(this).scope().ajax(this)" ng-model="myValue" style="display: none;"><table class="table table-hover" ng-if="count!=0"><tr class="row"><td class="col-ms-1">序号</td><td class="col-ms-5">文件名</td><td class="col-ms-3">上传时间</td><td class="col-ms-3">操作</td></tr><tr ng-repeat="(index,data) in aValue" class="row"><td class="col-ms-1">{{index+1}}</td><td class="col-ms-5">{{data.filename}}</td><td class="col-ms-3">{{data.createTime}}</td><td class="col-ms-3"><!-- <a class="btn btn-primary btn-small">下载</a> --><a class="btn btn-primary btn-small" ng-click="delete(data.id)">删除</a></td></tr></table><p style="display:none;"><textarea auto-focus class="form-control" ng-model="property.value" style="width:70%; height:100%; max-width: 100%; max-height: 100%; min-height: 200px;"/></p></div><div class="modal-footer"><button ng-click="save()" class="btn btn-primary" translate >ACTION.SAVE</button></div></div></div>
</div>
3.在 editor-app/configuration/properties-default-controller.js找到控制器在这里就可以撸代码了(注意jquery符号$在这里需要替换成jQuery)
var KisBpmZDYPropertyPopupCtrl = ['$scope',"$http","$rootScope",function($scope,$http,$rootScope) {$scope.aValue="";$scope.property.value="个附件";$scope.count=0;$scope.getData=function(){
业务需求是附件要和节点做绑定,据分析每个节点都有一个唯一的sid,捕获监听事件
1.定义点击节点时候的事件做判断获取 sid(这里使用了本地存储,而且事件不一定只有点击事件我这里是是在设置了点击事件)(在捕获会有点问题)
oryx.debug.js
_delegateEvent: function(event) {if(this.eventHandlerCallback) {if(event.type=="click"){var a=this.node.id.split("-").slice(1).join("-");localStorage.setItem("nodeId",a);}this.eventHandlerCallback(event, this);}
},
2.在editor-app/stencil-controller.js 这里配置也行
$scope.editor.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, function (event) {var shapes = event.elements;var canvasSelected = false;if (shapes && shapes.length == 0) {shapes = [$scope.editor.getCanvas()];canvasSelected = true;}if (shapes && shapes.length > 0) {var selectedShape = shapes.first();var a=selectedShape.node.id.split("-").slice(1).join("-");$rootScope.nodeId=a; //备用 先将节点标识存在$rootScope上localStorage.setItem("nodeId",a);var stencil = selectedShape.getStencil();
最后的效果图:
activiti扩展节点属性(在UserTask节点上添加附件上传功能)相关推荐
- 【Groovy】自定义 Xml 生成器 BuilderSupport ( 构造 Xml 节点类 | 封装节点名称、节点值、节点属性、子节点 | 将封装的节点数据转为 Xml 字符串 )
文章目录 一.构造 Xml 节点类 1.封装节点名称.节点值.节点属性.子节点 2.将封装的节点数据转为 Xml 字符串 二.Xml 节点类完整代码 一.构造 Xml 节点类 生成 Xml 数据前 , ...
- 用友nc开发,添加附件上传按钮
1.在功能注册中找到有附件上传按钮的的模板,这个模板中文件管理就是附件上传 2.通过Document到xml文件中找到他对应的按钮实现类
- 苹果审核上传附件上传不上去
如题,今天苹果审核上传附件一直不成功.等了10几分钟仍然未上传上去.这是为什么?后来终于发现原来苹果不支持中文,只要改成英文就可以了. 转载于:https://www.cnblogs.com/weic ...
- 驰骋工作流引擎的流程属性-节点属性-前台操作
1: 工作流引擎功能-流程属性 • 支持客户参与流程:比如在一个erp系统里供应商相对企业来说是外部用户,在一个学校系统里,教师是内部用户,学生是外部用户.ccflow支持外部用户登录参与 ...
- DOM-3 【utils/待讲评】节点属性、方法、封装方法、DOM结构
讲评 节点属性 nodeType 元素节点 1 大写 属性节点 2 文本节点 3 #text 注释节点 8 #comment document 9 DocumentFragment 11 nodeNa ...
- 前端:JS/25/DOM官方定义,DOM分类,HTML节点树(节点关系,节点类型,),核心DOM中公共的属性和方法(节点访问,查找DOM节点,节点属性,节点的创建,追加和删除)
DOM官方定义 DOM,Document Object Model,文档对象模型,我们可以把网页中的所有"东西"看成是对象": DOM的官方定义:DOM可以使用脚本,动态 ...
- 【Groovy】自定义 Xml 生成器 BuilderSupport ( 创建 XmlNode 节点 | 管理 XmlNode 节点并将根节点转为 Xml 信息 | 完整代码示例 )
文章目录 一.创建 XmlNode 节点 二.管理 XmlNode 节点并将根节点转为 Xml 信息 三.完整代码示例 1.自定义 Xml 生成器 MyBuilderSupport 2.Xml 节点封 ...
- Swift 扩展存储属性
Swift扩展存储属性 Swift默认只能扩展计算属性无法扩展存储属性,如果想扩展存储属性就需要使用runtime. 使用runtime的两个核心方法(关联对象) /// 设置值 /// - 参数1: ...
- 附件上传在IE中的问题
附件上传在IE中的问题 问题描述:自定义的文件上传input:file在IE浏览器上进行附件上传时,input:file 的onchange事件失效. 原因分析: input:file 控件的onch ...
最新文章
- 2010 ACM/ICPC Online-Contest-SCU[四川赛区网络预选赛]
- 修改文件vim 插件:perl-support的修改和使用
- python中读取文件内容-Python从文件中读取数据(2)
- RunTime 入门
- MOVE-CORRESPONDING 应该注意的语法特点
- php和mysql web开发 笔记_PHP和MySQL Web开发读书笔记---创建Web数据库
- VMware workstation 15.5.2及镜像文件下载
- 美国科学家研制出由病毒构成的微型电池
- 2018软工第六次作业
- php主动推送弹幕_源起网-织梦发布文档主动百度推送熊掌推送批量推送
- Linux之父Linus Torvalds恶评Intel漏洞修复补丁:完全是个垃圾
- php oracle 大字段,php oracle数据库clob和nclob字段
- 第二部分 python基础 day10\11\12 运算符与基本数据类型
- Gephi初识之简单绘图学习
- Atitit 效率提升分析与解决方案 1. 三大模式 优化资源配置 通过降低难度 提升培训	1 1.1. 优化资源配置	1 1.2. 通过降低难度	1 1.3. 提升培训	1 2. 有效与立即可
- 离线版MSDN下载地址
- Android9怎么剪辑音频,音频剪辑铃声制作
- 方差var、协方差cov、协方差矩阵(浅谈)
- 苹果官网查询产品的激活日期教程
- 详解程序员如何备战金三银四跳槽季