lixiaojun
2024-10-29 cc89c6b8112cfccd270951a9177c6ac0e5307d79
Desktop/HStation.DeskTop.Xhs.Main/GuideMain.cs
@@ -3,8 +3,10 @@
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraEditors;
using HStation.WinFrmUI;
using HStation.WinFrmUI.Xhs;
using HStation.WinFrmUI.Xhs.Project;
using HStation.WinFrmUI.Auth;
using HStation.WinFrmUI.Basic;
using HStation.WinFrmUI.Organize;
using HStation.WinFrmUI.Xhs.PumpProduct;
using System;
using System.Drawing;
using System.IO;
@@ -95,6 +97,13 @@
                    }
                    break;
                case "SystemOrganize":
                    {
                        popSystemOrganize.MinWidth = buttonInfo.Bounds.Width;
                        popSystemOrganize.ShowPopup(point);
                    }
                    break;
                case "SystemAuthority":
                    {
                        popSystemAuthority.MinWidth = buttonInfo.Bounds.Width;
@@ -158,17 +167,17 @@
        /// </summary>
        private void barBtnProject_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new SurfaceGuid()
            var guid = new PageGuid()
            {
                Function = "项目管理",
                Modular = eModular.Basic
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new XhsProjectListPage();
                page.PageTitle.Caption = guid.Function;
                page.SurfaceGuid = guid;
                CreatePage(page, guid);
                /*     var page = new XhsProjectMainPanel();
                     page.PageTitle.Caption = guid.Function;
                     page.PageGuid = guid;
                     CreatePage(page, guid);*/
            }
        }
@@ -177,16 +186,16 @@
        /// </summary>
        private void barBtnPumpManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new SurfaceGuid()
            var guid = new PageGuid()
            {
                Function = "泵管理",
                Modular = eModular.Basic
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new PumpManageCtrl();
                var page = new PumpProductMainPanel();
                page.PageTitle.Caption = guid.Function;
                page.SurfaceGuid = guid;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }
@@ -196,16 +205,16 @@
        /// </summary>
        private void barButtonTypeManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new SurfaceGuid()
            var guid = new PageGuid()
            {
                Function = "类型管理",
                Modular = eModular.Basic
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new TypeManageCtrl();
                var page = new SysTypeManageMainPanel();
                page.PageTitle.Caption = guid.Function;
                page.SurfaceGuid = guid;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }
@@ -215,17 +224,53 @@
        /// </summary>
        private void BtnCatlogManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new SurfaceGuid()
            var guid = new PageGuid()
            {
                Function = "分类管理",
                Modular = eModular.Basic
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new CatalogManageCtrl();
                var page = new SysCatalogManageMainPanel();
                page.PageTitle.Caption = guid.Function;
                page.SurfaceGuid = guid;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }
        /// <summary>
        /// 属性管理
        /// </summary>
        private void BtnPropManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new PageGuid()
            {
                Function = "属性管理",
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new SysPropManageMainPanel();
                page.PageTitle.Caption = guid.Function;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }
        //角色管理
        private void BarBtnRoleManage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new PageGuid()
            {
                Function = "角色管理",
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                /* var page = new MenuMgrMainPanel();
                 page.PageTitle.Caption = guid.Function;
                 page.PageGuid = guid;
                 CreatePage(page, guid);*/
            }
        }
@@ -280,12 +325,24 @@
        }
        /// <summary>
        /// 用户管理
        /// 员工管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barBtnUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var guid = new PageGuid()
            {
                Function = "员工管理",
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new EmployeeMgrMainPanel();
                page.PageTitle.Caption = guid.Function;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }
        /// <summary>
@@ -314,7 +371,7 @@
        }
        //是否存在Page
        private bool IsExistPage(WinFrmUI.SurfaceGuid sguid, bool isActivateDoc)
        private bool IsExistPage(PageGuid sguid, bool isActivateDoc)
        {
            if (sguid == null)
                return false;
@@ -325,9 +382,9 @@
                {
                    if (doc.Tag != null)
                    {
                        if (doc.Tag is WinFrmUI.SurfaceGuid)
                        if (doc.Tag is PageGuid)
                        {
                            if ((doc.Tag as WinFrmUI.SurfaceGuid).ToString() == sguid.ToString())
                            if ((doc.Tag as PageGuid).ToString() == sguid.ToString())
                            {
                                if (isActivateDoc)
                                    this.tabbedView1.Controller.Activate(doc);
@@ -342,19 +399,19 @@
        }
        //更新数据
        private void RefreshPageData(WinFrmUI.SurfaceGuid sguid)
        private void RefreshPageData(PageGuid sguid)
        {
            if (sguid == null)
                return;
            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
            {
                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is WinFrmUI.SurfaceGuid && (x.Tag as WinFrmUI.SurfaceGuid).ToString() == sguid.ToString());
                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == sguid.ToString());
                if (doc != null)
                {
                    if (doc.Control is WinFrmUI.DocumentPage page)
                    if (doc.Control is DocumentPage page)
                    {
                        page.RefreshDataSource();
                        page.RefreshData();
                    }
                    return;
                }
@@ -362,21 +419,21 @@
        }
        //更新PageTitle
        private void UpdatePageTitle(WinFrmUI.SurfaceGuid sguid, WinFrmUI.PageTitle title)
        private void UpdatePageTitle(PageGuid sguid, PageTitle title)
        {
            if (sguid == null || title == null)
                return;
            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
            {
                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is WinFrmUI.SurfaceGuid && (x.Tag as WinFrmUI.SurfaceGuid).ToString() == sguid.ToString());
                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == sguid.ToString());
                if (doc != null)
                {
                    doc.Caption = title.Caption;
                    doc.ImageOptions.Image = title.HeaderImage;
                    doc.ImageOptions.SvgImage = title.HeaderSvgImage;
                    doc.ImageOptions.SvgImageSize = title.SvgImageSize;
                    if (doc.Control is WinFrmUI.DocumentPage page)
                    if (doc.Control is DocumentPage page)
                    {
                        page.PageTitle = title;
                    }
@@ -386,11 +443,11 @@
        }
        //创建Page
        private bool CreatePage(WinFrmUI.DocumentPage page, WinFrmUI.SurfaceGuid sguid)
        private bool CreatePage(DocumentPage page, PageGuid sguid)
        {
            if (page == null || sguid == null)
                return false;
            page.SurfaceGuid = sguid;
            page.PageGuid = sguid;
            page.Dock = DockStyle.Fill;
            page.IsExistPageEvent += IsExistPage;
            page.CreatePageEvent += CreatePage;
@@ -413,7 +470,7 @@
            }
            else
            {
                doc.Caption = page.SurfaceGuid?.Function;
                doc.Caption = page.PageGuid?.Function;
            }
            doc.Tag = sguid;
            this.tabbedView1.EndUpdate();
@@ -425,21 +482,21 @@
        }
        //关闭Page
        private void ClosePage(WinFrmUI.SurfaceGuid sguid)
        private void ClosePage(PageGuid sguid)
        {
            if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0)
            {
                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is WinFrmUI.SurfaceGuid && (x.Tag as WinFrmUI.SurfaceGuid).ToString() == sguid.ToString());
                var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == sguid.ToString());
                if (doc != null)
                {
                    var page = doc.Control as WinFrmUI.DocumentPage;
                    var page = doc.Control as DocumentPage;
                    this.tabbedView1.Controller.Close(doc);//会触发正在关闭和关闭事件
                }
            }
        }
        //查找page
        private WinFrmUI.DocumentPage FindPage(WinFrmUI.SurfaceGuid sguid, bool isActiveDoc)
        private DocumentPage FindPage(PageGuid sguid, bool isActiveDoc)
        {
            if (sguid == null)
                return default;
@@ -452,7 +509,7 @@
                {
                    if (isActiveDoc)
                        this.tabbedView1.Controller.Activate(doc);
                    if (doc.Control is WinFrmUI.DocumentPage page)
                    if (doc.Control is DocumentPage page)
                    {
                        return page;
                    }
@@ -470,16 +527,16 @@
        private void GuideMain_Load(object sender, EventArgs e)
        {
            var guid = new SurfaceGuid()
            var guid = new PageGuid()
            {
                Function = "项目管理",
                Modular = eModular.Basic
                Function = "项目总览",
                Modular = ""
            };
            if (!IsExistPage(guid, true))
            {
                var page = new XhsProjectListPage();
                var page = new HomeXhsProjectPage_Bak();
                page.PageTitle.Caption = guid.Function;
                page.SurfaceGuid = guid;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }