123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- var listIndex = 0;
- //人员大数据统计
- function personnel() {
- $.get('/api/Project_v2/personnel_ly',{orgid:orgid},function (data) {
- if(data.status == 0){
- if(data.data.length > 0){
- var personnel = echarts.init(document.getElementById('personnel'));
- personnelOption = {
- color:['#7DACFA','#3FECFF','#114FEC'],
- 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 : 50,
- 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/convey',{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 class="table-project-name">' + list[i]['START_TITLE'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['END_TITLE'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['CREATE_TIME'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['REAL_NAME'] + '</td>';
- if (list[i]['TODO_MODE'] == 3) {
- str += '<td class="status-yes">已完成</td>';
- }else{
- str += '<td class="status-no">未完成</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/repairs',{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]['DEP_TITLE'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['CREATE_TIME'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['REAL_NAME'] + '</td>';
- if(list[i]['STATUS'] == 3){
- str += '<td class="status-yes">已完成</td>';
- }else{
- str += '<td class="status-no">未完成</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");//自动滚动
- });
- }
- }
- })
- }
- //近7天运送订单分析
- function hiddenDangerChart() {
- $.get('/api/Project_v2/conveyChart',{orgid:orgid,mode: 3},function (data) {
- if(data.status == 0){
- if(data.data.x.length > 0){
- var hiddenDanger = echarts.init(document.getElementById('hidden-danger'));
- hiddenDangerOption = {
- color:['#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/device',{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>' + (parseInt(i)+1) +'</td>';
- str += '<td class="table-project-name">' + list[i]['TITLE'] +'</td>';
- str += '<td>' + list[i]['CREATE_TIME'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['REAL_NAME'] + '</td>';
- str += '<td class="table-project-name">' + list[i]['CONTENT'] + '</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);
- }
- })
- }
- //近7天运送订单分析
- function repairTodoChart() {
- $.get('/api/Project_v2/conveyChart',{orgid:orgid,mode: 1},function (data) {
- if(data.status == 0){
- if(data.data.x.length > 0){
- var hiddenDanger = echarts.init(document.getElementById('repair-todo-order'));
- hiddenDangerOption = {
- color:['#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
- },
- ]
- };
- hiddenDanger.setOption(hiddenDangerOption);
- }
- }
- });
- }
- 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*5;
- personnel();
- duty();
- taskList();
- complaintList();
- hiddenDangerList();
- hiddenDangerChart();
- patrolTask();
- patrol(); //巡更
- repairTodoChart();
- setInterval(function(){
- personnel();
- duty();
- taskList();
- complaintList();
- hiddenDangerList();
- hiddenDangerChart();
- patrolTask();
- repairTodoChart();
- // patrol();
- }, timer);
- setInterval(function(){
- hiddenDangerList();
- patrolTask();
- }, 10000);
- function locationIiconold() {
- // 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',
- // });
- // }
- }
- var orders = [];
- var orderindex = 0;
- getNewOrders();
- setInterval(function () {
- getNewOrders();
- },60000*5);
- function getNewOrders() {
- $.get('/api/Project_v2/neworders',{orgid:orgid},function (res) {
- if(res.status == 0) {
- orders = res.data?res.data:[];
- orderindex = 0;
- }
- })
- }
- function locationIicon() {
- if(orders.length == 0){
- $('#location-icon1').hide();
- return false;
- }
- //预设随机位置
- var locations = [
- [94,322],
- [133,345],
- [177,375],
- [196,303],
- [179,415],
- [209,457],
- [245,470],
- [274,387],
- [305,459],
- [370,425],
- [323,303],
- [332,247]
- ];
- let orderinfo = orders[orderindex];
- $('#order-title').html(orderinfo.TITLE);
- if(orderinfo.DEP_NAME){
- $('#order-dep').html('科室:'+orderinfo.DEP_NAME);
- }else{
- $('#order-dep').html('');
- }
- if(orderinfo.DEP_CONTENT){
- $('#order-addr').html('地点:'+orderinfo.DEP_CONTENT);
- }else{
- $('#order-addr').html('');
- }
- orderindex++;
- if(orderindex >= orders.length){
- orderindex = 0;
- }
- let rand = getRandomInt(0,locations.length);
- let top = locations[rand][0];
- let left = locations[rand][1];
- $('#location-icon1').show().css({
- '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);
|