Supply.cshtml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. @using WePlatform.Configuration
  2. @using WePlatform.Authorization
  3. @using WePlatform.Views.Shared.Modals
  4. @using WePlatform.Views.Shared.SearchForm
  5. @using WePlatform.Views.Shared.Table
  6. @{
  7. ViewBag.Title = "应急物资库管理";
  8. string activeMenu = PermissionNames.PagesResourceMgGuideMgSupplyMg; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. var searchForm = new SearchFormViewModel(new List<SearchItem>
  11. {
  12. new SearchItem("name", "名称"),
  13. });
  14. var table = new TableViewModel(IwbConsts.ApiAppUrl + "Supply/GetAll", activeMenu, searchForm)
  15. .SetFields(new List<FieldItem>()
  16. {
  17. new FieldItem("name", "名称"),
  18. new FieldItem("quantity", "数量"),
  19. });
  20. }
  21. @section css{
  22. }
  23. @Html.Partial("Table/_Table", table)
  24. @section modal{
  25. <!--Main Modal-->
  26. @{
  27. var modal = new ModalViewModel("应急物资", new ModalBodyViewModel(new List<Input>()
  28. {
  29. new InputHide("id"),
  30. new Input("name", "名称"),
  31. new InputNumber("quantity", "数量").SetMin(0),
  32. new InputTextarea("description", "描述").SetNotRequired(),
  33. }));
  34. }
  35. @Html.Partial("Modals/_Modal", modal)
  36. }
  37. @section scripts
  38. {
  39. <script type="text/javascript">
  40. var $table;
  41. $(function () {
  42. $table = LoadTable();
  43. var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
  44. funs["btnCreate"] = function () { BtnCreate({ data: { id: "" } }); }
  45. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  46. });
  47. </script>
  48. <!--格式化-->
  49. <script id="formatter-script" type="text/javascript">
  50. function TypeFormatter(v) {
  51. var name = $('#hid-type option[value="' + v + '"]').text();
  52. switch (v) {
  53. case 0:
  54. return '<span class="label label-danger">' + name + '</span>';
  55. default:
  56. return '<span class="label label-info">' + name + '</span>';
  57. }
  58. }
  59. </script>
  60. }
  61. <section style="display: none">
  62. <select id="hid-type">
  63. <option value=""></option>
  64. </select>
  65. @*@Html.DropDownList("hid-type", type)*@
  66. </section>