📄 topflow.js
字号:
/*--------------------------------------------------|
| 本作品取得原作者授权修改自 support@tops.com.cn |
| 的作品topflow |
| |
| 本文件是CommitFlow的最核心文件,定义了设计器用到的|
| 各种对象类,以及各种类的方法、属性等,请勿更改此 |
| 文件! |
| |
| 版权归上海雪线信息技术有限公司所有, |
| 技术支持:sales@shcommit.com (仅对付费用户) |
| 网 站:www.shcommit.com |
| |
| 请勿私自拷贝、修改或用于商业用途 |
| 敬请保留本注释. |
| |
| Updated: 20070613 |
|--------------------------------------------------*/
//const
//[任务]类定义
function TProc(AFlow,id){
this.ObjType = "Proc";
this.Flow = AFlow;
this.ID = id;
if(this.ID == undefined) this.ID = this.Flow.getMaxProcID();
this.Text = "新建" + this.ID;
this.ShapeType = "RoundRect";
this.ProcType = "NormalProc";
this.Width = "50";
this.Height = "50";
this.X = "50";
this.Y = "50";
this.TextWeight = "9pt";
this.StrokeWeight = "1";
this.zIndex = 1;
this.InnerObject = null;
this.MoveType = "";
//新增
this.actFlag = "";
this.waittime = "";
this.isSltTrans = "1";
this.isSameCredit = "1";
}
TProc.prototype.getInnerObject = function(){
if(this.InnerObject == null) this.InnerObject = document.all(this.ID);
return this.InnerObject;
}
TProc.prototype.setFocus = function(){
this.getInnerObject.StrokeColor = this.Flow.Config.ProcFocusedStrokeColor;
}
TProc.prototype.lostFocus = function(){
this.getInnerObject.StrokeColor = (this.ProcType == "NormalProc")?this.Flow.Config.ProcColor:this.Flow.Config._ProcColor;
}
TProc.prototype.doClick = function(){
this.Flow.selectObject(this.ID, "Proc");
}
TProc.prototype.mouseDown = function(){
var rightSide = (parseInt(this.X) + parseInt(this.Width) - event.x <= 2);
var bottomSide = (parseInt(this.Y) + parseInt(this.Height) - event.y <= 2);
if(rightSide && bottomSide)
this.MoveType = "nw";
else if(rightSide)
this.MoveType = "e";
else if(bottomSide)
this.MoveType = "n";
else
this.MoveType = "m";
this.getInnerObject.setCapture();
switch(this.MoveType){
case "m":
this.CurrentX = event.x - this.InnerObject.offsetLeft;
this.CurrentY = event.y - this.InnerObject.offsetTop;
break;
case "front":
case "back":
if(_TOOLTYPE == "front")
this.Flow.brintToFront(this);
else
this.Flow.sendToBack(this);
this.getInnerObject.style.zIndex = this.zIndex;
break;
}
}
TProc.prototype.mouseMove = function(){
switch(this.MoveType){
case "m":
this.X = event.x - this.CurrentX;
this.Y = event.y - this.CurrentY;
if(this.X < 0) this.X = 0;
if(this.Y < 30) this.Y = 30;
this.InnerObject.style.left = this.X;
this.InnerObject.style.top = this.Y;
break;
case "n":
this.Height = event.y - this.Y;
if(this.Height < 30) this.Height = 30;
this.InnerObject.style.height = this.Height;
break;
case "e":
this.Width = event.x - this.X;
if(this.Width < 30) this.Width = 30;
this.InnerObject.style.width = this.Width;
break;
case "nw":
this.Width = event.x - this.X;
this.Height = event.y - this.Y;
if(this.Width < 30) this.Width = 30;
if(this.Height < 30) this.Height = 30;
this.InnerObject.style.width = this.Width;
this.InnerObject.style.height = this.Height;
break;
default://没有任何按键的情况下,计算位置并显示相应的操作鼠标
var rightSide = (parseInt(this.X) + parseInt(this.Width) - event.x <= 2);
var bottomSide = (parseInt(this.Y) + parseInt(this.Height) - event.y <= 2);
if(rightSide && bottomSide)
this.getInnerObject.style.cursor = "NW-resize";
else if(rightSide)
this.getInnerObject.style.cursor = "E-resize";
else if(bottomSide)
this.getInnerObject.style.cursor = "N-resize";
else
this.getInnerObject.style.cursor = "hand";
break;
}
}
TProc.prototype.mouseUp = function(){
if(this.MoveType != ""){
this.getInnerObject.releaseCapture();
if(this.MoveType == "nw"){
if(parseInt(this.InnerObject.style.top)<-10){
alert("对象上边界超出,将自动调整.");
this.InnerObject.style.top=30;
}
if(parseInt(this.InnerObject.style.left)<-10){
alert("对象左边界超出,将自动调整.");
this.InnerObject.style.left=30;
}
}
}
this.MoveType = "";
}
TProc.prototype.clone = function(AProc){
this.ID = AProc.ID;
this.Text = AProc.Text;
this.ShapeType = AProc.ShapeType
this.ProcType = AProc.ProcType;
this.Width = AProc.Width;
this.Height = AProc.Height;
this.X = AProc.X;
this.Y = AProc.Y;
this.TextWeight = AProc.TextWeight;
this.StrokeWeight = AProc.StrokeWeight;
this.zIndex = AProc.zIndex;
this.InnerObject = null;
this.MoveType = "";
}
TProc.prototype.setPropValue = function(AProp, AValue){
switch(AProp){
case "ID":
var oldID = this.ID;
if(oldID == AValue) return true;
if(this.Flow.IDExists(AValue)){
alert("编号[" + AValue + "]已经存在!");
return false;
}
this.InnerObject.all(oldID + "Text").id = AValue + "Text";
this.ID = AValue;
this.InnerObject.id = AValue;
this.Flow.changeProcID(oldID, AValue);
break;
case "X":
this.X = AValue;
this.InnerObject.style.left = AValue;
break;
case "Y":
this.Y = AValue;
this.InnerObject.style.top = AValue;
break;
case "Width":
this.Width = AValue;
this.InnerObject.style.width = AValue;
break;
case "Height":
this.Height = AValue;
this.InnerObject.style.height = AValue;
break;
}
}
//[任务]字符串化函数
TProc.prototype.toString = function(){
var cl = this.Flow.Config;
var nStockeColor,nTextColor;
if(this.ProcType == 'BeginProc' || this.ProcType == 'EndProc'){
nTextColor = cl._ProcTextColor;
nStrokeColor = cl._ProcColor;
}
else{
nTextColor = cl.ProcTextColor;
nStrokeColor = cl.ProcColor;
}
var arrVal = new Array();
arrVal["id"] = this.ID;
//arrVal["title"] = this.ID + ':' + this.Text + "\n\nX-" + this.X + " Y-" + this.Y + " W-" + this.Width + " H-" + this.Height + " Z-" + this.zIndex;
arrVal["title"] = this.ID;
arrVal["sc"] = nStrokeColor;
arrVal["st"] = this.ProcType;
arrVal["l"] = this.X;
arrVal["t"] = this.Y;
arrVal["w"] = this.Width;
arrVal["h"] = this.Height;
arrVal["z"] = this.zIndex;
arrVal["sw"] = this.StrokeWeight;
arrVal["fsc"] = cl.ProcFocusedStrokeColor;
arrVal["shadowenable"] = cl.IsProcShadow;
arrVal["shadowcolor"] = cl.ProcShadowColor;
arrVal["3denable"] = cl.IsProc3D;
arrVal["3ddepth"] = cl.Proc3DDepth;
arrVal["sc1"] = cl.ProcColor1;
arrVal["sc2"] = cl.ProcColor2;
arrVal["tc"] = nTextColor;
arrVal["fs"] = this.TextWeight;
arrVal["text"] = this.Text;
//新增
arrVal["af"] = this.actFlag;
arrVal["wt"] = this.waittime;
arrVal["ist"] = this.isSltTrans;
arrVal["isc"] = this.isSameCredit;
return stuffShape(getShapeVal(this.ShapeType), arrVal);
}
//[路径]类定义
function TStep(AFlow,id){
this.ObjType = "Step";
this.Flow = AFlow;
this.ID = id;
if(this.ID == undefined) this.ID = this.Flow.getMaxStepID();
this.Text = "新建" + this.ID;
this.ShapeType = "Line";
this.FromProc = "";
this.ToProc = "";
this.Points = "";
this.Cond = "";
this.StartArrow = "none";
this.EndArrow = "Classic";
this.TextWeight = "9pt";
this.StrokeWeight = "1";
this.zIndex = 0;
this.InnerObject = null;
//新增
this.fromRelX = 0;
this.fromRelY = 0;
this.toRelX = 0;
this.toRelY = 0;
}
TStep.prototype.clone = function(AStep){
this.ID = AStep.ID;
this.Text = AStep.Text;
this.ShapeType = AStep.ShapeType;
this.FromProc = AStep.FromProc;
this.ToProc = AStep.ToProc;
this.Points = AStep.Points;
this.Cond = AStep.Cond;
this.StartArrow = AStep.StartArrow;
this.EndArrow = AStep.EndArrow;
this.TextWeight = AStep.TextWeight;
this.StrokeWeight = AStep.StrokeWeight;
this.zIndex = AStep.zIndex;
this.Points = AStep.Points;
this.fromRelX = AStep.fromRelX;
this.fromRelY = AStep.fromRelY;
this.toRelX = AStep.toRelX;
this.toRelY = AStep.toRelY;
}
TStep.prototype.setPropValue = function(AProp, AValue){
switch(AProp){
case "ID":
var oldID = this.ID;
if(oldID == AValue) return true;
if(this.Flow.IDExists(AValue)){
alert("编号[" + AValue + "]已经存在!");
return false;
}
this.InnerObject.all(oldID + "Text").id = AValue + "Text";
this.InnerObject.all(oldID + "Arrow").id = AValue + "Arrow";
this.ID = AValue;
this.InnerObject.id = AValue;
break;
case "Points":
this.Points = AValue;
break;
case "FromProc":
this.FromProc = AValue;
break;
case "ToProc":
this.ToProc = AValue;
break;
}
}
//[路径]字符串化函数
TStep.prototype.toString = function(){
var StepHTML = '';
var cl = this.Flow.Config;
var arrVal = new Array();
arrVal["id"] = this.ID;
arrVal["title"] = this.ID + ':' + this.Text;
arrVal["sc"] = cl.StepColor;
arrVal["pt"] = this.getPath();
arrVal["z"] = this.zIndex;
arrVal["sw"] = this.StrokeWeight;
arrVal["fsc"] = cl.StepFocusedStrokeColor;
arrVal["sa"] = this.StartArrow;
arrVal["ea"] = this.EndArrow;
arrVal["cond"] = this.Cond;
arrVal["text"] = this.Text;
return stuffShape(getShapeVal(this.ShapeType), arrVal);
}
TStep.prototype.getInnerObject = function(){
if(this.InnerObject == null) this.InnerObject = document.all(this.ID);
return this.InnerObject;
}
TStep.prototype.setFocus = function(){
this.getInnerObject.StrokeColor = this.Flow.Config.StepFocusedStrokeColor;
}
TStep.prototype.lostFocus = function(){
this.getInnerObject.StrokeColor = this.Flow.Config.StepColor;
}
TStep.prototype.doClick = function(){
this.Flow.selectObject(this.ID, "Step");
}
//流程图类定义
function TTopFlow(AName){
this.name = AName;
this.ID = "";
this.Text = "";
this.FileName = "";
this.FormID = "";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -