修改测试bug

This commit is contained in:
GGJ
2024-10-22 10:50:47 +08:00
parent 29150a3c82
commit 7d2394f75d
6 changed files with 126 additions and 65 deletions

View File

@@ -39,7 +39,8 @@ import { reactive } from 'vue'
import DatePicker from '@/components/form/datePicker/index.vue'
import { getDeviceDataTrend } from '@/api/cs-harmonic-boot/datatrend'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { yMethod } from '@/utils/echartMethod'
import { yMethod, exportCSV } from '@/utils/echartMethod'
import { ITEM_RENDER_EVT } from 'element-plus/es/components/virtual-list/src/defaults'
interface Props {
detail: anyObj
@@ -121,11 +122,11 @@ const init = () => {
})
let [min, max] = yMethod(arr.map((item: any) => item.statisticalData.toFixed(2)))
echartsData.value = {
options: {
grid: {
top: '50px',
top: '60px',
left: '10px',
right: '20px',
bottom: '40px',
@@ -160,7 +161,7 @@ const init = () => {
})
},
title: {
text: props.detail.name?.split('(')[0],
text: props.detail.name?.split('(')[0],
},
tooltip: {
axisPointer: {
@@ -187,9 +188,7 @@ const init = () => {
yAxis: {
name: `单位:(${arr[0].unit == null ? ' / ' : arr[0].unit})`,
type: 'value',
axisLine: {
show: true
},
min: min,
max: max,
@@ -246,6 +245,21 @@ const init = () => {
// return value.split(' ').join('\n')
// }
// }
},
toolbox: {
featureProps: {
myTool1: {
show: true,
title: '下载csv',
icon: 'path://M733.549304 0l116.434359 116.23452-226.402521 226.40252 57.053835 57.068109 226.459617-226.445342 120.616689 120.41685V0H733.549304zM689.513507 619.855586l-57.068108 57.068109 224.232847 224.232847-122.64362 122.843458h293.676657V729.838022l-114.007751 114.207588-224.190025-224.190024zM338.197775 404.144414l57.068109-57.068109L171.033037 122.843458 293.676657 0H0v294.161978l114.022025-114.207588 224.17575 224.190024zM347.076305 624.294851L120.616689 850.754468 0 730.323343v293.676657h294.161978l-116.420084-116.23452 226.40252-226.40252-57.068109-57.068109z',
onclick: (e) => {
echartsData.value
console.log("🚀 ~ init ~ echartsData.value:", echartsData.value.options.series.map(item => item.name))
exportCSV(echartsData.value.options.series.map(item => item.name),dataList, 'aaa.csv')
// downloadCSV(dataList, 'data.csv');
}
}
}
}
}
if ((echartsData.value.legend = ['A相', 'B相', 'C相'])) {
@@ -257,6 +271,15 @@ const init = () => {
loading.value = false
})
}
const dataList = [
{ x: 'A', y: 10 },
{ x: 'B', y: 20 },
{ x: 'C', y: 30 }
// ... 其他数据点
];
defineExpose({ open })
</script>
<style lang="scss">