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}
{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 += '
';
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/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 += '';
str += '' + list[i]['COMPLAIN_ID'] + ' | ';
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/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 += '';
// str += '' + list[i]['PATROL_RECORD_ID'] + ' | ';
str += '' + list[i]['TITLE'] + ' | ';
str += '' + list[i]['REAL_NAME'] + ' | ';
str += '' + list[i]['CREATE_TIME'] + ' | ';
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");//自动滚动
});
}
}
})
}
//安保
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 += '';
str += '' + list[i]['ORDER_ID'] +' | ';
str += '' + list[i]['TITLE'] + list[i]['NAME'] +' | ';
str += '' + list[i]['CREATTE_TIME'] + ' | ';
str += '' + list[i]['REAL_NAME'] + ' | ';
str += '' + list[i]['CONTENT'] + ' | ';
if (list[i]['CURR_ORDER_MODE'] == 9 || list[i]['CURR_ORDER_MODE'] == 11) {
status = '已完成';
str += '' + status + ' | ';
} else {
status = '未完成';
str += '' + status + ' | ';
}
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);
}
})
}
function chunk(arr, size) {
var arrs=[];
for(var i=0; i