流程编辑器原型

 

 

      最近使用工作流引擎,要求实现一个比较便捷的流程编辑工具,但是一直没有找到一个比较好的开源流程编辑器,于是自己组织开发了一个,实现了流程定制、修改、流转步骤属性设置等功能,可实时编辑后切换流程,晒下效果图,呵呵。如果有不足之处,望大家指正,我会在后续版本中继续完善。

  

[removed] <!-- var listenerFieldsEditCount = 0; jq(function(){ _listener_event_type=jq('#listenerEventType').combobox({ editable:false }); _task_listener_fields_dg=jq('#task-listeners-fields-list').datagrid({ //title:"Listener", //url:'${ctx}/wf/procdef/procdef!search.action',//加载表格数据的URL singleSelect:true, width:600, height:300, iconCls:'icon-edit', //fit:true, //idField:'id', //pagination:true, //pageSize:15, //pageNumber:1, //pageList:[10,15], rownumbers:true, //sortName:'id', //sortOrder:'asc', striped:true, toolbar:[{ text:'New', iconCls:'icon-add', handler:function(){ if(listenerFieldsEditCount>0){ jq.messager.alert("error","有可编辑的单元格,不能添加!",'error'); return; } jq('#task-listeners-fields-list').datagrid('appendRow',{ id:'', fieldName:'', type:'', value:'', action:'' }); var index = jq('#task-listeners-fields-list').datagrid('getRows').length-1; jq('#task-listeners-fields-list').datagrid('beginEdit', index); } }], onDblClickRow:function(rowIndex,rowData){ editListenerField(rowIndex); }, onBeforeEdit:function(index,row){ row.editing = true; jq(this).datagrid('refreshRow', index); listenerFieldsEditCount++; }, onAfterEdit:function(index,row){ row.editing = false; jq(this).datagrid('refreshRow', index); listenerFieldsEditCount--; }, onCancelEdit:function(index,row){ row.editing = false; jq(this).datagrid('refreshRow', index); listenerFieldsEditCount--; } }); jq('#fieldSaveBt').linkbutton({ iconCls:"icon-save" }); jq('#fieldCancelBt').linkbutton({ iconCls:"icon-cancel" }); jq("#listenerServiceClass").autocomplete(_process_def_provided_listeners, { width: 450, minChars: 0, max: 10, autoFill: true, mustMatch: false, matchContains: false, scrollHeight: 220, //multiple: true, //multipleSeparator: " ", scroll: true }); populateListenerProperties(); }); function changeListenerServiceType(obj){ if(obj.value=='javaClass'){ jq('#listenerServiceLabel').html('Service Class:'); jq('#listenerServiceClass').show(); jq('#listenerServiceExpression').hide(); }else if(obj.value=='expression'){ jq('#listenerServiceLabel').html('Expression:'); jq('#listenerServiceClass').hide(); jq('#listenerServiceExpression').show(); } } function listenerFieldsActionFormatter(value,rowData,rowIndex){ var id = rowIndex; var s='<img onclick="saveListenerField('+id+')" src="../../image/ok.png" title="'+"确定"+'" style="cursor:hand;"/>'; var c='<img onclick="cancelListenerField('+id+')" src="../../image/cancel.png" title="'+"取消"+'" style="cursor:hand;"/>'; var e='<img onclick="editListenerField('+id+')" src="../../image/modify.png" title="'+"修改"+'" style="cursor:hand;"/>'; var d='<img onclick="deleteListenerField('+id+')" src="../../image/delete.gif" title="'+"删除"+'" style="cursor:hand;"/>'; if(rowData.editing) return s; else return e+' '+d; } function cancelListenerField(id){ _task_listener_fields_dg.datagrid('cancelEdit', id); } function editListenerField(id){ _task_listener_fields_dg.datagrid('beginEdit', id); } function saveListenerField(id){ //alert(id); _task_listener_fields_dg.datagrid('endEdit', id); //alert(editcount); } function deleteListenerField(id){ _task_listener_fields_dg.datagrid('deleteRow',id); refreshAllListenerFields(); } function refreshAllListenerFields(){ var rs = _task_listener_fields_dg.datagrid('getRows'); for(var i=0;i0){ jq.messager.alert("error","",'error'); return null; } var insertRows = _task_listener_fields_dg.datagrid('getChanges','inserted'); var updateRows = _task_listener_fields_dg.datagrid('getChanges','updated'); var deleteRows = _task_listener_fields_dg.datagrid('getChanges','deleted'); var changesRows = { inserted : [], updated : [], deleted : [] }; if (insertRows.length>0) { for (var i=0;i0) { for (var k=0;k0) { for (var j=0;j0){ jq.messager.alert("error","请先保存可编辑的表格!",'error'); return; } if(listenerId != "" && listenerId != null && listenerId!="null"&&listenerId;!="NULL"){ var listener = getExsitingListener(); var r = updateExistingListener(listener); if(!r)return; }else{ var listener = createNewListener(); var r = insertNewListener(listener); if(!r)return; } _listener_win.window('close'); } function insertNewListener(listener){ listener.event=_listener_event_type.combobox('getValue'); jq('input[name="listenerServiceType"]').each(function(i){ if(this.checked){ listener.serviceType=this.value; return false; } }); listener.serviceClass=jq('#listenerServiceClass').val(); listener.serviceExpression=jq('#listenerServiceExpression').val(); var changesRows = getListenerFieldsGridChangeRows(); if(changesRows == null)return false; var insertRows = changesRows['inserted']; if (insertRows.length>0) { for (var i=0;i0) { for (var i=0;i0) { for (var k=0;k0) { for (var j=0;j<deleteRows.length;j++) { listener.deleteField(deleteRows[j].id); } } loadTaskListeners(); return true; } function populateListenerProperties(){ if(listenerId != "" && listenerId != null && listenerId!="null"&&listenerId;!="NULL"){ var listener = task.getTaskListener(listenerId); _listener_event_type.combobox('setValue',listener.event); var serviceType = listener.serviceType; jq('input[name="listenerServiceType"]').each(function(i){ if(this.value==serviceType){ this.checked=true; changeListenerServiceType(this); if(this.value=='javaClass'){ jq('#listenerServiceClass').val(listener.serviceClass); }else if(this.value=='expression'){ jq('#listenerServiceExpression').val(listener.serviceExpression); } return false; } }); var fields = listener.fields; var _listener_fields_grid_data=[]; for(var i=0;i<fields.getSize();i++){ var field = { id:fields.get(i).id, fieldName:fields.get(i).name, type:fields.get(i).type, value:fields.get(i).value, action:'' }; _listener_fields_grid_data[i]=field; } _task_listener_fields_dg.datagrid('loadData',_listener_fields_grid_data); } } function closeTaskListenerWin(){ _listener_win.window('close'); } //--> [removed] Event: Create Assignment Complete All <input type="radio" id="listenerServiceType" name="listenerServiceType" value="javaClass" checked="checked" Class <input type="radio" id="listenerServiceType" name="listenerServiceType" value="expression" Service Class: <input type="text" id="listenerServiceClass" name="listenerServiceClass" size="80" value=""/> <input type="text" id="listenerServiceExpression" name="listenerServiceExpression" size="80" none;" value=""/> Fields: Field Name Type Value Action <a href="##" id="fieldSaveBt" <a href="##" id="fieldCancelBt"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值