From 0dac1e7402bbd83a2b4bee7b2f63980b2b6903f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=89=E7=A5=A5=20=E8=A9=B9?= Date: Tue, 22 Oct 2024 11:09:19 +0800 Subject: [PATCH] updates --- Controllers/AuthApiController.cs | 9 +++++++- Modals/DbTableClass.cs | 1 + Views/Home/RateList.cshtml | 11 +++++++--- wwwroot/assets/javascript/custom/ratelist.js | 22 ++++++++++++++++---- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Controllers/AuthApiController.cs b/Controllers/AuthApiController.cs index 34e0850e..6b2fbab0 100644 --- a/Controllers/AuthApiController.cs +++ b/Controllers/AuthApiController.cs @@ -903,6 +903,7 @@ namespace QuotationMaker.Controllers string dept_uid = obj["dept_uid"].ToString(); string mainItem_uid = obj["mainItem_uid"].ToString(); string mainItem_name = obj["mainItem_name"].ToString(); + string method = obj["method"].ToString(); if (method == "") { @@ -924,10 +925,13 @@ namespace QuotationMaker.Controllers if (method == "add") { + int mainItem_order = int.Parse(obj["mainItem_order"].ToString()); + mainItem_uid = GlobalClass.CreateRandomCode(12); mainItem newItem = new mainItem(); newItem.mainItem_name = mainItem_name; newItem.mainItem_uid = mainItem_uid; + newItem.mainItem_order = mainItem_order; newItem.dept_uid = dept_uid; newItem.mainItem_lastmodify_uid = token.user_uid; newItem.mainItem_createdate = DateTime.Now; @@ -968,7 +972,10 @@ namespace QuotationMaker.Controllers return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); } + int mainItem_order = int.Parse(obj["mainItem_order"].ToString()); + editItem.mainItem_name = mainItem_name; + editItem.mainItem_order = mainItem_order; editItem.mainItem_lastmodify_uid = token.user_uid; editItem.mainItem_modifydate= DateTime.Now; @@ -1020,7 +1027,7 @@ namespace QuotationMaker.Controllers string dept_uid = obj["dept_uid"].ToString(); - ret.mainItems = conn.Query("select * from mainItem where dept_uid = @dept_uid", new { dept_uid = dept_uid }).ToList(); + ret.mainItems = conn.Query("select * from mainItem where dept_uid = @dept_uid order by mainItem_order, mainItem_name", new { dept_uid = dept_uid }).ToList(); ret.ret = "yes"; return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8"); diff --git a/Modals/DbTableClass.cs b/Modals/DbTableClass.cs index 7c6ed104..388441a4 100644 --- a/Modals/DbTableClass.cs +++ b/Modals/DbTableClass.cs @@ -359,6 +359,7 @@ public class DbTableClass public string mainItem_uid { get; set; } = ""; public string dept_uid { get; set; } = ""; public string mainItem_name { get; set; } = ""; + public int mainItem_order { get; set; } = 99; public DateTime mainItem_createdate { get; set; } = DateTime.Now; public DateTime mainItem_modifydate { get; set; } = DateTime.Now; public string mainItem_lastmodify_uid { get; set; } = ""; diff --git a/Views/Home/RateList.cshtml b/Views/Home/RateList.cshtml index 0006dccc..6a92ee7b 100644 --- a/Views/Home/RateList.cshtml +++ b/Views/Home/RateList.cshtml @@ -64,8 +64,8 @@ - - + + @@ -102,7 +102,12 @@ - + +
+
+ +
+
主項目名稱 主項目名稱 順序 功能