lixiaojun
2024-12-18 046e8574ce28d1b8858f8d3619df5a28a2f51e38
WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/00-core/HomeXhsProjectPage.cs
@@ -11,69 +11,24 @@
        {
            InitializeComponent();
            this.PageTitle.Caption = "首页";
            this.PageTitle.HeaderSvgImage = this.svgImg32[0];
            this.PageTitle.HeaderSvgImage = XhsMainSvgImageHelper.Home;
            this.PageTitle.SvgImageSize = new Size(24, 24);
            this.PageTitle.AllowClose = false;
            this.repPicEdit.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom;
            this.xhsProjectHomeTitleCtrl1.JumpEvent += XhsProjectHomeTitleCtrl1_JumpEvent;
            this.mapViewProjectListContainer1.LoadCompletedEvent += MapViewProjectListContainer1_LoadCompletedEvent;
        }
        //页面类
        private class CurrentViewModel
        {
            public string Name { get; set; }
            public int Count { get; set; }
            public SvgImage Image { get; set; }
        }
        private List<XhsProjectVmo> _allProjectList = null;
        private Lazy<BLL.AssetsPumpMain> _bllPump = new(() => new BLL.AssetsPumpMain());
        private List<XhsProjectVmo> _allProjectList = null;//所有项目列表
        /// <summary>
        /// 初始化数据源
        /// </summary>
        public override async void InitialDataSource()
        {
            SetBindingData();
            this.mapViewProjectListContainer1.LoadCompletedEvent += MapViewProjectListContainer1_LoadCompletedEvent;
            await this.mapViewProjectListContainer1.InitialContainer();
        }
        private async void SetBindingData()
        {
            base.InitialDataSource();
            _allProjectList = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetAll();
            var allPump = await _bllPump.Value.GetAll();
            var allValveList = await new BLL.AssetsValveMain().GetAll();
            var vm = new CurrentViewModel()
            {
                Name = "项目数量",
                Count = _allProjectList?.Count ?? 0,
                Image = ImageLib.Project
            };
            var vm2 = new CurrentViewModel()
            {
                Name = "水泵型号数量",
                Count = allPump?.Count ?? 0,
                Image = ImageLib.PumpMain
            };
            var vm3 = new CurrentViewModel()
            {
                Name = "阀门型号数量",
                Count = allValveList?.Count ?? 0,
                Image = ImageLib.Valve
            };
            var vm4 = new CurrentViewModel()
            {
                Name = "冷却塔数量",
                Count = 0,
                Image = ImageLib.CoolingTower
            };
            var list = new List<CurrentViewModel>() { vm, vm2, vm3, vm4 };
            this.gridControl1.DataSource = list;
            this.gridControl1.RefreshDataSource();
            this.xhsProjectHomeTitleCtrl1.SetBindingData();
            await this.mapViewProjectListContainer1.InitialContainer();
        }
        /// <summary>
@@ -83,9 +38,9 @@
        {
            base.RefreshData();
            _allProjectList = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetAll();
            this.xhsProjectHomeTitleCtrl1.SetBindingData();
            await this.mapViewProjectListContainer1.SetProjectList(_allProjectList);
            this.homeXhsProjectTreeListCtrl1.SetBindingData(_allProjectList);
            SetBindingData();
        }
        //地图加载完成
@@ -160,82 +115,89 @@
            RefreshData();
        }
        //单击数量总览跳转
        private void layoutView1_FieldValueClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.FieldValueClickEventArgs e)
        //Title跳转
        private void XhsProjectHomeTitleCtrl1_JumpEvent(string obj)
        {
            if (e.Column.Caption != "名称")
                return;
            switch (e.FieldValue)
            switch (obj)
            {
                case "项目数量":
                    var guid = new PageGuid()
                case HStation.Xhs.DataType.XhsProject:
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "ProjectMgr",
                    };
                    if (!IsExistPage(guid, true))
                    {
                        var page = new XhsProjectMgrPage();
                        CreatePage(page, guid);
                        var guid = new PageGuid()
                        {
                            Modular = XhsFunctionHelper.Modular,
                            MoudingType = eMoudingType.Tab,
                            Function = XhsFunctionHelper.ProjectMgr
                        };
                        if (!IsExistPage(guid, true))
                        {
                            var page = new XhsProjectMgrPage();
                            CreatePage(page, guid);
                        }
                    }
                    break;
                case "水泵型号数量":
                    var pumpGuid = new PageGuid()
                case HStation.Assets.DataType.CoolingMain:
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "pumpMgr",
                    };
                    if (!IsExistPage(pumpGuid, true))
                    {
                        var page = new PumpProductMainPage();
                        CreatePage(page, pumpGuid);
                        var guid = new PageGuid()
                        {
                            Modular = AssetsFunctionHelper.Modular,
                            MoudingType = eMoudingType.Tab,
                            Function = AssetsFunctionHelper.CoolingMgr
                        };
                        if (!IsExistPage(guid, true))
                        {
                            var page = new AssetsCoolingMgrPage();
                            CreatePage(page, guid);
                        }
                    }
                    break;
                case "阀门型号数量":
                    var valveGuid = new PageGuid()
                case HStation.Assets.DataType.PumpMain:
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "ValveMgr",
                    };
                    if (!IsExistPage(valveGuid, true))
                    {
                        var page = new ValveManageMainPage();
                        CreatePage(page, valveGuid);
                        var guid = new PageGuid()
                        {
                            Modular = AssetsFunctionHelper.Modular,
                            MoudingType = eMoudingType.Tab,
                            Function = AssetsFunctionHelper.PumpMgr
                        };
                        if (!IsExistPage(guid, true))
                        {
                            var page = new PumpProductMainPage();
                            CreatePage(page, guid);
                        }
                    }
                    break;
                case HStation.Assets.DataType.ValveMain:
                    {
                        var guid = new PageGuid()
                        {
                            Modular = AssetsFunctionHelper.Modular,
                            MoudingType = eMoudingType.Tab,
                            Function = AssetsFunctionHelper.ValveMgr
                        };
                        if (!IsExistPage(guid, true))
                        {
                            var page = new ValveManageMainPage();
                            CreatePage(page, guid);
                        }
                    }
                    break;
                case HStation.Assets.DataType.ExchangerMain:
                    {
                        var guid = new PageGuid()
                        {
                            Modular = AssetsFunctionHelper.Modular,
                            MoudingType = eMoudingType.Tab,
                            Function = AssetsFunctionHelper.ExchangerMgr
                        };
                        if (!IsExistPage(guid, true))
                        {
                            var page = new ExchangerManageMainPage();
                            CreatePage(page, guid);
                        }
                    }
                    break;
                default: break;
            }
        }
        #region 鼠标事件
        /*   private void layoutView1_MouseMove(object sender, MouseEventArgs e)
    {
        var info = layoutView1.CalcHitInfo(e.X, e.Y);
        if (info.Column == null)
            return;
        if (info.Column.Caption == "名称")
        {
            Cursor.Current = Cursors.Help;
        }
        else
        {
        }
    }*/
        /*     private void layoutView1_MouseEnter(object sender, EventArgs e)
             {
                 var info = layoutView1.CalcHitInfo(Cursor.Position.X, Cursor.Position.Y);
                 if (info.Column != null && info.Column.Caption == "名称")
                 {
                     Cursor.Current = Cursors.Help;
                 }
             }*/
        #endregion 鼠标事件
    }
}