czl-screen/js/home.js

1941 lines
46 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var clickNUm = 1;
layui.use(['layer'], function() {
var $ = layui.jquery,
layer = layui.layer;
getData();
getProjectResource();
getSubTeamCapacity();
getToolsResource();
getMapResource();
getProjectProgress();
getPreReleaseResource();
setInterval(function () {
$("#nowTime").text(getNowTime())
},1000);
//
$("#Jump_release_1").click(function () {
localStorage.setItem("Jump_release","2")
var index = layer.open({
type: 2,
title: false,
content: './preReleaseResourceList.html',
area: ['95%', '95%'],
maxmin: false,
});
// window.location.href="./preReleaseResourceList.html";
});
$("#Jump_release_2").click(function () {
localStorage.setItem("Jump_release","1")
var index = layer.open({
type: 2,
title: false,
content: './preReleaseResourceList.html',
area: ['95%', '95%'],
maxmin: false,
});
});
//在建工程跳转
$("#Jump_building_pro").click(function () {
localStorage.setItem("ds_pro_status","1")
window.location.href="./z_projectList.html";
});
$("#Jump_finish_pro").click(function () {
localStorage.setItem("ds_pro_status","2")
window.location.href="./z_projectList.html";
});
$("#Jump_no_start_pro").click(function () {
window.location.href="./z_project_arrange_List.html";
});
//基础杆塔跳转
$("#JumpSchedule_base").click(function () {
window.location.href="./schedule.html";
});
//组塔杆塔跳转
$("#JumpSchedule_tower").click(function () {
window.location.href="./schedule.html";
});
//架线杆塔跳转
$("#JumpSchedule_line").click(function () {
window.location.href="./schedule.html";
});
//公司团队跳转
$("#JumpSchedule_unitTeam_item").click(function () {
localStorage.setItem("orgType","");
localStorage.setItem("state","");
window.location.href="./z_companyTeamList.html";
});
$("#JumpSchedule_unitTeam_input").click(function () {
localStorage.setItem("orgType","");
localStorage.setItem("state","1");
window.location.href="./z_companyTeamList.html";
});
$("#JumpSchedule_unitTeam_idle").click(function () {
localStorage.setItem("orgType","");
localStorage.setItem("state","0");
window.location.href="./z_companyTeamList.html";
});
//分包班组跳转
$("#JumpSchedule_subTeam_item").click(function () {
localStorage.setItem("subType","");
localStorage.setItem("state","");
window.location.href="./z_subcontractingTeamsList.html";
});
$("#JumpSchedule_subTeam_input").click(function () {
localStorage.setItem("subType","");
localStorage.setItem("state","1");
window.location.href="./z_subcontractingTeamsList.html";
});
$("#JumpSchedule_subTeam_idle").click(function () {
localStorage.setItem("subType","");
localStorage.setItem("state","0");
window.location.href="./z_subcontractingTeamsList.html";
});
//自有班组跳转
$("#JumpSchedule_ownTeam_item").click(function () {
localStorage.setItem("ownType","");
localStorage.setItem("state","");
window.location.href="./z_ownTeamList.html";
});
$("#JumpSchedule_ownTeam_input").click(function () {
localStorage.setItem("ownType","");
localStorage.setItem("state","1");
window.location.href="./z_ownTeamList.html";
});
$("#JumpSchedule_ownTeam_idle").click(function () {
localStorage.setItem("ownType","");
localStorage.setItem("state","0");
window.location.href="./z_ownTeamList.html";
});
//实名制在场跳转
$("#JumpSchedule_RealName").click(function () {
window.location.href="./z_realNameList.html";
});
//设备工机具跳转
$("#JumpSchedule_Tools").click(function () {
window.location.href="./z_constructionMachinesList.html";
});
//项目资源管理-线路施工分公司跳转
// $("#lineOne").click(function () {
// localStorage.setItem("orgType","2")
// localStorage.setItem("state","");
// window.location.href="./z_companyTeamList.html";
// });
// $("#lineTwo").click(function () {
// localStorage.setItem("orgType","3")
// localStorage.setItem("state","");
// window.location.href="./z_companyTeamList.html";
// });
// $("#vigorously").click(function () {
// localStorage.setItem("orgType","4")
// localStorage.setItem("state","");
// window.location.href="./z_companyTeamList.html";
// });
//分包班组承载力-基础跳转
// $("#foundation").click(function () {
// localStorage.setItem("subType","基础")
// localStorage.setItem("state","");
// window.location.href="./z_subcontractingTeamsList.html";
// });
// $("#tower").click(function () {
// localStorage.setItem("subType","组塔")
// localStorage.setItem("state","");
// window.location.href="./z_subcontractingTeamsList.html";
// });
// $("#line").click(function () {
// localStorage.setItem("subType","架线")
// localStorage.setItem("state","");
// window.location.href="./z_subcontractingTeamsList.html";
// });
//自有班组承载力-基础跳转
// $("#own_foundation").click(function () {
// localStorage.setItem("ownType","基础")
// localStorage.setItem("state","");
// window.location.href="./z_ownTeamList.html";
// });
// $("#own_tower").click(function () {
// localStorage.setItem("ownType","组塔")
// localStorage.setItem("state","");
// window.location.href="./z_ownTeamList.html";
// });
// $("#own_line").click(function () {
// localStorage.setItem("ownType","架线")
// localStorage.setItem("state","");
// window.location.href="./z_ownTeamList.html";
// });
$("#c_echart").click(function () {
window.location.href="./c_echart.html";
});
$("#changeView").click(function () {
if(clickNUm%2==1){
$("#sub_div").css("display","none");
$("#own_div").css("display","");
$("#changeView").text("分包班组>>");
$("#change_text").text("自有班组承载力");
if(clickNUm == 1){
getOwnTeamCapacity();
}
}else{
$("#sub_div").css("display","");
$("#own_div").css("display","none");
$("#changeView").text("自有班组>>");
$("#change_text").text("分包商承载力");
}
clickNUm ++;
});
//JumpSchedule_unitTeam
//JumpSchedule_subTeam
//JumpSchedule_ownTeam
});
function getData() {
getProjectStatus();
getBaseTowerStatus();
getTowerTowerStatus();
getLineTowerStatus();
getBranchOfficeTeamStatus();
getSubTeamStatus();
getOwnTeamStatus();
getRealMessage();
getToolsStatus();
}
//获取在建工程信息(开关/未开工)
function getProjectStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getProjectStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
let dataKey =obj.dataKey; //在建工程
let dataValue =obj.dataValue;//完工
let dataNum =obj.dataNum;//已开工
$("#pro_dataNum").text(dataKey); //在建工程
//$("#pro_dataValue").text(parseInt(dataNum-dataValue));
$("#pro_dataValue").text(dataNum);//待开工公工程
$("#pro_dataKey").text(dataValue);//完工
}
});
}
//获取基础杆塔信息(完成/未完成)
function getBaseTowerStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getBaseTowerStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
let dataKey =obj.dataKey;
let dataValue =obj.dataValue;
$("#base_dataNum").text(parseInt(dataKey));
$("#base_dataKey").text(dataValue);
$("#base_dataValue").text(parseInt(dataKey)-parseInt(dataValue));
}
});
}
//获取组塔杆塔信息(完成/未完成)
function getTowerTowerStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getTowerTowerStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
let dataKey =obj.dataKey;
let dataValue =obj.dataValue;
$("#tower_dataNum").text(parseInt(dataKey));
$("#tower_dataKey").text(dataValue);
$("#tower_dataValue").text(parseInt(dataKey)-parseInt(dataValue));
}
});
}
//获取架线杆塔信息(总数/已完成)
function getLineTowerStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getLineTowerStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
let dataKey =obj.dataKey;
let dataValue =obj.dataValue;
$("#line_dataNum").text(parseFloat(dataKey).toFixed(2));
$("#line_dataKey").text(parseFloat(dataValue).toFixed(2));//
$("#line_dataValue").text((parseFloat(dataKey)-parseFloat(dataValue)).toFixed(2));
}
});
}
//分公司团队 (投入/闲置)
function getBranchOfficeTeamStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getBranchOfficeTeamStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
let dataKey =obj.dataKey;
let dataValue =obj.dataValue;
$("#own_dataNum").text(parseInt(dataKey)+parseInt(dataValue));
$("#own_dataKey").text(dataKey);
$("#own_dataValue").text(dataValue);
}
});
}
//分包班组 id1投入 2闲置 dataKey类型 dataValue数量
function getSubTeamStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getSubTeamStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
var AllNum = 0;
var baseAllNum = 0;
var TowerAllNum = 0;
var LineAllNum = 0;
var trAllNum = 0;
var xzAllNum = 0;
var tfBaseNum = 0;
var tfTowerNum = 0;
var tfLineNum = 0;
var xzBaseNum = 0;
var xzTowerNum = 0;
var xzLineNum = 0;
if(obj !=null && obj.length >0){
for(var i=0;i<obj.length;i++){
var id = parseInt(obj[i].id);
var dataKey = parseInt(obj[i].dataKey);
var dataValue = parseInt(obj[i].dataValue);
if(id == 1){
if(dataKey == 1){
tfBaseNum = tfBaseNum + dataValue;
}else if(dataKey == 2){
tfTowerNum = tfTowerNum + dataValue;
}else{
tfLineNum = tfLineNum + dataValue;
}
}else{
if(dataKey == 1){
xzBaseNum = xzBaseNum + dataValue;
}else if(dataKey == 2){
xzTowerNum = xzTowerNum + dataValue;
}else{
xzLineNum = xzLineNum + dataValue;
}
}
}
}
trAllNum = tfBaseNum + tfTowerNum + tfLineNum;
xzAllNum = xzBaseNum + xzTowerNum + xzLineNum;
baseAllNum = tfBaseNum + xzBaseNum;
TowerAllNum = tfTowerNum + xzTowerNum;
LineAllNum = tfLineNum + xzLineNum;
AllNum = baseAllNum + TowerAllNum + LineAllNum;
$("#sub_AllNum").text(AllNum);
$("#sub_baseAllNum").text(baseAllNum);
$("#sub_TowerAllNum").text(TowerAllNum);
$("#sub_LineAllNum").text(LineAllNum);
$("#sub_trAllNum").text(trAllNum);
$("#sub_tfBaseNum").text(tfBaseNum);
$("#sub_tfTowerNum").text(tfTowerNum);
$("#sub_tfLineNum").text(tfLineNum);
$("#sub_xzAllNum").text(xzAllNum);
$("#sub_xzBaseNum").text(xzBaseNum);
$("#sub_xzTowerNum").text(xzTowerNum);
$("#sub_xzLineNum").text(xzLineNum);
}
});
}
//自有班组 id1投入 2闲置 dataKey类型 dataValue数量
function getOwnTeamStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getOwnTeamStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
var AllNum = 0;
var baseAllNum = 0;
var TowerAllNum = 0;
var LineAllNum = 0;
var trAllNum = 0;
var xzAllNum = 0;
var tfBaseNum = 0;
var tfTowerNum = 0;
var tfLineNum = 0;
var xzBaseNum = 0;
var xzTowerNum = 0;
var xzLineNum = 0;
if(obj !=null && obj.length >0){
for(var i=0;i<obj.length;i++){
var id = parseInt(obj[i].id);
var dataKey = parseInt(obj[i].dataKey);
var dataValue = parseInt(obj[i].dataValue);
if(id == 1){
if(dataKey == 1){
tfBaseNum = tfBaseNum + dataValue;
}else if(dataKey == 2){
tfTowerNum = tfTowerNum + dataValue;
}else{
tfLineNum = tfLineNum + dataValue;
}
}else{
if(dataKey == 1){
xzBaseNum = xzBaseNum + dataValue;
}else if(dataKey == 2){
xzTowerNum = xzTowerNum + dataValue;
}else{
xzLineNum = xzLineNum + dataValue;
}
}
}
}
trAllNum = tfBaseNum + tfTowerNum + tfLineNum;
xzAllNum = xzBaseNum + xzTowerNum + xzLineNum;
baseAllNum = tfBaseNum + xzBaseNum;
TowerAllNum = tfTowerNum + xzTowerNum;
LineAllNum = tfLineNum + xzLineNum;
AllNum = baseAllNum + TowerAllNum + LineAllNum;
$("#own_AllNum").text(AllNum);
$("#own_baseAllNum").text(baseAllNum);
$("#own_TowerAllNum").text(TowerAllNum);
$("#own_LineAllNum").text(LineAllNum);
$("#own_trAllNum").text(trAllNum);
$("#own_tfBaseNum").text(tfBaseNum);
$("#own_tfTowerNum").text(tfTowerNum);
$("#own_tfLineNum").text(tfLineNum);
$("#own_xzAllNum").text(xzAllNum);
$("#own_xzBaseNum").text(xzBaseNum);
$("#own_xzTowerNum").text(xzTowerNum);
$("#own_xzLineNum").text(xzLineNum);
}
});
}
//获取实名制信息
function getRealMessage() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getRealMessage",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
let dataKey =obj.dataKey;
let dataValue =obj.dataValue;
let dataNum =obj.dataNum;
$("#real_dataKey").text(parseFloat(dataValue)+parseFloat(dataNum));
$("#real_dataValue").text(parseFloat(dataValue));//
$("#real_dataNum").text(parseFloat(dataNum));
}
});
}
//获取安全工器具信息(总数/使用数)
function getToolsStatus() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getToolsStatus",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
if(obj !=null){
let dataKey =obj.dataKey;
let dataValue =obj.dataValue;
$("#tools_allNum").text(parseFloat(dataKey));
$("#tools_useNum").text(parseFloat(dataValue));//
$("#tools_unUseNum").text(parseFloat(dataKey)-parseFloat(dataValue));
}else{
$("#tools_allNum").text("0");
$("#tools_useNum").text("0");//
$("#tools_unUseNum").text("0");
}
}
});
}
//获取项目资源管理信息
function getProjectResource() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getProjectResource",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
if(obj !=[] && obj.length>0){
for(var i=0;i<obj.length;i++){
let id = obj[i].id;
let dataKey = obj[i].dataKey;
let dataValue = obj[i].dataValue;
let allNum = obj[i].allNum;
if(i == 0){
// 名称 投产数 总数
getLineOne(dataKey,dataValue,allNum);
}else if(i == 1){
getLineTwo(dataKey,dataValue,allNum);
}else{
getVigorously(dataKey,dataValue,allNum)
}
}
}
}
});
}
//获取获取分包商承载力
function getSubTeamCapacity() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getSubTeamCapacity",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
if(obj !=[] && obj.length>0){
for(var i=0;i<obj.length;i++){
let id = obj[i].id;
let dataKey = obj[i].dataKey;//总数
let dataValue = obj[i].dataValue;//使用
if(id == 1){
getFoundation(dataKey,dataValue,'foundation');//基础
}else if(id == 2){
getTower(dataKey,dataValue,'tower');//组塔
}else{
getLine(dataKey,dataValue,'line');//架线
}
}
}
}
});
};
//获取自有班组承载力
function getOwnTeamCapacity() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getOwnTeamCapacity",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
if(obj !=[] && obj.length>0){
for(var i=0;i<obj.length;i++){
let id = obj[i].id;
let dataKey = obj[i].dataKey;//总数
let dataValue = obj[i].dataValue;//使用
if(id == 1){
getFoundation(dataKey,dataValue,'own_foundation');//基础
}else if(id == 2){
getTower(dataKey,dataValue,'own_tower');//组塔
}else{
getLine(dataKey,dataValue,'own_line');//架线
}
}
}
}
});
};
function getToolsResource() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getToolsResource",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
var names =[];
var value1 =[];
var value2 =[];
if(obj !=[] && obj !=null &&obj.length>0){
for(var i=0;i<obj.length;i++){
let id = obj[i].id;
let dataKey = obj[i].dataKey;
let dataValue = obj[i].dataValue;
let dataNum = obj[i].dataNum;
names.push(dataKey);
value1.push(dataValue);
value2.push(parseInt(dataNum)-parseInt(dataValue));
}
}
getDevice(names,value1,value2);
}
});
}
function getMapResource() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getMapResource",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= data.data;
//alert(JSON.stringify(obj));
getMap(obj);
}
});
};
function getProjectProgress() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/dataHome/getProjectProgress",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
let obj= JSON.parse(data.data);
let proName = obj.proName;
let proId = obj.proId;
let data0 = obj.data0;
let data1 = obj.data1;
let data2 = obj.data2;
let lonList = obj.lonList;
let latList = obj.latList;
let cityNameList = obj.cityNameList;
getProject(proName,proId,data0,data1,data2,lonList,latList,cityNameList);
}
});
}
/**
* 获取预释放资源数据
*/
function getPreReleaseResource() {
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + "/schedule/getPreReleaseResource",// 请求地址
dataType: 'json', // 服务器返回数据类型
data: {}, //获取提交的表单字段
success: function (data) {
setPreReleaseData("#team_one_1","#team_one_2",data.obj.teamNumber);
console.log("team_one_1");
setPreReleaseData("#team_three_1","#team_three_2",data.obj.teamNineNumber);
console.log("team_three_1");
setPreReleaseData("#basic_one_1","#basic_one_2",data.obj.basicNumber);
console.log("basic_one_1");
setPreReleaseData("#basic_three_1","#basic_three_2",data.obj.basicNineNumber);
console.log("basic_three_1");
setPreReleaseData("#tower_one_1","#tower_one_2",data.obj.towerNumber);
console.log("tower_one_1");
setPreReleaseData("#tower_three_1","#tower_three_2",data.obj.towerNineNumber);
console.log("tower_three_1");
setPreReleaseData("#line_one_1","#line_one_2",data.obj.lineNumber);
console.log("line_one_1");
setPreReleaseData("#line_three_1","#line_three_2",data.obj.lineNineNumber);
console.log("line_three_1");
}
});
}
/**
* 预释放资源赋值
* @param id1
* @param id2
* @param data
*/
function setPreReleaseData(id1,id2,data){
if(parseInt(data) > 9 && parseInt(data) < 100){
$(id1).text(data.toString().substring(0,1));
$(id2).text(data.toString().substring(1,2));
}else {
$(id1).text("0");
$(id2).text(data);
}
}
function getLineOne(dataKey,dataValue,allNum) {
var chartDom = document.getElementById('lineOne');
var myChart = echarts.init(chartDom);
var data = [
{
label: "投入:"+dataValue,
value: dataValue
},
{
label: "闲置:"+(parseInt(allNum)-parseInt(dataValue)),
value: (parseInt(allNum)-parseInt(dataValue))
}
];
var colors = [
['68,119,253', '70,174,250', '72,230,246'],
[ '12,31,105','66,71,183', '131,107,239']
];
var num = allNum; //数量
var option;
option = {
title: [
{
text: dataKey,
x: 'center',
y: '40%',
textStyle: {
fontWeight: 'normal',
fontSize: 12,
color: "#fff",
}
},
{
text: num,
x: 'center',
y: '50%',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "#fff",
}
}],
legend: {
orient: 'horizontal',
icon: 'circle',
bottom: -5,
textStyle: {
color: '#fff'
},
data: data.map(it => it.label),
},
tooltip: {
show: false
},
series: [
{
name: '年龄段',
type: 'pie',
radius: ['65%', '45%'],
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
data: data.map((it, i) => {
return {
value: it.value,
name: it.label,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0.05,
color: `rgba(${colors[i][0]},0.7)`
}, {
offset: 0.5,
color: `rgba(${colors[i][1]},0.7)`
}, {
offset: 1,
color: `rgba(${colors[i][2]},0.7)`
}]),
},
color: `rgba(${colors[i]},0.7)`,
borderColor: `rgba(${colors[i]},1)`,
borderWidth: 1
}
};
})
},
{
type: 'pie',// 内层细圆环2
radius: ['75%', '80%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
color:'#2858BA',
},
label: {
show: false
},
data: [1]
},
]
};
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name == "投入:"+dataValue){
localStorage.setItem("orgType","2")
localStorage.setItem("state","1");
window.location.href="./z_companyTeamList.html";
}else if(name == "闲置:"+(parseInt(allNum)-parseInt(dataValue))){
localStorage.setItem("orgType","2")
localStorage.setItem("state","0");
window.location.href="./z_companyTeamList.html";
}
});
myChart.on('click', function(params) {
localStorage.setItem("orgType","2")
localStorage.setItem("state","");
window.location.href="./z_companyTeamList.html";
});
option && myChart.setOption(option);
}
function getLineTwo(dataKey,dataValue,allNum) {
var chartDom = document.getElementById('lineTwo');
var myChart = echarts.init(chartDom);
var data = [
{
label: "投入:"+dataValue,
value: dataValue
},
{
label: "闲置:"+(parseInt(allNum)-parseInt(dataValue)),
value: (parseInt(allNum)-parseInt(dataValue))
}
];
var colors = [
['68,119,253', '70,174,250', '72,230,246'],
[ '12,31,105','66,71,183', '131,107,239']
];
var num = allNum; //数量
var option;
option = {
title: [
{
text: dataKey,
x: 'center',
y: '40%',
textStyle: {
fontWeight: 'normal',
fontSize: 12,
color: "#fff",
}
},
{
text: num,
x: 'center',
y: '50%',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "#fff",
}
}],
legend: {
orient: 'horizontal',
icon: 'circle',
bottom: -5,
textStyle: {
color: '#fff'
},
data: data.map(it => it.label),
},
tooltip: {
show: false
},
series: [
{
name: '年龄段',
type: 'pie',
radius: ['65%', '45%'],
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
data: data.map((it, i) => {
return {
value: it.value,
name: it.label,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0.05,
color: `rgba(${colors[i][0]},0.7)`
}, {
offset: 0.5,
color: `rgba(${colors[i][1]},0.7)`
}, {
offset: 1,
color: `rgba(${colors[i][2]},0.7)`
}]),
},
color: `rgba(${colors[i]},0.7)`,
borderColor: `rgba(${colors[i]},1)`,
borderWidth: 1
}
};
})
},
{
type: 'pie',// 内层细圆环2
radius: ['75%', '80%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
color:'#2858BA',
},
label: {
show: false
},
data: [1]
},
]
};
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name == "投入:"+dataValue){
localStorage.setItem("orgType","3")
localStorage.setItem("state","1");
window.location.href="./z_companyTeamList.html";
}else if(name == "闲置:"+(parseInt(allNum)-parseInt(dataValue))){
localStorage.setItem("orgType","3")
localStorage.setItem("state","0");
window.location.href="./z_companyTeamList.html";
}
})
myChart.on('click', function(params) {
localStorage.setItem("orgType","3")
localStorage.setItem("state","");
window.location.href="./z_companyTeamList.html";
});
option && myChart.setOption(option);
}
function getVigorously(dataKey,dataValue,allNum) {
var chartDom = document.getElementById('vigorously');
var myChart = echarts.init(chartDom);
var data = [
{
label: "投入:"+dataValue,
value: dataValue
},
{
label: "闲置:"+(parseInt(allNum)-parseInt(dataValue)),
value: (parseInt(allNum)-parseInt(dataValue))
}
];
var colors = [
['68,119,253', '70,174,250', '72,230,246'],
[ '12,31,105','66,71,183', '131,107,239']
];
var num = allNum; //数量
var option;
option = {
title: [
{
text:dataKey,
x: 'center',
y: '40%',
textStyle: {
fontWeight: 'normal',
fontSize: 12,
color: "#fff",
}
},
{
text: num,
x: 'center',
y: '50%',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "#fff",
}
}],
legend: {
orient: 'horizontal',
icon: 'circle',
bottom: -5,
textStyle: {
color: '#fff'
},
data: data.map(it => it.label),
},
tooltip: {
show: false
},
series: [
{
name: '年龄段',
type: 'pie',
radius: ['65%', '45%'],
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
data: data.map((it, i) => {
return {
value: it.value,
name: it.label,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0.05,
color: `rgba(${colors[i][0]},0.7)`
}, {
offset: 0.5,
color: `rgba(${colors[i][1]},0.7)`
}, {
offset: 1,
color: `rgba(${colors[i][2]},0.7)`
}]),
},
color: `rgba(${colors[i]},0.7)`,
borderColor: `rgba(${colors[i]},1)`,
borderWidth: 1
}
};
})
},
{
type: 'pie',// 内层细圆环2
radius: ['75%', '80%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
color:'#2858BA',
},
label: {
show: false
},
data: [1]
},
]
};
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name == "投入:"+dataValue){
localStorage.setItem("orgType","4")
localStorage.setItem("state","1");
window.location.href="./z_companyTeamList.html";
}else if(name == "闲置:"+(parseInt(allNum)-parseInt(dataValue))){
localStorage.setItem("orgType","4")
localStorage.setItem("state","0");
window.location.href="./z_companyTeamList.html";
}
})
myChart.on('click', function(params) {
localStorage.setItem("orgType","4")
localStorage.setItem("state","");
window.location.href="./z_companyTeamList.html";
});
option && myChart.setOption(option);
}
function getFoundation(dataKey,dataValue,chartId) {//总数、使用
var chartDom = document.getElementById(chartId);
var myChart = echarts.init(chartDom);
var data = [
{
label: "投入: "+dataValue,
value: dataValue
},
{
label: "闲置: "+(parseInt(dataKey)-parseInt(dataValue)),
value: (parseInt(dataKey)-parseInt(dataValue))
}
];
var colors = [
['25,216,248', '40,220,245', '149,252,220' ],
[ '9,61,78','52,131,107','120,193,122']
];
var num = dataKey; //数量
var option;
option = {
title: [
{
text: '基础',
x: 'center',
y: '40%',
textStyle: {
fontWeight: 'normal',
fontSize: 12,
color: "#fff",
}
},
{
text: num,
x: 'center',
y: '50%',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "#fff",
}
}],
legend: {
orient: 'horizontal',
icon: 'circle',
bottom: -5,
textStyle: {
color: '#fff'
},
data: data.map(it => it.label),
},
tooltip: {
show: false
},
series: [
{
type: 'pie',
radius: ['65%', '45%'],
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
data: data.map((it, i) => {
return {
value: it.value,
name: it.label,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0.05,
color: `rgba(${colors[i][0]},0.7)`
}, {
offset: 0.5,
color: `rgba(${colors[i][1]},0.7)`
}, {
offset: 1,
color: `rgba(${colors[i][2]},0.7)`
}]),
},
color: `rgba(${colors[i]},0.7)`,
borderColor: `rgba(${colors[i]},1)`,
borderWidth: 1
}
};
})
},
{
type: 'pie',// 内层细圆环2
radius: ['75%', '80%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
color:'#2858BA',
},
label: {
show: false
},
data: [1]
},
]
};
if (chartId == 'foundation'){
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name.indexOf("投入") != -1){
localStorage.setItem("subType","基础")
localStorage.setItem("state","1");
window.location.href="./z_subcontractingTeamsList.html";
}else if(name.indexOf("闲置") != -1){
localStorage.setItem("subType","基础")
localStorage.setItem("state","0");
window.location.href="./z_subcontractingTeamsList.html";
}
});
myChart.on('click', function(params) {
localStorage.setItem("subType","基础")
localStorage.setItem("state","");
window.location.href="./z_subcontractingTeamsList.html";
});
} else if (chartId == 'own_foundation'){
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name.indexOf("投入") != -1){
localStorage.setItem("ownType","基础")
localStorage.setItem("state","1");
window.location.href="./z_ownTeamList.html";
}else if(name.indexOf("闲置") != -1){
localStorage.setItem("ownType","基础")
localStorage.setItem("state","0");
window.location.href="./z_ownTeamList.html";
}
});
myChart.on('click', function(params) {
localStorage.setItem("ownType","基础")
localStorage.setItem("state","");
window.location.href="./z_ownTeamList.html";
});
}
option && myChart.setOption(option);
}
function getTower(dataKey,dataValue,chartId) {
var chartDom = document.getElementById(chartId);
var myChart = echarts.init(chartDom);
var data = [
{
label: "投入: "+dataValue,
value: dataValue
},
{
label: "闲置: "+(parseInt(dataKey)-parseInt(dataValue)),
value: (parseInt(dataKey)-parseInt(dataValue))
}
];
var colors = [
['25,216,248', '40,220,245', '149,252,220' ],
[ '9,61,78','52,131,107','120,193,122']
];
var num =dataKey; //数量
var option;
option = {
title: [
{
text: '组塔',
x: 'center',
y: '40%',
textStyle: {
fontWeight: 'normal',
fontSize: 12,
color: "#fff",
}
},
{
text: num,
x: 'center',
y: '50%',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "#fff",
}
}],
legend: {
orient: 'horizontal',
icon: 'circle',
bottom: -5,
textStyle: {
color: '#fff'
},
data: data.map(it => it.label),
},
tooltip: {
show: false
},
series: [
{
name: '年龄段',
type: 'pie',
radius: ['65%', '45%'],
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
data: data.map((it, i) => {
return {
value: it.value,
name: it.label,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0.05,
color: `rgba(${colors[i][0]},0.7)`
}, {
offset: 0.5,
color: `rgba(${colors[i][1]},0.7)`
}, {
offset: 1,
color: `rgba(${colors[i][2]},0.7)`
}]),
},
color: `rgba(${colors[i]},0.7)`,
borderColor: `rgba(${colors[i]},1)`,
borderWidth: 1
}
};
})
},
{
type: 'pie',// 内层细圆环2
radius: ['75%', '80%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
color:'#2858BA',
},
label: {
show: false
},
data: [1]
},
]
};
if (chartId == 'tower'){
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name.indexOf("投入") != -1){
localStorage.setItem("subType","组塔")
localStorage.setItem("state","1");
window.location.href="./z_subcontractingTeamsList.html";
}else if(name.indexOf("闲置") != -1){
localStorage.setItem("subType","组塔")
localStorage.setItem("state","0");
window.location.href="./z_subcontractingTeamsList.html";
}
})
myChart.on('click', function(params) {
localStorage.setItem("subType","组塔")
localStorage.setItem("state","");
window.location.href="./z_subcontractingTeamsList.html";
});
}else if (chartId == 'own_tower'){
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name.indexOf("投入") != -1){
localStorage.setItem("ownType","组塔")
localStorage.setItem("state","1");
window.location.href="./z_ownTeamList.html";
}else if(name.indexOf("闲置") != -1){
localStorage.setItem("ownType","组塔")
localStorage.setItem("state","0");
window.location.href="./z_ownTeamList.html";
}
});
myChart.on('click', function(params) {
localStorage.setItem("ownType","组塔")
localStorage.setItem("state","");
window.location.href="./z_ownTeamList.html";
});
}
option && myChart.setOption(option);
}
function getLine(dataKey,dataValue,chartId) {
var chartDom = document.getElementById(chartId);
var myChart = echarts.init(chartDom);
var data = [
{
label: "投入: "+dataValue,
value: dataValue
},
{
label: "闲置: "+(parseInt(dataKey)-parseInt(dataValue)),
value: (parseInt(dataKey)-parseInt(dataValue))
}
];
var colors = [
['25,216,248', '40,220,245', '149,252,220' ],
[ '9,61,78','52,131,107','120,193,122']
];
var num = dataKey; //数量
var option;
option = {
title: [
{
text: '架线',
x: 'center',
y: '40%',
textStyle: {
fontWeight: 'normal',
fontSize: 12,
color: "#fff",
}
},
{
text: num,
x: 'center',
y: '50%',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "#fff",
}
}],
legend: {
orient: 'horizontal',
icon: 'circle',
bottom: -5,
textStyle: {
color: '#fff'
},
data: data.map(it => it.label),
},
tooltip: {
show: false
},
series: [
{
name: '年龄段',
type: 'pie',
radius: ['65%', '45%'],
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
data: data.map((it, i) => {
return {
value: it.value,
name: it.label,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0.05,
color: `rgba(${colors[i][0]},0.7)`
}, {
offset: 0.5,
color: `rgba(${colors[i][1]},0.7)`
}, {
offset: 1,
color: `rgba(${colors[i][2]},0.7)`
}]),
},
color: `rgba(${colors[i]},0.7)`,
borderColor: `rgba(${colors[i]},1)`,
borderWidth: 1
}
};
})
},
{
type: 'pie',// 内层细圆环2
radius: ['75%', '80%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
color:'#2858BA',
},
label: {
show: false
},
data: [1]
},
]
};
if (chartId == 'line'){
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name.indexOf("投入") != -1){
localStorage.setItem("subType","架线")
localStorage.setItem("state","1");
window.location.href="./z_subcontractingTeamsList.html";
}else if(name.indexOf("闲置") != -1){
localStorage.setItem("subType","架线")
localStorage.setItem("state","0");
window.location.href="./z_subcontractingTeamsList.html";
}
})
myChart.on('click', function(params) {
localStorage.setItem("subType","架线")
localStorage.setItem("state","");
window.location.href="./z_subcontractingTeamsList.html";
});
}else if (chartId == 'own_line'){
myChart.on('legendselectchanged', function(params) {
let name = params.name;
if (name.indexOf("投入") != -1){
localStorage.setItem("ownType","架线")
localStorage.setItem("state","1");
window.location.href="./z_ownTeamList.html";
}else if(name.indexOf("闲置") != -1){
localStorage.setItem("ownType","架线")
localStorage.setItem("state","0");
window.location.href="./z_ownTeamList.html";
}
});
myChart.on('click', function(params) {
localStorage.setItem("ownType","架线")
localStorage.setItem("state","");
window.location.href="./z_ownTeamList.html";
});
}
option && myChart.setOption(option);
}
function getDevice(names,dataValue,dataNum) {
var chartDom = document.getElementById('device');
var myChart = echarts.init(chartDom);
var name = names;
var num = dataValue;
var nums = dataNum;
var option;
option = {
tooltip: {
show: true,
trigger: 'axis',
backgroundColor: "rgba(75,79,82)", //设置背景图片 rgba格式
borderWidth: "1", //边框宽度设置1
borderColor: "gray", //设置边框颜色
axisPointer:{
type:'shadow',
},
textStyle: {
fontSize: 16,
color: "#E7E8E8" //设置文字颜色
},
formatter: (p)=> { //添加单位
console.log("p:"+JSON.stringify(p));
return '投入:&nbsp;&nbsp;' +p[0].value + '&nbsp;套<br/>'
+'闲置:&nbsp;&nbsp;' +p[1].value + '&nbsp;套';
}
},
legend: {
data: ["投入", "闲置"],
top: "0",
right: '0',
textStyle: {
color: "rgba(250,250,250,0.6)",
fontSize: 16
}
},
grid: {
top: '10%',
right: '3%',
left: '0%',
bottom: '0%',
containLabel:true
},
barWidth: 15,
xAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: "rgba(255,255,255,0.2)",
type:"dashed"
}
},
axisTick: {
show: false
},
axisLine: { // 改变x轴颜色
lineStyle: {
color: '#26D9FF',
}
},
axisLabel: { // 改变x轴字体颜色和大小
textStyle: {
color: "rgba(250,250,250,0.6)",
fontSize: 16
}
}
},
yAxis: {
type: 'category',
data: name,
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: { // 改变y轴颜色
lineStyle: {
color: '#5E657C',
}
},
axisLabel: { // 改变y轴字体颜色和大小
// formatter: '{value} 套',
textStyle: {
color: "rgba(193,195,205,0.6)",
fontSize: 16
}
}
},
series: [
{
type: 'bar',
name: "投入",
itemStyle: {
normal: {
label: {
show: true,
position: 'right',
textStyle: {
color: "rgba(250,250,250,0.6)",
fontSize: 16,
fontWeight: 600
},
// formatter: function(params) {
// return params.value + '套';
// }
},
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
offset: 0,
color: 'rgba(52,233,148,1)'
}, {
offset: 1,
color: 'rgba(12,63,73,0)'
}]),
borderWidth: 2
}
},
data: num
},
{
type: 'bar',
name: "闲置",
itemStyle: {
normal: {
label: {
show: true,
position: 'right',
textStyle: {
color: "rgba(250,250,250,0.6)",
fontSize: 16,
fontWeight: 600
},
// formatter: function(params) {
// return params.value + '套';
// }
},
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
offset: 0,
color: 'rgba(37,135,251,1)'
}, {
offset: 1,
color: 'rgba(5,29,80,0)'
}]),
borderWidth: 2
}
},
data: nums
}
]
};
option && myChart.setOption(option);
}
// 定义一个变量用于记录当前展示的数据索引
var currentIndex = 0;
function getProject(proName,proId,data0,data1,data2,lonList,latList,cityNameList) {
var chartDom = document.getElementById('project');
var myChart = echarts.init(chartDom);
var threaten_data = data0;
var threaten_data2 = data1;
var threaten_data3 = data2;
var xAxis_data = proName;
var xAxis_id = proId;
var showNums = 18;
if(proName.length<=5){
showNums = 100;
}
// var threaten_data = [760,450,820,450,240,605,1301,1101];
// var threaten_data2 = [860,650,890,750,540,685,1401,1201];
// var threaten_data3 = [860,650,890,750,540,685,1401,1201];
// var xAxis_data = ['周一','周二','周三','周四','周五','周六','周日'];
var option;
option = {
grid: {
left: '5%',
right: '5%',
bottom: '1%',
top: '12%',
containLabel: true
},
legend: {
icon:'circle',
right: '5%',
top:10,
data: ['基础','组塔','架线'],
textStyle: {
color: '#5b97d5'
}
},
xAxis:{
type : 'category',
data : xAxis_data,
axisLabel:{
rotate: 20, // 旋转角度,
fontSize: 12, // 字体大小
textStyle:{
color: '#D9DBE0',
}
},
axisLine:{
show: false,
lineStyle:{
color:'#1f3a56',
}
},
splitLine:{
show: false,
},
axisTick:{
show:false,
},
},
yAxis :{
min: 0, max: 100,
type : 'value',
axisLabel:{
textStyle:{
color: '#C9CBD4'
},
formatter:'{value} %'
},
axisLine:{
lineStyle:{
color:'#1f3a56',
}
},
splitLine:{
show: true,
lineStyle:{
color:'#1f3a56',
type:"dashed"
}
},
},
tooltip: {
show: true,
formatter: function (params) {
console.log("params="+JSON.stringify(params));
let values = "0";
if(!isNaN(params.value)){
values = params.value;
}
// return params.seriesName + ' : ' + values+"\r"+params.name;
return params.seriesName + ':' + values+"%";;
}
},
series: [
{
name:'基础',
type:'bar',
barWidth : '10%', //柱子宽度
itemStyle:{ //柱子颜色
normal:{
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#59A5FF'
}, {
offset: 1,
color: '#0E3A57'
}]),
}
},
barMinHeight:3,
data : threaten_data,
},
{
name:'组塔',
type:'bar',
barWidth : '10%', //柱子宽度
itemStyle:{ //柱子颜色
normal:{
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FBF899'
}, {
offset: 1,
color: '#344E61'
}]),
}
},
barMinHeight:3,
data : threaten_data2
},
{
name:'架线',
type:'bar',
barWidth : '10%', //柱子宽度
itemStyle:{ //柱子颜色
normal:{
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#9BDDB4'
}, {
offset: 1,
color: '#165363'
}]),
},
},
barMinHeight:3,
data : threaten_data3
}
],dataZoom: [
{
type: 'inside',
start: 0,
end: showNums
}
]
};
option && myChart.setOption(option);
myChart.on('click', function (params) {
let index = xAxis_data.indexOf(params.name);
// 这里可以编写处理点击事件的逻辑
var proId = xAxis_id[index];
var selectLon = lonList[index];
var selectLat = latList[index];
var cityName = cityNameList[index];
// 在这里可以根据点击的位置信息进行相应的操作
localStorage.setItem("proId",proId);
localStorage.setItem("selectLon",selectLon);
localStorage.setItem("selectLat",selectLat);
localStorage.setItem("cityName",cityName);
window.location.href="./schedule.html";
// var index = layer.open({
// type: 2,
// title: '形象进度',
// content: './schedule.html',
// area: ['90%', '95%'],
// maxmin: false,
// closeBtn: true
// });
});
if(proName.length>5){
//使用定时器每隔三秒更新图表数据
setInterval(function() {
// 更新数据
var firstElement = threaten_data.shift(); // 移除数组的第一个元素,并返回该元素
threaten_data.push(firstElement); // 将该元素添加到数组的末尾
option.series[0].data = threaten_data;
var firstElement2 = threaten_data2.shift(); // 移除数组的第一个元素,并返回该元素
threaten_data2.push(firstElement2); // 将该元素添加到数组的末尾
option.series[1].data = threaten_data2;
var firstElement3 = threaten_data3.shift(); // 移除数组的第一个元素,并返回该元素
threaten_data3.push(firstElement3); // 将该元素添加到数组的末尾
option.series[2].data = threaten_data3;
// console.log("threaten_data1="+threaten_data);
// console.log("threaten_data2="+threaten_data2)
// console.log("threaten_data3="+threaten_data3)
//xAxis_id
var proName = xAxis_data.shift(); // 移除数组的第一个元素,并返回该元素
xAxis_data.push(proName); // 将该元素添加到数组的末尾
var proId= xAxis_id.shift(); // 移除数组的第一个元素,并返回该元素
xAxis_id.push(proId); // 将该元素添加到数组的末尾
// 重新设置图表配置
option && myChart.setOption(option);
// 自增索引判断是否超过数据长度如果超过则重置为0
}, 3000);
}
};