attach_list.tpl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>附件管理 - Powered by MinDoc</title>
  8. <!-- Bootstrap -->
  9. <link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
  10. <link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet" type="text/css">
  11. <link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
  12. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  13. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  14. <!--[if lt IE 9]>
  15. <script src="{{cdnjs "/static/html5shiv/3.7.3/html5shiv.min.js"}}"></script>
  16. <script src="{{cdnjs "/static/respond.js/1.4.2/respond.min.js" }}"></script>
  17. <![endif]-->
  18. </head>
  19. <body>
  20. <div class="manual-reader">
  21. {{template "widgets/header.tpl" .}}
  22. <div class="container manual-body">
  23. <div class="row">
  24. {{template "manager/widgets.tpl" "attach"}}
  25. <div class="page-right">
  26. <div class="m-box">
  27. <div class="box-head">
  28. <strong class="box-title">附件管理</strong>
  29. </div>
  30. </div>
  31. <div class="box-body">
  32. <div class="attach-list" id="attachList">
  33. <table class="table">
  34. <thead>
  35. <tr>
  36. <th>#</th>
  37. <th>附件名称</th>
  38. <th>项目/文章名称</th>
  39. <th>文件大小</th>
  40. <th>是否存在</th>
  41. <th>操作</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. {{range $index,$item := .Lists}}
  46. <tr>
  47. <td>{{$item.AttachmentId}}</td>
  48. <td>{{$item.FileName}}</td>
  49. <td>{{$item.BookName}}</td>
  50. <td>{{$item.FileShortSize}}</td>
  51. <td>{{ if $item.IsExist }} 是{{else}}否{{end}}</td>
  52. <td>
  53. <button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.AttachmentId}}" data-loading-text="删除中...">删除</button>
  54. <a href="{{urlfor "ManagerController.AttachDetailed" ":id" $item.AttachmentId}}" class="btn btn-success btn-sm">详情</a>
  55. </td>
  56. </tr>
  57. {{else}}
  58. <tr><td class="text-center" colspan="6">暂无数据</td></tr>
  59. {{end}}
  60. </tbody>
  61. </table>
  62. <nav class="pagination-container">
  63. {{.PageHtml}}
  64. </nav>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. {{template "widgets/footer.tpl" .}}
  71. </div>
  72. <script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
  73. <script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
  74. <script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
  75. <script src="{{cdnjs "/static/layer/layer.js" }}" type="text/javascript"></script>
  76. <script type="text/javascript">
  77. $(function () {
  78. $("#attachList").on("click","button[data-method='delete']",function () {
  79. var id = $(this).attr("data-id");
  80. var $this = $(this);
  81. $(this).button("loading");
  82. $.ajax({
  83. url : "{{urlfor "ManagerController.AttachDelete"}}",
  84. data : { "attach_id" : id },
  85. type : "post",
  86. dataType : "json",
  87. success : function (res) {
  88. if(res.errcode === 0){
  89. $this.closest("tr").remove().empty();
  90. }else {
  91. layer.msg(res.message);
  92. }
  93. },
  94. error : function () {
  95. layer.msg("服务器异常");
  96. },
  97. complete : function () {
  98. $this.button("reset");
  99. }
  100. });
  101. });
  102. });
  103. </script>
  104. </body>
  105. </html>