c834ff82ba554447f8e2686ce84f88de509bafcd.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. <title></title>
  6. <!--框架必需start-->
  7. <script type="text/javascript" src="../../libs/js/jquery.js"></script>
  8. <script type="text/javascript" src="../../libs/js/language/cn.js"></script>
  9. <script type="text/javascript" src="../../libs/js/framework.js"></script>
  10. <link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  11. <link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
  12. <link rel="stylesheet" type="text/css" id="customSkin"/>
  13. <!--框架必需end-->
  14. <!-- 条件过滤器 start -->
  15. <script type="text/javascript" src="../../libs/js/form/filter.js"></script>
  16. <!-- 条件过滤器 end -->
  17. </head>
  18. <body>
  19. <div class="box1" panelWidth="800">
  20. <fieldset>
  21. <legend>1、使用url赋值</legend>
  22. <div class="red">此示例由后台支持</div>
  23. <!--
  24. <div class="filter" url="../../userAction.do?method=getUsersOfListFormation" id="filter1"></div>
  25. <input type="button" value="获取值" onclick="getValue()"/>
  26. -->
  27. </fieldset>
  28. <div class="height_15"></div>
  29. <fieldset>
  30. <legend>2、使用url+参数赋值</legend>
  31. <div class="red">此示例由后台支持</div>
  32. <!--
  33. <div class="filter" url="../../userAction.do?method=getUsersOfListFormation" params='{"userinfor.organization.orgId":"2"}'></div>
  34. -->
  35. </fieldset>
  36. <div class="height_15"></div>
  37. <fieldset>
  38. <legend>3、赋值给标签的data属性</legend>
  39. <p>注意:使用json格式的字符串时所有节点的属性名与值都必须使用双引号</p>
  40. <div class="filter" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  41. </fieldset>
  42. <div class="height_15"></div>
  43. <fieldset>
  44. <legend>4、动态设置data</legend>
  45. 使用本地数据:<br/>
  46. <div class="filter" id="filter4-1" keepDefaultStyle="true"></div>
  47. <br/>
  48. <br/>
  49. 使用远程数据:
  50. <div class="red">此示例由后台支持</div>
  51. <div class="filter" id="filter4-2" keepDefaultStyle="true"></div>
  52. </fieldset>
  53. <div class="height_15"></div>
  54. <fieldset>
  55. <legend>5、可多选</legend>
  56. <div class="filter" multiMode="true" id="filter5" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  57. <input type="button" value="获取值" onclick="getValue2()"/>
  58. </fieldset>
  59. <div class="height_15"></div>
  60. <fieldset>
  61. <legend>6、使用隐藏域</legend>
  62. <p>如果为组件添加name属性,那么会自动生成一个隐藏域input,用来存储组件当前的value,该input的name与组件name一致。<br/>在提交表单时会用到。</p>
  63. <div class="filter" name="filter6" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  64. <input type="button" value="获取隐藏域选中值" onclick="getHiddenValue()"/>
  65. </fieldset>
  66. <div class="height_15"></div>
  67. <fieldset>
  68. <legend>7、自定义项目尺寸</legend>
  69. <div class="filter" multiMode="true" itemWidth="200" itemHeight="30" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  70. </fieldset>
  71. <div class="height_15"></div>
  72. <fieldset>
  73. <legend>8、文字截取与显示提示</legend>
  74. <div class="filter" multiMode="true" showTip="true" data='{"list":[{"value":"1","key":"员工员工员工员工员工员工员工员工员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  75. <br/>
  76. <br/>
  77. <div class="filter" multiMode="true" showInfo="true" data='{"list":[{"value":"1","key":"员工员工员工员工员工员工员工员工员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  78. </fieldset>
  79. <div class="height_15"></div>
  80. <fieldset>
  81. <legend>9、禁用/启用</legend>
  82. <div class="filter" disabled="true" filterWidth="400" id="filter9" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  83. <input type="button" value="启用" onclick="enableFilter()"/>
  84. <input type="button" value="禁用" onclick="disableFilter()"/>
  85. <br/>
  86. 这里还可以自定义总宽度。
  87. </fieldset>
  88. <div class="height_15"></div>
  89. <fieldset>
  90. <legend>10、设置初始值</legend>
  91. <div class="filter" multiMode="true" selectedValue="1,2,3" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  92. </fieldset>
  93. <div class="height_15"></div>
  94. <fieldset>
  95. <legend>11、动态生成</legend>
  96. <div class="red">此示例由后台支持</div>
  97. <input type="button" value="点击生成(使用url)" id="testBtn" onclick="dynamicFilter1()" style="width:150px;"/><br/><br/>
  98. <input type="button" value="点击生成(使用data)" id="testBtn2" onclick="dynamicFilter2()" style="width:150px;"/><br/><br/>
  99. </fieldset>
  100. <div class="height_15"></div>
  101. <fieldset>
  102. <legend>12、动态选中</legend>
  103. <div class="filter" multiMode="true" id="filter12" data='{"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]}'></div>
  104. <input type="button" value="选中前两项" id="testBtn" onclick="setValue()" style="width:150px;"/>
  105. </fieldset>
  106. <div class="height_15"></div>
  107. <fieldset>
  108. <legend>13、综合示例</legend>
  109. <table class="filterTable">
  110. <tr>
  111. <td width="80" class="left">品牌</td>
  112. <td class="right"><div class="filter" multiMode="true" id="filter13-1" data='{"list":[{"value":"1","key":"夏普"},{"value":"2","key":"索尼"},{"value":"3","key":"三星"},{"value":"4","key":"海信"},{"value":"5","key":"TCL"},{"value":"6","key":"创维"},{"value":"7","key":"松下"},{"value":"8","key":"飞利浦"},{"value":"9","key":"康佳"},{"value":"10","key":"长虹"},{"value":"11","key":"清华同方"}]}'></div></td>
  113. </tr>
  114. <tr>
  115. <td class="left">品类</td>
  116. <td class="right"><div class="filter" id="filter13-2" data='{"list":[{"value":"1","key":"LED背光电视"},{"value":"2","key":"LCD背光电视"},{"value":"3","key":"等离子电视"}]}'></div></td>
  117. </tr>
  118. <tr>
  119. <td class="left">功能</td>
  120. <td class="right"><div class="filter" id="filter13-3" data='{"list":[{"value":"1","key":"3D电视"},{"value":"2","key":"非3D电视"},{"value":"3","key":"智能电视"},{"value":"4","key":"非智能电视"},{"value":"5","key":"网络电视"},{"value":"6","key":"非网络电视"}]}'></div></td>
  121. </tr>
  122. <tr>
  123. <td class="left">价格</td>
  124. <td class="right"><div class="filter" id="filter13-4" data='{"list":[{"value":"1","key":"1-1999"},{"value":"2","key":"2000-3999"},{"value":"3","key":"4000-5999"},{"value":"4","key":"6000-9999"},{"value":"5","key":"10000-14999"},{"value":"6","key":"15000-24999"},{"value":"7","key":"25000以上"}]}'></div></td>
  125. </tr>
  126. <tr>
  127. <td colspan="2" class="ali02 padding5">
  128. <input type="button" value="提交" onclick="submitForm()"/>
  129. <input type="button" value="重置" onclick="resetForm()"/>
  130. </td>
  131. </tr>
  132. </table>
  133. </fieldset>
  134. <div class="height_15"></div>
  135. <fieldset>
  136. <legend>14、可分组的条件过滤器</legend>
  137. <p>可分组的条件过滤器与上例的区别是使用一个组件和一个数据源即可实现分组的功能。不过无法灵活控制哪个组是单选哪个组是多选</p>
  138. <div class="filter" groupMode="true" data='{"list":[{"name":"部门1","list":[{"key":"员工1","value":"11"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"}]},{"name":"部门2","list":[{"key":"员工4","value":"21"},{"key":"员工5","value":"22"},{"key":"员工6","value":"23"}]},{"name":"部门3","list":[{"key":"员工1","value":"11"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"}]},{"name":"部门4","list":[{"key":"员工4","value":"21"},{"key":"员工5","value":"22"},{"key":"员工6","value":"23"}]}]}' id="filter13"></div>
  139. </fieldset>
  140. <div class="height_15"></div>
  141. <fieldset>
  142. <legend>15、添加图标</legend>
  143. <div class="filter" multiMode="true" id="filter5" data='{"list":[{"value":"1","key":"员工1","iconClass":"icon_user"},{"value":"2","key":"员工2","iconClass":"icon_user_worker"},{"value":"3","key":"员工3","iconClass":"icon_user_female"},{"value":"4","key":"其他","iconSrc":"../../libs/images/icons/setting.png"}]}'></div>
  144. </fieldset>
  145. <div class="height_15"></div>
  146. <fieldset>
  147. <legend>16、无前缀数据</legend>
  148. <div class="filter" multiMode="true" id="filter5" data='[{"value":"1","key":"员工1","iconClass":"icon_user"},{"value":"2","key":"员工2","iconClass":"icon_user_worker"},{"value":"3","key":"员工3","iconClass":"icon_user_female"},{"value":"4","key":"其他","iconSrc":"../../libs/images/icons/setting.png"}]'></div>
  149. </fieldset>
  150. <div class="height_15"></div>
  151. </div>
  152. <script>
  153. //动态设置data
  154. function initComplete(){
  155. var selData= {"list":[{"value":"1","key":"员工1"},{"value":"2","key":"员工2"},{"value":"3","key":"员工3"},{"value":"4","key":"员工4"}]};
  156. //赋给data属性
  157. $("#filter4-1").data("data",selData)
  158. $("#filter4-1").render();
  159. //获取json数据
  160. /*
  161. $.post("../../userAction.do?method=getUsersOfListFormation",{"userinfor.organization.orgId":"2"},function(result){
  162. //赋给data属性
  163. $("#filter4-2").data("data",selData)
  164. //刷新
  165. $("#filter4-2").render();
  166. },"json");
  167. */
  168. }
  169. //获取值
  170. function getValue(){
  171. top.Dialog.alert("选中文本:"+$("#filter1").attr("relText")+"<br/>选中id:"+$("#filter1").attr("relValue"));
  172. }
  173. //获取值
  174. function getValue2(){
  175. top.Dialog.alert("选中文本:"+$("#filter5").attr("relText")+"<br/>选中id:"+$("#filter5").attr("relValue"));
  176. }
  177. //获取隐藏域值
  178. function getHiddenValue(){
  179. top.Dialog.alert($("input:hidden[name='filter6']").val());
  180. }
  181. //禁用
  182. function disableFilter(){
  183. $("#filter9").attr("disabled",true);
  184. $("#filter9").render();
  185. }
  186. //启用
  187. function enableFilter(){
  188. $("#filter9").attr("disabled",false);
  189. $("#filter9").render();
  190. }
  191. //动态生成
  192. function dynamicFilter1(){
  193. /*
  194. var $filter = $('<div class="filter"></div>');
  195. $filter.attr("url","../../userAction.do?method=getUsersOfListFormation");
  196. //加到按钮的后面
  197. $("#testBtn").after($filter);
  198. $("#testBtn").after("<br/>");
  199. //渲染
  200. $filter.render();
  201. */
  202. }
  203. //动态生成
  204. function dynamicFilter2(){
  205. //获取json数据
  206. /*
  207. $.post("../../userAction.do?method=getUsersOfListFormation",{"userinfor.organization.orgId":"2"},function(result){
  208. var $filter = $('<div class="filter"></div>');
  209. //赋给data属性
  210. $filter.data("data",result);
  211. //加到按钮的后面
  212. $("#testBtn2").after($filter);
  213. $("#testBtn2").after("<br/>");
  214. //渲染
  215. $filter.render();
  216. },"json");
  217. */
  218. }
  219. //动态选中
  220. function setValue(){
  221. $("#filter12").setValue("1,2");
  222. }
  223. //提交
  224. function submitForm(){
  225. top.Dialog.alert("品牌:"+$("#filter12-1").attr("relText")+"("+$("#filter13-1").attr("relValue")+")<br/>品类:"+$("#filter13-2").attr("relText")+"("+$("#filter13-2").attr("relValue")+")<br/>功能:"+$("#filter13-3").attr("relText")+"("+$("#filter13-3").attr("relValue")+")<br/>价格:"+$("#filter13-4").attr("relText")+"("+$("#filter13-4").attr("relValue")+")");
  226. }
  227. //重置表单
  228. function resetForm(){
  229. $(".filterTable .filter").resetValue();
  230. }
  231. </script>
  232. </body>
  233. </html>