前端
1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="flow_view.aspx.cs" Inherits="general_WorkFlow_flow_view" %>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head runat="server">
7 <title>流程图</title>
8 <link href="http://f.oa.com/theme2009/1/top.css" rel="Stylesheet" type="text/css" />
9 <script language="javascript" type="text/javascript">
10 focus();
11 function SetBgColor(obj, color)
12 {
13 obj.parentElement.style.backgroundColor = color;
14 }
15 function SetStatus(obj)
16 {
17
18 if (obj.parentElement.rows.length == 1) return;
19 if (obj.parentElement.rows[1].style.display == 'none')
20 {
21 obj.parentElement.rows[1].style.display = '';
22 obj.parentElement.rows[2].style.display = '';
23 }
24 else
25 {
26 obj.parentElement.rows[1].style.display = 'none';
27 obj.parentElement.rows[2].style.display = 'none';
28 }
29 }
30 function view_graph()
31 {
32 myleft=(screen.availWidth-800)/2;
33 window.open("view_graph.aspx?flow_id=<%=ViewState["FlowId"] %>","graph_view","status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=800,height=500,left="+myleft+",top=50");
34 }
35 focus();
36
37 function sms_remind()
38 {
39 var url="sms.aspx?run_id=<%= ViewState["RunId"]%>";
40 myleft=(screen.availWidth-600)/2;
41 window.open(url,"flow_sms","status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=600,height=350,left="+myleft+",top=100");
42 }
43 </script>
44
45 </HEAD>
46 <body class="bodycolor" topMargin="5">
47 <form id="Form1" method="post" runat="server"></form>
48 <asp:placeholder runat="server" ID="plMap" ></asp:placeholder>
49 </body>
50
51 </HTML>
52
后端
![]()
Code
1 using System;
2 using System.Web.UI;
3 using System.Web.UI.HtmlControls;
4 using System.Web.UI.WebControls;
5 using System.Data;
6
7 using Miracle.Web.Commands.Back;
8 using Miracle.Web.Base;
9 using Miracle.Web.Struct;
10 using Miracle.Web.Commands.Public;
11 using Miracle.Web.UI.Back;
12 using Miracle.Web.Binds;
13
14 public partial class general_WorkFlow_flow_view : PageUI
15 {
16 protected DataTable dt;//存储当前任务的步骤列表
17 protected new void Page_Load(object sender, EventArgs e)
18 {
19 if (!IsPostBack)
20 {
21 ViewState["RunId"] = Bases.ToInt(Current.Get("run_id"),0);
22 dt = RunPrcses.GetRunPrcsListByRunID(Bases.ToInt(ViewState["RunId"], 0));
23 if(dt!=null)
24 {
25 DataRow[] drs=dt.Select("ParentID = 0 ");
26 if (drs != null && drs.Length > 0)
27 {
28 this.plMap.Controls.Add(this.GetChildNote(drs[0]));
29 }
30 }
31 }
32 }
33
34 private System.Web.UI.HtmlControls.HtmlTable GetChildNotes(DataRow[] Items)
35 {
36 HtmlTable table = new HtmlTable();
37 table.Rows.Add(new HtmlTableRow());
38 table.Width = "100%";
39 table.CellPadding = 0;
40 table.CellSpacing = 0;
41
42 for (int i = 0; i < Items.Length; i++)
43 {
44 HtmlTableCell cell = new HtmlTableCell();
45 if (Items.Length == 1)
46 {
47 cell.Controls.Add(this.GetLine());
48 }
49 else if (i == 0)
50 {
51 cell.Controls.Add(this.GetRightTopLine());
52 }
53 else if (i == Items.Length - 1)
54 {
55 cell.Controls.Add(this.GetLeftTopLine());
56 }
57 else
58 {
59 cell.Controls.Add(this.GetAcross());
60 }
61 cell.Controls.Add(this.GetChildNote(Items[i]));
62 cell.VAlign = "top";
63 table.Rows[0].Cells.Add(cell);
64 }
65
66 return table;
67 }
68
69 private System.Web.UI.HtmlControls.HtmlTable GetChildNote(DataRow Item)
70 {
71 HtmlTable table = new HtmlTable();
72 table.Rows.Add(new HtmlTableRow());
73 table.Width = "100%";
74 table.Rows[0].Cells.Add(new HtmlTableCell());
75 table.Rows[0].Cells[0].Controls.Add(this.GetBox(Item));
76 table.Rows[0].Cells[0].Align = "center";
77 table.Rows[0].Attributes.Add("onmouseover", "SetBgColor(this, '#BDFCC9')");
78 table.Rows[0].Attributes.Add("onmouseout", "SetBgColor(this, '');");
79 table.Rows[0].Attributes.Add("ondblclick", "SetStatus(this)");
80 table.CellSpacing = 1;
81 table.CellPadding = 0;
82
83 //List<QuartersItem> Items = QuartersService.GetBLL().FindItemsByHigerupId(Item.Id);
84 DataRow[] Items = dt.Select("ParentID = " + Item["ID"].ToString());
85 if (Items.Length > 0)
86 {
87 HtmlTableRow toprow = new HtmlTableRow();
88 HtmlTableCell topcell = new HtmlTableCell();
89 toprow.Cells.Add(topcell);
90 topcell.Controls.Add(this.GetLine());
91 table.Rows.Add(toprow);
92
93 HtmlTableRow row = new HtmlTableRow();
94 HtmlTableCell cell = new HtmlTableCell();
95 if (Items.Length > 1)
96 {
97 //topcell.Controls.Add(this.GetAcross());
98 cell.Controls.Add(this.GetChildNotes(Items));
99 }
100 else
101 {
102 cell.Controls.Add(this.GetChildNote(Items[0]));
103 }
104 row.Cells.Add(cell);
105 table.Rows.Add(row);
106 }
107 return table;
108 }
109
110 private HtmlTable GetLine()
111 {
112 HtmlTable table = new HtmlTable();
113 HtmlTableRow row = new HtmlTableRow();
114 row.Cells.Add(new HtmlTableCell());
115 row.Cells.Add(new HtmlTableCell());
116 row.Cells[0].Width = "50%";
117 row.Cells[0].InnerHtml = " ";
118 row.Cells[0].Style.Add("border-right", "1px solid black");
119 row.Cells[1].Width = "50%";
120 row.Cells[1].InnerHtml = " ";
121 table.Rows.Add(row);
122 table.Width = "100%";
123 table.CellPadding = 0;
124 table.CellSpacing = 0;
125 return table;
126 }
127
128 private HtmlTable GetAcross()
129 {
130 HtmlTable table = new HtmlTable();
131 HtmlTableRow row = new HtmlTableRow();
132 row.Cells.Add(new HtmlTableCell());
133 row.Cells.Add(new HtmlTableCell());
134 row.Cells[0].Width = "50%";
135 row.Cells[0].InnerHtml = " ";
136 row.Cells[0].Style.Add("border-right", "1px solid black");
137 row.Cells[1].Width = "50%";
138 row.Cells[1].InnerHtml = " ";
139 table.Rows.Add(row);
140 table.Width = "100%";
141 table.CellPadding = 0;
142 table.CellSpacing = 0;
143 table.Style.Add("border-top", "1px solid black");
144 return table;
145 }
146
147 private HtmlTable GetLeftTopLine()
148 {
149 HtmlTable table = new HtmlTable();
150 HtmlTableRow row = new HtmlTableRow();
151 row.Cells.Add(new HtmlTableCell());
152 row.Cells.Add(new HtmlTableCell());
153 row.Cells[0].Width = "50%";
154 row.Cells[0].InnerHtml = " ";
155 row.Cells[0].Style.Add("border-right", "1px solid black");
156 row.Cells[0].Style.Add("border-top", "1px solid black");
157 row.Cells[1].Width = "50%";
158 row.Cells[1].InnerHtml = " ";
159 table.Rows.Add(row);
160 table.Width = "100%";
161 table.CellPadding = 0;
162 table.CellSpacing = 0;
163 return table;
164 }
165
166 private HtmlTable GetRightTopLine()
167 {
168 HtmlTable table = new HtmlTable();
169 HtmlTableRow row = new HtmlTableRow();
170 row.Cells.Add(new HtmlTableCell());
171 row.Cells.Add(new HtmlTableCell());
172 row.Cells[0].Width = "50%";
173 row.Cells[0].InnerHtml = " ";
174 row.Cells[0].Style.Add("border-right", "1px solid black");
175 row.Cells[1].Style.Add("border-top", "1px solid black");
176 row.Cells[1].Width = "50%";
177 row.Cells[1].InnerHtml = " ";
178 table.Rows.Add(row);
179 table.Width = "100%";
180 table.CellPadding = 0;
181 table.CellSpacing = 0;
182 return table;
183 }
184
185 private System.Web.UI.HtmlControls.HtmlTable GetBox(DataRow Item)
186 {
187 HtmlTable table = new HtmlTable();
188 table.CellSpacing = 1;
189 table.CellPadding = 1;
190 HtmlTableRow row = new HtmlTableRow();
191 HtmlTableCell cell = new HtmlTableCell();
192 cell.Controls.Add(this.GetBoxInnerHtml(Item));
193 cell.Align = "center";
194 cell.BgColor = "#87CEEB";
195 row.Cells.Add(cell);
196 table.Rows.Add(row);
197 table.Style.Add("border", "1px solid black");
198 return table;
199 }
200
201 private HyperLink GetBoxInnerHtml(DataRow Item)
202 {
203 HyperLink hlDetail = new HyperLink();
204 hlDetail.Text = Item["RealName"].ToString() + " 完成: " + Item["Tempo"].ToString() + "% " + Item["content"].ToString();
205 hlDetail.NavigateUrl = "View.aspx?Id=" + Item["UserId"].ToString();
206 hlDetail.Target = "_blank";
207 hlDetail.Font.Bold = true;
208 hlDetail.Style.Add("color", "black");
209 return hlDetail;
210 }
211 }
212
图例