show.ejs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <% include ./sub_menu.ejs %>
  2. <div class="panel-content">
  3. <div class="panel-title">
  4. <div class="title-main">
  5. <h2>显示设置</h2>
  6. </div>
  7. </div>
  8. <div class="content-wrap">
  9. <div class="c-body">
  10. <div class="sjs-height-0">
  11. <div class="row m-0 mt-3">
  12. <div class="col-5">
  13. <div class="form-group">
  14. <label>项目列表默认显示</label>
  15. <div class="card w-50">
  16. <ul class="list-group list-group-flush">
  17. <% showList.forEach(function(item, idx) { %>
  18. <li class="list-group-item">
  19. <%= item.label_name %>
  20. <% if(!item.is_default) { %>
  21. <a href="javascript:void(0)" id="set-default" class="btn btn-primary btn-sm pull-right" data-attid="<%- idx %>">设为默认</a>
  22. <% } else {%>
  23. <span class="pull-right">默认</span>
  24. <% } %>
  25. </li>
  26. <% }) %>
  27. <!-- <li class="list-group-item">
  28. 标段列表<a href="#" class="btn btn-primary btn-sm pull-right">设为默认</a>
  29. </li>
  30. <li class="list-group-item">金额概况<span class="pull-right">默认</span></li>
  31. <li class="list-group-item">
  32. 计量进度<a href="#" class="btn btn-primary btn-sm pull-right">设为默认</a>
  33. </li> -->
  34. </ul>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <legend>台账列显示</legend>
  39. <table class="table table-hover table-bordered">
  40. <thead><tr><th>名称</th><th>是否显示</th><th>别名</th><th></th></tr></thead>
  41. <tbody id="ledger_col_list">
  42. <% for (const sl of sjsRela.ledgerCol) { %>
  43. <tr>
  44. <td><%- sl.name %></td>
  45. <td>
  46. <div class="form-check form-check-inline">
  47. <input class="form-check-input" type="checkbox" id="inlineCheckbox-<%- sl.field %>" <% if (sl.show) { %>checked<% } %> onchange="updateColShow('ledgerCol', '<%- sl.field %>', this);">
  48. <label class="form-check-label" for="inlineCheckbox-<%- sl.field %>"></label>
  49. </div>
  50. </td>
  51. <td>
  52. <div class="input-group input-group-sm" style="width:90px">
  53. <input type="text" class="form-control" value="<%- sl.alias %>" onchange="updateColAlias('ledgerCol', '<%- sl.field%>', this);">
  54. </div>
  55. </td>
  56. <td><span class="form-control-sm text-warning"><%- sl.hint || '' %></span></td>
  57. </tr>
  58. <% } %>
  59. </tbody>
  60. </table>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <script src="/public/js/setting.js"></script>
  69. <script>
  70. $(function () {
  71. autoFlashHeight();
  72. })
  73. const showList = JSON.parse('<%- JSON.stringify(showList) %>');
  74. const updateColShow = function (sub, field, obj) {
  75. const data = { sub, field, key: 'show', value: obj.checked };
  76. postData('show/update-sjs', data, function() {
  77. obj.setAttribute('value', obj.checked);
  78. }, function () {
  79. obj.checked = obj.getAttribute('value') === true;
  80. });
  81. };
  82. const updateColAlias = function (sub, field, obj) {
  83. const data = { sub, field, key: 'alias', value: obj.value };
  84. postData('show/update-sjs', data, function() {
  85. obj.setAttribute('org', obj.value);
  86. }, function () {
  87. obj.value = obj.getAttribute('org');
  88. });
  89. };
  90. </script>