mrzcc
2020-03-06 ecdac8a738f254db2b2ea28cbe3248f7a6a7eb2b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
    入驻小区
**/
(function(vc){
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROW = 10;
    vc.extends({
        data:{
            roomUnits:[],
            roomCreateFeeInfo:{
                rooms:[],
                total:0,
                records:1,
                floorId:'',
                unitId:'',
                state:'',
                roomNum:'',
                moreCondition:false,
                conditions:{
                    floorId:'',
                    floorName:'',
                    unitId:'',
                    roomNum:'',
                    roomId:'',
                    state:'',
                    section:''
                }
            }
        },
        _initMethod:function(){
            vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
            vc.component.roomCreateFeeInfo.conditions.floorName = vc.getParam("floorName");
            vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
        },
        _initEvent:function(){
            vc.on('room','chooseFloor',function(_param){
                vc.component.roomCreateFeeInfo.conditions.floorId = _param.floorId;
                vc.component.roomCreateFeeInfo.conditions.floorName = _param.floorName;
                vc.component.loadUnits(_param.floorId);
 
            });
            vc.on('pagination','page_event',function(_currentPage){
                vc.component.listRoom(_currentPage,DEFAULT_ROW);
            });
        },
        methods:{
 
            listRoom:function(_page,_row){
 
                vc.component.roomCreateFeeInfo.conditions.page=_page;
                vc.component.roomCreateFeeInfo.conditions.row=_row;
                vc.component.roomCreateFeeInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params:vc.component.roomCreateFeeInfo.conditions
                };
 
               //发送get请求
               vc.http.get('roomCreateFee',
                            'listRoom',
                             param,
                             function(json,res){
                                var listRoomData =JSON.parse(json);
 
                                vc.component.roomCreateFeeInfo.total = listRoomData.total;
                                vc.component.roomCreateFeeInfo.records = listRoomData.records;
                                vc.component.roomCreateFeeInfo.rooms = listRoomData.rooms;
 
                                vc.emit('pagination','init',{
                                    total:vc.component.roomCreateFeeInfo.records,
                                    dataCount: vc.component.roomCreateFeeInfo.total,
                                    currentPage:_page
                                });
                             },function(errInfo,error){
                                console.log('请求失败处理');
                             }
                           );
            },
            _openRoomCreateFeeAddModal:function(_room,_isMore){
                vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',{
                    isMore:_isMore,
                    room:_room
                });
            },
            _openViewRoomCreateFee:function(_room){
                 vc.jumpToPage("/flow/listRoomFeeFlow?"+vc.objToGetParam(_room));
            },
            /**
                根据楼ID加载房屋
            **/
            loadUnits:function(_floorId){
                vc.component.addRoomUnits = [];
                var param = {
                    params:{
                        floorId:_floorId,
                        communityId:vc.getCurrentCommunity().communityId
                    }
                }
                vc.http.get(
                    'roomCreateFee',
                    'loadUnits',
                     param,
                     function(json,res){
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        if(res.status == 200){
                            var tmpUnits = JSON.parse(json);
                            vc.component.roomUnits = tmpUnits;
 
                            return ;
                        }
                        vc.message(json);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');
 
                        vc.message(errInfo);
                     });
            },
            _queryRoomMethod:function(){
                vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
            },
            _loadDataByParam: function(){
                vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
                vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorName");
                //如果 floodId 没有传 则,直接结束
               /* if(!vc.notNull(vc.component.roomCreateFeeInfo.conditions.floorId)){
                    return ;
                }*/
 
                var param = {
                    params:{
                        communityId:vc.getCurrentCommunity().communityId,
                        floorId:vc.component.roomCreateFeeInfo.conditions.floorId
                    }
                }
 
                vc.http.get(
                    'roomCreateFee',
                    'loadFloor',
                     param,
                     function(json,res){
                        if(res.status == 200){
                            var _floorInfo = JSON.parse(json);
                            var _tmpFloor = _floorInfo.apiFloorDataVoList[0];
                            /*vc.emit('roomSelectFloor','chooseFloor', _tmpFloor);
                            */
 
                            return ;
                        }
                        vc.message(json);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');
 
                        vc.message(errInfo);
                     });
 
            },
            _moreCondition:function(){
                if(vc.component.roomCreateFeeInfo.moreCondition){
                    vc.component.roomCreateFeeInfo.moreCondition = false;
                }else{
                    vc.component.roomCreateFeeInfo.moreCondition = true;
                }
            },
            _openChooseFloorMethod:function(){
                vc.emit('searchFloor','openSearchFloorModel',{});
            }
        }
    });
})(window.vc);