using System;
|
using System.Collections.Generic;
|
using HDL_ON.Entity;
|
|
namespace HDL_ON
|
{
|
public class FloorSelectPopupDialog
|
{
|
public FloorSelectPopupDialog()
|
{
|
}
|
|
/// <summary>
|
/// 一级List
|
/// </summary>
|
List<RoomCellInfo> mFirstList = new List<RoomCellInfo>();
|
/// <summary>
|
/// 二级联动List
|
/// </summary>
|
List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>();
|
|
/// <summary>
|
///
|
/// </summary>
|
public void ShowView(Action<string> selectAction, string selectTag = DiySelectPopupDialog.ALLSELECT)
|
{
|
|
var floorList = SpatialInfo.CurrentSpatial.FloorList;
|
var roomList = SpatialInfo.CurrentSpatial.RoomList;
|
|
if (floorList == null || floorList.Count == 0)
|
{
|
//没有楼层只加载房间
|
if (roomList == null)
|
{
|
Utlis.WriteLine("roomList null");
|
return;
|
}
|
|
mFirstList.Clear();
|
foreach (var room in roomList)
|
{
|
mFirstList.Add(new RoomCellInfo() { Title = room.roomName, TagId = room.roomId });
|
}
|
var roomSelectPopupDialog = new DiySelectPopupDialog();
|
roomSelectPopupDialog.ShowView(mFirstList, null, selectAction, selectTag);
|
}
|
else
|
{
|
mFirstList.Clear();
|
mSecondList.Clear();
|
//一级数组为楼层
|
foreach (var floor in floorList)
|
{
|
mFirstList.Add(new RoomCellInfo() { Title = floor.roomName, TagId = floor.roomId });
|
var mList = new List<RoomCellInfo>();
|
var allRoom = roomList.FindAll((room) => room.parentId == floor.roomId);
|
foreach (var mRoom in allRoom)
|
{
|
mList.Add(new RoomCellInfo() { Title = mRoom.roomName, TagId = mRoom.roomId });
|
}
|
|
if(mList == null)
|
{
|
mList = new List<RoomCellInfo>();
|
}
|
mSecondList.Add(mList);
|
}
|
|
var roomSelectPopupDialog = new DiySelectPopupDialog();
|
roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag);
|
|
}
|
|
}
|
|
}
|
}
|