s2b.ejs 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <% include ./sub_menu.ejs %>
  2. <div class="panel-content">
  3. <div class="panel-title">
  4. <div class="title-main">
  5. <h2>API设置</h2>
  6. </div>
  7. </div>
  8. <div class="content-wrap">
  9. <div class="c-body">
  10. <div class="sjs-height-0">
  11. <% if (tenders.length === 0) { %>
  12. <div class="jumbotron m-3">
  13. <h3 class="display-6">没有标段数据</h3>
  14. </div>
  15. <% } else { %>
  16. <div class="m-3">
  17. <table class="table table-hover table-bordered">
  18. <thead>
  19. <tr>
  20. <th class="text-center" >名称</th>
  21. <th class="text-center" >计量模式</th>
  22. <th class="text-center" >计量期数</th>
  23. <th class="text-center" >创建人</th>
  24. <th class="text-center" >标段创建时间/期审批时间</th>
  25. <th class="text-center">工序报验</th>
  26. <th class="text-center">档案管理</th>
  27. </tr>
  28. </thead>
  29. <% for (const t of tenders) { %>
  30. <tr tid="<%- t.id %>">
  31. <td><%- t.name %></td>
  32. <td><%- t.measure_type_str %></td>
  33. <td><%- t.stage_count_str %></td>
  34. <td><%- t.user_str %></td>
  35. <td><%- ctx.moment(t.show_time).format('YYYY-MM-DD HH:mm:ss') %></td>
  36. <td class="text-center">
  37. <div class="form-check form-check-inline">
  38. <input class="form-check-input" type="checkbox" id="inlineCheckbox1" <% if (t.s2b_gxby_check) { %>checked<% } %> name="gxby_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_check %>">
  39. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  40. <label class="form-check-label" for="inlineCheckbox1">检查计量</label>
  41. </div>
  42. <div class="form-check form-check-inline">
  43. <input class="form-check-input" type="checkbox" id="inlineCheckbox2" <% if (t.s2b_gxby_limit) { %>checked<% } %> name="gxby_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_limit %>">
  44. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  45. <label class="form-check-label" for="inlineCheckbox2">限制上报</label>
  46. </div>
  47. </td>
  48. <td class="text-center">
  49. <div class="form-check form-check-inline">
  50. <input class="form-check-input" type="checkbox" id="inlineCheckbox3" <% if (t.s2b_dagl_check) { %>checked<% } %> name="dagl_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_check %>">
  51. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  52. <label class="form-check-label" for="inlineCheckbox3">检查计量</label>
  53. </div>
  54. <div class="form-check form-check-inline">
  55. <input class="form-check-input" type="checkbox" id="inlineCheckbox4" <% if (t.s2b_dagl_limit) { %>checked<% } %> name="dagl_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_limit %>">
  56. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  57. <label class="form-check-label" for="inlineCheckbox4">限制上报</label>
  58. </div>
  59. </td>
  60. </tr>
  61. <% } %>
  62. </table>
  63. </div>
  64. <% } %>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <script>
  70. const updateS2bSetting = function (obj) {
  71. try {
  72. const name = obj.getAttribute('name');
  73. const tid = parseInt(obj.parentNode.parentNode.parentNode.getAttribute('tid'));
  74. if (!name) return;
  75. const data = { tid };
  76. data[name] = obj.checked;
  77. postData('api/update', data, function() {
  78. obj.setAttribute('value', obj.checked);
  79. }, function () {
  80. obj.checked = obj.getAttribute('value') === true;
  81. })
  82. } catch (err) {
  83. obj.checked = obj.getAttribute('value') === true;
  84. }
  85. }
  86. $(() => {
  87. autoFlashHeight();
  88. })
  89. </script>