Prompt.cshtml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. @using WePlatform
  2. @using WePlatform.Configuration
  3. @using WePlatform.Authorization
  4. @using WePlatform.Views.Shared.Modals
  5. @using WePlatform.Views.Shared.SearchForm
  6. @using WePlatform.Views.Shared.Table
  7. @{
  8. ViewBag.Title = "引导信息库管理";
  9. string activeMenu = PermissionNames.PagesResourceMgGuideMgPromptMg;
  10. string guideType = ViewBag.GuideType;
  11. ViewBag.ActiveMenu = activeMenu;
  12. var searchForm = new SearchFormViewModel(new List<SearchItem>()
  13. {
  14. new SearchItem("name","提示名称"),
  15. new SearchItem("guideType","提示类型",FieldType.I).SetSelectItem(guideType),
  16. }, "search-form", false);
  17. var table = new TableViewModel(IwbConsts.ApiAppUrl + "Prompt/GetAll", activeMenu, searchForm)
  18. .SetFields(new List<FieldItem>()
  19. {
  20. new FieldItem("id", "编码"),
  21. new FieldItem("name", "提示名称"),
  22. new FieldItem("description", "提示详情"),
  23. new FieldItem("guideType", "提示类型","GuideTypeFormatter"),
  24. });
  25. }
  26. @section css{
  27. }
  28. @Html.Partial("Table/_Table", table)
  29. @section modal{
  30. <!--Main Modal-->
  31. @{
  32. var modal = new ModalViewModel("引导信息", new ModalBodyViewModel(new List<Input>()
  33. {
  34. new InputHide("id"),
  35. new Input("name", "提示名称").SetNotRequired(),
  36. new Input("guideType", "提示类型").SetNotRequired().SetSelectOptions(guideType),
  37. new InputTextarea("description", "提示详情").SetNotRequired(),
  38. }));
  39. }
  40. @Html.Partial("Modals/_Modal", modal)
  41. }
  42. @section scripts
  43. {
  44. <script type="text/javascript">
  45. var $table;
  46. $(function () {
  47. $table = LoadTable();
  48. var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
  49. funs["btnCreate"] = function () { BtnCreate({ data: { id: "" } }); }
  50. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  51. });
  52. </script>
  53. <!--格式化-->
  54. <script id="formatter-script" type="text/javascript">
  55. function TypeFormatter(v) {
  56. var name = $('#hid-type option[value="' + v + '"]').text();
  57. switch (v) {
  58. case 0:
  59. return '<span class="label label-danger">' + name + '</span>';
  60. default:
  61. return '<span class="label label-info">' + name + '</span>';
  62. }
  63. }
  64. function GuideTypeFormatter(v) {
  65. var name = $('#hid-guideType option[value="' + v + '"]').text();
  66. switch (v) {
  67. case 0:
  68. return '<span class="label label-danger">' + name + '</span>';
  69. default:
  70. return '<span class="label label-info">' + name + '</span>';
  71. }
  72. }
  73. </script>
  74. }
  75. <section style="display: none">
  76. <select id="hid-type">
  77. <option value=""></option>
  78. </select>
  79. <select id="hid-guideType">
  80. @Html.Raw(guideType)
  81. </select>
  82. @*@Html.DropDownList("hid-type", type)*@
  83. </section>