efficiencyFrm.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta
  6. name="viewport"
  7. content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
  8. />
  9. <meta
  10. name="format-detection"
  11. content="telephone=no,email=no,date=no,address=no"
  12. />
  13. <title>生产数据</title>
  14. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  15. <!--<link rel="stylesheet" type="text/css" href="../../css/aui.css"/>-->
  16. <link rel="stylesheet" type="text/css" href="../../css/popoPicker.css" />
  17. <link rel="stylesheet" type="text/css" href="../../css/style.css" />
  18. <link rel="stylesheet" href="../../css/projeck.css" />
  19. <style>
  20. body,
  21. html {
  22. background: #f3f3f3;
  23. }
  24. .api_layout {
  25. /*border-top: 1px solid #37b0e9;*/
  26. padding: 13px 10px;
  27. -webkit-box-sizing: border-box;
  28. -moz-box-sizing: border-box;
  29. box-sizing: border-box;
  30. }
  31. .navs_item {
  32. padding: 0;
  33. }
  34. .nav_title {
  35. padding: 0 5px;
  36. background: #f3f6fa;
  37. }
  38. .nav_title li {
  39. text-align: center;
  40. font-size: 14px;
  41. padding: 9px 0;
  42. color: #232627;
  43. }
  44. .li-box {
  45. height: 39px;
  46. line-height: 39px;
  47. font-size: 14px;
  48. color: #232627;
  49. }
  50. .selectData {
  51. margin-left: 10px;
  52. }
  53. #coalCuttings .li-box {
  54. height: auto;
  55. line-height: normal;
  56. padding: 11px 0;
  57. font-size: 12px;
  58. }
  59. </style>
  60. </head>
  61. <body>
  62. <div class="api_layout">
  63. <!-- 时间 -->
  64. <div class="Notice borderRa Stitle">
  65. <span class="time-box"></span>
  66. </div>
  67. <!--今日产量-->
  68. <div class="Notice borderRa beforS">
  69. <p class="Stitle centertT">今日产量</p>
  70. <div class="" style="width: 100%;">
  71. <canvas
  72. id="downWell"
  73. style="width: 100%; margin-top: 10px; height: 210px;"
  74. ></canvas>
  75. </div>
  76. </div>
  77. <!-- 一周产量 -->
  78. <div class="Notice borderRa">
  79. <div class="Chart">
  80. <div class="flex-start">
  81. <div class="relative Sharebox screen">
  82. <input id="button-value" class="js-picker" value="周产量趋势" />
  83. <i class="lower"></i>
  84. </div>
  85. <div class="selectTime hide">
  86. <input class="button-value startYear" value="" />
  87. </div>
  88. <div class="selectTime1 hide">
  89. <input class="button-value startTime" value="" />
  90. </div>
  91. </div>
  92. <div class="" style="width: 100%;">
  93. <canvas
  94. id="weekYield"
  95. style="width: 100%; margin-top: 10px; height: 210px;"
  96. ></canvas>
  97. </div>
  98. </div>
  99. <!--列表-->
  100. <nav>
  101. <ul class="nav_title flex-wrap">
  102. <li class="flex-con">日期</li>
  103. <li class="flex-con">晚班</li>
  104. <li class="flex-con">早班</li>
  105. <li class="flex-con">中班</li>
  106. <li class="flex-con">日产量</li>
  107. </ul>
  108. </nav>
  109. <ul class="downWellPersonnal" id="downWellPersonnal"></ul>
  110. </div>
  111. <!-- 皮带秤 产量 -->
  112. <div class="Notice borderRa beforS">
  113. <p class="Stitle centertT">皮带秤小时产量</p>
  114. <div class="" style="width: 100%;">
  115. <canvas
  116. id="Belt"
  117. style="width: 100%; margin-top: 10px; height: 210px;"
  118. ></canvas>
  119. </div>
  120. </div>
  121. <!-- 周割煤刀数 -->
  122. <div class="Notice borderRa">
  123. <div class="Chart">
  124. <div class="flex-start">
  125. <div class="relative Sharebox screen">
  126. <input
  127. id="button-value"
  128. class="js-coalCutting"
  129. readonly
  130. value="日割煤刀数"
  131. />
  132. <i class="lower"></i>
  133. </div>
  134. <div class="selectData hide">
  135. <input class="button-value startData" value="" />
  136. </div>
  137. </div>
  138. <div class="" style="width: 100%;">
  139. <canvas
  140. id="coalCutting"
  141. style="width: 100%; margin-top: 10px; height: 210px;"
  142. ></canvas>
  143. </div>
  144. </div>
  145. <!--列表-->
  146. <nav>
  147. <ul class="nav_title flex-wrap">
  148. <li class="flex-con">工作面名称</li>
  149. <li class="flex-con">区队名称</li>
  150. <li class="flex-con">实际刀数</li>
  151. <li class="flex-con">计划刀数</li>
  152. </ul>
  153. </nav>
  154. <ul class="downWellPersonnal" id="coalCuttings"></ul>
  155. </div>
  156. </div>
  157. <script type="text/template" id="downWellTemplate">
  158. {{~it:value}}
  159. <li class="flex-wrap li-box centertT relative after-border">
  160. <span class="flex-con">{{=value.CurDT}}</span>
  161. <span class="flex-con">{{=getInteger(value.BanTotal1)}}吨</span>
  162. <span class="flex-con">{{=getInteger(value.BanTotal2)}}吨</span>
  163. <span class="flex-con">{{=getInteger(value.BanTotal3)}}吨</span>
  164. <span class="flex-con">{{=getInteger(value.BanTotal2) + getInteger(value.BanTotal3) + getInteger(value.BanTotal1)}}吨</span>
  165. </li>
  166. {{~}}
  167. </script>
  168. <script type="text/template" id="coalCuttingsTemplate">
  169. {{~it:value}}
  170. <li class="flex-wrap li-box centertT relative after-border">
  171. <span class="flex-con">{{=value.work}}</span>
  172. <span class="flex-con">{{=value.team}}</span>
  173. <span class="flex-con">{{=value.value}}刀</span>
  174. <span class="flex-con">{{=value.plan_value}}刀</span>
  175. </li>
  176. {{~}}
  177. </script>
  178. <script src="../../script/api.js"></script>
  179. <script src="../../script/popoPicker.js"></script>
  180. <script src="../../script/doT.min.js"></script>
  181. <script src="../../script/f2.js"></script>
  182. <script src="../../script/config.js"></script>
  183. <script>
  184. var headers;
  185. var apiToast = new apiToast();
  186. apiready = function () {
  187. var info = $api.getStorage('data'),
  188. user = JSON.parse(info).data.user;
  189. token = JSON.parse(info).data.access_token;
  190. $api.html($api.dom('.time-box'), getNowFormatDate());
  191. setInterval(function () {
  192. $api.html($api.dom('.time-box'), getNowFormatDate());
  193. }, 1000);
  194. headers = {
  195. Authorization: 'Bearer ' + token,
  196. };
  197. openSharebox(); //选择器
  198. // 图表权限
  199. chartsJurisdiction();
  200. // 监听切换tab标签,刷新页面
  201. api.addEventListener(
  202. {
  203. name: 'refreshProduction',
  204. },
  205. function (ret, err) {
  206. // 图表
  207. chartsJurisdiction();
  208. }
  209. );
  210. };
  211. // 图表
  212. function chartsJurisdiction() {
  213. $api.val($api.dom('#button-value'), '周产量趋势');
  214. $api.addCls($api.dom('.selectTime1'), 'hide');
  215. $api.addCls($api.dom('.selectTime'), 'hide');
  216. getThreeyield();
  217. // 今日产量
  218. downWell();
  219. //一周的产量
  220. weekYield(false, 210);
  221. // 皮带称
  222. getBeltData();
  223. // 割煤刀数
  224. coalCutting('day', false, 210, '');
  225. }
  226. // 今日产量
  227. function downWell() {
  228. $http.fnReuestDataNologing(
  229. zaoquanUrlRouter.getBanNowDayAllTotal,
  230. '',
  231. 'get',
  232. '',
  233. function (ret, err) {
  234. // console.log(JSON.stringify(ret));
  235. // console.log(JSON.stringify(err));
  236. if (ret.status === 20000) {
  237. var data = ret.data;
  238. var map = {};
  239. data.map(function (obj) {
  240. map[obj.devName] = getInteger(obj.total) + '吨';
  241. });
  242. var chart = new F2.Chart({
  243. id: 'downWell',
  244. pixelRatio: window.devicePixelRatio,
  245. padding: [20, 'auto'],
  246. });
  247. chart.source(data, {
  248. percent: {
  249. formatter: function formatter(val) {
  250. return val + '吨';
  251. },
  252. },
  253. });
  254. chart.tooltip(false);
  255. chart.legend({
  256. position: 'right',
  257. itemFormatter: function itemFormatter(val) {
  258. return val + ' ' + map[val];
  259. },
  260. });
  261. chart.coord('polar', {
  262. transposed: true,
  263. innerRadius: 0.7,
  264. radius: 0.85,
  265. });
  266. chart.axis(false);
  267. chart
  268. .interval()
  269. .position('conts*total')
  270. .color('devName', [
  271. '#1890FF',
  272. '#13C2C2',
  273. '#2FC25B',
  274. '#FACC14',
  275. '#F04864',
  276. '#8543E0',
  277. '#3436C7',
  278. '#223273',
  279. ])
  280. .adjust('stack');
  281. chart.guide().html({
  282. position: ['50%', '45%'],
  283. html:
  284. '<div style="width: 250px;height: 40px;text-align: center;">' +
  285. '<div style="font-size: 16px">总产量</div>' +
  286. '<div style="font-size: 18px">' +
  287. getInteger(ret.data[0].count) +
  288. ' 吨</div>' +
  289. '</div>',
  290. });
  291. chart.render();
  292. }
  293. }
  294. );
  295. }
  296. //一周的产量
  297. function weekYield(transposed, height, type, startTime, endTime) {
  298. if (type != '年产量趋势') {
  299. var data = {
  300. dateTime: startTime,
  301. endTime: endTime,
  302. };
  303. $http.fnReuestDataNologing(
  304. zaoquanUrlRouter.getBanDayList,
  305. '',
  306. 'get',
  307. data,
  308. function (ret, err) {
  309. // console.log(JSON.stringify(ret));
  310. // console.log(JSON.stringify(err));
  311. if (ret && ret.status === 20000) {
  312. var data = ret.data;
  313. var chart = new F2.Chart({
  314. id: 'weekYield',
  315. height: height,
  316. pixelRatio: window.devicePixelRatio,
  317. });
  318. chart.source(data, {
  319. banTotal2: {
  320. tickCount: 5,
  321. },
  322. });
  323. chart.coord({
  324. transposed: transposed,
  325. });
  326. chart.tooltip({
  327. custom: false, // 自定义 tooltip 内容框
  328. });
  329. chart
  330. .interval()
  331. .position('curDT*total')
  332. .color('devName')
  333. .adjust('stack');
  334. chart.render();
  335. }
  336. }
  337. );
  338. } else {
  339. $http.fnReuestDataNologing(
  340. zaoquanUrlRouter.getMonthSumByYear,
  341. '',
  342. 'get',
  343. {year: startTime},
  344. function (ret, err) {
  345. // console.log(JSON.stringify(ret));
  346. // console.log(JSON.stringify(err));
  347. if (ret && ret.status === 20000) {
  348. var data = ret.data;
  349. var chart = new F2.Chart({
  350. id: 'weekYield',
  351. height: height,
  352. pixelRatio: window.devicePixelRatio,
  353. });
  354. chart.source(data, {
  355. banTotal2: {
  356. tickCount: 5,
  357. },
  358. });
  359. chart.coord({
  360. transposed: transposed,
  361. });
  362. chart.axis('total', {
  363. line: null,
  364. grid: F2.Global._defaultAxis.grid,
  365. label: function label(text, index, total) {
  366. var textCfg = {
  367. text: text / 10000 + '万吨',
  368. };
  369. if (index === 0) {
  370. textCfg.textAlign = 'right';
  371. } else if (index === total - 1) {
  372. textCfg.textAlign = 'right';
  373. } else {
  374. textCfg.textAlign = 'right';
  375. }
  376. return textCfg;
  377. },
  378. });
  379. chart
  380. .interval()
  381. .position('month*total')
  382. .color('devName')
  383. .adjust('stack');
  384. chart.render();
  385. }
  386. }
  387. );
  388. }
  389. }
  390. // 选择时间
  391. function openSharebox() {
  392. var myDate = new Date();
  393. var tYear = myDate.getFullYear();
  394. var tmonth = myDate.getMonth() + 1;
  395. $api.val($api.dom('.startYear'), tYear + '年');
  396. $api.val(
  397. $api.dom('.startTime'),
  398. tYear + '-' + (tmonth < 10 ? 0 + '' + tmonth : tmonth)
  399. );
  400. $api.val(
  401. $api.dom('.startData'),
  402. tYear + '-' + (tmonth < 10 ? 0 + '' + tmonth : tmonth)
  403. );
  404. new popoPicker('.js-picker', {
  405. container: '.screen',
  406. wheels: [
  407. {
  408. infinite: false,
  409. //selected: 3,
  410. data: [
  411. {value: 0, display: '周产量趋势'},
  412. {value: 1, display: '月产量趋势'},
  413. {value: 2, display: '年产量趋势'},
  414. ],
  415. },
  416. ],
  417. background: 'light',
  418. save: function (data) {
  419. switch (data.result[0].display) {
  420. case '周产量趋势':
  421. $api.addCls($api.dom('.selectTime1'), 'hide');
  422. $api.addCls($api.dom('.selectTime'), 'hide');
  423. weekYield(false, 210);
  424. break;
  425. case '月产量趋势':
  426. $api.removeCls($api.dom('.selectTime1'), 'hide');
  427. $api.addCls($api.dom('.selectTime'), 'hide');
  428. weekYield(
  429. true,
  430. 700,
  431. '',
  432. tYear +
  433. '-' +
  434. (tmonth < 10 ? 0 + '' + tmonth + '-' + 0 + '' + 1 : tmonth),
  435. tYear +
  436. '-' +
  437. (tmonth < 10 ? 0 + '' + tmonth + '-' + 31 : tmonth),
  438. ''
  439. );
  440. break;
  441. case '年产量趋势':
  442. $api.addCls($api.dom('.selectTime1'), 'hide');
  443. $api.removeCls($api.dom('.selectTime'), 'hide');
  444. weekYield(false, 300, data.result[0].display, tYear);
  445. break;
  446. default:
  447. }
  448. },
  449. });
  450. new popoDate('.startTime', {
  451. container: '.selectTime1',
  452. background: 'light',
  453. save: function (data) {
  454. weekYield(true, 700, '', data + '-' + 0 + '' + 1, data + '-' + 31);
  455. },
  456. });
  457. new popoYear('.startYear', {
  458. container: '.selectTime',
  459. background: 'light',
  460. save: function (data) {
  461. $api.val($api.dom('.startYear'), data + '年');
  462. weekYield(false, 300, '年产量趋势', data);
  463. },
  464. });
  465. new popoPicker('.js-coalCutting', {
  466. container: '.screen',
  467. wheels: [
  468. {
  469. infinite: false,
  470. //selected: 3,
  471. data: [
  472. {value: 'day', display: '日割煤刀数'},
  473. {value: 'week', display: '周割煤刀数'},
  474. {value: 'month', display: '月割煤刀数'},
  475. ],
  476. },
  477. ],
  478. background: 'light',
  479. save: function (data) {
  480. switch (data.result[0].display) {
  481. case '日割煤刀数':
  482. $api.addCls($api.dom('.selectData'), 'hide');
  483. coalCutting(data.result[0].value, false, 210, '');
  484. break;
  485. case '周割煤刀数':
  486. $api.addCls($api.dom('.selectData'), 'hide');
  487. coalCutting(data.result[0].value, false, 210, '');
  488. break;
  489. case '月割煤刀数':
  490. $api.removeCls($api.dom('.selectData'), 'hide');
  491. coalCutting('month', false, 210, '');
  492. break;
  493. default:
  494. }
  495. },
  496. });
  497. new popoDate('.startData', {
  498. container: '.selectData',
  499. background: 'light',
  500. save: function (data) {
  501. coalCutting('month', false, 210, data);
  502. },
  503. });
  504. }
  505. // 皮带称数据
  506. function getBeltData() {
  507. $http.fnReuestDataNologing(
  508. zaoquanUrlRouter.getDayHourTotal,
  509. '',
  510. 'get',
  511. '',
  512. function (ret, err) {
  513. // console.log(JSON.stringify(ret));
  514. // console.log(JSON.stringify(err));
  515. if (ret.status === 20000) {
  516. var data = ret.data;
  517. var chart = new F2.Chart({
  518. id: 'Belt',
  519. pixelRatio: window.devicePixelRatio,
  520. });
  521. chart.source(data, {
  522. time: {
  523. type: 'timeCat',
  524. mask: 'hh:mm',
  525. tickCount: 5,
  526. range: [0, 1],
  527. },
  528. });
  529. chart.tooltip({
  530. showCrosshairs: true,
  531. showItemMarker: false,
  532. onShow: function onShow(ev) {
  533. var items = ev.items;
  534. items[0].name = null;
  535. items[0].value = items[0].value + '吨';
  536. },
  537. });
  538. chart.axis('day', {
  539. label: function label(text, index, total) {
  540. var textCfg = {};
  541. if (index === 0) {
  542. textCfg.textAlign = 'left';
  543. } else if (index === total - 1) {
  544. textCfg.textAlign = 'right';
  545. }
  546. return textCfg;
  547. },
  548. });
  549. if (ret.data.length != 0) {
  550. chart.legend({
  551. custom: true,
  552. itemWidth: null,
  553. nameStyle: {
  554. textAlign: 'middle',
  555. fontSize: '14',
  556. textBaseline: 'middle',
  557. },
  558. items: [
  559. {
  560. name: '皮带秤',
  561. marker: {
  562. symbol: 'circle',
  563. radius: 5,
  564. fill:
  565. ret.data[ret.data.length - 1].runState === 'Stop'
  566. ? '#E74C3C'
  567. : '#2ECC71',
  568. },
  569. },
  570. ],
  571. });
  572. }
  573. chart.line().position('time*total').shape('smooth');
  574. chart.point().position('time*total').shape('smooth').style({
  575. stroke: '#fff',
  576. lineWidth: 1,
  577. });
  578. chart.render();
  579. }
  580. }
  581. );
  582. }
  583. // 周割煤刀数
  584. function coalCutting(type, transposed, height, date) {
  585. var param = {
  586. type: type,
  587. date: date,
  588. };
  589. $http.fnReuestDataNologing(
  590. zaoquanUrlRouter.getEfficacyCutMerge,
  591. '',
  592. 'post',
  593. param,
  594. function (ret, err) {
  595. if (ret.code === 0) {
  596. // 图表
  597. var data = ret.data['total'];
  598. var chart = new F2.Chart({
  599. id: 'coalCutting',
  600. height: height,
  601. pixelRatio: window.devicePixelRatio,
  602. });
  603. chart.source(data);
  604. chart.coord({
  605. transposed: transposed,
  606. });
  607. chart.interval().position('label*value').color('type').adjust({
  608. type: 'dodge',
  609. marginRatio: 0.05, // 设置分组间柱子的间距
  610. });
  611. chart.render();
  612. // 周割煤刀数列表
  613. $apis.html(
  614. coalCuttings,
  615. '#coalCuttingsTemplate',
  616. ret.data['info']
  617. );
  618. }
  619. }
  620. );
  621. }
  622. // 前三天的产量
  623. function getThreeyield() {
  624. var curTime = new Date().getTime();
  625. var endDate = curTime - 3 * 3600 * 24 * 1000;
  626. var dateTime = curTime - 1 * 3600 * 24 * 1000;
  627. var data = {
  628. dateTime: formatDateTime(endDate),
  629. endTime: formatDateTime(dateTime),
  630. };
  631. $http.fnReuestDataNologing(
  632. zaoquanUrlRouter.getBanDayThree,
  633. '',
  634. 'get',
  635. data,
  636. function (ret, err) {
  637. if (ret.status === 20000) {
  638. $apis.html(downWellPersonnal, '#downWellTemplate', ret.data);
  639. }
  640. }
  641. );
  642. }
  643. // 取整数
  644. function getInteger(data) {
  645. return Math.floor(data / 1);
  646. }
  647. </script>
  648. </body>
  649. </html>