add.jsp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ taglib prefix="s" uri="/struts-tags" %>
  3. <form id="addChooseHouseForm" method="post">
  4. <input type="hidden" name="houseIds" id="houseIds_add">
  5. <table class="mytable" style="width: 100%;">
  6. <tr>
  7. <th>标题</th>
  8. <td colspan="3">
  9. <input class="easyui-validatebox" id="title_add" name="chooseHouse.title" required="true" style="width: 100%">
  10. </td>
  11. </tr>
  12. <tr>
  13. <th width="20%">业务时间</th>
  14. <td width="30%">
  15. <input class="easyui-datebox" id="businessDate_add" name="chooseHouse.businessDate" required="true" >
  16. </td>
  17. <th width="20%">业务人</th>
  18. <td width="30%">
  19. <input class="easyui-validatebox" id="businessUserName_add" value="${user.fullName}" name="chooseHouse.businessUserName" required="true" >
  20. </td>
  21. </tr>
  22. <tr>
  23. <th>装修清单<input type="button" value="选择" onclick="selectDecoration()"/></th>
  24. <td colspan="3">
  25. <input type="text" id="decorationName_add" style="width: 300px" class="easyui-validatebox" required="true" readonly="readonly"/>
  26. <input type="hidden" id="decorationId_add" name="chooseHouse.decoration.id">
  27. </td>
  28. </tr>
  29. </table>
  30. <table class="mytable" style="width: 100%;" >
  31. <tr>
  32. <th>
  33. <a href="javascript:addHouse1();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">新增房源</a>
  34. </th>
  35. </tr>
  36. </table>
  37. <table id="chooseHouseInfoDataGrid1">
  38. <thead>
  39. <tr>
  40. <th data-options="field:'communityName',width:150,formatter:communityNameFormatter">小区名称</th>
  41. <th data-options="field:'address',width:200,formatter:addressFormatter">居住地点</th>
  42. <th data-options="field:'houseNumber',width:40,formatter:houseNumberFormatter">房号</th>
  43. <th data-options="field:'area',width:60,formatter:areaFormatter">面积</th>
  44. <th data-options="field:'delete',align:'center',width:38,formatter:delChooseHouseFormatter">删除</th>
  45. </tr>
  46. </thead>
  47. </table>
  48. </form>
  49. <script type="text/javascript">
  50. //添加房源
  51. var addHouse1 = function(){
  52. $('#addHouse').dialog(
  53. {
  54. buttons : [
  55. {
  56. text : '提交',
  57. iconCls : 'icon-ok',
  58. handler : function(){
  59. var houseIds = house_select_submit();
  60. if(houseIds != ""){
  61. houseIds = houseIds +",";
  62. }
  63. var rows = $("#chooseHouseInfoDataGrid1").datagrid("getRows");
  64. if(typeof(rows) != "undefined"){
  65. for(var i=0;i<rows.length;i++){
  66. houseIds += rows[i].id+",";
  67. }
  68. }
  69. if(houseIds != ""){
  70. houseIds = houseIds.substring(0,houseIds.length - 1);
  71. }
  72. $('#chooseHouseInfoDataGrid1').datagrid({
  73. rownumbers:true,
  74. fitColumns:false,
  75. border:false,
  76. sortOrder:'desc',
  77. nowrap:true,
  78. url:whzl.basePath + '/chooseHouseAction_houseList?houseIds='+ houseIds,
  79. loadFilter:function(result){
  80. if(result.success){
  81. return result.obj;
  82. }else{
  83. return ;
  84. }
  85. }
  86. });
  87. $('#addChooseHouseForm').form('submit',
  88. {
  89. url : whzl.basePath+'/chooseHouseAction_addHouseChoose',
  90. success : function(result){
  91. var parseResult = $.parseJSON(result);
  92. if(parseResult.success){
  93. $.messager.alert('提示','接收成功!');
  94. if( $('#chooseHouseDataGrid') != null){
  95. $('#chooseHouseDataGrid').datagrid('reload');
  96. }
  97. if( $('#taskDataGrid') != null){
  98. $('#taskDataGrid').datagrid('reload');
  99. }
  100. }else{
  101. $.messager.alert("提示",parseResult.message);
  102. }
  103. }
  104. }
  105. );
  106. $("#addHouse").dialog("close");
  107. }
  108. },
  109. {
  110. text : '取消',
  111. iconCls : 'icon-cancel',
  112. handler : function(){
  113. $("#addHouse").dialog("close");
  114. }
  115. }
  116. ],
  117. onLoad : function(){
  118. var houseIds = "";
  119. var rows = $("#chooseHouseInfoDataGrid1").datagrid("getRows");
  120. if(typeof(rows) != "undefined"){
  121. for(var i=0;i<rows.length;i++){
  122. houseIds += rows[i].id+",";
  123. }
  124. if(houseIds != ""){
  125. houseIds = houseIds.substring(0,houseIds.length - 1);
  126. }
  127. }
  128. house_select_load('&houseIds='+ houseIds);
  129. }
  130. }
  131. );
  132. }
  133. /**小区名称*/
  134. var communityNameFormatter = function(value , row , index){
  135. if (typeof(row.communityName) != "undefined") {
  136. return row.communityName;
  137. }else{
  138. return row.house.communityName;
  139. }
  140. };
  141. /**居住地点*/
  142. var addressFormatter = function(value , row , index){
  143. if (typeof(row.address) != "undefined") {
  144. return row.address;
  145. }else{
  146. return row.house.address;
  147. }
  148. };
  149. /**房号*/
  150. var houseNumberFormatter = function(value , row , index){
  151. if (typeof(row.houseNumber) != "undefined") {
  152. return row.houseNumber;
  153. }else{
  154. return row.house.houseNumber;
  155. }
  156. };
  157. /**面积*/
  158. var areaFormatter = function(value , row , index){
  159. if (typeof(row.area) != "undefined") {
  160. return row.area;
  161. }else{
  162. return row.house.area;
  163. }
  164. };
  165. /**删除*/
  166. var delChooseHouseFormatter = function(value , row , index){
  167. return "<img src='" + whzl.basePath +"/js/easyui/themes/itemicon/delete.png' title='删除' onclick=deleteChooseHouseInfo(" + row.id + ") style='cursor:pointer' />";
  168. };
  169. var deleteChooseHouseInfo = function(id){
  170. var houseIds = "";
  171. var rows = $("#chooseHouseInfoDataGrid1").datagrid("getRows");
  172. if(typeof(rows) != "undefined"){
  173. for(var i=0;i<rows.length;i++){
  174. if(rows[i].id != id){
  175. houseIds += rows[i].id+",";
  176. }
  177. }
  178. }
  179. if(houseIds != ""){
  180. houseIds = houseIds.substring(0,houseIds.length - 1);
  181. }
  182. $('#chooseHouseInfoDataGrid1').datagrid({
  183. rownumbers:true,
  184. fitColumns:false,
  185. border:false,
  186. sortOrder:'desc',
  187. nowrap:true,
  188. url:whzl.basePath + '/chooseHouseAction_houseList?houseIds='+ houseIds,
  189. loadFilter:function(result){
  190. if(result.success){
  191. return result.obj;
  192. }else{
  193. return ;
  194. }
  195. }
  196. });
  197. }
  198. /*function selectDecoration(){
  199. $("#decorationList2Dialog").dialog({
  200. buttons:[{
  201. text : '确认',
  202. iconCls : 'icon-ok',
  203. handler : function(){
  204. var row = $('#decoration2DataGrid').datagrid('getSelected');
  205. $("#decorationId_add").val(row.id);
  206. $("#decorationName_add").val(row.name);
  207. $("#decorationList2Dialog").dialog("close");
  208. }
  209. }]
  210. })
  211. }
  212. var createUserFormatter = function(value, row, index){
  213. return row.createUser.fullName;
  214. }
  215. var dateFormatter = function(value, row, index){
  216. return dealDate(value);
  217. }*/
  218. </script>