You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

774 lines
20 KiB

function BasicElement(paramObj) {
/**
* @description 修改节点属性
* @param paramObj 传入参数对象
*/
this.modifyProperty = function (paramObj) {
for (i in paramObj) {
if (typeof this[i] != 'function') {
this[i] = paramObj[i];
}
}
}
/**
* 返回当前对象的属性
* @return 返回当前节点的属性
*/
this.exportToObj = function () {
tmpObj = new Object();
for (i in this) {
if (typeof this[i] != 'function') {
tmpObj[i] = this[i];
}
}
return tmpObj;
}
}
/**
* @description 最基本的Node节点
*/
function Node(paramObj) {
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "";
/**
* 当前节点的唯一ID
*/
this.nodeId = paramObj.nodeId == undefined ? (paramObj.nodeType) + "_" + Date.parse(Date()) : paramObj.nodeId;
/**
* 谁创建的该节点
*/
this.creator = paramObj.creator || " ";
/**
* 节点描述
*/
this.desc = paramObj.desc ||this.nodeName|| "";
/**
* 节点类型
*/
this.nodeType = paramObj.nodeType || "";
/**
* 源节点集合
*/
this.targetId = paramObj.targetId || [];
/**
* 目标节点集合
*/
this.sourceId = paramObj.sourceId || [];
/**
* 目标节点的锚点集合
*/
this.targetAnchor = paramObj.targetAnchor || [];
/***
* 当前节点的连接器集合
*/
this.connector = paramObj.connector || [];
/**
* 当前节点的Y轴坐标
*/
this.blockTop = paramObj.blockTop || "";
/**
* 当前节X轴坐标
*/
this.blockLeft = paramObj.blockLeft || "";
/**
* 节点对应的metaType
*/
this.metaType = NodeMetaObj;
/**
*可以被连接对的点
*/
this.endPoints = ['TopCenter', 'RightMiddle', 'BottomCenter', 'LeftMiddle'];
/**
* @description 添加目标节点
* @param paramID 目标节点ID
* @param paramConnect 与添加节点的连接器
* @param paramAnchor 目标节点的锚点
*
*/
this.appendTargetID = function (paramID, paramConnect, paramAnchor) {
this.targetId.push(paramID);
this.Connector.push(paramConnector);
this.targetAnchor.push(paramAnchor);
}
BasicElement.call(this, paramObj);
}
/**
* @description 流程节点对象
*/
function FlowNode(paramObj) {
Node.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "流程节点";
/**
* 当前节点流程码
*/
this.flowCode = paramObj.flowCode || "";
/**
* 签核类型
*/
this.assignClass = paramObj.assignClass || "";
/**
* 代理设置
*/
this.agentSetting = "";
/**
* 本节点可选择的签核人员
*/
this.assigner = paramObj.assigner || "";
/**
* 代理开始时间
*/
this.agentStartDate = "";
/**
* 代理结束时间
*/
//this.agentEndDate = "";
/**
*可以被连接对的点
*/
this.endPoints = ['TopCenter', 'RightMiddle', 'BottomCenter', 'LeftMiddle'];
/**
* 当前节点所绑定的任务节点集合
*/
//this.taskNodeList = [];
/**
* 节点对应的metaType
*/
this.metaType = FLowNodeMetaObj;
/**
*元素对应的htmlDiv
*/
/**
*元素对应的htmlDiv
*/
this.htmlDiv = paramObj.htmlDiv;
/**
*
* 是否允许指派
*/
this.allowAssign = paramObj.allowAssign || "";
/**
*
* 是否允许转交
*/
this.allowPassTo = paramObj.allowPassTo || "";
/**
*
* 退回选项
*/
this.backOption = paramObj.backOption || "";
/**
* 签核类型方法
*/
this.assignClassMethod = paramObj.assignClassMethod || "";
this.endPoints = ['TopCenter', 'RightMiddle', 'LeftMiddle'];
this.appendTask = function (paramTaskNode) {
this.taskNodeList.push(paramTaskNode);
}
Object.defineProperty(this, 'metaType', {
enumerable: false
});
}
/**
* @description 流程节点对象
*/
function StartNode(paramObj) {
Node.call(this, paramObj);
/**
*
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "申请";
/**
* 当前节点流程码
*/
this.flowCode = paramObj.flowCode || "";
/**
* 签核类型
*/
this.assignClass = paramObj.assignClass || "";
/**
* 签核类型方法
*/
this.assignClassMethod = paramObj.assignClassMethod || "";
/**
* 本节点可选择的签核人员
*/
this.assigner = paramObj.assigner || "";
// /**
// * 当前节点所绑定的任务节点集合
// */
// this.taskNodeList = [];
/**
*可以被连接对的点
*/
this.endPoints = ['RightMiddle'];
/**
* 节点对应的metaType
*/
this.metaType = StartNodeMetaObj;
/**
*元素对应的htmlDiv
*/
this.htmlDiv = paramObj.htmlDiv;
/**
*
* 是否允许指派
*/
this.allowAssign = paramObj.allowAssign || "";
/**
*
* 是否允许转交
*/
this.allowPassTo = paramObj.allowPassTo || "";
/**
*
* 退回选项
*/
this.backOption = paramObj.backOption || "";
Object.defineProperty(this, 'metaType', {
enumerable: false
});
this.appendTask = function (paramTaskNode) {
this.taskNodeList.push(paramTaskNode);
}
Object.defineProperty(this, 'metaType', {
enumerable: false
});
}
/**
* @description 判断节点,继承于Node节点
*/
function LogicNode(paramObj) {
Node.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "逻辑节点";
/**
*控制跳转的的函数
*/
this.routeMethod = paramObj.routeMethod|| "";
/**
* 节点对应的metaType
*/
this.metaType = LogicNodeMetaObj;
/**
*元素对应的htmlDiv
*/
this.htmlDiv = paramObj.htmlDiv;
this.endPoints = ['TopCenter', 'RightMiddle', 'LeftMiddle'];
Object.defineProperty(this, 'metaType', {
enumerable: false
});
}
/**
* @description 流程节点对象
*/
function EndNode(paramObj) {
Node.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "结案节点";
/**
* 当前节点流程码
*/
this.flowCode = paramObj.flowCode || "";
/**
* 签核类型
*/
this.assignClass = paramObj.assignClass || "";
/**
* 本节点可选择的签核人员
*/
this.assigner = paramObj.assigner || "";
/**
*可以被连接对的点
*/
this.endPoints = ['TopCenter'];
/**
* 节点对应的metaType
*/
this.metaType = StartNodeMetaObj;
/**
*元素对应的htmlDiv
*/
this.htmlDiv = paramObj.htmlDiv;
this.appendTask = function (paramTaskNode) {
this.taskNodeList.push(paramTaskNode);
}
Object.defineProperty(this, 'metaType', {
enumerable: false
});
}
function CounterSignTask(paramObj) {
Node.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "会签任务节点";
/**
* 当前节点流程码
*/
this.flowCode = paramObj.flowCode || "";
/**
* 本节点可选择的签核人员
*/
this.assigner = paramObj.assigner || "";
/**
* 节点对应的metaType
*/
this.metaType = CounterSignTaskMetaObj;
this.endPoints = ['TopCenter', 'RightMiddle', 'LeftMiddle'];
/***
*h合并选项
*/
this.mergeOption = paramObj.mergeOption;
/**
*元素对应的htmlDiv
*/
this.htmlDiv = paramObj.htmlDiv;
this.appendTask = function (paramTaskNode) {
this.taskNodeList.push(paramTaskNode);
}
Object.defineProperty(this, 'metaType', {
enumerable: false
});
}
/**
* @description 任务节点
*/
function TaskNode(paramObj) {
Node.call(this, paramObj);
/**
* 任务类型有三种,Mail:邮件,Notice:通知,timedTask:定时任务
*/
this.taskType = "";
/**
*可以被连接对的点
*/
this.endPoints = ['TopCenter', 'RightMiddle', 'LeftMiddle'];
Object.defineProperty(this, 'metaType', {
enumerable: false
});
// /**
// * 该任务是否为全局任务
// */
// this.isGlobal = "N";
// /**
// *触发类型
// *A:Always 每个节点触发; O:OPEN当创建时; C:Close当结案时; N:None 不生效;
// */
// this.triggerType = "N";
}
/**
* @description 邮件任务
*/
function MailTask(paramObj) {
TaskNode.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "邮件任务节点";
/**
* 任务类型
*/
this.taskType = "Mail";
/**
* 邮件发送者
*/
this.mailFrom = paramObj.mailFrom;
/**
* 邮件接收者
*/
this.mailTo = paramObj.mailTo;
/**
* 邮件主题
*/
this.mailSubject = paramObj.mailSubject;
/**
* 邮件内容
*/
this.mailContent = paramObj.mailContent;
this.metaType = MailTaskeMetaObj;
/*只从上面节点接入*/
this.endPoints = ['TopCenter'];
/**
*元素对应的htmlDiv
*/
this.htmlDiv = paramObj.htmlDiv;
Object.defineProperty(this, 'metaType', {
enumerable: false
});
}
/**
* @description 通知任务
*/
function NoticeTask(paramObj) {
TaskNode.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "通知任务节点";
/**
* 任务类型
*/
this.taskType = "Notice";
/***
*通知标题
*/
this.noticeTitle = paramObj.noticeTitle;
/***
*通知Url
*/
this.noticeUrl = paramObj.noticeUrl;
/**
* 通知人员
*/
this.noticeList = [];
this.metaType = NoticeTaskeMetaObj;
/**
*元素对应的htmlDiv
*/
/*只从上面节点接入*/
this.htmlDiv = paramObj.htmlDiv;
Object.defineProperty(this, 'metaType', {
enumerable: false
});
};
/**
* @description 合并任务
*/
function MergeNode(paramObj) {
TaskNode.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "合并任务节点";
/**
* 任务类型
*/
this.taskType = "Merge";
/***
*h合并选项
*/
this.mergeOption = paramObj.mergeOption;
this.metaType = MergeNodeMetaObj;
/**
*元素对应的htmlDiv
*/
/*只从上面节点接入*/
this.endPoints = ['RightMiddle', 'TopLeft', 'BottomLeft'];
this.htmlDiv = paramObj.htmlDiv;
Object.defineProperty(this, 'metaType', {
enumerable: false
});
};
/**
* @description 拆分任务
*/
function SplitNode(paramObj) {
TaskNode.call(this, paramObj);
/**
* 当前节点的名字
*/
this.nodeName = paramObj.nodeName || "拆分";
/**
* 任务类型
*/
this.taskType = "Split";
this.flowCode = paramObj.flowCode || "";
this.metaType = SplitNodeMetaObj;
/**
*元素对应的htmlDiv
*/
/*只从上面节点接入*/
this.endPoints = ['LeftMiddle', 'TopRight', 'BottomRight'];
this.htmlDiv = paramObj.htmlDiv;
Object.defineProperty(this, 'metaType', {
enumerable: false
});
};
/**
* @description 基本节点的元数据
*/
var FlowMetaObj = {
flowName: {group: '基本属性', name: '流程名称', type: 'text'},
systemId: {group: '基本属性', name: '系统ID', type: 'text'},
flowId: {group: '基本属性', name: '流程ID', type: 'text'},
version: {group: '基本属性', name: '版本', type: 'text'},
saveUrl: {group: '基本属性', name: '保存链接', type: 'text'},
publishUrl: {group: '基本属性', name: '发布链接', type: 'text'},
desc: {group: '基本属性', name: '描述', type: 'text'},
endPoints: {group: 'hidden_group'},
selectedNode: {group: 'hidden_group'},
drawID: {group: 'hidden_group'},
flowList: {group: 'hidden_group'},
flowConnector: {group: 'hidden_group'},
metaType: {group: 'not_save_group'}
};
/**
* @description 基本节点的元数据
*/
var NodeMetaObj = {
nodeName: {group: '基本属性', name: '节点名称', type: 'text'},
version: {group: '基本属性', name: '版本', type: 'text'},
creator: {group: '基本属性', name: '创建人员', type: 'text'},
changer: {group: '基本属性', name: '本次修改人员', type: 'text'},
desc: {group: '基本属性', name: '描述', type: 'text'},
targetId: {group: 'hidden_group'},
connector: {group: 'hidden_group'},
sourceId: {group: 'hidden_group'},
targetAnchor: {group: 'hidden_group'},
nodeId: {group: '基本属性', name: '节点ID', type: 'text'},
blockTop: {group: 'hidden_group'},
blockLeft: {group: 'hidden_group'},
endPoints: {group: 'hidden_group'},
metaType: {group: 'not_save_group'},
htmlDiv: {group: 'hidden_group'},
nodeType: {group: 'hidden_group'}
};
/**
* @description 开始节点的元数据
*/
var StartNodeMetaObj = $.extend({}, NodeMetaObj, { //右侧属性表格信息
flowCode: {group: '签核属性', name: '流程码', type: 'text'},
assignClass: {
group: '签核属性',
name: '签核类别',
type: 'options',
options: [{text: '专人签核', value: 'A'}, {text: '审核至科长', value: 'B'}, {
text: '审核至经理',
value: 'C'
}, {text: '审核至协理/厂长/总监', value: 'D'}, {text: '审核至副总', value: 'E'}, {text: '审核至总经理', value: 'F'}
, {text: '由PHP函数返回', value: 'X'}]
},
assignClassMethod: {group: '签核属性', name: 'PHP 函数:', type: 'text_area'},
assigner: {group: '签核属性', name: '签核人员', type: 'text'},
// back_flow_code: { group: '签核属性', name: '可退回流程码', type: 'text' },
allowAssign: {
group: '签核属性', name: '允许指派', type: 'options',
options: [{text: 'True', value: 'true'}, {text: 'Flase', value: 'flase'}]
},
allowPassTo: {
group: '签核属性', name: '允许转交', type: 'options',
options: [{text: 'True', value: 'true'}, {text: 'Flase', value: 'flase'}]
},
backOption: {
group: '签核属性',
name: '退回选项',
type: 'options',
options: [{text: '不可退回', value: ''},
{text: '申请人', value: 'B1'}
]
},
// back_flow_code: { group: '签核属性', name: '可退回流程码', type: 'text' },
// agentEndDate: {group: '代理', name: '结束时间', type: 'text'},
// taskNodeList: { group: '任务列表', name: ' ', type: 'options' }
});
/**
* @description 流程节点的元数据
*/
FLowNodeMetaObj = $.extend({}, NodeMetaObj, { //右侧属性表格信息
flowCode: {group: '签核属性', name: '流程码', type: 'text'},
assignClass: {
group: '签核属性',
name: '签核类别',
type: 'options',
options: [{text: '专人签核', value: 'A'}, {text: '审核至科长', value: 'B'}, {
text: '审核至经理',
value: 'C'
}, {text: '审核至协理/厂长/总监', value: 'D'},
{text: '审核至副总', value: 'E'},
{text: '审核至总经理', value: 'F'},
{text: '由PHP函数返回', value: 'X'}]
},
assignClassMethod: {group: '签核属性', name: 'PHP 函数:', type: 'text_area'},
assigner: {group: '签核属性', name: '签核人员', type: 'text'},
allowAssign: {
group: '签核属性', name: '允许指派', type: 'options',
options: [{text: 'True', value: 'true'}, {text: 'Flase', value: 'flase'}]
},
allowPassTo: {
group: '签核属性', name: '允许转交', type: 'options',
options: [{text: 'True', value: 'true'}, {text: 'Flase', value: 'flase'}]
},
backOption: {
group: '签核属性',
name: '退回选项',
type: 'options',
options: [{text: '不可退回', value: ''}
, {text: '申请人', value: 'B7'}
, {text: '上一个节点', value: 'B4'}
]
},
agentSetting: {
group: '代理',
name: '代理设置',
type: 'options',
options: [{text: '不设置', value: 'E'}, {text: '跳过', value: 'A'}, {
text: '由前一关卡代签',
value: 'B'
}, {text: '由GetAgent代理', value: 'D'}]
},
//agent: {group: '代理', name: '代理人', type: 'text'},
// agentStartDate: {group: '代理', name: '开始时间', type: 'text'},
// agentEndDate: {group: '代理', name: '结束时间', type: 'text'},
// taskNodeList: { group: '任务列表', name: '任务一', type: 'options' ,options: [{ text: '', value: '' }]},
});
/**
* @description 流程节点的元数据
*/
CounterSignTaskMetaObj = $.extend({}, NodeMetaObj, { //右侧属性表格信息
flowCode: {group: '会签属性', name: '流程码', type: 'text'},
assigner: {group: '会签属性', name: '会签成员设置', type: 'text'},
mergeOption: {
group: '合并属性',
name: '合并条件',
type: 'options',
options: [{text: 'AND-必须所有人同意', value: 'AND'}, {text: 'OR-只需一个同意', value: 'OR'}
, {text: 'VOTE-少数服从多数', value: 'VOTE'}]
},
taskType: {group: 'hidden_group'}
});
/**
* @description 逻辑节点的元数据
*
*/
LogicNodeMetaObj = $.extend({}, NodeMetaObj, {
routeMethod: {group: '基本属性', name: 'PHP 函数:', type: 'text_area'},
agentStartDate: {group: '代理', name: '开始时间', type: 'text'}
});
MailTaskeMetaObj = $.extend({}, NodeMetaObj, {
mailFrom: {group: '邮件属性', name: '发件人', type: 'text'},
mailTo: {group: '邮件属性', name: '收件人', type: 'text'},
mailSubject: {group: '邮件属性', name: '邮件主题', type: 'text'},
mailContent: {group: '邮件属性', name: '邮件内容', type: 'text_area'},
taskType: {group: 'hidden_group'}
});
NoticeTaskeMetaObj = $.extend({}, NodeMetaObj, {
noticeTitle: {group: '通知属性', name: '通知标题', type: 'text'},
noticeUrl: {group: '通知属性', name: 'URL', type: 'text'},
noticeList: {group: '通知属性', name: '通知人员', type: 'text'},
taskType: {group: 'hidden_group'}
});
SplitNodeMetaObj = $.extend({}, NodeMetaObj, {
flowCode: {group: '签核属性', name: '流程码', type: 'text'},
taskType: {group: 'hidden_group'}
});
MergeNodeMetaObj = $.extend({}, NodeMetaObj, {
mergeOption: {
group: '合并属性',
name: '合并条件',
type: 'options',
options: [{text: 'AND-必须所有人同意', value: 'AND'}, {text: 'OR-只需一个同意', value: 'OR'}
, {text: 'VOTE-少数服从多数', value: 'VOTE'}]
},
taskType: {group: 'hidden_group'}
});
//基本连接线样式
connectorPaintStyle = {
lineWidth: 4,
strokeStyle: "#61B7CF",
joinstyle: "round",
outlineColor: "white",
outlineWidth: 2
};
// 鼠标悬浮在连接线上的样式
connectorHoverStyle = {
lineWidth: 4,
strokeStyle: "#216477",
outlineWidth: 2,
outlineColor: "white"
};
endpointHoverStyle = {
fillStyle: "#216477",
strokeStyle: "#216477"
};
//空心圆端点样式设置
hollowCircle = {
endpoint: ["Dot", {radius: 8}], //端点的形状
connectorStyle: connectorPaintStyle,//连接线的颜色,大小样式
connectorHoverStyle: connectorHoverStyle,
paintStyle: {
strokeStyle: "#1e8151",
fillStyle: "transparent",
radius: 4,
lineWidth: 2
}, //端点的颜色样式
//anchor: "AutoDefault",
isSource: true, //是否可以拖动(作为连线起点)
connector: ["Flowchart", {stub: [40, 60], gap: 10, cornerRadius: 5, alwaysRespectStubs: true}],
isTarget: true, //是否可以放置(连线终点)
maxConnections: -1, // 设置连接点最多可以连接几条线
connectorOverlays: [["Arrow", {width: 10, length: 10, location: 1}]]
};