rentRemove.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ taglib prefix="s" uri="/struts-tags" %>
  3. <script>
  4. //人员类型
  5. var personTypeObj_remove = null;
  6. var personType_array_remove = null;
  7. //户型
  8. var roomTypeObj_remove = null;
  9. var roomType_array_remove = null;
  10. //取消原因
  11. var cancelReasonObj_cancel = null;
  12. var cancelReason_array_cancel = null;
  13. //从合同中添加
  14. function removeFromLeaseContract(){
  15. $('#leaseContractSelectDialog').dialog(
  16. {
  17. buttons : [
  18. {
  19. text : '确定',
  20. iconCls : 'icon-ok',
  21. handler : function(){
  22. var leaseContractId = select_submit();
  23. $("#leaseContractId_remove").val(leaseContractId);
  24. $.ajax({
  25. type: "post",//使用post方法访问后台
  26. dataType: "json",//返回json格式的数据
  27. url: "leaseContractAction_findById",//要访问的后台地址
  28. data:{"leaseContract.id":leaseContractId },
  29. success: function(msg){//msg为返回的数据,在这里做数据绑定
  30. if(msg.success){
  31. $("#securityPersonIdCard_remove").val(msg.obj.securityPerson.idCard);
  32. $("#securityPersonName_remove").val(msg.obj.securityPerson.name);
  33. $("#leaseContractId_remove").val(msg.obj.id);
  34. $("#securityPersonId_remove").val(msg.obj.securityPerson.id);
  35. $("#houseId_remove").val(msg.obj.house.id);
  36. $("#rentMonthMoney_remove").numberbox('setValue', msg.obj.moneyActual);
  37. $("#leaseContract_startDate_remove").datebox('setValue', msg.obj.startDate);
  38. $("#leaseContract_endDate_remove").datebox('setValue', msg.obj.endDate);
  39. $("#personType_remove").val(msg.obj.securityPerson.personType);
  40. $("#securityNum_remove").numberbox('setValue', msg.obj.securityPerson.securityNum);
  41. $("#houseAddress_remove").val(msg.obj.houseAddress);
  42. $("#roomType_remove").val(msg.obj.house.roomType);
  43. $("#contractNo_remove").val(msg.obj.contractNo);
  44. $("#contractName_remove").val(msg.obj.contractName);
  45. var houseArea = msg.obj.houseArea;
  46. if(houseArea == null){
  47. houseArea = 0;
  48. }
  49. $("#houseArea_remove").numberbox('setValue', houseArea);
  50. var garageArea = msg.obj.garageArea;
  51. if(garageArea == null){
  52. garageArea = 0;
  53. }
  54. $("#garageArea_remove").numberbox('setValue', garageArea);
  55. $('#rent_endDate_remove').datebox('setValue', msg.obj.rentDate);
  56. $('#endDate_remove').datebox('setValue', msg.obj.rentDate);
  57. }
  58. }
  59. });
  60. $("#leaseContractSelectDialog").dialog("close");
  61. }
  62. },
  63. {
  64. text : '取消',
  65. iconCls : 'icon-cancel',
  66. handler : function(){
  67. $("#leaseContractSelectDialog").dialog("close");
  68. }
  69. }
  70. ],
  71. onLoad : function(){
  72. select_load();
  73. }
  74. }
  75. );
  76. }
  77. //空值转换
  78. var dealNull = function(value){
  79. if(value == ""){
  80. return 0;
  81. }
  82. else{
  83. return value;
  84. }
  85. }
  86. //月份加减函数
  87. function removeMoth(d,m){
  88. var ds=d.split('-'),_d=ds[2]-0;
  89. var nextM=new Date( ds[0],ds[1]-1+m+1, 0 );
  90. var max=nextM.getDate();
  91. d=new Date( ds[0],ds[1]-1+m,_d>max? max:_d );
  92. return d.toLocaleDateString().match(/\d+/g).join('-')
  93. }
  94. //日期加减函数
  95. function removeDate(dd,dremove){
  96. var a = new Date(dd)
  97. a = a.valueOf()
  98. a = a + dremove * 24 * 60 * 60 * 1000
  99. a = new Date(a)
  100. return a;
  101. }
  102. //日期格式化
  103. Date.prototype.Format = function (fmt) { //author: meizz
  104. var o = {
  105. "M+": this.getMonth() + 1, //月份
  106. "d+": this.getDate(), //日
  107. "h+": this.getHours(), //小时
  108. "m+": this.getMinutes(), //分
  109. "s+": this.getSeconds(), //秒
  110. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  111. "S": this.getMilliseconds() //毫秒
  112. };
  113. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  114. for (var k in o)
  115. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  116. return fmt;
  117. }
  118. //计算金额和租金
  119. var countMoney = function(){
  120. var rentMonth_remove = dealNull($("#rentMonth_remove").numberbox('getValue'));
  121. var rentMonthMoney_remove = dealNull($("#rentMonthMoney_remove").numberbox('getValue'));
  122. var rentMoney1_remove = rentMonth_remove * rentMonthMoney_remove;
  123. $("#rentMoney1_remove").numberbox('setValue', rentMoney1_remove );
  124. }
  125. var remove_load = function(){
  126. $('#rentMonth_remove').numberbox({
  127. onChange: function () {
  128. countMoney();
  129. }
  130. });
  131. //人员类别
  132. $.ajax({
  133. type: "post",//使用post方法访问后台
  134. dataType: "json",//返回json格式的数据
  135. url: "aa10Action_listAa10All",//要访问的后台地址
  136. data:{"aa10.letter":"personType" ,"aa10.name":"保障人员类别" },
  137. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  138. success: function(msg){//msg为返回的数据,在这里做数据绑定
  139. if(msg.success){
  140. personTypeObj_remove = msg.obj.rows;
  141. var select_arr = [];
  142. var data = personTypeObj_remove;
  143. for(var nItem = 0; nItem < data.length; nItem++ ){
  144. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  145. }
  146. personType_array_remove = select_arr.join("");
  147. $("#personType_remove").append(personType_array_remove);
  148. }
  149. }
  150. });
  151. //户型
  152. $.ajax({
  153. type: "post",//使用post方法访问后台
  154. dataType: "json",//返回json格式的数据
  155. url: "aa10Action_listAa10All",//要访问的后台地址
  156. data:{"aa10.letter":"roomType" ,"aa10.name":"户型" },
  157. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  158. success: function(msg){//msg为返回的数据,在这里做数据绑定
  159. if(msg.success){
  160. roomTypeObj_remove = msg.obj.rows;
  161. var select_arr = [];
  162. var data = roomTypeObj_remove;
  163. for(var nItem = 0; nItem < data.length; nItem++ ){
  164. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  165. }
  166. roomType_array_remove = select_arr.join("");
  167. $("#roomType_remove").append(roomType_array_remove);
  168. }
  169. }
  170. });
  171. $("#cancelLease").change(
  172. function () {
  173. if($("#cancelLease").val() == "0"){
  174. $("#zzbt").hide();
  175. $("#cancelReason_cancel").hide();
  176. }else{
  177. $("#zzbt").show();
  178. $("#cancelReason_cancel").show();
  179. }
  180. }
  181. );
  182. }
  183. //取消原因
  184. $.ajax({
  185. type: "post",//使用post方法访问后台
  186. dataType: "json",//返回json格式的数据
  187. url: "aa10Action_listAa10All",//要访问的后台地址
  188. data:{"aa10.letter":"cancelReason" ,"aa10.name":"取消原因" },
  189. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  190. success: function(msg){//msg为返回的数据,在这里做数据绑定
  191. if(msg.success){
  192. cancelReasonObj_cancel = msg.obj.rows;
  193. var select_arr = [];
  194. var data = cancelReasonObj_cancel;
  195. for(var nItem = 0; nItem < data.length; nItem++ ){
  196. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  197. }
  198. cancelReason_array_cancel = select_arr.join("");
  199. $("#cancelReason_cancel").append(cancelReason_array_cancel);
  200. }
  201. }
  202. });
  203. var remove_submit = function(){
  204. $('#removeRentForm').form('submit',{
  205. url : whzl.basePath+'/rentAction_removeRent',
  206. success : function(result){
  207. var parseResult = $.parseJSON(result);
  208. if(parseResult.success){
  209. $('#rentDataGrid').datagrid('reload');
  210. }
  211. }
  212. }
  213. );
  214. }
  215. </script>
  216. <div class="easyui-tabs" id="tabs_remove">
  217. <div title="基本信息" id="jbxx_detail">
  218. <table class="mytable" style="width: 100%;" >
  219. <tr>
  220. <th>
  221. <a href="javascript:removeFromLeaseContract();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">从租赁合同中选择</a>
  222. </th>
  223. </tr>
  224. </table>
  225. <form id="removeRentForm" method="post" enctype="multipart/form-data">
  226. <table class="mytable" style="width: 100%;">
  227. <tr>
  228. <th width="20%">退租人身份证号</th>
  229. <td width="30%" >
  230. <input class="easyui-validatebox" readonly="readonly" style="width:150px" required="true" type="text" id="securityPersonIdCard_remove" />
  231. <input type="hidden" id="securityPersonId_remove" name="rent.securityPerson.id" />
  232. <input type="hidden" id="houseId_remove" name="rent.house.id" />
  233. <input type="hidden" id="leaseContractId_remove" name="rent.leaseContract.id" />
  234. </td>
  235. <th width="20%">退租人姓名</th>
  236. <td width="30%" >
  237. <input class="easyui-validatebox" readonly="readonly" style="width:150px" required="true" type="text" id="securityPersonName_remove" />
  238. </td>
  239. </tr>
  240. <tr>
  241. <th width="20%">合同编号</th>
  242. <td width="30%" >
  243. <input class="easyui-validatebox" style="width:150px" required="true" type="text" id="contractNo_remove" readonly="readonly" >
  244. </td>
  245. <th width="20%">合同名称</th>
  246. <td width="30%" >
  247. <input class="easyui-validatebox" style="width:150px" required="true" type="text" id="contractName_remove" >
  248. </td>
  249. </tr>
  250. <tr>
  251. <th width="20%">合同租房开始时间</th>
  252. <td width="30%" >
  253. <input id="leaseContract_startDate_remove" readonly="readonly" class="easyui-datebox" />
  254. </td>
  255. <th width="20%">合同租房结束时间</th>
  256. <td width="30%" >
  257. <input id="leaseContract_endDate_remove" readonly="readonly" class="easyui-datebox" />
  258. </td>
  259. </tr>
  260. <tr>
  261. <th width="20%">退租房屋地址</th>
  262. <td width="30%" >
  263. <input class="easyui-validatebox" readonly="readonly" style="width:150px" required="true" type="text" id="houseAddress_remove" >
  264. </td>
  265. <th width="20%">租金已交至</th>
  266. <td width="30%" >
  267. <input id="rent_endDate_remove" class="easyui-datebox" readonly="readonly" />
  268. </td>
  269. </tr>
  270. <tr>
  271. <th width="20%">退租开始时间</th>
  272. <td width="30%" >
  273. <input id="startDate_remove" name="rent.startDate" class="easyui-datebox" required="true"/>
  274. </td>
  275. <th width="20%">退租结束时间</th>
  276. <td width="30%" >
  277. <input id="endDate_remove" name="rent.endDate" class="easyui-datebox" required="true"/>
  278. </td>
  279. </tr>
  280. <tr>
  281. <th width="20%">退租月数</th>
  282. <td width="30%" >
  283. <input id="rentMonth_remove" name="rent.rentMonth" class="easyui-numberbox" required="true"/>
  284. </td>
  285. <th width="20%">月应退租金</th>
  286. <td width="30%" >
  287. <input id="rentMonthMoney_remove" precision="2" name="rent.rentMonthMoney" class="easyui-numberbox" required="true"/>
  288. </td>
  289. </tr>
  290. <tr>
  291. <th width="20%">应退租总金额</th>
  292. <td width="30%" >
  293. <input id="rentMoney1_remove" precision="2" readonly="readonly" class="easyui-numberbox" required="true"/>
  294. </td>
  295. <th width="20%">实际退租总金额</th>
  296. <td width="30%" >
  297. <input id="rentMoney_remove" precision="2" name="rent.rentMoney" class="easyui-numberbox" required="true"/>
  298. </td>
  299. </tr>
  300. <tr>
  301. <th width="20%">退租原因</th>
  302. <td colspan="3" >
  303. <textarea rows="2" cols="50" id="removeReason_remove" name= "rent.removeReason" ></textarea>
  304. </td>
  305. </tr>
  306. <tr>
  307. <th width="20%">是否终止合同</th>
  308. <td>
  309. <select id="cancelLease" style="width:100px;" name="cancelLease">
  310. <option value="0">否</option>
  311. <option value="1">是</option>
  312. </select>
  313. </td>
  314. <th> <span id="zzbt" style="display:none">合同终止原因 </span></th>
  315. <td>
  316. <select id="cancelReason_cancel" style="display:none" name="cancelReason" required="true">
  317. <option value="">请选择</option>
  318. </select>
  319. </td>
  320. </tr>
  321. </table>
  322. </form>
  323. </div>
  324. </div>