region.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. var minleader = 0; //紧急联系人
  2. var maxleader = 3;
  3. var minprogram = 0; //项目
  4. var maxprogram = 7;
  5. var userpage = 1; //人员数据分析
  6. var yinhuanpage = 1 //河南省隐患数据详细统计
  7. var preventionpage = 1; //河南省防患预警数据和投诉数据
  8. var assignmentspage = 1; //河南省各项目任务总量统计
  9. var orderspage = 1; //各项目订单近一周总量数据分析
  10. var patrolpage = 1; //各项目巡查近一周数据统计
  11. var yuangongxuexi = []; //各项目员工学习近一周完成百分比
  12. var yuangongxuexiindex = 0;
  13. //初始化
  14. for (var i=0;i<5;i++){
  15. if(yuangongxuexiindex >= olist.length){
  16. yuangongxuexiindex = 0;
  17. }
  18. yuangongxuexi.push(olist[yuangongxuexiindex]);
  19. yuangongxuexiindex++;
  20. }
  21. // 设备维护
  22. var deviceChart = echarts.init(document.getElementById("device"));
  23. deviceOption = null;
  24. deviceOption = {
  25. color: ['#3398DB'],
  26. legend: {
  27. data:['维护次数'],
  28. textStyle: { color: "#FFFDFE" },
  29. top: 10
  30. // icon: "circle",
  31. },
  32. tooltip : {
  33. trigger: 'axis',
  34. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  35. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  36. }
  37. },
  38. grid: {
  39. left: '3%',
  40. right: '4%',
  41. bottom: '3%',
  42. containLabel: true
  43. },
  44. xAxis : [
  45. {
  46. type : 'category',
  47. data : devicedata.x,
  48. axisTick: {
  49. alignWithLabel: true
  50. },
  51. axisLabel: {
  52. color:'#fff',
  53. },
  54. axisLine: {
  55. lineStyle: {
  56. type: 'solid',
  57. color: '#fff',
  58. }
  59. }
  60. }
  61. ],
  62. yAxis : [
  63. {
  64. type : 'value',
  65. axisLabel: {
  66. color:'#fff',
  67. },
  68. axisLine: {
  69. lineStyle: {
  70. type: 'solid',
  71. color: '#fff',
  72. }
  73. }
  74. }
  75. ],
  76. series : [
  77. {
  78. name:'维护次数',
  79. type:'bar',
  80. barWidth: 30,
  81. label: {
  82. normal: {
  83. show: true,
  84. position: 'top',
  85. color: '#fff'
  86. }
  87. },
  88. barWidth: 30,
  89. data:devicedata.y
  90. }
  91. ]
  92. };
  93. if (deviceOption && typeof deviceOption === "object") {
  94. deviceChart.setOption(deviceOption, true);
  95. }
  96. //各项目人员数据分析
  97. function user() {
  98. $.get('/api/Statics/user',{orgid:orgid,page:userpage},function (data) {
  99. if(data.status == 0){
  100. if(data.data.x.length > 0){
  101. userpage++;
  102. var personnelChart = echarts.init(document.getElementById("personnel"));
  103. personnelOption = null;
  104. personnelOption = {
  105. color: ['#3398DB'],
  106. legend: {
  107. data:['用户人数'],
  108. textStyle: { color: "#FFFDFE" },
  109. top: 10
  110. // icon: "circle",
  111. },
  112. tooltip : {
  113. trigger: 'axis',
  114. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  115. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  116. }
  117. },
  118. grid: {
  119. left: '3%',
  120. right: '4%',
  121. bottom: '3%',
  122. containLabel: true
  123. },
  124. xAxis : [
  125. {
  126. type : 'category',
  127. data : data.data.x,
  128. axisTick: {
  129. alignWithLabel: true
  130. },
  131. axisLabel: {
  132. color:'#fff',
  133. },
  134. axisLine: {
  135. lineStyle: {
  136. type: 'solid',
  137. color: '#fff',
  138. }
  139. }
  140. }
  141. ],
  142. yAxis : [
  143. {
  144. type : 'value',
  145. axisLabel: {
  146. color:'#fff',
  147. },
  148. axisLine: {
  149. lineStyle: {
  150. type: 'solid',
  151. color: '#fff',
  152. }
  153. }
  154. }
  155. ],
  156. series : [
  157. {
  158. name:'用户人数',
  159. type:'bar',
  160. barWidth: 30,
  161. label: {
  162. normal: {
  163. show: true,
  164. position: 'top',
  165. color: '#fff'
  166. }
  167. },
  168. barWidth: 30,
  169. data:data.data.y
  170. }
  171. ]
  172. };
  173. if (personnelOption && typeof personnelOption === "object") {
  174. personnelChart.setOption(personnelOption, true);
  175. }
  176. }else{
  177. userpage = 1;
  178. }
  179. }
  180. });
  181. }
  182. //河南省各项目应急联络方式
  183. function leader() {
  184. if(olist.length <= 4){
  185. var str = '';
  186. for (var i=0;i<olist.length;i++){
  187. str += '<tr>';
  188. str += '<td class="table-project-name">'+olist[i]['name']+'</td>';
  189. str += '<td>'+olist[i]['leader']+'</td>';
  190. str += '<td>'+olist[i]['leader_phone']+'</td>';
  191. str += '</tr>';
  192. }
  193. $('#leader').html(str);
  194. }else{
  195. if(maxleader < olist.length){
  196. var str = '';
  197. for (var i=minleader;i<=maxleader;i++){
  198. str += '<tr>';
  199. str += '<td class="table-project-name">'+olist[i]['name']+'</td>';
  200. str += '<td>'+olist[i]['leader']+'</td>';
  201. str += '<td>'+olist[i]['leader_phone']+'</td>';
  202. str += '</tr>';
  203. }
  204. $('#leader').html(str);
  205. minleader = minleader + 4;
  206. maxleader = maxleader + 4;
  207. }else if(maxleader >= olist.length&&minleader < olist.length){
  208. var str = '';
  209. for (var i=minleader;i<olist.length;i++){
  210. str += '<tr>';
  211. str += '<td class="table-project-name">'+olist[i]['name']+'</td>';
  212. str += '<td>'+olist[i]['leader']+'</td>';
  213. str += '<td>'+olist[i]['leader_phone']+'</td>';
  214. str += '</tr>';
  215. }
  216. $('#leader').html(str);
  217. minleader = 0;
  218. maxleader = 3;
  219. }else{
  220. minleader = 0;
  221. maxleader = 3;
  222. }
  223. }
  224. }
  225. //河南省各项目
  226. function program() {
  227. if(olist.length <= 7){
  228. var str = '';
  229. for (var i=0;i<olist.length;i++){
  230. str += '<li>';
  231. str += '<a href="#">'+olist[i]['name']+'</a>';
  232. str += '</li>';
  233. }
  234. $('#program').html(str);
  235. }else{
  236. if(maxprogram < olist.length){
  237. var str = '';
  238. for (var i=minprogram;i<=maxprogram;i++){
  239. str += '<li>';
  240. str += '<a href="#">'+olist[i]['name']+'</a>';
  241. str += '</li>';
  242. }
  243. $('#program').html(str);
  244. minprogram = minprogram + 7;
  245. maxprogram = maxprogram + 7;
  246. }else if(maxprogram >= olist.length&&minprogram < olist.length){
  247. var str = '';
  248. for (var i=minprogram;i<olist.length;i++){
  249. str += '<li>';
  250. str += '<a href="#">'+olist[i]['name']+'</a>';
  251. str += '</li>';
  252. }
  253. $('#program').html(str);
  254. minprogram = 0;
  255. maxprogram = 6;
  256. }else{
  257. minprogram = 0;
  258. maxprogram = 6;
  259. }
  260. }
  261. }
  262. //河南省隐患数据详细统计
  263. function yinhuan() {
  264. $.get('/api/Statics/yinhuan',{orgid:orgid,page:yinhuanpage},function (ret) {
  265. if(ret.status == 0){
  266. let list = ret.data.list;
  267. if(list.length > 0){
  268. yinhuanpage++;
  269. let str = '';
  270. for (var o in list){
  271. str += '<tr>';
  272. str += '<td>' + list[o]['time'] + '</td>';
  273. str += '<td class="table-project-name">'+list[o]['name']+'</td>';
  274. str += '<td>'+list[o]['ocount']+'</td>';
  275. str += '<td>'+list[o]['tcount']+'</td>';
  276. str += '</tr>';
  277. }
  278. $('#yinhuan').html(str);
  279. }else{
  280. yinhuanpage = 1;
  281. }
  282. }
  283. });
  284. }
  285. //河南省防患预警数据和投诉数据
  286. function prevention() {
  287. $.get('/api/Statics/yhts',{orgid:orgid,page:preventionpage},function (data) {
  288. if(data.status == 0){
  289. if(data.data.x.length > 0){
  290. preventionpage++;
  291. var preventionChart = echarts.init(document.getElementById("prevention"));
  292. preventionOption = null;
  293. preventionOption = {
  294. color:['#50e2cb','#137bc4','#eac304'],
  295. tooltip: {
  296. trigger: 'axis',
  297. axisPointer: {
  298. type: 'cross',
  299. crossStyle: {
  300. color: '#999'
  301. }
  302. }
  303. },
  304. legend: {
  305. data:['防患数据','投诉意见数据','已转任务比率'],
  306. textStyle: { color: "#FFFDFE" },
  307. top: 10
  308. // icon: "circle",
  309. },
  310. // grid: {
  311. // left: '3%',
  312. // right: '4%',
  313. // bottom: '-3%',
  314. // containLabel: true
  315. // },
  316. xAxis: [
  317. {
  318. type: 'category',
  319. data : data.data.x,
  320. axisPointer: {
  321. type: 'shadow'
  322. },
  323. axisLabel: {
  324. color:'#fff',
  325. }
  326. }
  327. ],
  328. yAxis: [
  329. {
  330. type: 'value',
  331. axisLabel: {
  332. formatter: '{value}',
  333. color:'#fff',
  334. },
  335. axisLine: {
  336. show: true,
  337. lineStyle: {
  338. color: '#ccc'
  339. }
  340. }
  341. },
  342. {
  343. type: 'value',
  344. axisLabel: {
  345. formatter: '{value} %',
  346. color:'#fff',
  347. },
  348. axisLine: {
  349. show: true,
  350. lineStyle: {
  351. color: '#ccc'
  352. }
  353. }
  354. }
  355. ],
  356. series: [
  357. {
  358. name:'防患数据',
  359. type:'bar',
  360. barWidth: 30,
  361. data:data.data.y2
  362. },
  363. {
  364. name:'投诉意见数据',
  365. type:'bar',
  366. barWidth: 30,
  367. data:data.data.y1
  368. },
  369. {
  370. name:'已转任务比率',
  371. type:'line',
  372. yAxisIndex: 1,
  373. data:data.data.y3
  374. }
  375. ]
  376. };
  377. if (preventionOption && typeof preventionOption === "object") {
  378. preventionChart.setOption(preventionOption, true);
  379. }
  380. }else{
  381. preventionpage = 1;
  382. }
  383. }
  384. });
  385. }
  386. //河南省各项目任务总量统计
  387. function assignments() {
  388. $.get('/api/Statics/todo',{orgid:orgid,page:assignmentspage},function (data) {
  389. if(data.status == 0){
  390. if(data.data.x.length > 0){
  391. assignmentspage++;
  392. var assignmentsChart = echarts.init(document.getElementById("assignments"));
  393. assignmentsOption = null;
  394. assignmentsOption = {
  395. // title: {
  396. // text: '各项目任务总量统计'
  397. // },
  398. color:['#50e2cb','#137bc4'],
  399. tooltip : {
  400. trigger: 'axis',
  401. axisPointer: {
  402. type: 'cross',
  403. label: {
  404. backgroundColor: '#6a7985'
  405. }
  406. }
  407. },
  408. legend: {
  409. data:['已完成','未完成'],
  410. textStyle: { color: "#FFFDFE" },
  411. top: 10
  412. },
  413. grid: {
  414. left: '3%',
  415. right: '4%',
  416. bottom: '3%',
  417. containLabel: true
  418. },
  419. xAxis : [
  420. {
  421. type : 'category',
  422. boundaryGap : false,
  423. data : data.data.x,
  424. axisLabel: {
  425. color:'#fff',
  426. }
  427. }
  428. ],
  429. yAxis : [
  430. {
  431. type : 'value',
  432. axisLabel: {
  433. color:'#fff',
  434. }
  435. }
  436. ],
  437. series : [
  438. {
  439. name:'已完成',
  440. type:'line',
  441. stack: '总量',
  442. areaStyle: {},
  443. data:data.data.y1
  444. },
  445. {
  446. name:'未完成',
  447. type:'line',
  448. stack: '总量',
  449. areaStyle: {},
  450. data:data.data.y2
  451. }
  452. ]
  453. };
  454. if (assignmentsOption && typeof assignmentsOption === "object") {
  455. assignmentsChart.setOption(assignmentsOption, true);
  456. }
  457. }else{
  458. assignmentspage = 1;
  459. }
  460. }
  461. });
  462. }
  463. //各项目订单近一周总量数据分析
  464. function orders() {
  465. $.get('/api/Statics/order',{orgid:orgid,page:orderspage},function (data) {
  466. if(data.status == 0){
  467. if(data.data.x.length > 0){
  468. orderspage++;
  469. $('#orders-name').html(data.data.name);
  470. var ordersChart = echarts.init(document.getElementById("orders"));
  471. ordersOption = null;
  472. ordersOption = {
  473. color: ['#50e2cb'],
  474. tooltip: {
  475. trigger: 'axis',
  476. axisPointer: {
  477. type: 'shadow'
  478. }
  479. },
  480. grid: {
  481. left: '3%',
  482. right: '4%',
  483. bottom: '3%',
  484. containLabel: true
  485. },
  486. xAxis: {
  487. type: 'value',
  488. boundaryGap: [0, 0.01],
  489. axisLabel: {
  490. color:'#fff',
  491. }
  492. },
  493. yAxis: {
  494. type: 'category',
  495. data: data.data.y,
  496. axisLabel: {
  497. color:'#fff',
  498. }
  499. },
  500. series: [
  501. {
  502. name: '订单量',
  503. type: 'bar',
  504. barMaxWidth: 30,
  505. label: {
  506. normal: {
  507. show: true,
  508. position: 'right',
  509. color: '#fff'
  510. }
  511. },
  512. data: data.data.x
  513. }
  514. ]
  515. };
  516. if (ordersOption && typeof ordersOption === "object") {
  517. ordersChart.setOption(ordersOption, true);
  518. }
  519. }else{
  520. orderspage = 1;
  521. }
  522. }
  523. });
  524. }
  525. //各项目巡查近一周数据统计
  526. function patrol() {
  527. $.get('/api/Statics/patrol',{orgid:orgid,page:patrolpage},function (data) {
  528. if(data.status == 0){
  529. if(data.data.ll.length > 0){
  530. patrolpage++;
  531. $('#patrol-name').html(data.data.name);
  532. var patrolChart = echarts.init(document.getElementById("patrol"));
  533. patrolOption = null;
  534. patrolOption = {
  535. color: ['#50e2cb'],
  536. legend: {
  537. data:['巡查次数'],
  538. textStyle: { color: "#FFFDFE" },
  539. top: 15
  540. // icon: "circle",
  541. },
  542. tooltip: {},
  543. dataset: {
  544. dimensions: ['day', '巡查次数'],
  545. source: data.data.ll,
  546. /*source: [
  547. {day: '6-1', '巡查次数': 43},
  548. {day: '6-2', '巡查次数': 83},
  549. {day: '6-3', '巡查次数': 86},
  550. {day: '6-4', '巡查次数': 72},
  551. {day: '6-5', '巡查次数': 99},
  552. {day: '6-6', '巡查次数': 88},
  553. {day: '6-7', '巡查次数': 110}
  554. ]*/
  555. },
  556. xAxis: {
  557. type: 'category',
  558. axisLabel: {
  559. color:'#fff',
  560. }
  561. },
  562. yAxis: {
  563. axisLabel: {
  564. color:'#fff',
  565. }
  566. },
  567. series: [
  568. {
  569. type: 'bar',
  570. barWidth: 30,
  571. label: {
  572. normal: {
  573. show: true,
  574. position: 'top',
  575. color: '#fff'
  576. }
  577. },
  578. }
  579. ]
  580. };
  581. if (patrolOption && typeof patrolOption === "object") {
  582. patrolChart.setOption(patrolOption, true);
  583. }
  584. }else{
  585. patrolpage = 1;
  586. }
  587. }
  588. });
  589. }
  590. //员工学习
  591. function learning() {
  592. $.get('/api/Statics/article',{orgid:yuangongxuexi[0].orgid},function (data) {
  593. if(data.status == 0){
  594. if(data.data.length > 0){
  595. var str = '<span class="projects">项目名称</span>';
  596. for (var o in yuangongxuexi){
  597. if(o == 0){
  598. str += '<span class="projects-title active">'+yuangongxuexi[o].name+'</span>';
  599. }else{
  600. str += '<span class="projects-title">'+yuangongxuexi[o].name+'</span>';
  601. }
  602. }
  603. $('#yuangongxuexi').html(str);
  604. var learningChart = echarts.init(document.getElementById("learning"));
  605. learningOption = null;
  606. learningOption = {
  607. color:['#50e2cb','#7dc5fa','#137bc4','#219180'],
  608. tooltip : {
  609. trigger: 'item',
  610. formatter: "{a} <br/>{b} : {c} ({d}%)"
  611. },
  612. series : [
  613. {
  614. name: '学习情况',
  615. type: 'pie',
  616. radius : '55%',
  617. center: ['50%', '50%'],
  618. data:data.data,
  619. /* data:[
  620. {value:335, name:'保洁'},
  621. {value:310, name:'保安'},
  622. {value:234, name:'维修'},
  623. {value:135, name:'运送'},
  624. ],*/
  625. itemStyle: {
  626. emphasis: {
  627. shadowBlur: 10,
  628. shadowOffsetX: 0,
  629. shadowColor: 'rgba(0, 0, 0, 0.5)'
  630. }
  631. },
  632. label: {
  633. formatter: '{b}{d}%',
  634. color: '#fff'
  635. }
  636. }
  637. ]
  638. };
  639. if (learningOption && typeof learningOption === "object") {
  640. learningChart.setOption(learningOption, true);
  641. }
  642. yuangongxuexi.shift();
  643. if(yuangongxuexiindex >= olist.length){
  644. yuangongxuexiindex = 0;
  645. }
  646. yuangongxuexi.push(olist[yuangongxuexiindex]);
  647. yuangongxuexiindex++;
  648. }
  649. }
  650. });
  651. }
  652. var time = 10000;
  653. user();
  654. leader();
  655. program();
  656. yinhuan();
  657. prevention();
  658. assignments();
  659. orders();
  660. patrol();
  661. learning();
  662. setInterval(function () {
  663. user();
  664. leader();
  665. program();
  666. yinhuan();
  667. prevention();
  668. assignments();
  669. orders();
  670. patrol();
  671. learning();
  672. },time);