big_design1.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. //计划完成表的当前所选
  2. var indexnum = 0;
  3. var color=['#F35331','#2499F8','#3DF098','#33B734'];
  4. var fontColor='#FFF';
  5. //定义进度条组件和属性
  6. var y_gauge1 =null;
  7. var y_gauge2 =null;
  8. var y_gauge3 =null;
  9. var y_gauge4 =null;
  10. var m_gauge1 =null;
  11. var m_gauge2 =null;
  12. var m_gauge3 =null;
  13. var m_gauge4 =null;
  14. var d_gauge1 =null;
  15. var d_gauge2 =null;
  16. var d_gauge3 =null;
  17. var d_gauge4 =null;
  18. var option_Progress =null;
  19. //定义仪表盘组件和属性
  20. var gauge1 =null;
  21. var gauge2 =null;
  22. var gauge3 =null;
  23. var gauge4 =null;
  24. var gauge5 =null;
  25. var option_gauge =null;
  26. //生产质量堆积图组件和属性
  27. var quality_chart = null;
  28. var quality_option=null;
  29. //生产计划折线图组件和属性
  30. var plan_chart = null;
  31. var plan_option=null;
  32. //环形图的风格定义
  33. var dataStyle = {
  34. normal: {
  35. label: {show:false},
  36. labelLine: {show:false}
  37. }
  38. };
  39. var placeHolderStyle = {
  40. normal : {
  41. color: 'rgba(0,0,0,0.1)',
  42. label: {show:false},
  43. labelLine: {show:false}
  44. },
  45. emphasis : {
  46. color: 'rgba(0,0,0,0)'
  47. }
  48. };
  49. //最大订单号
  50. var lastOrderNumber=1;
  51. $(document).ready(function ()
  52. {
  53. //环形进度条设置对象
  54. option_Progress={
  55. title : {
  56. text: '目前进度',
  57. subtext: '50%',
  58. x: 'center',
  59. y: 90,
  60. itemGap: 10,
  61. textStyle : {
  62. color : '#B7E1FF',
  63. fontWeight: 'normal',
  64. fontFamily : '微软雅黑',
  65. fontSize : 24
  66. },
  67. subtextStyle:{
  68. color: '#B7E1FF',
  69. fontWeight: 'bolder',
  70. fontSize:24,
  71. fontFamily : '微软雅黑'
  72. }
  73. },
  74. series : [{
  75. type : 'pie',
  76. center : ['50%', '50%'],
  77. radius : [75,90],
  78. x: '0%',
  79. tooltip:{show:false},
  80. data : [{
  81. name:'达成率',
  82. value:79,
  83. itemStyle:{color :'rgba(0,153,255,0.8)'},
  84. hoverAnimation: false,
  85. label : {
  86. show : false,
  87. position : 'center',
  88. textStyle: {
  89. fontFamily:'微软雅黑',
  90. fontWeight: 'bolder',
  91. color:'#B7E1FF',
  92. fontSize:24
  93. }
  94. },
  95. labelLine : {
  96. show : false
  97. }
  98. },
  99. {
  100. name:'79%',
  101. value:21,
  102. itemStyle:{color: 'rgba(0,153,255,0.1)'},
  103. hoverAnimation: false,
  104. label : {
  105. show : false,
  106. position : 'center',
  107. padding:20,
  108. textStyle: {
  109. fontFamily:'微软雅黑',
  110. fontSize: 24,
  111. color:'#B7E1FF'
  112. }
  113. },
  114. labelLine : {
  115. show : false
  116. }
  117. }]
  118. },
  119. {
  120. type : 'pie',
  121. center : ['50%', '50%'],
  122. radius : [95,100],
  123. x: '0%',
  124. hoverAnimation: false,
  125. data : [{
  126. value:100,
  127. itemStyle:{color :'rgba(0,153,255,0.3)'},
  128. label : {show : false},
  129. labelLine : {show : false}
  130. }]
  131. },
  132. {
  133. type : 'pie',
  134. center : ['50%', '50%'],
  135. radius : [69,70],
  136. x: '0%',
  137. hoverAnimation: false,
  138. data : [{
  139. value:100,
  140. itemStyle:{color :'rgba(0,153,255,0.3)'},
  141. label : {show : false},
  142. labelLine : {show : false}
  143. }]
  144. }]
  145. };
  146. //年仪表盘
  147. y_gauge1 = echarts.init(document.getElementById('y_gauge1'));
  148. y_gauge2 = echarts.init(document.getElementById('y_gauge2'));
  149. y_gauge3 = echarts.init(document.getElementById('y_gauge3'));
  150. y_gauge4 = echarts.init(document.getElementById('y_gauge4'));
  151. //月仪表盘
  152. m_gauge1 = echarts.init(document.getElementById('m_gauge1'));
  153. m_gauge2 = echarts.init(document.getElementById('m_gauge2'));
  154. m_gauge3 = echarts.init(document.getElementById('m_gauge3'));
  155. m_gauge4 = echarts.init(document.getElementById('m_gauge4'));
  156. //日仪表盘
  157. d_gauge1 = echarts.init(document.getElementById('d_gauge1'));
  158. d_gauge2 = echarts.init(document.getElementById('d_gauge2'));
  159. d_gauge3 = echarts.init(document.getElementById('d_gauge3'));
  160. d_gauge4 = echarts.init(document.getElementById('d_gauge4'));
  161. //监控仪表盘
  162. option_gauge = {
  163. title: {
  164. text: '', //标题文本内容
  165. },
  166. toolbox: { //可视化的工具箱
  167. show: false,
  168. },
  169. tooltip: { //弹窗组件
  170. formatter: "{a} <br/>{b} : {c}%"
  171. },
  172. series: [{
  173. type: 'gauge',
  174. axisLine: {// 坐标轴线
  175. lineStyle: { // 属性lineStyle控制线条样式
  176. color: [
  177. [0.2, color[0]],
  178. [0.8, color[1]],
  179. [1, color[2]]
  180. ],
  181. width: 18
  182. }
  183. },
  184. splitLine: { // 分隔线
  185. show:true,
  186. length: 18,
  187. lineStyle: {
  188. color: '#28292D',
  189. width: 1
  190. }
  191. },
  192. axisTick : { //刻度线样式(及短线样式)
  193. show:false,
  194. lineStyle: {
  195. color: 'auto',
  196. width: 1
  197. },
  198. length : 20
  199. },
  200. axisLabel : {
  201. color:'#FFF',
  202. fontSize:14,
  203. fontFamily:'Verdana, Geneva, sans-serif'
  204. },
  205. title: {
  206. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  207. fontWeight: 'bolder',
  208. fontSize: 20,
  209. color: '#FFF'
  210. },
  211. offsetCenter: [0, '30%']
  212. },
  213. pointer: {
  214. width: 5,
  215. color: '#F00',
  216. shadowColor: '#FF0',
  217. shadowBlur: 10
  218. },
  219. detail: {
  220. show:false,
  221. formatter:'{value}%',
  222. textStyle:
  223. {
  224. fontFamily:'Arial',
  225. color: '#000',
  226. fontSize:'32px'
  227. },
  228. offsetCenter: [0, '90%']
  229. },
  230. data: [{value: 45, name: '水'}]
  231. }]
  232. };
  233. gauge1 = echarts.init(document.getElementById('gauge1'));
  234. gauge2 = echarts.init(document.getElementById('gauge2'));
  235. gauge3 = echarts.init(document.getElementById('gauge3'));
  236. gauge4 = echarts.init(document.getElementById('gauge4'));
  237. gauge5 = echarts.init(document.getElementById('gauge5'));
  238. option_gauge.series[0].axisLine.lineStyle.color=[[0.2, color[0]],[0.8, color[1]],[1, color[2]]];
  239. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  240. option_gauge.series[0].data[0].name ="水";
  241. $('#vg1').html(option_gauge.series[0].data[0].value);
  242. gauge1.setOption(option_gauge);
  243. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  244. option_gauge.series[0].data[0].name ="电";
  245. $('#vg2').html(option_gauge.series[0].data[0].value);
  246. gauge2.setOption(option_gauge);
  247. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  248. option_gauge.series[0].data[0].name ="天然气";
  249. $('#vg3').html(option_gauge.series[0].data[0].value);
  250. gauge3.setOption(option_gauge);
  251. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  252. option_gauge.series[0].data[0].name ="压缩空气";
  253. $('#vg4').html(option_gauge.series[0].data[0].value);
  254. gauge4.setOption(option_gauge);
  255. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  256. option_gauge.series[0].data[0].name ="蒸汽";
  257. $('#vg5').html(option_gauge.series[0].data[0].value);
  258. gauge5.setOption(option_gauge);
  259. //生产质量堆积图
  260. quality_chart = echarts.init(document.getElementById('quality'));
  261. quality_option={
  262. title: {
  263. show:false,
  264. text: 'AUDIT',
  265. left: 'center',
  266. textStyle: {
  267. color: '#F00',
  268. fontSize:32
  269. }
  270. },
  271. xAxis: {
  272. data: ['1月10日','2月10日','3月10日','4月10日','5月10日','6月10日'],
  273. axisLabel: {
  274. textStyle: {
  275. color: '#B7E1FF',
  276. fontSize:24
  277. }
  278. },
  279. axisLine:{
  280. lineStyle:{
  281. color:'#09F'
  282. }
  283. },
  284. axisTick:{
  285. lineStyle:{
  286. color:'#09F'
  287. }
  288. }
  289. },
  290. yAxis: {
  291. inverse: false,
  292. splitArea: {show: false},
  293. axisLine: {show: false},
  294. axisTick: {show: false},
  295. axisLabel: {
  296. textStyle: {
  297. color: '#B7E1FF',
  298. fontSize:24,
  299. fontFamily:'Arial',
  300. }
  301. },
  302. splitLine :{
  303. lineStyle:{
  304. color:'#09F'
  305. }
  306. }
  307. },
  308. grid: {
  309. left: 100
  310. },
  311. tooltip: {
  312. trigger: 'item',
  313. textStyle: {
  314. color: '#B7E1FF',
  315. fontSize:24
  316. }
  317. },
  318. legend:{
  319. show:false,
  320. top: 'bottom',
  321. textStyle: {
  322. color: '#F00',
  323. fontSize:24,
  324. fontFamily:'微软雅黑'
  325. },
  326. data:['AUDIT分数1','AUDIT分数']
  327. },
  328. series: [
  329. {
  330. name: 'AUDIT分数1',
  331. type: 'bar',
  332. stack: 'one',
  333. itemStyle:
  334. {
  335. normal: {color: color[1]}
  336. },
  337. barWidth : 60,
  338. data:[2200,2900,3680,2200,2900,3680]
  339. },
  340. {
  341. name: 'AUDIT分数',
  342. type: 'bar',
  343. stack: 'one',
  344. itemStyle: {
  345. normal: {
  346. color: '#F90',
  347. label: {
  348. show: true,
  349. position: 'insideTop',
  350. textStyle: {
  351. color: '#000',
  352. fontSize:24
  353. }
  354. }
  355. }
  356. },
  357. barWidth : 50,
  358. data: [1800,1100,320,1800,1100,320]
  359. }
  360. ]
  361. };
  362. quality_chart.setOption(quality_option);
  363. //生产计划折线图
  364. var plan_data1=[];
  365. var plan_data2=[];
  366. var plan_xAxis=[];
  367. for (var i = 1; i <= 7; i++) {
  368. plan_xAxis.push("3月"+i+"日");
  369. plan_data1.push(Math.round(Math.random() * 100));
  370. plan_data2.push(Math.round(Math.random() * 100));
  371. }
  372. plan_chart = echarts.init(document.getElementById('plan'));
  373. plan_option={
  374. xAxis: {
  375. data:plan_xAxis,
  376. axisLabel: {
  377. textStyle: {
  378. color: '#B7E1FF',
  379. fontSize:24
  380. }
  381. },
  382. axisLine:{
  383. lineStyle:{
  384. color:'#09F'
  385. }
  386. },
  387. axisTick:{
  388. lineStyle:{
  389. color:'#09F'
  390. }
  391. }
  392. },
  393. yAxis: {
  394. inverse: false,
  395. splitArea: {show: false},
  396. axisLine: {show: false},
  397. axisTick: {show: false},
  398. axisLabel: {
  399. textStyle: {
  400. color: '#B7E1FF',
  401. fontSize:24,
  402. fontFamily:'Arial',
  403. }
  404. },
  405. splitLine :{
  406. lineStyle:{
  407. color:'#09F'
  408. }
  409. }
  410. },
  411. tooltip: {
  412. trigger: 'axis',
  413. textStyle: {
  414. color: '#FFF',
  415. fontSize:24
  416. }
  417. },
  418. grid: {
  419. left: 100
  420. },
  421. legend:{
  422. show:false,
  423. top: 'bottom',
  424. textStyle: {
  425. color: '#F00',
  426. fontSize:24
  427. },
  428. data:['计划完成数','实际完成数']
  429. },
  430. series: [
  431. {
  432. name: '计划完成数',
  433. type: 'bar',
  434. itemStyle:
  435. {
  436. normal: {color: color[1]},
  437. emphasis: {color: color[2]}
  438. },
  439. barWidth : 40,
  440. data:plan_data1
  441. },
  442. {
  443. name: '实际完成数',
  444. type: 'line',
  445. itemStyle: {
  446. normal: {
  447. color: '#F90',
  448. label: {
  449. show: true,
  450. position: 'top',
  451. textStyle: {
  452. color: '#CCC',
  453. fontSize:24
  454. }
  455. },
  456. lineStyle:{
  457. color:'#F90',
  458. width:4
  459. }
  460. },
  461. emphasis: {
  462. color: '#FF0'
  463. }
  464. },
  465. symbolSize: 24,
  466. data: plan_data2
  467. }
  468. ]
  469. };
  470. plan_chart.setOption(plan_option);
  471. //轮番显示tips
  472. function clock(){
  473. showToolTip_highlight(plan_chart);
  474. }
  475. setInterval(clock, 5000);
  476. //地图开始
  477. var map_chart = echarts.init(document.getElementById('map'));
  478. var CCData = [
  479. [{name:'长春'}, {name:'上海',value:95}],
  480. [{name:'长春'}, {name:'广州',value:90}],
  481. [{name:'长春'}, {name:'大连',value:80}],
  482. [{name:'长春'}, {name:'南宁',value:70}],
  483. [{name:'长春'}, {name:'南昌',value:60}],
  484. [{name:'长春'}, {name:'拉萨',value:50}],
  485. [{name:'长春'}, {name:'长春',value:40}],
  486. [{name:'长春'}, {name:'包头',value:30}],
  487. [{name:'长春'}, {name:'重庆',value:20}],
  488. [{name:'长春'}, {name:'北京',value:10}]
  489. ];
  490. var series = [];
  491. [['长春', CCData]].forEach(function (item, i) {
  492. series.push({
  493. name: '一汽汽车销售',
  494. type: 'lines',
  495. zlevel: 1,
  496. effect: {
  497. show: true,
  498. period: 6,
  499. trailLength: 0.7,
  500. color: '#FF0',
  501. symbolSize: 3
  502. },
  503. lineStyle: {
  504. normal: {
  505. color: '#000',
  506. width: 0,
  507. curveness: 0.2
  508. }
  509. },
  510. data: convertData(item[1])
  511. },
  512. {
  513. name: '一汽汽车销售',
  514. type: 'lines',
  515. zlevel: 2,
  516. symbol: ['none', 'arrow'],
  517. symbolSize: 10,
  518. lineStyle: {
  519. normal: {
  520. color: '#FF0',
  521. width: 1,
  522. opacity: 0.6,
  523. curveness: 0.2
  524. }
  525. },
  526. data: convertData(item[1])
  527. },
  528. {
  529. name: '一汽汽车销售',
  530. type: 'effectScatter',
  531. coordinateSystem: 'geo',
  532. zlevel: 2,
  533. rippleEffect: {
  534. brushType: 'stroke'
  535. },
  536. label: {
  537. normal: {
  538. show: true,
  539. position: 'right',
  540. formatter: '{b}'
  541. }
  542. },
  543. symbolSize: function (val) {
  544. return 15;
  545. },
  546. itemStyle: {
  547. normal: {
  548. color: '#FFF',
  549. label: {
  550. show: true,
  551. position: 'top',
  552. textStyle: {
  553. color: '#FFF',
  554. fontSize:24
  555. }
  556. }
  557. }
  558. },
  559. data: item[1].map(function (dataItem) {
  560. return {
  561. name: dataItem[1].name,
  562. value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
  563. };
  564. })
  565. });
  566. });
  567. map_option = {
  568. backgroundColor: '',
  569. title : {
  570. show:false,
  571. text: '一汽汽车销售地域分布示意图',
  572. subtext: '截至2018年05月04日',
  573. left: 'center',
  574. top:10,
  575. textStyle : {
  576. color: '#09F',
  577. fontSize:32
  578. },
  579. subtextStyle:{
  580. color: '#09F',
  581. fontSize:24
  582. }
  583. },
  584. tooltip : {
  585. trigger: 'item'
  586. },
  587. legend: {
  588. show:false,
  589. orient: 'vertical',
  590. top: 'bottom',
  591. left: 'right',
  592. data:['一汽汽车销售'],
  593. textStyle: {
  594. color: '#000'
  595. },
  596. selectedMode: 'single'
  597. },
  598. geo: {
  599. map: 'china',
  600. label: {
  601. emphasis: {
  602. show: false
  603. }
  604. },
  605. roam: true,
  606. itemStyle: {
  607. normal: {
  608. areaColor: '#09F',
  609. borderColor: '#09F',
  610. opacity:0.5
  611. },
  612. emphasis: {
  613. areaColor: '#09F',
  614. borderColor: '#09F',
  615. opacity:0.8
  616. }
  617. }
  618. },
  619. series: series
  620. };
  621. map_chart.setOption(map_option, true);
  622. resresh();
  623. //开始定时刷新
  624. setInterval(resresh, 5*1000);
  625. });
  626. var convertData = function (data) {
  627. var res = [];
  628. for (var i = 0; i < data.length; i++) {
  629. var dataItem = data[i];
  630. var fromCoord = geoCoordMap[dataItem[0].name];
  631. var toCoord = geoCoordMap[dataItem[1].name];
  632. if (fromCoord && toCoord) {
  633. res.push({
  634. fromName: dataItem[0].name,
  635. toName: dataItem[1].name,
  636. coords: [fromCoord, toCoord]
  637. });
  638. }
  639. }
  640. return res;
  641. };
  642. function showToolTip_highlight(mychart)
  643. {
  644. var echartObj = mychart;
  645. // 高亮当前图形
  646. var highlight =setInterval(function()
  647. {
  648. echartObj.dispatchAction({
  649. type: 'highlight',
  650. seriesIndex: 0,
  651. dataIndex: indexnum
  652. });
  653. echartObj.dispatchAction({
  654. type: 'showTip',
  655. seriesIndex: 0,
  656. dataIndex: indexnum
  657. });
  658. clearInterval(highlight);
  659. indexnum = indexnum + 1;
  660. if(indexnum>=7) indexnum=0;
  661. },1000);
  662. }
  663. //定时刷新数据
  664. function resresh()
  665. {
  666. var myDate = new Date();
  667. // $('#refresh').html("<img src=\"images/wait.gif\" align=\"absmiddle\"><span>数据刷新中...</span>");
  668. //年月日刷新
  669. $('#currentYear').html(myDate.getFullYear()+"年");
  670. $('#currentMonth').html(insertZero(myDate.getMonth()+1)+"月");
  671. $('#currentDay').html(insertZero(myDate.getDate())+"日");
  672. $('#currentDate').html(myDate.getFullYear()+"/"+insertZero(myDate.getMonth()+1)+"/"+insertZero(myDate.getDate()));
  673. option_gauge.series[0].axisLabel.show=true;
  674. option_gauge.series[0].axisLine.lineStyle.color=[[0.2, color[0]],[0.8, color[1]],[1, color[2]]]
  675. var maxg=Math.round(Math.random()*500)+400;
  676. var n1=Math.round(Math.random()*(maxg-100))+100;
  677. var n2=Math.round(Math.random()*(n1-50))+50;
  678. var n3=(n2/maxg*100).toFixed(2);
  679. //年进度条
  680. option_Progress.title.text ="计划生产";
  681. option_Progress.series[0].data[0].value = maxg;
  682. option_Progress.title.subtext =maxg+"台";
  683. option_Progress.series[0].data[1].value =0;
  684. y_gauge1.setOption(option_Progress);
  685. option_Progress.title.text ="已接订单";
  686. option_Progress.series[0].data[0].value = n1;
  687. option_Progress.title.subtext =n1+"台";
  688. option_Progress.series[0].data[1].value =(maxg-n1);
  689. y_gauge2.setOption(option_Progress);
  690. option_Progress.title.text ="已经完成";
  691. option_Progress.series[0].data[0].value = n2;
  692. option_Progress.title.subtext =n2+"台";
  693. option_Progress.series[0].data[1].value =(maxg-n2);
  694. y_gauge3.setOption(option_Progress);
  695. option_Progress.title.text ="计划完成率";
  696. option_Progress.series[0].data[0].value = n3;
  697. option_Progress.title.subtext =n3+"%";
  698. option_Progress.series[0].data[1].value =(100-n3);
  699. y_gauge4.setOption(option_Progress);
  700. //月进度条
  701. maxg=Math.round(Math.random()*maxg)+1;
  702. n1=Math.round(Math.random()*maxg)+1;
  703. n2=Math.round(Math.random()*n1);
  704. n3=(n2/maxg*100).toFixed(2);
  705. option_Progress.title.text ="计划生产";
  706. option_Progress.series[0].data[0].value = maxg;
  707. option_Progress.title.subtext =maxg+"台";
  708. option_Progress.series[0].data[1].value =0;
  709. m_gauge1.setOption(option_Progress);
  710. option_Progress.title.text ="已接订单";
  711. option_Progress.series[0].data[0].value = n1;
  712. option_Progress.title.subtext =n1+"台";
  713. option_Progress.series[0].data[1].value =(maxg-n1);
  714. m_gauge2.setOption(option_Progress);
  715. option_Progress.title.text ="已经完成";
  716. option_Progress.series[0].data[0].value = n2;
  717. option_Progress.title.subtext =n2+"台";
  718. option_Progress.series[0].data[1].value =(maxg-n2);
  719. m_gauge3.setOption(option_Progress);
  720. option_Progress.title.text ="计划完成率";
  721. option_Progress.series[0].data[0].value = n3;
  722. option_Progress.title.subtext =n3+"%";
  723. option_Progress.series[0].data[1].value =(100-n3);
  724. m_gauge4.setOption(option_Progress);
  725. //日进度条
  726. maxg=Math.round(Math.random()*maxg)+1;
  727. n1=Math.round(Math.random()*maxg)+1;
  728. n2=Math.round(Math.random()*n1);
  729. n3=(n2/maxg*100).toFixed(2);
  730. option_Progress.title.text ="计划生产";
  731. option_Progress.series[0].data[0].value = maxg;
  732. option_Progress.title.subtext =maxg+"台";
  733. option_Progress.series[0].data[1].value =0;
  734. d_gauge1.setOption(option_Progress);
  735. option_Progress.title.text ="已接订单";
  736. option_Progress.series[0].data[0].value = n1;
  737. option_Progress.title.subtext =n1+"台";
  738. option_Progress.series[0].data[1].value =(maxg-n1);
  739. d_gauge2.setOption(option_Progress);
  740. option_Progress.title.text ="已经完成";
  741. option_Progress.series[0].data[0].value = n2;
  742. option_Progress.title.subtext =n2+"台";
  743. option_Progress.series[0].data[1].value =(maxg-n2);
  744. d_gauge3.setOption(option_Progress);
  745. option_Progress.title.text ="计划完成率";
  746. option_Progress.series[0].data[0].value = n3;
  747. option_Progress.title.subtext =n3+"%";
  748. option_Progress.series[0].data[1].value =(100-n3);
  749. d_gauge4.setOption(option_Progress);
  750. //仪表盘刷新
  751. option_gauge.series[0].axisLine.lineStyle.color=[[0.2, color[0]],[0.8, color[1]],[1, color[0]]];
  752. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  753. option_gauge.series[0].data[0].name ="水";
  754. $('#vg1').html(option_gauge.series[0].data[0].value);
  755. gauge1.setOption(option_gauge);
  756. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  757. option_gauge.series[0].data[0].name ="电";
  758. $('#vg2').html(option_gauge.series[0].data[0].value);
  759. gauge2.setOption(option_gauge);
  760. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  761. option_gauge.series[0].data[0].name ="天然气";
  762. $('#vg3').html(option_gauge.series[0].data[0].value);
  763. gauge3.setOption(option_gauge);
  764. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  765. option_gauge.series[0].data[0].name ="压缩空气";
  766. $('#vg4').html(option_gauge.series[0].data[0].value);
  767. gauge4.setOption(option_gauge);
  768. option_gauge.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
  769. option_gauge.series[0].data[0].name ="蒸汽";
  770. $('#vg5').html(option_gauge.series[0].data[0].value);
  771. gauge5.setOption(option_gauge);
  772. //显示最后更新时间
  773. $('#refresh').html("<span id=\"refreshTime\">最后刷新时间:"+myDate.toLocaleDateString()+" "+myDate.toLocaleTimeString()+"</span>");
  774. }
  775. //生成订单号
  776. function getOrderNumber(n)
  777. {
  778. var no="000000"+n.toString();
  779. return no.substring(no.length-6);
  780. }
  781. //前面补0
  782. function insertZero(n)
  783. {
  784. var no="000000"+n.toString();
  785. return no.substring(no.length-2);
  786. }