template.ejs 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. <% if (template.ft_type !== FtType.org) { %>
  38. <div class="p-2">
  39. <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>
  40. <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>
  41. </div>
  42. <% } %>
  43. <form class="ml-2 p-2" method="POST" action="/file/template/reset?id=<%- template.id %>">
  44. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  45. <button class="btn btn-sm btn-primary"><i class="fa fa-refresh" aria-hidden="true"></i> 初始化模板</button>
  46. </form>
  47. </div>
  48. <div>
  49. <ul id="filing" class="ztree" style="overflow: auto"></ul>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div stype="display: none">
  56. <form id="hiddenForm" action="" method="POST">
  57. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  58. <input type="hidden" id="extra" name="" value="">
  59. </form>
  60. </div>
  61. </div>
  62. <script>
  63. const templateList = JSON.parse('<%- JSON.stringify(templateList) %>');
  64. const templateData = JSON.parse('<%- JSON.stringify(templateData) %>');
  65. $('.table-file').click(function(e) {
  66. if (this.getAttribute('renaming') === '1') return;
  67. if (e.target.tagName === 'A' || e.target.tagName === 'I' || e.target.tagName === 'INPUT') return;
  68. window.location.href = '/file/template/' + this.getAttribute('tempId');
  69. });
  70. const readOnly = <%- template.ft_type === FtType.org %>;
  71. </script>