houseList.jsp 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
  2. <jsp:include page="../../common/include.jsp" />
  3. <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
  4. <script type="text/javascript">
  5. //区
  6. var areaObj = null;
  7. var area_array = null;
  8. //户型
  9. var roomTypeObj = null;
  10. var roomType_array = null;
  11. //保障性住房类型
  12. var typeObj = null;
  13. var type_array = null;
  14. //装修状态
  15. var decorationStateObj = null;
  16. var decorationState_array = null;
  17. //房源状态
  18. var houseStateObj = null;
  19. var houseState_array = null;
  20. //是否现房
  21. var isExistHouseObj = null;
  22. var isExistHouse_array = null;
  23. var brandobj = null;
  24. //户型
  25. $.ajax({
  26. type: "post",//使用post方法访问后台
  27. dataType: "json",//返回json格式的数据
  28. url: "aa10Action_listAa10All",//要访问的后台地址
  29. data:{"aa10.letter":"roomType" ,"aa10.name":"户型" },
  30. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  31. success: function(msg){//msg为返回的数据,在这里做数据绑定
  32. if(msg.success){
  33. roomTypeObj = msg.obj.rows;
  34. var select_arr = [];
  35. var data = roomTypeObj;
  36. for(var nItem = 0; nItem < data.length; nItem++ ){
  37. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  38. }
  39. roomType_array = select_arr.join("");
  40. $("#roomType").append(roomType_array);
  41. }
  42. }
  43. });
  44. //保障性住房类型
  45. $.ajax({
  46. type: "post",//使用post方法访问后台
  47. dataType: "json",//返回json格式的数据
  48. url: "aa10Action_listAa10All",//要访问的后台地址
  49. data:{"aa10.letter":"indemnificatoryType" ,"aa10.name":"保障性住房类型" },
  50. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  51. success: function(msg){//msg为返回的数据,在这里做数据绑定
  52. if(msg.success){
  53. typeObj = msg.obj.rows;
  54. var select_arr = [];
  55. var data = typeObj;
  56. for(var nItem = 0; nItem < data.length; nItem++ ){
  57. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  58. }
  59. type_array = select_arr.join("");
  60. $("#type").append(type_array);
  61. }
  62. }
  63. });
  64. //装修状态
  65. $.ajax({
  66. type: "post",//使用post方法访问后台
  67. dataType: "json",//返回json格式的数据
  68. url: "aa10Action_listAa10All",//要访问的后台地址
  69. data:{"aa10.letter":"decorationState" ,"aa10.name":"装修状态" },
  70. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  71. success: function(msg){//msg为返回的数据,在这里做数据绑定
  72. if(msg.success){
  73. decorationStateObj = msg.obj.rows;
  74. var select_arr = [];
  75. var data = decorationStateObj;
  76. for(var nItem = 0; nItem < data.length; nItem++ ){
  77. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  78. }
  79. decorationState_array = select_arr.join("");
  80. $("#decorationState").append(decorationState_array);
  81. }
  82. }
  83. });
  84. //房源状态
  85. $.ajax({
  86. type: "post",//使用post方法访问后台
  87. dataType: "json",//返回json格式的数据
  88. url: "aa10Action_listAa10All",//要访问的后台地址
  89. data:{"aa10.letter":"houseState" ,"aa10.name":"房屋状态"},
  90. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  91. success: function(msg){//msg为返回的数据,在这里做数据绑定
  92. if(msg.success){
  93. houseStateObj = msg.obj.rows;
  94. var select_arr = [];
  95. var data = houseStateObj;
  96. for(var nItem = 0; nItem < data.length; nItem++ ){
  97. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  98. }
  99. houseState_array = select_arr.join("");
  100. }
  101. }
  102. });
  103. //是否现房
  104. $.ajax({
  105. type: "post",//使用post方法访问后台
  106. dataType: "json",//返回json格式的数据
  107. url: "aa10Action_listAa10All",//要访问的后台地址
  108. data:{"aa10.letter":"isExistHouse" ,"aa10.name":"是否现房"},
  109. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  110. success: function(msg){//msg为返回的数据,在这里做数据绑定
  111. if(msg.success){
  112. isExistHouseObj = msg.obj.rows;
  113. var select_arr = [];
  114. var data = isExistHouseObj;
  115. for(var nItem = 0; nItem < data.length; nItem++ ){
  116. select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
  117. }
  118. isExistHouse_array = select_arr.join("");
  119. }
  120. }
  121. });
  122. //获取区
  123. $.ajax({
  124. type: "post",//使用post方法访问后台
  125. dataType: "json",//返回json格式的数据
  126. url: "houseRegisterAction_listChildren",//要访问的后台地址
  127. //data:{"id":id},
  128. success: function(msg){//msg为返回的数据,在这里做数据绑定
  129. if(msg.success){
  130. areaObj = msg.obj.rows;
  131. var select_arr = [];
  132. var data = areaObj;
  133. for(var nItem = 0; nItem < data.length; nItem++ ){
  134. select_arr.push("<option value="+data[nItem].id+">"+data[nItem].name+"</option>");
  135. }
  136. area_array = select_arr.join("");
  137. }
  138. }
  139. });
  140. /**小区显示区*/
  141. $(function() {
  142. $('#houseDataGrid').datagrid({
  143. rownumbers:true,
  144. fit:true,
  145. pageSize:20,
  146. pageList : [ 10, 20, 30, 40, 50 ],
  147. fitColumns:false,
  148. border:false,
  149. sortOrder:'desc',
  150. pagination:true,
  151. idField:'id',
  152. url:whzl.basePath + '/houseAction_listHouse',
  153. toolbar:'#searchtool',
  154. checkOnSelect:true,
  155. selectOnCheck:true,
  156. singleSelect:true,
  157. loadFilter:function(result){
  158. if(result.success){
  159. console.log(result.obj)
  160. return result.obj;
  161. }else{
  162. $.messager.alert("提示",result.message);
  163. return ;
  164. }
  165. }
  166. });
  167. });
  168. /**查询*/
  169. function searchFun(){
  170. var params = encodeURI("house.community.id="+trim($('#communityId').combobox("getValue"))+
  171. "&house.no="+trim($('#no').combobox("getValue"))+
  172. "&house.houseNumber="+trim($('#houseNumber').combobox("getValue"))+
  173. "&house.roomType="+trim($('#roomType').val())+
  174. "&house.deliveryDate="+$('#deliveryDate').datebox('getValue')+
  175. "&house.houseState="+$('#houseState').val()
  176. );
  177. $('#houseDataGrid').datagrid({url:whzl.basePath + '/houseAction_listHouse?'+params,pageNumber:1});
  178. }
  179. /*清除查询条件**/
  180. function ClearQuery() {
  181. $('#communityId').combobox("setValue","");
  182. $('#no').combobox("setValue","");
  183. $('#houseNumber').combobox("setValue","");
  184. $("#tblQuery").find("input").val("");
  185. $("#tblQuery").find("select").val("-1");
  186. }
  187. /**详细*/
  188. var detailsFormatter = function(value , row , index){
  189. return "<img src='<%=basePath%>/js/easyui/themes/itemicon/detail.png' title='查看详情' onclick=houseDetails(" + row.id + ") style='cursor:pointer' />";
  190. };
  191. /**详细页面对话框*/
  192. var houseDetails = function(id){
  193. $("#detailHouseDialog").dialog(
  194. {
  195. buttons : [
  196. {
  197. text : '确定',
  198. iconCls : 'icon-ok',
  199. handler : function(){
  200. $("#detailHouseDialog").dialog("close");
  201. }
  202. }
  203. ],
  204. onLoad : function(){
  205. house_detail_load(id);
  206. }
  207. }
  208. );
  209. };
  210. /**更新*/
  211. var updateFormatter = function(value , row , index){
  212. return "<img src='<%=basePath%>/images/pencil.png' title='修改' onclick=updateRow(" + row.id + ",'update') style='cursor:pointer' />";
  213. };
  214. /**更新事件*/
  215. function updateRow(id,param){
  216. var selectedItems = $('#houseDataGrid').datagrid('getSelections');
  217. if(selectedItems.length==1){
  218. var id=selectedItems[0].id;
  219. //var updateIndex = $('#houseDataGrid').datagrid('getRowIndex', id);
  220. $('#updateHouseDialog').dialog(
  221. {
  222. buttons : [
  223. {
  224. text : '提交',
  225. iconCls : 'icon-ok',
  226. handler : function(){
  227. if($("#communityId_update").combobox("getValue") == ''){
  228. $.messager.alert("提示","请选择小区信息!");
  229. }else{
  230. if($("#communityId_update").combobox("getValue")==$("#communityId_update").combobox("getText")){
  231. $.messager.alert("提示","小区不存在!请先维护小区信息!");
  232. }else{
  233. $("#communityName_update").val($("#communityId_update").combobox("getText"));
  234. $('#updateHouseForm').form('submit',
  235. {
  236. url : whzl.basePath+'/houseAction_updateHouse',
  237. success : function(result){
  238. var parseResult = $.parseJSON(result);
  239. if(parseResult.success){
  240. $('#houseDataGrid').datagrid('reload');
  241. $("#updateHouseDialog").dialog("close");
  242. }else{
  243. $.messager.alert("提示",parseResult.message);
  244. }
  245. }
  246. }
  247. );
  248. }
  249. }
  250. }
  251. },
  252. {
  253. text : '取消',
  254. iconCls : 'icon-cancel',
  255. handler : function(){
  256. $("#updateHouseDialog").dialog("close");
  257. }
  258. }
  259. ],
  260. onLoad : function(){
  261. if(param == 'add'){
  262. $('#tabs_update').tabs('select', $('#tabs_update').tabs('getTabIndex', $('#tabs_update').tabs('getSelected')) + 1);
  263. }
  264. $("#type_update").append(type_array);
  265. $("#roomType_update").append(roomType_array);
  266. $("#isExistHouse_update").append(isExistHouse_array);
  267. $("#decorationState_update").append(decorationState_array);
  268. $.ajax({
  269. type: "post",//使用get方法访问后台
  270. dataType: "json",//返回json格式的数据
  271. url: "houseAction_findById",//要访问的后台地址
  272. data: "house.id="+id,//要发送的数据
  273. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  274. success: function(msg){//msg为返回的数据,在这里做数据绑定
  275. $("#id_update").val(msg.obj.id);
  276. $("#qx_update").combobox("setValue",msg.obj.community.area);
  277. $("#communityId_update").combobox("setValue",msg.obj.community.id);
  278. $("#communityId_update").combobox("setText",msg.obj.communityName);
  279. $("#communityName_update").val(msg.obj.communityName);
  280. $("#area_update").val(msg.obj.area);
  281. $("#no_update").val(msg.obj.no);
  282. $("#unit_update").val(msg.obj.unit);
  283. $("#houseNumber_update").val(msg.obj.houseNumber);
  284. $("#guaranteeYear_update").numberbox('setValue', msg.obj.guaranteeYear);
  285. $("#deliveryDate_update").datebox("setValue", msg.obj.deliveryDate);
  286. $("#roomType_update").val(msg.obj.roomType);
  287. $("#type_update").val(msg.obj.type);
  288. $("#garageArea_update").val(msg.obj.garageArea);
  289. $("#developerDeadline_update").datebox('setValue', msg.obj.developerDeadline);
  290. //备注
  291. $("#remark_update").val(msg.obj.remark);
  292. $("#isExistHouse_update").val(msg.obj.isExistHouse);
  293. $("#waterCardNum_update").val(msg.obj.waterCardNum);
  294. $("#waterBase_update").val(msg.obj.waterBase);
  295. $("#electricCardNum_update").val(msg.obj.electricCardNum);
  296. $("#electricBase_update").val(msg.obj.electricBase);
  297. $("#gasCardNum_update").val(msg.obj.gasCardNum);
  298. $("#gasBase_update").val(msg.obj.gasBase);
  299. $("#initialPlacementTime_update").datebox('setValue', msg.obj.initialPlacementTime);
  300. $("#status_update").val(msg.obj.status);
  301. $("#houseState_update").val(msg.obj.houseState);
  302. $("#marketRent_update").val(msg.obj.marketRent);
  303. $("#price_update").val(msg.obj.price);
  304. $("#priceTotal_update").val(msg.obj.priceTotal);
  305. $("#housePrice_update").val(msg.obj.housePrice);
  306. $("#garagePrice_update").val(msg.obj.garagePrice);
  307. $("#certificateNumber1_update").val(msg.obj.certificateNumber1);
  308. $("#certificateNumber2_update").val(msg.obj.certificateNumber2);
  309. $("#decorationState_update").val(msg.obj.decorationState);
  310. for(var i=0;i< msg.obj.deliveryFile.length;i++){
  311. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.deliveryFile[i].filePath+" download="+msg.obj.deliveryFile[i].fileName+">"+msg.obj.deliveryFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.deliveryFile[i].id + "' onclick='removeImg(" + msg.obj.deliveryFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  312. $("#deliveryFile_update_file").append ($file);
  313. }
  314. for(var i=0;i< msg.obj.recordFile.length;i++){
  315. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.recordFile[i].filePath+" download="+msg.obj.recordFile[i].fileName+">"+msg.obj.recordFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.recordFile[i].id + "' onclick='removeImg(" + msg.obj.recordFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  316. $("#recordFile_update_file").append ($file);
  317. }
  318. for(var i=0;i< msg.obj.purchaseFile.length;i++){
  319. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.purchaseFile[i].filePath+" download="+msg.obj.purchaseFile[i].fileName+">"+msg.obj.purchaseFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.purchaseFile[i].id + "' onclick='removeImg(" + msg.obj.purchaseFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  320. $("#purchaseFile_update_file").append ($file);
  321. }
  322. $("#deliveryFile_update").change(
  323. function(){
  324. $('#updateHouseForm').form('submit',{
  325. url : whzl.basePath+'/houseAction_addUploadFile',
  326. success: function(result){
  327. $("#deliveryFile_update").attr("value","");
  328. $.ajax({
  329. type: "post",//使用get方法访问后台
  330. dataType: "json",//返回json格式的数据
  331. url: "houseAction_findById",//要访问的后台地址
  332. data: "house.id="+id,//要发送的数据
  333. success: function(msg){
  334. $("#deliveryFile_update_file").children('div').remove();
  335. for(var i=0;i< msg.obj.deliveryFile.length;i++){
  336. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.deliveryFile[i].filePath+" download="+msg.obj.deliveryFile[i].fileName+">"+msg.obj.deliveryFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.deliveryFile[i].id + "' onclick='removeImg(" + msg.obj.deliveryFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  337. $("#deliveryFile_update_file").append ($file);
  338. }
  339. }
  340. });
  341. }
  342. }
  343. );
  344. });
  345. $("#recordFile_update").change(
  346. function(){
  347. $('#updateHouseForm').form('submit',{
  348. url : whzl.basePath+'/houseAction_addUploadFile',
  349. success: function(result){
  350. $("#recordFile_update").attr("value","");
  351. $.ajax({
  352. type: "post",//使用get方法访问后台
  353. dataType: "json",//返回json格式的数据
  354. url: "houseAction_findById",//要访问的后台地址
  355. data: "house.id="+id,//要发送的数据
  356. success: function(msg){
  357. $("#recordFile_update_file").children('div').remove();
  358. for(var i=0;i< msg.obj.recordFile.length;i++){
  359. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.recordFile[i].filePath+" download="+msg.obj.recordFile[i].fileName+">"+msg.obj.recordFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.recordFile[i].id + "' onclick='removeImg(" + msg.obj.recordFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  360. $("#recordFile_update_file").append ($file);
  361. }
  362. }
  363. });
  364. }
  365. }
  366. );
  367. });
  368. $("#purchaseFile_update").change(
  369. function(){
  370. $('#updateHouseForm').form('submit',{
  371. url : whzl.basePath+'/houseAction_addUploadFile',
  372. success: function(result){
  373. $("#recordFile_update").attr("value","");
  374. $.ajax({
  375. type: "post",//使用get方法访问后台
  376. dataType: "json",//返回json格式的数据
  377. url: "houseAction_findById",//要访问的后台地址
  378. data: "house.id="+id,//要发送的数据
  379. success: function(msg){
  380. $("#purchaseFile_update_file").children('div').remove();
  381. for(var i=0;i< msg.obj.purchaseFile.length;i++){
  382. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.purchaseFile[i].filePath+" download="+msg.obj.purchaseFile[i].fileName+">"+msg.obj.purchaseFile[i].fileName+"</a><img src='images/de.png' id='img" + msg.obj.purchaseFile[i].id + "' onclick='removeImg(" + msg.obj.purchaseFile[i].id + ")' width='15' height='15' style='position: relative;right: 2px; cursor:pointer;'><div>");
  383. $("#purchaseFile_update_file").append ($file);
  384. }
  385. }
  386. });
  387. }
  388. }
  389. );
  390. });
  391. }
  392. });
  393. }
  394. }
  395. );
  396. }else{
  397. $.messager.alert('提示','请选择一条房源信息');
  398. }
  399. }
  400. /**删除*/
  401. var delFormatter = function(value , row , index){
  402. if(row.houseState == 1 && row.decorationState == 1){
  403. return "<img src='<%=basePath%>/images/edit_remove.png' title='删除' onclick=deleteRow(" + row.id + ") style='cursor:pointer' />";
  404. }
  405. };
  406. /**删除功能*/
  407. function deleteRow(id){
  408. var selectedItems = $('#houseDataGrid').datagrid('getSelections');
  409. if(selectedItems.length==1){
  410. var id=selectedItems[0].id;
  411. var houseState=selectedItems[0].houseState
  412. var decorationState=selectedItems[0].decorationState
  413. if(houseState == 1 && decorationState == 1){
  414. $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
  415. if (r){
  416. $.ajax({
  417. type: "post",//使用get方法访问后台
  418. dataType: "json",//返回json格式的数据
  419. url: "houseAction_deleteHouse",//要访问的后台地址
  420. data: "house.id="+id,//要发送的数据
  421. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  422. success: function(msg){//msg为返回的数据,在这里做数据绑定
  423. if(msg.success){
  424. $.messager.alert('提示','删除成功!');
  425. //$('#houseDataGrid').datagrid('reload');
  426. searchFun();
  427. }else{
  428. $.messager.alert('提示','删除失败!');
  429. }
  430. }
  431. });
  432. }
  433. });
  434. }else{
  435. $.messager.alert('提示','当前房源不可删除');
  436. }
  437. }else{
  438. $.messager.alert('提示','请选择一条房源信息');
  439. }
  440. }
  441. /**增加小区*/
  442. function houseAdd(){
  443. $('#addHouseDialog').dialog(
  444. {
  445. buttons : [
  446. {
  447. text : '确定',
  448. iconCls : 'icon-ok',
  449. handler : function(){
  450. if($("#communityId_add").combobox("getValue") == ''){
  451. $.messager.alert("提示","请选择小区信息!");
  452. }else{
  453. if($("#communityId_add").combobox("getValue")==$("#communityId_add").combobox("getText")){
  454. $.messager.alert("提示","小区不存在!请先维护小区信息!");
  455. }else{
  456. $("#communityName_add").val($("#communityId_add").combobox("getText"));
  457. parent.$.messager.progress({
  458. title : '提示',
  459. text : '保存中,请稍后....'
  460. });
  461. $('#addHouseForm').form('submit',
  462. {
  463. url : whzl.basePath+'/houseAction_addHouse',
  464. onSubmit: function(){
  465. var isValid =$('#addHouseForm').form('validate');
  466. if(isValid == false){
  467. parent.$.messager.progress('close');
  468. }
  469. return isValid;
  470. },
  471. success : function(result){
  472. parent.$.messager.progress('close');
  473. var parseResult = $.parseJSON(result);
  474. if(parseResult.success){
  475. $("#addHouseDialog").dialog("close");
  476. searchFun();
  477. var id = parseResult.obj.id;
  478. //updateRow(id,'add');
  479. }else{
  480. $.messager.alert("提示",parseResult.message);
  481. }
  482. }
  483. }
  484. );
  485. }
  486. }
  487. }
  488. },
  489. {
  490. text : '取消',
  491. iconCls : 'icon-cancel',
  492. handler : function(){
  493. $("#addHouseDialog").dialog("close");
  494. }
  495. }
  496. ],
  497. onLoad : function(){
  498. $("#roomType_add").append(roomType_array);
  499. $("#type_add").append(type_array);
  500. $("#isExistHouse_add").append(isExistHouse_array);
  501. }
  502. }
  503. );
  504. }
  505. /**增加小区*/
  506. function houseImport(){
  507. $('#importHouseDialog').dialog(
  508. {
  509. buttons : [
  510. {
  511. text : '确定',
  512. iconCls : 'icon-ok',
  513. handler : function(){
  514. $("#importHouseDialog").dialog("close");
  515. }
  516. },
  517. {
  518. text : '取消',
  519. iconCls : 'icon-cancel',
  520. handler : function(){
  521. $("#importHouseDialog").dialog("close");
  522. }
  523. }
  524. ]
  525. }
  526. );
  527. }
  528. /**上传文件*/
  529. function formSubmit(){
  530. var upload = $("#upload").val();
  531. if(upload == null || upload == ''){
  532. $.messager.alert("系统提示","请选择文件上传!","error");
  533. }else{
  534. parent.$.messager.progress({
  535. title : '提示',
  536. text : '上传数据中,请稍候....'
  537. });
  538. $('#importHouseForm').form('submit',
  539. {
  540. url : whzl.basePath+"/houseAction_uploadExcel",//要访问的后台地址
  541. success : function(result){
  542. parent.$.messager.progress('close');
  543. result = $.parseJSON(result);
  544. if(result.success){
  545. $("#message").text(result.message);
  546. $("#errorShowList").hide();
  547. $("#exportBtn").hide();
  548. }else{
  549. $("#message").text(result.message + "一共存在" + result.obj.length + "错误。");
  550. $("#errorShowList").show();
  551. $("#exportBtn").show();
  552. var error = "";//全部错误信息
  553. var errorShow = "";//只显示前6条错误信息
  554. for(var i = 0; i < result.obj.length; i++){
  555. error += (i+1) + "、" + result.obj[i] + "\r\n";
  556. if(i < 6){
  557. errorShow += "<p>" + (i+1) + "、" + result.obj[i] + "</p>";
  558. }
  559. }
  560. $("#errorShowList").html(errorShow);
  561. $("#errorList").html(error);
  562. $("#errorText").val(error);
  563. parent.$.messager.progress('close');
  564. }
  565. }
  566. }
  567. );
  568. }
  569. }
  570. function exportErrorMsg(){
  571. //var error = $("#errorList").html();
  572. //window.location.href = whzl.basePath+"/houseAction_exportTXT.do?error=" + error;
  573. $('#errorForm').form('submit',
  574. {
  575. url : whzl.basePath+"/houseAction_exportTXT"//要访问的后台地址
  576. }
  577. );
  578. }
  579. /**查询小区*/
  580. function communityQuery(){
  581. $('#communityDialog').dialog(
  582. {
  583. buttons : [
  584. {
  585. text : '提交',
  586. iconCls : 'icon-ok',
  587. handler : function(){
  588. var checkedItems = $('#communityDataGrid').datagrid('getChecked');
  589. if(checkedItems.length==0){
  590. $.messager.alert("提示","至少选择一条 的数据");
  591. }else{
  592. $.each(checkedItems, function(index, item){
  593. $("#add_communityName").val(item.name);
  594. });
  595. $("#communityDialog").dialog("close");
  596. }
  597. }
  598. },
  599. {
  600. text : '取消',
  601. iconCls : 'icon-cancel',
  602. handler : function(){
  603. $("#communityDialog").dialog("close");
  604. }
  605. }
  606. ]
  607. }
  608. );
  609. }
  610. function houseExport(){
  611. var params = encodeURI("house.communityName="+trim($('#communityId').combobox("getText"))+
  612. "&house.community.id="+trim($('#communityId').combobox("getValue"))+
  613. "&house.no="+trim($('#no').combobox("getValue")) +
  614. "&house.houseNumber="+trim($('#houseNumber').combobox("getValue"))+
  615. "&house.roomType="+trim($('#roomType').val())+
  616. "&house.deliveryDate="+$('#deliveryDate').datebox('getValue')
  617. );
  618. window.location.href = whzl.basePath+"/houseAction_export?"+params;
  619. }
  620. /**汇总导出*/
  621. function houseSummaryExport(){
  622. window.location.href = whzl.basePath+"/houseAction_houseSummaryExport";
  623. }
  624. //删除图片
  625. var removeImg = function(id){
  626. $.messager.confirm('提示', '确定删除么?删除后将无法恢复', function(r){
  627. if (r){
  628. $("#img" + id).parent().remove();
  629. $.ajax({
  630. type: "post",//使用post方法访问后台
  631. dataType: "json",//返回json格式的数据
  632. url:whzl.basePath + "/uploadFileAction_deleteUploadFile",
  633. data:{
  634. "uploadFile.id":id
  635. },
  636. error: function(msg){//msg为返回的数据,在这里做数据绑定
  637. $.messager.alert("提示","删除失败!");
  638. }
  639. });
  640. }
  641. });
  642. }
  643. /**户型*/
  644. var roomTypeFormatter = function(value , row , index){
  645. var roomType = "";
  646. for(var nItem = 0; nItem < roomTypeObj.length; nItem++ ){
  647. if(roomTypeObj[nItem].code == value){
  648. roomType = roomTypeObj[nItem].value;
  649. break;
  650. }
  651. }
  652. return roomType;
  653. };
  654. /**装修状态*/
  655. var decorationStateFormatter = function(value , row , index){
  656. var decorationState = "";
  657. for(var nItem = 0; nItem < decorationStateObj.length; nItem++ ){
  658. if(decorationStateObj[nItem].code == value){
  659. decorationState = decorationStateObj[nItem].value;
  660. break;
  661. }
  662. }
  663. return decorationState;
  664. };
  665. /**房源状态*/
  666. var houseStateFormatter = function(value , row , index){
  667. var houseState = "";
  668. for(var nItem = 0; nItem < houseStateObj.length; nItem++ ){
  669. if(houseStateObj[nItem].code == value){
  670. houseState = houseStateObj[nItem].value;
  671. break;
  672. }
  673. }
  674. return houseState;
  675. };
  676. function onSelect(date){
  677. $("#developerDeadline_add").datebox('setValue', date.getFullYear() + 2 + "-" +(date.getMonth()+1)+"-"+date.getDate());
  678. }
  679. function onSelectUpdate(date){
  680. $("#developerDeadline_update").datebox('setValue', date.getFullYear() + 2 + "-" +(date.getMonth()+1)+"-"+date.getDate());
  681. }
  682. /**批量上传*/
  683. function uploadFile(){
  684. var selectedItems = $('#houseDataGrid').datagrid('getSelections');
  685. var ids = [];
  686. $.each(selectedItems,function(index,item){
  687. ids.push(item.id);
  688. })
  689. if(ids.length==0){
  690. $.messager.alert("警告","请选择至少一条记录!");
  691. return;
  692. }
  693. var idsStr = ids.join(",");
  694. $('#uploadHouseDialog').dialog(
  695. {
  696. buttons : [
  697. {
  698. text : '确定',
  699. iconCls : 'icon-ok',
  700. handler : function(){
  701. $("#uploadHouseDialog").dialog("close");
  702. }
  703. }
  704. ],
  705. onLoad : function(){
  706. $("#house_upload").val(idsStr);
  707. $("#deliveryFile_upload").change(
  708. function(){
  709. var obj = document.getElementById('deliveryFile_upload');
  710. if(imageFormat(obj)){
  711. $('#uploadHouseForm').form('submit',{
  712. url : whzl.basePath+'/houseAction_uploadFiles',
  713. success: function(result){
  714. $("#deliveryFile_upload").attr("value","");
  715. $.ajax({
  716. type: "post",//使用get方法访问后台
  717. dataType: "json",//返回json格式的数据
  718. url: "houseAction_findById",//要访问的后台地址
  719. data: "house.id="+ids[0],//要发送的数据
  720. success: function(msg){
  721. $("#deliveryFile_upload_file").children('div').remove();
  722. for(var i=0;i< msg.obj.deliveryFile.length;i++){
  723. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.deliveryFile[i].filePath+" download="+msg.obj.deliveryFile[i].fileName+">"+msg.obj.deliveryFile[i].fileName+"</a><div>");
  724. $("#deliveryFile_upload_file").append ($file);
  725. }
  726. }
  727. });
  728. }
  729. });
  730. };
  731. });
  732. $("#recordFile_upload").change(
  733. function(){
  734. var obj = document.getElementById('recordFile_upload');
  735. if(imageFormat(obj)){
  736. $('#uploadHouseForm').form('submit',{
  737. url : whzl.basePath+'/houseAction_uploadFiles',
  738. success: function(result){
  739. $("#recordFile_upload").attr("value","");
  740. $.ajax({
  741. type: "post",//使用get方法访问后台
  742. dataType: "json",//返回json格式的数据
  743. url: "houseAction_findById",//要访问的后台地址
  744. data: "house.id="+ids[0],//要发送的数据
  745. success: function(msg){
  746. $("#recordFile_upload_file").children('div').remove();
  747. for(var i=0;i< msg.obj.recordFile.length;i++){
  748. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.recordFile[i].filePath+" download="+msg.obj.recordFile[i].fileName+">"+msg.obj.recordFile[i].fileName+"</a><div>");
  749. $("#recordFile_upload_file").append ($file);
  750. }
  751. }
  752. });
  753. }
  754. });
  755. }
  756. });
  757. $("#purchaseFile_upload").change(
  758. function(){
  759. var obj = document.getElementById('purchaseFile_upload');
  760. if(imageFormat(obj)){
  761. $('#uploadHouseForm').form('submit',{
  762. url : whzl.basePath+'/houseAction_uploadFiles',
  763. success: function(result){
  764. $("#recordFile_upload").attr("value","");
  765. $.ajax({
  766. type: "post",//使用get方法访问后台
  767. dataType: "json",//返回json格式的数据
  768. url: "houseAction_findById",//要访问的后台地址
  769. data: "house.id="+ids[0],//要发送的数据
  770. success: function(msg){
  771. $("#purchaseFile_upload_file").children('div').remove();
  772. for(var i=0;i< msg.obj.purchaseFile.length;i++){
  773. var $file = $("<div style='display: inline-block;'><a style='padding-right:10px;' href=<%=basePath %>/"+msg.obj.purchaseFile[i].filePath+" download="+msg.obj.purchaseFile[i].fileName+">"+msg.obj.purchaseFile[i].fileName+"</a><div>");
  774. $("#purchaseFile_upload_file").append ($file);
  775. }
  776. }
  777. });
  778. }
  779. });
  780. }
  781. });
  782. }
  783. }
  784. );
  785. }
  786. function imageFormat(obj){
  787. var files = obj.files;
  788. for(var i=0;i<files.length;i++){
  789. /**判断图片格式*/
  790. if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(files[i].name)){
  791. $.messager.alert('提示','图片类型必须是.gif,jpeg,jpg,png中的一种');
  792. return false;
  793. }
  794. /**判断图片大小*/
  795. if(files[i].size>1000*1024){
  796. $.messager.alert('提示','单张图片不得大于10M。');
  797. return false;
  798. }
  799. }
  800. return true;
  801. }
  802. var initialPlacementTimeFormatter = function(value , row , index){
  803. return dealDate(value);
  804. }
  805. var checkOutFormatter = function(value , row , index){
  806. if(row.houseState == "5"){
  807. return "<img src='<%=basePath%>/images/update.png' title='退房' onclick=checkOutRow(" + row.id+",'"+row.address + "') style='cursor:pointer' />";
  808. }else{
  809. return "";
  810. }
  811. }
  812. function checkOutRow(id,address){
  813. $.messager.prompt('退房', '确定将'+address+'房源退房吗?请填写原因', function(r){
  814. if (r){
  815. $.ajax({
  816. type: "post",//使用get方法访问后台
  817. dataType: "json",//返回json格式的数据
  818. url: "houseAction_checkOutHouse",//要访问的后台地址
  819. data: "house.id="+id+"&house.checkOutRemark="+r,//要发送的数据
  820. success: function(msg){
  821. $('#houseDataGrid').datagrid('reload');
  822. }
  823. });
  824. }
  825. })
  826. };
  827. </script>
  828. <div class="easyui-layout" data-options="fit:true,border:false">
  829. <div data-options="region:'center',border:false">
  830. <div id="searchtool" data-options="region:'north',border:false">
  831. <div class="clear"></div>
  832. <table id="tblQuery" style="width:100%;font-size:12px;">
  833. <tr>
  834. <td align="right" width="100px"><span>小区名称</span></td>
  835. <td colspan="5" width="500px">
  836. <select id="area" style="width:100px;">
  837. <option value="">全部</option>
  838. </select>
  839. <input id="communityId">
  840. <input id="no" style="width: 60px;">幢
  841. <input id="houseNumber" style="width: 80px;">室
  842. </td>
  843. <td align="left">
  844. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  845. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
  846. <a href="javascript:houseImport();" class="easyui-linkbutton" data-options="iconCls:'icon-import',plain:true">导入</a>
  847. <a href="javascript:houseExport();" class="easyui-linkbutton" data-options="iconCls:'icon-export',plain:true">导出</a>
  848. <a href="javascript:houseSummaryExport();" class="easyui-linkbutton" data-options="iconCls:'icon-export',plain:true">汇总</a>
  849. </td>
  850. </tr>
  851. <tr>
  852. <td align="right"><span>户型</span></td>
  853. <td width="100px">
  854. <select id="roomType">
  855. <option value="">全部</option>
  856. </select>
  857. </td>
  858. <td align="right" width="50px"><span>交房日期</span></td>
  859. <td width="100px">
  860. <input class="easyui-datebox" id="deliveryDate" name="house.deliveryDate">
  861. </td>
  862. <td>房源状态</td>
  863. <td>
  864. <select id="houseState" name="house.houseState">
  865. <option value="">全部</option>
  866. <option value="5">已交付</option>
  867. <option value="6">未交付</option>
  868. <option value="11">人才公寓</option>
  869. </select>
  870. </td>
  871. <td>
  872. <a href="javascript:houseAdd();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">增加</a>
  873. <a href="javascript:updateRow();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
  874. <a href="javascript:deleteRow();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
  875. <a href="javascript:uploadFile();" class="easyui-linkbutton" data-options="iconCls:'icon-batch',plain:true">批量上传附件</a>
  876. </td>
  877. </tr>
  878. </table>
  879. <div class="clear"></div>
  880. </div>
  881. <table id="houseDataGrid">
  882. <thead frozen="true">
  883. <tr>
  884. <th data-options="field:'id',checkbox:true,width:30">ID</th>
  885. <th data-options="field:'communityName',sortable:true,width:100">小区名称</th>
  886. </tr>
  887. </thead>
  888. <thead>
  889. <tr>
  890. <th data-options="field:'address',width:200">居住地点</th>
  891. <th data-options="field:'houseNumber',width:60">房号</th>
  892. <th data-options="field:'area',width:60">面积</th>
  893. <th data-options="field:'garageArea',width:60">车库面积</th>
  894. <th data-options="field:'roomType',width:60,formatter:roomTypeFormatter">户型</th>
  895. <th data-options="field:'initialPlacementTime',width:80,formatter:initialPlacementTimeFormatter">初始安置时间</th>
  896. <th data-options="field:'decorationState',width:60,formatter:decorationStateFormatter">装修状态</th>
  897. <th data-options="field:'houseState',width:80,formatter:houseStateFormatter">房源状态</th>
  898. <th data-options="field:'details',align:'center',width:60,formatter:detailsFormatter">查看详情</th>
  899. <!-- <th data-options="field:'update',align:'center',width:38,formatter:updateFormatter">修改</th>
  900. <th data-options="field:'delete',align:'center',width:38,formatter:delFormatter">删除</th>-->
  901. <th data-options="field:'checkOut',align:'center',width:38,formatter:checkOutFormatter">退房</th>
  902. </tr>
  903. </thead>
  904. </table>
  905. </div>
  906. </div>
  907. <div id="detailHouseDialog" data-options="title:'&nbsp;户型详细信息',iconCls:'icon-details',width:700,height:400,modal:true,href:'<%=basePath %>/houseAction_toDetail'">
  908. </div>
  909. <div id="updateHouseDialog" data-options="title:'&nbsp;修改户型信息',iconCls:'icon-edit',width:700,height:400,modal:true,href:'<%=basePath %>/houseAction_toUpdate'">
  910. </div>
  911. <div id="addHouseDialog" data-options="title:'&nbsp;增加户型信息',iconCls:'icon-add',width:700,height:400,modal:true,href:'<%=basePath %>/houseAction_toAdd'">
  912. </div>
  913. <div id="communityDialog" data-options="title:'&nbsp;选择户型信息',iconCls:'icon-query',width:700,height:400,modal:true,href:'<%=basePath%>/houseAction_toListQuery.do'">
  914. </div>
  915. <div id="importHouseDialog" data-options="title:'&nbsp;导入户型信息',iconCls:'icon-add',width:700,height:350,modal:true,href:'<%=basePath %>/houseAction_toImport'">
  916. </div>
  917. <div id="uploadHouseDialog" data-options="title:'&nbsp;房源附件批量上传',iconCls:'icon-add',width:700,height:350,modal:true,href:'<%=basePath %>/houseAction_toUpload'">
  918. </div>
  919. <div id="detailDialog"></div>
  920. <div id="setHouseDialog" data-options="title:'&nbsp;个性化设置',iconCls:'icon-cog',width:500,height:370,modal:true,href:'<%=basePath %>/columnSetAction_toSet?tname=house'">
  921. </div>
  922. <script type="text/javascript">
  923. <!--
  924. $(function(){
  925. parent.$.messager.progress('close');
  926. $('#area').combobox({
  927. url: whzl.basePath + '/houseRegisterAction_listChildrenCombobox',
  928. valueField:'value',
  929. textField:'text',
  930. onChange:function (newValue,oldValue) {
  931. $('#communityId').combobox("setValue","");
  932. $('#no').combobox("setValue","");
  933. $('#houseNumber').combobox("setValue","");
  934. $('#communityId').combobox('reload',whzl.basePath + '/communityAction_findAll?community.area='+newValue);
  935. }
  936. });
  937. $('#communityId').combobox({
  938. url: whzl.basePath + '/communityAction_findAll',
  939. valueField:'value',
  940. textField:'text',
  941. filter:function(q,row){
  942. var opts=$(this).combobox("options");
  943. //return row[opts.textField].indexOf(q)==0;//
  944. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  945. },
  946. onChange:function (newValue,oldValue) {
  947. $('#no').combobox("setValue","");
  948. $('#houseNumber').combobox("setValue","");
  949. $('#no').combobox('reload',whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"));
  950. }
  951. });
  952. $('#no').combobox({
  953. //editable:false,
  954. url: whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"),
  955. valueField:'value',
  956. textField:'text',
  957. filter:function(q,row){
  958. var opts=$(this).combobox("options");
  959. //return row[opts.textField].indexOf(q)==0;//
  960. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  961. },
  962. onChange:function (newValue,oldValue) {
  963. $('#houseNumber').combobox("setValue","");
  964. $('#houseNumber').combobox('reload',whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+newValue);
  965. }
  966. });
  967. $('#houseNumber').combobox({
  968. //editable:false,
  969. url: whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+$('#no').combobox("getValue"),
  970. valueField:'value',
  971. textField:'text',
  972. filter:function(q,row){
  973. var opts=$(this).combobox("options");
  974. //return row[opts.textField].indexOf(q)==0;//
  975. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  976. }
  977. });
  978. });
  979. //-->
  980. </script>