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}
{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 += '
';
str += '' + list[i]['ID'] + ' | ';
str += '' + list[i]['DEP'] + ' | ';
str += '' + list[i]['NAME'] + ' | ';
str += '' + list[i]['PHONE'] + ' | ';
str += '
';
}
$('#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 += '';
str += '' + list[i]['START_TITLE'] + ' | ';
str += '' + list[i]['END_TITLE'] + ' | ';
str += '' + list[i]['CREATE_TIME'] + ' | ';
str += '' + list[i]['REAL_NAME'] + ' | ';
if (list[i]['TODO_MODE'] == 3) {
str += '已完成 | ';
}else{
str += '未完成 | ';
}
// str += '' + list[i]['CONTENT'] + ' | ';
// str += '' + list[i]['CREATTE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + ' | ';
str += '
';
}
$('#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 += '';
str += '' + list[i]['DEP_TITLE'] + ' | ';
str += '' + list[i]['CREATE_TIME'] + ' | ';
str += '' + list[i]['REAL_NAME'] + ' | ';
if(list[i]['STATUS'] == 3){
str += '已完成 | ';
}else{
str += '未完成 | ';
}
str += '
';
}
$('#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 += '';
str += '' + (parseInt(i)+1) +' | ';
str += '' + list[i]['TITLE'] +' | ';
str += '' + list[i]['CREATE_TIME'] + ' | ';
str += '' + list[i]['REAL_NAME'] + ' | ';
str += '' + list[i]['CONTENT'] + ' | ';
str += '
';
}
}
$('#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 += '';
str += ''+list[i]['PATROL_TASK_ID']+' | ';
// str += ''+list[i]['TITLE']+' | ';
str += ''+list[i]['NAME']+' | ';
str += ''+list[i]['USERS']+' | ';
str += ''+list[i]['START_TIME']+' | ';
str += ''+list[i]['END_TIME']+' | ';
if (list[i]['STATUS'] == 2) {
status = '已完成';
str += '' + status + ' | ';
} else if (list[i]['STATUS'] == 3) {
status = '未完成';
str += '' + status + ' | ';
} else if (list[i]['STATUS'] == 1) {
status = '执行中';
str += '' + status + ' | ';
} else {
status = '未执行';
str += '' + status + ' | ';
}
str += '
';
}
}
$('#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 += '';
str += '' + list['NAME'] +'地点' + ' | ';
str += '' + list['TITLE'] + ' | ';
str += '
';
str += '';
str += '' + list['NAME'] +'时间' + ' | ';
str += '' + list['CREATE_TIME'].replace(/(\d{4}).(\d{1,2}).(\d{1,2}).+/mg, '$1-$2-$3') + ' | ';
str += '
';
str += '';
str += '' + list['NAME'] +'人员' + ' | ';
str += '' + list['USER_NAME'] + ' | ';
str += '
';
str += '';
str += '' + list['NAME'] +'内容' + ' | ';
str += '' + list['TASK_NAME'] + ' | ';
str += '
';
$('#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= 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);