数据分析-

This commit is contained in:
lSun 2025-10-27 19:10:17 +08:00
parent a41169b29b
commit 2eb8eebde6
8 changed files with 302 additions and 151 deletions

View File

@ -8,13 +8,13 @@ let aqEnnable = false // 参数加密开关
//
const URL_IP="http://192.168.0.234:28080/gdwebs/zhgd-web"
const commonUrl = "http://192.168.0.234:28080/zhgd/";
const imgUrl = "http://192.168.0.234:28080/zhgd/file/files/";
// const URL_IP="http://192.168.0.234:28080/gdwebs/zhgd-web"
// const commonUrl = "http://192.168.0.234:28080/zhgd/";
// const imgUrl = "http://192.168.0.234:28080/zhgd/file/files/";
// const URL_IP="http://192.168.0.14:1999/gdwebs/zhgd-web"
// const commonUrl = "http://192.168.0.14:1999/zhgd/";
// const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/";
const URL_IP="http://192.168.0.14:1999/gdwebs/zhgd-web"
const commonUrl = "http://192.168.0.14:1999/zhgd/";
const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/";
// const URL_IP="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web"

View File

@ -1,4 +1,4 @@
let table, layer, form,laydate;
let table, layer, form, laydate;
let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff';
const bidCode = parent.$('#bidPro').val();
@ -14,7 +14,7 @@ layui.use(["layer", "table", "form", "laydate"], function () {
rangeLinked: true, // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
});
$("#ID-laydate-start-date-1").val(getNowTime())
$("#ID-laydate-start-date-1").val(getOneMonthAgo())
$("#ID-laydate-end-date-1").val(getNowTime())
let startTime = "";
@ -28,21 +28,12 @@ layui.use(["layer", "table", "form", "laydate"], function () {
}
getEnergyReduction(startTime, endTime)
//蓄水和用水趋势
getWaterList(startTime, endTime)
//发电和用电趋势
getEnergyList(startTime, endTime)
});
function query() {
let startTime = "";
let endTime = "";
if ($("#ID-laydate-start-date-1").val() != "") {
startTime = $("#ID-laydate-start-date-1").val();
endTime = $("#ID-laydate-end-date-1").val();
} else {
startTime = "";
endTime = "";
}
getEnergyReduction(startTime, endTime);
}
function getEnergyReduction(startTime, endTime) {
const url =
commonUrl +
@ -55,10 +46,9 @@ function getEnergyReduction(startTime, endTime) {
},
function (result) {
if (result.code === 200) {
setData(result.data);
setData(result);
} else if (result.code === 500) {
console.error("实时监测" + result.msg);
setData(null);
setData(result);
} else if (result.code === 401) {
loginout(1);
}
@ -72,27 +62,109 @@ function getEnergyReduction(startTime, endTime) {
/* 实时检测赋值 */
function setData(data) {
console.log(data)
console.log(data.length)
if (data) {
console.log(data)
let energyUtilization = data.energyUtilization;
if (data.code === 200) {
let energyUtilization = data.data.energyUtilization;
updateCounter("power", energyUtilization);
let waterUtilization = data.waterUtilization;
let waterUtilization = data.data.waterUtilization;
updateCounter("water", waterUtilization);
let power = data.echarts['发电量'];
let water = data.echarts['用水量'];
let usePower = data.echarts['用电量'];
let waterStorage = data.echarts['蓄水量'];
getWaterTrend(water, waterStorage);
getPowerTrend(power, usePower);
} else {
layer.msg(data.msg || "暂无数据");
updateCounter("power", "0");
updateCounter("water", "0");
}
}
}
function getWaterList(startTime, endTime) {
const url =
commonUrl +
"screen/energyReduction/getWaterList?startTime=" + startTime + "&endTime=" + endTime;
ajaxRequestGet(
url,
"GET",
true,
function () {
},
function (result) {
if (result.code === 200) {
setData(result);
} else if (result.code === 500) {
setData(result);
} else if (result.code === 401) {
loginout(1);
}
},
function (xhr, status, error) {
errorFn(xhr, status, error);
setData(null);
},
aqEnnable
);
function setData(data) {
if (data.code === 200) {
initWaterTrend(data.data.dayList, data.data.ysList, data.data.xsList);
} else {
layer.msg(data.msg || "暂无数据");
initWaterTrend("", "", "");
}
}
}
function getEnergyList(startTime, endTime) {
const url =
commonUrl +
"screen/energyReduction/getEnergyList?startTime=" + startTime + "&endTime=" + endTime;
ajaxRequestGet(
url,
"GET",
true,
function () {
},
function (result) {
if (result.code === 200) {
setData(result);
} else if (result.code === 500) {
setData(result);
} else if (result.code === 401) {
loginout(1);
}
},
function (xhr, status, error) {
errorFn(xhr, status, error);
setData(null);
},
aqEnnable
);
function setData(data) {
if (data.code === 200) {
initPowerTrend(data.data.dayList, data.data.fdList, data.data.ydList);
} else {
layer.msg(data.msg || "暂无数据");
initPowerTrend("", "", "");
}
}
}
function query() {
let startTime = "";
let endTime = "";
if ($("#ID-laydate-start-date-1").val() != "") {
startTime = $("#ID-laydate-start-date-1").val();
endTime = $("#ID-laydate-end-date-1").val();
} else {
startTime = "";
endTime = "";
}
getEnergyReduction(startTime, endTime);
//蓄水和用水趋势
getWaterList(startTime, endTime)
//发电和用电趋势
getEnergyList(startTime, endTime)
}
function updateCounter(prefix, value) {
// 确保值在有效范围内
const numValue = Math.max(0, Math.min(9999, parseInt(value) || 0));
@ -109,8 +181,8 @@ function updateCounter(prefix, value) {
}
}
function getWaterTrend(water, waterStorage){
let date =[];
function getWaterTrend(water, waterStorage) {
let date = [];
let waterDataNum = [];
let waterStorageDataNum = [];
for (let i = 0; i < water.length; i++) {
@ -121,11 +193,11 @@ function getWaterTrend(water, waterStorage){
initWaterTrend(date, waterDataNum, waterStorageDataNum);
}
function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
function initWaterTrend(date, waterDataNum, waterStorageDataNum) {
const leftChart = echarts.init(document.getElementById("waterTrend"));
const option = {
const option = {
tooltip: {
show:true,
show: true,
trigger: 'axis',
axisPointer: {
type: 'shadow',
@ -139,11 +211,11 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
padding: 10,
},
legend: {
show:true,
top:40,
right:20,
textStyle:{
color:'#ffffff'
show: true,
top: 40,
right: 20,
textStyle: {
color: '#ffffff'
}
},
grid: {
@ -202,7 +274,7 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
color: 'rgba(255,255,255,0.8)',
padding: 16
},
formatter: function(value) {
formatter: function (value) {
if (value === 0) {
return value
}
@ -219,18 +291,19 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
"xAxisIndex": [
0
],
bottom:'8%',
bottom: '8%',
"start": 10,
"end": 90,
handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
handleSize: '110%',
handleStyle:{
color:"#d3dee5",
handleStyle: {
color: "#d3dee5",
},
textStyle:{
color:"#fff"},
borderColor:"#90979c"
textStyle: {
color: "#fff"
},
borderColor: "#90979c"
}, {
"type": "inside",
"show": true,
@ -321,8 +394,8 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
});
}
function getPowerTrend(power, usePower){
let date =[];
function getPowerTrend(power, usePower) {
let date = [];
let powerDataNum = [];
let usePowerDataNum = [];
for (let i = 0; i < power.length; i++) {
@ -333,11 +406,11 @@ function getPowerTrend(power, usePower){
initPowerTrend(date, powerDataNum, usePowerDataNum);
}
function initPowerTrend(date,powerDataNum,usePowerDataNum) {
function initPowerTrend(date, powerDataNum, usePowerDataNum) {
const leftChart = echarts.init(document.getElementById("powerTrend"));
const option = {
const option = {
tooltip: {
show:true,
show: true,
trigger: 'axis',
axisPointer: {
type: 'shadow',
@ -351,11 +424,11 @@ function initPowerTrend(date,powerDataNum,usePowerDataNum) {
padding: 10,
},
legend: {
show:true,
top:40,
right:20,
textStyle:{
color:'#ffffff'
show: true,
top: 40,
right: 20,
textStyle: {
color: '#ffffff'
}
},
grid: {
@ -414,7 +487,7 @@ function initPowerTrend(date,powerDataNum,usePowerDataNum) {
color: 'rgba(255,255,255,0.8)',
padding: 16
},
formatter: function(value) {
formatter: function (value) {
if (value === 0) {
return value
}
@ -431,18 +504,19 @@ function initPowerTrend(date,powerDataNum,usePowerDataNum) {
"xAxisIndex": [
0
],
bottom:'8%',
bottom: '8%',
"start": 10,
"end": 90,
handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
handleSize: '110%',
handleStyle:{
color:"#d3dee5",
handleStyle: {
color: "#d3dee5",
},
textStyle:{
color:"#fff"},
borderColor:"#90979c"
textStyle: {
color: "#fff"
},
borderColor: "#90979c"
}, {
"type": "inside",
"show": true,

View File

@ -12,6 +12,9 @@ layui.use(['layer', 'table', 'form', 'laydate'], function () {
rangeLinked: true, // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
});
$("#ID-laydate-start-date-1").val(getOneMonthAgo())
$("#ID-laydate-end-date-1").val(getNowTime())
// 工程安全分析-一本账
initTable();
// 工程安全分析-球机列表
@ -193,7 +196,7 @@ function initTable2(startTime, endTime,ballName) {
}*/
if (item.imagePath) { // 检查是否有Base64图像数据
const img = document.createElement("img");
img.src = item.imagePath; // 直接使用Base64数据
img.src = "data:image/png;base64," + item.imagePath; // 直接使用Base64数据
img.style.cssText = `width: 100%;height: 100%;object-fit: cover;`;
img.onerror = function () {
// 图片加载失败时显示文字

View File

@ -693,7 +693,19 @@ function warningList(warning){
{field: 'number', width:'10%',title: '序号', align: 'center', type: 'numbers'},
{field: 'modeName', width:'30%', align: 'center', title: '预警类型'},
{field: 'currentDay', width:'30%', align: 'center', title: '预警时间'},
{field: 'deviceName', width:'30%', align: 'center', title: '预警内容'},
{field: '', width:'30%', align: 'center', title: '预警内容',
templet: function (d) {
var val = d.val;
var unit = d.unit;
var html = '';
if (unit) {
html = val + unit;
}else{
html = val
}
return html;
}
},
]],
initComplete: function () {
// 在表格渲染完成后,重新渲染序号列

View File

@ -15,7 +15,7 @@ layui.use(["layer", "table", "form", "laydate"], function () {
rangeLinked: true, // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
});
$("#ID-laydate-start-date-1").val(getNowTime())
$("#ID-laydate-start-date-1").val(getOneMonthAgo())
$("#ID-laydate-end-date-1").val(getNowTime())
let startTime = "";

View File

@ -15,7 +15,7 @@ layui.use(["layer", "table", "form", "laydate"], function () {
rangeLinked: true, // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
});
$("#ID-laydate-start-date-1").val(getNowTime())
$("#ID-laydate-start-date-1").val(getOneMonthAgo())
$("#ID-laydate-end-date-1").val(getNowTime())
let startTime = "";

View File

@ -13,7 +13,7 @@ layui.use(["layer", "table", "form", "laydate"], function () {
rangeLinked: true, // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
});
$("#ID-laydate-start-date-1").val(getNowTime())
$("#ID-laydate-start-date-1").val(getOneMonthAgo())
$("#ID-laydate-end-date-1").val(getNowTime())
let startTime = "";
@ -25,23 +25,15 @@ layui.use(["layer", "table", "form", "laydate"], function () {
startTime = "";
endTime = "";
}
//echarts图
getProProgress(startTime, endTime);
//土建列表
getTjProgressList(startTime, endTime);
//电气列表
getDqProgressList(startTime, endTime);
});
function query() {
let startTime = "";
let endTime = "";
if ($("#ID-laydate-start-date-1").val() != "") {
startTime = $("#ID-laydate-start-date-1").val();
endTime = $("#ID-laydate-end-date-1").val();
} else {
startTime = "";
endTime = "";
}
getProProgress(startTime, endTime);
}
function getProProgress(startTime, endTime) {
function getProProgress(startTime, endTime){
const url =
commonUrl +
"screen/proProgress/selectProProgress?startTime=" + startTime + "&endTime=" + endTime;
@ -53,10 +45,9 @@ function getProProgress(startTime, endTime) {
},
function (result) {
if (result.code === 200) {
setData(result.data);
setData(result);
} else if (result.code === 500) {
console.error("实时监测" + result.msg);
setData(null);
setData(result);
} else if (result.code === 401) {
loginout(1);
}
@ -68,59 +59,118 @@ function getProProgress(startTime, endTime) {
aqEnnable
);
/* 实时检测赋值 */
function setData(data) {
if (data) {
var civilEngineeringData = data["变电土建专业"];
if (civilEngineeringData) {
var civilEngineeringEchartsData = civilEngineeringData["echarts"];
getCivilEngineering(civilEngineeringEchartsData)
var civilEngineeringPercentData = civilEngineeringData["percent"];
initCivilEngineeringPercent(civilEngineeringPercentData)
if(data.code === 200){
var list = data.data
var date = list.day;
var plannedCounttj = list.tjplanNum;
var actualCounttj = list.tjexeNum;
var plannedCountdq = list.dqplanNum;
var actualCountdq = list.dqexeNum;
initCivilEngineering(date, plannedCounttj, actualCounttj)
initElectrical(date, plannedCountdq, actualCountdq)
}else{
layer.msg(data.msg || "暂无数据");
initCivilEngineering("","","")
initElectrical("", "", "")
}
}
}
function getTjProgressList(startTime, endTime){
const url =
commonUrl +
"screen/proProgress/getTjProgressList?startTime=" + startTime + "&endTime=" + endTime;
ajaxRequestGet(
url,
"GET",
true,
function () {
},
function (result) {
if (result.code === 200) {
setData(result);
} else if (result.code === 500) {
setData(result);
} else if (result.code === 401) {
loginout(1);
}
},
function (xhr, status, error) {
errorFn(xhr, status, error);
setData(null);
},
aqEnnable
);
function setData(data) {
if(data.code === 200){
initCivilEngineeringPercent(data.data)
}else{
layer.msg(data.msg || "暂无数据");
initCivilEngineeringPercent("")
}
}
var electricalData = data["变电电气专业"];
if (electricalData) {
var electricalEchartsData = electricalData["echarts"];
getElectrical(electricalEchartsData)
var electricalPercentData =electricalData["percent"];
initElectricalPercentPercent(electricalPercentData)
}
function getDqProgressList(startTime, endTime){
const url =
commonUrl +
"screen/proProgress/getDqProgressList?startTime=" + startTime + "&endTime=" + endTime;
ajaxRequestGet(
url,
"GET",
true,
function () {
},
function (result) {
if (result.code === 200) {
setData(result);
} else if (result.code === 500) {
setData(result);
} else if (result.code === 401) {
loginout(1);
}
},
function (xhr, status, error) {
errorFn(xhr, status, error);
setData(null);
},
aqEnnable
);
function setData(data) {
if(data.code === 200){
initElectricalPercentPercent(data.data)
}else{
layer.msg(data.msg || "暂无数据");
initElectricalPercentPercent()
}
}
}
function getCivilEngineering(civilEngineeringEchartsData) {
let date = []
let plannedCount = []
let actualCount = []
if (civilEngineeringEchartsData) {
for (let i = 0; i < civilEngineeringEchartsData.length; i++) {
date.push(civilEngineeringEchartsData[i].date)
plannedCount.push(civilEngineeringEchartsData[i].plannedCount)
actualCount.push(civilEngineeringEchartsData[i].actualCount)
}
function query() {
let startTime = "";
let endTime = "";
if ($("#ID-laydate-start-date-1").val() != "") {
startTime = $("#ID-laydate-start-date-1").val();
endTime = $("#ID-laydate-end-date-1").val();
} else {
startTime = "";
endTime = "";
}
initCivilEngineering(date, plannedCount, actualCount)
//echarts图
getProProgress(startTime, endTime);
//土建列表
getTjProgressList(startTime, endTime);
//电气列表
getDqProgressList(startTime, endTime);
}
function getElectrical(electricalEchartsData) {
let date = []
let plannedCount = []
let actualCount = []
if (electricalEchartsData) {
for (let i = 0; i < electricalEchartsData.length; i++) {
date.push(electricalEchartsData[i].date)
plannedCount.push(electricalEchartsData[i].plannedCount)
actualCount.push(electricalEchartsData[i].actualCount)
}
}
initElectrical(date, plannedCount, actualCount)
}
// 初始化
function initCivilEngineering(date, plannedCount, actualCount) {
@ -527,30 +577,30 @@ function initElectrical(date, plannedCount, actualCount) {
function initCivilEngineeringPercent(civilEngineeringPercentData) {
let civilEngineeringPercent = document.getElementById('civilEngineeringPercent');
if (civilEngineeringPercentData) {
civilEngineeringPercentData.forEach(item => {
civilEngineeringPercentData.forEach((item, index) => {
const html = `
<div class="border">
<div class="title">
0${item.id} ${item.proGx}
${index + 1} ${item.proType}
</div>
<div class="progress-group">
<div class="label">计划 ${item.planStartTime} ~ ${item.planEndTime} / 共${item.planDays}</div>
<div class="label">计划 ${item.planStartTime} ~ ${item.planEndTime} / 共${item.planDay}</div>
<div class="progress-bar-container">
<div class="percentage-box">计划</div>
<div class="progress-bar-container-box">
<div class="progress-bar-box" style="width: ${item.planPercent}%;"></div>
<div class="progress-bar-box" style="width: ${item.planAccess}%;"></div>
</div>
<div class="percentage-box">${item.planPercent}%</div>
<div class="percentage-box">${item.planAccess}%</div>
</div>
</div>
<div class="progress-group">
<div class="label">实际 ${item.startTime} ~ ${item.endTime} / 共${item.actualDays}</div>
<div class="label">实际 ${item.startTime} ~ ${item.endTime} / 共${item.exeDay}</div>
<div class="progress-bar-container">
<div class="percentage-box">实际</div>
<div class="progress-bar-container-box">
<div class="progress-bar-box-sj" style="width: ${item.actualPercent}%;"></div>
<div class="progress-bar-box-sj" style="width: ${item.exeAccess}%;"></div>
</div>
<div class="percentage-box">${item.actualPercent}%</div>
<div class="percentage-box">${item.exeAccess}%</div>
</div>
</div>
</div>
@ -563,30 +613,30 @@ function initCivilEngineeringPercent(civilEngineeringPercentData) {
function initElectricalPercentPercent(electricalPercentData) {
let electricalPercent = document.getElementById('electricalPercent');
if (electricalPercentData) {
electricalPercentData.forEach(item => {
electricalPercentData.forEach((item, index) => {
const html = `
<div class="border">
<div class="title">
0${item.id} ${item.proGx}
${index + 1} ${item.proType}
</div>
<div class="progress-group">
<div class="label">计划 ${item.planStartTime} ~ ${item.planEndTime} / 共${item.planDays}</div>
<div class="label">计划 ${item.planStartTime} ~ ${item.planEndTime} / 共${item.planDay}</div>
<div class="progress-bar-container">
<div class="percentage-box">计划</div>
<div class="progress-bar-container-box">
<div class="progress-bar-box" style="width: ${item.planPercent}%;"></div>
<div class="progress-bar-box" style="width: ${item.planAccess}%;"></div>
</div>
<div class="percentage-box">${item.planPercent}%</div>
<div class="percentage-box">${item.planAccess}%</div>
</div>
</div>
<div class="progress-group">
<div class="label">实际 ${item.startTime} ~ ${item.endTime} / 共${item.actualDays}</div>
<div class="label">实际 ${item.startTime} ~ ${item.endTime} / 共${item.exeDay}</div>
<div class="progress-bar-container">
<div class="percentage-box">实际</div>
<div class="progress-bar-container-box">
<div class="progress-bar-box-sj" style="width: ${item.actualPercent}%;"></div>
<div class="progress-bar-box-sj" style="width: ${item.exeAccess}%;"></div>
</div>
<div class="percentage-box">${item.actualPercent}%</div>
<div class="percentage-box">${item.exeAccess}%</div>
</div>
</div>
</div>

View File

@ -148,3 +148,15 @@ function getNowTime() {
var dateStr = year + "-" + month + "-" + day;
return dateStr;
}
// 获取一个月前的时间
function getOneMonthAgo() {
var nowDate = new Date();
nowDate.setMonth(nowDate.getMonth() - 1); // 设置为一个月前
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) :
nowDate.getMonth() + 1;
var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
var dateStr = year + "-" + month + "-" + day;
return dateStr;
}