rentPlanUpdate.jsp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ taglib prefix="s" uri="/struts-tags" %>
  3. <script type="text/javascript"><!--
  4. var rentPlanId = null;
  5. var task_load = function(id,page){
  6. $('#tabs_update').tabs('select', page);
  7. //加载配租方案
  8. $.ajax({
  9. type: "post",//使用post方法访问后台
  10. dataType: "json",//返回json格式的数据
  11. url: "rentPlanAction_findById",//要访问的后台地址
  12. data:{"rentPlan.id":id },
  13. success: function(msg){//msg为返回的数据,在这里做数据绑定
  14. if(msg.success){
  15. $("#id_update").val(msg.obj.id);
  16. $("#title_update").val(msg.obj.title);
  17. $("#content_update").val(msg.obj.content);
  18. $("#startDate_update").datebox("setValue",msg.obj.startDate);
  19. $("#endDate_update").datebox("setValue",msg.obj.endDate);
  20. }
  21. }
  22. });
  23. rentPlanId = id;
  24. $('#rentPlanHouseItemDataGrid').datagrid({
  25. rownumbers:true,
  26. border:false,
  27. sortOrder:'desc',
  28. url:whzl.basePath + '/rentPlanAction_listRentPlanHouseItem?rentPlanHouseItem.rentPlan.id=' + id,
  29. checkOnSelect:true,
  30. selectOnCheck:false,
  31. loadFilter:function(result){
  32. if(result.success){
  33. return result.obj;
  34. }else{
  35. $.messager.alert("提示",result.message);
  36. return ;
  37. }
  38. }
  39. });
  40. }
  41. var task_submit = function(id){
  42. $('#updateRentPlanForm').form('submit',{
  43. url : whzl.basePath+'/rentPlanAction_updateRentPlan',
  44. success : function(result){
  45. var parseResult = $.parseJSON(result);
  46. if(parseResult.success){
  47. parent.$.messager.progress('close');
  48. $("#updateRentPlanDialog").dialog("close");
  49. searchFun();
  50. }else{
  51. parent.$.messager.progress('close');
  52. $.messager.alert("提示",parseResult.message);
  53. }
  54. }
  55. });
  56. }
  57. //添加房源
  58. var addRentPlanHouse = function(){
  59. $('#addHouse').dialog(
  60. {
  61. buttons : [
  62. {
  63. text : '提交',
  64. iconCls : 'icon-ok',
  65. handler : function(){
  66. var houseIds = house_select_submit(rentPlanId);
  67. $.ajax({
  68. type: "post",//使用post方法访问后台
  69. dataType: "json",//返回json格式的数据
  70. url: "rentPlanAction_addRentPlanHouseItems",//要访问的后台地址
  71. data:{"rentPlanId":rentPlanId ,"houseIds":houseIds },
  72. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  73. success: function(msg){//msg为返回的数据,在这里做数据绑定
  74. if(msg.success){
  75. $('#rentPlanHouseItemDataGrid').datagrid("reload");
  76. }
  77. }
  78. });
  79. $("#addHouse").dialog("close");
  80. }
  81. },
  82. {
  83. text : '取消',
  84. iconCls : 'icon-cancel',
  85. handler : function(){
  86. $("#addHouse").dialog("close");
  87. }
  88. }
  89. ],
  90. onLoad : function(){
  91. house_select_load('&house.houseState=1');
  92. }
  93. }
  94. );
  95. }
  96. var deleteRentPlanHouseItemRow = function(id){
  97. $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
  98. if (r){
  99. $.ajax({
  100. type: "post",//使用get方法访问后台
  101. dataType: "json",//返回json格式的数据
  102. url: "rentPlanAction_deleteRentPlanHouseItem",//要访问的后台地址
  103. data: "rentPlanHouseItem.id="+id,//要发送的数据
  104. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  105. success: function(msg){//msg为返回的数据,在这里做数据绑定
  106. if(msg.success){
  107. $.messager.alert('提示','删除成功!');
  108. $('#rentPlanHouseItemDataGrid').datagrid('reload');
  109. }else{
  110. $.messager.alert('提示',msg.message);
  111. }
  112. }
  113. });
  114. }
  115. });
  116. }
  117. -->
  118. </script>
  119. <div class="easyui-tabs" id="tabs_update">
  120. <div title="基本信息" id="jbxx_update">
  121. <form id="updateRentPlanForm" method="post" enctype="multipart/form-data">
  122. <table class="mytable" style="width: 100%;">
  123. <tr>
  124. <th width="20%">配租方案标题</th>
  125. <td width="80%" colspan = "3">
  126. <input class="easyui-validatebox" style="width:350px" required="true" type="text" id="title_update" name="rentPlan.title">
  127. <input id="id_update" name="rentPlan.id" type="hidden" />
  128. </td>
  129. </tr>
  130. <tr>
  131. <th width="20%" >配租方案开始时间</th>
  132. <td width="30%" >
  133. <input id="startDate_update" name="rentPlan.startDate" class="easyui-datebox"/>
  134. </td>
  135. <th width="20%" >配租方案结束时间</th>
  136. <td width="30%" >
  137. <input id="endDate_update" name="rentPlan.endDate" class="easyui-datebox"/>
  138. </td>
  139. </tr>
  140. <tr>
  141. <th>配租方案内容</th>
  142. <td colspan = "3" >
  143. <textarea rows="12" cols="70" id="content_update" name="rentPlan.content"></textarea>
  144. </td>
  145. </tr>
  146. </table>
  147. </form>
  148. </div>
  149. <div title="房源选择" id="fyxz_update" >
  150. <table class="mytable" style="width: 100%;" >
  151. <tr>
  152. <th colspan="4" >添加配租方案房源
  153. <a href="javascript:addRentPlanHouse();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">新增房源</a>
  154. </th>
  155. </tr>
  156. </table>
  157. <table id="rentPlanHouseItemDataGrid" >
  158. <thead>
  159. <tr>
  160. <th data-options="field:'communityName',width:100,formatter:communityNameFormatter">小区名称</th>
  161. <th data-options="field:'address',width:200,formatter:addressFormatter">居住地点</th>
  162. <th data-options="field:'houseNumber',width:40,formatter:houseNumberFormatter">房号</th>
  163. <th data-options="field:'roomType',width:40,formatter:roomTypeHouseFormatter">户型</th>
  164. <th data-options="field:'area',width:60,formatter:areaFormatter">面积</th>
  165. <th data-options="field:'delete',align:'center',width:38,formatter:delRentPlanHouseItemFormatter">删除</th>
  166. </tr>
  167. </thead>
  168. </table>
  169. </div>
  170. </div>