From fb6e16a425e9ade08dbcca96d6a2f1c9b2f25b1e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 14 一月 2026 17:51:56 +0800
Subject: [PATCH] fix: 合格率统计调整:铜、铝合并为【导体】统计数据。明细表格字段更改和导出按钮
---
src/components/echarts/echarts.vue | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/components/echarts/echarts.vue b/src/components/echarts/echarts.vue
index 68de3a2..8e72a2e 100644
--- a/src/components/echarts/echarts.vue
+++ b/src/components/echarts/echarts.vue
@@ -18,13 +18,13 @@
chartStyle: {
type: Object,
default: () => ({
- height: '80%',
+ height: '95%',
width: '100%'
})
},
dataset: {
type: Object,
- default: () => {}
+ default: () => { }
},
xAxis: {
type: Array,
@@ -81,8 +81,8 @@
watch: {
options: {
deep: true,
- // immediate: true,
- handler(val) {
+ // immediate: true,
+ handler(val) {
this.$nextTick(() => {
this.renderChart()
})
@@ -198,6 +198,7 @@
},
renderChart() {
const option = {
+ ...this.options,
backgroundColor: this.options.backgroundColor || '#fff',
xAxis: this.xAxis,
yAxis: this.yAxis,
@@ -240,7 +241,26 @@
this.chartInstance.dispose()
this.chartInstance = null
}
+ },
+
+ // 涓嬭浇鍥剧墖鍔熻兘
+ downloadImage(fileName = 'chart') {
+ if (!this.chartInstance) return;
+
+ const url = this.chartInstance.getDataURL({
+ type: 'png',
+ pixelRatio: 2,
+ backgroundColor: '#fff'
+ });
+
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = `${fileName}.png`;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
}
+
},
}
</script>
--
Gitblit v1.9.3