diff --git a/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue b/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue index ec8e3d7c..c0c4ae93 100644 --- a/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue +++ b/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue @@ -1,138 +1,139 @@ \ No newline at end of file + `; + }) + .join(``) + ); + }, + }, + legend: { + right: '1%', + icon: 'rect', + itemHeight: 8, + itemWidth: 8, + }, + grid: { + left: '1%', + right: '1%', + bottom: '3%', + containLabel: true, + }, + yAxis: { + type: 'value', + boundaryGap: [0, 0.01], + }, + xAxis: { + type: 'category', + data: arr, + }, + series: yData, + }; + option && this.chart.setOption(option); + }, + }, +}; + diff --git a/src/views/energy/analysis/trendAnalysis/index.vue b/src/views/energy/analysis/trendAnalysis/index.vue index a40aaea7..4af97e6e 100644 --- a/src/views/energy/analysis/trendAnalysis/index.vue +++ b/src/views/energy/analysis/trendAnalysis/index.vue @@ -74,29 +74,12 @@ export default { }, // 导出excel exportExl(params) { - exportTrend({ ...params }).then((res) => { - // let fileName = ''; - // const contentDisposition = res.headers['content-disposition']; - // if (contentDisposition) { - // fileName = decodeURIComponent( - // contentDisposition.slice( - // contentDisposition.indexOf('filename=') + 9 - // ) - // ); - // } - const blob = new Blob([res.data]); - const reader = new FileReader(); - reader.readAsDataURL(blob); - reader.onload = (e) => { - const a = document.createElement('a'); - a.download = '走势分析'; - a.href = e.target.result; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); + exportTrend({ ...params }) + .then((response) => { + this.$download.excel(response, '走势分析.xls'); this.$message.success('导出成功'); - }; - }); + }) + .catch(() => {}); }, }, };