rentList.jsp 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
  2. <jsp:include page="../../common/include.jsp" />
  3. <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
  4. <script type="text/javascript"><!--
  5. /**用户显示区*/
  6. $(function() {
  7. $('#rentDataGrid').datagrid({
  8. rownumbers:true,
  9. fit:true,
  10. pageSize:20,
  11. pageList : [ 10, 20, 30, 40, 50 ],
  12. fitColumns:false,
  13. border:false,
  14. sortOrder:'desc',
  15. pagination:true,
  16. idField:'id',
  17. url:whzl.basePath + '/rentAction_listRent',
  18. toolbar:'#searchtool',
  19. checkOnSelect:true,
  20. selectOnCheck:false,
  21. nowrap:true,
  22. rowStyler:function(index,row){
  23. if(row.rentType == 1){
  24. return 'background-color:pink;color:blue;font-weight:bold;';
  25. }
  26. },
  27. loadFilter:function(result){
  28. if(result.success){
  29. return result.obj;
  30. }else{
  31. $.messager.alert("提示",result.message);
  32. return ;
  33. }
  34. }
  35. });
  36. });
  37. /**查询*/
  38. function searchFun(){
  39. $("#rentDataGrid").datagrid("load", {
  40. "rent.securityPerson.name":$("#tblQuery").find("input[id='securityPersonName']").val(),
  41. "rent.securityPerson.idCard":$("#tblQuery").find("input[id='securityPersonIdCard']").val()
  42. });
  43. }
  44. /*清除查询条件**/
  45. function ClearQuery() {
  46. $("#tblQuery").find("input").val("");
  47. $("#tblQuery").find("select").val("-1");
  48. }
  49. var dateFormatter = function(value,row,index){
  50. if(value != null){
  51. return value.substring(0,10);
  52. }else{
  53. return "";
  54. }
  55. }
  56. var contractNameFormatter = function(value,row,index){
  57. return row.leaseContract.contractName;
  58. }
  59. var contractNoFormatter = function(value,row,index){
  60. return row.leaseContract.contractNo;
  61. }
  62. var securityPersonNameFormatter = function(value,row,index){
  63. return row.securityPerson.name;
  64. }
  65. var securityPersonIdCardFormatter = function(value,row,index){
  66. return row.securityPerson.idCard;
  67. }
  68. var houseAddressFormatter = function(value,row,index){
  69. return row.house.address;
  70. }
  71. //月租金保留小数点后两位
  72. var rentMonthMoneyFormatter = function(value,row,index){
  73. return row.rentMonthMoney.toFixed(2);
  74. }
  75. //总租金保留小数点后两位
  76. var rentMoneyFormatter = function(value,row,index){
  77. return row.rentMoney.toFixed(2);
  78. }
  79. /**详细*/
  80. var detailsFormatter = function(value , row , index){
  81. if(row.rentType != 1){
  82. return "<img src='<%=basePath%>/images/details.png' title='查看详情' onclick=rentDetails(" + row.id + ") style='cursor:pointer' />";
  83. }else{
  84. return "<img src='<%=basePath%>/images/details.png' title='查看详情' onclick=rentRemoveDetails(" + row.id + ") style='cursor:pointer' />";
  85. }
  86. };
  87. /**详细页面对话框*/
  88. var rentDetails = function(id){
  89. $("#detailRentDialog").dialog(
  90. {
  91. buttons : [
  92. {
  93. text : '确定',
  94. iconCls : 'icon-ok',
  95. handler : function(){
  96. $("#detailRentDialog").dialog("close");
  97. }
  98. }
  99. ],
  100. onLoad : function(){
  101. detail_load(id);
  102. }
  103. }
  104. );
  105. };
  106. /**详细页面对话框*/
  107. var rentRemoveDetails = function(id){
  108. $("#detailRentRemoveDialog").dialog(
  109. {
  110. buttons : [
  111. {
  112. text : '确定',
  113. iconCls : 'icon-ok',
  114. handler : function(){
  115. $("#detailRentRemoveDialog").dialog("close");
  116. }
  117. }
  118. ],
  119. onLoad : function(){
  120. removeDetail_load(id);
  121. }
  122. }
  123. );
  124. };
  125. /**增加租金收取*/
  126. function rentAdd(){
  127. $('#addRentDialog').dialog(
  128. {
  129. buttons : [
  130. {
  131. text : '提交',
  132. iconCls : 'icon-ok',
  133. handler : function(){
  134. /*parent.$.messager.progress({
  135. title : '提示',
  136. text : '保存中,请稍后....'
  137. });*/
  138. add_submit();
  139. $("#addRentDialog").dialog("close");
  140. }
  141. },
  142. {
  143. text : '取消',
  144. iconCls : 'icon-cancel',
  145. handler : function(){
  146. $("#addRentDialog").dialog("close");
  147. }
  148. }
  149. ],
  150. onLoad : function(){
  151. add_load();
  152. }
  153. }
  154. );
  155. }
  156. /**增加租金退还*/
  157. function rentRemove(){
  158. $('#removeRentDialog').dialog(
  159. {
  160. buttons : [
  161. {
  162. text : '提交',
  163. iconCls : 'icon-ok',
  164. handler : function(){
  165. remove_submit();
  166. $("#removeRentDialog").dialog("close");
  167. }
  168. },
  169. {
  170. text : '取消',
  171. iconCls : 'icon-cancel',
  172. handler : function(){
  173. $("#removeRentDialog").dialog("close");
  174. }
  175. }
  176. ],
  177. onLoad : function(){
  178. remove_load();
  179. }
  180. }
  181. );
  182. }
  183. /**删除*/
  184. var delFormatter = function(value , row , index){
  185. return "<img src='<%=basePath%>/images/edit_remove.png' title='删除' onclick=deleteRow(" + row.id + ") style='cursor:pointer' />";
  186. };
  187. /**删除功能*/
  188. function deleteRow(id){
  189. $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
  190. if (r){
  191. $.ajax({
  192. type: "post",//使用get方法访问后台
  193. dataType: "json",//返回json格式的数据
  194. url: "rentAction_delete",//要访问的后台地址
  195. data: "rent.id="+id,//要发送的数据
  196. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  197. success: function(msg){//msg为返回的数据,在这里做数据绑定
  198. if(msg.success){
  199. $.messager.alert('提示','删除成功!');
  200. $('#rentDataGrid').datagrid('reload');
  201. }else{
  202. $.messager.alert('提示','删除失败!');
  203. }
  204. }
  205. });
  206. }
  207. });
  208. }
  209. --></script>
  210. <div class="easyui-layout" data-options="fit:true,border:false">
  211. <div data-options="region:'center',border:false">
  212. <div id="searchtool" data-options="region:'north' , border:false">
  213. <div class="clear"></div>
  214. <table id="tblQuery" style="width:100%;">
  215. <tr>
  216. <td align="right" style="width: 70px;"><span>租房人姓名</span></td><td style="width: 120px;"><input id="securityPersonName" name="rent.securityPerson.name" type="text" style="width: 100px;"/></td>
  217. <td align="right" style="width: 70px;"><span>租房人身份证号</span></td><td style="width: 120px;"><input id="securityPersonIdCard" name="rent.securityPerson.idCard" type="text" style="width: 140px;"/></td>
  218. <td align="left" style="width: 200px;">
  219. <a href="javascript:rentAdd();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">租金收取</a>
  220. <a href="javascript:rentRemove();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">租金退还</a>
  221. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  222. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
  223. </td>
  224. </tr>
  225. </table>
  226. <div class="clear"></div>
  227. </div>
  228. <table id="rentDataGrid">
  229. <thead>
  230. <tr>
  231. <th data-options="field:'contractName',sortable:true,width:155,formatter:contractNameFormatter">租赁合同名称</th>
  232. <th data-options="field:'contractNo',sortable:true,width:90,formatter:contractNoFormatter">租赁合同编号</th>
  233. <th data-options="field:'securityPersonName',sortable:true,width:80,formatter:securityPersonNameFormatter">租赁人</th>
  234. <th data-options="field:'securityPersonIdCard',sortable:true,width:160,formatter:securityPersonIdCardFormatter">租赁人身份证号码</th>
  235. <th data-options="field:'houseAddress',sortable:true,width:120,formatter:houseAddressFormatter">租赁房屋</th>
  236. <th data-options="field:'rentMonthMoney',sortable:true,width:75,formatter:rentMonthMoneyFormatter">月租金</th>
  237. <th data-options="field:'rentMonth',sortable:true,width:50">收取月数</th>
  238. <th data-options="field:'rentMoney',sortable:true,width:75,formatter:rentMoneyFormatter">收取总金额</th>
  239. <th data-options="field:'startDate',sortable:true,width:75,formatter:dateFormatter">租金开始日期</th>
  240. <th data-options="field:'endDate',sortable:true,width:75,formatter:dateFormatter">租金结束日期</th>
  241. <th data-options="field:'details',align:'center',width:60,formatter:detailsFormatter">查看详情</th>
  242. <!--<th data-options="field:'delete',align:'center',width:60,formatter:delFormatter">删除</th>-->
  243. </tr>
  244. </thead>
  245. </table>
  246. </div>
  247. </div>
  248. <div id="detailRentDialog" data-options="title:'&nbsp;租金收取详情',iconCls:'icon-details',width:800,height:420,modal:true,href:'<%=basePath %>/rentAction_toDetail'">
  249. </div>
  250. <div id="addRentDialog" data-options="title:'&nbsp;添加租金收取',iconCls:'icon-add',width:800,height:420,modal:true,href:'<%=basePath %>/rentAction_toAdd'">
  251. </div>
  252. <div id="leaseContractSelectDialog" data-options="title:'&nbsp;选择合同',iconCls:'icon-details',width:800,height:420,modal:true,href:'<%=basePath %>/leaseContractAction_toLeaseContractSelect'">
  253. </div>
  254. <div id="removeRentDialog" data-options="title:'&nbsp;添加租金退还',iconCls:'icon-remove',width:800,height:420,modal:true,href:'<%=basePath %>/rentAction_toRemove'">
  255. </div>
  256. <div id="detailRentRemoveDialog" data-options="title:'&nbsp;租金退还详情',iconCls:'icon-details',width:800,height:420,modal:true,href:'<%=basePath %>/rentAction_toRemoveDetail'">
  257. </div>
  258. <script type="text/javascript">
  259. <!--
  260. parent.$.messager.progress('close');
  261. //-->
  262. </script>