123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- var listIndex = 0;
- //人员大数据统计
- function personnel() {
- $.get('/api/Project_v2/personnel',{orgid:orgid},function (data) {
- if(data.status == 0){
- if(data.data.length > 0){
- var personnel = echarts.init(document.getElementById('personnel'));
- personnelOption = {
- color:['#fdd100','#ec5400','#40ebff','#ff4874'],
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- legend: {
- x : 'left',
- y : 'center',
- left: 50,
- textStyle: {
- color: '#fff',
- fontSize: 12,
- },
- orient: 'vertical',
- data:['保洁','保安','维修','运送']
- },
- calculable : true,
- series : [
- {
- name:'人员大数据统计',
- type:'pie',
- radius : [20, 70],
- center : ['60%', '50%'],
- roseType : 'radius',
- data:data.data,
- // data:[
- // {value:30, name:'保洁'},
- // {value:25, name:'保安'},
- // {value:20, name:'维修'},
- // {value:25, name:'运送'}
- // ],
- label: {
- formatter: '{b}{d}%',
- color: '#fff'
- }
- }
- ]
- };
- personnel.setOption(personnelOption);
- }
- }
- });
- }
- function duty() {
- $.get('/api/Project_v2/duty',{orgid:orgid},function (res) {
- if(res.status == 0) {
- let list = res.data.data;
- if (list.length > 0) {
- var str = '';
- for (var i in list){
- str += '<tr>';
- str += '<td>' + list[i]['ID'] + '</td>';
- str += '<td>' + list[i]['DEP'] + '</td>';
- str += '<td>' + list[i]['NAME'] + '</td>';
- str += '<td>' + list[i]['PHONE'] + '</td>';
- str += '</tr>';
- }
- $('#duty').html(str);
- }
- }
- })
- }
- //投诉大数据
- function complaintList() {
- $.get('/api/Project_v2/complaint',{orgid:orgid},function (res) {
- if(res.status == 0) {
- let list = res.data.data;
- if (list.length > 0) {
- var str = '';
- for (var i in list){
- str += '<tr>';
- str += '<td>' + list[i]['COMPLAIN_ID'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['CONTENT'] + '</td>';
- str += '<td>' + list[i]['CREATTE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + '</td>';
- str += '</tr>';
- }
- $('#complaintList').html(str);
- }
- if (list.length > 5) {
- $(function(){
- var text=$("#complaintList:first");
- var clear;
- text.hover(function(){
- clearInterval(clear);
- },function(){
- clear=setInterval(function(){
- var field=text.find("tr:first");
- var high=field.height();
- text.animate({ marginTop:-high+"px"},600,function(){
- field.css("marginTop",0).appendTo(text);
- text.css("marginTop",0);
- })
- },2000)//滚动间隔时间
- }).trigger("mouseleave");//自动滚动
- });
- }
- }
- })
- }
- //网格化
- function taskList() {
- $.get('/api/Project_v2/task',{orgid:orgid},function (res) {
- if(res.status == 0) {
- let list = res.data.data;
- if (list.length > 0) {
- var str = '';
- for (var i in list){
- str += '<tr>';
- // str += '<td>' + list[i]['PATROL_RECORD_ID'] + '</td>';
- str += '<td data-show>' + list[i]['TITLE'] + '</td>';
- str += '<td class="table-project-name data-show">' + list[i]['REAL_NAME'] + '</td>';
- str += '<td data-show>' + list[i]['CREATE_TIME'] + '</td>';
- str += '</tr>';
- }
- $('#taskList').html(str);
- }
- if (list.length > 13) {
- $(function(){
- var text=$("#taskList:first");
- var clear;
- text.hover(function(){
- clearInterval(clear);
- },function(){
- clear=setInterval(function(){
- var field=text.find("tr:first");
- var high=field.height();
- text.animate({ marginTop:-high+"px"},600,function(){
- field.css("marginTop",0).appendTo(text);
- text.css("marginTop",0);
- })
- },5000)//滚动间隔时间
- }).trigger("mouseleave");//自动滚动
- });
- }
- }
- })
- }
- //安保
- function hiddenDangerChart() {
- $.get('/api/Project_v2/hiddenDangerChart',{orgid:orgid},function (data) {
- if(data.status == 0){
- if(data.data.x.length > 0){
- var hiddenDanger = echarts.init(document.getElementById('hidden-danger'));
- hiddenDangerOption = {
- color:['#04F4CD','#429AEC'],
- tooltip : {
- trigger: 'axis',
- axisPointer : {
- type : 'shadow'
- }
- },
- grid: {
- top: '30%',
- left: '6%',
- right: '6%',
- bottom: '2%',
- containLabel: true
- },
- legend: {
- icon:"circle",
- data:['隐患数量','转工单量'],
- textStyle: {
- color: '#fff',
- fontSize: 12,
- }
- },
- xAxis: {
- axisLine: {
- lineStyle: {
- color: '#fff',
- width: 1,
- }
- },
- data: data.data.x,
- },
- yAxis: {
- type: 'value',
- axisLabel:{
- show:true,
- inside:false,
- rotate:0,
- margin: 8,
- color:'#fff',
- },
- },
- series: [
- {
- name:'隐患数量',
- type:'bar',
- label: {
- normal: {
- show: true,
- position: 'top',
- color: '#fff'
- }
- },
- data: data.data.y1
- },
- {
- name:'转工单量',
- type:'bar',
- label: {
- normal: {
- show: true,
- position: 'top',
- color: '#fff'
- }
- },
- data: data.data.y2
- }
- ]
- };
- hiddenDanger.setOption(hiddenDangerOption);
- }
- }
- });
- }
- // 安保表单
- function hiddenDangerList() {
- $.get('/api/Project_v2/hiddenDanger',{orgid:orgid},function (res) {
- if(res.status == 0) {
- let list = [];
- let hiddenlist = res.data.data;
- if (hiddenlist.length < 5) {
- list = hiddenlist;
- } else {
- for (var i=0;i<5;i++){
- if(listIndex >= hiddenlist.length){
- listIndex = 0;
- }
- list.push(hiddenlist[listIndex]);
- listIndex++;
- }
- }
- if (list.length > 0) {
- var str = '';
- var status = '';
- for (var i in list){
- str += '<tr>';
- str += '<td>' + list[i]['ORDER_ID'] +'</td>';
- str += '<td class="table-project-name">' + list[i]['TITLE'] + list[i]['NAME'] +'</td>';
- str += '<td>' + list[i]['CREATTE_TIME'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['REAL_NAME'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['CONTENT'] + '</td>';
- if (list[i]['CURR_ORDER_MODE'] == 9 || list[i]['CURR_ORDER_MODE'] == 11) {
- status = '已完成';
- str += '<td class="status-yes">' + status + '</td>';
- } else {
- status = '未完成';
- str += '<td class="status-no">' + status + '</td>';
- }
- str += '</tr>';
- }
- }
- $('#hiddenDangerList').html(str);
- list.shift();
- if(listIndex >= hiddenlist.length){
- listIndex = 0;
- }
- list.push(hiddenlist[listIndex]);
- listIndex++;
- }
- })
- }
- // patrol-task
- function patrolTask() {
- $.get('/api/Orders/patrol',{org_id:orgid},function (res) {
- if(res.status === 0) {
- let list = [];
- let tasklist = res.data.data;
- if (tasklist.length < 5) {
- list = tasklist;
- } else {
- for (var i=0;i<5;i++){
- if(listIndex >= tasklist.length){
- listIndex = 0;
- }
- list.push(tasklist[listIndex]);
- listIndex++;
- }
- }
- if(list.length > 0){
- var str = '';
- var status = '';
- for (i in list){
- str += '<tr>';
- str += '<td>'+list[i]['PATROL_TASK_ID']+'</td>';
- // str += '<td>'+list[i]['TITLE']+'</td>';
- str += '<td>'+list[i]['NAME']+'</td>';
- str += '<td class="table-project-name">'+list[i]['USERS']+'</td>';
- str += '<td>'+list[i]['START_TIME']+'</td>';
- str += '<td>'+list[i]['END_TIME']+'</td>';
- if (list[i]['STATUS'] == 2) {
- status = '已完成';
- str += '<td class="status-yes">' + status + '</td>';
- } else if (list[i]['STATUS'] == 3) {
- status = '未完成';
- str += '<td class="status-no">' + status + '</td>';
- } else if (list[i]['STATUS'] == 1) {
- status = '执行中';
- str += '<td style="color: #FDD100;">' + status + '</td>';
- } else {
- status = '未执行';
- str += '<td>' + status + '</td>';
- }
- str += '</tr>';
- }
- }
- $('#patrol-task').html(str);
- list.shift();
- if(listIndex >= tasklist.length){
- listIndex = 0;
- }
- list.push(tasklist[listIndex]);
- listIndex++;
- }
- })
- }
- // 巡更
- function patrol() {
- $.get('/api/Project_v2/patrol',{orgid:orgid},function (res) {
- if(res.status == 0) {
- var list = res.data.data;
- if (list != '') {
- var str = '';
- str += '<tr>';
- str += '<td>' + list['NAME'] +'地点' + '</td>';
- str += '<td>' + list['TITLE'] + '</td>';
- str += '</tr>';
- str += '<tr>';
- str += '<td>' + list['NAME'] +'时间' + '</td>';
- str += '<td>' + list['CREATE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + '</td>';
- str += '</tr>';
- str += '<tr>';
- str += '<td>' + list['NAME'] +'人员' + '</td>';
- str += '<td>' + list['USER_NAME'] + '</td>';
- str += '</tr>';
- str += '<tr>';
- str += '<td>' + list['NAME'] +'内容' + '</td>';
- str += '<td>' + list['TASK_NAME'] + '</td>';
- str += '</tr>';
- $('#patrol').html(str);
- $('#patrol-addr').html(list['TITLE']);
- $('#patrol-report').html('汇报内容:' + list['CONTENT']);
- var oImg = document.getElementById('patrol-img');
- var arr = list['IMAGES'];
- var num = 0;
- num++;
- if (num == arr.length) {
- num = 0;
- }
- oImg.src = arr[num];
- }
- setTimeout("patrol()", 15000);
- }
- })
- }
- function chunk(arr, size) {
- var arrs=[];
- for(var i=0; i<arr.length; i=i+size) {
- arrs.push(arr.slice(i,i+size));
- }
- return arrs;
- }
- var timer = 1000*60*15;
- personnel();
- duty();
- taskList();
- complaintList();
- hiddenDangerList();
- hiddenDangerChart();
- patrolTask();
- patrol(); //巡更
- setInterval(function(){
- personnel();
- duty();
- taskList();
- complaintList();
- hiddenDangerList();
- hiddenDangerChart();
- patrolTask();
- // patrol();
- }, timer);
- setInterval(function(){
- hiddenDangerList();
- patrolTask();
- }, 10000);
- function locationIicon() {
- var id = document.getElementById("location-icon");
- var photo=$(".location-icon img");
- var imgs = [
- '/public/data/img/bannertips/1.png',
- '/public/data/img/bannertips/2.png',
- '/public/data/img/bannertips/3.png',
- '/public/data/img/bannertips/4.png',
- '/public/data/img/bannertips/5.png',
- '/public/data/img/bannertips/6.png',
- '/public/data/img/bannertips/7.png',
- '/public/data/img/bannertips/8.png',
- ];
- for(var i=0; photo.eq(i).val()==0;i++){
- // var left = Math.floor( Math.random() * 100 + 200 );
- // var top = Math.floor( Math.random() * 100 + 80);
- var left = getRandomInt(100, 350);
- var top = getRandomInt(30, 180);
- let index = left%8;
- photo.attr('src',imgs[index]);
- photo.eq(i).css({
- 'position': 'absolute',
- 'left':left +'px',
- 'top' :top +'px',
- });
- }
- }
- function getRandomInt(min, max) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min)) + min; //不含最大值,含最小值
- }
- setInterval(function () {
- locationIicon();
- },5000);
|