76 lines
2.7 KiB
JavaScript
76 lines
2.7 KiB
JavaScript
/**
|
|
入驻小区
|
|
**/
|
|
(function (vc) {
|
|
var DEFAULT_PAGE = 1;
|
|
var DEFAULT_ROWS = 10;
|
|
vc.extends({
|
|
data: {
|
|
pointRouteInfo: {
|
|
routes: [],
|
|
inspectionId: '',
|
|
inspectionRouteId:'',
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('pointRoute', 'switch', function (_data) {
|
|
$that.pointRouteInfo.inspectionId = _data.inspectionId;
|
|
$that.pointRouteInfo.inspectionRouteId = _data.inspectionRouteId;
|
|
|
|
$that._loadPointRouteData(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
});
|
|
vc.on('pointRoute', 'paginationPlus', 'page_event',
|
|
function (_currentPage) {
|
|
$that._loadPointRouteData(_currentPage, DEFAULT_ROWS);
|
|
});
|
|
vc.on('pointRoute', 'notify', function (_data) {
|
|
$that._loadPointRouteData(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
})
|
|
},
|
|
methods: {
|
|
|
|
_loadPointRouteData: function (_page, _row) {
|
|
let param = {
|
|
params: {
|
|
communityId: vc.getCurrentCommunity().communityId,
|
|
inspectionId: $that.pointRouteInfo.inspectionId,
|
|
inspectionRouteId:$that.pointRouteInfo.inspectionRouteId,
|
|
page: _page,
|
|
row: _row
|
|
}
|
|
};
|
|
//发送get请求
|
|
vc.http.apiGet('/inspectionRoute.listInspectionRoutes',
|
|
param,
|
|
function (json) {
|
|
let _json = JSON.parse(json);
|
|
$that.pointRouteInfo.routes = _json.inspectionRoutes;
|
|
if(_json.inspectionRoutes && _json.inspectionRoutes.length>0){
|
|
$that._switchPointRoute(_json.inspectionRoutes[0]);
|
|
}
|
|
},
|
|
function () {
|
|
console.log('请求失败处理');
|
|
}
|
|
);
|
|
},
|
|
//查询
|
|
_qureyPointRoute: function () {
|
|
$that._loadPointRouteData(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
},
|
|
|
|
_switchPointRoute:function(_route){
|
|
$that.pointRouteInfo.inspectionRouteId = _route.inspectionRouteId;
|
|
setTimeout(function(){
|
|
vc.emit('inspectionRouteMap','initMap',{
|
|
inspectionRouteId:_route.inspectionRouteId
|
|
})
|
|
},1000);
|
|
},
|
|
|
|
|
|
}
|
|
});
|
|
})(window.vc); |