/** 入驻小区 **/ (function (vc) { var DEFAULT_PAGE = 1; var DEFAULT_ROWS = 10; vc.extends({ data: { aStaffCommunityInfo: { staffs: [], communitys: [], orgId: '', orgName: '', curStaffId: '', } }, _initMethod: function () { $that._loadStaffs(); }, _initEvent: function () { vc.on('aStaffCommunity', 'listAStaffCommunity', function () { $that._loadAStaffCommunitys(DEFAULT_PAGE,DEFAULT_ROWS); }); vc.on('aStaffCommunity', 'switchOrg', function (_org) { $that.aStaffCommunityInfo.orgId = _org.orgId; $that.aStaffCommunityInfo.orgName = _org.allOrgName; $that._loadStaffs(); }); }, methods: { _loadStaffs: function () { let param = { params: { page: 1, row: 100, orgId: $that.aStaffCommunityInfo.orgId, staffName:$that.aStaffCommunityInfo.staffNameLike } } vc.http.apiGet('/query.staff.infos', param, function (json) { let _json = JSON.parse(json); // 员工列表 和 岗位列表匹配 let staffList = _json.staffs; $that.aStaffCommunityInfo.staffs = staffList; if (staffList && staffList.length > 0) { $that.aStaffCommunityInfo.curStaffId = staffList[0].userId; $that._loadAStaffCommunitys(DEFAULT_PAGE,DEFAULT_ROWS); } }, function () { console.log('请求失败处理'); } ); }, _staffAttendanceChangeOrg: function () { vc.emit('chooseOrgTree', 'openOrgModal', {}); }, swatchStaff: function (_staff) { $that.aStaffCommunityInfo.curStaffId = _staff.userId; $that._loadAStaffCommunitys(DEFAULT_PAGE,DEFAULT_ROWS); }, _loadAStaffCommunitys:function(_page,_rows){ let param = { params: { page: _page, row: _rows, staffId: $that.aStaffCommunityInfo.curStaffId } }; //发送get请求 vc.http.apiGet('/role.listAStaffCommunity', param, function (json, res) { let _json = JSON.parse(json); $that.aStaffCommunityInfo.total = _json.total; $that.aStaffCommunityInfo.records = _json.records; $that.aStaffCommunityInfo.communitys = _json.data; vc.emit('aStaffCommunity', 'paginationPlus', 'init', { total: $that.aStaffCommunityInfo.records, dataCount: $that.aStaffCommunityInfo.total, currentPage: _page }); }, function (errInfo, error) { console.log('请求失败处理'); } ); }, _openAddAStaffCommunityModal:function(){ vc.emit('addAStaffCommunity', 'openAddAStaffCommunityModal',{ staffId:$that.aStaffCommunityInfo.curStaffId, }) }, _openDeleteAStaffCommunityModel:function(aStaffCommunity){ vc.emit( 'deleteAStaffCommunity','openDeleteAStaffCommunityModal',aStaffCommunity) }, } }); })(window.vc);