ShortMsgMg.cshtml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. @*<button type="button" onclick="createNotice()">测试</button>*@
  15. <div class="table-box mr-4 iwb-bootstrap-table">
  16. <input type="hidden" id="IsLock" value="N"/>
  17. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu })
  18. <table id="table"
  19. data-url="/api/services/app/ShortMsgDetail/GetAllByUser"
  20. data-striped="true" data-id-field="id" data-unique-id="id"
  21. data-method="post"
  22. data-side-pagination="server"
  23. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  24. data-cache="false"
  25. 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"
  26. data-query-params="QueryParams"
  27. data-response-handler="ResponseHandler"
  28. data-click-to-select="true"
  29. data-single-select="false">
  30. <thead>
  31. <tr class="row" id="header">
  32. <th data-field="state" data-checkbox="true"></th>
  33. <th data-align="center" data-field="isRead" data-formatter="IsReadFormatter">是否已读</th>
  34. <th data-align="center" data-field="content">消息</th>
  35. <th data-align="center" data-field="sendUserID">发送人</th>
  36. <th data-align="center" data-field="sendTime">发送时间</th>
  37. <th data-align="center" data-formatter="ActionFormatter"></th>
  38. </tr>
  39. </thead>
  40. </table>
  41. </div>
  42. @section modal{
  43. <section>
  44. <!--Main Modal-->
  45. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  46. <div class="modal-dialog modal-dialog-centered" role="document">
  47. <div class="modal-content">
  48. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("通知"))
  49. @{
  50. var inputs = new List<InputViewModel>
  51. {
  52. new InputViewModel("id", hide: true),
  53. new InputViewModel("sendUserID",InputTypes.List, displayName: "发信人"),
  54. new InputViewModel("sendTime", displayName: "发送时间"),
  55. new InputViewModel("content",InputTypes.Textarea, displayName: "内容")
  56. };
  57. }
  58. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  59. <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>
  60. </div>
  61. </div>
  62. </div>
  63. </section>
  64. }
  65. @section scripts
  66. {
  67. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  68. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  69. <script src="~/Content/Plugins/kindeditor/kindeditor-all.js"></script>
  70. <script src="~/Content/Plugins/kindeditor/lang/zh-CN.js"></script>
  71. <script type="text/javascript">
  72. $(function () {
  73. //show完毕前执行
  74. LoadTable();
  75. var funs = window.funs || { none: function () { console.log("No type"); } };
  76. //funs["btnUpdate"] = function () { BtnUpdate({ readonly: "standardName" }); };
  77. funs["btnUpdate"] = function() {
  78. var rows = config.table.bootstrapTable("getSelections");
  79. if (rows.length === 1) {
  80. BtnUpdate({ readonly: "sendUserID,content,sendTime", data: { sendUserID: rows[0].sendUserID, sendTime: rows[0].sendTime, content: rows[0].content} });
  81. }
  82. };
  83. funs["btnSetRead"] = function() {
  84. var rows = config.table.bootstrapTable("getSelections");
  85. var ids = '';
  86. rows.forEach(function(v, i) {
  87. ids += v.id + ',';
  88. });
  89. SaveAjax({
  90. url: window.appUrl + 'ShortMsgDetail/SetRead',
  91. data: { Id: ids },
  92. isAlert: false,
  93. isValidate: false,
  94. success: function(res) {
  95. RefreshTable();
  96. }
  97. });
  98. }
  99. funs["btnDelete"] = function () {
  100. abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"), abp.localization.localize("DeleteConfirmTitle"),function() {
  101. var rows = config.table.bootstrapTable("getSelections");
  102. var ids = '';
  103. rows.forEach(function(v, i) {
  104. ids += v.id + ',';
  105. });
  106. SaveAjax({
  107. url: window.appUrl + 'ShortMsgDetail/BatchDelete',
  108. data: { Id: ids },
  109. isAlert: false,
  110. isValidate: false,
  111. success: function(res) {
  112. RefreshTable();
  113. }
  114. });
  115. });
  116. }
  117. });
  118. //function createNotice() {
  119. // SaveAjax({
  120. // url: window.appUrl + 'Common/WriteShortMessage?sendman=admin&recieveIds=admin&title=wwwww&content=qqqqqqq&isSendMail=false',
  121. // isAlert: false,
  122. // isValidate: false,
  123. // success: function (res) {
  124. // RefreshTable();
  125. // }
  126. // });
  127. //}
  128. function IsReadFormatter(v, r) {
  129. if (r.isRead==="Y") {
  130. return '<span class="label label-primary">已读</span>';
  131. }
  132. return '<span class="label label-info">未读</span>';
  133. }
  134. function ActionFormatter(v, r) {
  135. if (r.isRead==="N") {
  136. return '<span class="table-action" onclick="ChangeStatus(' +
  137. r.id +
  138. ')"><i class="iconfont icon-right"></i>已读</span>';
  139. }
  140. return '';
  141. }
  142. function ChangeStatus(id) {
  143. SaveAjax({
  144. url: window.appUrl + "ShortMsgDetail/ChangeIsRead",
  145. data: { Id: id },
  146. isAlert: false,
  147. isValidate: false,
  148. success: function(res) {
  149. if (res) {
  150. RefreshTable();
  151. }
  152. }
  153. });
  154. }
  155. </script>
  156. }