From 6e2b929cf381e2320ba6e7dec56c0371124d2b51 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期六, 27 八月 2022 15:03:00 +0800
Subject: [PATCH] 提交

---
 zhengcaioa/zhengcaioa/Controllers/AdmManagement/DailyManagementController.cs |  152 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 114 insertions(+), 38 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/DailyManagementController.cs b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/DailyManagementController.cs
index 0c01d2c..ba2f0b0 100644
--- a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/DailyManagementController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/DailyManagementController.cs
@@ -20,38 +20,64 @@
         private readonly ILiaotianService _liaotianService;
         private readonly IUserService _userService;
         private readonly IHrDeptService _hrDeptService;
+        private readonly IPltPageService _pltPageService;
 
         [CheckLogin]
         public DailyManagementController(ILogger<DailyManagementController> logger, IDailyManagementService DailyManageService, 
-                 ILiaotianService liaotianService, IUserService userService, IHrDeptService hrDeptService)
+                 ILiaotianService liaotianService, IUserService userService, IHrDeptService hrDeptService
+            , IPltPageService pltPageService)
         {
             _logger = logger;
             _DailyManageService = DailyManageService;
             _liaotianService = liaotianService;
             _userService =  userService;
             _hrDeptService = hrDeptService;
+            _pltPageService = pltPageService;
         }
 
         #region 閫氳瘽绠$悊
         [CheckLogin]
         public IActionResult HoldPhone()
         {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
             List<ActionEntity> actionlist = new List<ActionEntity>();
-            ActionEntity actionEntity = new ActionEntity();
-            actionEntity.OpenType = 0;
-            actionEntity.ActionUrl = "";
-            actionEntity.ActionFun = "Search";
-            actionEntity.PageIco = "fa fa-search";
-            actionEntity.ActionName = "鏌ヨ";
-            actionlist.Add(actionEntity);
-            ActionEntity actionEntity1 = new ActionEntity();
-            actionEntity1.OpenType = 0;
-            actionEntity1.ActionUrl = "";
-            actionEntity1.ActionFun = "Add";
-            actionEntity1.PageIco = "fa fa-plus";
-            actionEntity1.ActionName = "鏂板";
-            actionlist.Add(actionEntity1);            
+           
+            //ActionEntity actionEntity1 = new ActionEntity();
+            //actionEntity1.OpenType = 0;
+            //actionEntity1.ActionUrl = "";
+            //actionEntity1.ActionFun = "Add";
+            //actionEntity1.PageIco = "fa fa-plus";
+            //actionEntity1.ActionName = "鏂板";
+            //actionlist.Add(actionEntity1);            
+            var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/DailyManagement/HoldPhone/");
+            var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList();
+            if(pageEntities1.Count(x=>x.PageShortcut == "Search") <= 0)
+            {
+                ActionEntity actionEntity = new ActionEntity();
+                actionEntity.OpenType = 0;
+                actionEntity.ActionUrl = "";
+                actionEntity.ActionFun = "Search";
+                actionEntity.PageIco = "fa fa-search";
+                actionEntity.ActionName = "鏌ヨ";
+                actionlist.Add(actionEntity);
+
+                ViewData["Creater"] = curentuser.Id;
+            }
+            var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList();
+
+            foreach (var pageEntity in pageEntities1)
+            {
+                ActionEntity actionEntity1 = new ActionEntity();
+                actionEntity1.OpenType = pageEntity.OpenType;
+                actionEntity1.ActionUrl = "";
+                actionEntity1.ActionFun = pageEntity.PageShortcut;
+                actionEntity1.PageIco = pageEntity.PageIco;
+                actionEntity1.ActionName = pageEntity.PageName;
+                actionlist.Add(actionEntity1);
+            }
             ViewData["ActionInfo"] = actionlist;
+            ViewData["ActionInfo2"] = pageEntities2;
             ViewBag.LineType =    _liaotianService.GetSYScode("ADM_HoldPhone", "LineType").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
             ViewBag.Intention = _liaotianService.GetSYScode("ADM_HoldPhone", "Intention").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
             return View();
@@ -185,12 +211,17 @@
         public IActionResult EditMemoBook(string Rtype="1" , string id = "0") 
         {
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
-            ViewData["users"] = _userService.GetList();
+            ViewData["users"] = _userService.GetList().Where(x=>x.Id != curentuser.Id).ToList();
             AdmMemoBookDTO admMemoBookDTO = _DailyManageService.GetMemoBook(id);
-            if (admMemoBookDTO.Time.Equals(DateTime.MinValue))
+            if (!admMemoBookDTO.Time.HasValue)
             {
-                admMemoBookDTO.Time = DateTime.Now;
+                admMemoBookDTO.TimeName = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                 Rtype = string.IsNullOrEmpty(admMemoBookDTO.Rtype)? Rtype : admMemoBookDTO.Rtype;
+            }
+            else
+            {
+                admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm");
+                Rtype = string.IsNullOrEmpty(admMemoBookDTO.Rtype) ? Rtype : admMemoBookDTO.Rtype;
             }
             ViewData.Model = admMemoBookDTO;
             ViewBag.Rtype = Rtype;
@@ -221,7 +252,7 @@
         [HttpPost]
         public string SaveMemoBook(AdmMemoBookDTO memoBook)
         {
-            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));            
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             memoBook.RecStatus = "A";
             if (String.IsNullOrEmpty(memoBook.Id))
             {
@@ -274,13 +305,32 @@
             actionEntity.PageIco = "fa fa-search";
             actionEntity.ActionName = "鏌ヨ";
             actionlist.Add(actionEntity);
-            ActionEntity actionEntity1 = new ActionEntity();
-            actionEntity1.OpenType = 0;
-            actionEntity1.ActionUrl = "";
-            actionEntity1.ActionFun = "Add";
-            actionEntity1.PageIco = "fa fa-plus";
-            actionEntity1.ActionName = "宸ヤ綔瀹夋帓";
-            actionlist.Add(actionEntity1);
+            //ActionEntity actionEntity1 = new ActionEntity();
+            //actionEntity1.OpenType = 0;
+            //actionEntity1.ActionUrl = "";
+            //actionEntity1.ActionFun = "Add";
+            //actionEntity1.PageIco = "fa fa-plus";
+            //actionEntity1.ActionName = "宸ヤ綔瀹夋帓";
+            //actionlist.Add(actionEntity1);
+
+            var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/DailyManagement/MemoWorkAnPai");
+            var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList();
+           
+            var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList();
+
+            foreach (var pageEntity in pageEntities1)
+            {
+                ActionEntity actionEntity1 = new ActionEntity();
+                actionEntity1.OpenType = pageEntity.OpenType;
+                actionEntity1.ActionUrl = "";
+                actionEntity1.ActionFun = pageEntity.PageShortcut;
+                actionEntity1.PageIco = pageEntity.PageIco;
+                actionEntity1.ActionName = pageEntity.PageName;
+                actionlist.Add(actionEntity1);
+            }
+            ViewData["ActionInfo"] = actionlist;
+            ViewData["ActionInfo2"] = pageEntities2;
+
 
             //ActionEntity actionEntity2 = new ActionEntity();
             //actionEntity2.OpenType = 0;
@@ -293,7 +343,7 @@
             ViewBag.User = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList();
 
             ViewBag.Wancheng = _liaotianService.GetSYScode("ADM_MemoBook", "HaveRead").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
-            ViewData["ActionInfo"] = actionlist;
+            //ViewData["ActionInfo"] = actionlist;
             return View();
         }
 
@@ -317,7 +367,8 @@
         public IActionResult EditWorkAnPai( string id = "")
         {
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
-            ViewData["users"] = _userService.GetList();
+            ViewData["curentuser"] = curentuser;
+            ViewData["users"] = _userService.GetList().Where(x => x.Id != curentuser.Id).ToList();
             AdmMemoBookDTO admMemoBookDTO = new AdmMemoBookDTO();
             if (!string.IsNullOrEmpty(id))
             {
@@ -325,9 +376,14 @@
                 admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId;
             }
             
-            if (admMemoBookDTO.Time.Equals(DateTime.MinValue))
+            if (!admMemoBookDTO.Time.HasValue)
             {
-                admMemoBookDTO.Time = DateTime.Now;
+                //admMemoBookDTO.Time = DateTime.Now;
+                admMemoBookDTO.TimeName = "";
+            }
+            else
+            {
+                admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm");
             }
             ViewData.Model = admMemoBookDTO;
             ViewData["Dept"] = _hrDeptService.GetList();
@@ -389,9 +445,14 @@
                 admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId;
             }
 
-            if (admMemoBookDTO.Time.Equals(DateTime.MinValue))
+            if (!admMemoBookDTO.Time.HasValue)
             {
-                admMemoBookDTO.Time = DateTime.Now;
+                //admMemoBookDTO.Time = DateTime.Now;
+                admMemoBookDTO.TimeName = "";
+            }
+            else
+            {
+                admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm");
             }
             ViewData.Model = admMemoBookDTO;
             ViewBag.KaoHe = _liaotianService.GetSYScode("ADM_MemoBook", "KaoHe");
@@ -506,9 +567,14 @@
                 admMemoBookDTO = _DailyManageService.GetMemoBook(id);
             }
 
-            if (admMemoBookDTO.Time.Equals(DateTime.MinValue))
+            if (!admMemoBookDTO.Time.HasValue)
             {
-                admMemoBookDTO.Time = DateTime.Now;
+                //admMemoBookDTO.Time = DateTime.Now;
+                admMemoBookDTO.TimeName = "";
+            }
+            else
+            {
+                admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm");
             }
             ViewData.Model = admMemoBookDTO;
             ViewBag.Rtype = _liaotianService.GetSYScode("ADM_MemoBook", "Rtype").Where(x=>x.CodeSn=="2" || x.CodeSn == "4").ToList();
@@ -571,9 +637,14 @@
                 admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId;
             }
 
-            if (admMemoBookDTO.Time.Equals(DateTime.MinValue))
+            if (!admMemoBookDTO.Time.HasValue)
             {
-                admMemoBookDTO.Time = DateTime.Now;
+                //admMemoBookDTO.Time = DateTime.Now;
+                admMemoBookDTO.TimeName = "";
+            }
+            else
+            {
+                admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm");
             }
             ViewData.Model = admMemoBookDTO;
            
@@ -623,9 +694,14 @@
                 admMemoBookDTO.WorkDept = _userService.GetPltUserEntity(admMemoBookDTO.ToUserId).DeptId;
             }
 
-            if (admMemoBookDTO.Time.Equals(DateTime.MinValue))
+            if (!admMemoBookDTO.Time.HasValue)
             {
-                admMemoBookDTO.Time = DateTime.Now;
+                //admMemoBookDTO.Time = DateTime.Now;
+                admMemoBookDTO.TimeName = "";
+            }
+            else
+            {
+                admMemoBookDTO.TimeName = admMemoBookDTO.Time.Value.ToString("yyyy-MM-dd HH:mm");
             }
             ViewData.Model = admMemoBookDTO;
 

--
Gitblit v1.9.1