Index.cshtml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. @{
  2. ViewBag.Title = "模块管理";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. @model dynamic
  6. <!-- table star -->
  7. <div class="row col-lg-12">
  8. <div class="wrapper wrapper-content animated fadeInUp">
  9. <div class="ibox">
  10. <div class="ibox-title">
  11. <h5>所有模块</h5>
  12. <div class="ibox-tools rboor">
  13. <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i> 创建新模块</a>
  14. <a class="btn btn-primary btn-xs p310" id="modify" action="edit"><i class="im-pencil2"></i> 编辑</a>
  15. <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
  16. </div>
  17. </div>
  18. <div class="ibox-content">
  19. <!-- search star -->
  20. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  21. {
  22. <div class="form-horizontal clearfix">
  23. <div class="col-lg-4 col-sm-3 pl0" style="width:50%;">
  24. <div class="form-group">
  25. <label class="control-label" style="width:70px; float:left;">系统:</label>
  26. <div class="col-lg-8 col-sm-7" style="width:300px !important;">
  27. <select id="System" name="System" class="select2-container form-control select2" style="width:100%;" onchange="submit()">
  28. <option value="" @(ViewData["System"] == null ? "selected=\"selected\"" : "")>全部</option>
  29. @{
  30. foreach (var item in ViewData["Systemlist"] as dynamic)
  31. {
  32. <option value="@item.ID" @(ViewData["System"] != null && ViewData["System"].ToString() != "" && ViewData["System"].ToString() == item.ID ? "selected=\"selected\"" : "")>@item.NAME</option>
  33. }
  34. }
  35. </select>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="col-lg-4 col-sm-4" style="float:right;">
  40. <div class="form-group">
  41. <div class="col-lg-12 col-sm-12 input-group">
  42. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  43. <span class="input-group-btn">
  44. <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
  45. </span>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. }
  51. <!-- search end -->
  52. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  53. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  54. <thead>
  55. <tr>
  56. <th class="tn" style="width: 50px !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  57. <th>所属系统</th>
  58. <th>模块名称</th>
  59. <th style="width: 100px !important;">模块别名</th>
  60. <th style="width:100px !important;">模块类型</th>
  61. <th>模块地址</th>
  62. <th style="width: 100px !important;">状态/顺序</th>
  63. <th style="width: 120px !important;">操作</th>
  64. </tr>
  65. </thead>
  66. <tbody>
  67. @{foreach (var item in Model)
  68. {
  69. <tr>
  70. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
  71. <td>@item.SYSNAME</td>
  72. <td style="text-align:left">
  73. <a href="javascript:EditModule('@item.ID')" listaction="detail"><i class="@item.ICON"></i> @HttpUtility.HtmlDecode(item.MODULENAME)</a>
  74. </td>
  75. <td>@item.ALIAS</td>
  76. <td>@item.MODULETYPE</td>
  77. <td>@item.MODULEPATH</td>
  78. <td>@item.ISSHOW/@item.SHOWORDER</td>
  79. <td style="text-align:center;">
  80. <a href="javascript:AddChild('@item.ID','@item.FK_BELONGSYSTEM')" listaction="addchild" class="text-navy" title="添加子模块">[添加子模块]</a>
  81. </td>
  82. </tr>
  83. }
  84. }
  85. </tbody>
  86. </table>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <!-- table end -->
  93. @section scripts{
  94. <script type="text/javascript">
  95. //列表增加
  96. $("#insert").click(function () {
  97. dig.addModel("添加/编辑模块", "/Sys/Module/detail", 700, 450, function () {
  98. if (this.returnValue == 'yes') {
  99. location.reload();
  100. }
  101. });
  102. });
  103. //添加子模块
  104. function AddChild(n,e) {
  105. dig.addModel("添加/编辑模块", "/Sys/Module/detail?parentId=" + n + "&sys=" + e, 700, 450, function () {
  106. if (this.returnValue == 'yes') {
  107. location.reload();
  108. }
  109. });
  110. }
  111. //跳转修改
  112. function EditModule(n) {
  113. dig.addModel("添加/编辑模块", "/Sys/Module/detail/" + n, 700, 450, function () {
  114. if (this.returnValue == 'yes') {
  115. location.reload();
  116. }
  117. });
  118. }
  119. //列表选择修改
  120. $('#modify').click(function () {
  121. var vals = '';
  122. var num = 0;
  123. $('input[name="checkbox_name"]:checked').each(function () {
  124. vals = $(this).val();
  125. num++;
  126. });
  127. if (!vals) {
  128. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  129. return;
  130. }
  131. if (num > 1) {
  132. dig.alertError("提示", "对不起,每次只能修改一条记录!");
  133. return;
  134. }
  135. dig.addModel("添加/编辑模块", "/Sys/Module/detail/" + vals, 700, 450, function () {
  136. if (this.returnValue == 'yes') {
  137. location.reload();
  138. }
  139. });
  140. });
  141. $(function () { $('.select2').select2(); $('.ibox-content').css('height', $(window).height() - 60).css('overflow', 'auto'); });
  142. </script>
  143. }