ShortMsgMg.cshtml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. @using ShwasherSys.Authorization.Permissions
  2. @using ShwasherSys.Models.Layout
  3. @using ShwasherSys.Models.Modal
  4. @{
  5. /**/
  6. ViewBag.ActiveMenu = PermissionNames.PagesNotificationInfoShortMsgMg; //The menu item will be active for this page.
  7. ViewBag.Title = "短消息管理";
  8. }
  9. @section css
  10. {
  11. <link rel="stylesheet" href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker-wr.css" />
  12. <link href="~/Content/Plugins/kindeditor/themes/default/default.css" rel="stylesheet" />
  13. }
  14. <div class="table-box mr-4 iwb-bootstrap-table">
  15. <input type="hidden" id="IsLock" value="N" />
  16. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu })
  17. <table id="table"
  18. data-url="/api/services/app/ShortMsgDetail/GetAllByUser"
  19. data-striped="true" data-id-field="id" data-unique-id="id"
  20. data-method="post"
  21. data-side-pagination="server"
  22. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  23. data-cache="false"
  24. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  25. data-query-params="QueryParams"
  26. data-response-handler="ResponseHandler"
  27. data-click-to-select="true"
  28. data-single-select="false">
  29. <thead>
  30. <tr class="row" id="header">
  31. <th data-field="state" data-checkbox="true"></th>
  32. <th data-align="center" data-field="isRead" data-formatter="IsReadFormatter">是否已读</th>
  33. <th data-align="center" data-field="content">消息</th>
  34. <th data-align="center" data-field="sendUserID">发送人</th>
  35. <th data-align="center" data-field="sendTime">发送时间</th>
  36. <th data-align="center" data-formatter="ActionFormatter"></th>
  37. </tr>
  38. </thead>
  39. </table>
  40. </div>
  41. @section modal{
  42. <section>
  43. <!--Main Modal-->
  44. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  45. <div class="modal-dialog modal-dialog-centered" role="document">
  46. <div class="modal-content">
  47. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("通知"))
  48. @{
  49. var inputs = new List<InputViewModel>
  50. {
  51. new InputViewModel("id", hide: true),
  52. new InputViewModel("sendUserID",InputTypes.List, displayName: "发信人"),
  53. new InputViewModel("sendTime", displayName: "发送时间"),
  54. new InputViewModel("content",InputTypes.Textarea, displayName: "内容")
  55. };
  56. }
  57. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  58. <button type="button" class="btn btn-default waves-effect" data-dismiss="modal" style="min-width:100px;background: #FFFFFF;border: 1px solid #DDDDDD;" onclick="$('#modal').modal('hide')">取消</button>
  59. </div>
  60. </div>
  61. </div>
  62. </section>
  63. }
  64. @section scripts
  65. {
  66. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  67. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  68. <script src="~/Content/Plugins/kindeditor/kindeditor-all.js"></script>
  69. <script src="~/Content/Plugins/kindeditor/lang/zh-CN.js"></script>
  70. <script type="text/javascript">
  71. $(function () {
  72. //show完毕前执行
  73. LoadTable();
  74. var funs = window.funs || { none: function () { console.log("No type"); } };
  75. //funs["btnUpdate"] = function () { BtnUpdate({ readonly: "standardName" }); };
  76. funs["btnUpdate"] = function() {
  77. var rows = config.table.bootstrapTable("getSelections");
  78. if (rows.length === 1) {
  79. BtnUpdate({ readonly: "sendUserID,content,sendTime", data: { sendUserID: rows[0].sendUserID, sendTime: rows[0].sendTime, content: rows[0].content} });
  80. }
  81. };
  82. funs["btnSetRead"] = function() {
  83. var rows = config.table.bootstrapTable("getSelections");
  84. var ids = '';
  85. rows.forEach(function(v, i) {
  86. ids += v.id + ',';
  87. });
  88. SaveAjax({
  89. url: window.appUrl + 'ShortMsgDetail/SetRead',
  90. data: { Id: ids },
  91. isAlert: false,
  92. isValidate: false,
  93. success: function(res) {
  94. RefreshTable();
  95. }
  96. });
  97. }
  98. funs["btnDelete"] = function () {
  99. abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"), abp.localization.localize("DeleteConfirmTitle"),function() {
  100. var rows = config.table.bootstrapTable("getSelections");
  101. var ids = '';
  102. rows.forEach(function(v, i) {
  103. ids += v.id + ',';
  104. });
  105. SaveAjax({
  106. url: window.appUrl + 'ShortMsgDetail/BatchDelete',
  107. data: { Id: ids },
  108. isAlert: false,
  109. isValidate: false,
  110. success: function(res) {
  111. RefreshTable();
  112. }
  113. });
  114. });
  115. }
  116. });
  117. function IsReadFormatter(v, r) {
  118. if (r.isRead==="Y") {
  119. return '<span class="label label-primary">已读</span>';
  120. }
  121. return '<span class="label label-info">未读</span>';
  122. }
  123. function ActionFormatter(v, r) {
  124. if (r.isRead==="N") {
  125. return '<span class="table-action" onclick="ChangeStatus(' +
  126. r.id +
  127. ')"><i class="iconfont icon-right"></i>已读</span>';
  128. }
  129. return '';
  130. }
  131. function ChangeStatus(id) {
  132. SaveAjax({
  133. url: window.appUrl + "ShortMsgDetail/ChangeIsRead",
  134. data: { Id: id },
  135. isAlert: false,
  136. isValidate: false,
  137. success: function(res) {
  138. if (res) {
  139. RefreshTable();
  140. }
  141. }
  142. });
  143. }
  144. </script>
  145. }