list.htm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ##tlayout("admin/layout.htm"){
  2. <div class="breadcrumbs" style="padding-top:10px;height: 50px;">
  3. <div class="col-xs-12">
  4. <a class="btn btn-info btn-sm" style="margin-top: -12px;margin-left: 10px;" href="javascript:showAlert('/admin/subject/add')">+添加专题</a>
  5. </div>
  6. </div>
  7. <div class="page-content">
  8. <div class="row" style="margin-top:10px;">
  9. <div class="col-xs-12">
  10. <div class="table-responsive">
  11. <table class="table table-striped table-bordered table-hover">
  12. <thead>
  13. <tr>
  14. <th>名称</th>
  15. <th>排序</th>
  16. <th>状态</th>
  17. <th>添加时间</th>
  18. <th>操作</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. ##if(results!=null && results.list.~size!=0){
  23. ##for(_item in results.list!){
  24. <tr>
  25. <td>${_item.title!}</td>
  26. <td>${_item.idx!}</td>
  27. <td>
  28. ##if(_item.status==1){
  29. 启用
  30. ##}else{
  31. 禁用
  32. ##}
  33. </td>
  34. <td>${_item.create_date!,dateFormat='yyyy-MM-dd HH:mm'}</td>
  35. <td style="width:100px;">
  36. <div class="btn-group">
  37. <button class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown">
  38. 操作<span class="icon-caret-down icon-on-right"></span>
  39. </button>
  40. <ul class="dropdown-menu dropdown-info pull-right">
  41. <li><a href="javascript:showAlert('/admin/subject/edit?id=${_item.id!}')">编辑</a></li>
  42. ##if(_item.status==1){
  43. <li><a href="javascript:changeStatus(${_item.id!}, 0, '禁用')">禁用</a></li>
  44. ##}else{
  45. <li><a href="javascript:changeStatus(${_item.id!}, 1, '启用')">启用</a></li>
  46. ##}
  47. <li><a href="javascript:changeStatus(${_item.id!}, 9, '删除')">删除</a></li>
  48. </ul>
  49. </div>
  50. </td>
  51. </tr>
  52. ##}
  53. ##}
  54. </tbody>
  55. </table>
  56. ##if(totalPage>1){
  57. <div class="fenye">
  58. <#_pagination page="${results!}">
  59. <ul id="Pagination"></ul>
  60. </#_pagination>
  61. </div>
  62. ##}
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <script>
  68. function changeStatus(id, status, msg){
  69. if(confirm("确定要" + msg + "该记录吗?")){
  70. $.post("/admin/subject/changeStatus",{id:id,status:status},function(data){
  71. alert(data.msg);
  72. if(data.success){
  73. location.reload();
  74. }
  75. });
  76. }
  77. }
  78. </script>
  79. ##}