Help.cshtml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. @using VberAdmin.Web.Models.Input
  2. @using VberAdmin.Web.Models.Modals
  3. @using VberAdmin.Web.Models.Search
  4. @using VberAdmin.Web.Models.Table
  5. @using VberZero
  6. @using VberZero.Tools.StringModel
  7. @{
  8. string activeMenu = PermissionNames.VberSystemMgHelpMg; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. string helpType = ViewBag.HelpType, menus = ViewBag.FunctionMenu;
  11. }
  12. @{
  13. /**/
  14. ViewBag.Title = "系统帮助管理";
  15. var table = new VmTable(VzConsts.ApiAppUrl + "Help/GetAll", activeMenu, new VmSearch(new List<VmSearchItem>()
  16. {
  17. new VmSearchItem("helpType", "帮助类别").WithExpType(EType.Equal).WithSelect(helpType)
  18. })).AddItems(new List<VmTableItem>()
  19. {
  20. new VmTableItem("title", "标题"),
  21. new VmTableItem("keyWords", "关键字信息"),
  22. new VmTableItem("helpType", "帮助类别", "HelpTypeFormatter"),
  23. new VmTableItem("functionDisplayName", "功能菜单"),
  24. new VmTableItem("sequence", "排序"),
  25. });
  26. var modalBody = new VmModalBody()
  27. .AddInputs(new List<VmInputBase>
  28. {
  29. new VmInputHidden("id"),
  30. })
  31. .AddGroup(new List<VmInputBase>
  32. {
  33. new VmInput("title", "标题").WithRequired(),
  34. new VmInput("keyWords", "关键字").WithRequired(),
  35. new VmInputNumber("sequence", "序列").WithRequired(),
  36. })
  37. .AddGroup(new List<VmInputBase>
  38. {
  39. new VmInput("helpType", "帮助类别").WithSelect(helpType).WithRequired(),
  40. new VmInput("functionNo", "功能菜单").WithSelect(menus,isTree:true).WithRequired(),
  41. })
  42. .AddInput(new VmInputWangEditor("content", "帮助内容"));
  43. /*.AddGroup(new VmInputGroup().WithAverage(2).AddInputs(new List<VmInputBase>
  44. {
  45. }));*/
  46. var modal = new VmModal().WithHeaderAndFooter("帮助", "").WithBody(modalBody);
  47. }
  48. @await Html.PartialAsync("_Table", table)
  49. @await Html.PartialAsync("_Modal", modal)
  50. @section scripts
  51. {
  52. <script type="text/javascript">
  53. $(function () {
  54. var $table = $('#table');
  55. var funs = LoadTable();
  56. funs["btnCreate"] = function(url) {
  57. BtnCreate({
  58. url: url,
  59. data: { helpType: "@(VzDefinition.HelpType.System.ToStr())"}
  60. });
  61. };
  62. funs["btnUpdate"] = function(url) {
  63. var row = $table.VbTable("getSelection");
  64. if (row) {
  65. $.vbAjax4({
  66. url: abp.appUrl + "Query/QueryHelpDto?id=" + row.id,
  67. success: function(data) {
  68. BtnUpdate({
  69. url: url
  70. },
  71. data);
  72. }
  73. });
  74. }
  75. };
  76. });
  77. </script>
  78. <script>
  79. function HelpTypeFormatter(v) {
  80. var name = $('#hid-helpType option[value="' + v + '"]').text();
  81. switch (v) {
  82. case @(VzDefinition.HelpType.System.ToInt()):
  83. return '<span class="badge badge-light-danger">' + name + '</span>';
  84. case @(VzDefinition.HelpType.Business.ToInt()):
  85. return '<span class="badge badge-light-success">' + name + '</span>';
  86. case @(VzDefinition.HelpType.Instructions.ToInt()):
  87. return '<span class="badge badge-light-primary">' + name + '</span>';
  88. default:
  89. break;
  90. }
  91. return v;
  92. }
  93. </script>
  94. }
  95. <section style="display: none">
  96. <select id="hid-helpType">@Html.Raw(helpType)</select>
  97. </section>