Index.cshtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. @{
  2. ViewBag.Title = "Index";
  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. @model PageInfo
  11. <div class="row col-lg-12">
  12. <div class="wrapper wrapper-content animated fadeInUp">
  13. <div class="ibox">
  14. <div class="ibox-title">
  15. <h5>发消息</h5>
  16. <div class="ibox-tools rboor">
  17. <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i>发送消息</a>
  18. </div>
  19. </div>
  20. <div class="ibox-content">
  21. <!-- search star -->
  22. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  23. {
  24. <div class="form-horizontal clearfix">
  25. <div class="col-lg-4 col-sm-3 pl0" style="width:50%;">
  26. <div class="form-group">
  27. <label class="control-label" style="width:100px; float:left;">消息类型:</label>
  28. <div class="col-lg-8 col-sm-7">
  29. <select id="msgtype" name="msgtype" class="input-sm form-control input-s-sm inline" style="width:180px;" onchange="submit()">
  30. <option value="" @(ViewData["msgtype"].ToString() == "" ? "selected" : "")>全部</option>
  31. @{
  32. foreach (var item in ViewData["msgtypelist"] as List<SYS_CODE>)
  33. {
  34. <option value="@item.CODEVALUE" @(item.CODEVALUE == ViewData["msgtype"].ToString() ? "selected" : "")>@item.NAMETEXT</option>
  35. }
  36. }
  37. </select>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="form-group col-sm-4" style="float:right;">
  42. <div class="col-sm-12 input-group">
  43. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  44. <span class="input-group-btn">
  45. <button type="submit" class="btn btn-sm btn-primary" onclick="submit()"> 搜索</button>
  46. </span>
  47. </div>
  48. </div>
  49. </div>
  50. <!-- search end -->
  51. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  52. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  53. <thead>
  54. <tr>
  55. <th style="width:100px !important;">消息类型</th>
  56. <th>标题</th>
  57. <th style="width:200px !important;">接收人</th>
  58. <th style="width:150px !important;">发送时间</th>
  59. <th style="width:70px !important;">操作</th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. @{foreach (var item in Model.List)
  64. {
  65. <tr>
  66. <td>@item.MSGTYPE</td>
  67. <td style="text-align:left" title="@item.MSGNAME"><a href="javascript:show('@item.ID')"> @item.MSGNAME</a></td>
  68. <td style="text-align:left;">
  69. @{
  70. string per = item.READUSER;
  71. string res = string.Empty;
  72. if (!string.IsNullOrEmpty(per))
  73. {
  74. for (int i = 0; i < per.Split(',').Length; i++)
  75. {
  76. if (per.Split(',')[i].ToString().Split('|')[0] == "0")
  77. {
  78. res += " <i class=\"im-envelop3\" style=\"color:#f0ad4e;\"></i>";
  79. }
  80. else
  81. {
  82. res += " <i class=\"im-envelop-opened\" style=\"color:#1ab394;\"></i>";
  83. }
  84. res += per.Split(',')[i].ToString().Split('|')[1];
  85. }
  86. }
  87. @Html.Raw(res);
  88. }
  89. </td>
  90. <td>@item.CREATEDATE</td>
  91. <td><a href="javascript:transpond('@item.ID')"> [转发]</a></td>
  92. </tr>
  93. }
  94. }
  95. </tbody>
  96. </table>
  97. <!-- page -->
  98. <div class="bottom">
  99. <div class="dataTables_info" id="example_info" post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  100. <div class="dataTables_length" id="example_length">
  101. <label>
  102. 显示
  103. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  104. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  105. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  106. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  107. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  108. </select> 项结果
  109. </label>
  110. </div>
  111. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url)
  112. <div class="clear"></div>
  113. </div>
  114. <!-- page -->
  115. </div>
  116. }
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. @section scripts{
  122. <script type="text/javascript">
  123. //点击详情
  124. function show(n) {
  125. dig.addModel('消息详情', '/Sys/Msg/Show/' + n, 900, 500, function () { });
  126. }
  127. //点击转发
  128. function transpond(n) {
  129. window.location.href = "/Sys/Msg/Transpond/" + n;
  130. }
  131. $(function () {
  132. //添加
  133. $('#insert').click(function () {
  134. dig.addModel('发送消息', '/Sys/Msg/Detail/', 900, 500, function () {
  135. var retval = this.returnValue;
  136. if (retval!='' && retval!='no') {
  137. window.location.reload();
  138. }
  139. });
  140. });
  141. });
  142. </script>
  143. }