EnvironResourceInfo.cshtml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.PagesResourceMgEnvironReMg; //The menu item will be active for this page.
  10. ViewBag.ActiveMenu = activeMenu;
  11. string resourceType = ViewBag.ResourceType;
  12. var searchForm = new SearchFormViewModel(new List<SearchItem>()
  13. {
  14. new SearchItem("resourceName","资源名称"),
  15. new SearchItem("messageCode","消息代码"),
  16. }, "search-form", false);
  17. var table = new TableViewModel(IwbConsts.ApiAppUrl + "EnvironResource/GetAll", activeMenu, searchForm)
  18. .SetFields(new List<FieldItem>()
  19. {
  20. new FieldItem("id", "编码"),
  21. new FieldItem("resourceName", "资源名称"),
  22. new FieldItem("resourceType", "资源类型","ResourceTypeFormatter"),
  23. new FieldItem("messageCode", "消息代码"),
  24. new FieldItem("resourcePath", "资源路径","PathFormatter"),
  25. });
  26. }
  27. @section css{
  28. }
  29. @Html.Partial("Table/_Table", table)
  30. @section modal{
  31. <!--Main Modal-->
  32. @{
  33. var modal = new ModalViewModel("环境资源", new ModalBodyViewModel(new List<Input>()
  34. {
  35. new InputHide("id"),
  36. new Input("resourceName", "资源名称"),
  37. new Input("resourceType", "资源类型").SetSelectOptions(resourceType),
  38. new Input("messageCode", "消息代码"),
  39. new InputFile("resourcePath", "资源路径").SetFileOption("fileInfo","fileName","fileExt"),
  40. new InputTextarea("description", "资源描述").SetNotRequired(),
  41. }));
  42. }
  43. @Html.Partial("Modals/_Modal", modal)
  44. }
  45. @section scripts
  46. {
  47. <script type="text/javascript">
  48. var $table;
  49. $(function () {
  50. $table = LoadTable();
  51. var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
  52. funs["btnCreate"] = function () { BtnCreate({ data: { id: "" } }); }
  53. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  54. });
  55. </script>
  56. <!--格式化-->
  57. <script id="formatter-script" type="text/javascript">
  58. function TypeFormatter(v) {
  59. var name = $('#hid-type option[value="' + v + '"]').text();
  60. switch (v) {
  61. case 0:
  62. return '<span class="label label-danger">' + name + '</span>';
  63. default:
  64. return '<span class="label label-info">' + name + '</span>';
  65. }
  66. }
  67. function ResourceTypeFormatter(v) {
  68. var name = $('#hid-resource-type option[value="' + v + '"]').text();
  69. switch (v) {
  70. case 1:
  71. return '<span class="label label-danger">' + name + '</span>';
  72. case 2:
  73. return '<span class="label label-info">' + name + '</span>';
  74. case 3:
  75. return '<span class="label label-success">' + name + '</span>';
  76. default:
  77. return '<span class="label label-info">' + name + '</span>';
  78. }
  79. }
  80. function PathFormatter(v) {
  81. if (v) {
  82. return '<a class="table-action" href="{0}" target="_blank">查看附件</a>'.format(v);
  83. }
  84. return '暂无附件';
  85. }
  86. </script>
  87. }
  88. <section style="display: none">
  89. <select id="hid-type">
  90. <option value=""></option>
  91. </select>
  92. <select id="hid-resource-type">
  93. @Html.Raw(resourceType)
  94. </select>
  95. @*@Html.DropDownList("hid-type", type)*@
  96. </section>