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

环比同比更新

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