This commit is contained in:
2024-10-16 09:55:22 +08:00
parent 9fc6f013cc
commit 9699e90ab3
21 changed files with 1621 additions and 829 deletions

View File

@@ -150,6 +150,10 @@
<el-button type="primary" size="small" @click="search">查询</el-button>
<span class="separateStyle"></span>
<el-button size="small" @click="resetBtn">重置</el-button>
<span class="separateStyle"></span>
<el-button type="primary" size="small" @click="exportData" plain>
导出
</el-button>
</el-form-item>
</el-form>
<span v-if="isFold" class="foldClass" @click='switchMode'>
@@ -326,8 +330,16 @@ export default {
})
}
},
// 查询
search() {
if (this.validateData()) {
this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '';
this.$emit('submit', this.queryParams);
}
},
// 查询
search() {
validateData() {
if (!this.queryParams.energyTypeId) {
this.$modal.msgError('请选择能源类型')
return false
@@ -397,10 +409,7 @@ export default {
this.$modal.msgError('请选择对象')
return false
}
this.queryParams.startTime = this.queryParams.startTime + ''
this.queryParams.endTime = this.queryParams.endTime + ''
console.log(this.queryParams)
this.$emit('submit', this.queryParams)
return true;
},
resetBtn() {
this.queryParams.energyTypeId = null
@@ -436,7 +445,14 @@ export default {
} else {
element.classList.add('divHeight')
}
}
},
exportData() {
if (this.validateData()) {
this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '';
this.$emit('exportD', this.queryParams);
}
},
}
}
</script>
@@ -494,4 +510,4 @@ export default {
vertical-align: middle;
margin: 0 10px;
}
</style>
</style>

View File

@@ -1,7 +1,7 @@
<template>
<div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
<!-- 搜索工作栏 -->
<search-area :isFold="isFold" @submit="getList"/>
<search-area :isFold="isFold" @submit="getList" @exportD="exportData"/>
<div v-show="chartData.length">
<bar-chart
ref="analysisBarChart"
@@ -18,7 +18,7 @@
</div>
</template>
<script>
import { getCompare } from "@/api/analysis/energyAnalysis"
import { getCompare ,exportCompare} from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea"
import BarChart from "./components/barChart"
import tableHeightMixin from '@/mixins/tableHeightMixin';
@@ -85,32 +85,17 @@ export default {
}
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
},
// 导出
exportExl() {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(
document.querySelector('.contrast-out-table')
);
let fileName = '对比分析.xlsx';
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'array',
});
try {
FileSaver.saveAs(
new Blob([wbout], { type: 'application/octet-stream' }),
fileName
);
this.$message.success('导出成功');
} catch (e) {
if (typeof console !== 'undefined') console.log(e, wbout);
}
return wbout;
} else {
this.$modal.msgWarning('暂无数据导出');
}
},
/** 导出按钮操作 */
exportData(val) {
// 处理查询参数
this.$modal.confirm('是否确认导出对比分析数据?').then(() => {
this.exportLoading = true;
return exportCompare(val);
}).then(response => {
this.$download.excel(response, '对比分析数据.xlsx');
this.exportLoading = false;
}).catch(() => {});
}
}
}
</script>