RoadFlow2.1 临时演示

Default.aspx 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebForm.Controls.SelectDictionary.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. <table border="0" cellpadding="0" cellspacing="0" align="center" style="margin-top:4px;">
  17. <tr>
  18. <td valign="top">
  19. <div id="dict" style="width:210px; height:420px; overflow:auto;" class="SelectBorder"></div>
  20. </td>
  21. <td align="center" style="padding:0px 6px;" valign="middle">
  22. <div style="margin-bottom:12px;"><button class="mybutton" onclick="add();">添加</button></div>
  23. <div style="margin-bottom:12px;"><button class="mybutton" onclick="del();">删除</button></div>
  24. <div style="margin-bottom:12px;"><button class="mybutton" onclick="confirm1();">确定</button></div>
  25. <div><button class="mybutton" onclick="win.close();">取消</button></div>
  26. </td>
  27. <td valign="top">
  28. <div id="SelectNote" class="SelectBorder" style="width:200px; height:40px; overflow:auto; margin-bottom:5px;">
  29. <span style="color:#ccc;">单击已选择项可显示该项详细信息</span>
  30. </div>
  31. <div id="SelectDiv" style="width:200px; height:367px; overflow:auto;" class="SelectBorder">
  32. <%=defaultValuesString %>
  33. </div>
  34. </td>
  35. </tr>
  36. </table>
  37. <script type="text/javascript">
  38. var AppID = '<%=Request.QueryString["appid"]%>';
  39. var ismore = '<%=Request.QueryString["ismore"]%>';//是否可以多选
  40. var isparent = '<%=Request.QueryString["isparent"]%>';//是否可以选择有子节点的节点
  41. var ischild = '<%=Request.QueryString["ischild"]%>';//是否加载所有下级节点
  42. var isroot = '<%=Request.QueryString["isroot"]%>';//是否可以选择根节点
  43. var root = '<%=Request.QueryString["root"]%>';
  44. var eid = '<%=Request.QueryString["eid"]%>';
  45. var datasource = '<%=Request.QueryString["datasource"] ?? "0"%>';
  46. var roadTree = null;
  47. $(function ()
  48. {
  49. switch (datasource)
  50. {
  51. case "0":
  52. default:
  53. roadTree = new RoadUI.Tree({
  54. id: "dict", path: top.rootdir + "/Platform/Dictionary/Tree1.ashx?root=" + root + "&ischild=" + ischild,
  55. refreshpath: top.rootdir + "/Platform/Dictionary/TreeRefresh.ashx", onclick: click, ondblclick: dblclick
  56. });
  57. break;
  58. case "1": //SQL
  59. var dbconn = '<%=Request.QueryString["dbconn"]%>';
  60. var sql = encodeURI("<%=Request.QueryString["sql"]%>");
  61. roadTree = new RoadUI.Tree({
  62. id: "dict", path: top.rootdir + "/Controls/SelectDictionary/GetJson_SQL.ashx?dbconn=" + dbconn + "&sql=" + sql,
  63. refreshpath: "", onclick: click, ondblclick: dblclick
  64. });
  65. break;
  66. case "2": //URL
  67. var url0 = decodeURI("<%=Request.QueryString["url0"]%>");
  68. var url1 = decodeURI("<%=Request.QueryString["url1"]%>");
  69. roadTree = new RoadUI.Tree({
  70. id: "dict", path: top.rootdir + url0,
  71. refreshpath: top.rootdir + url1, onclick: click, ondblclick: dblclick
  72. });
  73. break;
  74. case "3": //表
  75. var dbconn = encodeURI("<%=Request.QueryString["dbconn"]%>");
  76. var dbtable = encodeURI("<%=Request.QueryString["dbtable"]%>");
  77. var valuefield = encodeURI("<%=Request.QueryString["valuefield"]%>");
  78. var titlefield = encodeURI("<%=Request.QueryString["titlefield"]%>");
  79. var parentfield = encodeURI("<%=Request.QueryString["parentfield"]%>");
  80. var where = encodeURI("<%=Request.QueryString["where"]%>");
  81. roadTree = new RoadUI.Tree({
  82. id: "dict", path: top.rootdir + "/Controls/SelectDictionary/GetJson_Table.ashx?dbconn=" + dbconn + "&dbtable=" + dbtable
  83. + "&valuefield=" + valuefield + "&titlefield=" + titlefield + "&parentfield=" + parentfield + "&where=" + where,
  84. refreshpath: top.rootdir + "/Controls/SelectDictionary/GetJson_TableRefresh.ashx?dbconn=" + dbconn + "&dbtable=" + dbtable
  85. + "&valuefield=" + valuefield + "&titlefield=" + titlefield + "&parentfield=" + parentfield + "&where=" + where, onclick: click, ondblclick: dblclick
  86. });
  87. break;
  88. }
  89. });
  90. function click(json)
  91. {
  92. current = json;
  93. }
  94. function dblclick(json)
  95. {
  96. click(json);
  97. add();
  98. }
  99. function add()
  100. {
  101. if (!current)
  102. {
  103. alert("没有选择要添加的项"); return;
  104. }
  105. if (("0" == ismore || "false" == ismore.toLowerCase()) && $("#SelectDiv").children("div").size() >= 1)
  106. {
  107. alert("当前设置最多只能选择一项!"); return;
  108. }
  109. if ($("#SelectDiv div[value$='" + current.id + "']").size() > 0)
  110. {
  111. alert(current.title + "已经选择了!"); return;
  112. }
  113. var value = current.id;
  114. var type = current.type;
  115. if ("0" == type && "0" == isroot)
  116. {
  117. alert("当前设置不允许选择根节点!"); return;
  118. }
  119. if ("1" == type && "0" == isparent)
  120. {
  121. alert("当前设置不允许选有下级节点的节点!"); return;
  122. }
  123. $("#SelectDiv").append('<div onclick="currentDel=this;showinfo(\'' + value + '\');" class="selectorDiv" ondblclick="currentDel=this;del();" value="' + value + '">' + current.title + '</div>');
  124. }
  125. function showinfo(id)
  126. {
  127. //$.ajax({
  128. // url: 'GetNote.ashx?id=' + id, async: true, cache: true, success: function (txt)
  129. // {
  130. // $("#SelectNote").html(txt);
  131. // }
  132. //});
  133. }
  134. function del()
  135. {
  136. if (!currentDel)
  137. {
  138. alert("没有选择要删除的项");
  139. }
  140. $(currentDel).remove();
  141. window.setTimeout('$("#SelectNote").html(\'<span style="color:#ccc;">单击已选择项可显示该项详细信息</span>\')', 1);
  142. }
  143. function confirm1()
  144. {
  145. var value = [];
  146. var title = [];
  147. var objs = $("#SelectDiv div");
  148. for (var i = 0; i < objs.size() ; i++)
  149. {
  150. value.push(objs.eq(i).attr("value"));
  151. title.push(objs.eq(i).text());
  152. }
  153. var ele = win.getOpenerElement(eid);
  154. var ele1 = win.getOpenerElement(eid + "_text");
  155. if (ele1 != null && ele1.size() > 0)
  156. {
  157. ele1.val(title.join(','));
  158. }
  159. if (ele != null && ele.size() > 0)
  160. {
  161. ele.val(value.join(','));
  162. }
  163. win.close();
  164. }
  165. </script>
  166. </body>
  167. </html>