完成水电表列表
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
<script name="repairEcharts" setup lang="ts">
|
||||
import Echarts from '@/components/Echarts/index.vue';
|
||||
import { getLast7Days } from '@/utils/time';
|
||||
import { EChartsOption } from 'echarts';
|
||||
|
||||
// 生成过去7天的日期
|
||||
const getLast7Days = (days = 7) => {
|
||||
const dates = [];
|
||||
for (let i = days - 1; i >= 0; i--) {
|
||||
dates.push(new Date(new Date().getTime() - i * 24 * 60 * 60 * 1000).toLocaleDateString());
|
||||
}
|
||||
return dates;
|
||||
};
|
||||
const chartConfig = shallowRef<EChartsOption>({
|
||||
grid: {
|
||||
left: '1%',
|
||||
@@ -24,11 +16,15 @@ const chartConfig = shallowRef<EChartsOption>({
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [5, 92, 12, 34, 120, 10, 120],
|
||||
data: [100, 140, 230, 100, 130, 180, 173],
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
name: '维修单数',
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
@@ -45,32 +41,14 @@ const chartConfig = shallowRef<EChartsOption>({
|
||||
lineStyle: {
|
||||
color: '#1a75ff'
|
||||
},
|
||||
itemStyle: {
|
||||
color: '#1a75ff'
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
color: '#3f8afc',
|
||||
position: 'top'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: [5, 92, 12, 34, 120, 10, 120].reverse(),
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1, // 从上到下渐变
|
||||
colorStops: [
|
||||
{ offset: 0, color: '#e2edff' }, // 顶部:半透明蓝色
|
||||
{ offset: 1, color: '#f2f9ff' } // 底部:极浅蓝/透明
|
||||
]
|
||||
}
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#ffc800'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user