e49dc601b6caa7ac54f42203cc07d0a87f0a5ede.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <!--框架必需start-->
  6. <script type="text/javascript" src="../../libs/js/jquery.js"></script>
  7. <script type="text/javascript" src="../../libs/js/language/cn.js"></script>
  8. <script type="text/javascript" src="../../libs/js/framework.js"></script>
  9. <link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  10. <link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
  11. <link rel="stylesheet" type="text/css" id="customSkin"/>
  12. <!--框架必需end-->
  13. <!-- 树组件start -->
  14. <script type="text/javascript" src="../../libs/js/tree/ztree/ztree.js"></script>
  15. <link type="text/css" rel="stylesheet" href="../../libs/js/tree/ztree/ztree.css"></link>
  16. <!-- 树组件end -->
  17. <!-- 树形下拉框start -->
  18. <script type="text/javascript" src="../../libs/js/form/selectTree.js"></script>
  19. <!-- 树形下拉框end -->
  20. <!-- 日期控件start -->
  21. <script type="text/javascript" src="../../libs/js/form/datePicker/WdatePicker.js"></script>
  22. <!-- 日期控件end -->
  23. <!-- 条件过滤器 start -->
  24. <script type="text/javascript" src="../../libs/js/form/filter.js"></script>
  25. <!-- 条件过滤器 end -->
  26. <!-- 数字步进器start -->
  27. <script type="text/javascript" src="../../libs/js/form/stepper.js"></script>
  28. <!-- 数字步进器end -->
  29. <!-- 软键盘控件start -->
  30. <script type="text/javascript" src="../../libs/js/form/keypad.js"></script>
  31. <!-- 软键盘控件end -->
  32. <!-- 双向选择器start -->
  33. <script type="text/javascript" src="../../libs/js/form/lister.js"></script>
  34. <!-- 双向选择器end -->
  35. <!--自动提示框start-->
  36. <script type='text/javascript' src='../../libs/js/form/suggestion.js'></script>
  37. <!--自动提示框end-->
  38. <!-- 树形双选器start -->
  39. <script type="text/javascript" src="../../libs/js/form/listerTree.js"></script>
  40. <!-- 树形双选器end -->
  41. <!-- 组合下拉框start -->
  42. <script type="text/javascript" src="../../libs/js/form/selectCustom.js"></script>
  43. <!-- 组合拉框end -->
  44. <!-- 颜色选择器 start -->
  45. <script type="text/javascript" src="../../libs/js/form/color.js"></script>
  46. <!-- 颜色选择器 end -->
  47. <!-- 评星级 start -->
  48. <script type="text/javascript" src="../../libs/js/form/rating.js"></script>
  49. <!-- 评星级 end -->
  50. <!-- 表单验证start -->
  51. <script src="../../libs/js/form/validationRule.js" type="text/javascript"></script>
  52. <script src="../../libs/js/form/validation.js" type="text/javascript"></script>
  53. <!-- 表单验证end -->
  54. </head>
  55. <body>
  56. <div id="scrollContent">
  57. </div>
  58. <script type="text/javascript">
  59. //上传组件使用
  60. var upload;
  61. var catalogId = "1340271126861_2";
  62. var $form;
  63. function initComplete(){
  64. //获取多功能容器内容区域
  65. var $content=$("#scrollContent");
  66. //创建表单
  67. $form=$('<form></form>')
  68. //将表单添加到多功能容器内容区域
  69. $content.append($form);
  70. //创建表格
  71. var $table=$('<table class="formTable"><tr><td class="ali03" width="150">文本框:</td><td></td></tr>'+
  72. '<tr><td class="ali03">单选按钮:</td><td></td></tr>'+
  73. '<tr><td class="ali03">多选按钮:</td><td></td></tr>'+
  74. '<tr><td class="ali03">单选下拉框:</td><td></td></tr>'+
  75. '<tr><td class="ali03">树形下拉框:</td><td></td></tr>'+
  76. '<tr><td class="ali03">自动完成框:</td><td></td></tr>'+
  77. '<tr><td class="ali03">日期选择框:</td><td></td></tr>'+
  78. '<tr><td class="ali03">双向选择器:</td><td></td></tr>'+
  79. '<tr><td class="ali03">树形双选器:</td><td></td></tr>'+
  80. '<tr><td class="ali03">条件过滤器:</td><td></td></tr>'+
  81. '<tr><td class="ali03">颜色选择器:</td><td></td></tr>'+
  82. '<tr><td class="ali03">数字步进器:</td><td></td></tr>'+
  83. '<tr><td class="ali03">软键盘控件:</td><td></td></tr>'+
  84. '<tr><td class="ali03">评星级控件:</td><td></td></tr>'+
  85. '<tr><td class="ali03">文本域:</td><td></td></tr>'+
  86. '<tr><td class="ali02" colspan="2"></td></tr>'+
  87. '</table>');
  88. //将表格添加到表单中
  89. $form.append($table);
  90. //创建文本框并赋值
  91. var $input=$('<input type="text" class="validate[required]">');
  92. $input.val("张三");
  93. //创建单选按钮并赋值
  94. var $radio1 =$('<input type="radio" id="radio-1" name="bo.radio" value="男" />');
  95. var $radiolabel1 =$('<label for="radio-1">男</label>');
  96. var $radio2 =$('<input type="radio" id="radio-2" name="bo.radio" value="女"/>');
  97. var $radiolabel2 =$('<label for="radio-2">女</label>');
  98. $radio2.attr("checked",true);
  99. //创建复选按钮并赋值
  100. var $check1 =$('<input type="checkbox" id="checkbox-1" name="bo.checkboxs" value="唱歌"/>');
  101. var $checklabel1 =$('<label for="checkbox-1" >唱歌</label>');
  102. var $check2 =$('<input type="checkbox" id="checkbox-2" name="bo.checkboxs" value="跳舞" />');
  103. var $checklabel2 =$('<label for="checkbox-2">跳舞</label>');
  104. $check2.attr("checked",true);
  105. //创建单选下拉框并赋值
  106. var $select = $('<select mode="ajax" prompt="请选择省份"></select>');
  107. var selData={"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"}]};
  108. //赋给data
  109. $select.data("data",selData);
  110. $select.attr("selectedValue","2");
  111. //创建树形下拉框并赋值
  112. var $selTree = $('<div class="selectTree"></div>');
  113. var defaultNodes = {"treeNodes":[
  114. { id:1, parentId:0, name:"部门1", open: true},
  115. { id:11, parentId:1, name:"员工1"},
  116. { id:12, parentId:1, name:"员工2"},
  117. { id:13, parentId:1, name:"员工3"},
  118. { id:2, parentId:0, name:"部门2", open: true},
  119. { id:21, parentId:2, name:"员工4"}
  120. ]};
  121. $selTree.data("data",defaultNodes);
  122. //创建自动完成框并赋值
  123. var $auto = $('<input type="text" class="autoComplete"/>');
  124. $auto.attr("url","<%=path%>/autoComplateAction.do?method=getListByEmail");
  125. $auto.attr("params",'{"userAge": "26", "userSex": "1"}');
  126. $auto.attr("matchName","userName");
  127. $auto.val("北京");
  128. //创建日期选择框并赋值
  129. var $date=$('<input type="text" class="date"/>');
  130. $date.val("2012-07-16");
  131. //创建双向选择器并赋值
  132. var $lister=$('<div class="lister" listerWidth="120" listerHeight="120" ></div>');
  133. var listerData={fromList:[{value:"1",key:"员工1"},{value:"2",key:"员工2"},{value:"3",key:"员工3"},{value:"4",key:"员工4"}],"toList":[]};
  134. $lister.data("data",listerData)
  135. $lister.attr("selectedValue",'1,2');
  136. //创建树形双选器并赋值
  137. var $listerTree=$('<div class="listerTree" listerWidth="120" listerHeight="180" ></div>');
  138. var listerTreeData={"toList":[],"fromList":[{"id":"1","parentId":"0","open":"true","name":"部门1","oldParentId":"null","drag":"false"},{"id":"11","parentId":"1","name":"员工1","oldParentId":"1"},{"id":"12","parentId":"1","name":"员工2","oldParentId":"1"},{"id":"13","parentId":"1","name":"员工3","oldParentId":"1"}]}
  139. $listerTree.data("data",listerTreeData)
  140. $listerTree.attr("selectedValue",'11,12');
  141. //创建条件过滤器并赋值
  142. var $filter = $('<div class="filter"></div>');
  143. var filterData= {"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]};
  144. $filter.data("data",filterData)
  145. $filter.attr("selectedValue","2");
  146. //创建颜色选择器并赋值
  147. var $color=$('<input type="text" class="color"/>');
  148. $color.val("#00ff00");
  149. //创建数字步进器并赋值
  150. var $stepper = $('<input id="step1" type="text" class="stepper"/>');
  151. $stepper.val(10);
  152. //创建软键盘控件并赋值
  153. var $keypad = $('<input type="text" class="keypad"/>');
  154. $keypad.val(1234);
  155. //创建星级控件并赋值
  156. //动态生成星级控件需要设置id
  157. var $rating = $('<div class="rating" id="rating9"></div>');
  158. $rating.attr("value",2);
  159. //创建文本域并赋值
  160. var $ta=$('<textarea class="textarea"></textarea>');
  161. $ta.html("备注信息");
  162. //创建按钮
  163. var $input1=$('<input type="button" value="提交"/>' );
  164. var $input2=$('<input type="button" value="取消"/>' );
  165. //提交触发表单验证
  166. $input1.click(function(){
  167. var valid = $form.validationEngine({returnIsValid: true});
  168. if(valid == true){
  169. top.Dialog.alert("验证通过,表单提交处理");
  170. }
  171. else{
  172. top.Dialog.alert("表单填写不正确,请按要求填写!");
  173. }
  174. });
  175. //将元素添加到表格中
  176. $table.find("tr").eq(0).find("td").eq(1).append($input);
  177. $table.find("tr").eq(1).find("td").eq(1).append($radio1);
  178. $table.find("tr").eq(1).find("td").eq(1).append($radiolabel1);
  179. $table.find("tr").eq(1).find("td").eq(1).append($radio2);
  180. $table.find("tr").eq(1).find("td").eq(1).append($radiolabel2);
  181. $table.find("tr").eq(2).find("td").eq(1).append($check1);
  182. $table.find("tr").eq(2).find("td").eq(1).append($checklabel1);
  183. $table.find("tr").eq(2).find("td").eq(1).append($check2);
  184. $table.find("tr").eq(2).find("td").eq(1).append($checklabel2);
  185. $table.find("tr").eq(3).find("td").eq(1).append($select);
  186. $table.find("tr").eq(4).find("td").eq(1).append($selTree);
  187. $table.find("tr").eq(5).find("td").eq(1).append($auto);
  188. $table.find("tr").eq(6).find("td").eq(1).append($date);
  189. $table.find("tr").eq(7).find("td").eq(1).append($lister);
  190. $table.find("tr").eq(8).find("td").eq(1).append($listerTree);
  191. $table.find("tr").eq(9).find("td").eq(1).append($filter);
  192. $table.find("tr").eq(10).find("td").eq(1).append($color);
  193. $table.find("tr").eq(11).find("td").eq(1).append($stepper);
  194. $table.find("tr").eq(12).find("td").eq(1).append($keypad);
  195. $table.find("tr").eq(13).find("td").eq(1).append($rating);
  196. $table.find("tr").eq(14).find("td").eq(1).append($ta);
  197. $table.find("tr").eq(15).find("td").eq(0).append($input1);
  198. $table.find("tr").eq(15).find("td").eq(0).append("&nbsp;");
  199. $table.find("tr").eq(15).find("td").eq(0).append($input2);
  200. //渲染一律放在最后
  201. $input.render();
  202. $select.render();
  203. $selTree.render();
  204. $auto.render();
  205. $date.render();
  206. $lister.render();
  207. $listerTree.render();
  208. $filter.render();
  209. $color.render();
  210. $stepper.render();
  211. $keypad.render();
  212. $rating.render();
  213. $ta.render();
  214. $input1.render();
  215. $input2.render();
  216. //动态添加验证
  217. $form.validationEngine();
  218. }
  219. </script>
  220. </body>
  221. </html>