rentList7.jsp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <%-- 退房 --%>
  2. <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
  3. <jsp:include page="../../common/include.jsp" />
  4. <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
  5. <script type="text/javascript">
  6. /**小区显示区*/
  7. $(function() {
  8. $('#rentDataGrid7').datagrid({
  9. rownumbers:true,
  10. fit:true,
  11. pageSize:10,
  12. pageList : [ 10, 20, 30, 40, 50 ],
  13. fitColumns:false,
  14. border:false,
  15. sortOrder:'desc',
  16. pagination:true,
  17. idField:'id',
  18. toolbar:'#searchtool',
  19. url:whzl.basePath + '/rent10Action_houseList',
  20. pageNumber:1,
  21. nowrap:true,
  22. loadFilter:function(result){
  23. if(result.success){
  24. return result.obj;
  25. }else{
  26. $.messager.alert("提示",result.message);
  27. return ;
  28. }
  29. },
  30. rowStyler:function(index,row){
  31. if("1" == row.status){
  32. if(typeof(row.endTime) == 'undefined'){
  33. }else{
  34. var day = countDay(row.endTime);
  35. if(day < 0){
  36. if(day > -30){
  37. return 'background-color:#FFFACD;';
  38. }else{
  39. return 'background-color:#98FB98';
  40. }
  41. }else{
  42. return "background-color:#FFC0CB;";
  43. }
  44. }
  45. }
  46. }
  47. });
  48. });
  49. /**计算今天到结束时间的天数*/
  50. var countDay = function(time){
  51. var today = new Date();
  52. var endTime = new Date(time.replace(/\-/g, "/"));
  53. return parseInt(parseInt(today - endTime)/1000/60/60/24);
  54. }
  55. /**查询*/
  56. function searchFun(){
  57. $("#rentDataGrid7").datagrid("load", {
  58. "rent10.house.community.id":trim($('#communityId').combobox("getValue")),
  59. "rent10.house.no":trim($('#no').combobox("getValue")),
  60. "rent10.house.houseNumber":trim($('#houseNumber').combobox("getValue")),
  61. "rent10.lesseeId":trim($('#lesseeId').val())
  62. });
  63. }
  64. /*清除查询条件**/
  65. function ClearQuery() {
  66. $("#tblQuery").find("input").val("");
  67. $("#tblQuery").find("select").val("-1");
  68. }
  69. var endTimeFormatter = function(value , row , index){
  70. if(row.lessee == ""||row.lessee==null){
  71. return "";
  72. }else{
  73. return dealDate(value);
  74. }
  75. }
  76. var statsuFormatter = function(value , row , index){
  77. if("1" == value){
  78. console.log(row.endTime);
  79. if(typeof(row.endTime) == 'undefined'){
  80. return "已配租";
  81. }else{
  82. var day = countDay(row.endTime);
  83. if(day < 0){
  84. if(day > -30){
  85. return "即将到期";
  86. }else{
  87. return "已配租";
  88. }
  89. }else{
  90. return "欠费";
  91. }
  92. }
  93. }else if("2" == value){
  94. return "预配租";
  95. }else{
  96. return "未租";
  97. }
  98. }
  99. //详情
  100. var detailFormatter = function(value , row , index){
  101. return "<img src='<%=basePath%>/images/details.png' title='详情' onclick=houseDetail(" + row.id + ") style='cursor:pointer' />"
  102. }
  103. function houseDetail(houseId){
  104. $("#houseDetailDialog").dialog({
  105. buttons : [{
  106. text : '确定',
  107. iconCls : 'icon-ok',
  108. handler : function(){
  109. $("#houseDetailDialog").dialog("close");
  110. }
  111. }],
  112. onLoad : function(){
  113. detail_load(houseId);
  114. }
  115. })
  116. }
  117. //退房
  118. var checkoutFormatter = function(value , row , index){
  119. if(row.status == '1'){
  120. return "<img src='<%=basePath%>/js/easyui/themes/itemicon/export.png' title='退租' onclick=checkout(" + row.id + ") style='cursor:pointer' />"
  121. }
  122. }
  123. function checkout(houseId){
  124. $("#checkoutDialog").dialog({
  125. buttons : [{
  126. text : '确定',
  127. iconCls : 'icon-ok',
  128. handler : function(){
  129. checkoutRents_submit();
  130. }
  131. },{
  132. text : '取消',
  133. iconCls : 'icon-cancel',
  134. handler : function(){
  135. $("#checkoutDialog").dialog("close");
  136. }
  137. }],
  138. onLoad : function(){
  139. checkoutRents_load(houseId);
  140. }
  141. })
  142. }
  143. var applicationFormFormatter = function(value , row , index){
  144. if(row.status == '1'){
  145. return "<img src='<%=basePath%>/js/easyui/themes/itemicon/print.png' title='打印' onclick=printApplicationForm(" + row.id + ") style='cursor:pointer' />"
  146. }
  147. }
  148. function printApplicationForm(houseId){
  149. window.open(whzl.basePath+"/rent10Action_toApplicationFrom?house.id="+houseId);
  150. }
  151. /**导出合同*/
  152. function checkOutExport(){
  153. window.location.href = whzl.basePath+"/rent10Action_checkOutExport";
  154. }
  155. </script>
  156. <div class="easyui-layout" data-options="fit:true,border:false">
  157. <div data-options="region:'center',border:false">
  158. <div id="searchtool" data-options="region:'north',border:false">
  159. <div class="clear"></div>
  160. <table id="tblQuery" style="width:100%;font-size:12px;">
  161. <tr>
  162. <td><span>小区名称</span></td>
  163. <td>
  164. <input id="communityId">
  165. <input id="no" style="width: 60px;">幢
  166. <input id="houseNumber" style="width: 80px;">室
  167. </td>
  168. <td>承租人身份证号</td>
  169. <td><input id="lesseeId"/></td>
  170. <td align="center">
  171. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  172. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
  173. <a href="javascript:checkOutExport();" class="easyui-linkbutton" data-options="iconCls:'icon-import',plain:true">导出</a>
  174. </td>
  175. </tr>
  176. </table>
  177. <div class="clear"></div>
  178. </div>
  179. <table id="rentDataGrid7">
  180. <thead frozen="true">
  181. <thead frozen="true">
  182. <tr>
  183. <th data-options="field:'id',checkbox:true,width:30">ID</th>
  184. <th data-options="field:'communityName',sortable:true,width:100">小区名称</th>
  185. </tr>
  186. </thead>
  187. <thead>
  188. <tr>
  189. <th data-options="field:'no',width:80">楼号</th>
  190. <th data-options="field:'houseNumber',width:80">房号</th>
  191. <th data-options="field:'area',width:60">面积</th>
  192. <th data-options="field:'garageArea',width:60">车库面积</th>
  193. <th data-options="field:'status',width:70,formatter:statsuFormatter">状态</th>
  194. <th data-options="field:'lessee',width:60">承租人</th>
  195. <th data-options="field:'lesseeId',width:160">承租人身份证号</th>
  196. <th data-options="field:'endTime',width:80,formatter:endTimeFormatter">到期时间</th>
  197. <th data-options="field:'detail',width:60,formatter:detailFormatter">详情</th>
  198. <th data-options="field:'applicationForm',align:'center',width:60,formatter:applicationFormFormatter">申请表</th>
  199. <th data-options="field:'checkout',align:'center',width:60,formatter:checkoutFormatter">退房</th>
  200. </tr>
  201. </thead>
  202. </table>
  203. </div>
  204. </div>
  205. <div id="houseDetailDialog" data-options="title:'&nbsp;房源详情信息',iconCls:'icon-detail',width:1000,height:500,modal:true,href:'<%=basePath %>/rent10Action_toDetail'">
  206. </div>
  207. <div id="checkoutDialog" data-options="title:'&nbsp;退租信息',iconCls:'icon-add',width:1000,height:500,modal:true,href:'<%=basePath %>/rent10Action_toCheckout'">
  208. </div>
  209. <script type="text/javascript">
  210. $(function(){
  211. parent.$.messager.progress('close');
  212. $('#communityId').combobox({
  213. url: whzl.basePath + '/communityAction_findAll',
  214. valueField:'value',
  215. textField:'text',
  216. filter:function(q,row){
  217. var opts=$(this).combobox("options");
  218. //return row[opts.textField].indexOf(q)==0;//
  219. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  220. },
  221. onChange:function (newValue,oldValue) {
  222. $('#no').combobox("setValue","");
  223. $('#houseNumber').combobox("setValue","");
  224. $('#no').combobox('reload',whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"));
  225. }
  226. });
  227. $('#no').combobox({
  228. //editable:false,
  229. url: whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"),
  230. valueField:'value',
  231. textField:'text',
  232. filter:function(q,row){
  233. var opts=$(this).combobox("options");
  234. //return row[opts.textField].indexOf(q)==0;//
  235. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  236. },
  237. onChange:function (newValue,oldValue) {
  238. $('#houseNumber').combobox("setValue","");
  239. $('#houseNumber').combobox('reload',whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+newValue);
  240. }
  241. });
  242. $('#houseNumber').combobox({
  243. //editable:false,
  244. url: whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+$('#no').combobox("getValue"),
  245. valueField:'value',
  246. textField:'text',
  247. filter:function(q,row){
  248. var opts=$(this).combobox("options");
  249. //return row[opts.textField].indexOf(q)==0;//
  250. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  251. }
  252. });
  253. })
  254. </script>