自定义表单、流程、菜单开发总结
自定义表单流程:流程中首先需要处理的问题便是链线问题。项目启动时,一直不能确定是否封装浏览器,直到最后链线方法还是使用了SVG(总想有个机会写写canvas)。现在的链线并不完美,但基本功能已实现,等项目重新启动后再进行优化。SVG链线这块,需要注意的是直接向SVG中插入元素该元素是无法实现效果的,需要使用克隆,在获得克隆对象后更改属性值来获得一个新的链线。如下:
使用clone并修改attr 代码 收藏代码
else{
//当前页已存在SVG元素
//克隆已存在的线
line = processSvg.find('polyline').eq(0).clone(false);
line.attr('points',points);
line.attr('style',line_style);
line.attr('class',_class);
line.attr('id',polylineId);
processSvg.append(line);
//克隆已存在的矩形
rect = processSvg.find('rect').eq(0).clone(false);
rect.attr('x',rectX);
rect.attr('y',rectY);
rect.attr('style',rect_style);
rect.attr('id','rect_'+polylineId);
rect.attr('polylineId',polylineId);
processSvg.append(rect);
//克隆已存在文本
_text = processSvg.find('text').eq(0).clone(false);
_text.attr('x',textX);
_text.attr('y',textY);
_text.attr('style',text_style);
_text.attr('id','text_'+polylineId);
_text.attr('polylineId',polylineId);
processSvg.append(_text);
}
在链线上有文字提示,图上所表示的设置和黄色为初始状态。点击可进行编辑,用于设置该链线的流向(提交、退回),条件(成立、不成立);
流程操作界面:
其它的数据交互就只是复杂一些,难度倒没什么。
如果感兴趣某一个点,可以留言。
后续时间不紧了,再做详细更新。