efficiencyFrm.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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. jinfengUrlRouter.getBanNowDayAllTotal,
  230. '',
  231. 'get',
  232. '',
  233. function (ret, err) {
  234. if (ret.status === 20000) {
  235. var data = ret.data;
  236. var map = {};
  237. data.map(function (obj) {
  238. map[obj.devName] = getInteger(obj.total) + '吨';
  239. });
  240. var chart = new F2.Chart({
  241. id: 'downWell',
  242. pixelRatio: window.devicePixelRatio,
  243. padding: [20, 'auto'],
  244. });
  245. chart.source(data, {
  246. percent: {
  247. formatter: function formatter(val) {
  248. return val + '吨';
  249. },
  250. },
  251. });
  252. chart.tooltip(false);
  253. chart.legend({
  254. position: 'right',
  255. itemFormatter: function itemFormatter(val) {
  256. return val + ' ' + map[val];
  257. },
  258. });
  259. chart.coord('polar', {
  260. transposed: true,
  261. innerRadius: 0.7,
  262. radius: 0.85,
  263. });
  264. chart.axis(false);
  265. chart
  266. .interval()
  267. .position('conts*total')
  268. .color('devName', [
  269. '#1890FF',
  270. '#13C2C2',
  271. '#2FC25B',
  272. '#FACC14',
  273. '#F04864',
  274. '#8543E0',
  275. '#3436C7',
  276. '#223273',
  277. ])
  278. .adjust('stack');
  279. chart.guide().html({
  280. position: ['50%', '45%'],
  281. html:
  282. '<div style="width: 250px;height: 40px;text-align: center;">' +
  283. '<div style="font-size: 16px">总产量</div>' +
  284. '<div style="font-size: 18px">' +
  285. getInteger(ret.data[0].count) +
  286. ' 吨</div>' +
  287. '</div>',
  288. });
  289. chart.render();
  290. }
  291. }
  292. );
  293. }
  294. //一周的产量
  295. function weekYield(transposed, height, type, startTime, endTime) {
  296. if (type != '年产量趋势') {
  297. var data = {
  298. dateTime: startTime,
  299. endTime: endTime,
  300. };
  301. $http.fnReuestDataNologing(
  302. jinfengUrlRouter.getBanDayList,
  303. '',
  304. 'get',
  305. data,
  306. function (ret, err) {
  307. if (ret && ret.status === 20000) {
  308. var data = ret.data;
  309. var chart = new F2.Chart({
  310. id: 'weekYield',
  311. height: height,
  312. pixelRatio: window.devicePixelRatio,
  313. });
  314. chart.source(data, {
  315. banTotal2: {
  316. tickCount: 5,
  317. },
  318. });
  319. chart.coord({
  320. transposed: transposed,
  321. });
  322. chart.tooltip({
  323. custom: false, // 自定义 tooltip 内容框
  324. });
  325. chart
  326. .interval()
  327. .position('curDT*total')
  328. .color('devName')
  329. .adjust('stack');
  330. chart.render();
  331. }
  332. }
  333. );
  334. } else {
  335. $http.fnReuestDataNologing(
  336. jinfengUrlRouter.getMonthSumByYear,
  337. '',
  338. 'get',
  339. {year: startTime},
  340. function (ret, err) {
  341. if (ret && ret.status === 20000) {
  342. var data = ret.data;
  343. var chart = new F2.Chart({
  344. id: 'weekYield',
  345. height: height,
  346. pixelRatio: window.devicePixelRatio,
  347. });
  348. chart.source(data, {
  349. banTotal2: {
  350. tickCount: 5,
  351. },
  352. });
  353. chart.coord({
  354. transposed: transposed,
  355. });
  356. chart.axis('total', {
  357. line: null,
  358. grid: F2.Global._defaultAxis.grid,
  359. label: function label(text, index, total) {
  360. var textCfg = {
  361. text: text / 10000 + '万吨',
  362. };
  363. if (index === 0) {
  364. textCfg.textAlign = 'right';
  365. } else if (index === total - 1) {
  366. textCfg.textAlign = 'right';
  367. } else {
  368. textCfg.textAlign = 'right';
  369. }
  370. return textCfg;
  371. },
  372. });
  373. chart
  374. .interval()
  375. .position('month*total')
  376. .color('devName')
  377. .adjust('stack');
  378. chart.render();
  379. }
  380. }
  381. );
  382. }
  383. }
  384. // 选择时间
  385. function openSharebox() {
  386. var myDate = new Date();
  387. var tYear = myDate.getFullYear();
  388. var tmonth = myDate.getMonth() + 1;
  389. $api.val($api.dom('.startYear'), tYear + '年');
  390. $api.val(
  391. $api.dom('.startTime'),
  392. tYear + '-' + (tmonth < 10 ? 0 + '' + tmonth : tmonth)
  393. );
  394. $api.val(
  395. $api.dom('.startData'),
  396. tYear + '-' + (tmonth < 10 ? 0 + '' + tmonth : tmonth)
  397. );
  398. new popoPicker('.js-picker', {
  399. container: '.screen',
  400. wheels: [
  401. {
  402. infinite: false,
  403. //selected: 3,
  404. data: [
  405. {value: 0, display: '周产量趋势'},
  406. {value: 1, display: '月产量趋势'},
  407. {value: 2, display: '年产量趋势'},
  408. ],
  409. },
  410. ],
  411. background: 'light',
  412. save: function (data) {
  413. switch (data.result[0].display) {
  414. case '周产量趋势':
  415. $api.addCls($api.dom('.selectTime1'), 'hide');
  416. $api.addCls($api.dom('.selectTime'), 'hide');
  417. weekYield(false, 210);
  418. break;
  419. case '月产量趋势':
  420. $api.removeCls($api.dom('.selectTime1'), 'hide');
  421. $api.addCls($api.dom('.selectTime'), 'hide');
  422. weekYield(
  423. true,
  424. 700,
  425. '',
  426. tYear +
  427. '-' +
  428. (tmonth < 10 ? 0 + '' + tmonth + '-' + 0 + '' + 1 : tmonth),
  429. tYear +
  430. '-' +
  431. (tmonth < 10 ? 0 + '' + tmonth + '-' + 31 : tmonth),
  432. ''
  433. );
  434. break;
  435. case '年产量趋势':
  436. $api.addCls($api.dom('.selectTime1'), 'hide');
  437. $api.removeCls($api.dom('.selectTime'), 'hide');
  438. weekYield(false, 300, data.result[0].display, tYear);
  439. break;
  440. default:
  441. }
  442. },
  443. });
  444. new popoDate('.startTime', {
  445. container: '.selectTime1',
  446. background: 'light',
  447. save: function (data) {
  448. weekYield(true, 700, '', data + '-' + 0 + '' + 1, data + '-' + 31);
  449. },
  450. });
  451. new popoYear('.startYear', {
  452. container: '.selectTime',
  453. background: 'light',
  454. save: function (data) {
  455. $api.val($api.dom('.startYear'), data + '年');
  456. weekYield(false, 300, '年产量趋势', data);
  457. },
  458. });
  459. new popoPicker('.js-coalCutting', {
  460. container: '.screen',
  461. wheels: [
  462. {
  463. infinite: false,
  464. //selected: 3,
  465. data: [
  466. {value: 'day', display: '日割煤刀数'},
  467. {value: 'week', display: '周割煤刀数'},
  468. {value: 'month', display: '月割煤刀数'},
  469. ],
  470. },
  471. ],
  472. background: 'light',
  473. save: function (data) {
  474. switch (data.result[0].display) {
  475. case '日割煤刀数':
  476. $api.addCls($api.dom('.selectData'), 'hide');
  477. coalCutting(data.result[0].value, false, 210, '');
  478. break;
  479. case '周割煤刀数':
  480. $api.addCls($api.dom('.selectData'), 'hide');
  481. coalCutting(data.result[0].value, false, 210, '');
  482. break;
  483. case '月割煤刀数':
  484. $api.removeCls($api.dom('.selectData'), 'hide');
  485. coalCutting('month', false, 210, '');
  486. break;
  487. default:
  488. }
  489. },
  490. });
  491. new popoDate('.startData', {
  492. container: '.selectData',
  493. background: 'light',
  494. save: function (data) {
  495. coalCutting('month', false, 210, data);
  496. },
  497. });
  498. }
  499. // 皮带称数据
  500. function getBeltData() {
  501. $http.fnReuestDataNologing(
  502. jinfengUrlRouter.getDayHourTotal,
  503. '',
  504. 'get',
  505. '',
  506. function (ret, err) {
  507. if (ret.status === 20000) {
  508. var data = ret.data;
  509. var chart = new F2.Chart({
  510. id: 'Belt',
  511. pixelRatio: window.devicePixelRatio,
  512. });
  513. chart.source(data, {
  514. time: {
  515. type: 'timeCat',
  516. mask: 'hh:mm',
  517. tickCount: 5,
  518. range: [0, 1],
  519. },
  520. });
  521. chart.tooltip({
  522. showCrosshairs: true,
  523. showItemMarker: false,
  524. onShow: function onShow(ev) {
  525. var items = ev.items;
  526. items[0].name = null;
  527. items[0].value = items[0].value + '吨';
  528. },
  529. });
  530. chart.axis('day', {
  531. label: function label(text, index, total) {
  532. var textCfg = {};
  533. if (index === 0) {
  534. textCfg.textAlign = 'left';
  535. } else if (index === total - 1) {
  536. textCfg.textAlign = 'right';
  537. }
  538. return textCfg;
  539. },
  540. });
  541. if (ret.data.length != 0) {
  542. chart.legend({
  543. custom: true,
  544. itemWidth: null,
  545. nameStyle: {
  546. textAlign: 'middle',
  547. fontSize: '14',
  548. textBaseline: 'middle',
  549. },
  550. items: [
  551. {
  552. name: '皮带秤',
  553. marker: {
  554. symbol: 'circle',
  555. radius: 5,
  556. fill:
  557. ret.data[ret.data.length - 1].runState === 'Stop'
  558. ? '#E74C3C'
  559. : '#2ECC71',
  560. },
  561. },
  562. ],
  563. });
  564. }
  565. chart.line().position('time*total').shape('smooth');
  566. chart.point().position('time*total').shape('smooth').style({
  567. stroke: '#fff',
  568. lineWidth: 1,
  569. });
  570. chart.render();
  571. }
  572. }
  573. );
  574. }
  575. // 周割煤刀数
  576. function coalCutting(type, transposed, height, date) {
  577. var param = {
  578. type: type,
  579. date: date,
  580. };
  581. $http.fnReuestDataNologing(
  582. jinfengUrlRouter.getEfficacyCutMerge,
  583. '',
  584. 'post',
  585. param,
  586. function (ret, err) {
  587. if (ret.code === 0) {
  588. // 图表
  589. var data = ret.data['total'];
  590. var chart = new F2.Chart({
  591. id: 'coalCutting',
  592. height: height,
  593. pixelRatio: window.devicePixelRatio,
  594. });
  595. chart.source(data);
  596. chart.coord({
  597. transposed: transposed,
  598. });
  599. chart.interval().position('label*value').color('type').adjust({
  600. type: 'dodge',
  601. marginRatio: 0.05, // 设置分组间柱子的间距
  602. });
  603. chart.render();
  604. // 周割煤刀数列表
  605. $apis.html(
  606. coalCuttings,
  607. '#coalCuttingsTemplate',
  608. ret.data['info']
  609. );
  610. }
  611. }
  612. );
  613. }
  614. // 前三天的产量
  615. function getThreeyield() {
  616. var curTime = new Date().getTime();
  617. var endDate = curTime - 3 * 3600 * 24 * 1000;
  618. var dateTime = curTime - 1 * 3600 * 24 * 1000;
  619. var data = {
  620. dateTime: formatDateTime(endDate),
  621. endTime: formatDateTime(dateTime),
  622. };
  623. $http.fnReuestDataNologing(
  624. jinfengUrlRouter.getBanDayThree,
  625. '',
  626. 'get',
  627. data,
  628. function (ret, err) {
  629. if (ret.status === 20000) {
  630. $apis.html(downWellPersonnal, '#downWellTemplate', ret.data);
  631. }
  632. }
  633. );
  634. }
  635. // 取整数
  636. function getInteger(data) {
  637. return Math.floor(data / 1);
  638. }
  639. </script>
  640. </body>
  641. </html>