index.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. //人员大数据统计
  2. function user() {
  3. $.get('/api/Project/user',{orgid:orgid},function (data) {
  4. if(data.status == 0){
  5. if(data.data.length > 0){
  6. // 保洁
  7. var cleaning = echarts.init(document.getElementById('cleaning'));
  8. cleaningOption = {
  9. color: ['#2b5e8e', '#40edfe'],
  10. title: {
  11. text: '保洁人员',
  12. textStyle: {
  13. color: '#fff',
  14. fontSize: 14,
  15. },
  16. y: 'center',
  17. x: 'right',
  18. },
  19. series: [{
  20. name: '保洁人员',
  21. type: 'pie',
  22. radius: ['70%', '80%'],
  23. avoidLabelOverlap: false,
  24. label: {
  25. normal: {
  26. show: false,
  27. position: 'center',
  28. textStyle: {
  29. fontSize: 14,
  30. color: '#eac304',
  31. },
  32. formatter: '{c}%'
  33. }
  34. },
  35. labelLine: {
  36. normal: {
  37. show: false
  38. }
  39. },
  40. data: [
  41. {
  42. value: 100 - data.data[2]['percent'],
  43. color: '#40edfe',
  44. label: {
  45. normal: {
  46. show: false
  47. }
  48. }
  49. },
  50. {
  51. value: data.data[2]['percent'],
  52. color: '#2b5e8e',
  53. label: {
  54. normal: {
  55. show: true,
  56. position: 'center',
  57. textStyle: {
  58. fontSize: 14,
  59. color: '#eac304',
  60. },
  61. formatter: '{c}%'
  62. }
  63. }
  64. }
  65. ]
  66. }]
  67. };
  68. cleaning.setOption(cleaningOption);
  69. // 保安
  70. var security = echarts.init(document.getElementById('security'));
  71. securityOption = {
  72. color: ['#2b5e8e', '#40edfe'],
  73. title: {
  74. text: '保安人员',
  75. textStyle: {
  76. color: '#fff',
  77. fontSize: 14,
  78. },
  79. y: 'center',
  80. x: 'right',
  81. },
  82. series: [{
  83. name: '保安人员',
  84. type: 'pie',
  85. radius: ['70%', '80%'],
  86. avoidLabelOverlap: false,
  87. label: {
  88. normal: {
  89. show: true,
  90. position: 'center',
  91. textStyle: {
  92. fontSize: 14,
  93. color: '#eac304',
  94. },
  95. formatter: '{c}%'
  96. }
  97. },
  98. labelLine: {
  99. normal: {
  100. show: false
  101. }
  102. },
  103. data: [{
  104. value: 100 - data.data[3]['percent'],
  105. color: '#40edfe',
  106. label: {
  107. normal: {
  108. show: false
  109. }
  110. }
  111. }, {
  112. value: data.data[3]['percent'],
  113. color: '#2b5e8e',
  114. label: {
  115. normal: {
  116. show: true,
  117. position: 'center',
  118. textStyle: {
  119. fontSize: 14,
  120. color: '#eac304',
  121. },
  122. formatter: '{c}%'
  123. }
  124. }
  125. },
  126. ]
  127. }]
  128. };
  129. security.setOption(securityOption);
  130. // 维修
  131. var repair = echarts.init(document.getElementById('repair'));
  132. repairOption = {
  133. color: ['#2b5e8e', '#40edfe'],
  134. title: {
  135. text: '维修人员',
  136. textStyle: {
  137. color: '#fff',
  138. fontSize: 14,
  139. },
  140. y: 'center',
  141. x: 'right',
  142. },
  143. series: [{
  144. name: '维修人员',
  145. type: 'pie',
  146. radius: ['70%', '80%'],
  147. avoidLabelOverlap: false,
  148. label: {
  149. normal: {
  150. show: true,
  151. position: 'center',
  152. textStyle: {
  153. fontSize: 14,
  154. color: '#eac304',
  155. },
  156. formatter: '{c}%'
  157. }
  158. },
  159. labelLine: {
  160. normal: {
  161. show: false
  162. }
  163. },
  164. data: [{
  165. value: 100 - data.data[1]['percent'],
  166. color: '#40edfe',
  167. label: {
  168. normal: {
  169. show: false
  170. }
  171. }
  172. }, {
  173. value: data.data[1]['percent'],
  174. color: '#2b5e8e',
  175. label: {
  176. normal: {
  177. show: true,
  178. position: 'center',
  179. textStyle: {
  180. fontSize: 14,
  181. color: '#eac304',
  182. },
  183. formatter: '{c}%'
  184. }
  185. }
  186. },
  187. ]
  188. }]
  189. };
  190. repair.setOption(repairOption);
  191. // 运送
  192. var transport = echarts.init(document.getElementById('transport'));
  193. transportOption = {
  194. color: ['#2b5e8e', '#40edfe'],
  195. title: {
  196. text: '运送人员',
  197. textStyle: {
  198. color: '#fff',
  199. fontSize: 14,
  200. },
  201. y: 'center',
  202. x: 'right',
  203. },
  204. series: [{
  205. name: '运送人员',
  206. type: 'pie',
  207. radius: ['70%', '80%'],
  208. avoidLabelOverlap: false,
  209. label: {
  210. normal: {
  211. show: true,
  212. position: 'center',
  213. textStyle: {
  214. fontSize: 14,
  215. color: '#eac304',
  216. },
  217. formatter: '{c}%'
  218. }
  219. },
  220. labelLine: {
  221. normal: {
  222. show: false
  223. }
  224. },
  225. data: [{
  226. value: 100 - data.data[0]['percent'],
  227. color: '#40edfe',
  228. label: {
  229. normal: {
  230. show: false
  231. }
  232. }
  233. }, {
  234. value: data.data[0]['percent'],
  235. color: '#2b5e8e',
  236. label: {
  237. normal: {
  238. show: true,
  239. position: 'center',
  240. textStyle: {
  241. fontSize: 14,
  242. color: '#eac304',
  243. },
  244. formatter: '{c}%'
  245. }
  246. }
  247. },
  248. ]
  249. }]
  250. };
  251. transport.setOption(transportOption);
  252. }
  253. }
  254. });
  255. }
  256. // 人员统计玫瑰图
  257. function personnel() {
  258. $.get('/api/Project/personnel',{orgid:orgid},function (data) {
  259. if(data.status == 0){
  260. if(data.data.length > 0){
  261. var personnel = echarts.init(document.getElementById('personnel'));
  262. personnelOption = {
  263. color:['#fdd100','#ec5400','#40ebff','#ff4874'],
  264. tooltip : {
  265. trigger: 'item',
  266. formatter: "{a} <br/>{b} : {c} ({d}%)"
  267. },
  268. legend: {
  269. x : 'left',
  270. y : 'center',
  271. left: 50,
  272. textStyle: {
  273. color: '#fff',
  274. fontSize: 12,
  275. },
  276. orient: 'vertical',
  277. data:['保洁','保安','维修','运送']
  278. },
  279. calculable : true,
  280. series : [
  281. {
  282. name:'人员大数据统计',
  283. type:'pie',
  284. radius : [20, 70],
  285. center : ['60%', '50%'],
  286. roseType : 'radius',
  287. data:data.data,
  288. // data:[
  289. // {value:30, name:'保洁'},
  290. // {value:25, name:'保安'},
  291. // {value:20, name:'维修'},
  292. // {value:25, name:'运送'}
  293. // ],
  294. label: {
  295. formatter: '{b}{d}%',
  296. color: '#fff'
  297. }
  298. }
  299. ]
  300. };
  301. personnel.setOption(personnelOption);
  302. }
  303. }
  304. });
  305. }
  306. // 工单统计
  307. function todo(type) {
  308. $.get('/api/Project/todo',{orgid:orgid, type: type},function (data) {
  309. if(data.status == 0){
  310. if(data.data.list.length > 0){
  311. var ordersChart = echarts.init(document.getElementById("orders"));
  312. ordersOption = null;
  313. ordersOption = {
  314. color:'#00c6ff',
  315. tooltip: {},
  316. dataset: {
  317. dimensions: ['day', '工单量'],
  318. source: data.data.list,
  319. },
  320. xAxis: {
  321. type: 'category',
  322. axisLabel: {
  323. color:'#fff',
  324. }
  325. },
  326. yAxis: {
  327. axisLabel: {
  328. color:'#fff',
  329. }
  330. },
  331. series: [
  332. {
  333. type: 'bar',
  334. barMaxWidth:'30',
  335. label: {
  336. normal: {
  337. show: true,
  338. position: 'top',
  339. color: '#fff'
  340. }
  341. },
  342. }
  343. ]
  344. };
  345. if (ordersOption && typeof ordersOption === "object") {
  346. ordersChart.setOption(ordersOption, true);
  347. }
  348. $('.todo').removeClass('active');
  349. $('#todo'+type).addClass('active');
  350. }
  351. }
  352. });
  353. }
  354. //投诉大数据
  355. function complaintList() {
  356. $.get('/api/Project/complaint',{orgid:orgid},function (res) {
  357. if(res.status == 0) {
  358. let list = res.data.data;
  359. if (list.length > 0) {
  360. var str = '';
  361. for (var i in list){
  362. str += '<tr>';
  363. str += '<td class="table-project-name">' + list[i]['CONTENT'] + '</td>';
  364. str += '<td>' + list[i]['CREATTE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + '</td>';
  365. // str += '<td>' + list[i]['REAL_NAME'].replace(/(?<=.)./g, '*') + '</td>';
  366. str += '</tr>';
  367. }
  368. $('#complaintList').html(str);
  369. }
  370. }
  371. })
  372. }
  373. // 投诉图表
  374. function complaintChart() {
  375. $.get('/api/Project/complaintChart',{orgid: orgid},function (data) {
  376. if(data.status == 0){
  377. if(data.data.x.length > 0){
  378. var complaint = echarts.init(document.getElementById('complaint'));
  379. complaintOption = null;
  380. complaintOption = {
  381. color:'#2ca2fc',
  382. tooltip: {
  383. trigger: 'axis',
  384. axisPointer: {
  385. type: 'shadow'
  386. }
  387. },
  388. grid: {
  389. top: '3%',
  390. left: '3%',
  391. right: '4%',
  392. bottom: '0',
  393. // minHeight: 200,
  394. containLabel: true
  395. },
  396. xAxis: {
  397. type: 'value',
  398. boundaryGap: [0, 0.01],
  399. axisLabel: {
  400. color:'#fff',
  401. }
  402. },
  403. yAxis: {
  404. type: 'category',
  405. data: data.data.y,
  406. axisLabel: {
  407. color:'#fff',
  408. }
  409. },
  410. series: [
  411. {
  412. name: '投诉量',
  413. type: 'bar',
  414. barMaxWidth: 30,
  415. label: {
  416. normal: {
  417. show: true,
  418. position: 'right',
  419. color: '#fff'
  420. }
  421. },
  422. data: data.data.x
  423. }
  424. ]
  425. };
  426. complaint.setOption(complaintOption);
  427. }
  428. }
  429. });
  430. }
  431. //任务大数据监控
  432. function taskList() {
  433. $.get('/api/Project/task',{orgid:orgid},function (res) {
  434. if(res.status == 0) {
  435. let list = res.data.data;
  436. if (list.length > 0) {
  437. var str = '';
  438. for (var i in list){
  439. str += '<tr>';
  440. str += '<td class="table-project-name">' + list[i]['TITLE'] + list[i]['NAME'] + '</td>';
  441. str += '<td>' + list[i]['CREATE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + '</td>';
  442. str += '<td>' + list[i]['NAME'] + '</td>';
  443. str += '</tr>';
  444. }
  445. $('#taskList').html(str);
  446. }
  447. }
  448. })
  449. }
  450. function taskChart() {
  451. $.get('/api/Project/taskChart',{orgid: orgid},function (data) {
  452. if(data.status == 0){
  453. if(data.data.x.length > 0){
  454. var task = echarts.init(document.getElementById('task'));
  455. taskOption = {
  456. color: ['#2ca2fc','#fdd100'],
  457. tooltip: {
  458. trigger: 'axis',
  459. axisPointer: {
  460. type: 'cross',
  461. crossStyle: {
  462. color: '#999'
  463. }
  464. }
  465. },
  466. grid: {
  467. top: '13%',
  468. left: '3%',
  469. right: '4%',
  470. bottom: '-2%',
  471. // minHeight: 120,
  472. containLabel: true
  473. },
  474. xAxis: [
  475. {
  476. type: 'category',
  477. data : data.data.x,
  478. axisPointer: {
  479. type: 'shadow'
  480. },
  481. axisLabel: {
  482. color:'#fff',
  483. }
  484. }
  485. ],
  486. yAxis: [
  487. {
  488. type: 'value',
  489. axisLabel: {
  490. formatter: '{value}',
  491. color:'#fff',
  492. },
  493. axisLine: {
  494. show: true,
  495. lineStyle: {
  496. color: '#ccc'
  497. }
  498. }
  499. },
  500. // {
  501. // type: 'value',
  502. // axisLabel: {
  503. // formatter: '{value} %',
  504. // color:'#fff',
  505. // },
  506. // axisLine: {
  507. // show: true,
  508. // lineStyle: {
  509. // color: '#ccc'
  510. // }
  511. // }
  512. // }
  513. ],
  514. series: [
  515. {
  516. name:'任务量',
  517. type:'bar',
  518. barWidth: 30,
  519. data: data.data.y1,
  520. label: {
  521. normal: {
  522. show: true,
  523. position: 'top',
  524. color: '#fff'
  525. }
  526. },
  527. },
  528. // {
  529. // name:'概率',
  530. // type:'line',
  531. // yAxisIndex: 1,
  532. // data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2]
  533. // }
  534. ]
  535. };
  536. task.setOption(taskOption);
  537. }
  538. }
  539. });
  540. }
  541. //安保
  542. function hiddenDangerChart() {
  543. $.get('/api/Project/hiddenDangerChart',{orgid:orgid},function (data) {
  544. if(data.status == 0){
  545. if(data.data.x.length > 0){
  546. var hiddenDanger = echarts.init(document.getElementById('hidden-danger'));
  547. hiddenDangerOption = {
  548. color:['#2ca2fc','#ffcb1d'],
  549. tooltip : {
  550. trigger: 'axis',
  551. axisPointer : {
  552. type : 'shadow'
  553. }
  554. },
  555. grid: {
  556. top: '10%',
  557. left: '3%',
  558. right: '4%',
  559. bottom: '0',
  560. containLabel: true
  561. },
  562. xAxis: {
  563. type: 'category',
  564. axisLabel:{
  565. show:true,
  566. inside:false,
  567. rotate:0,
  568. margin: 8,
  569. color:'#fff',
  570. },
  571. data: data.data.x,
  572. },
  573. yAxis: {
  574. type: 'value',
  575. axisLabel:{
  576. show:true,
  577. inside:false,
  578. rotate:0,
  579. margin: 8,
  580. color:'#fff',
  581. },
  582. // data: ['0','500','1000','1500','2000']
  583. },
  584. series: [
  585. {
  586. name: '隐患数量',
  587. type: 'bar',
  588. stack: '总量',
  589. barWidth:'30',
  590. radius: ['70%', '100%'],
  591. label: {
  592. normal: {
  593. show: true,
  594. position: 'insideRight'
  595. }
  596. },
  597. data: data.data.y1,
  598. },
  599. {
  600. name: '转工单量',
  601. type: 'bar',
  602. stack: '总量',
  603. label: {
  604. normal: {
  605. show: true,
  606. position: 'insideRight'
  607. }
  608. },
  609. data: data.data.y2,
  610. },
  611. ]
  612. };
  613. hiddenDanger.setOption(hiddenDangerOption);
  614. }
  615. }
  616. });
  617. }
  618. // 安保表单
  619. function hiddenDangerList() {
  620. $.get('/api/Project/hiddenDanger',{orgid:orgid},function (res) {
  621. if(res.status == 0) {
  622. let list = res.data.data;
  623. if (list.length > 0) {
  624. var str = '';
  625. for (var i in list){
  626. if (list[i]['CURR_ORDER_MODE'] == 9 || list[i]['CURR_ORDER_MODE'] == 11) {
  627. str += '<tr style="color: #adff2f;">';
  628. } else {
  629. str += '<tr>';
  630. }
  631. str += '<td class="table-project-name">' + list[i]['TITLE'] + list[i]['NAME'] +'</td>';
  632. str += '<td>' + list[i]['CREATTE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + '</td>';
  633. str += '<td>' + list[i]['REAL_NAME'] + '</td>';
  634. str += '</tr>';
  635. }
  636. $('#hiddenDangerList').html(str);
  637. }
  638. }
  639. })
  640. }
  641. // 巡更
  642. function patrol() {
  643. $.get('/api/Project/patrol',{orgid:orgid},function (res) {
  644. if(res.status == 0) {
  645. var list = res.data.data;
  646. if (list != '') {
  647. var str = '';
  648. str += '<tr>';
  649. str += '<td>' + list['NAME'] +'地点' + '</td>';
  650. str += '<td>' + list['TITLE'] + '</td>';
  651. str += '</tr>';
  652. str += '<tr>';
  653. str += '<td>' + list['NAME'] +'时间' + '</td>';
  654. str += '<td>' + list['CREATE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + '</td>';
  655. str += '</tr>';
  656. str += '<tr>';
  657. str += '<td>' + list['NAME'] +'人员' + '</td>';
  658. str += '<td>' + list['USER_NAME'] + '</td>';
  659. str += '</tr>';
  660. $('#patrol').html(str);
  661. $('#patrol-addr').html(list['TITLE']);
  662. $('#patrol-data-monitor').html(list['NAME']+'大数据监控');
  663. $('#patrol-data-title').html('最新'+ list['NAME']+'记录');
  664. var oImg = document.getElementById('patrol-img');
  665. var arr = list['IMAGES'];
  666. var num = 0;
  667. num++;
  668. if (num == arr.length) {
  669. num = 0;
  670. }
  671. oImg.src = arr[num];
  672. }
  673. setTimeout("patrol()", 15000);
  674. }
  675. })
  676. }
  677. var timer = 1000*60*30;
  678. todo(0);
  679. user();
  680. personnel();
  681. taskList();
  682. taskChart();
  683. complaintList();
  684. complaintChart();
  685. hiddenDangerList();
  686. hiddenDangerChart();
  687. patrol(); //巡更
  688. setInterval(function(){
  689. user();
  690. personnel();
  691. taskList();
  692. taskChart();
  693. complaintList();
  694. complaintChart();
  695. hiddenDangerList();
  696. hiddenDangerChart();
  697. }, timer);
  698. setInterval(function () {
  699. setTimeout(function(){
  700. todo(0);
  701. },5000);
  702. setTimeout(function(){
  703. todo(1);
  704. },10000);
  705. setTimeout(function(){
  706. todo(2);
  707. },15000);
  708. },15000);
  709. function locationIicon() {
  710. var id = document.getElementById("location-icon");
  711. var photo=$(".location-icon img");
  712. for(var i=0; photo.eq(i).val()==0;i++){
  713. var left = Math.floor( Math.random() * 100 + 200 );
  714. var top = Math.floor( Math.random() * 100 + 100);
  715. photo.eq(i).css({
  716. 'position': 'absolute',
  717. 'left':left +'px',
  718. 'top' :top +'px',
  719. });
  720. }
  721. }
  722. setInterval(function () {
  723. locationIicon();
  724. },5000);