rentPlanUpdate.jsp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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 roomType1= 0;
  6. var roomType2 = 0;
  7. var task_load = function(id,page){
  8. $('#tabs_update').tabs('select', page);
  9. //加载配租方案
  10. $.ajax({
  11. type: "post",//使用post方法访问后台
  12. dataType: "json",//返回json格式的数据
  13. url: "rentPlanAction_findById",//要访问的后台地址
  14. data:{"rentPlan.id":id },
  15. success: function(msg){//msg为返回的数据,在这里做数据绑定
  16. if(msg.success){
  17. $("#id_update").val(msg.obj.id);
  18. $("#title_update").val(msg.obj.title);
  19. $("#content_update").val(msg.obj.content);
  20. $("#startDate_update").datebox("setValue",msg.obj.startDate);
  21. $("#endDate_update").datebox("setValue",msg.obj.endDate);
  22. }
  23. }
  24. });
  25. rentPlanId = id;
  26. $('#rentPlanHouseItemDataGrid').datagrid({
  27. rownumbers:true,
  28. border:false,
  29. sortOrder:'desc',
  30. url:whzl.basePath + '/rentPlanAction_listRentPlanHouseItem?rentPlanHouseItem.rentPlan.id=' + id,
  31. checkOnSelect:true,
  32. selectOnCheck:false,
  33. rowStyler:function(index,row){
  34. if(row.house != null){
  35. if (row.house.roomType == 1){
  36. roomType1++;
  37. return 'background-color:yellow;color:blue;font-weight:bold;';
  38. }else{
  39. roomType2++;
  40. }
  41. }
  42. },
  43. loadFilter:function(result){
  44. if(result.success){
  45. return result.obj;
  46. }else{
  47. $.messager.alert("提示",result.message);
  48. return ;
  49. }
  50. }
  51. });
  52. rentPlanId = id;
  53. $('#rentPlanApplyDataGrid').datagrid({
  54. rownumbers:true,
  55. border:false,
  56. checkOnSelect:true,
  57. selectOnCheck:true,
  58. url:whzl.basePath + '/rentPlanAction_listRentPlanApply?rentPlanApply.rentPlan.id=' + id,
  59. columns:[[
  60. {field:'name',title:'姓名',width:80,
  61. formatter:function(value,row,index){
  62. return row.securityPerson.name ;
  63. }
  64. },
  65. {field:'idCard',title:'身份证号码',width:150,
  66. formatter:function(value,row,index){
  67. return row.securityPerson.idCard ;
  68. }
  69. },
  70. {field:'phone',title:'联系电话',width:120,
  71. formatter:function(value,row,index){
  72. return row.securityPerson.phone;
  73. }
  74. },
  75. {field:'roomType',title:'适用户型',width:80,
  76. formatter:function(value,row,index){
  77. if(row.securityPerson.securityNum >=3){
  78. return "二居室";
  79. }else{
  80. return "一居室";
  81. }
  82. }
  83. },
  84. {field:'applyType',title:'在保类型',width:100,
  85. formatter:function(value,row,index){
  86. if(row.securityPerson.subsidiesState==0||row.securityPerson.subsidiesState==''){
  87. return "无其他保障类别";
  88. }else{
  89. return "申请公租房补贴";
  90. }
  91. }
  92. },
  93. {field:'delete',title:'删除',width:38,align:'center',
  94. formatter:function(value,row,index){
  95. return "<img src='" + whzl.basePath +"/js/easyui/themes/itemicon/delete.png' title='删除' onclick=deleteRentPlanApplyRow(" + row.id + ") style='cursor:pointer' />";
  96. }
  97. }
  98. ]],
  99. rowStyler:function(index,row){
  100. if(row.securityPerson !=null){
  101. if(row.securityPerson.securityNum <3){
  102. return 'background-color:yellow;color:blue;font-weight:bold;';
  103. }
  104. }
  105. },
  106. loadFilter:function(result){
  107. if(result.success){
  108. return result.obj;
  109. }else{
  110. return ;
  111. }
  112. },
  113. onLoadSuccess : function(){
  114. var rows = $("#rentPlanApplyDataGrid").datagrid("getRows");
  115. for(var i=0,l=rows.length;i<l;i++){
  116. $('#rentPlanApplyDataGrid').datagrid('beginEdit', i);
  117. }
  118. }
  119. });
  120. //加载配租方案
  121. $.ajax({
  122. type: "post",//使用post方法访问后台
  123. dataType: "json",//返回json格式的数据
  124. url: "rentPlanAction_findById",//要访问的后台地址
  125. data:{"rentPlan.id":id },
  126. success: function(msg){//msg为返回的数据,在这里做数据绑定
  127. if(msg.success){
  128. $("#title_update1").text(msg.obj.title);
  129. $("#content_update1").text(msg.obj.content);
  130. $("#startDate_update1").text(msg.obj.startDate.substring(0,10));
  131. $("#endDate_update1").text(msg.obj.endDate.substring(0,10));
  132. }
  133. }
  134. });
  135. }
  136. var task_submit = function(id){
  137. $('#updateRentPlanForm').form('submit',{
  138. url : whzl.basePath+'/rentPlanAction_updateRentPlan',
  139. success : function(result){
  140. var parseResult = $.parseJSON(result);
  141. if(parseResult.success){
  142. $.messager.alert("提示","摇号方案修改成功");
  143. parent.$.messager.progress('close');
  144. $("#updateRentPlanDialog").dialog("close");
  145. searchFun();
  146. }else{
  147. parent.$.messager.progress('close');
  148. $.messager.alert("提示",parseResult.message);
  149. }
  150. }
  151. });
  152. }
  153. //添加房源
  154. var addRentPlanHouse = function(){
  155. $('#addHouse').dialog(
  156. {
  157. buttons : [
  158. {
  159. text : '提交',
  160. iconCls : 'icon-ok',
  161. handler : function(){
  162. var houseIds = house_select_submit(rentPlanId);
  163. $.ajax({
  164. type: "post",//使用post方法访问后台
  165. dataType: "json",//返回json格式的数据
  166. url: "rentPlanAction_addRentPlanHouseItems",//要访问的后台地址
  167. data:{"rentPlanId":rentPlanId ,"houseIds":houseIds },
  168. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  169. success: function(msg){//msg为返回的数据,在这里做数据绑定
  170. if(msg.success){
  171. $('#rentPlanHouseItemDataGrid').datagrid("reload");
  172. $.messager.alert('提示','房源添加成功!');
  173. }
  174. }
  175. });
  176. $("#addHouse").dialog("close");
  177. }
  178. },
  179. {
  180. text : '取消',
  181. iconCls : 'icon-cancel',
  182. handler : function(){
  183. $("#addHouse").dialog("close");
  184. }
  185. }
  186. ],
  187. onLoad : function(){
  188. house_select_load('&house.houseState=6');
  189. }
  190. }
  191. );
  192. }
  193. var deleteRentPlanHouseItemRow = function(id){
  194. $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
  195. if (r){
  196. $.ajax({
  197. type: "post",//使用get方法访问后台
  198. dataType: "json",//返回json格式的数据
  199. url: "rentPlanAction_deleteRentPlanHouseItem",//要访问的后台地址
  200. data: "rentPlanHouseItem.id="+id,//要发送的数据
  201. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  202. success: function(msg){//msg为返回的数据,在这里做数据绑定
  203. if(msg.success){
  204. $.messager.alert('提示','删除成功!');
  205. $('#rentPlanHouseItemDataGrid').datagrid('reload');
  206. }else{
  207. $.messager.alert('提示',msg.message);
  208. }
  209. }
  210. });
  211. }
  212. });
  213. }
  214. var importRentPlanApply = function(){
  215. $.ajax({
  216. type: "post",//使用post方法访问后台
  217. dataType: "json",//返回json格式的数据
  218. url: "rentPlanAction_importRentPlanApply",//要访问的后台地址
  219. data:{"rentPlan.id":rentPlanId},
  220. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  221. success: function(msg){//msg为返回的数据,在这里做数据绑定
  222. if(msg.success){
  223. $.messager.alert('提示','人员添加成功!');
  224. $('#rentPlanApplyDataGrid').datagrid("reload");
  225. }
  226. }
  227. });
  228. }
  229. //添加人员
  230. var addRentPlanApply = function(){
  231. $('#addApply').dialog(
  232. {
  233. buttons : [
  234. {
  235. text : '提交',
  236. iconCls : 'icon-ok',
  237. handler : function(){
  238. var securityPersonIds = select_submit();
  239. $.ajax({
  240. type: "post",//使用post方法访问后台
  241. dataType: "json",//返回json格式的数据
  242. url: "rentPlanAction_addRentPlanApplys",//要访问的后台地址
  243. data:{"rentPlanId":rentPlanId ,"securityPersonIds":securityPersonIds },
  244. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  245. success: function(msg){//msg为返回的数据,在这里做数据绑定
  246. if(msg.success){
  247. $('#rentPlanApplyDataGrid').datagrid("reload");
  248. $.messager.alert('提示','人员添加成功!');
  249. }
  250. }
  251. });
  252. $("#addApply").dialog("close");
  253. }
  254. },
  255. {
  256. text : '取消',
  257. iconCls : 'icon-cancel',
  258. handler : function(){
  259. $("#addApply").dialog("close");
  260. }
  261. }
  262. ],
  263. onLoad : function(){
  264. var condition = "?securityPerson.rentHouseState=1&sort=waitDate&order=asc";
  265. select_load(condition);
  266. }
  267. }
  268. );
  269. }
  270. var deleteRentPlanApplyRow = function(id){
  271. $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
  272. if (r){
  273. $.ajax({
  274. type: "post",//使用get方法访问后台
  275. dataType: "json",//返回json格式的数据
  276. url: "rentPlanAction_deleteRentPlanApply",//要访问的后台地址
  277. data: "rentPlanApply.id="+id,//要发送的数据
  278. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  279. success: function(msg){//msg为返回的数据,在这里做数据绑定
  280. if(msg.success){
  281. $.messager.alert('提示','删除成功!');
  282. $('#rentPlanApplyDataGrid').datagrid('reload');
  283. }else{
  284. $.messager.alert('提示',msg.message);
  285. }
  286. }
  287. });
  288. }
  289. });
  290. }
  291. -->
  292. </script>
  293. <div class="easyui-tabs" id="tabs_update">
  294. <div title="基本信息" id="jbxx_update">
  295. <form id="updateRentPlanForm" method="post" enctype="multipart/form-data">
  296. <table class="mytable" style="width: 100%;">
  297. <tr>
  298. <th width="20%">摇号方案标题</th>
  299. <td width="80%" colspan = "3">
  300. <input class="easyui-validatebox" style="width:350px" required="true" type="text" id="title_update" name="rentPlan.title">
  301. <input id="id_update" name="rentPlan.id" type="hidden" />
  302. </td>
  303. </tr>
  304. <tr>
  305. <th width="20%" >摇号方案开始时间</th>
  306. <td width="30%" >
  307. <input id="startDate_update" name="rentPlan.startDate" class="easyui-datebox"/>
  308. </td>
  309. <th width="20%" >摇号方案结束时间</th>
  310. <td width="30%" >
  311. <input id="endDate_update" name="rentPlan.endDate" class="easyui-datebox"/>
  312. </td>
  313. </tr>
  314. <tr>
  315. <th>摇号方案内容</th>
  316. <td colspan = "3" >
  317. <textarea rows="12" cols="70" id="content_update" name="rentPlan.content"></textarea>
  318. </td>
  319. </tr>
  320. </table>
  321. </form>
  322. </div>
  323. <div title="房源选择" id="fyxz_update" >
  324. <table class="mytable" style="width: 100%;" >
  325. <tr>
  326. <th colspan="4" >添加摇号房源
  327. <a href="javascript:addRentPlanHouse();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">新增房源</a>
  328. <span style="background-color:yellow;color:blue;font-weight:bold;">一居室房屋</span>
  329. <span >二居室房屋</span>
  330. </th>
  331. </tr>
  332. </table>
  333. <table id="rentPlanHouseItemDataGrid" >
  334. <thead>
  335. <tr>
  336. <th data-options="field:'communityName',width:100,formatter:communityNameFormatter">小区名称</th>
  337. <th data-options="field:'address',width:200,formatter:addressFormatter">居住地点</th>
  338. <th data-options="field:'houseNumber',width:40,formatter:houseNumberFormatter">房号</th>
  339. <th data-options="field:'roomType',width:60,formatter:roomTypeHouseFormatter">户型</th>
  340. <th data-options="field:'area',width:60,formatter:areaFormatter">面积</th>
  341. <th data-options="field:'delete',align:'center',width:38,formatter:delRentPlanHouseItemFormatter">删除</th>
  342. </tr>
  343. </thead>
  344. </table>
  345. </div>
  346. <div title="人员选择" id="yxdj_update">
  347. <table class="mytable" style="width: 100%;" >
  348. <tr>
  349. <th colspan="4" >添加摇号对象
  350. <a href="javascript:importRentPlanApply();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">导入轮候人员</a>
  351. <a href="javascript:addRentPlanApply();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">新增配租对象</a>
  352. <input type="hidden" value="${rentPlanId}" id="rentPlanId">
  353. <span style="background-color:yellow;color:blue;font-weight:bold;">一居室房屋</span>
  354. <span >二居室房屋</span>
  355. </th>
  356. </tr>
  357. </table>
  358. <table id="rentPlanApplyDataGrid" >
  359. </table>
  360. </div>
  361. </div>