mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 14:17:54 +08:00
97 lines
3.7 KiB
JavaScript
97 lines
3.7 KiB
JavaScript
(function(vc) {
|
|
//员工权限
|
|
vc.extends({
|
|
data: {
|
|
unitInfo: {
|
|
units: [],
|
|
_currentFloorId: '',
|
|
moreCondition: false,
|
|
conditions: {
|
|
floorId: '',
|
|
floorName: '',
|
|
unitNum: '',
|
|
layerCount: '',
|
|
lift: '',
|
|
}
|
|
}
|
|
},
|
|
_initMethod: function() {
|
|
var _paramFloorId = vc.getParam("floorId");
|
|
var _paramFloorName = vc.getParam("floorName");
|
|
console.log('_paramFloorId', _paramFloorId);
|
|
if (vc.notNull(_paramFloorId)) {
|
|
vc.component.unitInfo.conditions.floorId = _paramFloorId;
|
|
vc.component.unitInfo.conditions.floorName = _paramFloorName;
|
|
vc.component._loadUnits({ 'floorId': _paramFloorId });
|
|
}
|
|
|
|
},
|
|
_initEvent: function() {
|
|
vc.on('unit', 'chooseFloor', function(_param) {
|
|
vc.component.unitInfo.conditions.floorId = _param.floorId;
|
|
vc.component.unitInfo.conditions.floorName = _param.floorName;
|
|
});
|
|
|
|
vc.on('unit', 'loadUnit', function(_param) {
|
|
vc.component.unitInfo.conditions.floorId = _param.floorId;
|
|
vc.component._loadUnits(_param);
|
|
});
|
|
vc.on('unit', 'loadData', function(_param) {
|
|
vc.component._loadUnits(_param);
|
|
});
|
|
},
|
|
methods: {
|
|
_loadUnits: function(_param) {
|
|
vc.component.unitInfo._currentFloorId = _param.floorId;
|
|
if (!vc.notNull(_param.floorId)) {
|
|
return;
|
|
}
|
|
vc.component.unitInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
|
|
var param = {
|
|
params: vc.component.unitInfo.conditions
|
|
};
|
|
//发送get请求
|
|
vc.http.apiGet('/unit.queryUnits',
|
|
param,
|
|
function(json) {
|
|
var _unitInfo = JSON.parse(json);
|
|
vc.component.unitInfo.units = _unitInfo;
|
|
},
|
|
function() {
|
|
console.log('请求失败处理');
|
|
});
|
|
},
|
|
_openDeleteUnitModel: function(_unit) {
|
|
_unit.floorId = vc.component.unitInfo._currentFloorId;
|
|
vc.emit('deleteUnit', 'openUnitModel', _unit);
|
|
},
|
|
_openEditUnitModel: function(_unit) {
|
|
_unit.floorId = vc.component.unitInfo._currentFloorId;
|
|
vc.emit('editUnit', 'openUnitModel', _unit);
|
|
},
|
|
_openChooseFloorMethod: function() {
|
|
vc.emit('searchFloor', 'openSearchFloorModel', {});
|
|
},
|
|
openAddUnitModel: function() {
|
|
if (!vc.isNotEmpty($that.unitInfo.conditions.floorId)) {
|
|
vc.toast('请先选择楼栋');
|
|
return;
|
|
}
|
|
vc.emit('addUnit', 'addUnitModel', {
|
|
floorId: vc.component.unitInfo.conditions.floorId
|
|
});
|
|
},
|
|
_queryUnitMethod: function() {
|
|
vc.component._loadUnits({ 'floorId': vc.component.unitInfo.conditions.floorId });
|
|
},
|
|
_moreCondition: function() {
|
|
if (vc.component.unitInfo.moreCondition) {
|
|
vc.component.unitInfo.moreCondition = false;
|
|
} else {
|
|
vc.component.unitInfo.moreCondition = true;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
})(window.vc); |