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.

90 lines
3.0 KiB

  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 GetSelectJson(string enCode)
  23. {
  24. var data = itemsDetailApp.GetItemList(enCode);
  25. List<object> list = new List<object>();
  26. foreach (ItemsDetailEntity item in data)
  27. {
  28. list.Add(new { id = item.F_ItemCode, text = item.F_ItemName });
  29. }
  30. return Content(list.ToJson());
  31. }
  32. //[HttpGet]
  33. //[HandlerAjaxOnly]
  34. //public ActionResult GetSelectJsonWH(string keyValue)
  35. //{
  36. // string keyValueCH = string.Empty;
  37. // switch (keyValue)
  38. // {
  39. // case "1": keyValueCH = "仓库类型"; break;
  40. // case "2": keyValueCH = "形状"; break;
  41. // case "3": keyValueCH = "色度"; break;
  42. // case "4": keyValueCH = "净度"; break;
  43. // case "5": keyValueCH = "抛光"; break;
  44. // case "6": keyValueCH = "对称性"; break;
  45. // case "7": keyValueCH = "切工"; break;
  46. // case "8": keyValueCH = "分类"; break;
  47. // }
  48. // //string itemsId = itemsApp.GetForm2(keyValue).F_Id;
  49. // string itemsId = itemsApp.GetForm2(keyValueCH).F_Id;
  50. // var data = itemsDetailApp.GetItemListWH(itemsId);
  51. // List<object> list = new List<object>();
  52. // foreach (ItemsDetailEntity item in data)
  53. // {
  54. // list.Add(new { id = item.F_ItemCode, text = item.F_ItemName });
  55. // }
  56. // return Content(list.ToJson());
  57. //}
  58. [HttpGet]
  59. [HandlerAjaxOnly]
  60. public ActionResult GetFormJson(string keyValue)
  61. {
  62. var data = itemsDetailApp.GetForm(keyValue);
  63. return Content(data.ToJson());
  64. }
  65. [HttpPost]
  66. [HandlerAjaxOnly]
  67. [ValidateAntiForgeryToken]
  68. public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue)
  69. {
  70. itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue);
  71. return Success("操作成功。");
  72. }
  73. [HttpPost]
  74. [HandlerAjaxOnly]
  75. [HandlerAuthorize]
  76. [ValidateAntiForgeryToken]
  77. public ActionResult DeleteForm(string keyValue)
  78. {
  79. itemsDetailApp.DeleteForm(keyValue);
  80. return Success("删除成功。");
  81. }
  82. }
  83. }