数据分析-

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 URL_IP="http://192.168.0.234:28080/gdwebs/zhgd-web"
const commonUrl = "http://192.168.0.234:28080/zhgd/"; // const commonUrl = "http://192.168.0.234:28080/zhgd/";
const imgUrl = "http://192.168.0.234:28080/zhgd/file/files/"; // const imgUrl = "http://192.168.0.234:28080/zhgd/file/files/";
// const URL_IP="http://192.168.0.14:1999/gdwebs/zhgd-web" const URL_IP="http://192.168.0.14:1999/gdwebs/zhgd-web"
// const commonUrl = "http://192.168.0.14:1999/zhgd/"; const commonUrl = "http://192.168.0.14:1999/zhgd/";
// const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/"; const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/";
// const URL_IP="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web" // 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'; let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff';
const bidCode = parent.$('#bidPro').val(); const bidCode = parent.$('#bidPro').val();
@ -14,7 +14,7 @@ layui.use(["layer", "table", "form", "laydate"], function () {
rangeLinked: true, // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增 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()) $("#ID-laydate-end-date-1").val(getNowTime())
let startTime = ""; let startTime = "";
@ -28,21 +28,12 @@ layui.use(["layer", "table", "form", "laydate"], function () {
} }
getEnergyReduction(startTime, endTime) 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) { function getEnergyReduction(startTime, endTime) {
const url = const url =
commonUrl + commonUrl +
@ -55,10 +46,9 @@ function getEnergyReduction(startTime, endTime) {
}, },
function (result) { function (result) {
if (result.code === 200) { if (result.code === 200) {
setData(result.data); setData(result);
} else if (result.code === 500) { } else if (result.code === 500) {
console.error("实时监测" + result.msg); setData(result);
setData(null);
} else if (result.code === 401) { } else if (result.code === 401) {
loginout(1); loginout(1);
} }
@ -72,27 +62,109 @@ function getEnergyReduction(startTime, endTime) {
/* 实时检测赋值 */ /* 实时检测赋值 */
function setData(data) { function setData(data) {
console.log(data) if (data.code === 200) {
console.log(data.length) let energyUtilization = data.data.energyUtilization;
if (data) {
console.log(data)
let energyUtilization = data.energyUtilization;
updateCounter("power", energyUtilization); updateCounter("power", energyUtilization);
let waterUtilization = data.waterUtilization; let waterUtilization = data.data.waterUtilization;
updateCounter("water", waterUtilization); updateCounter("water", waterUtilization);
} else {
let power = data.echarts['发电量']; layer.msg(data.msg || "暂无数据");
let water = data.echarts['用水量']; updateCounter("power", "0");
let usePower = data.echarts['用电量']; updateCounter("water", "0");
let waterStorage = data.echarts['蓄水量'];
getWaterTrend(water, waterStorage);
getPowerTrend(power, usePower);
} }
} }
} }
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) { function updateCounter(prefix, value) {
// 确保值在有效范围内 // 确保值在有效范围内
const numValue = Math.max(0, Math.min(9999, parseInt(value) || 0)); const numValue = Math.max(0, Math.min(9999, parseInt(value) || 0));
@ -109,8 +181,8 @@ function updateCounter(prefix, value) {
} }
} }
function getWaterTrend(water, waterStorage){ function getWaterTrend(water, waterStorage) {
let date =[]; let date = [];
let waterDataNum = []; let waterDataNum = [];
let waterStorageDataNum = []; let waterStorageDataNum = [];
for (let i = 0; i < water.length; i++) { for (let i = 0; i < water.length; i++) {
@ -121,11 +193,11 @@ function getWaterTrend(water, waterStorage){
initWaterTrend(date, waterDataNum, waterStorageDataNum); initWaterTrend(date, waterDataNum, waterStorageDataNum);
} }
function initWaterTrend(date,waterDataNum,waterStorageDataNum) { function initWaterTrend(date, waterDataNum, waterStorageDataNum) {
const leftChart = echarts.init(document.getElementById("waterTrend")); const leftChart = echarts.init(document.getElementById("waterTrend"));
const option = { const option = {
tooltip: { tooltip: {
show:true, show: true,
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow', type: 'shadow',
@ -139,11 +211,11 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
padding: 10, padding: 10,
}, },
legend: { legend: {
show:true, show: true,
top:40, top: 40,
right:20, right: 20,
textStyle:{ textStyle: {
color:'#ffffff' color: '#ffffff'
} }
}, },
grid: { grid: {
@ -202,7 +274,7 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
color: 'rgba(255,255,255,0.8)', color: 'rgba(255,255,255,0.8)',
padding: 16 padding: 16
}, },
formatter: function(value) { formatter: function (value) {
if (value === 0) { if (value === 0) {
return value return value
} }
@ -219,18 +291,19 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
"xAxisIndex": [ "xAxisIndex": [
0 0
], ],
bottom:'8%', bottom: '8%',
"start": 10, "start": 10,
"end": 90, "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', 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%', handleSize: '110%',
handleStyle:{ handleStyle: {
color:"#d3dee5", color: "#d3dee5",
}, },
textStyle:{ textStyle: {
color:"#fff"}, color: "#fff"
borderColor:"#90979c" },
borderColor: "#90979c"
}, { }, {
"type": "inside", "type": "inside",
"show": true, "show": true,
@ -321,8 +394,8 @@ function initWaterTrend(date,waterDataNum,waterStorageDataNum) {
}); });
} }
function getPowerTrend(power, usePower){ function getPowerTrend(power, usePower) {
let date =[]; let date = [];
let powerDataNum = []; let powerDataNum = [];
let usePowerDataNum = []; let usePowerDataNum = [];
for (let i = 0; i < power.length; i++) { for (let i = 0; i < power.length; i++) {
@ -333,11 +406,11 @@ function getPowerTrend(power, usePower){
initPowerTrend(date, powerDataNum, usePowerDataNum); initPowerTrend(date, powerDataNum, usePowerDataNum);
} }
function initPowerTrend(date,powerDataNum,usePowerDataNum) { function initPowerTrend(date, powerDataNum, usePowerDataNum) {
const leftChart = echarts.init(document.getElementById("powerTrend")); const leftChart = echarts.init(document.getElementById("powerTrend"));
const option = { const option = {
tooltip: { tooltip: {
show:true, show: true,
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow', type: 'shadow',
@ -351,11 +424,11 @@ function initPowerTrend(date,powerDataNum,usePowerDataNum) {
padding: 10, padding: 10,
}, },
legend: { legend: {
show:true, show: true,
top:40, top: 40,
right:20, right: 20,
textStyle:{ textStyle: {
color:'#ffffff' color: '#ffffff'
} }
}, },
grid: { grid: {
@ -414,7 +487,7 @@ function initPowerTrend(date,powerDataNum,usePowerDataNum) {
color: 'rgba(255,255,255,0.8)', color: 'rgba(255,255,255,0.8)',
padding: 16 padding: 16
}, },
formatter: function(value) { formatter: function (value) {
if (value === 0) { if (value === 0) {
return value return value
} }
@ -431,18 +504,19 @@ function initPowerTrend(date,powerDataNum,usePowerDataNum) {
"xAxisIndex": [ "xAxisIndex": [
0 0
], ],
bottom:'8%', bottom: '8%',
"start": 10, "start": 10,
"end": 90, "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', 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%', handleSize: '110%',
handleStyle:{ handleStyle: {
color:"#d3dee5", color: "#d3dee5",
}, },
textStyle:{ textStyle: {
color:"#fff"}, color: "#fff"
borderColor:"#90979c" },
borderColor: "#90979c"
}, { }, {
"type": "inside", "type": "inside",
"show": true, "show": true,

View File

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

View File

@ -693,7 +693,19 @@ function warningList(warning){
{field: 'number', width:'10%',title: '序号', align: 'center', type: 'numbers'}, {field: 'number', width:'10%',title: '序号', align: 'center', type: 'numbers'},
{field: 'modeName', width:'30%', align: 'center', title: '预警类型'}, {field: 'modeName', width:'30%', align: 'center', title: '预警类型'},
{field: 'currentDay', 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 () { initComplete: function () {
// 在表格渲染完成后,重新渲染序号列 // 在表格渲染完成后,重新渲染序号列

View File

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

View File

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

View File

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

View File

@ -148,3 +148,15 @@ function getNowTime() {
var dateStr = year + "-" + month + "-" + day; var dateStr = year + "-" + month + "-" + day;
return dateStr; 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;
}