dashboard.js 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  1. $(window).load(function () {
  2. $(".loading").fadeOut();
  3. })
  4. $(function () {
  5. var prefix = 'http://localhost:18531/eap/api/Dashboard/';
  6. load();
  7. setInterval(() => {
  8. load();
  9. }, 1000 * 60 * 30);
  10. function load() {
  11. var dateNow = new Date();
  12. var lastYear = dateNow.getFullYear() - 1;
  13. var thisYear = dateNow.getFullYear();
  14. var yearSpan = lastYear + '、' + thisYear;
  15. $('.yearSpan').text(yearSpan);
  16. loadCurrentOutput();
  17. loadCompletedLots();
  18. loadMachineToPms();
  19. loadPmRate();
  20. loadAlarmCodePie();
  21. loadGoodRate("中测");
  22. loadGoodRate('成测');
  23. loadOutputs('封装');
  24. loadOutputs('中测');
  25. loadOutputs('成测');
  26. loadOS();
  27. $('#owl').owlCarousel({
  28. items: 1,
  29. autoPlay: 5000,
  30. pagination: false
  31. });
  32. }
  33. function echarts_1(legends, data) {
  34. // 基于准备好的dom,初始化echarts实例
  35. var myChart = echarts.init(document.getElementById('echart1'));
  36. option = {
  37. tooltip: {
  38. trigger: 'item',
  39. formatter: "{b} : {c} ({d}%)"
  40. },
  41. legend: {
  42. right: 0,
  43. top: 30,
  44. height: 160,
  45. itemWidth: 10,
  46. itemHeight: 10,
  47. itemGap: 10,
  48. textStyle: {
  49. color: 'rgba(255,255,255,.6)',
  50. fontSize: 12
  51. },
  52. orient: 'vertical',
  53. data: legends
  54. },
  55. calculable: true,
  56. series: [
  57. {
  58. name: ' ',
  59. color: ['#62c98d', '#2f89cf', '#4cb9cf', '#53b666', '#62c98d', '#205acf', '#c9c862', '#c98b62', '#c962b9', '#7562c9', '#c96262', '#c25775', '#00b7be'],
  60. type: 'pie',
  61. radius: [30, 70],
  62. center: ['35%', '50%'],
  63. roseType: 'radius',
  64. label: {
  65. normal: {
  66. show: true
  67. },
  68. emphasis: {
  69. show: true
  70. }
  71. },
  72. lableLine: {
  73. normal: {
  74. show: true
  75. },
  76. emphasis: {
  77. show: true
  78. }
  79. },
  80. data: data
  81. },
  82. ]
  83. };
  84. // 使用刚指定的配置项和数据显示图表。
  85. myChart.setOption(option);
  86. window.addEventListener("resize", function () {
  87. myChart.resize();
  88. });
  89. }
  90. function echarts_2(legends, data) {
  91. // 基于准备好的dom,初始化echarts实例
  92. var myChart = echarts.init(document.getElementById('echart2'));
  93. option = {
  94. tooltip: {
  95. trigger: 'item',
  96. formatter: "{b} : {d}%"
  97. },
  98. legend: {
  99. right: 0,
  100. top: 30,
  101. data: legends,
  102. icon: 'circle',
  103. textStyle: {
  104. color: 'rgba(255,255,255,.6)',
  105. }
  106. },
  107. calculable: true,
  108. series: [{
  109. name: '',
  110. color: ['#62c98d', '#2f89cf', '#4cb9cf', '#53b666', '#62c98d', '#205acf', '#c9c862', '#c98b62', '#c962b9', '#c96262'],
  111. type: 'pie',
  112. //起始角度,支持范围[0, 360]
  113. startAngle: 0,
  114. //饼图的半径,数组的第一项是内半径,第二项是外半径
  115. radius: [51, 100],
  116. //支持设置成百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度
  117. center: ['50%', '45%'],
  118. //是否展示成南丁格尔图,通过半径区分数据大小。可选择两种模式:
  119. // 'radius' 面积展现数据的百分比,半径展现数据的大小。
  120. // 'area' 所有扇区面积相同,仅通过半径展现数据大小
  121. roseType: 'area',
  122. //是否启用防止标签重叠策略,默认开启,圆环图这个例子中需要强制所有标签放在中心位置,可以将该值设为 false。
  123. avoidLabelOverlap: false,
  124. label: {
  125. normal: {
  126. show: true,
  127. // formatter: '{c}辆'
  128. },
  129. emphasis: {
  130. show: true
  131. }
  132. },
  133. labelLine: {
  134. normal: {
  135. show: true,
  136. length2: 1,
  137. },
  138. emphasis: {
  139. show: true
  140. }
  141. },
  142. data: data
  143. }]
  144. };
  145. // 使用刚指定的配置项和数据显示图表。
  146. myChart.setOption(option);
  147. window.addEventListener("resize", function () {
  148. myChart.resize();
  149. });
  150. }
  151. function echarts_ZC(legends, dates, dbData, wbData) {
  152. // 基于准备好的dom,初始化echarts实例
  153. var myChart = echarts.init(document.getElementById('echart3'));
  154. option = {
  155. tooltip: {
  156. trigger: 'axis',
  157. axisPointer: {
  158. lineStyle: {
  159. color: '#57617B'
  160. }
  161. },
  162. // formatter:'{a}-{b}:{c}%'
  163. },
  164. legend: {
  165. data: legends,
  166. top: '0',
  167. textStyle: {
  168. color: "#fff"
  169. },
  170. itemGap: 20,
  171. },
  172. grid: {
  173. left: '0',
  174. right: '20',
  175. top: '10',
  176. bottom: '20',
  177. containLabel: true
  178. },
  179. xAxis: [{
  180. type: 'category',
  181. boundaryGap: false,
  182. axisLabel: {
  183. show: true,
  184. textStyle: {
  185. color: 'rgba(255,255,255,.6)'
  186. }
  187. },
  188. axisLine: {
  189. lineStyle: {
  190. color: 'rgba(255,255,255,.1)'
  191. }
  192. },
  193. data: dates
  194. }, {
  195. }],
  196. yAxis: [{
  197. // min: 50,
  198. axisLabel: {
  199. show: true,
  200. textStyle: {
  201. color: 'rgba(255,255,255,.6)'
  202. }
  203. },
  204. axisLine: {
  205. lineStyle: {
  206. color: 'rgba(255,255,255,.1)'
  207. }
  208. },
  209. splitLine: {
  210. lineStyle: {
  211. color: 'rgba(255,255,255,.1)'
  212. }
  213. }
  214. }],
  215. series: [{
  216. name: legends[0],
  217. type: 'line',
  218. smooth: false,
  219. lineStyle: {
  220. normal: {
  221. width: 2
  222. }
  223. },
  224. label: {
  225. normal: {
  226. show: false,
  227. position: 'bottom',
  228. color: '#fff',
  229. formatter: function (parmas) {
  230. if (parseFloat(parmas.data) <= 0)
  231. return '';
  232. return parmas.data + '%';
  233. }
  234. }
  235. },
  236. areaStyle: {
  237. normal: {
  238. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  239. offset: 0,
  240. color: 'rgba(24, 163, 64, 0.3)'
  241. }, {
  242. offset: 0.8,
  243. color: 'rgba(24, 163, 64, 0)'
  244. }], false),
  245. shadowColor: 'rgba(0, 0, 0, 0.1)',
  246. shadowBlur: 10
  247. }
  248. },
  249. itemStyle: {
  250. normal: {
  251. color: '#cdba00',
  252. borderColor: 'rgba(137,189,2,0.27)',
  253. borderWidth: 12
  254. }
  255. },
  256. symbolSize: 2,
  257. data: dbData
  258. }, {
  259. name: legends[1],
  260. type: 'line',
  261. smooth: false,
  262. lineStyle: {
  263. normal: {
  264. width: 2
  265. }
  266. },
  267. label: {
  268. normal: {
  269. show: false,
  270. position: 'bottom',
  271. color: '#fff',
  272. formatter: function (parmas) {
  273. if (parseFloat(parmas.value) <= 0)
  274. return '';
  275. return parmas.data + '%';
  276. }
  277. }
  278. },
  279. areaStyle: {
  280. normal: {
  281. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  282. offset: 0,
  283. color: 'rgba(39, 122,206, 0.3)'
  284. }, {
  285. offset: 0.8,
  286. color: 'rgba(39, 122,206, 0)'
  287. }], false),
  288. shadowColor: 'rgba(0, 0, 0, 0.1)',
  289. shadowBlur: 10
  290. }
  291. },
  292. itemStyle: {
  293. normal: {
  294. color: '#277ace',
  295. borderColor: 'rgba(0,136,212,0.2)',
  296. borderWidth: 12
  297. }
  298. }, symbolSize: 2,
  299. data: wbData
  300. }]
  301. };
  302. // 使用刚指定的配置项和数据显示图表。
  303. myChart.setOption(option);
  304. window.addEventListener("resize", function () {
  305. myChart.resize();
  306. });
  307. }
  308. function echarts_CC(legends, dates, dbData, wbData) {
  309. // 基于准备好的dom,初始化echarts实例
  310. var myChart = echarts.init(document.getElementById('echart4'));
  311. option = {
  312. tooltip: {
  313. trigger: 'axis',
  314. axisPointer: {
  315. lineStyle: {
  316. color: '#57617B'
  317. }
  318. },
  319. // formatter:'{a}-{b}:{c}%'
  320. },
  321. legend: {
  322. data: legends,
  323. top: '0',
  324. textStyle: {
  325. color: "#fff"
  326. },
  327. itemGap: 20,
  328. },
  329. grid: {
  330. left: '0',
  331. right: '20',
  332. top: '10',
  333. bottom: '20',
  334. containLabel: true
  335. },
  336. xAxis: [{
  337. type: 'category',
  338. boundaryGap: false,
  339. axisLabel: {
  340. show: true,
  341. textStyle: {
  342. color: 'rgba(255,255,255,.6)'
  343. }
  344. },
  345. axisLine: {
  346. lineStyle: {
  347. color: 'rgba(255,255,255,.1)'
  348. }
  349. },
  350. data: dates
  351. }, {
  352. }],
  353. yAxis: [{
  354. axisLabel: {
  355. show: true,
  356. textStyle: {
  357. color: 'rgba(255,255,255,.6)'
  358. }
  359. },
  360. axisLine: {
  361. lineStyle: {
  362. color: 'rgba(255,255,255,.1)'
  363. }
  364. },
  365. splitLine: {
  366. lineStyle: {
  367. color: 'rgba(255,255,255,.1)'
  368. }
  369. }
  370. }],
  371. series: [{
  372. name: legends[0],
  373. type: 'line',
  374. smooth: false,
  375. lineStyle: {
  376. normal: {
  377. width: 2
  378. }
  379. },
  380. label: {
  381. normal: {
  382. show: false,
  383. position: 'bottom',
  384. color: '#fff',
  385. formatter: function (parmas) {
  386. if (parmas.data == 0)
  387. return '';
  388. return parmas.data + '%';
  389. }
  390. }
  391. },
  392. areaStyle: {
  393. normal: {
  394. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  395. offset: 0,
  396. color: 'rgba(24, 163, 64, 0.3)'
  397. }, {
  398. offset: 0.8,
  399. color: 'rgba(24, 163, 64, 0)'
  400. }], false),
  401. shadowColor: 'rgba(0, 0, 0, 0.1)',
  402. shadowBlur: 10
  403. }
  404. },
  405. itemStyle: {
  406. normal: {
  407. color: '#cdba00',
  408. borderColor: 'rgba(137,189,2,0.27)',
  409. borderWidth: 12
  410. }
  411. },
  412. symbolSize: 2,
  413. data: dbData
  414. }, {
  415. name: legends[1],
  416. type: 'line',
  417. label: {
  418. normal: {
  419. show: false,
  420. position: 'bottom',
  421. color: '#fff',
  422. formatter: function (parmas) {
  423. if (parmas.data == 0)
  424. return '';
  425. return parmas.data + '%';
  426. }
  427. }
  428. },
  429. smooth: false,
  430. symbolSize: 2,
  431. lineStyle: {
  432. normal: {
  433. width: 2
  434. }
  435. },
  436. areaStyle: {
  437. normal: {
  438. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  439. offset: 0,
  440. color: 'rgba(39, 122,206, 0.3)'
  441. }, {
  442. offset: 0.8,
  443. color: 'rgba(39, 122,206, 0)'
  444. }], false),
  445. shadowColor: 'rgba(0, 0, 0, 0.1)',
  446. shadowBlur: 10
  447. }
  448. },
  449. itemStyle: {
  450. normal: {
  451. color: '#277ace',
  452. borderColor: 'rgba(0,136,212,0.2)',
  453. borderWidth: 12
  454. }
  455. },
  456. data: wbData
  457. }]
  458. };
  459. // 使用刚指定的配置项和数据显示图表。
  460. myChart.setOption(option);
  461. console.log(option);
  462. window.addEventListener("resize", function () {
  463. myChart.resize();
  464. });
  465. }
  466. function outputZc(legends, xData, dbData, wbData) {
  467. // 基于准备好的dom,初始化echarts实例
  468. var myChart = echarts.init(document.getElementById('echart10'));
  469. option = {
  470. tooltip: {
  471. trigger: 'axis',
  472. axisPointer: {
  473. lineStyle: {
  474. color: '#57617B'
  475. }
  476. }
  477. },
  478. "legend": {
  479. "data": legends,
  480. "top": "0%",
  481. "textStyle": {
  482. "color": "rgba(255,255,255,0.9)"//图例文字
  483. }
  484. },
  485. "xAxis": [
  486. {
  487. "type": "category",
  488. data: xData,
  489. axisLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
  490. axisLabel: {
  491. textStyle: { color: "rgba(255,255,255,.6)", fontSize: '14', },
  492. },
  493. },
  494. ],
  495. "yAxis": [
  496. {
  497. "type": "value",
  498. "name": "",
  499. // "interval": 10,
  500. "axisLabel": {
  501. "show": true,
  502. },
  503. axisLine: { lineStyle: { color: 'rgba(255,255,255,.4)' } },//左线色
  504. }
  505. ],
  506. "grid": {
  507. "top": "10%",
  508. "right": "30",
  509. "bottom": "30",
  510. "left": "70",
  511. show: true
  512. },
  513. "series": [
  514. {
  515. "name": legends[0],
  516. "type": "bar",
  517. "data": dbData,
  518. "barWidth": "auto",
  519. "itemStyle": {
  520. "normal": {
  521. "color": {
  522. "type": "linear",
  523. "x": 0,
  524. "y": 0,
  525. "x2": 0,
  526. "y2": 1,
  527. "colorStops": [
  528. {
  529. "offset": 0,
  530. "color": "#609db8"
  531. },
  532. {
  533. "offset": 1,
  534. "color": "#609db8"
  535. }
  536. ],
  537. "globalCoord": false
  538. }
  539. }
  540. },
  541. label: {
  542. show: false,
  543. color: '#fff',
  544. position: 'top',
  545. formatter: function (params) {
  546. if (params.data == 0) {
  547. return '';
  548. }
  549. return params.data;
  550. }
  551. }
  552. },
  553. {
  554. "name": legends[1],
  555. "type": "bar",
  556. "data": wbData,
  557. "barWidth": "auto",
  558. "itemStyle": {
  559. "normal": {
  560. "color": {
  561. "type": "linear",
  562. "x": 0,
  563. "y": 0,
  564. "x2": 0,
  565. "y2": 1,
  566. "colorStops": [
  567. {
  568. "offset": 0,
  569. "color": "#66b8a7"
  570. },
  571. {
  572. "offset": 1,
  573. "color": "#66b8a7"
  574. }
  575. ],
  576. "globalCoord": false
  577. }
  578. }
  579. },
  580. label: {
  581. show: false,
  582. color: '#fff',
  583. position: 'top',
  584. formatter: function (params) {
  585. if (params.data == 0) {
  586. return '';
  587. }
  588. return params.data;
  589. }
  590. },
  591. "barGap": "0"
  592. }
  593. ]
  594. };
  595. // 使用刚指定的配置项和数据显示图表。
  596. myChart.setOption(option);
  597. window.addEventListener("resize", function () {
  598. myChart.resize();
  599. });
  600. }
  601. function outputCc(legends, xData, dbData, wbData) {
  602. // 基于准备好的dom,初始化echarts实例
  603. var myChart = echarts.init(document.getElementById('echart11'));
  604. option = {
  605. tooltip: {
  606. trigger: 'axis',
  607. axisPointer: {
  608. lineStyle: {
  609. color: '#57617B'
  610. }
  611. }
  612. },
  613. "legend": {
  614. "data": legends,
  615. "top": "0%",
  616. "textStyle": {
  617. "color": "rgba(255,255,255,0.9)"//图例文字
  618. }
  619. },
  620. "xAxis": [
  621. {
  622. "type": "category",
  623. data: xData,
  624. axisLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
  625. axisLabel: {
  626. textStyle: { color: "rgba(255,255,255,.6)", fontSize: '14', },
  627. },
  628. },
  629. ],
  630. "yAxis": [
  631. {
  632. "type": "value",
  633. "name": "",
  634. // "interval": 10,
  635. "axisLabel": {
  636. "show": true,
  637. },
  638. axisLine: { lineStyle: { color: 'rgba(255,255,255,.4)' } },//左线色
  639. }
  640. ],
  641. "grid": {
  642. "top": "10%",
  643. "right": "30",
  644. "bottom": "30",
  645. "left": "70",
  646. show: true
  647. },
  648. "series": [
  649. {
  650. "name": legends[0],
  651. "type": "bar",
  652. "data": dbData,
  653. "barWidth": "auto",
  654. "itemStyle": {
  655. "normal": {
  656. "color": {
  657. "type": "linear",
  658. "x": 0,
  659. "y": 0,
  660. "x2": 0,
  661. "y2": 1,
  662. "colorStops": [
  663. {
  664. "offset": 0,
  665. "color": "#609db8"
  666. },
  667. {
  668. "offset": 1,
  669. "color": "#609db8"
  670. }
  671. ],
  672. "globalCoord": false
  673. }
  674. }
  675. },
  676. label: {
  677. show: false,
  678. color: '#fff',
  679. position: 'top',
  680. }
  681. },
  682. {
  683. "name": legends[1],
  684. "type": "bar",
  685. "data": wbData,
  686. "barWidth": "auto",
  687. "itemStyle": {
  688. "normal": {
  689. "color": {
  690. "type": "linear",
  691. "x": 0,
  692. "y": 0,
  693. "x2": 0,
  694. "y2": 1,
  695. "colorStops": [
  696. {
  697. "offset": 0,
  698. "color": "#66b8a7"
  699. },
  700. {
  701. "offset": 1,
  702. "color": "#66b8a7"
  703. }
  704. ],
  705. "globalCoord": false
  706. }
  707. }
  708. },
  709. label: {
  710. show: false,
  711. color: '#fff',
  712. position: 'top',
  713. },
  714. "barGap": "0"
  715. }
  716. ]
  717. };
  718. // 使用刚指定的配置项和数据显示图表。
  719. myChart.setOption(option);
  720. window.addEventListener("resize", function () {
  721. myChart.resize();
  722. });
  723. }
  724. function outputFz(legends, xData, dbData, wbData) {
  725. // 基于准备好的dom,初始化echarts实例
  726. var myChart = echarts.init(document.getElementById('echart12'));
  727. option = {
  728. tooltip: {
  729. trigger: 'axis',
  730. axisPointer: {
  731. lineStyle: {
  732. color: '#57617B'
  733. }
  734. }
  735. },
  736. "legend": {
  737. "data": legends,
  738. "top": "0%",
  739. "textStyle": {
  740. "color": "rgba(255,255,255,0.9)"//图例文字
  741. }
  742. },
  743. "xAxis": [
  744. {
  745. "type": "category",
  746. data: xData,
  747. axisLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
  748. axisLabel: {
  749. textStyle: { color: "rgba(255,255,255,.6)", fontSize: '14', },
  750. },
  751. },
  752. ],
  753. "yAxis": [
  754. {
  755. "type": "value",
  756. "name": "",
  757. // "interval": 10,
  758. "axisLabel": {
  759. "show": true,
  760. },
  761. axisLine: { lineStyle: { color: 'rgba(255,255,255,.4)' } },//左线色
  762. }
  763. ],
  764. "grid": {
  765. "top": "10%",
  766. "right": "30",
  767. "bottom": "30",
  768. "left": "70",
  769. show: true
  770. },
  771. "series": [
  772. {
  773. "name": legends[0],
  774. "type": "bar",
  775. "data": dbData,
  776. "barWidth": "auto",
  777. "itemStyle": {
  778. "normal": {
  779. "color": {
  780. "type": "linear",
  781. "x": 0,
  782. "y": 0,
  783. "x2": 0,
  784. "y2": 1,
  785. "colorStops": [
  786. {
  787. "offset": 0,
  788. "color": "#609db8"
  789. },
  790. {
  791. "offset": 1,
  792. "color": "#609db8"
  793. }
  794. ],
  795. "globalCoord": false
  796. }
  797. }
  798. },
  799. label: {
  800. show: false,
  801. color: '#fff',
  802. position: 'top',
  803. }
  804. },
  805. {
  806. "name": legends[1],
  807. "type": "bar",
  808. "data": wbData,
  809. "barWidth": "auto",
  810. "itemStyle": {
  811. "normal": {
  812. "color": {
  813. "type": "linear",
  814. "x": 0,
  815. "y": 0,
  816. "x2": 0,
  817. "y2": 1,
  818. "colorStops": [
  819. {
  820. "offset": 0,
  821. "color": "#66b8a7"
  822. },
  823. {
  824. "offset": 1,
  825. "color": "#66b8a7"
  826. }
  827. ],
  828. "globalCoord": false
  829. }
  830. }
  831. },
  832. label: {
  833. show: false,
  834. color: '#fff',
  835. position: 'top',
  836. },
  837. "barGap": "0"
  838. }
  839. ]
  840. };
  841. // 使用刚指定的配置项和数据显示图表。
  842. myChart.setOption(option);
  843. window.addEventListener("resize", function () {
  844. myChart.resize();
  845. });
  846. }
  847. function echarts_5(legends, completedData, totalData) {
  848. // 基于准备好的dom,初始化echarts实例
  849. var myChart = echarts.init(document.getElementById('echart5'));
  850. // 颜色
  851. var lightBlue = {
  852. type: 'linear',
  853. x: 0,
  854. y: 0,
  855. x2: 0,
  856. y2: 1,
  857. colorStops: [{
  858. offset: 0,
  859. color: 'rgba(41, 121, 255, 1)'
  860. }, {
  861. offset: 1,
  862. color: 'rgba(0, 192, 255, 1)'
  863. }],
  864. globalCoord: false
  865. }
  866. var option = {
  867. tooltip: {
  868. show: false
  869. },
  870. grid: {
  871. top: '0%',
  872. left: '78',
  873. right: '14%',
  874. bottom: '0%',
  875. },
  876. xAxis: {
  877. min: 0,
  878. max: totalData[0],
  879. splitLine: {
  880. show: false
  881. },
  882. axisTick: {
  883. show: false
  884. },
  885. axisLine: {
  886. show: false
  887. },
  888. axisLabel: {
  889. show: false
  890. }
  891. },
  892. yAxis: {
  893. data: legends,
  894. //offset: 15,
  895. axisTick: {
  896. show: false
  897. },
  898. axisLine: {
  899. show: false
  900. },
  901. axisLabel: {
  902. color: 'rgba(255,255,255,.6)',
  903. fontSize: 14
  904. }
  905. },
  906. series: [{
  907. type: 'bar',
  908. label: {
  909. show: true,
  910. zlevel: 10000,
  911. position: 'right',
  912. padding: 10,
  913. color: '#49bcf7',
  914. fontSize: 14,
  915. formatter: '{c}'
  916. },
  917. itemStyle: {
  918. color: '#49bcf7'
  919. },
  920. barWidth: '15',
  921. data: completedData,
  922. z: 10
  923. }, {
  924. type: 'bar',
  925. barGap: '-100%',
  926. itemStyle: {
  927. color: '#fff',
  928. opacity: 0.1
  929. },
  930. barWidth: '15',
  931. data: totalData,
  932. z: 5
  933. }],
  934. };
  935. // 使用刚指定的配置项和数据显示图表。
  936. myChart.setOption(option);
  937. window.addEventListener("resize", function () {
  938. myChart.resize();
  939. });
  940. }
  941. function loadCurrentOutput() {
  942. $.get(prefix + 'GetCurrentOutputs', {}, function (res) {
  943. var html = '';
  944. if (res && res.length > 0) {
  945. res.forEach(element => {
  946. html += '<li><span class="col15">' + element.index + '-' + element.pName + '</span><span class="col50"><div class="skillbar clearfix dayOutputBar" data-percent="'
  947. + (element.useRatio * 100).toFixed(2) + '%">'
  948. + '<div class="skillbar-bar output-bar" style="background: #49bcf7;"></div>'
  949. + '<div class="skill-bar-percent output-bar-percent">' + element.output + '</div>'
  950. + '</div></span><span class="col20">' + element.capacity + '</span>'
  951. + '<span class="col15">' + (element.useRatio * 100).toFixed(2) + '%</span></li>';
  952. });
  953. }
  954. $('.dayOutputs').html(html);
  955. $('.dayOutputBar').each(function () {
  956. $(this).find('.output-bar').animate({
  957. width: $(this).attr('data-percent')
  958. }, 2000);
  959. });
  960. }, 'json');
  961. }
  962. // 加载保养率
  963. function loadPmRate() {
  964. $.get(prefix + 'GetPmRate', {}, function (res) {
  965. console.log(res);
  966. var html = '';
  967. res.forEach(element => {
  968. html += '<li><span class="col25">' + element.pName + '</span><span class="col50"><div class="skillbar clearfix pmBar" data-percent="' + (element.pmRate * 100).toFixed(2) + '%">'
  969. + '<div class="skillbar-bar pmBar-bar" style="background: #49bcf7;"></div>'
  970. + '<div class="skill-bar-percent pmbar-bar-percent">' + (element.pmRate * 100).toFixed(2) + '%</div>'
  971. + '</div></span><span class="col25">' + element.machineCount + '</span></li>';
  972. });
  973. $('.machinePmRate').html(html);
  974. $('.pmBar').each(function () {
  975. $(this).find('.pmBar-bar').animate({
  976. width: $(this).attr('data-percent')
  977. }, 2000);
  978. });
  979. // if (res.length > 5) {
  980. $('#machinePmRate').liMarquee({
  981. direction: 'up',/*身上滚动*/
  982. runshort: false,/*内容不足时不滚动*/
  983. scrollamount: 20/*速度*/,
  984. behavior: 'alternate'
  985. });
  986. //}
  987. }, 'json');
  988. }
  989. function loadAlarmCodePie() {
  990. var take = 5;
  991. $.get(prefix + 'GetAlarmCodePie', { take: take }, function (res) {
  992. console.log(res);
  993. var legends = [];
  994. var data = [];
  995. var total = 0;
  996. res.forEach(element => {
  997. total += element.count;
  998. });
  999. res.forEach(element => {
  1000. legends.push(element.alarmCode);
  1001. data.push({
  1002. value: Math.round(element.count / total * 100),
  1003. name: element.alarmCode
  1004. });
  1005. });
  1006. echarts_1(legends, data);
  1007. }, 'json');
  1008. }
  1009. // 加载未完成订单当前生产的工序
  1010. function loadCompletedLots() {
  1011. $.get(prefix + 'GetUnCompletedOrders', {}, function (res) {
  1012. console.log(res);
  1013. var html = '';
  1014. res.forEach(element => {
  1015. html += '<li><p><span>' + element.orderCode + '</span><span>' + element.productCode + '</span><span>' + element.proName + '</span></p></li>';
  1016. });
  1017. $('.lastestLots').html(html);
  1018. $('#lastestLots').liMarquee({
  1019. direction: 'up',/*身上滚动*/
  1020. runshort: false,/*内容不足时不滚动*/
  1021. scrollamount: 20/*速度*/,
  1022. behavior: 'alternate'
  1023. });
  1024. }, 'json');
  1025. }
  1026. // 加载保养过期机台
  1027. function loadMachineToPms() {
  1028. $.get(prefix + 'GetMachineToPMs', {}, function (res) {
  1029. console.log(res);
  1030. var html = '';
  1031. var index = 1;
  1032. res.forEach(element => {
  1033. html += '<li><p><span class="li-num">' + index++ + '</span><span class="li-pname">' + element.pName + '</span><span class="li-mac">'
  1034. + element.macCode + '</span><span class="li-duty">' + element.dutyName + '</span></p></li>'
  1035. });
  1036. $('#machineToPm').html(html);
  1037. $('.machineToPm').liMarquee({
  1038. direction: 'up',/*身上滚动*/
  1039. runshort: false,/*内容不足时不滚动*/
  1040. scrollamount: 20/*速度*/,
  1041. behavior: 'alternate'
  1042. });
  1043. }, 'json');
  1044. }
  1045. function loadGoodRate(pCode) {
  1046. $.get(prefix + 'GetProductGoodRate', { pCode: pCode }, function (res) {
  1047. console.log(res);
  1048. var legends = [];
  1049. var lastData = [];
  1050. var thisData = [];
  1051. var dates = [];
  1052. res.forEach(element => {
  1053. if (legends.indexOf(element.year.toString()) <= -1) {
  1054. legends.push(element.year.toString());
  1055. }
  1056. });
  1057. for (var i = 0; i < 12; i++) {
  1058. var currnetMonth = i + 1;
  1059. dates.push(currnetMonth);
  1060. res.forEach(element => {
  1061. if (element.year == legends[0] && element.month == currnetMonth) {
  1062. lastData.push((element.rate * 100).toFixed(2));
  1063. }
  1064. });
  1065. }
  1066. for (var j = 0; j < new Date().getMonth() + 1; j++) {
  1067. res.forEach(element => {
  1068. if (element.year == legends[1] && element.month == j + 1) {
  1069. thisData.push((element.rate * 100).toFixed(2));
  1070. }
  1071. });
  1072. }
  1073. if (pCode === '中测') {
  1074. echarts_ZC(legends, dates, lastData, thisData);
  1075. } else {
  1076. echarts_CC(legends, dates, lastData, thisData);
  1077. }
  1078. }, 'json');
  1079. }
  1080. function loadOutputs(pCode) {
  1081. $.get(prefix + 'GetOutputBar', { pCode: pCode }, function (res) {
  1082. var legends = [];
  1083. var xData = [];
  1084. var dbData = [];
  1085. var wbData = [];
  1086. xData = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
  1087. res.legend.forEach(element => {
  1088. legends.push(element);
  1089. });
  1090. res.sources.forEach(element => {
  1091. element.data.forEach(item => {
  1092. if (element.title == legends[0]) {
  1093. dbData.push(parseInt(item.value));
  1094. } else if (element.title == legends[1]) {
  1095. wbData.push(parseInt(item.value));
  1096. }
  1097. });
  1098. });
  1099. if (pCode === '中测') {
  1100. outputZc(legends, xData, dbData, wbData);
  1101. } else if (pCode === '成测') {
  1102. outputCc(legends, xData, dbData, wbData);
  1103. } else if (pCode === '封装') {
  1104. outputFz(legends, xData, dbData, wbData);
  1105. }
  1106. }, 'json');
  1107. }
  1108. function loadOS() {
  1109. var take = 5;
  1110. $.get(prefix + 'GetOS', { take: take }, function (res) {
  1111. console.log(res);
  1112. var legends = [];
  1113. var data = [];
  1114. var total = 0;
  1115. res.forEach(element => {
  1116. total += element.count;
  1117. });
  1118. var total = 0;
  1119. res.forEach(element => {
  1120. legends.push(element.alarmCode);
  1121. data.push({
  1122. value: Math.round(element.radio),
  1123. name: element.alarmCode
  1124. });
  1125. total += Math.round(element.radio);
  1126. });
  1127. if (total < 100 && total > 0) {
  1128. data.push({
  1129. value: 100 - total,
  1130. name: '其它'
  1131. });
  1132. legends.push('其它');
  1133. }
  1134. echarts_2(legends, data);
  1135. }, 'json');
  1136. }
  1137. })