js.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  1. $(window).load(function () {
  2. $(".loading").fadeOut();
  3. })
  4. $(function () {
  5. var prefix = 'http://10.172.21.30:9999/eap/api/ScreenDisplay/';
  6. load();
  7. setInterval(() => {
  8. load();
  9. }, 1000 * 60 * 30);
  10. function load() {
  11. loadCurrentOutput();
  12. loadEffiency();
  13. loadOrderProgress();
  14. loadAlarmCodePie();
  15. loadCompletedLots();
  16. loadCommst();
  17. loadStatusPie();
  18. loadMachineToPM();
  19. loadAlarmLine();
  20. loadMtbf();
  21. }
  22. function echarts_1(legends, data) {
  23. // 基于准备好的dom,初始化echarts实例
  24. var myChart = echarts.init(document.getElementById('echart1'));
  25. option = {
  26. tooltip: {
  27. trigger: 'item',
  28. formatter: "{b} : {c} ({d}%)"
  29. },
  30. legend: {
  31. right: 0,
  32. top: 30,
  33. height: 160,
  34. itemWidth: 10,
  35. itemHeight: 10,
  36. itemGap: 10,
  37. textStyle: {
  38. color: 'rgba(255,255,255,.6)',
  39. fontSize: 12
  40. },
  41. orient: 'vertical',
  42. data: legends
  43. },
  44. calculable: true,
  45. series: [
  46. {
  47. name: ' ',
  48. color: ['#62c98d', '#2f89cf', '#4cb9cf', '#53b666', '#62c98d', '#205acf', '#c9c862', '#c98b62', '#c962b9', '#7562c9', '#c96262', '#c25775', '#00b7be'],
  49. type: 'pie',
  50. radius: [30, 70],
  51. center: ['35%', '50%'],
  52. roseType: 'radius',
  53. label: {
  54. normal: {
  55. show: true
  56. },
  57. emphasis: {
  58. show: true
  59. }
  60. },
  61. lableLine: {
  62. normal: {
  63. show: true
  64. },
  65. emphasis: {
  66. show: true
  67. }
  68. },
  69. data: data
  70. },
  71. ]
  72. };
  73. // 使用刚指定的配置项和数据显示图表。
  74. myChart.setOption(option);
  75. window.addEventListener("resize", function () {
  76. myChart.resize();
  77. });
  78. }
  79. function echarts_2(legends, data) {
  80. // 基于准备好的dom,初始化echarts实例
  81. var myChart = echarts.init(document.getElementById('echart2'));
  82. option = {
  83. tooltip: {
  84. trigger: 'item',
  85. formatter: "{b} : {c} ({d}%)"
  86. },
  87. legend: {
  88. top: '15%',
  89. data: legends,
  90. icon: 'circle',
  91. textStyle: {
  92. color: 'rgba(255,255,255,.6)',
  93. }
  94. },
  95. calculable: true,
  96. series: [{
  97. name: '',
  98. color: ['#62c98d', '#2f89cf', '#4cb9cf', '#53b666', '#62c98d', '#205acf', '#c9c862', '#c98b62', '#c962b9', '#c96262'],
  99. type: 'pie',
  100. //起始角度,支持范围[0, 360]
  101. startAngle: 0,
  102. //饼图的半径,数组的第一项是内半径,第二项是外半径
  103. radius: [51, 100],
  104. //支持设置成百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度
  105. center: ['50%', '45%'],
  106. //是否展示成南丁格尔图,通过半径区分数据大小。可选择两种模式:
  107. // 'radius' 面积展现数据的百分比,半径展现数据的大小。
  108. // 'area' 所有扇区面积相同,仅通过半径展现数据大小
  109. roseType: 'area',
  110. //是否启用防止标签重叠策略,默认开启,圆环图这个例子中需要强制所有标签放在中心位置,可以将该值设为 false。
  111. avoidLabelOverlap: false,
  112. label: {
  113. normal: {
  114. show: true,
  115. // formatter: '{c}辆'
  116. },
  117. emphasis: {
  118. show: true
  119. }
  120. },
  121. labelLine: {
  122. normal: {
  123. show: true,
  124. length2: 1,
  125. },
  126. emphasis: {
  127. show: true
  128. }
  129. },
  130. data: data
  131. }]
  132. };
  133. // 使用刚指定的配置项和数据显示图表。
  134. myChart.setOption(option);
  135. window.addEventListener("resize", function () {
  136. myChart.resize();
  137. });
  138. }
  139. function echarts_3(legends, dates, dbData, wbData) {
  140. // 基于准备好的dom,初始化echarts实例
  141. var myChart = echarts.init(document.getElementById('echart3'));
  142. option = {
  143. tooltip: {
  144. trigger: 'axis',
  145. axisPointer: {
  146. lineStyle: {
  147. color: '#57617B'
  148. }
  149. }
  150. },
  151. legend: {
  152. //icon: 'vertical',
  153. data: legends,
  154. //align: 'center',
  155. // right: '35%',
  156. top: '0',
  157. textStyle: {
  158. color: "#fff"
  159. },
  160. // itemWidth: 15,
  161. // itemHeight: 15,
  162. itemGap: 20,
  163. },
  164. grid: {
  165. left: '0',
  166. right: '20',
  167. top: '10',
  168. bottom: '20',
  169. containLabel: true
  170. },
  171. xAxis: [{
  172. type: 'category',
  173. boundaryGap: false,
  174. axisLabel: {
  175. show: true,
  176. textStyle: {
  177. color: 'rgba(255,255,255,.6)'
  178. }
  179. },
  180. axisLine: {
  181. lineStyle: {
  182. color: 'rgba(255,255,255,.1)'
  183. }
  184. },
  185. data: dates
  186. }, {
  187. }],
  188. yAxis: [{
  189. axisLabel: {
  190. show: true,
  191. textStyle: {
  192. color: 'rgba(255,255,255,.6)'
  193. }
  194. },
  195. axisLine: {
  196. lineStyle: {
  197. color: 'rgba(255,255,255,.1)'
  198. }
  199. },
  200. splitLine: {
  201. lineStyle: {
  202. color: 'rgba(255,255,255,.1)'
  203. }
  204. }
  205. }],
  206. series: [{
  207. name: 'DB',
  208. type: 'line',
  209. smooth: true,
  210. symbol: 'circle',
  211. symbolSize: 5,
  212. showSymbol: false,
  213. lineStyle: {
  214. normal: {
  215. width: 2
  216. }
  217. },
  218. areaStyle: {
  219. normal: {
  220. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  221. offset: 0,
  222. color: 'rgba(24, 163, 64, 0.3)'
  223. }, {
  224. offset: 0.8,
  225. color: 'rgba(24, 163, 64, 0)'
  226. }], false),
  227. shadowColor: 'rgba(0, 0, 0, 0.1)',
  228. shadowBlur: 10
  229. }
  230. },
  231. itemStyle: {
  232. normal: {
  233. color: '#cdba00',
  234. borderColor: 'rgba(137,189,2,0.27)',
  235. borderWidth: 12
  236. }
  237. },
  238. data: dbData
  239. }, {
  240. name: 'WB',
  241. type: 'line',
  242. smooth: true,
  243. symbol: 'circle',
  244. symbolSize: 5,
  245. showSymbol: false,
  246. lineStyle: {
  247. normal: {
  248. width: 2
  249. }
  250. },
  251. areaStyle: {
  252. normal: {
  253. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  254. offset: 0,
  255. color: 'rgba(39, 122,206, 0.3)'
  256. }, {
  257. offset: 0.8,
  258. color: 'rgba(39, 122,206, 0)'
  259. }], false),
  260. shadowColor: 'rgba(0, 0, 0, 0.1)',
  261. shadowBlur: 10
  262. }
  263. },
  264. itemStyle: {
  265. normal: {
  266. color: '#277ace',
  267. borderColor: 'rgba(0,136,212,0.2)',
  268. borderWidth: 12
  269. }
  270. },
  271. data: wbData
  272. }]
  273. };
  274. // 使用刚指定的配置项和数据显示图表。
  275. myChart.setOption(option);
  276. window.addEventListener("resize", function () {
  277. myChart.resize();
  278. });
  279. }
  280. function echarts_4(legends, xData, dbData, wbData) {
  281. // 基于准备好的dom,初始化echarts实例
  282. var myChart = echarts.init(document.getElementById('echart4'));
  283. option = {
  284. tooltip: {
  285. trigger: 'axis',
  286. axisPointer: {
  287. lineStyle: {
  288. color: '#57617B'
  289. }
  290. }
  291. },
  292. "legend": {
  293. "data": ['DB', 'WB'],
  294. "top": "0%",
  295. "textStyle": {
  296. "color": "rgba(255,255,255,0.9)"//图例文字
  297. }
  298. },
  299. "xAxis": [
  300. {
  301. "type": "category",
  302. data: xData,
  303. axisLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
  304. axisLabel: {
  305. textStyle: { color: "rgba(255,255,255,.6)", fontSize: '14', },
  306. },
  307. },
  308. ],
  309. "yAxis": [
  310. {
  311. "type": "value",
  312. "name": "",
  313. // "interval": 10,
  314. "axisLabel": {
  315. "show": true,
  316. },
  317. axisLine: { lineStyle: { color: 'rgba(255,255,255,.4)' } },//左线色
  318. }
  319. ],
  320. "grid": {
  321. "top": "10%",
  322. "right": "30",
  323. "bottom": "30",
  324. "left": "30",
  325. },
  326. "series": [
  327. {
  328. "name": "DB",
  329. "type": "bar",
  330. "data": dbData,
  331. "barWidth": "auto",
  332. "itemStyle": {
  333. "normal": {
  334. "color": {
  335. "type": "linear",
  336. "x": 0,
  337. "y": 0,
  338. "x2": 0,
  339. "y2": 1,
  340. "colorStops": [
  341. {
  342. "offset": 0,
  343. "color": "#609db8"
  344. },
  345. {
  346. "offset": 1,
  347. "color": "#609db8"
  348. }
  349. ],
  350. "globalCoord": false
  351. }
  352. }
  353. }
  354. },
  355. {
  356. "name": "WB",
  357. "type": "bar",
  358. "data": wbData,
  359. "barWidth": "auto",
  360. "itemStyle": {
  361. "normal": {
  362. "color": {
  363. "type": "linear",
  364. "x": 0,
  365. "y": 0,
  366. "x2": 0,
  367. "y2": 1,
  368. "colorStops": [
  369. {
  370. "offset": 0,
  371. "color": "#66b8a7"
  372. },
  373. {
  374. "offset": 1,
  375. "color": "#66b8a7"
  376. }
  377. ],
  378. "globalCoord": false
  379. }
  380. }
  381. },
  382. "barGap": "0"
  383. }
  384. ]
  385. };
  386. // 使用刚指定的配置项和数据显示图表。
  387. myChart.setOption(option);
  388. window.addEventListener("resize", function () {
  389. myChart.resize();
  390. });
  391. }
  392. function echarts_5(legends, completedData, totalData) {
  393. // 基于准备好的dom,初始化echarts实例
  394. var myChart = echarts.init(document.getElementById('echart5'));
  395. // 颜色
  396. var lightBlue = {
  397. type: 'linear',
  398. x: 0,
  399. y: 0,
  400. x2: 0,
  401. y2: 1,
  402. colorStops: [{
  403. offset: 0,
  404. color: 'rgba(41, 121, 255, 1)'
  405. }, {
  406. offset: 1,
  407. color: 'rgba(0, 192, 255, 1)'
  408. }],
  409. globalCoord: false
  410. }
  411. var option = {
  412. tooltip: {
  413. show: false
  414. },
  415. grid: {
  416. top: '0%',
  417. left: '65',
  418. right: '14%',
  419. bottom: '0%',
  420. },
  421. xAxis: {
  422. min: 0,
  423. max: 100,
  424. splitLine: {
  425. show: false
  426. },
  427. axisTick: {
  428. show: false
  429. },
  430. axisLine: {
  431. show: false
  432. },
  433. axisLabel: {
  434. show: false
  435. }
  436. },
  437. yAxis: {
  438. data: legends,
  439. //offset: 15,
  440. axisTick: {
  441. show: false
  442. },
  443. axisLine: {
  444. show: false
  445. },
  446. axisLabel: {
  447. color: 'rgba(255,255,255,.6)',
  448. fontSize: 14
  449. }
  450. },
  451. series: [{
  452. type: 'bar',
  453. label: {
  454. show: true,
  455. zlevel: 10000,
  456. position: 'right',
  457. padding: 10,
  458. color: '#49bcf7',
  459. fontSize: 14,
  460. formatter: '{c}%'
  461. },
  462. itemStyle: {
  463. color: '#49bcf7'
  464. },
  465. barWidth: '15',
  466. data: completedData,
  467. z: 10
  468. }, {
  469. type: 'bar',
  470. barGap: '-100%',
  471. itemStyle: {
  472. color: '#fff',
  473. opacity: 0.1
  474. },
  475. barWidth: '15',
  476. data: totalData,
  477. z: 5
  478. }],
  479. };
  480. // 使用刚指定的配置项和数据显示图表。
  481. myChart.setOption(option);
  482. window.addEventListener("resize", function () {
  483. myChart.resize();
  484. });
  485. }
  486. function zb1(v1) {
  487. // 基于准备好的dom,初始化echarts实例
  488. var myChart = echarts.init(document.getElementById('zb1'));
  489. var v3 = 100;
  490. // v1 = 85;
  491. var v2 = v3 - v1;
  492. option = {
  493. //animation: false,
  494. series: [{
  495. type: 'pie',
  496. radius: ['60%', '70%'],
  497. color: '#49bcf7',
  498. label: {
  499. normal: {
  500. position: 'center'
  501. }
  502. },
  503. data: [{
  504. value: v1,
  505. name: '稼动率',
  506. label: {
  507. normal: {
  508. show: true,
  509. textStyle: {
  510. fontSize: 20,
  511. color: '#fff',
  512. },
  513. formatter: function (params) {
  514. return v1 + '%'
  515. }
  516. }
  517. }
  518. }, {
  519. value: v2,
  520. name: '',
  521. label: {
  522. normal: {
  523. show: false
  524. }
  525. },
  526. itemStyle: {
  527. normal: {
  528. color: 'rgba(255,255,255,.2)'
  529. },
  530. emphasis: {
  531. color: '#fff'
  532. }
  533. },
  534. }]
  535. }]
  536. };
  537. myChart.setOption(option);
  538. window.addEventListener("resize", function () {
  539. myChart.resize();
  540. });
  541. }
  542. function zb2(v1) {
  543. // 基于准备好的dom,初始化echarts实例
  544. var myChart = echarts.init(document.getElementById('zb2'));
  545. var v3 = 100;
  546. // v1 = 5;
  547. var v2 = v3 - v1;
  548. option = {
  549. //animation: false,
  550. series: [{
  551. type: 'pie',
  552. radius: ['60%', '70%'],
  553. color: '#cdba00',
  554. label: {
  555. normal: {
  556. position: 'center'
  557. }
  558. },
  559. data: [{
  560. value: v1,
  561. name: '报警率',
  562. label: {
  563. normal: {
  564. show: true,
  565. textStyle: {
  566. fontSize: 20,
  567. color: '#fff',
  568. },
  569. formatter: function (params) {
  570. return v1 + '%'
  571. }
  572. }
  573. }
  574. }, {
  575. value: v2,
  576. name: '',
  577. label: {
  578. normal: {
  579. show: false
  580. }
  581. },
  582. itemStyle: {
  583. normal: {
  584. color: 'rgba(255,255,255,.2)'
  585. },
  586. emphasis: {
  587. color: '#fff'
  588. }
  589. },
  590. }]
  591. }]
  592. };
  593. myChart.setOption(option);
  594. window.addEventListener("resize", function () {
  595. myChart.resize();
  596. });
  597. }
  598. function zb3(v1) {
  599. // 基于准备好的dom,初始化echarts实例
  600. var myChart = echarts.init(document.getElementById('zb3'));
  601. var v3 = 100;
  602. // v1 = 10;
  603. var v2 = v3 - v1;
  604. option = {
  605. //animation: false,
  606. series: [{
  607. type: 'pie',
  608. radius: ['60%', '70%'],
  609. color: '#62c98d',
  610. label: {
  611. normal: {
  612. position: 'center'
  613. }
  614. },
  615. data: [{
  616. value: v1,
  617. name: '闲置率',
  618. label: {
  619. normal: {
  620. show: true,
  621. textStyle: {
  622. fontSize: 20,
  623. color: '#fff',
  624. },
  625. formatter: function (params) {
  626. return v1 + '%'
  627. }
  628. }
  629. }
  630. }, {
  631. value: v2,
  632. name: '',
  633. label: {
  634. normal: {
  635. show: false
  636. }
  637. },
  638. itemStyle: {
  639. normal: {
  640. color: 'rgba(255,255,255,.2)'
  641. },
  642. emphasis: {
  643. color: '#fff'
  644. }
  645. },
  646. }]
  647. }]
  648. };
  649. myChart.setOption(option);
  650. window.addEventListener("resize", function () {
  651. myChart.resize();
  652. });
  653. }
  654. function loadCurrentOutput() {
  655. $.get(prefix + 'GetAlarmCountTotal', {}, function (res) {
  656. // res = 18521;
  657. $('#currentOutput').text(res);
  658. }, 'json');
  659. }
  660. function loadEffiency() {
  661. $.get(prefix + 'GetEffiency', {}, function (res) {
  662. console.log(res);
  663. zb1((res.runRate * 100).toFixed(2));
  664. zb2((res.alarmRate * 100).toFixed(2));
  665. console.log((res.runRate * 100).toFixed(2));
  666. console.log((res.alarmRate * 100).toFixed(2));
  667. console.log(100 - parseFloat((res.runRate * 100).toFixed(2)) - parseFloat((res.alarmRate * 100).toFixed(2)));
  668. zb3(100 - parseFloat((res.runRate * 100).toFixed(2)) - parseFloat((res.alarmRate * 100).toFixed(2)));
  669. }, 'json');
  670. }
  671. function loadOrderProgress() {
  672. $.get(prefix + 'GetOrderProgress', {}, function (res) {
  673. console.log(res);
  674. var legends = [];
  675. var comdata = [];
  676. var total = [];
  677. res.forEach(element => {
  678. legends.push(element.orderNo);
  679. var com = Math.round(element.completeCount / element.totalCount * 100);
  680. if (com > 100) {
  681. com = 100;
  682. }
  683. comdata.push(com);
  684. total.push(100);
  685. });
  686. echarts_5(legends, comdata, total);
  687. }, 'json');
  688. }
  689. function loadAlarmCodePie() {
  690. var take = 5;
  691. $.get(prefix + 'GetAlarmCodePie', { take: take }, function (res) {
  692. console.log(res);
  693. var legends = [];
  694. var data = [];
  695. var total = 0;
  696. res.forEach(element => {
  697. total += element.count;
  698. });
  699. res.forEach(element => {
  700. legends.push(element.alarmCode);
  701. data.push({
  702. value: Math.round(element.count / total * 100),
  703. name: element.alarmCode
  704. });
  705. });
  706. echarts_1(legends, data);
  707. }, 'json');
  708. }
  709. // 加载已完成lot
  710. function loadCompletedLots() {
  711. $.get(prefix + 'ReadJobBooking', {}, function (res) {
  712. console.log(res);
  713. var html = '';
  714. res.forEach(element => {
  715. html += '<li><p><span>' + element.lotNo + '</span><span>' + element.macCode + '</span><span>' + element.ftotal + '</span><span>'
  716. + element.modtime.split('T')[1].substr(0, 8) + '</span></p></li>';
  717. });
  718. $('.lastestLots').html(html);
  719. $('.wrap,.adduser').liMarquee({
  720. direction: 'up',/*身上滚动*/
  721. runshort: true,/*内容不足时不滚动*/
  722. scrollamount: 20/*速度*/,
  723. behavior:'alternate'
  724. });
  725. }, 'json');
  726. }
  727. // 加载参数比对未通过机台
  728. function loadCommst() {
  729. $.get(prefix + 'ReadParamsComMst', {}, function (res) {
  730. console.log(res);
  731. var index = 1;
  732. res.forEach(element => {
  733. var tr = $('<tr>');
  734. var td1 = $('<td>');
  735. var span = $('<span>');
  736. span.text(index++);
  737. td1.append(span);
  738. var td2 = $('<td>');
  739. td2.text(element.macFCode);
  740. var td3 = $('<td>');
  741. td3.text(element.programFName);
  742. var td4 = $('<td>');
  743. td4.text(element.recTime.split('T')[1]);
  744. tr.append(td1).append(td2).append(td3).append(td4);
  745. $('#paramsCommst').append(tr);
  746. });
  747. }, 'json');
  748. }
  749. // 加载机台状态分布
  750. function loadStatusPie() {
  751. $.get(prefix + 'ReadLastStatus', {}, function (res) {
  752. console.log(res);
  753. var legends = [];
  754. var data = [];
  755. res.forEach(element => {
  756. legends.push(element.statusFName);
  757. data.push({
  758. value: element.fLen,
  759. name: element.statusFName
  760. });
  761. });
  762. for (var i = 0; i < 5; i++) {
  763. data.push(
  764. { value: 0, name: "", label: { show: false }, labelLine: { show: false } }
  765. );
  766. }
  767. echarts_2(legends, data);
  768. }, 'json');
  769. }
  770. // 加载待保养机台
  771. function loadMachineToPM() {
  772. $.get(prefix + 'GetMachineToPms', {}, function (res) {
  773. console.log(res);
  774. var index = 1;
  775. res.forEach(element => {
  776. var tr = $('<tr>');
  777. var td1 = $('<td>');
  778. var span = $('<span>');
  779. span.text(index++);
  780. td1.append(span);
  781. var td2 = $('<td>');
  782. td2.text(element.macCode);
  783. var td3 = $('<td>');
  784. td3.text(element.pmName);
  785. var td4 = $('<td>');
  786. td4.text(element.nextPmTime.split('T')[0]);
  787. tr.append(td1).append(td2).append(td3).append(td4);
  788. $('#machineToPm').append(tr);
  789. });
  790. }, 'json');
  791. }
  792. function loadAlarmLine() {
  793. $.get(prefix + 'GetAlarmLines', {}, function (res) {
  794. console.log(res);
  795. var legends = [];
  796. var dbData = [];
  797. var wbData = [];
  798. var dates = res.dates;
  799. var series = res.lineSeries;
  800. series.forEach(element => {
  801. legends.push(element.name);
  802. if (element.name === 'DB') {
  803. element.alarmTimeDtos.forEach(item => {
  804. dbData.push(item.count);
  805. });
  806. } else if (element.name === 'WB') {
  807. element.alarmTimeDtos.forEach(item => {
  808. wbData.push(item.count);
  809. });
  810. }
  811. });
  812. legends = ['DB', 'WB'];
  813. echarts_3(legends, dates, dbData, wbData);
  814. }, 'json');
  815. }
  816. function loadMtbf() {
  817. $.get(prefix + 'GetMTBFForDisplay', {}, function (res) {
  818. console.log(res);
  819. var legends = [];
  820. var xData = [];
  821. var dbData = [];
  822. var wbData = [];
  823. res.legend.forEach(element => {
  824. legends.push({
  825. name: element
  826. });
  827. });
  828. res.sources.forEach(element => {
  829. xData.push(element.title);
  830. element.data.forEach(item => {
  831. if (item.code === 'DB') {
  832. dbData.push(item.value.toFixed(2));
  833. } else if (item.code === 'WB') {
  834. wbData.push(item.value.toFixed(2));
  835. }
  836. });
  837. });
  838. echarts_4(legends, xData, dbData, wbData);
  839. }, 'json');
  840. }
  841. })