attach_list.tpl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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"}}" 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. <div class="page-left">
  25. <ul class="menu">
  26. {{template "manager/manager_widgets.tpl.tpl" .}}
  27. </ul>
  28. </div>
  29. <div class="page-right">
  30. <div class="m-box">
  31. <div class="box-head">
  32. <strong class="box-title">附件管理</strong>
  33. </div>
  34. </div>
  35. <div class="box-body">
  36. <div class="attach-list" id="attachList">
  37. <table class="table">
  38. <thead>
  39. <tr>
  40. <th>#</th>
  41. <th>附件名称</th>
  42. <th>项目名称</th>
  43. <th>文件大小</th>
  44. <th>是否存在</th>
  45. <th>操作</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. {{range $index,$item := .Lists}}
  50. <tr>
  51. <td>{{$item.AttachmentId}}</td>
  52. <td>{{$item.FileName}}</td>
  53. <td>{{$item.BookName}}</td>
  54. <td>{{$item.FileShortSize}}</td>
  55. <td>{{ if $item.IsExist }} 是{{else}}否{{end}}</td>
  56. <td>
  57. <button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.AttachmentId}}" data-loading-text="删除中...">删除</button>
  58. <a href="{{urlfor "ManagerController.AttachDetailed" ":id" $item.AttachmentId}}" class="btn btn-success btn-sm">详情</a>
  59. </td>
  60. </tr>
  61. {{else}}
  62. <tr><td class="text-center" colspan="6">暂无数据</td></tr>
  63. {{end}}
  64. </tbody>
  65. </table>
  66. <nav class="pagination-container">
  67. {{.PageHtml}}
  68. </nav>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. {{template "widgets/footer.tpl" .}}
  75. </div>
  76. <script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
  77. <script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
  78. <script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
  79. <script src="{{cdnjs "/static/layer/layer.js" }}" type="text/javascript"></script>
  80. <script type="text/javascript">
  81. $(function () {
  82. $("#attachList").on("click","button[data-method='delete']",function () {
  83. var id = $(this).attr("data-id");
  84. var $this = $(this);
  85. $(this).button("loading");
  86. $.ajax({
  87. url : "{{urlfor "ManagerController.AttachDelete"}}",
  88. data : { "attach_id" : id },
  89. type : "post",
  90. dataType : "json",
  91. success : function (res) {
  92. if(res.errcode === 0){
  93. $this.closest("tr").remove().empty();
  94. }else {
  95. layer.msg(res.message);
  96. }
  97. },
  98. error : function () {
  99. layer.msg("服务器异常");
  100. },
  101. complete : function () {
  102. $this.button("reset");
  103. }
  104. });
  105. });
  106. });
  107. </script>
  108. </body>
  109. </html>