📄 designer.ascx
字号:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Designer.ascx.cs" Inherits="VML.WorkFlow.Designer" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<script language="javascript" id="clientEventHandlersJS">
//*******************************************************************************
//2004-5-27
//姜勇
//增加功能:删除节点同时删除有关的关系。
//正在开发的功能:将数据保存于XML字符串,再行保存于数据库中。
//方法为:由XMLDom.LoadXML取得数据与生成数据。
//*******************************************************************************
<!--
//不知道什么,只有将这段放在页面内才起作用。
function DrawLine() {
//记忆最终节点
var tempEndPoint;
tempEndPoint=event.srcElement;
//声明箭头对象
var strstroke="<v:stroke color='bule' EndArrow='classic'></v:stroke>";
var tempstroke=document.createElement(strstroke);
//线段对象
var strElement="<v:polyline style='Z-Index:-1' id =ConnectLine class= NormalLine points="+line1.points.value+" EndShape="+tempEndPoint.Refid+" BeginShape="+Starline.Refid+"></v:polyline>";
var newPoint = document.createElement(strElement);
//增加线段的箭头。
newPoint.appendChild(tempstroke);
//增加子项
WorkFlowGroup.appendChild(newPoint);
//设定某个节点为起始节点
//if(Starline.Refid=='0')
//{
// document.getElementById(tempEndPoint.Refid).isStart='1';
//}
}
function DrawWorkFlowItem()
{
//又是一个问题:脚本不能一次性建立group和里面的对象,只对分开建立
//看来要定义很多对象,之后进行建立了。
MaxID=MaxID+1;
//WorkFlowItem的组
var tempg="<v:Group style='WIDTH: 1000px; POSITION: absolute; HEIGHT: 500px;' id ='WorkFlowItemGroup' coordsize='1000,500'></v:Group>";
//生成组,并添加工作流项
var tempgroupel;
tempgroupel=document.createElement(tempg);
//将整体加入到集合中
WorkFlowGroup.appendChild(tempgroupel);
var WorkFlowElement="<v:rect id='temp"+MaxID+"' class='WorkFlowItem' Title='未设定部门' style='WIDTH: 1000px; POSITION: absolute; HEIGHT: 500px' coordsize = '21600,21600' fillcolor = 'red' strokecolor = '#5082b9'></v:rect>";
//建立WorkFlowItem对象
var NewWorkFlowItem = document.createElement(WorkFlowElement);
tempgroupel.appendChild(NewWorkFlowItem);
//生成fill对象并加到工作流项中
var tempfill=document.createElement("<v:fill type = 'gradient' color2 = 'yellow' angle = '0' method = 'sigma'></v:fill>");
NewWorkFlowItem.appendChild(tempfill);
//生成Shadow对象并加到工作流项中
var tempShadow=document.createElement("<v:shadow on = 't' type = 'perspective' color = 'black' opacity = '19660f' matrix = '' offset = '2pt,3pt'></v:shadow>");
NewWorkFlowItem.appendChild(tempShadow);
//生成Textbox对象并加到工作流项中
var tempTextbox=document.createElement("<v:TextBox style='MARGIN-TOP: 4.718pt; LEFT: auto; MARGIN-LEFT: 8.312pt; WIDTH: 59.875pt; TOP: auto; HEIGHT: 29.562pt'></v:TextBox>");
NewWorkFlowItem.appendChild(tempTextbox);
var temptext=document.createTextNode("未定义部门");
tempTextbox.appendChild(temptext);
//加入工作流项的流入线段,将线段加在组中。
var tempinLine=document.createElement("<v:line class=EndLine style='POSITION: absolute;CURSOR: hand' Refid='temp"+MaxID+"' from = '1000,250' to = '1150,250' strokecolor = 'black'></v:line>");
tempinLine.appendChild(document.createElement("<v:stroke endarrow = 'classic'></v:stroke>"));
tempgroupel.appendChild(tempinLine);
//加入工作流项的流出线段,将线段加在组中。
var tempoutLine=document.createElement("<v:line class=StartLine style='POSITION: absolute;CURSOR: hand' Refid='temp"+MaxID+"' from = '-100,250' to = '0,250' strokecolor = 'black'></v:line>");
tempoutLine.appendChild(document.createElement("<v:stroke startarrow = 'oval'></v:stroke>"));
tempgroupel.appendChild(tempoutLine);
//window.alert('流程已经添加,请用右键为其设定部门和时限');
}
function btnADD_onclick() {
DrawWorkFlowItem();
}
//编辑节点对应的部门
function SelectDepartment(WorkFlowItemobj)
{
imgArr = showModalDialog('EditDepartment.aspx',window,'dialogWidth:350px; dialogHeight:150px;help:0;status:0;resizeable:1;');
if (imgArr != null)
{
//************************************
//为进行部门已经存在性检查
if (ContainDepartMent(imgArr['DepartmentID'])&&WorkFlowItemobj.id!=imgArr['DepartmentID'])
{
window.alert('部门已经存在,请选择其它部门');
return;
}
//***********************************
//保存原有的ID
var oldID=WorkFlowItemobj.id;
//为部门ID,部门名称和时限附值。
WorkFlowItemobj.id=imgArr['DepartmentID'];
//throw 'dd';
WorkFlowItemobj.children[2].childNodes[0].nodeValue=imgArr['DepartmentName'];
WorkFlowItemobj.title="时限为"+imgArr['limitDate']+"天";
WorkFlowItemobj.DepName=imgArr['DepartmentName'];
WorkFlowItemobj.LimiteDate=imgArr['limitDate']
//为流入与流出节点附值
WorkFlowItemobj.parentElement.children[1].Refid=imgArr['DepartmentID'];
WorkFlowItemobj.parentElement.children[2].Refid=imgArr['DepartmentID'];
//如果已经有关系,还得去改变关系的endshape和beginshape
UpdateRel(oldID,imgArr['DepartmentID']);
}
else
{}
}
//重置流程的结束点
function RetSetEndWorkFlowIetm()
{
var AllRect =new Array();
AllRect=document.getElementsByTagName('rect');
if (AllRect!=null)
{
var count=AllRect.length;
if (count)
{
var i;
for (i=0;i<count;i++)
{
if(AllRect[i].isStart=='-1')
AllRect[i].isStart='0';
}
}
else
{
if(AllRect.isStart=='-1')
AllRect.isStart='0';
}
}
}
//查看是否图中已经存在此部门
function ContainDepartMent(DepartmentID)
{
var AllRect =new Array();
AllRect=document.getElementsByTagName('rect');
if (AllRect!=null)
{
var count=AllRect.length;
if (count)
{
var i;
for (i=0;i<count;i++)
{
if(AllRect[i].id==DepartmentID) return true;
}
}
else
{
if(AllRect.id==DepartmentID) return true;
}
return false;
}
return false;
}
//取得数据,以XML形式表示
function CreateXmlData()
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
var XmlEle;
xmlDoc.loadXML('<Flow></Flow>');
var Root=xmlDoc.childNodes[0];
//取得所有的部门并进行数据形成,形成为XML格式。
var AllRect =new Array();
AllRect=document.getElementsByTagName('rect');
var j;
var AfterDeparts='';
var DepartsDays='';
if (AllRect!=null)
{
var count=AllRect.length;
if (count)
{
for (j=0; j<count; j++)
{
//如果有未指定部门的工作流项,则退出并报告错误!
if(AllRect[j].id.substring(0,1)=="t")
{
throw '有未指定部门,不能保存工作流程';
}
//增加XML数据
//加入取得原数据库接口需要的数据。
//AstrDepDays//流程相关部门和办理时限的字符串,格式为:各部门之间用分号(;)间隔,部门ID和部门时限之间用逗号(,)间隔,结束部门最后不需要加任何间隔符号。如:部门ID1,时限1;部门ID2,时限2;......
/// AstrDepAfters//流程相关部门之间的后置关系字符串,格式为:各部门之间用分号(;)间隔,部门ID和后置部门ID集合之间用逗号(,)间隔,后置部门ID之间也用逗号(,)间隔,结束部门最后不需要加任何间隔符号。如:部门ID1,部门ID1后置部门ID1,部门ID1后置部门ID2,......;部门ID2,部门ID2后置部门ID1,部门ID2后置部门ID2,......;......
//将开始与结束节点去除
if(AllRect[j].id!='-1' && AllRect[j].id!='0' )
{
AfterDeparts=AfterDeparts+";"+AllRect[j].id+GetAfterDepartments(AllRect[j].id);
DepartsDays=DepartsDays+";"+AllRect[j].id+","+AllRect[j].LimiteDate
}
//依次读取FlowBaseID,DepartID(id),Name(DepName),PriDepID(通过方法进行)
//LimiteDate(Title)。
var tempElement=xmlDoc.createElement('OnlySp_FlowDetail');
Root.appendChild(tempElement);
//FlowBaseID
var tempFlowBase=xmlDoc.createElement('FlowBaseID');
tempFlowBase.text=document.all.item('Designer1_FlowBase').value;
tempElement.appendChild(tempFlowBase);
//DepartID
var tempDepartID=xmlDoc.createElement('DepartID');
tempDepartID.text=AllRect[j].id;
tempElement.appendChild(tempDepartID);
//DepartName
var tempDepartName=xmlDoc.createElement('Name');
tempDepartName.text=AllRect[j].DepName;
tempElement.appendChild(tempDepartName);
//PriDepID
var tempPriDepID=xmlDoc.createElement('PriDepID');
tempPriDepID.text=GetPreWorkFlowItems(AllRect[j].id);
tempElement.appendChild(tempPriDepID);
//LimiteDate
var tempLimiteDate=xmlDoc.createElement('LimiteDate');
tempLimiteDate.text=AllRect[j].LimiteDate;
tempElement.appendChild(tempLimiteDate);
//PosX
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -