datacollect.ejs 13 KB

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