yaohaoUpdate.jsp 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <script type="text/javascript"><!--
  3. var yaohaoId = null;
  4. var rentPlanObj = null;
  5. var rentPlan_array = null;
  6. var update_load = function(id,page){
  7. $('#tabs_update').tabs('select', page);
  8. yaohaoId = id;
  9. //配租方案
  10. $.ajax({
  11. type: "post",//使用post方法访问后台
  12. dataType: "json",//返回json格式的数据
  13. url: "rentPlanAction_listRentPlan",//要访问的后台地址
  14. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  15. success: function(msg){//msg为返回的数据,在这里做数据绑定
  16. if(msg.success){
  17. rentPlanObj = msg.obj.rows;
  18. var select_arr = [];
  19. var data = rentPlanObj;
  20. for(var nItem = 0; nItem < data.length; nItem++ ){
  21. select_arr.push("<option value="+data[nItem].id+">"+ data[nItem].title +"</option>");
  22. }
  23. rentPlan_array = select_arr.join("");
  24. $("#rentPlanId_update").append(rentPlan_array);
  25. }
  26. }
  27. });
  28. $.ajax({
  29. type: "post",//使用post方法访问后台
  30. dataType: "json",//返回json格式的数据
  31. url: "yaohaoAction_findById",//要访问的后台地址
  32. data:{"yaohao.id":id},
  33. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  34. success: function(msg){//msg为返回的数据,在这里做数据绑定
  35. if(msg.success){
  36. $("#rentPlanId_update").val(msg.obj.rentPlan.id);
  37. $("#title_update").val(msg.obj.title);
  38. $("#id_update").val(id);
  39. }
  40. }
  41. });
  42. $('#houseDataGrid_update').datagrid({
  43. rownumbers:true,
  44. border:false,
  45. sortOrder:'desc',
  46. url:whzl.basePath + '/yaohaoAction_findHousesById?yaohao.id=' + id,
  47. checkOnSelect:true,
  48. selectOnCheck:false,
  49. loadFilter:function(result){
  50. if(result.success){
  51. return result.obj;
  52. }else{
  53. $.messager.alert("提示",result.message);
  54. return ;
  55. }
  56. }
  57. });
  58. $('#rentPlanApplyDataGrid_update').datagrid({
  59. rownumbers:true,
  60. border:false,
  61. sortOrder:'desc',
  62. url:whzl.basePath + '/yaohaoAction_findSecurityPersonByIds?yaohao.id=' + id,
  63. checkOnSelect:true,
  64. selectOnCheck:false,
  65. loadFilter:function(result){
  66. if(result.success){
  67. return result.obj;
  68. }else{
  69. $.messager.alert("提示",result.message);
  70. return ;
  71. }
  72. }
  73. });
  74. }
  75. var update_submit = function(){
  76. $('#updateYaohaoForm').form('submit',{
  77. url : whzl.basePath+'/yaohaoAction_updateYaohao',
  78. success : function(result){
  79. $("#updateYaohaoDialog").dialog("close");
  80. $('#yaohaoDataGrid').datagrid('reload');
  81. }
  82. }
  83. );
  84. }
  85. /**删除*/
  86. var delHouseFormatter = function(value , row , index){
  87. return "<img src='" + whzl.basePath +"/images/edit_remove.png' title='删除' onclick=deleteHouseRow(" + row.id + ") style='cursor:pointer' />";
  88. };
  89. /**删除*/
  90. var delSecurityPersonFormatter = function(value , row , index){
  91. return "<img src='" + whzl.basePath +"/images/edit_remove.png' title='删除' onclick=deleteSecurityPersonRow(" + row.id + ") style='cursor:pointer' />";
  92. };
  93. var addHouse = function(){
  94. var rentPlanId = $("#rentPlanId_update").val();
  95. $('#addHouseDialog').dialog(
  96. {
  97. buttons : [
  98. {
  99. text : '提交',
  100. iconCls : 'icon-ok',
  101. handler : function(){
  102. var houseIds = house_select_submit(rentPlanId);
  103. $.ajax({
  104. type: "post",//使用post方法访问后台
  105. dataType: "json",//返回json格式的数据
  106. url: "yaohaoAction_addHouses",//要访问的后台地址
  107. data:{"yaohaoId":yaohaoId ,"houseIds":houseIds },
  108. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  109. success: function(msg){//msg为返回的数据,在这里做数据绑定
  110. if(msg.success){
  111. $('#houseDataGrid_update').datagrid("reload");
  112. }
  113. }
  114. });
  115. $("#addHouseDialog").dialog("close");
  116. }
  117. },
  118. {
  119. text : '取消',
  120. iconCls : 'icon-cancel',
  121. handler : function(){
  122. $("#addHouseDialog").dialog("close");
  123. }
  124. }
  125. ],
  126. onLoad : function(){
  127. house_select_load(rentPlanId);
  128. }
  129. }
  130. );
  131. }
  132. var addRentPlanApply = function(){
  133. var rentPlanId = $("#rentPlanId_update").val();
  134. $('#addSecurityPersonDialog').dialog(
  135. {
  136. buttons : [
  137. {
  138. text : '提交',
  139. iconCls : 'icon-ok',
  140. handler : function(){
  141. var rentPlanApplyIds = select_submit(rentPlanId);
  142. $.ajax({
  143. type: "post",//使用post方法访问后台
  144. dataType: "json",//返回json格式的数据
  145. url: "yaohaoAction_addSecurityPersons",//要访问的后台地址
  146. data:{"yaohaoId":yaohaoId ,"rentPlanApplyIds":rentPlanApplyIds },
  147. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  148. success: function(msg){//msg为返回的数据,在这里做数据绑定
  149. if(msg.success){
  150. $('#rentPlanApplyDataGrid_update').datagrid("reload");
  151. }
  152. }
  153. });
  154. $("#addSecurityPersonDialog").dialog("close");
  155. }
  156. },
  157. {
  158. text : '取消',
  159. iconCls : 'icon-cancel',
  160. handler : function(){
  161. $("#addSecurityPersonDialog").dialog("close");
  162. }
  163. }
  164. ],
  165. onLoad : function(){
  166. select_load(rentPlanId);
  167. }
  168. }
  169. );
  170. }
  171. //删除待摇号房屋
  172. var deleteHouseRow = function(id){
  173. $.ajax({
  174. type: "post",//使用post方法访问后台
  175. dataType: "json",//返回json格式的数据
  176. url: "yaohaoAction_deleteHouseById",//要访问的后台地址
  177. data:{"yaohaoId":yaohaoId , "houseId" : id },
  178. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  179. success: function(msg){//msg为返回的数据,在这里做数据绑定
  180. $.messager.alert("提示","删除成功");
  181. $('#houseDataGrid_update').datagrid("reload");
  182. }
  183. });
  184. }
  185. //删除待摇号人员
  186. var deleteSecurityPersonRow = function(id){
  187. $.ajax({
  188. type: "post",//使用post方法访问后台
  189. dataType: "json",//返回json格式的数据
  190. url: "yaohaoAction_deleteSecurityPersonById",//要访问的后台地址
  191. data:{"yaohaoId":yaohaoId , "securityPersonId" : id },
  192. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  193. success: function(msg){//msg为返回的数据,在这里做数据绑定
  194. $.messager.alert("提示","删除成功");
  195. $('#rentPlanApplyDataGrid_update').datagrid("reload");
  196. }
  197. });
  198. }
  199. --></script>
  200. <form id="updateYaohaoForm" method="post" enctype="multipart/form-data">
  201. <div class="easyui-tabs" id="tabs_update">
  202. <div title="基本信息" id="jbxx_update">
  203. <table class="mytable" style="width: 100%;">
  204. <tr>
  205. <th width="40%">摇号标题</th>
  206. <td width="60%" >
  207. <input type="hidden" id="id_update" name="yaohao.id">
  208. <input class="easyui-validatebox" style="width:350px" required="true" type="text" id="title_update" name="yaohao.title">
  209. </td>
  210. </tr>
  211. <tr>
  212. <th>选择配租方案</th>
  213. <td>
  214. <select name="yaohao.rentPlan.id" disabled="disabled" id="rentPlanId_update" class="easyui-validatebox" required="true">
  215. <option value="">请选择</option>
  216. </select>
  217. </td>
  218. </tr>
  219. </table>
  220. </div>
  221. <div title="待摇号房源信息" id="fyxx_update">
  222. <table class="mytable" style="width: 100%;" >
  223. <tr>
  224. <th>加入待摇号房源
  225. <a href="javascript:addHouse();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">加入待摇号房源</a>
  226. </th>
  227. </tr>
  228. </table>
  229. <table id="houseDataGrid_update" title="待摇号房源信息" >
  230. <thead>
  231. <tr>
  232. <th data-options="field:'communityName',width:150,formatter:communityNameFormatter">小区名称</th>
  233. <th data-options="field:'address',width:200,formatter:addressFormatter">居住地点</th>
  234. <th data-options="field:'houseNumber',width:40,formatter:houseNumberFormatter">房号</th>
  235. <th data-options="field:'area',width:60,formatter:areaFormatter">面积</th>
  236. <th data-options="field:'delete',align:'center',width:38,formatter:delHouseFormatter">删除</th>
  237. </tr>
  238. </thead>
  239. </table>
  240. </div>
  241. <div title="待摇号人员信息" id="yxdj_update">
  242. <table class="mytable" style="width: 100%;" >
  243. <tr>
  244. <th>加入待摇号人员
  245. <a href="javascript:addRentPlanApply();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">加入待摇号人员</a>
  246. </th>
  247. </tr>
  248. </table>
  249. <table id="rentPlanApplyDataGrid_update" title="待摇号人员信息">
  250. <thead>
  251. <tr>
  252. <th data-options="field:'name',align:'center',sortable:true,width:80,formatter:nameFormatter">姓名</th>
  253. <th data-options="field:'idCard',align:'center',sortable:true,width:180,formatter:idCardFormatter">身份证<br/>号码</th>
  254. <th data-options="field:'phone',align:'center',sortable:true,width:90,formatter:phoneFormatter">联系<br/>电话</th>
  255. <th data-options="field:'roomType',align:'center',sortable:true,width:90,formatter:roomTypeFormatter">适用户型</th>
  256. <%-- <th data-options="field:'communityName',align:'center',sortable:true,width:90,formatter:communityNameApplyFormatter">意向小区</th>--%>
  257. <th data-options="field:'delete',align:'center',width:38,formatter:delSecurityPersonFormatter">删除</th>
  258. </tr>
  259. </thead>
  260. </table>
  261. </div>
  262. </div>
  263. </form>