Explorar el Código

优化 房屋管理页面

wuxw hace 7 años
padre
commit
1f1a22b8c4

+ 1 - 1
Api/src/main/java/com/java110/api/listener/room/QueryRoomsListener.java

@@ -81,7 +81,7 @@ public class QueryRoomsListener extends AbstractServiceApiDataFlowListener {
      */
     private void validateRoomData(JSONObject reqJson) {
         Assert.jsonObjectHaveKey(reqJson, "communityId", "请求中未包含communityId信息");
-        Assert.jsonObjectHaveKey(reqJson, "floorId", "请求中未包含communityId信息");
+        //Assert.jsonObjectHaveKey(reqJson, "floorId", "请求中未包含floorId信息");
         Assert.jsonObjectHaveKey(reqJson, "page", "请求报文中未包含page节点");
         Assert.jsonObjectHaveKey(reqJson, "row", "请求报文中未包含row节点");
 

+ 28 - 19
WebService/src/main/resources/components/roomPackage/room-manage/room.html

@@ -20,7 +20,7 @@
                         <div class="col-sm-4">
                             <div class="form-group input-group">
                                 <input type="text" placeholder="请选择楼栋"
-                                       v-model="unitInfo.conditions.floorName" class=" form-control">
+                                       v-model="roomInfo.conditions.floorName" class=" form-control">
                                 <div class="input-group-prepend">
                                     <button type="button" class="btn btn-primary btn-sm"
                                             v-on:click="_openChooseFloorMethod()"><i
@@ -32,42 +32,49 @@
                         </div>
                         <div class="col-sm-3">
                             <div class="form-group">
-                                <select class="form-control-sm form-control input-s-sm inline" v-model="roomInfo.unitId">
-                                    <option selected  value="">请选择单元</option>
-                                    <option v-for="(unit,index) in roomUnits" :key="index" v-bind:value="unit.unitId">{{unit.unitNum}}单元</option>
+                                <select class="form-control-sm form-control input-s-sm inline"
+                                        v-model="roomInfo.conditions.unitId">
+                                    <option selected value="">请选择单元</option>
+                                    <option v-for="(unit,index) in roomUnits" :key="index" v-bind:value="unit.unitId">
+                                        {{unit.unitNum}}单元
+                                    </option>
                                 </select>
                             </div>
                         </div>
                         <div class="col-sm-4">
                             <div class="form-group">
-                                <input type="text" placeholder="请填写房屋编号" class="form-control form-control-sm" v-model="roomInfo.roomNum">
+                                <input type="text" placeholder="请填写房屋编号" class="form-control form-control-sm"
+                                       v-model="roomInfo.conditions.roomNum">
                             </div>
                         </div>
                         <div class="col-sm-1">
-                            <button type="button" class="btn btn-primary btn-sm" v-on:click="_queryUnitMethod()"><i
+                            <button type="button" class="btn btn-primary btn-sm" v-on:click="_queryRoomMethod()"><i
                                     class="glyphicon glyphicon-search"></i> 查询
                             </button>
                         </div>
 
                     </div>
-                    <div class="row" v-if="unitInfo.moreCondition == true">
-                        <div class="col-sm-4" >
+                    <div class="row" v-if="roomInfo.moreCondition == true">
+                        <div class="col-sm-4">
                             <div class="form-group">
-                                <input type="text" placeholder="请填写房屋ID" class="form-control form-control-sm" v-model="roomInfo.roomId">
+                                <input type="text" placeholder="请填写房屋ID" class="form-control form-control-sm"
+                                       v-model="roomInfo.conditions.roomId">
                             </div>
                         </div>
-                        <div class="col-sm-3" >
-                            <select class="form-control-sm form-control input-s-sm inline" v-model="roomInfo.state">
-                                <option selected  value="">请选择状态</option>
+                        <div class="col-sm-3">
+                            <select class="form-control-sm form-control input-s-sm inline"
+                                    v-model="roomInfo.conditions.state">
+                                <option selected value="">请选择状态</option>
                                 <option value="2001">房屋已售</option>
                                 <option value="2002">房屋未售</option>
                                 <option value="2003">已交定金</option>
                                 <option value="2004">已出租</option>
                             </select>
                         </div>
-                        <div class="col-sm-4" >
+                        <div class="col-sm-4">
                             <div class="form-group">
-                                <input type="text" placeholder="请填写房屋房间数" class="form-control form-control-sm" v-model="roomInfo.roomNum">
+                                <input type="text" placeholder="请填写房屋房间数" class="form-control form-control-sm"
+                                       v-model="roomInfo.conditions.section">
                             </div>
                         </div>
                     </div>
@@ -84,7 +91,6 @@
                     <h5>房屋信息</h5>
                     <div class="ibox-tools" style="top:10px;">
                         <button type="button" class="btn btn-primary btn-sm"
-                                v-if="unitInfo.conditions.floorId != null && unitInfo.conditions.floorId != ''"
                                 style="margin-left:10px" v-on:click="_openAddRoom()">
                             <i class="glyphicon glyphicon-plus"></i> 添加房屋
                         </button>
@@ -92,7 +98,8 @@
                 </div>
                 <div class="ibox-content">
 
-                    <table class="footable table table-stripped toggle-arrow-tiny" style="margin-top:10px" data-page-size="10">
+                    <table class="footable table table-stripped toggle-arrow-tiny" style="margin-top:10px"
+                           data-page-size="10">
                         <thead>
                         <tr>
                             <th>房屋ID</th>
@@ -100,7 +107,7 @@
                             <th data-hide="phone">单元</th>
                             <th data-hide="phone">楼层</th>
                             <th data-hide="phone">房间数</th>
-                            <th data-hide="phone" >户型</th>
+                            <th data-hide="phone">户型</th>
                             <th data-hide="phone">建筑面积</th>
                             <th data-hide="phone">单价</th>
                             <th data-hide="phone">房屋状态</th>
@@ -143,10 +150,12 @@
                             </td>
                             <td class="text-right">
                                 <div class="btn-group">
-                                    <button class="btn-white btn btn-xs" v-on:click="_openEditRoomModel(room)">修改</button>
+                                    <button class="btn-white btn btn-xs" v-on:click="_openEditRoomModel(room)">修改
+                                    </button>
                                 </div>
                                 <div class="btn-group">
-                                    <button class="btn-white btn btn-xs" v-on:click="_openDelRoomModel(room)">删除</button>
+                                    <button class="btn-white btn btn-xs" v-on:click="_openDelRoomModel(room)">删除
+                                    </button>
                                 </div>
                             </td>
                         </tr>

+ 43 - 36
WebService/src/main/resources/components/roomPackage/room-manage/room.js

@@ -14,7 +14,17 @@
                 floorId:'',
                 unitId:'',
                 state:'',
-                roomNum:''
+                roomNum:'',
+                moreCondition:false,
+                conditions:{
+                    floorId:'',
+                    floorName:'',
+                    unitId:'',
+                    roomNum:'',
+                    roomId:'',
+                    state:'',
+                    section:''
+                }
             }
         },
         _initMethod:function(){
@@ -22,39 +32,33 @@
             vc.component._loadDataByParam();
         },
         _initEvent:function(){
+            vc.on('room','chooseFloor',function(_param){
+                vc.component.roomInfo.conditions.floorId = _param.floorId;
+                vc.component.roomInfo.conditions.floorName = _param.floorName;
+                vc.component.loadUnits(_param.floorId);
+
+            });
             vc.on('room','listRoom',function(_param){
-                  vc.component.listRoom();
+                  vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
             });
             vc.on('room','loadData',function(_param){
-                  vc.component._loadData(_param);
+                  vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
             });
             vc.on('pagination','page_event',function(_currentPage){
                 vc.component.listRoom(_currentPage,DEFAULT_ROW);
             });
         },
         methods:{
-            _loadData:function(_param){
-                    vc.component.roomInfo.floorId = _param.floorId;
-                    vc.component.roomInfo.unitId = '';
-                    vc.component.roomInfo.state = '';
-                    vc.component.roomInfo.roomNum = '';
 
-                    vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
-                    vc.component.loadUnits(_param.floorId);
-            },
             listRoom:function(_page,_row){
+
+                vc.component.roomInfo.conditions.page=_page;
+                vc.component.roomInfo.conditions.row=_row;
+                vc.component.roomInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                 var param = {
-                    params:{
-                        page:_page,
-                        row:_row,
-                        communityId:vc.getCurrentCommunity().communityId,
-                        floorId:vc.component.roomInfo.floorId,
-                        unitId:vc.component.roomInfo.unitId,
-                        state:vc.component.roomInfo.state,
-                        roomNum:vc.component.roomInfo.roomNum
+                    params:vc.component.roomInfo.conditions
+                };
 
-                    }
-                }
                //发送get请求
                vc.http.get('room',
                             'listRoom',
@@ -79,11 +83,11 @@
                 vc.jumpToPage("/flow/addRoomBindingFlow");
             },
             _openEditRoomModel:function(_room){
-                _room.floorId = vc.component.roomInfo.floorId;
+                _room.floorId = vc.component.roomInfo.conditions.floorId;
                 vc.emit('editRoom','openEditRoomModal',_room);
             },
             _openDelRoomModel:function(_room){
-                 _room.floorId = vc.component.roomInfo.floorId;
+                 _room.floorId = vc.component.roomInfo.conditions.floorId;
                  vc.emit('deleteRoom','openRoomModel',_room);
             },
             /**
@@ -106,12 +110,7 @@
                         if(res.status == 200){
                             var tmpUnits = JSON.parse(json);
                             vc.component.roomUnits = tmpUnits;
-                            /*if(tmpUnits == null || tmpUnits.length == 0){
-                                return ;
-                            }
-                            for(var unitIndex = 0; unitIndex < tmpUnits.length;unitIndex++){
-                               vc.component.addRoomInfo.units[unitIndex] = tmpUnits[unitIndex];
-                            }*/
+
                             return ;
                         }
                         vc.message(json);
@@ -122,7 +121,7 @@
                         vc.message(errInfo);
                      });
             },
-            queryRoomMethod:function(){
+            _queryRoomMethod:function(){
                 vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
             },
             showState:function(_state){
@@ -140,18 +139,16 @@
                 }
             },
             _loadDataByParam: function(){
-                vc.component.roomInfo.floorId = vc.getParam("floorId");
+                vc.component.roomInfo.conditions.floorId = vc.getParam("floorId");
                 //如果 floodId 没有传 则,直接结束
-                if(vc.component.roomInfo.floorId == null
-                    || vc.component.roomInfo.floorId == undefined
-                    || vc.component.roomInfo.floorId == ''){
+                /*if(!vc.notNull(vc.component.roomInfo.conditions.floorId)){
                     return ;
-                }
+                }*/
 
                 var param = {
                     params:{
                         communityId:vc.getCurrentCommunity().communityId,
-                        floorId:vc.component.roomInfo.floorId
+                        floorId:vc.component.roomInfo.conditions.floorId
                     }
                 }
 
@@ -177,6 +174,16 @@
                         vc.message(errInfo);
                      });
 
+            },
+            _moreCondition:function(){
+                if(vc.component.roomInfo.moreCondition){
+                    vc.component.roomInfo.moreCondition = false;
+                }else{
+                    vc.component.roomInfo.moreCondition = true;
+                }
+            },
+            _openChooseFloorMethod:function(){
+                vc.emit('searchFloor','openSearchFloorModel',{});
             }
         }
     });