datacollect.ejs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <% include ./sub_menu.ejs %>
  2. <div class="panel-content">
  3. <div class="panel-title">
  4. <div class="title-main">
  5. <h2>决策大屏
  6. <a href="#power" data-toggle="modal" data-target="#power" class="btn btn-primary btn-sm pull-right">权限管理</a>
  7. <a href="javascript:void(0);" id="tenderBtn" class="btn btn-primary btn-sm pull-right mr-1">标段管理</a>
  8. </h2>
  9. </div>
  10. </div>
  11. <div class="content-wrap">
  12. <div class="c-body">
  13. <div class="sjs-height-0">
  14. <nav class="nav nav-tabs m-3" id="tablist" role="tablist">
  15. <% for (let i = 1; i <= 2; i++) { %>
  16. <a class="nav-item nav-link<% if ((ctx.subProject.data_collect === 0 && i === 1) || ctx.subProject.data_collect === i) { %> active<% } %>" data-datacollect="<%- i %>" data-toggle="tab" href="#shujudaping-<%- i %>" role="tab">
  17. 决策大屏<%- ctx.helper.transFormToChinese(i) %><% if (ctx.helper._.indexOf(ctx.subProject.data_collect_pages, i.toString()) !== -1) { %>(已开启<% if (i === ctx.subProject.data_collect) { %>、默认<% } %>)<% } %></a>
  18. <% } %>
  19. <% if (is_dz1) { %>
  20. <a class="nav-item nav-link<% if (ctx.subProject.data_collect === is_dz1) { %> active<% } %>" data-datacollect="<%- is_dz1 %>" data-toggle="tab" href="#shujudaping-<%- is_dz1 %>" role="tab">
  21. 决策大屏<%- ctx.helper.transFormToChinese(is_dz1) %><% if (ctx.helper._.indexOf(ctx.subProject.data_collect_pages, is_dz1.toString()) !== -1) { %>(已开启<% if (ctx.subProject.data_collect === is_dz1) { %>、默认<% } %>)<% } %></a>
  22. <% } %>
  23. <% if (is_dz2) { %>
  24. <a class="nav-item nav-link<% if (ctx.subProject.data_collect === is_dz2) { %> active<% } %>" data-datacollect="<%- is_dz2 %>" data-toggle="tab" href="#shujudaping-<%- is_dz2 %>" role="tab">
  25. 决策大屏<%- ctx.helper.transFormToChinese(is_dz2) %><% if (ctx.helper._.indexOf(ctx.subProject.data_collect_pages, is_dz2.toString()) !== -1) { %>(已开启<% if (ctx.subProject.data_collect === is_dz2) { %>、默认<% } %>)<% } %></a>
  26. <% } %>
  27. <div class="ml-auto">
  28. <!--<div class="form-check form-check-inline">-->
  29. <!--<input class="form-check-input" type="checkbox" id="show-datacollect" value="option1" <% if (ctx.subProject.data_collect) { %>checked<% } %>>-->
  30. <!--<label class="form-check-label" for="show-datacollect">数据大屏显示</label>-->
  31. <!--</div>-->
  32. <div class="d-inline-block form-group form-check mt-2">
  33. <div class="custom-control custom-switch">
  34. <input type="checkbox" class="custom-control-input" id="show_datacollect" <% if (ctx.subProject.data_collect !== 0) { %>checked<% } %>>
  35. <label class="custom-control-label" for="show_datacollect">开启<i class="fa fa-question-circle text-primary" data-placement="bottom" data-toggle="tooltip" data-original-title="开启后,在决策大屏模块显示"></i></label>
  36. </div>
  37. </div>
  38. <div class="d-inline-block form-group form-check mt-2">
  39. <div class="custom-control custom-switch">
  40. <input type="checkbox" class="custom-control-input" id="default_datacollect" <% if (ctx.subProject.data_collect !== 0) { %>checked<% } %>>
  41. <label class="custom-control-label" for="default_datacollect">默认<i class="fa fa-question-circle text-primary" data-placement="bottom" data-toggle="tooltip" data-original-title="决策大屏第一个显示"></i></label>
  42. </div>
  43. </div>
  44. </div>
  45. </nav>
  46. <div class="tab-content m-3">
  47. <% for (let i = 1; i <= 2; i++) { %>
  48. <div id="shujudaping-<%- i %>" class="tab-pane<% if ((ctx.subProject.data_collect === 0 && i === 1) || ctx.subProject.data_collect === i) { %> active<% } %>"><img src="/public/images/juecedaping0<%- i %>.png" width="100%"></div>
  49. <% } %>
  50. <% if (is_dz1) { %>
  51. <div id="shujudaping-<%- is_dz1 %>" class="tab-pane<% if (ctx.subProject.data_collect === is_dz1) { %> active<% } %>">
  52. 山东济邹项目定制(MI22U)<img src="/public/images/juecedaping0<%- is_dz1 %>.png" width="100%">
  53. </div>
  54. <% } %>
  55. <% if (is_dz2) { %>
  56. <div id="shujudaping-<%- is_dz2 %>" class="tab-pane<% if (ctx.subProject.data_collect === is_dz2) { %> active<% } %>">
  57. <span>四川广元路桥集团计量内控管理云平台定制(GY18Y)</span><a class="nav-link" style="display: inline-block;" data-toggle="modal" href="#dpsix-set" data-target="#dpsix-set" title="决策大屏六设置"><i class="fa fa-cog"></i></a><img src="/public/images/juecedaping0<%- is_dz2 %>.png" width="100%">
  58. </div>
  59. <% } %>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <script src="/public/js/setting_datacollect_tender.js"></script>
  66. <script src="/public/js/PinYinOrder.bundle.js"></script>
  67. <script src="/public/js/shares/show_level.js"></script>
  68. <script src="/public/js/tender_showhide.js"></script>
  69. <script src="/public/js/shares/tender_list_order.js"></script>
  70. <script>
  71. let dataCollectPages = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.subProject.data_collect_pages)) %>'));
  72. let dataCollect = parseInt('<%- ctx.subProject.data_collect %>');
  73. const category = JSON.parse(unescape('<%- escape(JSON.stringify(categoryData)) %>'));
  74. const selfCategoryLevel = '<%- (selfCategoryLevel || '') %>';
  75. console.log(category);
  76. const tenders = JSON.parse(unescape('<%- escape(JSON.stringify(tenders)) %>'));
  77. let dcTenders = JSON.parse(unescape('<%- escape(JSON.stringify(dcTenders)) %>'));
  78. let addDataCollect = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.subProject.page_show.addDataCollect)) %>'));
  79. let is_dz1 = <% if (is_dz1) { %>parseInt('<%- is_dz1 %>');<% } else { %>false;<% } %>
  80. let is_dz2 = <% if (is_dz2) { %>parseInt('<%- is_dz2 %>');<% } else { %>false;<% } %>
  81. $(function () {
  82. autoFlashHeight();
  83. // 开启及关闭展示
  84. $('#show_datacollect').change(function () {
  85. const activePage = $('#tablist').find('.active').data('datacollect').toString();
  86. if ($(this).is(':checked')) {
  87. dataCollectPages.push(activePage);
  88. dataCollectPages.sort();
  89. if (dataCollect === 0) {
  90. dataCollect = parseInt(activePage);
  91. $('#default_datacollect').prop('checked', true);
  92. }
  93. } else {
  94. dataCollectPages.map((val, i) => {
  95. if (val === activePage) {
  96. dataCollectPages.splice(i, 1);
  97. }
  98. });
  99. if (dataCollectPages.length === 0) {
  100. dataCollect = 0;
  101. } else if (dataCollectPages.length !== 0 && dataCollect === parseInt(activePage)){
  102. dataCollect = parseInt(dataCollectPages[0]);
  103. }
  104. $('#default_datacollect').prop('checked', false);
  105. }
  106. postData('/sp/' + spid + '/setting/datacollect/save', { type: 'show', data_collect_pages: dataCollectPages, data_collect: dataCollect }, function (result) {
  107. updateTab();
  108. })
  109. });
  110. $('#default_datacollect').change(function () {
  111. const activePage = $('#tablist').find('.active').data('datacollect').toString();
  112. if ($(this).is(':checked')) {
  113. dataCollect = parseInt(activePage);
  114. $('#show_datacollect').prop('checked', true);
  115. if (_.indexOf(dataCollectPages, activePage) === -1) {
  116. dataCollectPages.push(activePage);
  117. dataCollectPages.sort();
  118. }
  119. } else {
  120. if (dataCollectPages.length === 1) {
  121. dataCollect = 0;
  122. dataCollectPages = [];
  123. $('#show_datacollect').prop('checked', false);
  124. } else {
  125. dataCollect = parseInt(dataCollectPages[0]) === dataCollect ? parseInt(dataCollectPages[1]) : parseInt(dataCollectPages[0]);
  126. }
  127. }
  128. updateTab();
  129. postData('/sp/' + spid + '/setting/datacollect/save', { type: 'show', data_collect_pages: dataCollectPages, data_collect: dataCollect }, function (result) {
  130. updateTab();
  131. })
  132. })
  133. function updateTab() {
  134. for (let i = 1; i <= 2; i++) {
  135. let msg = '';
  136. if (_.indexOf(dataCollectPages, i.toString()) !== -1) {
  137. msg = '(已开启' + (i=== dataCollect ? '、默认' : '') + ')' ;
  138. }
  139. $('#tablist a').eq(i-1).text('决策大屏' + transFormToChinese(i) + msg);
  140. }
  141. if (is_dz1) {
  142. let msg = '';
  143. if (_.indexOf(dataCollectPages, is_dz1.toString()) !== -1) {
  144. msg = '(已开启' + (is_dz1=== dataCollect ? '、默认' : '') + ')' ;
  145. }
  146. $('#tablist a').eq(is_dz1-3).text('决策大屏' + transFormToChinese(is_dz1) + msg);
  147. }
  148. if (is_dz2) {
  149. let msg = '';
  150. if (_.indexOf(dataCollectPages, is_dz2.toString()) !== -1) {
  151. msg = '(已开启' + (is_dz2=== dataCollect ? '、默认' : '') + ')' ;
  152. }
  153. $('#tablist a').eq(is_dz2-3).text('决策大屏' + transFormToChinese(is_dz2) + msg);
  154. }
  155. }
  156. $('#tablist a').click(function () {
  157. const page = parseInt($(this).data('datacollect'));
  158. if (_.indexOf(dataCollectPages, page.toString()) !== -1) {
  159. $('#show_datacollect').prop('checked', true);
  160. } else {
  161. $('#show_datacollect').prop('checked', false);
  162. }
  163. if (page === dataCollect) {
  164. $('#default_datacollect').prop('checked', true);
  165. } else {
  166. $('#default_datacollect').prop('checked', false);
  167. }
  168. });
  169. })
  170. </script>