index_cost.ejs 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. <link href="/public/css/bootstrap/bootstrap-colorpicker.min.css" rel="stylesheet">
  2. <div class="panel-content" style="background:#2c3237 !important">
  3. <div class="panel-title fluid border-top-0" style="background:#2c3237 !important">
  4. <div class="title-main d-flex justify-content-between">
  5. <div class="d-inline-block mr-2">
  6. <div class="btn-group" id="first-category">
  7. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-cid="" data-value="" data-toggle="dropdown">全部</button>
  8. <div class="dropdown-menu" aria-labelledby="zhankai">
  9. <a class="dropdown-item select-cate" data-value="" href="javascript:void(0);">全部</a>
  10. <% if (categoryData.length > 0 && categoryData[0].value.length > 0) { %>
  11. <% for (const c of categoryData[0].value) { %>
  12. <a class="dropdown-item select-cate" data-cid="<%- c.cid %>" data-value="<%- c.id %>" href="javascript:void(0);"><%- c.value %></a>
  13. <% } %>
  14. <% } %>
  15. </div>
  16. </div>
  17. <% if (categoryData[1] && categoryData[1].value.length > 0) { %>
  18. <div class="btn-group" id="second-category" style="display: none">
  19. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-cid="" data-value="" data-toggle="dropdown">全部</button>
  20. <div class="dropdown-menu" aria-labelledby="zhankai">
  21. <a class="dropdown-item select-cate" data-value="" href="javascript:void(0);">全部</a>
  22. <% for (const c of categoryData[1].value) { %>
  23. <a class="dropdown-item select-cate" data-cid="<%- c.cid %>" data-value="<%- c.id %>" href="javascript:void(0);"><%- c.value %></a>
  24. <% } %>
  25. </div>
  26. </div>
  27. <% } %>
  28. <% if (categoryData[2] && categoryData[2].value.length > 0) { %>
  29. <div class="btn-group" id="third-category" style="display: none">
  30. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-cid="" data-value="" data-toggle="dropdown">全部</button>
  31. <div class="dropdown-menu" aria-labelledby="zhankai">
  32. <a class="dropdown-item select-cate" data-value="" href="javascript:void(0);">全部</a>
  33. <% for (const c of categoryData[2].value) { %>
  34. <a class="dropdown-item select-cate" data-cid="<%- c.cid %>" data-value="<%- c.id %>" href="javascript:void(0);"><%- c.value %></a>
  35. <% } %>
  36. </div>
  37. </div>
  38. <% } %>
  39. </div>
  40. <div>
  41. <a href="javascript:void(0)" title="全屏显示" id="showFull" class="text-white"><i class="fa fa-arrows-alt"></i></a>
  42. <div class="btn-group">
  43. <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-toggle="dropdown" id="zhankai">决策大屏<span>7</span></button>
  44. <div class="dropdown-menu" aria-labelledby="zhankai">
  45. <% for (const i of ctx.subProject.data_collect_pages) { %>
  46. <% if (['8'].includes(i)) { %>
  47. <a class="dropdown-item" target="_blank" href="<%- shj_url %>">决策大屏<%- i %></a>
  48. <% } else { %>
  49. <a class="dropdown-item" href="/sp/<%- ctx.subProject.id %>/datacollect/index/<%- i %>">决策大屏<%- i %></a>
  50. <% } %>
  51. <% } %>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="content-wrap" id="big-data">
  58. <div style="height: 30px;background-color: #2c3237; display: none" id="exitfull-div">
  59. <div class="title-main d-flex">
  60. <div class="ml-auto">
  61. <div class="dropdown d-flex float-left mt-1 mr-2">
  62. <button id="exitFull" class="btn btn-sm btn-secondary ml-auto">退出全屏</button>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="c-body" style="background:#2c3237 !important">
  68. <div class="flex-content">
  69. <div class="row mx-2" style="height: 63.5vh">
  70. <div class="col-3 px-0 height-100">
  71. <div class="left-content height-100">
  72. <div class="left-card-content height-100">
  73. <div class="height-25 mb-2">
  74. <div class="card text-center bg-dark text-white mr-2 py-2 height-100">
  75. <div class="height-100" style="display: grid;place-items: center;">
  76. <div style="line-height: 3;">
  77. <div style="font-size: 1.5rem" class="data_total_in_tp">0.00</div>
  78. <div style="font-size: .9rem;">
  79. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">项目收入</span>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="height-25 mb-2">
  86. <div class="card text-center bg-dark text-white mr-2 py-2 height-100">
  87. <div class="height-100" style="display: grid;place-items: center;">
  88. <div style="line-height: 3;">
  89. <div style="font-size: 1.5rem" class="data_total_out_tp">0.00</div>
  90. <div style="font-size: .9rem;">
  91. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">项目支出</span>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="height-25 mb-2">
  98. <div class="card text-center bg-dark text-white mr-2 py-2 height-100">
  99. <div class="height-100" style="display: grid;place-items: center;">
  100. <div style="line-height: 3;">
  101. <div style="font-size: 1.5rem" class="data_total_profit">0.00</div>
  102. <div style="font-size: .9rem;">
  103. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">利润</span>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="height-25" style="height: 24.3%">
  110. <div class="card text-center bg-dark text-white mr-2 py-2 height-100">
  111. <div class="height-100" style="display: grid;place-items: center;">
  112. <div style="line-height: 3;">
  113. <div style="font-size: 1.5rem" class="data_total_profit_percent">0%</div>
  114. <div style="font-size: .9rem;">
  115. <span style="background-color: #42474c;border-radius: 1rem;padding: .25rem .75rem">利润率</span>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="col-6 px-0 height-100">
  125. <div class="center-content height-100 mr-2">
  126. <div class="center-chart-content height-100">
  127. <div class="center-di">
  128. <div class="card bg-dark height-100">
  129. <div class="jlchart" data-chart-num="1" id="jlchart" style="height: 100%; width: 100%;"></div>
  130. </div>
  131. </div>
  132. <div class="center-chart">
  133. <div class="card height-100 bg-dark mt-2">
  134. <div class="di-content mb-2">
  135. <div class="jldbchart" data-chart-num="1" id="jldbchart" style="height: 100%; width: 100%;"></div>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <div class="col-3 px-0 height-100">
  143. <div class="right-content height-100">
  144. <div class="right-chart-content height-100">
  145. <div class="right-month">
  146. <h6 class="card bg-dark text-center text-white m-0 pt-2 pb-3">期数统计</h6>
  147. <div class="row right-month-height">
  148. <div class="col-6 pr-0 height-50">
  149. <div class="card text-center bg-dark text-white border-right-0 border-botton-0 height-100">
  150. <div class="card-body card-small-body height-100">
  151. <h5 class="card-title text-center height-50" style="font-size: 2.80rem;line-height: 200%"><span class="stage_num">0</span></h5>
  152. <p class="card-text text-muted height-50">计量期</p>
  153. </div>
  154. </div>
  155. </div>
  156. <div class="col-6 pl-0 height-50">
  157. <div class="card text-center bg-dark text-white border-botton-0 height-100">
  158. <div class="card-body card-small-body height-100">
  159. <h5 class="card-title text-center height-50" style="font-size: 2.80rem;line-height: 200%"><span class="cost_ledger_num">0</span></h5>
  160. <p class="card-text text-muted height-50">成本报审</p>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="col-6 pr-0 height-50">
  165. <div class="card text-center bg-dark text-white border-right-0 border-top-0 height-100">
  166. <div class="card-body card-small-body height-100">
  167. <h5 class="card-title text-center height-50" style="font-size: 2.80rem;line-height: 200%"><span class="cost_book_num">0</span></h5>
  168. <p class="card-text text-muted height-50">财务账面</p>
  169. </div>
  170. </div>
  171. </div>
  172. <div class="col-6 pl-0 height-50">
  173. <div class="card text-center bg-dark text-white border-top-0 height-100">
  174. <div class="card-body card-small-body height-100">
  175. <h5 class="card-title text-center height-50" style="font-size: 2.80rem;line-height: 200%"><span class="cost_analysis_num">0</span></h5>
  176. <p class="card-text text-muted height-50">成本分析</p>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="right-chart">
  183. <div class="card height-100 bg-dark">
  184. <div class="jlwcdchart" id="jlwcdchart" style="height: 100%; width: 100%;"></div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="row mx-2" style="height: 32vh">
  192. <div class="col-9 px-0 pt-1 height-100">
  193. <div class="center-table height-100" style="padding-right: .5rem !important;">
  194. <div class="card height-100 bg-dark mt-2">
  195. <h6 class="bg-dark text-center text-white m-0 py-3">投资控制(万元)</h6>
  196. <div class="tablebox">
  197. <table id="tableId">
  198. <thead>
  199. <tr class="text-center">
  200. <th></th>
  201. <th>投资估算</th>
  202. <th>设计概算</th>
  203. <th>施工图预算</th>
  204. <th>控制目标</th>
  205. <th>已完成</th>
  206. <th>完成比例(%)</th>
  207. </tr>
  208. </thead>
  209. <tbody class="stage-data">
  210. </tbody>
  211. </table>
  212. <table id="tableId1"></table>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. <div class="col-3 px-0 pt-1 height-100">
  218. <div class="right-biaoduan height-100">
  219. <div class="card height-100 bg-dark mt-2">
  220. <h6 class="bg-dark text-center text-white m-0 py-3">利润率排名</h6>
  221. <div class="tablebox">
  222. <table id="profit_tableId">
  223. <thead>
  224. <tr class="text-center">
  225. <th></th>
  226. <th>标段</th>
  227. <th>利润率</th>
  228. </tr>
  229. </thead>
  230. <tbody class="tender-data">
  231. </tbody>
  232. </table>
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. <script src="/public/js/path_tree.js"></script>
  243. <script src="/public/js/shares/tenders2tree.js"></script>
  244. <script src="/public/js/datacollect_scroll.js"></script>
  245. <script type="text/javascript"> autoFlashHeight();</script>
  246. <script type="text/javascript">
  247. // 利润排名占比饼图表
  248. var chart1 = document.getElementsByClassName('jlwcdchart');
  249. option1 = {
  250. tooltip : {
  251. trigger: 'item',
  252. formatter: "{a} <br/>{b} : {c} ({d}%)",
  253. // 当前鼠标位置
  254. // position: 'top',
  255. },
  256. title: {
  257. text: '利润排名占比',
  258. left: 'center',
  259. top:'7%'
  260. },
  261. color: ['rgba(38, 217, 217,0.7)','rgba(78, 139, 229,0.7)',
  262. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  263. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  264. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  265. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  266. 'rgba(242, 179, 82, 0.7)'],
  267. backgroundColor: '#343a40 ',
  268. // tooltip: {
  269. // trigger: 'item'
  270. // },
  271. // legend: {
  272. // orient: 'vertical',
  273. // left: 'center',
  274. // },
  275. series: [
  276. {
  277. name: '利润金额',
  278. type: 'pie',
  279. radius: '60%',
  280. top:'15%',
  281. formatter: function(name){
  282. return name.length>10?name.substr(0,10)+"...":name;
  283. },
  284. data: [],
  285. emphasis: {
  286. itemStyle: {
  287. shadowBlur: 10,
  288. shadowOffsetX: 0,
  289. shadowColor: 'rgba(0, 0, 0, 0.5)'
  290. }
  291. }
  292. }
  293. ]
  294. };
  295. var myChart1_1 = echarts.init(chart1[0], 'dark');
  296. myChart1_1.setOption(option1);
  297. // 利润统计状图表
  298. option2 = {
  299. title: {
  300. text: '利润统计',
  301. left: 'center',
  302. top:'5%'
  303. },
  304. color: ['rgba(38, 217, 217,0.7)','rgba(78, 139, 229,0.7)',
  305. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  306. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  307. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  308. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  309. 'rgba(242, 179, 82, 0.7)'],
  310. backgroundColor: '#343a40 ',
  311. tooltip: {
  312. trigger: 'axis',
  313. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  314. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  315. },
  316. },
  317. dataZoom: [
  318. {
  319. brushSelect:false,
  320. // zoomLock: false,
  321. type: 'slider',
  322. show: true,
  323. realtime: true,
  324. showdetail: false,
  325. showDataShadow: false,
  326. // dataZoomIndex: 10,
  327. start: 0,
  328. end: 8,
  329. handleSize: 0,
  330. height: 10,
  331. bottom: '10%',
  332. },
  333. // {
  334. // // realtime: true,
  335. // type: 'slider',
  336. // show: true,
  337. // realtime: true,
  338. // showdetail: false,
  339. // showDataShadow: false,
  340. // // dataZoomIndex: 10,
  341. // start: 0,
  342. // end: 8,
  343. // handleSize: 0,
  344. // bottom:30,
  345. // height:10,
  346. // }
  347. ],
  348. // legend: {
  349. // data: ['利润'],
  350. // top:'17%'
  351. // },
  352. grid: {
  353. top:'25%',
  354. left: '3%',
  355. right: '4%',
  356. bottom: '15%',
  357. containLabel: true
  358. },
  359. xAxis: [
  360. {
  361. type: 'category',
  362. data: [],
  363. axisLabel: {
  364. show: true,
  365. interval: 0,
  366. textStyle: {
  367. color: "#fff",
  368. fontSize: 14
  369. },
  370. formatter: function(value) {
  371. var res = value;
  372. if(res.length > 6) {
  373. res = res.substring(0, 5) + "..";
  374. }
  375. return res;
  376. }
  377. }
  378. }
  379. ],
  380. yAxis: [
  381. {
  382. type: 'value',
  383. name:'金额',
  384. position: 'left',
  385. axisLabel : {
  386. formatter: function (value, index) {
  387. if (value < 0) {
  388. let newValue = Math.abs(value);
  389. if (newValue >= 10000 && newValue < 10000000) {
  390. newValue = newValue / 10000 + "万";
  391. } else if (newValue >= 10000000) {
  392. newValue = newValue / 10000000 + "千万";
  393. }
  394. value = '-' + newValue;
  395. }
  396. if (value >= 10000 && value < 10000000) {
  397. value = value / 10000 + "万";
  398. } else if (value >= 10000000) {
  399. value = value / 10000000 + "千万";
  400. }
  401. return value;
  402. }
  403. },
  404. splitArea : {show : true}
  405. },
  406. // {
  407. // type: 'value',
  408. // name:'完成度',
  409. // position: 'right',
  410. // min:0,
  411. // max:100,
  412. // axisLabel : {
  413. // formatter: '{value} %'
  414. // },
  415. // splitArea : {show : true}
  416. // }
  417. ],
  418. series: [
  419. {
  420. name: '利润',
  421. type: 'bar',
  422. emphasis: {
  423. focus: 'series'
  424. },
  425. data: []
  426. },
  427. ]
  428. };
  429. var chart2 = document.getElementsByClassName('jlchart');
  430. var myChart2_1 = echarts.init(chart2[0], 'dark');
  431. myChart2_1.setOption(option2);
  432. // myChart2.setOption(option);
  433. // 利润率统计柱状图表
  434. // var myChart3 = echarts.init(document.getElementsByClassName('jlwcdchart')[0], 'dark');
  435. option3 = {
  436. title: {
  437. text: '利润率统计',
  438. left: 'center',
  439. top:'5%'
  440. },
  441. color: ['rgba(38, 217, 217,0.7)','rgba(78, 139, 229,0.7)',
  442. 'rgba(78, 229, 139,0.7)','rgba(108, 78, 229,0.7)',
  443. 'rgba(58,207,221,0.7)','rgba(164, 229, 78,0.7)',
  444. 'rgba(199, 78, 229,0.7)', 'rgba(229, 92, 174, 0.7)',
  445. 'rgba(229, 214, 78, 0.7)', 'rgba(241, 87, 96, 0.7)',
  446. 'rgba(242, 179, 82, 0.7)'],
  447. backgroundColor: '#343a40 ',
  448. tooltip: {
  449. trigger: 'axis',
  450. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  451. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  452. },
  453. },
  454. dataZoom: [
  455. {
  456. brushSelect:false,
  457. // zoomLock: false,
  458. type: 'slider',
  459. show: true,
  460. realtime: true,
  461. showdetail: false,
  462. showDataShadow: false,
  463. // dataZoomIndex: 10,
  464. start: 0,
  465. end: 8,
  466. handleSize: 0,
  467. height: 10,
  468. bottom: '10%',
  469. },
  470. ],
  471. // legend: {
  472. // data: ['利润率'],
  473. // top:'17%'
  474. // },
  475. grid: {
  476. top:'25%',
  477. left: '3%',
  478. right: '4%',
  479. bottom: '15%',
  480. containLabel: true
  481. },
  482. xAxis: [
  483. {
  484. type: 'category',
  485. data: [],
  486. axisLabel: {
  487. show: true,
  488. interval: 0,
  489. textStyle: {
  490. color: "#fff",
  491. fontSize: 14
  492. },
  493. formatter: function(value) {
  494. var res = value;
  495. if(res.length > 6) {
  496. res = res.substring(0, 5) + "..";
  497. }
  498. return res;
  499. }
  500. }
  501. }
  502. ],
  503. yAxis: [
  504. // {
  505. // type: 'value',
  506. // name:'利润率',
  507. // position: 'left',
  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. // splitArea : {show : true}
  528. // },
  529. {
  530. type: 'value',
  531. name:'利润率',
  532. position: 'left',
  533. min:0,
  534. max:100,
  535. axisLabel : {
  536. formatter: '{value} %'
  537. },
  538. splitArea : {show : true}
  539. }
  540. ],
  541. series: [
  542. {
  543. name: '利润率',
  544. type: 'bar',
  545. emphasis: {
  546. focus: 'series'
  547. },
  548. data: []
  549. },
  550. ]
  551. };
  552. var chart3 = document.getElementsByClassName('jldbchart');
  553. var myChart3_1 = echarts.init(chart3[0], 'dark');
  554. myChart3_1.setOption(option3);
  555. function echartsReset() {
  556. myChart1_1.resize();
  557. myChart2_1.resize();
  558. myChart3_1.resize();
  559. }
  560. $(function () {
  561. $('#showFull').click(function () {
  562. const full=document.getElementById("big-data");
  563. launchIntoFullscreen(full);
  564. });
  565. $('#exitFull').click(function () {
  566. exitFullscreen();
  567. })
  568. })
  569. let resizeTimer = null;
  570. $(window).bind('resize', function () {
  571. if (resizeTimer) clearTimeout(resizeTimer);
  572. resizeTimer = setTimeout(function () {
  573. echartsReset();
  574. $(".tableid_").find('th').each(function(i) {
  575. $(this).css('width', $('#tableId').find('th:eq(' + i + ')').innerWidth());
  576. });
  577. }, 500);
  578. })
  579. // 数据全屏
  580. function launchIntoFullscreen(element) {
  581. if(element.requestFullscreen){
  582. element.requestFullscreen();
  583. }
  584. else if(element.mozRequestFullScreen) {
  585. element.mozRequestFullScreen();
  586. }
  587. else if(element.webkitRequestFullscreen) {
  588. element.webkitRequestFullscreen();
  589. }
  590. else if(element.msRequestFullscreen) {
  591. element.msRequestFullscreen();
  592. }
  593. }
  594. function exitFullscreen() {
  595. if(document.exitFullscreen) {
  596. document.exitFullscreen();
  597. } else if(document.mozCancelFullScreen) {
  598. document.mozCancelFullScreen();
  599. } else if(document.webkitExitFullscreen) {
  600. document.webkitExitFullscreen();
  601. }
  602. }
  603. document.addEventListener("fullscreenchange", function (event) {
  604. if (document.fullscreenElement) {
  605. $('#exitfull-div').show();
  606. $('#showFull').hide();
  607. } else {
  608. $('#exitfull-div').hide();
  609. $('#showFull').show();
  610. }
  611. });
  612. </script>
  613. <script>
  614. const originDataCollect = parseInt('<%- ctx.subProject.data_collect %>');
  615. const category = JSON.parse(unescape('<%- escape(JSON.stringify(categoryData)) %>'));
  616. let tenders = '';
  617. // let noticeList = '';
  618. $(function () {
  619. const compareObj = {
  620. curFinalId() {
  621. return this.finalInfo ? this.finalInfo.id : undefined;
  622. },
  623. expand(tree, tag) {
  624. switch (tag) {
  625. case "1":
  626. case "2":
  627. case "3":
  628. case "4":
  629. case "5":
  630. tree.expandByLevel(parseInt(tag));
  631. break;
  632. case "last":
  633. tree.expandByCustom(() => { return true; });
  634. break;
  635. }
  636. },
  637. calcStackedBar(tree) {
  638. const calcField = this.stackedBarField;
  639. const calcFieldColor = { 'gu_tp': '#657798', 'gai_tp': '#EE6666', 'yu_tp': '#74CBED', 'total_price': '#FAC858', 'final_tp': '#62DAAB' };
  640. const calcFieldCaption = { 'gu_tp': '估算', 'gai_tp': '概算', 'yu_tp': '预算', 'total_price': '台账', 'final_tp': '决算' };
  641. const calc = function(node, base){
  642. // const parent = tree.getParent(node);
  643. // if (!parent) {
  644. // base = 0;
  645. // for (const cf of calcField) {
  646. // base = Math.max(node[cf], base);
  647. // }
  648. // }
  649. node.stackedBar = [];
  650. node.stackedBarTips = [];
  651. for (const cf of calcField) {
  652. node.stackedBar.push({color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf});
  653. node.stackedBarTips.push(`${calcFieldCaption[cf]}: ${node[cf] || 0}`);
  654. }
  655. if (node.children) {
  656. for (const child of node.children) {
  657. calc(child, base);
  658. }
  659. }
  660. };
  661. let commonBase = 0;
  662. tree.children.forEach(x => {
  663. for (const cf of calcField) {
  664. commonBase = Math.max(x[cf] || 0, commonBase);
  665. }
  666. });
  667. for (const child of tree.children) {
  668. calc(child, commonBase);
  669. }
  670. },
  671. loadBudgetData(result) {
  672. const compareTree = createNewPathTree('final', {
  673. id: 'id',
  674. pid: 'pid',
  675. order: 'order',
  676. level: 'level',
  677. rootId: -1,
  678. });
  679. const setting = { id: 'tree_id', pid: 'tree_pid', order: 'order', level: 'level', rootId: -1, calcFields: ['total_price'] };
  680. const guTree = createNewPathTree('ledger', setting);
  681. guTree.loadDatas(result.gu);
  682. treeCalc.calculateAll(guTree);
  683. compareTree.loadTree(guTree, function (cur, source) {
  684. cur.base = true;
  685. cur.gu_dgn_qty1 = ZhCalc.add(cur.gu_dgn_qty1, source.dgn_qty1);
  686. cur.gu_dgn_qty2 = ZhCalc.add(cur.gu_dgn_qty2, source.dgn_qty2);
  687. cur.gu_tp = ZhCalc.add(cur.gu_tp, source.total_price);
  688. });
  689. const gaiTree = createNewPathTree('ledger', setting);
  690. gaiTree.loadDatas(result.gai);
  691. treeCalc.calculateAll(gaiTree);
  692. compareTree.loadTree(gaiTree, function (cur, source) {
  693. cur.base = true;
  694. cur.gai_dgn_qty1 = ZhCalc.add(cur.gai_dgn_qty1, source.dgn_qty1);
  695. cur.gai_dgn_qty2 = ZhCalc.add(cur.gai_dgn_qty2, source.dgn_qty2);
  696. cur.gai_tp = ZhCalc.add(cur.gai_tp, source.total_price);
  697. });
  698. const yuTree = createNewPathTree('ledger', setting);
  699. yuTree.loadDatas(result.yu);
  700. treeCalc.calculateAll(yuTree);
  701. compareTree.loadTree(yuTree, function (cur, source) {
  702. cur.base = true;
  703. cur.yu_dgn_qty1 = ZhCalc.add(cur.yu_dgn_qty1, source.dgn_qty1);
  704. cur.yu_dgn_qty2 = ZhCalc.add(cur.yu_dgn_qty2, source.dgn_qty2);
  705. cur.yu_tp = ZhCalc.add(cur.yu_tp, source.total_price);
  706. });
  707. compareTree.afterLoad(node => {
  708. node.gu_dgn_price = ZhCalc.div(node.gu_tp, node.gu_dgn_qty1, 2);
  709. node.gu_dgn_qty = node.gu_dgn_qty1
  710. ? (node.gu_dgn_qty2 ? node.gu_dgn_qty1 + '/' + node.gu_dgn_qty2 : node.gu_dgn_qty1)
  711. : (node.gu_dgn_qty2 ? '/' + node.gu_dgn_qty2 : '');
  712. node.gai_dgn_price = ZhCalc.div(node.gai_tp, node.gai_dgn_qty1, 2);
  713. node.gai_dgn_qty = node.gai_dgn_qty1
  714. ? (node.gai_dgn_qty2 ? node.gai_dgn_qty1 + '/' + node.gai_dgn_qty2 : node.gai_dgn_qty1)
  715. : (node.gai_dgn_qty2 ? '/' + node.gai_dgn_qty2 : '');
  716. node.yu_dgn_price = ZhCalc.div(node.yu_tp, node.yu_dgn_qty1, 2);
  717. node.yu_dgn_qty = node.yu_dgn_qty1
  718. ? (node.yu_dgn_qty2 ? node.yu_dgn_qty1 + '/' + node.yu_dgn_qty2 : node.yu_dgn_qty1)
  719. : (node.yu_dgn_qty2 ? '/' + node.yu_dgn_qty2 : '');
  720. });
  721. compareTree.resortChildrenByCustom(function (x, y) {
  722. const iCode = compareCode(x.code, y.code);
  723. if (iCode) return iCode;
  724. if (!x.name) return -1;
  725. if (!y.name) return 1;
  726. return x.name.localeCompare(y.name);
  727. });
  728. const expandTag = getLocalCache('revise-compare-level');
  729. if (expandTag) compareObj.expand(compareTree, expandTag);
  730. this.calcStackedBar(compareTree);
  731. // console.log(compareTree);
  732. setPageData(compareTree);
  733. },
  734. loadFinalData(result, msg) {
  735. if (msg) toastr.warning(msg);
  736. this.finalInfo = result.finalInfo;
  737. const finalTree = createNewPathTree('ledger', {
  738. id: 'tree_id',
  739. pid: 'tree_pid',
  740. order: 'order',
  741. level: 'level',
  742. rootId: -1,
  743. });
  744. finalTree.loadDatas(result.final);
  745. const expandTag = getLocalCache('revise-compare-level');
  746. if (expandTag) compareObj.expand(finalTree, expandTag);
  747. this.calcStackedBar(finalTree);
  748. // console.log(finalTree);
  749. setPageData(finalTree);
  750. },
  751. loadCacheData(){
  752. const stackedBarCache = 'gai_tp,total_price,final_tp';
  753. this.setStackedBarField(stackedBarCache.split(','));
  754. },
  755. setStackedBarField(field){
  756. this.stackedBarField = field;
  757. },
  758. };
  759. compareObj.loadCacheData();
  760. function compareCode(str1, str2, symbol = '-') {
  761. if (!str1) {
  762. return 1;
  763. } else if (!str2) {
  764. return -1;
  765. }
  766. function compareSubCode(code1, code2) {
  767. if (numReg.test(code1)) {
  768. if (numReg.test(code2)) {
  769. return parseInt(code1) - parseInt(code2);
  770. } else {
  771. return -1
  772. }
  773. } else {
  774. if (numReg.test(code2)) {
  775. return 1;
  776. } else {
  777. return code1 === code2 ? 0 : (code1 < code2 ? -1 : 1); //code1.localeCompare(code2);
  778. }
  779. }
  780. }
  781. const numReg = /^[0-9]+$/;
  782. const aCodes = str1.split(symbol), bCodes = str2.split(symbol);
  783. for (let i = 0, iLength = Math.min(aCodes.length, bCodes.length); i < iLength; ++i) {
  784. const iCompare = compareSubCode(aCodes[i], bCodes[i]);
  785. if (iCompare !== 0) {
  786. return iCompare;
  787. }
  788. }
  789. return aCodes.length - bCodes.length;
  790. }
  791. postData(`/sp/${spid}/datacollect/load`, {}, function (result, msg) {
  792. if (result.budget) {
  793. if (result.budget.final) {
  794. compareObj.loadFinalData(result.budget, msg);
  795. } else {
  796. compareObj.loadBudgetData(result.budget);
  797. }
  798. }
  799. const cost_tenderList = _.filter(result.tenderList, function (item) {
  800. return item.cost_analysis || item.cost_analsis_num || item.cost_ledger_num || item.cost_book_num || item.stage_num;
  801. })
  802. tenders = cost_tenderList;
  803. if (category && category.length > 0) {
  804. if (category[0] && category[0].value.length > 0) {
  805. for (const [i, fc] of category[0].value.entries()) {
  806. const fcCategory = {cid: fc.cid, value: fc.id};
  807. if (_.findIndex(tenders, function (item) {
  808. return _.findIndex(item.category, fcCategory) !== -1;
  809. }) === -1) {
  810. $('#first-category .select-cate').eq(i + 1).hide();
  811. } else {
  812. $('#first-category .select-cate').eq(i + 1).show();
  813. }
  814. }
  815. }
  816. }
  817. setData(tenders, 0);
  818. });
  819. function setPageData(tree) {
  820. let html = '';
  821. if (tree.children.length > 0) {
  822. // 分析第一层结构,获取各个部分金额非全0的及除了回收金额层
  823. const level1List = _.filter(tree.children, function (item) {
  824. return item.name.indexOf('回收金额') === -1 &&
  825. (item.gu_tp || item.gai_tp || (item.final_tp !== undefined && item.final_tp) || item.yu_tp || (item.ctrl_tp !== undefined && item.ctrl_tp))
  826. });
  827. if (level1List.length > 0) {
  828. for (const t of level1List) {
  829. html += '<tr class="text-center">\n' +
  830. ' <td class="text-left"><span data-toggle="tooltip" data-placement="right" data-original-title="'+ t.name +'">'+ (t.name.length > 15 ? t.name.substring(0, 15) + '...' : t.name) +'</span></td>\n' +
  831. ' <td>'+ (t.gu_tp ? ZhCalc.round(ZhCalc.div(t.gu_tp, 10000), 4) : 0) + '</td>\n' +
  832. ' <td>'+ (t.gai_tp ? ZhCalc.round(ZhCalc.div(t.gai_tp, 10000), 4) : 0) +'</td>\n' +
  833. ' <td>'+ (t.yu_tp ? ZhCalc.round(ZhCalc.div(t.yu_tp, 10000), 4) : 0) +'</td>\n' +
  834. ' <td>'+ (t.ctrl_tp ? ZhCalc.round(ZhCalc.div(t.ctrl_tp, 10000), 4) : 0) +'</td>\n' +
  835. ' <td>'+ (t.final_tp ? ZhCalc.round(ZhCalc.div(t.final_tp, 10000), 4) : 0) +'</td>\n' +
  836. ' <td>' + (t.final_tp && t.ctrl_tp ? ZhCalc.round(ZhCalc.div(t.final_tp, t.ctrl_tp) * 100, 2) : 0) + '</td>\n' +
  837. ' </tr>\n';
  838. }
  839. }
  840. }
  841. // 滚动数据
  842. $('.stage-data').eq(0).html(html);
  843. tableScroll('tableId', '100%', 30, 7);
  844. $('#tableId').css({'margin-top': 0});
  845. }
  846. function setData(tenderList, categoryIndex = 0) {
  847. let total_in_tp = 0;
  848. let total_out_tp = 0;
  849. let total_profit = 0;
  850. let stage_num = 0;
  851. let cost_ledger_num = 0;
  852. let cost_book_num = 0;
  853. let cost_analysis_num = 0;
  854. let tender_html = '';
  855. const chart_option_name = [];
  856. const chart_option2_data = [];
  857. const chart_option3_data = [];
  858. const chart_option1_data = [];
  859. // let option1_is_tender = false;
  860. const chart_category_data = [];
  861. // if (category && category.length > 0 && category[categoryIndex] && category[categoryIndex].value.length > 0) {
  862. // for (const c of category[categoryIndex].value) {
  863. // chart_category_data.push({
  864. // cid: category[categoryIndex].id,
  865. // value: c.id,
  866. // });
  867. // chart_option1_data.push({
  868. // value: 0,
  869. // name: c.value,
  870. // });
  871. // }
  872. // } else {
  873. // option1_is_tender = true;
  874. // }
  875. for(const t of tenderList) {
  876. const stage_tp = t.cost_analysis ? t.cost_analysis.stage_tp : null;
  877. if (stage_tp) {
  878. total_in_tp = ZhCalc.add(total_in_tp, stage_tp.in_tp);
  879. total_out_tp = ZhCalc.add(total_out_tp, stage_tp.out_tp);
  880. total_profit = ZhCalc.add(total_profit, stage_tp.profit);
  881. chart_option2_data.push(stage_tp.profit ? stage_tp.profit : 0);
  882. chart_option3_data.push(stage_tp.profit_percent ? stage_tp.profit_percent : 0);
  883. chart_option_name.push(t.name);
  884. chart_option1_data.push({ value: stage_tp.profit, name: t.name});
  885. }
  886. stage_num = ZhCalc.add(stage_num, t.stage_num);
  887. cost_ledger_num = ZhCalc.add(cost_ledger_num, t.cost_ledger_num);
  888. cost_book_num = ZhCalc.add(cost_book_num, t.cost_book_num);
  889. cost_analysis_num = ZhCalc.add(cost_analysis_num, t.cost_analysis_num);
  890. // if (option1_is_tender) {
  891. // if(stage_tp.profit)
  892. // } else {
  893. // const sameObject = _.intersectionWith(t.category, chart_category_data, _.isEqual);
  894. // const index = sameObject[0] ? _.findIndex(chart_category_data, { cid: sameObject[0].cid, value: sameObject[0].value }) : -1;
  895. // if (index !== -1) {
  896. // chart_option1_data[index].value = ZhCalc.add(chart_option1_data[index].value, (stage_tp.profit ? stage_tp.profit : 0));
  897. // }
  898. // }
  899. }
  900. // 根据利润率排行并只显示前5位
  901. let index = 1;
  902. const percent_tender_list = _.orderBy(tenderList, (t) => {
  903. const stage_tp = t.cost_analysis ? t.cost_analysis.stage_tp : null;
  904. return stage_tp && stage_tp.profit_percent ? stage_tp.profit_percent : 0;
  905. }, 'desc').slice(0, 5);
  906. const medalIcons = {
  907. 1: '<i class="fa fa-trophy" style="font-size:18px; color:#F0C040;"></i>',
  908. 2: '<i class="fa fa-trophy" style="font-size:18px; color:#B0B8C1;"></i>',
  909. 3: '<i class="fa fa-trophy" style="font-size:18px; color:#CD7F4A;"></i>',
  910. };
  911. for (const t of percent_tender_list) {
  912. const stage_tp = t.cost_analysis ? t.cost_analysis.stage_tp : null;
  913. if (stage_tp) {
  914. const rankDisplay = medalIcons[index] ?? index;
  915. tender_html += `<tr class="bg-dark">
  916. <td class="text-center py-2">${rankDisplay}</td>
  917. <td class="py-2">${t.name}</td>
  918. <td class="text-center py-2">${stage_tp.profit_percent}</td>
  919. </tr>`;
  920. index++;
  921. }
  922. }
  923. // console.log(tenderList);
  924. const profit_percent = total_in_tp && total_profit ? ZhCalc.round(ZhCalc.div(total_profit, total_in_tp) * 100, 2) : 0;
  925. $('.data_total_profit_percent').text(profit_percent ? profit_percent + '%' : '0%');
  926. $('.data_total_in_tp').text(formatMoney(total_in_tp));
  927. $('.data_total_out_tp').text(formatMoney(total_out_tp));
  928. $('.data_total_profit').text(formatMoney(total_profit));
  929. $('.stage_num').text(stage_num);
  930. $('.cost_ledger_num').text(cost_ledger_num);
  931. $('.cost_analysis_num').text(cost_analysis_num);
  932. $('.cost_book_num').text(cost_book_num);
  933. // 滚动数据
  934. $('.tender-data').eq(0).html(tender_html);
  935. // }
  936. $('[data-toggle="tooltip"]').tooltip();
  937. // 图表数据赋值
  938. const analysis_num = _.filter(tenderList, t => t.cost_analysis).length;
  939. const option2 = myChart2_1.getOption();
  940. option2.dataZoom[0].start = 0;
  941. option2.dataZoom[0].end = computedPosition(analysis_num);
  942. option2.xAxis[0].data = chart_option_name;
  943. option2.series[0].data = chart_option2_data;
  944. if (analysis_num >= 8) {
  945. option2.dataZoom[0].show = true;
  946. } else {
  947. option2.dataZoom[0].show = false;
  948. }
  949. myChart2_1.setOption(option2);
  950. const option3 = myChart3_1.getOption();
  951. option3.dataZoom[0].start = 0;
  952. option3.dataZoom[0].end = computedPosition(analysis_num);
  953. option3.xAxis[0].data = chart_option_name;
  954. option3.series[0].data = chart_option3_data;
  955. if (analysis_num >= 8) {
  956. option3.dataZoom[0].show = true;
  957. } else {
  958. option3.dataZoom[0].show = false;
  959. }
  960. myChart3_1.setOption(option3);
  961. const option1 = myChart1_1.getOption();
  962. option1.series[0].data = _.filter(chart_option1_data, function (item) {
  963. return item.value !== 0;
  964. });
  965. myChart1_1.setOption(option1);
  966. $('#profit_tableId').css({'margin-top': 0});
  967. }
  968. // 第一层分类选择
  969. $("body").on('click', '#first-category .select-cate', function () {
  970. const id = $(this).data('value');
  971. $(this).parents('.dropdown-menu').siblings('button').text($(this).text());
  972. let newTenderList = tenders;
  973. let categoryIndex = 0;
  974. if (!id) {
  975. $('#second-category').hide();
  976. $('#third-category').hide();
  977. $('#first-category').children('button').attr('data-cid', '').attr('data-value', '');
  978. } else {
  979. // 获取第一层已选类别
  980. const firstCategory = { cid: parseInt($(this).data('cid')), value: parseInt(id) };
  981. $('#first-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
  982. newTenderList = _.filter(tenders, function (item) {
  983. return _.findIndex(item.category, firstCategory) !== -1;
  984. })
  985. categoryIndex = 1;
  986. if (category[1] && category[1].value.length > 0) {
  987. $('#second-category').show();
  988. $('#third-category').hide();
  989. $('#second-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
  990. for (const [i,sc] of category[1].value.entries()) {
  991. const scCategory = { cid: sc.cid, value: sc.id };
  992. if (_.findIndex(newTenderList, function (item) {
  993. return _.findIndex(item.category, scCategory) !== -1;}) === -1) {
  994. $('#second-category .select-cate').eq(i+1).hide();
  995. } else {
  996. $('#second-category .select-cate').eq(i+1).show();
  997. }
  998. }
  999. }
  1000. // categoryList.push(firstCategory);
  1001. }
  1002. setData(newTenderList, categoryIndex);
  1003. // 获取新的tenderList及categoryList
  1004. });
  1005. // 第二层分类选择
  1006. $("body").on('click', '#second-category .select-cate', function () {
  1007. const id = $(this).data('value');
  1008. // 获取第一层已选类别
  1009. const first_cid = $('#first-category').children('button').attr('data-cid');
  1010. const first_value = $('#first-category').children('button').attr('data-value');
  1011. const firstCategory = { cid: parseInt(first_cid), value: parseInt(first_value) };
  1012. let newTenderList = _.filter(tenders, function (item) {
  1013. return _.findIndex(item.category, firstCategory) !== -1;
  1014. });
  1015. // let categoryList = [firstCategory];
  1016. let categoryIndex = 1;
  1017. $(this).parents('.dropdown-menu').siblings('button').text($(this).text());
  1018. if (!id) {
  1019. $('#third-category').hide();
  1020. } else {
  1021. // 获取第二层已选类别
  1022. const secondCategory = { cid: parseInt($(this).data('cid')), value: parseInt(id) };
  1023. $('#second-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
  1024. newTenderList = _.filter(newTenderList, function (item) {
  1025. return _.findIndex(item.category, secondCategory) !== -1;
  1026. });
  1027. categoryIndex = 2;
  1028. if (category[2] && category[2].value.length > 0) {
  1029. $('#third-category').show();
  1030. $('#third-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
  1031. for (const [i,sc] of category[2].value.entries()) {
  1032. const tcCategory = { cid: sc.cid, value: sc.id };
  1033. if (_.findIndex(newTenderList, function (item) {
  1034. return _.findIndex(item.category, tcCategory) !== -1;}) === -1) {
  1035. $('#third-category .select-cate').eq(i+1).hide();
  1036. } else {
  1037. $('#third-category .select-cate').eq(i+1).show();
  1038. }
  1039. }
  1040. }
  1041. // categoryList.push(secondCategory);
  1042. }
  1043. setData(newTenderList, categoryIndex);
  1044. // 获取新的tenderList及categoryList
  1045. });
  1046. // 第三层分类选择(至多三层)
  1047. $("body").on('click', '#third-category .select-cate', function () {
  1048. const id = $(this).data('value');
  1049. // 获取第一层已选类别
  1050. const first_cid = $('#first-category').children('button').attr('data-cid');
  1051. const first_value = $('#first-category').children('button').attr('data-value');
  1052. const firstCategory = { cid: parseInt(first_cid), value: parseInt(first_value) };
  1053. let newTenderList = _.filter(tenders, function (item) {
  1054. return _.findIndex(item.category, firstCategory) !== -1;
  1055. });
  1056. // 获取第二层已选类别
  1057. const second_cid = $('#second-category').children('button').attr('data-cid');
  1058. const second_value = $('#second-category').children('button').attr('data-value');
  1059. const secondCategory = { cid: parseInt(second_cid), value: parseInt(second_value) };
  1060. newTenderList = _.filter(newTenderList, function (item) {
  1061. return _.findIndex(item.category, secondCategory) !== -1;
  1062. });
  1063. // let categoryList = [firstCategory, secondCategory];
  1064. let categoryIndex = 2;
  1065. $(this).parents('.dropdown-menu').siblings('button').text($(this).text());
  1066. if (!id) {
  1067. $('#third-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
  1068. } else {
  1069. $('#third-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
  1070. categoryIndex = 3;
  1071. const third_cid = $('#third-category').children('button').attr('data-cid');
  1072. const third_value = $('#third-category').children('button').attr('data-value');
  1073. const thirdCategory = { cid: parseInt(third_cid), value: parseInt(third_value) };
  1074. newTenderList = _.filter(newTenderList, function (item) {
  1075. return _.findIndex(item.category, thirdCategory) !== -1;
  1076. });
  1077. // categoryList.push({ cid: parseInt($(this).data('cid')), value: parseInt($(this).data('value')) });
  1078. }
  1079. setData(newTenderList, categoryIndex);
  1080. // 获取新的tenderList及categoryList
  1081. })
  1082. })
  1083. function formatMoney(s, dot = ',', decimal = 2) {
  1084. if (!s) {
  1085. s = 0;
  1086. return s.toFixed(decimal);
  1087. }
  1088. console.log(parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(decimal) + '');
  1089. // 按decimal位数四舍五入方法
  1090. s = decimal === 0 ? parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(decimal) + '' : (Math.round(parseFloat((s + '').replace(/[^\d\.-]/g, '')) * Math.pow(10, decimal)) / Math.pow(10, decimal)).toFixed(decimal) + '';
  1091. console.log(s, Math.pow(10, decimal));
  1092. if (!decimal) {
  1093. s += '.';
  1094. }
  1095. const l = s.split('.')[0].split('').reverse(),
  1096. r = s.split('.')[1];
  1097. let t = '';
  1098. for (let i = 0; i < l.length; i++) {
  1099. t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? dot : '');
  1100. }
  1101. const num = t.split('').reverse().join('') + (decimal === 0 ? '' : '.' + r);
  1102. return num.replace('-,', '-');
  1103. }
  1104. // 计算显示滚动条长度
  1105. function computedPosition(xArrayLength) {
  1106. if (xArrayLength >= 8) {
  1107. return Math.floor(8 / xArrayLength * 100) > 100 ? 100 : Math.floor(8 / xArrayLength * 100);
  1108. // return length <= 10 ? 35 : 100 - Math.floor(35 / length * 100);
  1109. } else {
  1110. return 100;
  1111. }
  1112. }
  1113. </script>