Create.cshtml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @using Hospital.Core.Dict
  2. @model Hospital.Model.Models.Q_Roles
  3. @{
  4. ViewBag.Title = "新建角色";
  5. }
  6. @section head
  7. {
  8. @Styles.Render("~/Content/css/select2")
  9. }
  10. <div class="page-header">
  11. <h3>
  12. @if (ViewBag.Logo != null)
  13. {
  14. <img src="@ViewBag.Logo" id="logoImg" style="margin:0px 5px 5px 0px;" />
  15. }
  16. <i class="fa fa-sitemap"></i> @ViewBag.Title
  17. <a href="@Url.Action("Index", "Roles")" class='backbutton'><i class="icon-white fa fa-arrow-circle-left"></i>返回</a>
  18. </h3>
  19. </div>
  20. @using (Html.BeginForm("Create", "Roles", new { @returnUrl = Request.QueryString["returnUrl"] }, FormMethod.Post, new { name = "myform", id = "myform" }))
  21. {
  22. <div class="form-horizontal">
  23. <div class="control-group">
  24. @Html.LabelFor(m => m.RolesName, new { @class = "control-label", @style = "width:100px;" })
  25. <div class="controls" style="margin-left:10px;">
  26. @Html.TextBoxFor(m => m.RolesName, new { @class = "span2", @style = "width:350px;" })
  27. @Html.ValidationMessageFor(m => m.RolesName)
  28. </div>
  29. </div>
  30. <div class="control-group">
  31. @Html.LabelFor(m => m.RolesDescription, new { @class = "control-label", @style = "width:100px;" })
  32. <div class="controls" style="margin-left:10px;">
  33. @Html.TextBoxFor(m => m.RolesDescription, new { @class = "span2", @style = "width:350px;" })
  34. </div>
  35. </div>
  36. <div class="control-group">
  37. @Html.LabelFor(m => m.QuanxianChar, new { @class = "control-label", @style = "width:100px;" })
  38. <div class="controls" style="margin-left:10px;">
  39. @Html.ListBoxFor(m => m.QuanxianChar, Hospital.Controllers.RolesController.GetAllStaticQuanxianList(), new { @style = "width:365px;" })
  40. <span id="quanxianValidateMessage" style="color:red;"></span>
  41. </div>
  42. </div>
  43. </div>
  44. }
  45. <div class="form-actions">
  46. <div style="margin-left:100px;">
  47. <button type="submit" class="btn btn-primary btnSubmit">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
  48. <a href="@(Request.QueryString["returnUrl"] == null ? Url.Action("Index") : HttpUtility.UrlEncode(Request.QueryString["returnUrl"]))" class="btn">返回</a>
  49. </div>
  50. </div>
  51. @section scripts{
  52. @Scripts.Render("~/bundles/jquery/multiselect")
  53. <script type="text/javascript">
  54. $("#QuanxianChar").multiselect();
  55. $(".btnSubmit").click(function () {
  56. $("#quanxianValidateMessage").empty();
  57. if ($("#QuanxianChar").val() == null) {
  58. $("#quanxianValidateMessage").append("请选择");
  59. } else {
  60. $("#myform").submit();
  61. }
  62. });
  63. </script>
  64. }