From 35e6e8ab445a97b586346a4f4f2f0e1368229817 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Mon, 1 Apr 2024 09:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home/index.ts | 8 + src/views/home/echarts-data.ts | 459 ++++++++++++++++++++++++++++++++- src/views/home/index.vue | 453 ++++++++++++++++++++++++++------ 3 files changed, 845 insertions(+), 75 deletions(-) diff --git a/src/api/home/index.ts b/src/api/home/index.ts index b02f396..62ed75b 100644 --- a/src/api/home/index.ts +++ b/src/api/home/index.ts @@ -5,4 +5,12 @@ export const getData = async () => { return await request.get({ url: `/eam/home-page/select` }) } +// 获取年度指标 +export const getYearTarget = async () => { + return await request.get({ url: `/eam/home-page/selectYearIndex` }) +} +// 获取年度指标 +export const getChartsData = async (factory) => { + return await request.get({ url: `/eam/home-page/selectMonthGraphByFactory?factory=`+factory }) +} diff --git a/src/views/home/echarts-data.ts b/src/views/home/echarts-data.ts index 0768782..0239b0c 100644 --- a/src/views/home/echarts-data.ts +++ b/src/views/home/echarts-data.ts @@ -2,6 +2,456 @@ import { EChartsOption } from 'echarts' const { t } = useI18n() +export const lineOptions1: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions2: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions3: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions4: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions5: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions6: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions7: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions8: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} +export const lineOptions9: EChartsOption = { + xAxis: { + data: [ 1, 2, 3,4,5,6,7,8,9,10,11,12], + boundaryGap: false, + axisTick: { + show: false + } + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 50, + containLabel: true + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + padding: [5, 10] + }, + yAxis: { + axisTick: { + show: false + } + }, + legend: { + data: ['目标','实际'], + top: 20 + }, + series: [ + { + name: '实际', + smooth: true, + type: 'line', + itemStyle: {}, + data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], + animationDuration: 2800, + animationEasing: 'quadraticOut', + },{ + name: '目标', + smooth: true, + type: 'line', + data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], + animationDuration: 2800, + animationEasing: 'cubicInOut' + } + ] +} export const lineOptions: EChartsOption = { xAxis: { @@ -50,11 +500,16 @@ export const lineOptions: EChartsOption = { itemStyle: {}, data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], animationDuration: 2800, - animationEasing: 'quadraticOut' + animationEasing: 'quadraticOut', + markLine: { + data: [{ + name: 'Y 轴值为 100 的水平线', + yAxis: 100 + }] + } } ] } - export const pieOptions: EChartsOption = { // title: { // text: t('analysis.userAccessSource'), diff --git a/src/views/home/index.vue b/src/views/home/index.vue index f20cd10..c833f88 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -114,18 +114,42 @@