wuxw
2020-02-02 f8c1cc75508aeca2da8385f41474d7704ecf16ac
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:{
            parkingSpaceUnits:[],
            parkingSpaceCreateFeeInfo:{
                parkingSpaces:[],
                total:0,
                records:1,
                floorId:'',
                unitId:'',
                state:'',
                parkingSpaceNum:'',
                moreCondition:false,
                conditions:{
                    floorId:'',
                    floorName:'',
                    unitId:'',
                    parkingSpaceNum:'',
                    psId:'',
                    state:'',
                    section:''
                }
            }
        },
        _initMethod:function(){
            vc.component.parkingSpaceCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
            vc.component.parkingSpaceCreateFeeInfo.conditions.floorName = vc.getParam("floorName");
            vc.component.listParkingSpace(DEFAULT_PAGE,DEFAULT_ROW);
        },
        _initEvent:function(){
            vc.on('parkingSpace','chooseFloor',function(_param){
                vc.component.parkingSpaceCreateFeeInfo.conditions.floorId = _param.floorId;
                vc.component.parkingSpaceCreateFeeInfo.conditions.floorName = _param.floorName;
                vc.component.loadUnits(_param.floorId);
 
            });
            vc.on('pagination','page_event',function(_currentPage){
                vc.component.listParkingSpace(_currentPage,DEFAULT_ROW);
            });
        },
        methods:{
 
            listParkingSpace:function(_page,_row){
 
                vc.component.parkingSpaceCreateFeeInfo.conditions.page=_page;
                vc.component.parkingSpaceCreateFeeInfo.conditions.row=_row;
                vc.component.parkingSpaceCreateFeeInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params:vc.component.parkingSpaceCreateFeeInfo.conditions
                };
 
               //发送get请求
               vc.http.get('parkingSpaceCreateFee',
                            'listParkingSpace',
                             param,
                             function(json,res){
                                var listParkingSpaceData =JSON.parse(json);
 
                                vc.component.parkingSpaceCreateFeeInfo.total = listParkingSpaceData.total;
                                vc.component.parkingSpaceCreateFeeInfo.records = listParkingSpaceData.records;
                                vc.component.parkingSpaceCreateFeeInfo.parkingSpaces = listParkingSpaceData.parkingSpaces;
 
                                vc.emit('pagination','init',{
                                    total:vc.component.parkingSpaceCreateFeeInfo.records,
                                    dataCount: vc.component.parkingSpaceCreateFeeInfo.total,
                                    currentPage:_page
                                });
                             },function(errInfo,error){
                                console.log('请求失败处理');
                             }
                           );
            },
            _openParkingSpaceCreateFeeAddModal:function(_parkingSpace,_isMore){
                vc.emit('parkingSpaceCreateFeeAdd', 'openParkingSpaceCreateFeeAddModal',{
                    isMore:_isMore,
                    parkingSpace:_parkingSpace
                });
            },
            _openViewParkingSpaceCreateFee:function(_parkingSpace){
                 vc.jumpToPage("/flow/listParkingSpaceFeeFlow?"+vc.objToGetParam(_parkingSpace));
            },
            /**
                根据楼ID加载房屋
            **/
            loadUnits:function(_floorId){
                vc.component.addParkingSpaceUnits = [];
                var param = {
                    params:{
                        floorId:_floorId,
                        communityId:vc.getCurrentCommunity().communityId
                    }
                }
                vc.http.get(
                    'parkingSpaceCreateFee',
                    'loadUnits',
                     param,
                     function(json,res){
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        if(res.status == 200){
                            var tmpUnits = JSON.parse(json);
                            vc.component.parkingSpaceUnits = tmpUnits;
 
                            return ;
                        }
                        vc.message(json);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');
 
                        vc.message(errInfo);
                     });
            },
            _queryParkingSpaceMethod:function(){
                vc.component.listParkingSpace(DEFAULT_PAGE,DEFAULT_ROW);
            },
            _loadDataByParam: function(){
                vc.component.parkingSpaceCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
                vc.component.parkingSpaceCreateFeeInfo.conditions.floorId = vc.getParam("floorName");
                //如果 floodId 没有传 则,直接结束
               /* if(!vc.notNull(vc.component.parkingSpaceCreateFeeInfo.conditions.floorId)){
                    return ;
                }*/
 
                var param = {
                    params:{
                        communityId:vc.getCurrentCommunity().communityId,
                        floorId:vc.component.parkingSpaceCreateFeeInfo.conditions.floorId
                    }
                }
 
                vc.http.get(
                    'parkingSpaceCreateFee',
                    'loadFloor',
                     param,
                     function(json,res){
                        if(res.status == 200){
                            var _floorInfo = JSON.parse(json);
                            var _tmpFloor = _floorInfo.apiFloorDataVoList[0];
                            /*vc.emit('parkingSpaceSelectFloor','chooseFloor', _tmpFloor);
                            */
 
                            return ;
                        }
                        vc.message(json);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');
 
                        vc.message(errInfo);
                     });
 
            },
            _moreCondition:function(){
                if(vc.component.parkingSpaceCreateFeeInfo.moreCondition){
                    vc.component.parkingSpaceCreateFeeInfo.moreCondition = false;
                }else{
                    vc.component.parkingSpaceCreateFeeInfo.moreCondition = true;
                }
            },
            _openChooseFloorMethod:function(){
                vc.emit('searchFloor','openSearchFloorModel',{});
            }
        }
    });
})(window.vc);