houseSelectList.jsp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <script>
  3. /**户型*/
  4. var roomTypeFormatter_houseSelect = function(value , row , index){
  5. if(row.roomType ==2){
  6. return "二居室";
  7. }else{
  8. return "一居室";
  9. }
  10. };
  11. $(function(){
  12. $('#houseSelectDataGrid').datagrid({
  13. onSelect: function (rowIndex, rowData) {
  14. $('#colSize').text($('#houseSelectDataGrid').datagrid('getSelections').length);
  15. }
  16. });
  17. $('#area').combobox({
  18. url: whzl.basePath + '/houseRegisterAction_listChildrenCombobox',
  19. valueField:'value',
  20. textField:'text',
  21. onChange:function (newValue,oldValue) {
  22. $('#communityId').combobox("setValue","");
  23. $('#no').combobox("setValue","");
  24. $('#houseNumber').combobox("setValue","");
  25. $('#communityId').combobox('reload',whzl.basePath + '/communityAction_findAll?community.area='+newValue);
  26. }
  27. });
  28. $('#communityId').combobox({
  29. url: whzl.basePath + '/communityAction_findAll',
  30. valueField:'value',
  31. textField:'text',
  32. filter:function(q,row){
  33. var opts=$(this).combobox("options");
  34. //return row[opts.textField].indexOf(q)==0;//
  35. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  36. },
  37. onChange:function (newValue,oldValue) {
  38. $('#no').combobox("setValue","");
  39. $('#houseNumber').combobox("setValue","");
  40. $('#no').combobox('reload',whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"));
  41. }
  42. });
  43. $('#no').combobox({
  44. //editable:false,
  45. url: whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"),
  46. valueField:'value',
  47. textField:'text',
  48. filter:function(q,row){
  49. var opts=$(this).combobox("options");
  50. //return row[opts.textField].indexOf(q)==0;//
  51. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  52. },
  53. onChange:function (newValue,oldValue) {
  54. $('#houseNumber').combobox("setValue","");
  55. $('#houseNumber').combobox('reload',whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+newValue);
  56. }
  57. });
  58. $('#houseNumber').combobox({
  59. //editable:false,
  60. url: whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+$('#no').combobox("getValue"),
  61. valueField:'value',
  62. textField:'text',
  63. filter:function(q,row){
  64. var opts=$(this).combobox("options");
  65. //return row[opts.textField].indexOf(q)==0;//
  66. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  67. }
  68. });
  69. //户型
  70. $.ajax({
  71. type: "post",//使用post方法访问后台
  72. dataType: "json",//返回json格式的数据
  73. url: "aa10Action_listAa10All",//要访问的后台地址
  74. data:{"aa10.letter":"roomType" ,"aa10.name":"户型" },
  75. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  76. success: function(msg){//msg为返回的数据,在这里做数据绑定
  77. if(msg.success){
  78. roomTypeObj = msg.obj.rows;
  79. var select_arr = [];
  80. var data = roomTypeObj;
  81. for(var nItem = 0; nItem < data.length; nItem++ ){
  82. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  83. }
  84. roomType_array = select_arr.join("");
  85. $("#roomType").append(roomType_array);
  86. }
  87. }
  88. });
  89. });
  90. /**查询*/
  91. function searchFun(){
  92. var params = encodeURI("house.community.id="+trim($('#communityId').combobox("getValue"))+
  93. "&house.no="+trim($('#no').combobox("getValue"))+
  94. "&house.houseNumber="+trim($('#houseNumber').combobox("getValue"))+
  95. "&house.roomType="+trim($('#roomType').val())+
  96. paramValue
  97. );
  98. $('#houseSelectDataGrid').datagrid({url:whzl.basePath + '/houseAction_listHouseAll?'+params,pageNumber:1});
  99. }
  100. var paramValue;
  101. var house_select_load = function(param){
  102. paramValue = param;
  103. $('#houseSelectDataGrid').datagrid({
  104. rownumbers:true,
  105. fit:true,
  106. fitColumns:false,
  107. border:false,
  108. sortOrder:'desc',
  109. url:whzl.basePath + '/houseAction_listHouseAll?x=0' + param,
  110. toolbar:'#searchtoolHouse',
  111. checkOnSelect:true,
  112. selectOnCheck:true,
  113. nowrap:true,
  114. rowStyler:function(index,row){
  115. if(row.roomType == 1){
  116. return 'background-color:yellow;color:blue;font-weight:bold;';
  117. }
  118. },
  119. loadFilter:function(result){
  120. if(result.success){
  121. return result.obj;
  122. }else{
  123. return ;
  124. }
  125. }
  126. });
  127. }
  128. var house_select_submit = function(){
  129. var selectedItems = $('#houseSelectDataGrid').datagrid('getSelections');
  130. var ids = [];
  131. $.each(selectedItems,function(index,item){
  132. ids.push(item.id);
  133. })
  134. if(ids.length==0){
  135. $.messager.alert("警告","请选择至少一条记录!");
  136. return;
  137. }
  138. var idsStr = ids.join(",");
  139. return idsStr;
  140. }
  141. </script>
  142. <div class="easyui-layout" data-options="fit:true,border:false">
  143. <div data-options="region:'center',border:false">
  144. <div id="searchtoolHouse" data-options="region:'north',border:false">
  145. <div class="clear"></div>
  146. <table id="tblQuery" style="width:100%;font-size:12px;">
  147. <tr>
  148. <td align="right"><span>小区名称</span></td>
  149. <td colspan="4">
  150. <select id="area" style="width:100px;">
  151. <option value="">全部</option>
  152. </select>
  153. <input id="communityId">
  154. <input id="no" style="width: 60px;">幢
  155. <input id="houseNumber" style="width: 80px;">室
  156. </td>
  157. </tr>
  158. <tr>
  159. <td align="right"><span>户型</span></td>
  160. <td>
  161. <select id="roomType">
  162. <option value="">全部</option>
  163. </select>
  164. </td>
  165. <td align="left">
  166. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  167. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">清空</a>
  168. 已选中<span id="colSize" >0</span>行
  169. </td>
  170. </tr>
  171. </table>
  172. <div class="clear"></div>
  173. </div>
  174. <table id="houseSelectDataGrid" >
  175. <thead frozen="true">
  176. <tr><th data-options="field:'id',checkbox:true,width:30">ID</th>
  177. </tr>
  178. </thead>
  179. <thead>
  180. <tr>
  181. <th data-options="field:'communityName',width:150">小区名称</th>
  182. <th data-options="field:'address',width:200">居住地点</th>
  183. <th data-options="field:'roomType',width:60,formatter:roomTypeFormatter_houseSelect">户型</th>
  184. <th data-options="field:'houseNumber',width:40">房号</th>
  185. <th data-options="field:'area',width:60">面积</th>
  186. </tr>
  187. </thead>
  188. </table>
  189. </div>
  190. </div>