CampGroup.cshtml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.PagesTrainMgGroupMg;
  10. ViewBag.ActiveMenu = PermissionNames.PagesTrainMgCampMg;
  11. string campNo = ViewBag.CampNo, state = ViewBag.State;
  12. var searchForm = new SearchFormViewModel(new List<SearchItem>()
  13. {
  14. },"search-form",false);
  15. var table = new TableViewModel(IwbConsts.ApiAppUrl + "CampGroup/GetAll", activeMenu, searchForm)
  16. .SetFields(new List<FieldItem>()
  17. {
  18. new FieldItem("name", "分组名称"),
  19. new FieldItem("campName", "培训营"),
  20. new FieldItem("campGroupState", "培训营分组状态","StateFormatter"),
  21. new FieldItem("startDate", "开始时间","DateTimeFormatter"),
  22. new FieldItem("engDate", "结束时间","DateTimeFormatter"),
  23. new FieldItem("trainingMinute", "演练时长"),
  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 InputHide("campNo"),
  36. new Input("name", "分组名称"),
  37. }));
  38. }
  39. @Html.Partial("Modals/_Modal", modal)
  40. }
  41. @section scripts
  42. {
  43. <script type="text/javascript">
  44. var $table,campNo='@(campNo)';
  45. $(function () {
  46. $table = LoadTable({
  47. searchList: [{KeyWords: campNo,KeyField: 'campNo',FieldType: '0',ExpType: '0'}]
  48. });
  49. var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
  50. funs["btnCreate"] = function () { BtnCreate({ data: { id: "", campNo: campNo } }); }
  51. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  52. });
  53. </script>
  54. <!--格式化-->
  55. <script id="formatter-script" type="text/javascript">
  56. function TypeFormatter(v) {
  57. var name = $('#hid-type option[value="' + v + '"]').text();
  58. switch (v) {
  59. case 0:
  60. return '<span class="label label-danger">' + name +'</span>';
  61. default:
  62. return '<span class="label label-info">' + name +'</span>';
  63. }
  64. }
  65. function StateFormatter(v) {
  66. var name = $('#hid-state option[value="' + v + '"]').text();
  67. switch (v) {
  68. case @(CampGroupStateDefinition.New):
  69. return '<span class="label label-info">' + name + '</span>';
  70. case @(CampGroupStateDefinition.Run):
  71. return '<span class="label label-iwb">' + name + '</span>';
  72. case @(CampGroupStateDefinition.Error):
  73. case @(CampGroupStateDefinition.End):
  74. return '<span class="label label-danger">' + name + '</span>';
  75. default:
  76. return '<span class="label label-warning">其他</span>';
  77. }
  78. }
  79. </script>
  80. }
  81. <section style="display: none">
  82. <select id="hid-type">
  83. <option value=""></option>
  84. </select>
  85. <select id="hid-state">
  86. @(Html.Raw(state))
  87. </select>
  88. @*@Html.DropDownList("hid-type", type)*@
  89. </section>