efficiencyFrm.html 18 KB

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