Index - bak.cshtml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. @{
  2. ViewBag.Title = "公告列表";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. @using MES.Production.Service;
  6. @using Central.Control.Domain;
  7. @using Ant.Service.Common;
  8. @using Ant.Service.Common.Enums;
  9. @using CommonToolHelper;
  10. @using MES.Production.Entity;
  11. @model PageInfo
  12. <!-- table star -->
  13. <div class="row col-lg-12">
  14. <div class="wrapper wrapper-content animated fadeInUp">
  15. <div class="ibox">
  16. <div class="ibox-title">
  17. <h5>公告管理</h5>
  18. <div class="ibox-tools rboor">
  19. <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i> 创建公告</a>
  20. <a class="btn btn-primary btn-xs p310" id="modify" action="edit"><i class="im-pencil2"></i> 编辑公告</a>
  21. <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
  22. </div>
  23. </div>
  24. <div class="ibox-content">
  25. <!-- search star -->
  26. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  27. {
  28. <div class="form-horizontal clearfix">
  29. @*<div class="col-lg-4 col-sm-3 pl0" style="width:55%;">
  30. <div class="form-group">
  31. <div class="col-lg-8 col-sm-7" style="width:280px !important;">
  32. <select id="FK_DPTID" name="FK_DPTID" class="form-control select2" style="width:280px !important;" onchange="submit()">
  33. @{
  34. var department = ViewData["Department"] as dynamic;
  35. foreach (var item in department)
  36. {
  37. <option value="@item.id" @(ViewData["dptid"] != null && ViewData["dptid"].ToString() != "" && ViewData["dptid"].ToString() == item.id ? "selected" : "")>@CommonHtmlHelper.RtfTextToHtml(item.name)</option>
  38. }
  39. }
  40. </select>
  41. </div>
  42. </div>
  43. </div>*@
  44. <div class="col-lg-4 col-sm-4" style="float:right;">
  45. <div class="form-group">
  46. <div class="col-lg-12 col-sm-12 input-group" style="width:60%; float:right;">
  47. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询公告名称" })
  48. <span class="input-group-btn">
  49. <button type="button" onclick="submit()" class="btn btn-sm btn-primary">搜索</button>
  50. </span>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <!-- search end -->
  56. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  57. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  58. <thead>
  59. <tr>
  60. <th class="tn" style="width: 40px !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  61. <th>标题</th>
  62. <th>内容</th>
  63. <th>类型</th>
  64. <th>发送对象</th>
  65. <th style="width: 100px !important">创建者</th>
  66. <th style="width: 170px !important">创建时间</th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. @if (Model != null)
  71. {
  72. foreach (var item in Model.List)
  73. {
  74. <tr>
  75. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
  76. <td style="text-align:left">
  77. <a href="javascript:modify('@item.ID')" listaction="detail">@item.Title</a>
  78. </td>
  79. <td style="text-align:left">@(new HtmlString(item.Content))</td>
  80. <td>@((item.Noticetype == 1) ? "文字消息" : "图文消息")</td>
  81. <td>@CommonHtmlHelper.getRolse(item.RoleId)</td>
  82. <td>@item.createper</td>
  83. <td>@item.createDate</td>
  84. </tr>
  85. }
  86. }
  87. </tbody>
  88. </table>
  89. <!-- page -->
  90. <div class="bottom">
  91. @if (Model != null)
  92. {
  93. <div class="dataTables_info" id="example_info" Post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  94. <div class="dataTables_length" id="example_length">
  95. <label>
  96. 显示
  97. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  98. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  99. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  100. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  101. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  102. </select> 项结果
  103. </label>
  104. </div>
  105. CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url);
  106. }
  107. <div class="clear"></div>
  108. </div>
  109. <!-- page -->
  110. </div>
  111. }
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <!-- table end -->
  117. @section scripts{
  118. <script type="text/javascript">
  119. //点击修改
  120. function modify(n) {
  121. dig.addModel('添加/编辑公告', '/Sys/Notice/Detail/' + n, 700, 600, function () {
  122. if (this.returnValue == 'yes') {
  123. location.reload();
  124. }
  125. });
  126. }
  127. $(function () {
  128. $('.select2').select2();
  129. //添加
  130. $('#insert').click(function () {
  131. dig.addModel('添加/编辑公告', '/Sys/Notice/Detail', 700, 600, function () {
  132. if (this.returnValue == 'yes') {
  133. location.reload();
  134. }
  135. });
  136. });
  137. //修改
  138. $('#modify').click(function () {
  139. var vals = '';
  140. var num = 0;
  141. $('input[name="checkbox_name"]:checked').each(function () {
  142. vals = $(this).val();
  143. num++;
  144. });
  145. if (!vals) {
  146. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  147. return;
  148. }
  149. if (num > 1) {
  150. dig.alertError("提示", "对不起,每次只能修改一条记录!");
  151. return;
  152. }
  153. dig.addModel('添加/编辑公告', '/Sys/Notice/Detail/' + vals, 700, 600, function () {
  154. if (this.returnValue == 'yes') {
  155. location.reload();
  156. }
  157. });
  158. });
  159. });
  160. </script>
  161. }