HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs
@@ -11,7 +11,7 @@
    public class DiySelectPopupDialog : Dialog
    {
        /// <summary>
        /// ALLSELECT
        /// ALLSELECT,标识
        /// </summary>
        public const string ALLSELECT = "ALLSELECT";
@@ -24,7 +24,7 @@
        /// </summary>
        public FrameLayout BackView;
        /// <summary>
        ///
        /// 全部按钮
        /// </summary>
        Button leftAllButton;
        /// <summary>
@@ -53,13 +53,12 @@
        List<RoomCellInfo> mSecondAllList = new List<RoomCellInfo>();
        /// <summary>
        /// RoomSelectPopupDialog
        /// DiySelectPopupDialog
        /// </summary>
        /// <param name="SelectAction"></param>
        public DiySelectPopupDialog()
        {
            bodyView = new FrameLayout();
        }
        /// <summary>
@@ -67,8 +66,10 @@
        /// mFirstList、mSecondList不合法都不会显示View
        /// mSecondList 不传为默认一级
        /// </summary>
        /// <param name="mFirstList"></param>
        /// <param name="mSecondList"></param>
        /// <param name="mFirstList">一级数据集合</param>
        /// <param name="mSecondList">二级数据集合</param>
        /// <param name="SelectAction">选择回调事件</param>
        /// <param name="selectTagId"></param>
        public void ShowView(List<RoomCellInfo> mFirstList, List<List<RoomCellInfo>> mSecondList, Action<string> SelectAction, string selectTagId = ALLSELECT)
        {
            if (mFirstList == null)
@@ -99,19 +100,19 @@
                this.mFirstList = mFirstList;
                this.mSecondList = mSecondList;
                this.mSecondAllList.Clear();
                foreach(var list in mSecondList)
                foreach (var list in mSecondList)
                {
                    foreach (var data in list)
                    {
                        this.mSecondAllList.Add(data);
                    }
                }
                //View显示
                ShowDoubleBaseView();
                //数据内容填充
                RefreshDoubleBaseView();
                //
                //选中效果
                SetSelectTagId(selectTagId);
            }
@@ -120,7 +121,7 @@
        /// <summary>
        ///
        /// 刷新UI,选择全部
        /// </summary>
        void SelectAll()
        {
@@ -138,13 +139,13 @@
        /// </summary>
        void SetSelectTagId(string tagId)
        {
            if (string.IsNullOrEmpty(tagId) || tagId == ALLSELECT)
            if (string.IsNullOrEmpty(tagId) || tagId == ALLSELECT || mFirstList == null)
            {
                SelectAll();
            }
            else
            {
                //一级楼层匹配成功
                var tagInfo = mFirstList.Find((m) => m.TagId == tagId);
                if (tagInfo != null)
                {
@@ -162,7 +163,41 @@
                }
                else
                {
                    SelectAll();
                    //SelectAll();
                    //一级的楼层匹配失败,尝试匹配二级
                    if (mSecondList == null || mFirstList.Count != mSecondList.Count)
                    {
                        SelectAll();
                    }
                    else
                    {
                        //是否匹配到房间
                        bool isFind = false;
                        //1.遍历二级房间数据
                        for(var i = 0; i < mSecondList.Count; i++)
                        {
                            foreach (var room in mSecondList[i])
                            {
                                if(tagId == room.TagId)
                                {
                                    //匹配房间成功,选中对于的楼层
                                    var tagFirstInfo = mFirstList[i];
                                    isFind = true;
                                    RefreshSelectButton(leftScrolView, tagFirstInfo.TagId);
                                    LoadRightScrolView(tagFirstInfo, mSecondList[i]);
                                    break;
                                }
                            }
                        }
                        //没有匹配到房间
                        if (!isFind)
                        {
                            SelectAll();
                        }
                    }
                }
            }
        }