template.ejs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <div class="panel-content">
  2. <div class="panel-title fluid">
  3. <div class="title-main d-flex justify-content-between">
  4. <div>资料归集模板库</div>
  5. </div>
  6. </div>
  7. <div class="content-wrap">
  8. <div class="c-body">
  9. <div class="sjs-height-0 row">
  10. <div class="col-3">
  11. <div class="d-flex flex-row">
  12. <form class="ml-2 p-2" method="POST" action="/file/template/save">
  13. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  14. <button class="btn btn-sm btn-light text-primary"><i class="fa fa-plus" aria-hidden="true" type="submit"></i> 新增模板库</button>
  15. </form>
  16. </div>
  17. <div>
  18. <dl class="list-group">
  19. <% for (const temp of templateList) { %>
  20. <dd class="list-group-item <%- (temp.id === template.id ? 'bg-warning' : '')%>">
  21. <div class="d-flex justify-content-between align-items-center table-file" tempId="<%- temp.id %>">
  22. <div><%if (temp.ft_type === FtType.org) { %><span class="text-success mr-1" style="border: 1px solid">默认</span><% } %><%- temp.name %>%></div>
  23. <% if (temp.ft_type) { %>
  24. <div class="btn-group-table" style="display: none;">
  25. <a href="javascript: void(0);" class="mr-1" data-toggle="tooltip" data-placement="bottom" data-original-title="编辑" name="renameTemplate"><i class="fa fa-pencil fa-fw"></i></a>
  26. <a href="javascript: void(0);" class="mr-1" data-toggle="tooltip" data-placement="bottom" data-original-title="删除" name="delTemplate"><i class="fa fa-trash-o fa-fw text-danger"></i></a>
  27. </div>
  28. <% } %>
  29. </div>
  30. </dd>
  31. <% } %>
  32. </dl>
  33. </div>
  34. </div>
  35. <div class="col-9">
  36. <div class="d-flex flex-row">
  37. <div class="p-2">
  38. <a href="javascript: void(0);" class="btn btn-sm btn-light text-primary" id="add-slibing"><i class="fa fa-plus" aria-hidden="true"></i> 同层</a>
  39. <a href="javascript: void(0);" class="btn btn-sm btn-light text-primary" id="add-child"><i class="fa fa-plus" aria-hidden="true"></i> 子项</a>
  40. </div>
  41. <form class="ml-2 p-2" method="POST" action="/file/template/reset?id=<%- template.id %>">
  42. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  43. <button class="btn btn-sm btn-primary"><i class="fa fa-refresh" aria-hidden="true"></i> 初始化模板</button>
  44. </form>
  45. </div>
  46. <div>
  47. <ul id="filing" class="ztree" style="overflow: auto"></ul>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div stype="display: none">
  54. <form id="hiddenForm" action="" method="POST">
  55. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  56. <input type="hidden" id="extra" name="" value="">
  57. </form>
  58. </div>
  59. </div>
  60. <script>
  61. const templateList = JSON.parse('<%- JSON.stringify(templateList) %>');
  62. const templateData = JSON.parse('<%- JSON.stringify(templateData) %>');
  63. $('.table-file').click(function(e) {
  64. if (this.getAttribute('renaming') === '1') return;
  65. if (e.target.tagName === 'A' || e.target.tagName === 'I' || e.target.tagName === 'INPUT') return;
  66. window.location.href = '/file/template/' + this.getAttribute('tempId');
  67. });
  68. const readOnly = <%- template.ftType === FtType.org %>;
  69. </script>