440 lines
15 KiB
Plaintext
440 lines
15 KiB
Plaintext
let element;
|
|
let proType = ''; // 工程类型 01 变电 02 线路
|
|
let myChart10 = echarts.init(document.getElementById('construction')), timeOut10;
|
|
let myChart11 = echarts.init(document.getElementById('dailyRisk')), timeOut11;
|
|
let myChart12 = echarts.init(document.getElementById('teams')), timeOut12;
|
|
let interval = null, isScroll = false;
|
|
let mainMapPointList = [], mapPointList = [];
|
|
let scheduledTask = false;
|
|
let mapType = '3' // 1.工程统计 2.班组人员 3.日风险 4.绿色建造 地图展示类型
|
|
layui.use(['layer', 'form', 'element'], function () {
|
|
element = layui.element;
|
|
$("dd>a,li>a").click(function (e) {
|
|
if ($(this).next('dl').length === 0) {
|
|
e.preventDefault();
|
|
$('ul li').each(function () {
|
|
if ($(this).hasClass('layui-that') || $(this).hasClass('layui-this')) {
|
|
$(this).removeClass('layui-that')
|
|
$(this).removeClass('layui-this')
|
|
}
|
|
})
|
|
$(this).parents('.layui-nav-child').removeClass('layui-show');
|
|
$(this).parents('.layui-nav-item').addClass('layui-that');
|
|
if ($(".layui-tab-title li[lay-id='" + $(this).attr('idx') + "']").length > 0) {
|
|
$("#ifr-box ").css("background-image", "url('../../img/table-back-new.png')");
|
|
$("#homeIndexContent").hide();
|
|
$("#layui-tab").show();
|
|
element.tabChange('menu-tab', $(this).attr('idx'));
|
|
} else {
|
|
$(".homeIndexContent").hide();
|
|
element.tabAdd('menu-tab', {
|
|
title: $(this).text(),
|
|
content: "<iframe id='iframeMain' width='100%' height='100%' frameborder='0' src='" + $(this).attr('targetUrl') + "' class='layadmin-iframe' ></iframe>"
|
|
, id: $(this).attr('idx')
|
|
})
|
|
$("#ifr-box ").css("background-image", "url('../../img/table-back-new.png')");
|
|
$("#layui-tab").show();
|
|
element.tabChange('menu-tab', $(this).attr('idx'));
|
|
closeTitle();
|
|
}
|
|
/*$(".homeIndexContent").hide();
|
|
element.tabAdd('menu-tab', {
|
|
title: $(this).text(),
|
|
content: "<iframe id='iframeMain' width='100%' height='100%' frameborder='0' src='" + $(this).attr('targetUrl') + "' class='layadmin-iframe' ></iframe>"
|
|
, id: $(this).attr('idx')
|
|
})
|
|
$("#ifr-box ").css("background-image", "url('../../img/table-back-new.png')");
|
|
$("#layui-tab").show();
|
|
element.tabChange('menu-tab', $(this).attr('idx'));
|
|
closeTitle();*/
|
|
}
|
|
});
|
|
element.render();//渲染
|
|
})
|
|
|
|
$(function () {
|
|
getTeamNum(); //班组人员
|
|
getDayRiskNum(); //日风险
|
|
getAwardsList(); //获奖情况
|
|
getDayRiskByMap(); //默认加载工程计划地图
|
|
getProPlanStatis() //工程计划
|
|
getEiaNum() //环水保
|
|
getProZj() //工作造价
|
|
getGcjsNum()//工程技术
|
|
getProStatisNum("");
|
|
// getWeatherAlertAjax();
|
|
timedRefresh(); // 地图风险点-定时刷新
|
|
})
|
|
|
|
// 天气预警
|
|
function getWeatherAlertAjax() {
|
|
$.ajax({
|
|
url: dataUrl + 'proteam/pot/home/getWeatherAlert?token=' + token,
|
|
headers: {
|
|
"encrypt": sm3(JSON.stringify({}))
|
|
},
|
|
data: {},
|
|
type: 'post',
|
|
async: true,
|
|
success: function (result) {
|
|
if (result.code === 200) {
|
|
if (result.data && result.data.length > 0) {
|
|
setTimes(result.data);
|
|
} else {
|
|
$("#outText2").text('今日暂无预警信息');
|
|
}
|
|
} else if (result.code === 500) {
|
|
layer.alert(result.msg, {icon: 2})
|
|
} else if (result.code === 401) {
|
|
logout(1);
|
|
}
|
|
},
|
|
});
|
|
}
|
|
|
|
//定时器添加数据
|
|
function setWeatherAlertTimes(data) {
|
|
let intnum = 0;
|
|
this.timer = window.setInterval(() => {
|
|
if (intnum == data.length) {
|
|
intnum = 0;
|
|
}
|
|
let text = data[intnum];
|
|
$("#outText2").empty();
|
|
$("#outText2").text(text);
|
|
intnum++;
|
|
}, 30000)
|
|
}
|
|
|
|
// 工程计划-穿透
|
|
function openProPlan(type) {
|
|
let width = getNewDefaultWidth().toFixed(0) + "px";
|
|
let height = getNewDefaultHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "pro",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
skin: "my-skin child-skin",
|
|
content: 'proPlan.html',
|
|
area: [width, height],
|
|
shade: 0.65,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(type);
|
|
$(window).resize(function () {
|
|
if (autoNewResizeWidth) autoNewResizeWidth(index);
|
|
if (autoNewResizeHeight) autoNewResizeHeight(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
// 工程造价-穿透
|
|
function openEngineerCost(type) {
|
|
let width = getNewDefaultWidth().toFixed(0) + "px";
|
|
let height = getNewDefaultHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "engineerCost",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
skin: "my-skin child-skin",
|
|
content: 'engineerCost.html',
|
|
area: [width, height],
|
|
shade: 0.65,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(type);
|
|
$(window).resize(function () {
|
|
if (autoNewResizeWidth) autoNewResizeWidth(index);
|
|
if (autoNewResizeHeight) autoNewResizeHeight(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
// 设计问题-穿透页面
|
|
function openDesignProblem() {
|
|
let width = getNewDefaultWidth().toFixed(0) + "px";
|
|
let height = getNewDefaultHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "designProblem",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
skin: "my-skin child-skin",
|
|
content: 'designProblem.html',
|
|
area: [width, height],
|
|
shade: 0.65,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
$(window).resize(function () {
|
|
if (autoNewResizeWidth) autoNewResizeWidth(index);
|
|
if (autoNewResizeHeight) autoNewResizeHeight(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
//工程统计
|
|
function getProtj(type) {
|
|
$('.main-right-box1-title button').each(function () {
|
|
if ($(this).hasClass('main-right-box4-btn')) {
|
|
proType = $(this).attr('btnValue')
|
|
}
|
|
})
|
|
let width = getNewDefaultWidth().toFixed(0) + "px";
|
|
let height = getNewDefaultHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "getProtj",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
skin: "my-skin child-skin",
|
|
content: 'proTj.html',
|
|
area: [width, height],
|
|
shade: 0.65,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(type, proType);
|
|
$(window).resize(function () {
|
|
if (autoNewResizeWidth) autoNewResizeWidth(index);
|
|
if (autoNewResizeHeight) autoNewResizeHeight(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
//日风险-穿透
|
|
function openDayRisk(buildName, riskLevel) {
|
|
let width = getNewDefaultWidth().toFixed(0) + "px";
|
|
let height = getNewDefaultHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "dayRisk",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
skin: "my-skin child-skin",
|
|
content: 'dayRisk.html',
|
|
area: [width, height],
|
|
shade: 0.65,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(buildName, riskLevel);
|
|
$(window).resize(function () {
|
|
if (autoNewResizeWidth) autoNewResizeWidth(index);
|
|
if (autoNewResizeHeight) autoNewResizeHeight(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
// 数据配置
|
|
function dataSetting() {
|
|
let width = getNewDefaultWidth().toFixed(0) + "px";
|
|
let height = getNewDefaultHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "dataSetting",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
skin: "my-skin child-skin",
|
|
content: 'dataSetting.html',
|
|
area: [width, height],
|
|
shade: 0.65,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
$(window).resize(function () {
|
|
if (autoNewResizeWidth) autoNewResizeWidth(index);
|
|
if (autoNewResizeHeight) autoNewResizeHeight(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
// 首页风险点定时刷新
|
|
function timedRefresh() {
|
|
if (scheduledTask && mapType === '3') {
|
|
getDayRiskByMap(1)
|
|
} else {
|
|
scheduledTask = true;
|
|
}
|
|
setTimeout(timedRefresh, 1000 * 60 * 5);
|
|
}
|
|
|
|
/*地图风险等级选中*/
|
|
$(".check-risk").click(function (e) {
|
|
let checkedName = $(this).find('p').eq(0).attr("checkedName");
|
|
let isCheck = $(this).attr("isCheck");
|
|
if (checkedName === '' && isCheck === '1') {
|
|
$('.check-risk').each(function () {
|
|
if ($(this).attr("isCheck") === '1') {
|
|
$(this).attr("isCheck", '0')
|
|
let checkedValue = $(this).find('p').eq(0).attr("checkedName");
|
|
$(this).find('img').eq(0).attr("src", setRiskIcon(checkedValue, 1))
|
|
}
|
|
})
|
|
} else if (checkedName === '' && isCheck === '0') {
|
|
$('.check-risk').each(function () {
|
|
if ($(this).attr("isCheck") === '0') {
|
|
$(this).attr("isCheck", '1')
|
|
let checkedValue = $(this).find('p').eq(0).attr("checkedName");
|
|
$(this).find('img').eq(0).attr("src", setRiskIcon(checkedValue, 2))
|
|
}
|
|
})
|
|
} else if (checkedName !== '' && isCheck === '1') {
|
|
$(this).attr("isCheck", '0')
|
|
$(this).find('img').eq(0).attr("src", setRiskIcon(checkedName, 1))
|
|
} else if (checkedName !== '' && isCheck === '0') {
|
|
$(this).attr("isCheck", '1')
|
|
$(this).find('img').eq(0).attr("src", setRiskIcon(checkedName, 2))
|
|
}
|
|
mapSearch();
|
|
});
|
|
|
|
// 设置风险等级选中样式
|
|
function setRiskIcon(value, type) {
|
|
if (value && type === 1) {
|
|
return '../../img/title-btn/no-check/risk-' + value + '-nocheck.png';
|
|
} else if (!value && type === 1) {
|
|
return '../../img/title-btn/no-check/risk-1-nocheck.png';
|
|
} else if (value && type === 2) {
|
|
return '../../img/title-btn/check/risk-' + value + '-check.png';
|
|
} else if (!value && type === 2) {
|
|
return '../../img/title-btn/check/risk-1-check.png';
|
|
}
|
|
}
|
|
|
|
/*地图关键字搜索、风险等级选中*/
|
|
function mapSearch() {
|
|
let selRiskList = [];
|
|
mapPointList.splice(0, mapPointList.length);
|
|
$('.check-risk').each(function () {
|
|
if ($(this).attr("isCheck") === '1') {
|
|
if ($(this).find('p').eq(0).attr("checkedName")) {
|
|
selRiskList.push($(this).find('p').eq(0).attr("checkedName"))
|
|
}
|
|
}
|
|
})
|
|
if (selRiskList.length) {
|
|
$.each(selRiskList, function (index, item) {
|
|
let dataList = mainMapPointList.filter(item2 => {
|
|
if(item === '4'){
|
|
return item2.riskLevel === '4' || item2.riskLevel === '5';
|
|
}else {
|
|
return item2.riskLevel === item
|
|
}
|
|
})
|
|
$.each(dataList, function (index3, item3) {
|
|
mapPointList.push(item3)
|
|
})
|
|
})
|
|
}
|
|
map(mapPointList, '3')
|
|
}
|
|
|
|
// 刷新首页数据(环水保、工程技术、绿色建造)
|
|
function reloadHomeData(type) {
|
|
if (type === 1) {
|
|
getEiaNum() //环水保
|
|
} else if (type === 2) {
|
|
getGcjsNum(); // 工程技术
|
|
} else if (type === 3) {
|
|
getAwardsList(); // 获奖情况
|
|
} else if (type === 4) {
|
|
getExcellRateByOrg(1); // 优良率
|
|
}
|
|
}
|
|
|
|
// 切换获奖情况
|
|
function switchAwards(){
|
|
$("#awards").removeClass("main-right-box4-btns");
|
|
$("#excellRate").removeClass("main-right-box4-btn");
|
|
$("#awards").addClass("main-right-box4-btn");
|
|
$("#excellRate").addClass("main-right-box4-btns");
|
|
$("#construction").hide();
|
|
$("#awardsText").show();
|
|
scrollAwards();
|
|
}
|
|
|
|
// 获奖情况定时滚动
|
|
function scrollAwards() {
|
|
clearInterval(interval)
|
|
let domInner = document.getElementById('awards-content');
|
|
let domInner2 = document.getElementById('awards-content2');
|
|
let dom = document.getElementById('awardsText');
|
|
domInner2.innerHTML = domInner.innerHTML;
|
|
dom.scrollTop = 0
|
|
|
|
function marqueen() {
|
|
if (domInner.offsetHeight <= dom.scrollTop) {
|
|
dom.scrollTop = 0;
|
|
} else {
|
|
dom.scrollTop = dom.scrollTop + 1;
|
|
}
|
|
}
|
|
|
|
interval = setInterval(function () {
|
|
marqueen();
|
|
}, 30)
|
|
dom.onmouseover = function () {
|
|
clearInterval(interval)
|
|
domInner2.style.cssText = 'display:none'
|
|
}
|
|
dom.onmouseout = function () {
|
|
domInner2.style.cssText = ''
|
|
interval = setInterval(function () {
|
|
marqueen();
|
|
}, 30)
|
|
}
|
|
}
|
|
|
|
// 关闭事件监听
|
|
function closeTitle() {
|
|
$(".layui-tab-close").click(function (e) {
|
|
let tabr = $(".layui-tab-title").find("li");
|
|
let length = tabr.length;
|
|
if (length === 0) {//全部关闭了则返回首页
|
|
$("#menu-childer").empty();
|
|
$("#menu-content").empty();
|
|
$("#layui-tab").hide();
|
|
$(".homeIndexContent").show();
|
|
$("#ifr-box ").css("background-image", "");
|
|
$('ul li').each(function () {
|
|
if ($(this).hasClass('layui-that') || $(this).hasClass('layui-this')) {
|
|
$(this).removeClass('layui-that')
|
|
$(this).removeClass('layui-this')
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
/*日期动态展示*/
|
|
showTime();
|
|
setInterval("showTime()", 1000);//间隔多少毫秒执行一次
|
|
function showTime() {
|
|
let dateTime = new Date();
|
|
let year = dateTime.getFullYear(); //获取年份
|
|
let month = dateTime.getMonth() + 1; //获取月份
|
|
month = month < 10 ? "0" + month : month; //月份小于10则前面加个"0"
|
|
let date = dateTime.getDate(); //获取日
|
|
date = date < 10 ? "0" + date : date;
|
|
let hour = dateTime.getHours(); //获取小时
|
|
hour = hour < 10 ? "0" + hour : hour;
|
|
let minute = dateTime.getMinutes(); //获取分钟
|
|
minute = minute < 10 ? "0" + minute : minute;
|
|
let second = dateTime.getSeconds(); //获取秒
|
|
second = second < 10 ? "0" + second : second;
|
|
let day = dateTime.getDay()
|
|
//年月日时分秒赋值给dateTime
|
|
dateTime = year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
|
|
$('.date').html(dateTime);
|
|
} |