纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.5 KiB

3 years ago
3 years ago
  1. using NFine.Application.SystemManage;
  2. using NFine.Code;
  3. using NFine.Domain.Entity.SystemManage;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Web.Mvc;
  7. namespace NFine.Web.Areas.SystemManage.Controllers
  8. {
  9. public class ItemsDataController : ControllerBase
  10. {
  11. private ItemsDetailApp itemsDetailApp = new ItemsDetailApp();
  12. private ItemsApp itemsApp = new ItemsApp();
  13. [HttpGet]
  14. [HandlerAjaxOnly]
  15. public ActionResult GetGridJson(string itemId, string keyword)
  16. {
  17. var data = itemsDetailApp.GetList(itemId, keyword);
  18. return Content(data.ToJson());
  19. }
  20. [HttpGet]
  21. [HandlerAjaxOnly]
  22. public ActionResult GetGridJson2(string itemId, string keyword, Pagination pagination)
  23. {
  24. var data = itemsDetailApp.GetList1(itemId, keyword, ref pagination);
  25. var JsonData = new
  26. {
  27. total = pagination.total,
  28. page = pagination.page,
  29. records = pagination.records,
  30. rows = data,
  31. };
  32. return Content(JsonData.ToJson());
  33. }
  34. [HttpGet]
  35. [HandlerAjaxOnly]
  36. public ActionResult GetSelectJson(string enCode)
  37. {
  38. var data = itemsDetailApp.GetItemList(enCode);
  39. List<object> list = new List<object>();
  40. foreach (ItemsDetailEntity item in data)
  41. {
  42. list.Add(new { id = item.F_ItemCode, text = item.F_ItemName });
  43. }
  44. return Content(list.ToJson());
  45. }
  46. //[HttpGet]
  47. //[HandlerAjaxOnly]
  48. //public ActionResult GetSelectJsonWH(string keyValue)
  49. //{
  50. // string keyValueCH = string.Empty;
  51. // switch (keyValue)
  52. // {
  53. // case "1": keyValueCH = "仓库类型"; break;
  54. // case "2": keyValueCH = "形状"; break;
  55. // case "3": keyValueCH = "色度"; break;
  56. // case "4": keyValueCH = "净度"; break;
  57. // case "5": keyValueCH = "抛光"; break;
  58. // case "6": keyValueCH = "对称性"; break;
  59. // case "7": keyValueCH = "切工"; break;
  60. // case "8": keyValueCH = "分类"; break;
  61. // }
  62. // //string itemsId = itemsApp.GetForm2(keyValue).F_Id;
  63. // string itemsId = itemsApp.GetForm2(keyValueCH).F_Id;
  64. // var data = itemsDetailApp.GetItemListWH(itemsId);
  65. // List<object> list = new List<object>();
  66. // foreach (ItemsDetailEntity item in data)
  67. // {
  68. // list.Add(new { id = item.F_ItemCode, text = item.F_ItemName });
  69. // }
  70. // return Content(list.ToJson());
  71. //}
  72. [HttpGet]
  73. [HandlerAjaxOnly]
  74. public ActionResult GetFormJson(string keyValue)
  75. {
  76. var data = itemsDetailApp.GetForm(keyValue);
  77. return Content(data.ToJson());
  78. }
  79. [HttpPost]
  80. [HandlerAjaxOnly]
  81. [ValidateAntiForgeryToken]
  82. public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue)
  83. {
  84. itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue);
  85. return Success("操作成功。");
  86. }
  87. [HttpPost]
  88. [HandlerAjaxOnly]
  89. [HandlerAuthorize]
  90. [ValidateAntiForgeryToken]
  91. public ActionResult DeleteForm(string keyValue)
  92. {
  93. itemsDetailApp.DeleteForm(keyValue);
  94. return Success("删除成功。");
  95. }
  96. }
  97. }