PortraitRemark.cshtml 2.9 KB

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