Commit 9c034f4d authored by 朱超's avatar 朱超

环比同比更新

parent 061a9056
......@@ -229,9 +229,12 @@ function getEnterprise() {
}
function transferIdChange() {
if (enertyInfo.transferId.length > 10) {
if (networkType.value == 2) {
if (enertyInfo.idList.length > 10) {
ElMessage.error("换热机组最多只能选择10个");
}
} else {
}
}
function exportTableToExcel() {
......@@ -243,7 +246,7 @@ function exportTableToExcel() {
transferName: element.transferName,
gatherTime: element.gatherTime.replace("T", " "),
temperature: element.temperature,
record: element.record,
record: parseFloat(element.record),
};
exlData.push(tableArr);
});
......@@ -415,6 +418,10 @@ function selTypeChange() {
//换热站机组能耗数据接口(用量环比)
function postExternalQOQFun() {
if (enertyInfo.idList.length > 10) {
ElMessage.error("换热机组最多只能选择10个");
return false;
}
loading.value = true;
echarts.dispose(document.getElementById("echartsLayer"));
tableData.length = 0;
......@@ -488,6 +495,37 @@ function clearData() {
function pageInitFun(res) {
tableData.length = 0;
let tableArr = [];
if (networkType.value == 2) {
if (res.data.hourWater.length > 0) {
res.data.hourWater.forEach((element) => {
tableArr = {
transferName: element.transferName,
gatherTime: element.gatherTime.replace("T", " "),
temperature: element.temperature,
record: parseFloat(element.record).toFixed(2),
};
tableData.push(tableArr);
});
} else {
return false;
}
} else {
if (res.data.data.length > 0) {
res.data.data.forEach((element) => {
tableArr = {
transferName: element.supplyName,
gatherTime: element.gatherTime.replace("T", " "),
temperature: element.temperature,
record: parseFloat(element.record).toFixed(2),
};
tableData.push(tableArr);
});
} else {
return false;
}
}
// res.data.hourWater.forEach((element) => {
// let tableArr = {
// transferName: element.transferName,
......@@ -503,10 +541,13 @@ function pageInitFun(res) {
echartSeries.length = 0;
echartDataLegend.length = 0;
echartDataTime.length = 0;
if (res.data.hourWater.length > 0) {
tableData.value = res.data.hourWater;
nodata.value = true;
echartData.value = dataDeal(res.data.hourWater);
if (networkType.value == 2) {
echartData.value = dataDeal(tableData.value);
} else {
echartData.value = dataDeal(tableData);
}
echartData.value[0].listInfo.forEach((element) => {
if (element.gatherTime) {
echartDataTime.push(element.gatherTime);
......@@ -563,7 +604,6 @@ function pageInitFun(res) {
echartDataLegend.push(element.name);
});
echartInit();
}
}
function setContentHeight() {
......
......@@ -391,13 +391,13 @@ function exportTableToExcel() {
},
};
XLSX.utils.book_append_sheet(workbook, worksheet, "换热站趋势");
XLSX.utils.book_append_sheet(workbook, worksheet, "用量同比");
const excelBuffer = XLSX.write(workbook, { bookType: "xlsx", type: "array" });
const dataBlob = new Blob([excelBuffer], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",
});
const downloadUrl = URL.createObjectURL(dataBlob);
saveAs(dataBlob, "tableData.xlsx");
saveAs(dataBlob, "用量同比.xlsx");
ElMessage.success("导出成功!请稍后。。。");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment