list_info_modal.ejs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!--弹出列设置-->
  2. <div class="modal fade" id="col-set" data-backdrop="static">
  3. <div class="modal-dialog" role="document">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <h5 class="modal-title">列设置</h5>
  7. </div>
  8. <div class="modal-body">
  9. <table class="table table-hover table-bordered">
  10. <thead><tr><th width="150px">列名</th><th width="150px">别名</th><th width="50px">显示</th></tr></thead>
  11. <tbody class="text-center">
  12. <% for (const cs of colSet) { %>
  13. <tr code="<%- cs.field %>">
  14. <td><%- cs.name %><% if (cs.hint) { %><i class="fa fa-question-circle text-primary ml-1" data-placement="bottom" data-toggle="tooltip" data-original-title="<%- cs.hint %>"></i><% } %></td>
  15. <% if (cs.fixed.indexOf('alias') >= 0) { %>
  16. <td class="disabled">-</td>
  17. <% } else {%>
  18. <td><input type="text" class="form-control form-control-sm" value="<%- cs.alias %>"></td>
  19. <% } %>
  20. <% if (cs.fixed.indexOf('show') >= 0 ) { %>
  21. <td>
  22. <div class="form-check form-check-inline">
  23. <input class="form-check-input" type="checkbox" id="inlineCheckbox-<%- cs.code %>" checked="" disabled="">
  24. <label class="form-check-label" for="inlineCheckbox-<%- cs.code %>"></label>
  25. </div>
  26. </td>
  27. <% } else { %>
  28. <td>
  29. <div class="form-check form-check-inline">
  30. <input class="form-check-input" type="checkbox" id="inlineCheckbox-<%- cs.code %>" <% if (cs.show) { %> checked <% } %> >
  31. <label class="form-check-label" for="inlineCheckbox-<%- cs.code %>"></label>
  32. </div>
  33. </td>
  34. <% } %>
  35. </tr>
  36. <% } %>
  37. </tbody>
  38. </table>
  39. <div class="text-danger">请勿全选(页面显示不下);谨慎修改别名(修改后,各页面概念将不一致)</div>
  40. </div>
  41. <form class="modal-footer" action="/subproj/col-set" method="post" onsubmit="return onSetCol();">
  42. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  43. <input type="hidden" name="col_set" value="">
  44. <input type="hidden" name="col_type" value="info">
  45. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  46. <button type="submit" class="btn btn-primary btn-sm" id="add-bd-ok">确定修改</button>
  47. </form>
  48. </div>
  49. </div>
  50. </div>
  51. <script>
  52. const onSetCol = function() {
  53. const trs = $('tr[code]', '#col-set');
  54. const colSet = [];
  55. for (const tr of trs) {
  56. colSet.push({ field: $(tr).attr('code'), show: $('input[type=checkbox]', tr)[0].checked, alias: $('input[type=text]', tr).val() || ''});
  57. }
  58. $('input[name=col_set]').val(JSON.stringify(colSet));
  59. };
  60. </script>