mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-27 00:20:01 +08:00
119 lines
4.8 KiB
JavaScript
119 lines
4.8 KiB
JavaScript
/**
|
|
入驻小区
|
|
**/
|
|
(function (vc) {
|
|
var DEFAULT_PAGE = 1;
|
|
var DEFAULT_ROWS = 10;
|
|
vc.extends({
|
|
data: {
|
|
adminRoomInfo: {
|
|
rooms: [],
|
|
states:[],
|
|
roomSubTypes:[],
|
|
total: 0,
|
|
records: 1,
|
|
moreCondition: false,
|
|
conditions: {
|
|
communityId: '',
|
|
floorId: '',
|
|
unitId: '',
|
|
ownerNameLike:'',
|
|
ownerTel:'',
|
|
roomNum: '',
|
|
state: '',
|
|
roomSubType: '',
|
|
}
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
vc.emit('communityUnitTree', 'initCommunityUnitTree',{
|
|
callName:'adminRoom'
|
|
});
|
|
vc.getDict('building_room', "state", function (_data) {
|
|
$that.adminRoomInfo.states = _data;
|
|
});
|
|
//与字典表关联
|
|
vc.getDict('building_room', "room_sub_type", function (_data) {
|
|
$that.adminRoomInfo.roomSubTypes = _data;
|
|
});
|
|
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('adminRoom', 'selectCommunity', function (_param) {
|
|
$that.adminRoomInfo.conditions.communityId = _param.communityId;
|
|
$that.adminRoomInfo.conditions.floorId = '';
|
|
$that.adminRoomInfo.conditions.unitId = '';
|
|
$that._listAdminCommunityRooms(DEFAULT_PAGE,DEFAULT_ROWS);
|
|
});
|
|
vc.on('adminRoom', 'selectFloor', function (_param) {
|
|
$that.adminRoomInfo.conditions.communityId = '';
|
|
$that.adminRoomInfo.conditions.floorId = _param.floorId;
|
|
$that.adminRoomInfo.conditions.unitId = '';
|
|
$that._listAdminCommunityRooms(DEFAULT_PAGE,DEFAULT_ROWS);
|
|
|
|
});
|
|
vc.on('adminRoom', 'selectUnit', function (_param) {
|
|
$that.adminRoomInfo.conditions.communityId = '';
|
|
$that.adminRoomInfo.conditions.floorId = '';
|
|
$that.adminRoomInfo.conditions.unitId = _param.unitId;
|
|
$that._listAdminCommunityRooms(DEFAULT_PAGE,DEFAULT_ROWS);
|
|
});
|
|
vc.on('adminRoom', 'listAdminRoom', function (_param) {
|
|
$that._listCommunityPublicitys(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
});
|
|
vc.on('pagination', 'page_event', function (_currentPage) {
|
|
$that._listAdminCommunityRooms(_currentPage, DEFAULT_ROWS);
|
|
});
|
|
},
|
|
methods: {
|
|
_listAdminCommunityRooms: function (_page, _rows) {
|
|
$that.adminRoomInfo.conditions.page = _page;
|
|
$that.adminRoomInfo.conditions.row = _rows;
|
|
let param = {
|
|
params: $that.adminRoomInfo.conditions
|
|
};
|
|
//发送get请求
|
|
vc.http.apiGet('/room.queryAdminRoom',
|
|
param,
|
|
function (json, res) {
|
|
let _json = JSON.parse(json);
|
|
$that.adminRoomInfo.total = _json.total;
|
|
$that.adminRoomInfo.records = _json.records;
|
|
$that.adminRoomInfo.rooms = _json.data;
|
|
vc.emit('pagination', 'init', {
|
|
total: $that.adminRoomInfo.records,
|
|
dataCount: $that.adminRoomInfo.total,
|
|
currentPage: _page
|
|
});
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
}
|
|
);
|
|
},
|
|
|
|
//查询
|
|
_queryCommunityPublicityMethod: function () {
|
|
$that._listAdminCommunityRooms(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
},
|
|
//重置
|
|
_toAdminRoomDetail: function (_room) {
|
|
vc.jumpToPage('/#/pages/community/adminRoomDetail?roomId='+_room.roomId);
|
|
},
|
|
_moreCondition: function () {
|
|
if ($that.adminRoomInfo.moreCondition) {
|
|
$that.adminRoomInfo.moreCondition = false;
|
|
} else {
|
|
$that.adminRoomInfo.moreCondition = true;
|
|
}
|
|
},
|
|
_computeTableDivWidth: function () {
|
|
let mainWidth = document.getElementsByTagName('body')[0].clientWidth - document.getElementById('menu-nav').offsetWidth;
|
|
let treeWidth = document.getElementsByClassName('room-floor-unit-tree')[0].offsetWidth;
|
|
mainWidth = mainWidth - 20 - treeWidth - 15 - 20;
|
|
//document.getElementsByClassName('hc-table-div')[0].style.width=mainWidth+'px';
|
|
return mainWidth + 'px';
|
|
},
|
|
}
|
|
});
|
|
})(window.vc); |