datacollect.ejs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. <a class="nav-item nav-link<% if (ctx.subProject.data_collect === 7) { %> active<% } %>" data-datacollect="7" data-toggle="tab" href="#shujudaping-7" role="tab">
  28. 决策大屏<%- ctx.helper.transFormToChinese(7) %><% if (ctx.helper._.indexOf(ctx.subProject.data_collect_pages, '7') !== -1) { %>(已开启<% if (ctx.subProject.data_collect === 7) { %>、默认<% } %>)<% } %></a>
  29. <div class="ml-auto">
  30. <!--<div class="form-check form-check-inline">-->
  31. <!--<input class="form-check-input" type="checkbox" id="show-datacollect" value="option1" <% if (ctx.subProject.data_collect) { %>checked<% } %>>-->
  32. <!--<label class="form-check-label" for="show-datacollect">数据大屏显示</label>-->
  33. <!--</div>-->
  34. <div class="d-inline-block form-group form-check mt-2">
  35. <div class="custom-control custom-switch">
  36. <input type="checkbox" class="custom-control-input" id="show_datacollect" <% if (ctx.subProject.data_collect !== 0) { %>checked<% } %>>
  37. <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>
  38. </div>
  39. </div>
  40. <div class="d-inline-block form-group form-check mt-2">
  41. <div class="custom-control custom-switch">
  42. <input type="checkbox" class="custom-control-input" id="default_datacollect" <% if (ctx.subProject.data_collect !== 0) { %>checked<% } %>>
  43. <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>
  44. </div>
  45. </div>
  46. </div>
  47. </nav>
  48. <div class="tab-content m-3">
  49. <% for (let i = 1; i <= 2; i++) { %>
  50. <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>
  51. <% } %>
  52. <% if (is_dz1) { %>
  53. <div id="shujudaping-<%- is_dz1 %>" class="tab-pane<% if (ctx.subProject.data_collect === is_dz1) { %> active<% } %>">
  54. 山东济邹项目定制(MI22U)<img src="/public/images/juecedaping0<%- is_dz1 %>.png" width="100%">
  55. </div>
  56. <% } %>
  57. <% if (is_dz2) { %>
  58. <div id="shujudaping-<%- is_dz2 %>" class="tab-pane<% if (ctx.subProject.data_collect === is_dz2) { %> active<% } %>">
  59. <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%">
  60. </div>
  61. <% } %>
  62. <div id="shujudaping-7" class="tab-pane<% if (ctx.subProject.data_collect === 7) { %> active<% } %>">
  63. 成本管理决策大屏数据汇总<img src="/public/images/juecedaping07.png" width="100%">
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <script src="/public/js/setting_datacollect_tender.js"></script>
  71. <script src="/public/js/PinYinOrder.bundle.js"></script>
  72. <script src="/public/js/shares/show_level.js"></script>
  73. <script src="/public/js/tender_showhide.js"></script>
  74. <script src="/public/js/shares/tender_list_order.js"></script>
  75. <script>
  76. let dataCollectPages = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.subProject.data_collect_pages)) %>'));
  77. let dataCollect = parseInt('<%- ctx.subProject.data_collect %>');
  78. const category = JSON.parse(unescape('<%- escape(JSON.stringify(categoryData)) %>'));
  79. const selfCategoryLevel = '<%- (selfCategoryLevel || '') %>';
  80. console.log(category);
  81. const tenders = JSON.parse(unescape('<%- escape(JSON.stringify(tenders)) %>'));
  82. let dcTenders = JSON.parse(unescape('<%- escape(JSON.stringify(dcTenders)) %>'));
  83. let addDataCollect = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.subProject.page_show.addDataCollect)) %>'));
  84. let is_dz1 = <% if (is_dz1) { %>parseInt('<%- is_dz1 %>');<% } else { %>false;<% } %>
  85. let is_dz2 = <% if (is_dz2) { %>parseInt('<%- is_dz2 %>');<% } else { %>false;<% } %>
  86. $(function () {
  87. autoFlashHeight();
  88. // 开启及关闭展示
  89. $('#show_datacollect').change(function () {
  90. const activePage = $('#tablist').find('.active').data('datacollect').toString();
  91. if ($(this).is(':checked')) {
  92. dataCollectPages.push(activePage);
  93. dataCollectPages.sort();
  94. if (dataCollect === 0) {
  95. dataCollect = parseInt(activePage);
  96. $('#default_datacollect').prop('checked', true);
  97. }
  98. } else {
  99. dataCollectPages.map((val, i) => {
  100. if (val === activePage) {
  101. dataCollectPages.splice(i, 1);
  102. }
  103. });
  104. if (dataCollectPages.length === 0) {
  105. dataCollect = 0;
  106. } else if (dataCollectPages.length !== 0 && dataCollect === parseInt(activePage)){
  107. dataCollect = parseInt(dataCollectPages[0]);
  108. }
  109. $('#default_datacollect').prop('checked', false);
  110. }
  111. postData('/sp/' + spid + '/setting/datacollect/save', { type: 'show', data_collect_pages: dataCollectPages, data_collect: dataCollect }, function (result) {
  112. updateTab();
  113. })
  114. });
  115. $('#default_datacollect').change(function () {
  116. const activePage = $('#tablist').find('.active').data('datacollect').toString();
  117. if ($(this).is(':checked')) {
  118. dataCollect = parseInt(activePage);
  119. $('#show_datacollect').prop('checked', true);
  120. if (_.indexOf(dataCollectPages, activePage) === -1) {
  121. dataCollectPages.push(activePage);
  122. dataCollectPages.sort();
  123. }
  124. } else {
  125. if (dataCollectPages.length === 1) {
  126. dataCollect = 0;
  127. dataCollectPages = [];
  128. $('#show_datacollect').prop('checked', false);
  129. } else {
  130. dataCollect = parseInt(dataCollectPages[0]) === dataCollect ? parseInt(dataCollectPages[1]) : parseInt(dataCollectPages[0]);
  131. }
  132. }
  133. updateTab();
  134. postData('/sp/' + spid + '/setting/datacollect/save', { type: 'show', data_collect_pages: dataCollectPages, data_collect: dataCollect }, function (result) {
  135. updateTab();
  136. })
  137. })
  138. function updateTab() {
  139. for (let i = 1; i <= 2; i++) {
  140. let msg = '';
  141. if (_.indexOf(dataCollectPages, i.toString()) !== -1) {
  142. msg = '(已开启' + (i=== dataCollect ? '、默认' : '') + ')' ;
  143. }
  144. $('#tablist a').eq(i-1).text('决策大屏' + transFormToChinese(i) + msg);
  145. }
  146. if (is_dz1) {
  147. let msg = '';
  148. if (_.indexOf(dataCollectPages, is_dz1.toString()) !== -1) {
  149. msg = '(已开启' + (is_dz1=== dataCollect ? '、默认' : '') + ')' ;
  150. }
  151. $('#tablist a').eq(is_dz1-3).text('决策大屏' + transFormToChinese(is_dz1) + msg);
  152. }
  153. if (is_dz2) {
  154. let msg = '';
  155. if (_.indexOf(dataCollectPages, is_dz2.toString()) !== -1) {
  156. msg = '(已开启' + (is_dz2=== dataCollect ? '、默认' : '') + ')' ;
  157. }
  158. $('#tablist a').eq(is_dz2-3).text('决策大屏' + transFormToChinese(is_dz2) + msg);
  159. }
  160. let msg = '';
  161. if (_.indexOf(dataCollectPages, '7') !== -1) {
  162. msg = '(已开启' + (7 === dataCollect ? '、默认' : '') + ')' ;
  163. }
  164. $('#tablist a').eq(7-3).text('决策大屏' + transFormToChinese(7) + msg);
  165. }
  166. $('#tablist a').click(function () {
  167. const page = parseInt($(this).data('datacollect'));
  168. if (_.indexOf(dataCollectPages, page.toString()) !== -1) {
  169. $('#show_datacollect').prop('checked', true);
  170. } else {
  171. $('#show_datacollect').prop('checked', false);
  172. }
  173. if (page === dataCollect) {
  174. $('#default_datacollect').prop('checked', true);
  175. } else {
  176. $('#default_datacollect').prop('checked', false);
  177. }
  178. });
  179. })
  180. </script>