index4GY18Y.ejs 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  1. <link href="/public/css/bootstrap/bootstrap-colorpicker.min.css" rel="stylesheet">
  2. <style>
  3. ::-webkit-scrollbar {
  4. width: 3px;
  5. height: 3px;
  6. }
  7. /* 滚动条有滑块的轨道部分 */
  8. ::-webkit-scrollbar-track-piece {
  9. background-color: transparent;
  10. border-radius: 5px;
  11. }
  12. /* 滚动条滑块(竖向:vertical 横向:horizontal) */
  13. ::-webkit-scrollbar-thumb {
  14. cursor: pointer;
  15. background-color:#2C3034;
  16. border-radius: 5px;
  17. }
  18. /* 滚动条滑块hover */
  19. ::-webkit-scrollbar-thumb:hover {
  20. background-color: #999999;
  21. }
  22. /* 同时有垂直和水平滚动条时交汇的部分 */
  23. ::-webkit-scrollbar-corner {
  24. display: block; /* 修复交汇时出现的白块 */
  25. }
  26. </style>
  27. <div class="panel-content" style="background:#2c3237 !important">
  28. <div class="panel-title fluid border-top-0" style="background:#2c3237 !important">
  29. <div class="title-main d-flex justify-content-between">
  30. <div class="d-inline-block mr-2">
  31. <div class="btn-group" id="first-category">
  32. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-cid="" data-value="" data-toggle="dropdown">全部</button>
  33. <div class="dropdown-menu" aria-labelledby="zhankai">
  34. <a class="dropdown-item select-cate" data-value="" href="javascript:void(0);">全部</a>
  35. <% if (categoryData.length > 0 && categoryData[0].value.length > 0) { %>
  36. <% for (const c of categoryData[0].value) { %>
  37. <a class="dropdown-item select-cate" data-cid="<%- c.cid %>" data-value="<%- c.id %>" href="javascript:void(0);"><%- c.value %></a>
  38. <% } %>
  39. <% } %>
  40. </div>
  41. </div>
  42. <% if (categoryData[1] && categoryData[1].value.length > 0) { %>
  43. <div class="btn-group" id="second-category" style="display: none">
  44. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-cid="" data-value="" data-toggle="dropdown">全部</button>
  45. <div class="dropdown-menu" aria-labelledby="zhankai">
  46. <a class="dropdown-item select-cate" data-value="" href="javascript:void(0);">全部</a>
  47. <% for (const c of categoryData[1].value) { %>
  48. <a class="dropdown-item select-cate" data-cid="<%- c.cid %>" data-value="<%- c.id %>" href="javascript:void(0);"><%- c.value %></a>
  49. <% } %>
  50. </div>
  51. </div>
  52. <% } %>
  53. </div>
  54. <div>
  55. <a href="javascript:void(0)" title="全屏显示" id="showFull" class="text-white"><i class="fa fa-arrows-alt"></i></a>
  56. <div class="btn-group">
  57. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-toggle="dropdown" id="zhankai">决策大屏<span>6</span></button>
  58. <div class="dropdown-menu" aria-labelledby="zhankai">
  59. <% for (const i of projectData.data_collect_pages) { %>
  60. <a class="dropdown-item" href="/datacollect/index/<%- i %>">决策大屏<%- i %></a>
  61. <% } %>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="content-wrap" id="big-data">
  68. <div style="height: 30px;background-color: #2c3237; display: none" id="exitfull-div">
  69. <div class="title-main d-flex">
  70. <div class="ml-auto">
  71. <div class="dropdown d-flex float-left mt-1 mr-2">
  72. <button id="exitFull" class="btn btn-sm btn-secondary ml-auto">退出全屏</button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="c-body" style="background:#2c3237 !important">
  78. <div class="flex-content">
  79. <div class="row mx-3" style="height: 63.5vh">
  80. <div class="col-4 px-0 pb-1 height-100">
  81. <div class="height-100 pr-1">
  82. <div class="center-chart pb-1">
  83. <div class="card height-100 bg-dark">
  84. <div class="gcsrmx_chart" style="height: 100%; width: 100%;"></div>
  85. </div>
  86. </div>
  87. <div class="center-chart pt-1">
  88. <div class="card height-100 bg-dark">
  89. <div class="gccb" style="height: 100%; width: 100%;">
  90. <h6 class="bg-dark text-center text-white m-0 py-3">工程成本管理汇总</h6>
  91. <div class="tablebox" style="overflow: auto;">
  92. <table>
  93. <thead>
  94. <tr style="text-align: center">
  95. <th></th>
  96. <th>已完成</th>
  97. <th>应支付</th>
  98. <th>已支付</th>
  99. <th>待支付</th>
  100. </tr>
  101. </thead>
  102. <tbody class="stage-data">
  103. </tbody>
  104. </table>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="col-4 px-0 pb-1 height-100">
  112. <div class="height-100 px-1">
  113. <div class="center-chart pb-1">
  114. <div class="card height-100 bg-dark">
  115. <div class="gcsrqk_chart" style="height: 100%; width: 100%;"></div>
  116. </div>
  117. </div>
  118. <div class="center-chart pt-1 text-center text-white">
  119. <div class="height-100 row">
  120. <div class="col-6 pr-1">
  121. <div class="center-chart pb-1">
  122. <div class="card height-100 bg-dark">
  123. <div class="height-100" style="display: grid;place-items: center;">
  124. <div style="line-height: 3;">
  125. <div style="font-size: 1.2rem" class="gcsr_price"></div>
  126. <div style="font-size: .9rem;">
  127. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">工程收入</span>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="center-chart pt-1">
  134. <div class="card height-100 bg-dark">
  135. <div class="height-100" style="display: grid;place-items: center;">
  136. <div style="line-height: 3;">
  137. <div style="font-size: 1.2rem" class="gclr_price"></div>
  138. <div style="font-size: .9rem;">
  139. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">工程利润</span>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="col-6 pl-1">
  147. <div class="center-chart pb-1">
  148. <div class="card height-100 bg-dark">
  149. <div class="height-100" style="display: grid;place-items: center;">
  150. <div style="line-height: 3;">
  151. <div style="font-size: 1.2rem" class="gccb_price"></div>
  152. <div style="font-size: .9rem;">
  153. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">工程成本</span>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <div class="center-chart pt-1">
  160. <div class="card height-100 bg-dark">
  161. <div class="height-100" style="display: grid;place-items: center;">
  162. <div style="line-height: 3;">
  163. <div style="font-size: 1.2rem" class="gclrl_num"></div>
  164. <div style="font-size: .9rem;">
  165. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">工程利润率</span>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="col-4 px-0 pb-1 height-100">
  177. <div class="height-100 pl-1">
  178. <div class="center-chart pb-1">
  179. <div class="card height-100 bg-dark">
  180. <div class="yingsf_chart" style="height: 100%; width: 100%;"></div>
  181. </div>
  182. </div>
  183. <div class="center-chart pt-1">
  184. <div class="card height-100 bg-dark">
  185. <div class="yisf_chart" style="height: 100%; width: 100%;"></div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="row mx-3" style="height: 32vh">
  192. <div class="col-3 px-0 pt-1 height-100">
  193. <div class="height-100" style="padding-right: .375rem !important;">
  194. <% if (dpCategory.length > 0 && dpCategory[0]) { %>
  195. <div class="card bg-dark height-100">
  196. <div class="dpgl_chart" style="height: 100%; width: 100%;"></div>
  197. </div>
  198. <% } %>
  199. </div>
  200. </div>
  201. <div class="col-3 px-0 pt-1 height-100">
  202. <div class="height-100 pr-1" style="padding-left: .125rem !important;">
  203. <% if (dpCategory.length > 1 && dpCategory[1]) { %>
  204. <div class="card bg-dark height-100">
  205. <div class="dpgl_chart" style="height: 100%; width: 100%;"></div>
  206. </div>
  207. <% } %>
  208. </div>
  209. </div>
  210. <div class="col-3 px-0 pt-1 height-100">
  211. <div class="height-100 pl-1" style="padding-right: .125rem !important;">
  212. <% if (dpCategory.length > 2 && dpCategory[2]) { %>
  213. <div class="card bg-dark height-100">
  214. <div class="dpgl_chart" style="height: 100%; width: 100%;"></div>
  215. </div>
  216. <% } %>
  217. </div>
  218. </div>
  219. <div class="col-3 px-0 pt-1 height-100">
  220. <div class="height-100" style="padding-left: .375rem !important;">
  221. <% if (dpCategory.length > 3 && dpCategory[3]) { %>
  222. <div class="card bg-dark height-100">
  223. <div class="dpgl_chart" style="height: 100%; width: 100%;"></div>
  224. </div>
  225. <% } %>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. <!--<script src="/public/js/datacollect_scroll.js"></script>-->
  234. <script type="text/javascript"> autoFlashHeight();</script>
  235. <script type="text/javascript">
  236. const category = JSON.parse(unescape('<%- escape(JSON.stringify(categoryData)) %>'));
  237. const daping06Set = JSON.parse(unescape('<%- escape(JSON.stringify(daping06Set)) %>'));
  238. const dpCategory = JSON.parse(unescape('<%- escape(JSON.stringify(dpCategory)) %>'));
  239. const gcsrmx_option = {
  240. title: {
  241. text: '工程收入明细',
  242. left: 'center',
  243. top:'5%'
  244. },
  245. color: ['rgba(0, 157, 255,1)','rgba(34,228,255,1)',
  246. 'rgba(59,255,208,1)','rgba(108, 78, 229,0.7)',
  247. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  248. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  249. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  250. 'rgba(242, 179, 82, 0.7)'],
  251. backgroundColor: '#343a40 ',
  252. tooltip: {
  253. trigger: 'axis',
  254. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  255. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  256. },
  257. },
  258. dataZoom: [
  259. {
  260. brushSelect:false,
  261. // zoomLock: false,
  262. type: 'slider',
  263. show: true,
  264. realtime: true,
  265. showdetail: false,
  266. showDataShadow: false,
  267. // dataZoomIndex: 10,
  268. start: 0,
  269. end: 8,
  270. handleSize: 0,
  271. height: 10,
  272. bottom: '10%',
  273. },
  274. ],
  275. legend: {
  276. data: ['已完成', '应收入', '已收入'],
  277. top:'17%'
  278. },
  279. grid: {
  280. top:'25%',
  281. left: '3%',
  282. right: '4%',
  283. bottom: '15%',
  284. containLabel: true
  285. },
  286. xAxis: [
  287. {
  288. type: 'category',
  289. data: [],
  290. axisLabel: {
  291. show: true,
  292. interval: 0,
  293. textStyle: {
  294. color: "#fff",
  295. fontSize: 12
  296. },
  297. formatter: function(value) {
  298. var res = value;
  299. if(res.length > 10) {
  300. res = res.substring(0, 10) + "..";
  301. }
  302. return res;
  303. }
  304. }
  305. }
  306. ],
  307. yAxis: [
  308. {
  309. type: 'value',
  310. name:'金额',
  311. position: 'left',
  312. axisLabel : {
  313. formatter: function (value, index) {
  314. if (value < 0) {
  315. let newValue = Math.abs(value);
  316. if (newValue >= 10000 && newValue < 10000000) {
  317. newValue = newValue / 10000 + "万";
  318. } else if (newValue >= 10000000) {
  319. newValue = newValue / 10000000 + "千万";
  320. }
  321. value = '-' + newValue;
  322. }
  323. if (value >= 10000 && value < 10000000) {
  324. value = value / 10000 + "万";
  325. } else if (value >= 10000000) {
  326. value = value / 10000000 + "千万";
  327. }
  328. return value;
  329. }
  330. },
  331. splitArea : {show : true}
  332. },
  333. ],
  334. series: [
  335. {
  336. name: '已完成',
  337. type: 'bar',
  338. emphasis: {
  339. focus: 'series'
  340. },
  341. data: []
  342. },
  343. {
  344. name: '应收入',
  345. type: 'bar',
  346. emphasis: {
  347. focus: 'series'
  348. },
  349. data: []
  350. },
  351. {
  352. name: '已收入',
  353. type: 'bar',
  354. emphasis: {
  355. focus: 'series'
  356. },
  357. data: []
  358. }
  359. ]
  360. };
  361. const gcsrmx_chart = document.getElementsByClassName('gcsrmx_chart');
  362. const gcsrmxChart = echarts.init(gcsrmx_chart[0], 'dark');
  363. gcsrmxChart.setOption(gcsrmx_option);
  364. const gcsrqk_option = {
  365. title: {
  366. text: '工程收入情况',
  367. left: 'center',
  368. top:'5%'
  369. },
  370. color: ['rgba(0, 157, 255, 1)','rgba(78, 139, 229,1)',
  371. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  372. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  373. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  374. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  375. 'rgba(242, 179, 82, 0.7)'],
  376. backgroundColor: '#343a40',
  377. tooltip: {
  378. trigger: 'axis',
  379. axisPointer: { // Use axis to trigger tooltip
  380. type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
  381. }
  382. },
  383. grid: {
  384. left: '10%',
  385. right: '10%',
  386. bottom: '3%',
  387. containLabel: true
  388. },
  389. xAxis: {
  390. type: 'value',
  391. name:'金额',
  392. position: 'bottom',
  393. axisLabel : {
  394. formatter: function (value, index) {
  395. if (value < 0) {
  396. let newValue = Math.abs(value);
  397. if (newValue >= 10000 && newValue < 10000000) {
  398. newValue = newValue / 10000 + "万";
  399. } else if (newValue >= 10000000) {
  400. newValue = newValue / 10000000 + "千万";
  401. }
  402. value = '-' + newValue;
  403. }
  404. if (value >= 10000 && value < 10000000) {
  405. value = value / 10000 + "万";
  406. } else if (value >= 10000000) {
  407. value = value / 10000000 + "千万";
  408. }
  409. return value;
  410. }
  411. },
  412. splitArea : {show : true}
  413. },
  414. yAxis: {
  415. type: 'category',
  416. data: ['待收入', '已收入', '应收入', '已完成', '合同'],
  417. axisLabel: {
  418. show: true,
  419. interval: 0,
  420. formatter: function(value) {
  421. var res = value;
  422. if(res.length > 10) {
  423. res = res.substring(0, 10) + "..";
  424. }
  425. return res;
  426. }
  427. }
  428. },
  429. dataZoom: [
  430. {
  431. brushSelect:false,
  432. start: 0,
  433. end: 10,
  434. type: 'slider',
  435. show: true,
  436. handleSize: 0,
  437. realtime: true,
  438. showDetail: false,
  439. // filterMode: 'empty',
  440. yAxisIndex: [0,1],
  441. width: 10,
  442. height: '80%',
  443. right: '5%',
  444. bottom:'2%'
  445. },
  446. ],
  447. series: [
  448. {
  449. name: '情况',
  450. type: 'bar',
  451. stack: 'total',
  452. label: {
  453. show: true
  454. },
  455. emphasis: {
  456. focus: 'series'
  457. },
  458. data: [],
  459. }
  460. ]
  461. };
  462. const gcsrqk_chart = document.getElementsByClassName('gcsrqk_chart');
  463. const gcsrqkChart = echarts.init(gcsrqk_chart[0], 'dark');
  464. gcsrqkChart.setOption(gcsrqk_option);
  465. const yingsf_option = {
  466. title: {
  467. text: '应收与应付对比',
  468. left: 'center',
  469. top:'5%'
  470. },
  471. color: ['rgba(0, 157, 255,1)','rgba(34,228,255,1)',
  472. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  473. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  474. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  475. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  476. 'rgba(242, 179, 82, 0.7)'],
  477. backgroundColor: '#343a40 ',
  478. tooltip: {
  479. trigger: 'axis',
  480. axisPointer: {
  481. type: 'cross',
  482. label: {
  483. backgroundColor: '#6a7985'
  484. }
  485. }
  486. },
  487. legend: {
  488. data: ['工程应收', '工程应付'],
  489. top:'15%'
  490. },
  491. grid: {
  492. top:'25%',
  493. left: '3%',
  494. right: '4%',
  495. bottom: '15%',
  496. containLabel: true
  497. },
  498. xAxis: [
  499. {
  500. type: 'category',
  501. boundaryGap: false,
  502. data: []
  503. }
  504. ],
  505. yAxis: [
  506. {
  507. type: 'value',
  508. axisLabel : {
  509. formatter: function (value, index) {
  510. if (value < 0) {
  511. let newValue = Math.abs(value);
  512. if (newValue >= 10000 && newValue < 10000000) {
  513. newValue = newValue / 10000 + "万";
  514. } else if (newValue >= 10000000) {
  515. newValue = newValue / 10000000 + "千万";
  516. }
  517. value = '-' + newValue;
  518. }
  519. if (value >= 10000 && value < 10000000) {
  520. value = value / 10000 + "万";
  521. } else if (value >= 10000000) {
  522. value = value / 10000000 + "千万";
  523. }
  524. return value;
  525. }
  526. },
  527. }
  528. ],
  529. dataZoom: [
  530. {
  531. brushSelect: false,
  532. showdetail: false,
  533. show: true,
  534. realtime: true,
  535. dataZoomIndex: 10,
  536. start: 0,
  537. end: 8,
  538. handleSize: 0,
  539. height: 10,
  540. bottom: '10%'
  541. },
  542. ],
  543. series: [
  544. {
  545. name: '工程应收',
  546. type: 'line',
  547. // stack: '总量',
  548. // areaStyle: {},
  549. emphasis: {
  550. focus: 'series'
  551. },
  552. data: []
  553. },
  554. {
  555. name: '工程应付',
  556. type: 'line',
  557. // stack: '总量',
  558. // areaStyle: {},
  559. emphasis: {
  560. focus: 'series'
  561. },
  562. data: []
  563. }
  564. ]
  565. };
  566. const yingsf_chart = document.getElementsByClassName('yingsf_chart');
  567. const yingsfChart = echarts.init(yingsf_chart[0], 'dark');
  568. yingsfChart.setOption(yingsf_option);
  569. const yisf_option = {
  570. title: {
  571. text: '已收与已付对比',
  572. left: 'center',
  573. top:'5%'
  574. },
  575. color: ['rgba(0, 157, 255,1)','rgba(34,228,255,1)',
  576. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  577. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  578. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  579. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  580. 'rgba(242, 179, 82, 0.7)'],
  581. backgroundColor: '#343a40 ',
  582. tooltip: {
  583. trigger: 'axis',
  584. axisPointer: {
  585. type: 'cross',
  586. label: {
  587. backgroundColor: '#6a7985'
  588. }
  589. }
  590. },
  591. legend: {
  592. data: ['工程已收', '工程已付'],
  593. top:'15%'
  594. },
  595. grid: {
  596. top:'25%',
  597. left: '3%',
  598. right: '4%',
  599. bottom: '15%',
  600. containLabel: true
  601. },
  602. xAxis: [
  603. {
  604. type: 'category',
  605. boundaryGap: false,
  606. data: []
  607. }
  608. ],
  609. yAxis: [
  610. {
  611. type: 'value',
  612. axisLabel : {
  613. formatter: function (value, index) {
  614. if (value < 0) {
  615. let newValue = Math.abs(value);
  616. if (newValue >= 10000 && newValue < 10000000) {
  617. newValue = newValue / 10000 + "万";
  618. } else if (newValue >= 10000000) {
  619. newValue = newValue / 10000000 + "千万";
  620. }
  621. value = '-' + newValue;
  622. }
  623. if (value >= 10000 && value < 10000000) {
  624. value = value / 10000 + "万";
  625. } else if (value >= 10000000) {
  626. value = value / 10000000 + "千万";
  627. }
  628. return value;
  629. }
  630. },
  631. }
  632. ],
  633. dataZoom: [
  634. {
  635. brushSelect: false,
  636. showdetail: false,
  637. show: true,
  638. realtime: true,
  639. dataZoomIndex: 10,
  640. start: 0,
  641. end: 8,
  642. handleSize: 0,
  643. height: 10,
  644. bottom: '10%'
  645. },
  646. ],
  647. series: [
  648. {
  649. name: '工程已收',
  650. type: 'line',
  651. // stack: '总量',
  652. // areaStyle: {},
  653. emphasis: {
  654. focus: 'series'
  655. },
  656. data: []
  657. },
  658. {
  659. name: '工程已付',
  660. type: 'line',
  661. // stack: '总量',
  662. // areaStyle: {},
  663. emphasis: {
  664. focus: 'series'
  665. },
  666. data: []
  667. }
  668. ]
  669. };
  670. const yisf_chart = document.getElementsByClassName('yisf_chart');
  671. const yisfChart = echarts.init(yisf_chart[0], 'dark');
  672. yisfChart.setOption(yisf_option);
  673. const dpglChartOption = {
  674. title: {
  675. text: '管理',
  676. left: 'center',
  677. top:'5%'
  678. },
  679. color: ['rgba(0, 157, 255,1)','rgba(34,228,255,1)',
  680. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  681. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  682. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  683. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  684. 'rgba(242, 179, 82, 0.7)'],
  685. backgroundColor: '#343a40 ',
  686. tooltip: {
  687. trigger: 'axis',
  688. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  689. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  690. },
  691. },
  692. dataZoom: [
  693. {
  694. brushSelect:false,
  695. // zoomLock: false,
  696. type: 'slider',
  697. show: true,
  698. realtime: true,
  699. showdetail: false,
  700. showDataShadow: false,
  701. // dataZoomIndex: 10,
  702. start: 0,
  703. end: 8,
  704. handleSize: 0,
  705. height: 10,
  706. bottom: '10%',
  707. },
  708. ],
  709. legend: {
  710. data: ['已完成', '已支付'],
  711. top:'17%'
  712. },
  713. grid: {
  714. top:'25%',
  715. left: '3%',
  716. right: '4%',
  717. bottom: '15%',
  718. containLabel: true
  719. },
  720. xAxis: [
  721. {
  722. type: 'category',
  723. data: [],
  724. axisLabel: {
  725. show: true,
  726. interval: 0,
  727. textStyle: {
  728. color: "#fff",
  729. fontSize: 12
  730. },
  731. formatter: function(value) {
  732. var res = value;
  733. if(res.length > 10) {
  734. res = res.substring(0, 10) + "..";
  735. }
  736. return res;
  737. }
  738. }
  739. }
  740. ],
  741. yAxis: [
  742. {
  743. type: 'value',
  744. name:'金额',
  745. position: 'left',
  746. axisLabel : {
  747. formatter: function (value, index) {
  748. if (value < 0) {
  749. let newValue = Math.abs(value);
  750. if (newValue >= 10000 && newValue < 10000000) {
  751. newValue = newValue / 10000 + "万";
  752. } else if (newValue >= 10000000) {
  753. newValue = newValue / 10000000 + "千万";
  754. }
  755. value = '-' + newValue;
  756. }
  757. if (value >= 10000 && value < 10000000) {
  758. value = value / 10000 + "万";
  759. } else if (value >= 10000000) {
  760. value = value / 10000000 + "千万";
  761. }
  762. return value;
  763. }
  764. },
  765. splitArea : {show : true}
  766. },
  767. ],
  768. series: [
  769. {
  770. name: '已完成',
  771. type: 'bar',
  772. emphasis: {
  773. focus: 'series'
  774. },
  775. data: []
  776. },
  777. {
  778. name: '已支付',
  779. type: 'bar',
  780. stack: '计量',
  781. emphasis: {
  782. focus: 'series'
  783. },
  784. data: []
  785. }
  786. ]
  787. };
  788. const dpgl_chart = document.getElementsByClassName('dpgl_chart');
  789. const dpgl_charts = [];
  790. for (const d in dpCategory) {
  791. dpgl_charts[d] = echarts.init(dpgl_chart[d], 'dark');
  792. const option = _.cloneDeep(dpglChartOption);
  793. option.title.text = dpCategory[d].value;
  794. dpgl_charts[d].setOption(option);
  795. }
  796. let tenders = '';
  797. $(function () {
  798. $('#showFull').click(function () {
  799. const full=document.getElementById("big-data");
  800. launchIntoFullscreen(full);
  801. });
  802. $('#exitFull').click(function () {
  803. exitFullscreen();
  804. })
  805. // 数据全屏
  806. function launchIntoFullscreen(element) {
  807. if(element.requestFullscreen){
  808. element.requestFullscreen();
  809. }
  810. else if(element.mozRequestFullScreen) {
  811. element.mozRequestFullScreen();
  812. }
  813. else if(element.webkitRequestFullscreen) {
  814. element.webkitRequestFullscreen();
  815. }
  816. else if(element.msRequestFullscreen) {
  817. element.msRequestFullscreen();
  818. }
  819. }
  820. function exitFullscreen() {
  821. if(document.exitFullscreen) {
  822. document.exitFullscreen();
  823. } else if(document.mozCancelFullScreen) {
  824. document.mozCancelFullScreen();
  825. } else if(document.webkitExitFullscreen) {
  826. document.webkitExitFullscreen();
  827. }
  828. }
  829. document.addEventListener("fullscreenchange", function (event) {
  830. if (document.fullscreenElement) {
  831. $('#exitfull-div').show();
  832. $('#showFull').hide();
  833. } else {
  834. $('#exitfull-div').hide();
  835. $('#showFull').show();
  836. }
  837. });
  838. postData('/datacollect/load', {}, function (result) {
  839. tenders = result.tenderList;
  840. if (category && category.length > 0) {
  841. if (category[0] && category[0].value.length > 0) {
  842. for (const [i, fc] of category[0].value.entries()) {
  843. const fcCategory = {cid: fc.cid, value: fc.id};
  844. if (_.findIndex(tenders, function (item) {
  845. return _.findIndex(item.category, fcCategory) !== -1;
  846. }) === -1) {
  847. $('#first-category .select-cate').eq(i + 1).hide();
  848. } else {
  849. $('#first-category .select-cate').eq(i + 1).show();
  850. }
  851. }
  852. }
  853. }
  854. for (const t of tenders) {
  855. calculateTender(t);
  856. }
  857. console.log(tenders);
  858. setData(tenders);
  859. });
  860. function calculateTender(tender) {
  861. if (tender.stage_tp) {
  862. tender.gather_tp = ZhCalc.sum([tender.stage_tp.contract_tp, tender.stage_tp.qc_tp, tender.stage_tp.pc_tp]);
  863. tender.end_contract_tp = ZhCalc.sum([tender.stage_tp.pre_contract_tp, tender.stage_tp.contract_tp, tender.stage_tp.contract_pc_tp]);
  864. tender.end_qc_tp = ZhCalc.sum([tender.stage_tp.pre_qc_tp, tender.stage_tp.qc_tp, tender.stage_tp.qc_pc_tp]);
  865. tender.end_gather_tp = ZhCalc.add(tender.end_contract_tp, tender.end_qc_tp);
  866. tender.pre_gather_tp = ZhCalc.add(tender.stage_tp.pre_contract_tp, tender.stage_tp.pre_qc_tp);
  867. tender.yf_tp = ZhCalc.add(tender.stage_tp.yf_tp);
  868. tender.end_yf_tp = ZhCalc.add(tender.stage_tp.pre_yf_tp, tender.yf_tp);
  869. tender.sf_tp = ZhCalc.add(tender.stage_tp.sf_tp);
  870. tender.end_sf_tp = ZhCalc.add(tender.stage_tp.pre_sf_tp, tender.sf_tp);
  871. }
  872. }
  873. function setData(tenderList, categoryIndex = 0) {
  874. let gcsr_price = 0;
  875. let gccb_price = 0;
  876. let gclr_price = 0;
  877. let gclrl_num = 0;
  878. // 区分工程收入和工程成本
  879. const sr_tenders = _.filter(tenderList, function (item) {
  880. return _.findIndex(item.category, {cid: daping06Set.sr, value: daping06Set.sr_value}) !== -1;
  881. });
  882. const cb_tenders = _.filter(tenderList, function (item) {
  883. return _.findIndex(item.category, {cid: daping06Set.cb, value: daping06Set.cb_value}) !== -1;
  884. });
  885. const sr_chart_option_data = {
  886. contract_price: 0,
  887. end_gather_tp: 0,
  888. end_yf_tp: 0,
  889. end_sf_tp: 0,
  890. end_ds_tp: 0,
  891. };
  892. const srmx_chart_option_name = [];
  893. const srmx_chart_option_data = {
  894. end_gather_tp: [],
  895. end_yf_tp:[],
  896. end_sf_tp:[],
  897. };
  898. const yingsf_option_data = [];
  899. const yisf_option_data = [];
  900. for (const sr of sr_tenders) {
  901. sr_chart_option_data.contract_price = ZhCalc.add(sr_chart_option_data.contract_price, sr.contract_price);
  902. sr_chart_option_data.end_gather_tp = ZhCalc.add(sr_chart_option_data.end_gather_tp, sr.end_gather_tp);
  903. sr_chart_option_data.end_yf_tp = ZhCalc.add(sr_chart_option_data.end_yf_tp, sr.end_yf_tp);
  904. sr_chart_option_data.end_sf_tp = ZhCalc.add(sr_chart_option_data.end_sf_tp, sr.end_sf_tp);
  905. srmx_chart_option_name.push(sr.name);
  906. srmx_chart_option_data.end_gather_tp.push(sr.end_gather_tp ? sr.end_gather_tp : 0);
  907. srmx_chart_option_data.end_yf_tp.push(sr.end_yf_tp ? sr.end_yf_tp : 0);
  908. srmx_chart_option_data.end_sf_tp.push(sr.end_sf_tp ? sr.end_sf_tp : 0);
  909. for (const s of sr.month_stage) {
  910. const index = _.findIndex(yingsf_option_data, { yearmonth: s.yearmonth });
  911. const yiIndex = _.findIndex(yisf_option_data, { yearmonth: s.yearmonth });
  912. if (index === -1) {
  913. yingsf_option_data.push({
  914. yearmonth: s.yearmonth,
  915. ys_tp: s.end_yf_tp,
  916. yf_tp: 0,
  917. had_ys: true,
  918. had_yf: false,
  919. });
  920. } else {
  921. yingsf_option_data[index].had_ys = true;
  922. yingsf_option_data[index].ys_tp = ZhCalc.add(yingsf_option_data[index].ys_tp, s.end_yf_tp);
  923. }
  924. if (yiIndex === -1) {
  925. yisf_option_data.push({
  926. yearmonth: s.yearmonth,
  927. ys_tp: s.end_sf_tp,
  928. yf_tp: 0,
  929. had_ys: true,
  930. had_yf: false,
  931. });
  932. } else {
  933. yisf_option_data[yiIndex].had_ys = true;
  934. yisf_option_data[yiIndex].ys_tp = ZhCalc.add(yisf_option_data[yiIndex].ys_tp, s.end_sf_tp);
  935. }
  936. }
  937. }
  938. sr_chart_option_data.end_ds_tp = ZhCalc.sub(sr_chart_option_data.end_yf_tp, sr_chart_option_data.end_sf_tp);
  939. // 工程收入明细
  940. const gcsrmx_chart_option = gcsrmxChart.getOption();
  941. gcsrmx_chart_option.dataZoom[0].start = 0;
  942. gcsrmx_chart_option.dataZoom[0].end = computedPosition(sr_tenders.length);
  943. gcsrmx_chart_option.xAxis[0].data = srmx_chart_option_name;
  944. gcsrmx_chart_option.series[0].data = srmx_chart_option_data.end_gather_tp;
  945. gcsrmx_chart_option.series[1].data = srmx_chart_option_data.end_yf_tp;
  946. gcsrmx_chart_option.series[2].data = srmx_chart_option_data.end_sf_tp;
  947. if (sr_tenders.length >= 8) {
  948. gcsrmx_chart_option.dataZoom[0].show = true;
  949. } else {
  950. gcsrmx_chart_option.dataZoom[0].show = false;
  951. }
  952. gcsrmxChart.setOption(gcsrmx_chart_option);
  953. // 工程收入情况
  954. const gcsrqk_chart_option = gcsrqkChart.getOption();
  955. gcsrqk_chart_option.dataZoom[0].start = 0;
  956. gcsrqk_chart_option.dataZoom[0].end = computedPosition(sr_tenders.length);
  957. gcsrqk_chart_option.series[0].data = [sr_chart_option_data.end_ds_tp, sr_chart_option_data.end_sf_tp, sr_chart_option_data.end_yf_tp, sr_chart_option_data.end_gather_tp, sr_chart_option_data.contract_price];
  958. if (sr_tenders.length >= 8) {
  959. gcsrqk_chart_option.dataZoom[0].show = true;
  960. } else {
  961. gcsrqk_chart_option.dataZoom[0].show = false;
  962. }
  963. gcsrqkChart.setOption(gcsrqk_chart_option);
  964. const cb_chart_option_data = {
  965. // end_contract_tp: 0,
  966. end_gather_tp: 0,
  967. end_yf_tp: 0,
  968. end_sf_tp: 0,
  969. end_ds_tp: 0,
  970. };
  971. const cb_chart_option_name = [];
  972. for (const cb of cb_tenders) {
  973. cb_chart_option_name.push(cb.name);
  974. // cb_chart_option_data.end_contract_tp = ZhCalc.add(cb_chart_option_data.end_contract_tp, cb.end_contract_tp);
  975. cb_chart_option_data.end_gather_tp = ZhCalc.add(cb_chart_option_data.end_gather_tp, cb.end_gather_tp);
  976. cb_chart_option_data.end_yf_tp = ZhCalc.add(cb_chart_option_data.end_yf_tp, cb.end_yf_tp);
  977. cb_chart_option_data.end_sf_tp = ZhCalc.add(cb_chart_option_data.end_sf_tp, cb.end_sf_tp);
  978. for (const s of cb.month_stage) {
  979. const index = _.findIndex(yingsf_option_data, { yearmonth: s.yearmonth });
  980. const yiIndex = _.findIndex(yisf_option_data, { yearmonth: s.yearmonth });
  981. if (index === -1) {
  982. yingsf_option_data.push({
  983. yearmonth: s.yearmonth,
  984. ys_tp: 0,
  985. yf_tp: s.end_yf_tp,
  986. had_ys: false,
  987. had_yf: true,
  988. });
  989. } else {
  990. yingsf_option_data[index].had_yf = true;
  991. yingsf_option_data[index].yf_tp = ZhCalc.add(yingsf_option_data[index].yf_tp, s.end_yf_tp);
  992. }
  993. if (yiIndex === -1) {
  994. yisf_option_data.push({
  995. yearmonth: s.yearmonth,
  996. ys_tp: 0,
  997. yf_tp: s.end_sf_tp,
  998. had_ys: false,
  999. had_yf: true,
  1000. });
  1001. } else {
  1002. yisf_option_data[index].had_yf = true;
  1003. yisf_option_data[yiIndex].yf_tp = ZhCalc.add(yisf_option_data[yiIndex].yf_tp, s.end_sf_tp);
  1004. }
  1005. }
  1006. }
  1007. cb_chart_option_data.end_ds_tp = ZhCalc.sub(cb_chart_option_data.end_yf_tp, cb_chart_option_data.end_sf_tp);
  1008. // 中间表格数值
  1009. gcsr_price = sr_chart_option_data.end_yf_tp;
  1010. $('.gcsr_price').text(formatNum(gcsr_price, '#,##0.######'));
  1011. gccb_price = cb_chart_option_data.end_yf_tp;
  1012. $('.gccb_price').text(formatNum(gccb_price, '#,##0.######'));
  1013. gclr_price = ZhCalc.sub(gcsr_price, gccb_price);
  1014. $('.gclr_price').text(formatNum(gclr_price, '#,##0.######'));
  1015. gclrl_num = ZhCalc.round(ZhCalc.div(gclr_price, gccb_price)*100, 2);
  1016. $('.gclrl_num').text((gclrl_num ? gclrl_num : 0) + '%');
  1017. // 应收应付及已收已付
  1018. const show_yingsf_option_data = {
  1019. yearmonth: [],
  1020. yf_tp: [],
  1021. ys_tp: [],
  1022. };
  1023. if (yingsf_option_data.length > 0) {
  1024. // chart_option4_data 排序
  1025. const new_yingsf_option_data = _.sortBy(yingsf_option_data, 'yearmonth');
  1026. for (const c4 of new_yingsf_option_data) {
  1027. show_yingsf_option_data.yearmonth.push(c4.yearmonth);
  1028. const hadYsDatas = _.filter(new_yingsf_option_data, function (item) {
  1029. return item.yearmonth < c4.yearmonth;
  1030. });
  1031. // 找出最近的一个had_ys为true值
  1032. if (hadYsDatas.length > 0) {
  1033. c4.ys_tp = hadYsDatas[hadYsDatas.length - 1].ys_tp + c4.ys_tp;
  1034. }
  1035. // if (!c4.had_ys) {
  1036. // const hadYsDatas = _.filter(new_yingsf_option_data, function (item) {
  1037. // return item.had_ys && item.yearmonth < c4.yearmonth;
  1038. // });
  1039. // // 找出最近的一个had_ys为true值
  1040. // if (hadYsDatas.length > 0) {
  1041. // c4.ys_tp = hadYsDatas[hadYsDatas.length - 1].ys_tp;
  1042. // }
  1043. // }
  1044. show_yingsf_option_data.ys_tp.push(c4.ys_tp);
  1045. const hadYfDatas = _.filter(new_yingsf_option_data, function (item) {
  1046. return item.yearmonth < c4.yearmonth;
  1047. });
  1048. // 找出最近的一个had_yf为true值
  1049. if (hadYfDatas.length > 0) {
  1050. c4.yf_tp = hadYfDatas[hadYfDatas.length - 1].yf_tp + c4.yf_tp;
  1051. }
  1052. // if (!c4.had_yf) {
  1053. // const hadYfDatas = _.filter(new_yingsf_option_data, function (item) {
  1054. // return item.had_yf && item.yearmonth < c4.yearmonth;
  1055. // });
  1056. // // 找出最近的一个had_yf为true值
  1057. // if (hadYfDatas.length > 0) {
  1058. // c4.yf_tp = hadYfDatas[hadYfDatas.length - 1].yf_tp;
  1059. // }
  1060. // }
  1061. show_yingsf_option_data.yf_tp.push(c4.yf_tp);
  1062. }
  1063. }
  1064. const yingsf_option = yingsfChart.getOption();
  1065. yingsf_option.dataZoom[0].start = 0;
  1066. yingsf_option.dataZoom[0].end = computedPosition(show_yingsf_option_data.yearmonth.length);
  1067. yingsf_option.xAxis[0].data = show_yingsf_option_data.yearmonth;
  1068. yingsf_option.series[0].data = show_yingsf_option_data.ys_tp;
  1069. yingsf_option.series[1].data = show_yingsf_option_data.yf_tp;
  1070. if (show_yingsf_option_data.yearmonth.length >= 8) {
  1071. yingsf_option.dataZoom[0].show = true;
  1072. } else {
  1073. yingsf_option.dataZoom[0].show = false;
  1074. }
  1075. yingsfChart.setOption(yingsf_option);
  1076. const show_yisf_option_data = {
  1077. yearmonth: [],
  1078. yf_tp: [],
  1079. ys_tp: [],
  1080. };
  1081. if (yisf_option_data.length > 0) {
  1082. const new_yisf_option_data = _.sortBy(yisf_option_data, 'yearmonth');
  1083. for (const c4 of new_yisf_option_data) {
  1084. show_yisf_option_data.yearmonth.push(c4.yearmonth);
  1085. const hadYsDatas = _.filter(new_yisf_option_data, function (item) {
  1086. return item.yearmonth < c4.yearmonth;
  1087. });
  1088. // 找出最近的一个had_ys为true值
  1089. if (hadYsDatas.length > 0) {
  1090. c4.ys_tp = hadYsDatas[hadYsDatas.length - 1].ys_tp + c4.ys_tp;
  1091. }
  1092. // if (!c4.had_ys) {
  1093. // const hadYsDatas = _.filter(new_yisf_option_data, function (item) {
  1094. // return item.had_ys && item.yearmonth < c4.yearmonth;
  1095. // });
  1096. // // 找出最近的一个had_ys为true值
  1097. // if (hadYsDatas.length > 0) {
  1098. // c4.ys_tp = hadYsDatas[hadYsDatas.length - 1].ys_tp;
  1099. // }
  1100. // }
  1101. show_yisf_option_data.ys_tp.push(c4.ys_tp);
  1102. const hadYfDatas = _.filter(new_yisf_option_data, function (item) {
  1103. return item.yearmonth < c4.yearmonth;
  1104. });
  1105. // 找出最近的一个had_yf为true值
  1106. if (hadYfDatas.length > 0) {
  1107. c4.yf_tp = hadYfDatas[hadYfDatas.length - 1].yf_tp + c4.yf_tp;
  1108. }
  1109. // if (!c4.had_yf) {
  1110. // const hadYfDatas = _.filter(new_yisf_option_data, function (item) {
  1111. // return item.had_yf && item.yearmonth < c4.yearmonth;
  1112. // });
  1113. // // 找出最近的一个had_yf为true值
  1114. // if (hadYfDatas.length > 0) {
  1115. // c4.yf_tp = hadYfDatas[hadYfDatas.length - 1].yf_tp;
  1116. // }
  1117. // }
  1118. show_yisf_option_data.yf_tp.push(c4.yf_tp);
  1119. }
  1120. }
  1121. const yisf_option = yisfChart.getOption();
  1122. yisf_option.dataZoom[0].start = 0;
  1123. yisf_option.dataZoom[0].end = computedPosition(show_yisf_option_data.yearmonth.length);
  1124. yisf_option.xAxis[0].data = show_yisf_option_data.yearmonth;
  1125. yisf_option.series[0].data = show_yisf_option_data.ys_tp;
  1126. yisf_option.series[1].data = show_yisf_option_data.yf_tp;
  1127. if (show_yisf_option_data.yearmonth.length >= 8) {
  1128. yisf_option.dataZoom[0].show = true;
  1129. } else {
  1130. yisf_option.dataZoom[0].show = false;
  1131. }
  1132. yisfChart.setOption(yisf_option);
  1133. // 最底下1排4个管理图表输出设置和工程成本管理汇总表格设置
  1134. const gccbglhz = [];
  1135. if (dpgl_charts.length > 0) {
  1136. for (const d in dpCategory) {
  1137. if (d) {
  1138. const dpgl_option = dpgl_charts[d].getOption();
  1139. dpgl_option.dataZoom[0].start = 0;
  1140. const dpgl_chart_option_name = [];
  1141. const dpgl_chart_option_data = {
  1142. end_gather_tp: [],
  1143. end_sf_tp:[],
  1144. };
  1145. const cbgl_tenders = _.filter(tenderList, function (item) {
  1146. return _.findIndex(item.category, {cid: dpCategory[d].cid, value: dpCategory[d].id}) !== -1;
  1147. });
  1148. const oneCbgl = {
  1149. name: dpCategory[d].value,
  1150. end_gather_tp: 0,
  1151. end_sf_tp: 0,
  1152. end_yf_tp: 0,
  1153. }
  1154. for (const t of cbgl_tenders) {
  1155. dpgl_chart_option_name.push(t.name);
  1156. dpgl_chart_option_data.end_gather_tp.push(t.end_gather_tp ? t.end_gather_tp : 0);
  1157. dpgl_chart_option_data.end_sf_tp.push(t.end_sf_tp ? t.end_sf_tp : 0);
  1158. oneCbgl.end_gather_tp = t.end_gather_tp ? ZhCalc.add(oneCbgl.end_gather_tp, t.end_gather_tp) : oneCbgl.end_gather_tp;
  1159. oneCbgl.end_sf_tp = t.end_sf_tp ? ZhCalc.add(oneCbgl.end_sf_tp, t.end_sf_tp) : oneCbgl.end_sf_tp;
  1160. oneCbgl.end_yf_tp = t.end_yf_tp ? ZhCalc.add(oneCbgl.end_yf_tp, t.end_yf_tp) : oneCbgl.end_yf_tp;
  1161. }
  1162. oneCbgl.end_df_tp = ZhCalc.sub(oneCbgl.end_yf_tp, oneCbgl.end_sf_tp);
  1163. gccbglhz.push(oneCbgl);
  1164. dpgl_option.dataZoom[0].end = computedPosition(cbgl_tenders.length);
  1165. dpgl_option.xAxis[0].data = dpgl_chart_option_name;
  1166. dpgl_option.series[0].data = dpgl_chart_option_data.end_gather_tp;
  1167. dpgl_option.series[1].data = dpgl_chart_option_data.end_sf_tp;
  1168. if (cbgl_tenders.length >= 8) {
  1169. dpgl_option.dataZoom[0].show = true;
  1170. } else {
  1171. dpgl_option.dataZoom[0].show = false;
  1172. }
  1173. dpgl_charts[d].setOption(dpgl_option);
  1174. }
  1175. }
  1176. }
  1177. const allgccb = {
  1178. name: '合计',
  1179. end_gather_tp: 0,
  1180. end_sf_tp: 0,
  1181. end_yf_tp: 0,
  1182. };
  1183. let hzHtml = '';
  1184. for (const cb of gccbglhz) {
  1185. allgccb.end_gather_tp = ZhCalc.add(allgccb.end_gather_tp, cb.end_gather_tp);
  1186. allgccb.end_sf_tp = ZhCalc.add(allgccb.end_sf_tp, cb.end_sf_tp);
  1187. allgccb.end_yf_tp = ZhCalc.add(allgccb.end_yf_tp, cb.end_yf_tp);
  1188. hzHtml += '<tr class="bg-dark" style="line-height: 2rem;text-align: center;"><td style="text-align: left">' + cb.name + '</td><td>' + cb.end_gather_tp + '</td><td>' + cb.end_yf_tp + '</td><td>' + cb.end_sf_tp + '</td><td>' + cb.end_df_tp + '</td></tr>';
  1189. }
  1190. allgccb.end_df_tp = ZhCalc.sub(allgccb.end_yf_tp, allgccb.end_sf_tp);
  1191. hzHtml += '<tr class="bg-dark" style="line-height: 2rem;text-align: center;"><td style="text-align: left">' + allgccb.name + '</td><td>' + allgccb.end_gather_tp + '</td><td>' + allgccb.end_yf_tp + '</td><td>' + allgccb.end_sf_tp + '</td><td>' + allgccb.end_df_tp + '</td></tr>';
  1192. $('.stage-data').html(hzHtml);
  1193. setTableboxHeight();
  1194. // console.log(sr_tenders, cb_tenders);
  1195. }
  1196. function setTableboxHeight() {
  1197. $('.tablebox').height($('.gccb').height() - 51);
  1198. }
  1199. let resizeTimer = null;
  1200. $(window).bind('resize', function () {
  1201. if (resizeTimer) clearTimeout(resizeTimer);
  1202. resizeTimer = setTimeout(function () {
  1203. echartsReset();
  1204. }, 500);
  1205. })
  1206. function echartsReset() {
  1207. gcsrmxChart.resize();
  1208. gcsrqkChart.resize();
  1209. yingsfChart.resize();
  1210. yisfChart.resize();
  1211. if (dpgl_charts.length > 0) {
  1212. for (const d in dpCategory) {
  1213. if (d) {
  1214. dpgl_charts[d].resize();
  1215. }
  1216. }
  1217. }
  1218. setTableboxHeight();
  1219. }
  1220. // 第一层分类选择
  1221. $("body").on('click', '#first-category .select-cate', function () {
  1222. const id = $(this).data('value');
  1223. $(this).parents('.dropdown-menu').siblings('button').text($(this).text());
  1224. let newTenderList = tenders;
  1225. let categoryIndex = 0;
  1226. if (!id) {
  1227. $('#second-category').hide();
  1228. $('#first-category').children('button').attr('data-cid', '').attr('data-value', '');
  1229. } else {
  1230. // 获取第一层已选类别
  1231. const firstCategory = { cid: parseInt($(this).data('cid')), value: parseInt(id) };
  1232. $('#first-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
  1233. newTenderList = _.filter(tenders, function (item) {
  1234. return _.findIndex(item.category, firstCategory) !== -1;
  1235. })
  1236. categoryIndex = 1;
  1237. if (category[1] && category[1].value.length > 0) {
  1238. $('#second-category').show();
  1239. $('#second-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
  1240. for (const [i,sc] of category[1].value.entries()) {
  1241. const scCategory = { cid: sc.cid, value: sc.id };
  1242. if (_.findIndex(newTenderList, function (item) {
  1243. return _.findIndex(item.category, scCategory) !== -1;}) === -1) {
  1244. $('#second-category .select-cate').eq(i+1).hide();
  1245. } else {
  1246. $('#second-category .select-cate').eq(i+1).show();
  1247. }
  1248. }
  1249. }
  1250. }
  1251. // console.log(newTenderList, categoryIndex);
  1252. setData(newTenderList, categoryIndex);
  1253. });
  1254. // 第二层分类选择
  1255. $("body").on('click', '#second-category .select-cate', function () {
  1256. const id = $(this).data('value');
  1257. // 获取第一层已选类别
  1258. const first_cid = $('#first-category').children('button').attr('data-cid');
  1259. const first_value = $('#first-category').children('button').attr('data-value');
  1260. const firstCategory = { cid: parseInt(first_cid), value: parseInt(first_value) };
  1261. let newTenderList = _.filter(tenders, function (item) {
  1262. return _.findIndex(item.category, firstCategory) !== -1;
  1263. });
  1264. let categoryIndex = 1;
  1265. $(this).parents('.dropdown-menu').siblings('button').text($(this).text());
  1266. if (id) {
  1267. // 获取第二层已选类别
  1268. const secondCategory = { cid: parseInt($(this).data('cid')), value: parseInt(id) };
  1269. $('#second-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
  1270. newTenderList = _.filter(newTenderList, function (item) {
  1271. return _.findIndex(item.category, secondCategory) !== -1;
  1272. });
  1273. categoryIndex = 2;
  1274. }
  1275. // console.log(newTenderList, categoryIndex);
  1276. setData(newTenderList, categoryIndex);
  1277. });
  1278. });
  1279. // 计算显示滚动条长度
  1280. function computedPosition(xArrayLength) {
  1281. if (xArrayLength >= 8) {
  1282. return Math.floor(8 / xArrayLength * 100) > 100 ? 100 : Math.floor(8 / xArrayLength * 100);
  1283. // return length <= 10 ? 35 : 100 - Math.floor(35 / length * 100);
  1284. } else {
  1285. return 100;
  1286. }
  1287. }
  1288. function formatNum(num, pattern) {
  1289. const minus = num > 0 ? '' : '-'
  1290. const strarr = num ? Math.abs(num).toString().split('.') : ['0'];
  1291. const fmtarr = pattern ? pattern.split('.') : [''];
  1292. let retstr = '';
  1293. // 整数部分
  1294. let str = strarr[0];
  1295. let fmt = fmtarr[0];
  1296. let i = str.length - 1;
  1297. let comma = false;
  1298. for (var f = fmt.length - 1; f >= 0; f--) {
  1299. switch (fmt.substr(f, 1)) {
  1300. case '#':
  1301. if (i >= 0) retstr = str.substr(i--, 1) + retstr;
  1302. break;
  1303. case '0':
  1304. if (i >= 0) retstr = str.substr(i--, 1) + retstr;
  1305. else retstr = '0' + retstr;
  1306. break;
  1307. case ',':
  1308. comma = true;
  1309. retstr = ',' + retstr;
  1310. break;
  1311. }
  1312. }
  1313. if (i >= 0) {
  1314. if (comma) {
  1315. const l = str.length;
  1316. for (;i >= 0; i--) {
  1317. retstr = str.substr(i, 1) + retstr;
  1318. if (i > 0 && ((l - i) % 3) == 0) retstr = ',' + retstr;
  1319. }
  1320. } else retstr = str.substr(0, i + 1) + retstr;
  1321. }
  1322. retstr = retstr + '.';
  1323. // 处理小数部分
  1324. str = strarr.length > 1 ? strarr[1] : '';
  1325. fmt = fmtarr.length > 1 ? fmtarr[1] : '';
  1326. i = 0;
  1327. for (var f = 0; f < fmt.length; f++) {
  1328. switch (fmt.substr(f, 1)) {
  1329. case '#':
  1330. if (i < str.length) retstr += str.substr(i++, 1);
  1331. break;
  1332. case '0':
  1333. if (i < str.length) retstr += str.substr(i++, 1);
  1334. else retstr += '0';
  1335. break;
  1336. }
  1337. }
  1338. return minus + retstr.replace(/^,+/, '').replace(/\.$/, '');
  1339. }
  1340. </script>