template.ejs 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 class="ml-auto p-2">
  48. <a href="javascript: void(0);" class="btn btn-sm btn-primary" id="import-template">导入</a>
  49. <a href="javascript: void(0);" class="btn btn-sm btn-primary" id="export-template">导出</a>
  50. <a href="javascript: void(0);" class="btn btn-sm btn-primary" id="multi-setting">附加配置</a>
  51. </div>
  52. </div>
  53. <div>
  54. <ul id="filing" class="ztree" style="overflow: auto"></ul>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div stype="display: none">
  61. <form id="hiddenForm" action="" method="POST">
  62. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  63. <input type="hidden" id="extra" name="" value="">
  64. </form>
  65. </div>
  66. </div>
  67. <script>
  68. const templateList = JSON.parse('<%- JSON.stringify(templateList) %>');
  69. const templateData = JSON.parse('<%- JSON.stringify(templateData) %>');
  70. $('.table-file').click(function(e) {
  71. if (this.getAttribute('renaming') === '1') return;
  72. if (e.target.tagName === 'A' || e.target.tagName === 'I' || e.target.tagName === 'INPUT') return;
  73. window.location.href = '/file/template/' + this.getAttribute('tempId');
  74. });
  75. const readOnly = <%- template.ft_type === FtType.org %>;
  76. </script>