RoadFlow2.1 临时演示

Default.aspx 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebForm.Controls.SelectMember.Default" %>
  2. <!DOCTYPE html>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <title></title>
  7. <style type="text/css">
  8. .SelectBorder{border:1px solid #cccccc; padding:3px 3px 3px 3px;}
  9. body { overflow:hidden;}
  10. </style>
  11. <script type="text/javascript">
  12. var win = new RoadUI.Window();
  13. </script>
  14. </head>
  15. <body>
  16. <%
  17. RoadFlow.Platform.Organize borganizename = new RoadFlow.Platform.Organize();
  18. string userPrefix = RoadFlow.Platform.Users.PREFIX;
  19. string workgroupPrefix = RoadFlow.Platform.WorkGroup.PREFIX;
  20. string values = Request.QueryString["values"];
  21. string rootid = Request.QueryString["rootid"];
  22. string defaultValuesString = "";
  23. bool isChangeType = "1" == Request.QueryString["isChangeType"];
  24. System.Text.StringBuilder defautlSB = new System.Text.StringBuilder();
  25. foreach (string value in values.Split(','))
  26. {
  27. if (value.IsNullOrEmpty())
  28. {
  29. continue;
  30. }
  31. string name = borganizename.GetName(value);
  32. if (name.IsNullOrEmpty())
  33. {
  34. continue;
  35. }
  36. defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value);
  37. defautlSB.Append(name);
  38. defautlSB.Append("</div>");
  39. }
  40. defaultValuesString = defautlSB.ToString();
  41. %>
  42. <table border="0" cellpadding="0" cellspacing="0" align="center" style="margin-top:4px;">
  43. <tr>
  44. <td valign="top">
  45. <div style="margin-bottom:4px;">
  46. 显示类型:<select onchange="treecng(this.value);" <%=isChangeType?"disabled='disabled'":"" %> id="showtype" class="myselect" style="width:158px;">
  47. <option value="0">组织机构</option>
  48. <option value="1">工作组</option>
  49. </select>
  50. </div>
  51. <div id="Organize" style="width:210px; height:392px; overflow:auto;" class="SelectBorder"></div>
  52. </td>
  53. <td align="center" style="padding:0px 6px;" valign="middle">
  54. <div style="margin-bottom:12px;"><button class="mybutton" onclick="add();">添加</button></div>
  55. <div style="margin-bottom:12px;"><button class="mybutton" onclick="del();">删除</button></div>
  56. <div style="margin-bottom:12px;"><button class="mybutton" onclick="confirm1();">确定</button></div>
  57. <div><button class="mybutton" onclick="win.close();">取消</button></div>
  58. </td>
  59. <td valign="top">
  60. <div id="SelectNote" class="SelectBorder" style="width:200px; height:40px; overflow:auto; margin-bottom:5px;">
  61. <span style="color:#ccc;">单击已选择项可显示该项详细信息</span>
  62. </div>
  63. <div id="SelectDiv" style="width:200px; height:367px; overflow:auto;" class="SelectBorder">
  64. <%=defaultValuesString %>
  65. </div>
  66. </td>
  67. </tr>
  68. </table>
  69. <script type="text/javascript">
  70. var isdept = '<%=Request.QueryString["isdept"]%>';
  71. var isunit = '<%=Request.QueryString["isunit"]%>';
  72. var isstation = '<%=Request.QueryString["isstation"]%>';
  73. var isuser = '<%=Request.QueryString["isuser"]%>';
  74. var ismore = '<%=Request.QueryString["ismore"]%>';
  75. var isall = '<%=Request.QueryString["isall"]%>';
  76. var isgroup = '<%=Request.QueryString["isgroup"]%>';
  77. var onlyunit = '<%=Request.QueryString["onlyunit"]%>';
  78. var eid = '<%=Request.QueryString["eid"]%>';
  79. var rootid = '<%=rootid%>';
  80. var values = '<%=values%>';
  81. var userBefor = '<%=userPrefix%>';
  82. var userWorkGroup = '<%=workgroupPrefix%>';
  83. var orgTree = null;
  84. var current = null;
  85. var currentDel = null;
  86. $(function ()
  87. {
  88. orgTree = new RoadUI.Tree({
  89. id: "Organize", path: top.rootdir + "/Platform/Members/Tree1.ashx?showtype=0&isall=" + isall + "&onlyunit=" + onlyunit + "&rootid=" + rootid, refreshpath: top.rootdir + "/platform/Members/TreeRefresh.ashx?showtype=0",
  90. onclick: click, ondblclick: dblclick
  91. });
  92. });
  93. function treecng(val)
  94. {
  95. if (!val)
  96. {
  97. val = $("#showtype").val();
  98. }
  99. orgTree = new RoadUI.Tree({
  100. id: "Organize", path: top.rootdir + "/Platform/Members/Tree1.ashx?showtype=" + val + "&isall=" + isall + "&onlyunit=" + onlyunit + "&rootid=" + rootid, refreshpath: top.rootdir + "/Platform/Members/TreeRefresh.ashx?showtype=" + val,
  101. onclick: click, ondblclick: dblclick
  102. });
  103. }
  104. function click(json)
  105. {
  106. current = json;
  107. }
  108. function dblclick(json)
  109. {
  110. click(json);
  111. add();
  112. }
  113. function add()
  114. {
  115. if (!current)
  116. {
  117. alert("没有选择要添加的项"); return;
  118. }
  119. if (("0" == ismore || "false" == ismore.toLowerCase()) && $("#SelectDiv").children("div").size() >= 1)
  120. {
  121. alert("当前设置最多只能选择一项!"); return;
  122. }
  123. if (current.type == 1 && ("0" == isunit || "false" == isunit.toLowerCase()))
  124. {
  125. alert("当前设置不允许选择单位!"); return;
  126. }
  127. if (current.type == 2 && ("0" == isdept || "false" == isdept.toLowerCase()))
  128. {
  129. alert("当前设置不允许选择部门!"); return;
  130. }
  131. if (current.type == 3 && ("0" == isstation || "false" == isstation.toLowerCase()))
  132. {
  133. alert("当前设置不允许选择岗位!"); return;
  134. }
  135. if (current.type == 4 && ("0" == isuser || "false" == isuser.toLowerCase()))
  136. {
  137. alert("当前设置不允许选择人员!"); return;
  138. }
  139. if (current.type == 5 && ("0" == isgroup || "false" == isgroup.toLowerCase()))
  140. {
  141. alert("当前设置不允许选择工作组!"); return;
  142. }
  143. if ($("#SelectDiv div[value$='" + current.id + "']").size() > 0)
  144. {
  145. alert(current.title + "已经选择了!"); return;
  146. }
  147. var value = current.id;
  148. if (current.type == 4)
  149. {
  150. value = userBefor + value;
  151. }
  152. else if (current.type == 5)
  153. {
  154. value = userWorkGroup + value;
  155. }
  156. $("#SelectDiv").append('<div onclick="currentDel=this;showinfo(\'' + value + '\');" class="selectorDiv" ondblclick="currentDel=this;del();" value="' + value + '">' + current.title + '</div>');
  157. }
  158. function showinfo(id)
  159. {
  160. $.ajax({
  161. url: top.rootdir + '/Controls/SelectMember/GetNote.ashx?id=' + id, async: true, cache: true, success: function (txt)
  162. {
  163. $("#SelectNote").html(txt);
  164. }
  165. });
  166. }
  167. function del()
  168. {
  169. if (!currentDel)
  170. {
  171. alert("没有选择要删除的项");
  172. }
  173. $(currentDel).remove();
  174. window.setTimeout('$("#SelectNote").html(\'<span style="color:#ccc;">单击已选择项可显示该项详细信息</span>\')', 1);
  175. }
  176. function confirm1()
  177. {
  178. var value = [];
  179. var title = [];
  180. var objs = $("#SelectDiv div");
  181. for (var i = 0; i < objs.size() ; i++)
  182. {
  183. value.push(objs.eq(i).attr("value"));
  184. title.push(objs.eq(i).text());
  185. }
  186. var ele = win.getOpenerElement(eid);
  187. var ele1 = win.getOpenerElement(eid + "_text");
  188. if (ele1 != null && ele1.size() > 0)
  189. {
  190. ele1.val(title.join(','));
  191. }
  192. if (ele != null && ele.size() > 0)
  193. {
  194. ele.val(value.join(','));
  195. }
  196. win.close();
  197. }
  198. </script>
  199. </body>
  200. </html>