弥留残荷

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

let buildingArr = [];
let data = null;
let data2 = null;
let data3 = null;
BuildingServer.building_details_empty({buildingId: params.buildingId}, (json) => {
data2 = json.success;
});
BuildingServer.building_details_emptySeat({buildingId: params.buildingId}, (json) => {
data3 = json.success;
});
BuildingServer.building_details_list(params, (json) => {
data = json.success;
data.push(1)//保证最后一条也有插入
let currFloorId = 0;
data && data.map((item, id) => {
if (currFloorId != item.floorId) {
//如果当前楼层编号与楼层编号不同,则表示当前为新的楼层
if (currFloorId > 0) {
//如果楼层编号大于0,表示需要将该楼层编号的 空置房间与空置卡座进行PUSH
//房间空置数据插入
let blankRoom = 0;
data2 && data2.map((item2, id2) => {
if (currFloorId === item2.floorId) {
blankRoom++;
}
});
if (blankRoom > 0) {
buildingArr.push({
departmentName: <span style={{color: "#007de3"}}>办公室空置</span>,
staffCount: <span
style={{color: "#007de3"}}>{blankRoom}(间)</span>
});
}else{
buildingArr.push({
departmentName: <span style={{color: "#007de3"}}>办公室空置</span>,
staffCount: <span
style={{color: "#007de3"}}>0(间)</span>
});
}
//卡座空置数字插入
let blankSeat = 0;
data3 && data3.map((item3, id3) => {
if (currFloorId === item3.floorId) {
blankSeat++;
}
});
if (blankSeat > 0) {
buildingArr.push({
departmentName: <span style={{color: "#007de3"}}>卡座区空置</span>,
staffCount: <span style={{color: "#007de3"}}>{blankSeat}(位)</span>
});
}else{
buildingArr.push({
departmentName: <span style={{color: "#007de3"}}>卡座区空置</span>,
staffCount: <span style={{color: "#007de3"}}>0(位)</span>
});
}
}
buildingArr.push({
floorName: item.floorName,
departmentName: item.departmentName,
staffCount: item.staffCount
});
currFloorId = item.floorId;
}
else {
//如果当前楼层编号与楼层编号相同,则表示为同一楼层
buildingArr.push({
floorName: "",
departmentName: item.departmentName,
staffCount: item.staffCount
});

}
});
updateRows(buildingArr);
});

 

posted on 2019-06-04 11:29  弥留残荷  阅读(255)  评论(0编辑  收藏  举报