From 0b6b578d25467f7b466fedeec630a987060ae4bc Mon Sep 17 00:00:00 2001 From: ljx <15723110242@139.com> Date: Tue, 26 Aug 2025 19:35:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B5=84=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../largeScreen/components/optionList.ts | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/views/largeScreen/components/optionList.ts b/src/views/largeScreen/components/optionList.ts index 0daec3b..2a6572f 100644 --- a/src/views/largeScreen/components/optionList.ts +++ b/src/views/largeScreen/components/optionList.ts @@ -1,3 +1,4 @@ +import { to } from 'await-to-js'; import * as echarts from 'echarts/core'; import { text } from 'stream/consumers'; // import { PictorialBarChart } from 'echarts/charts' @@ -255,7 +256,6 @@ export const getLineOption = (lineData: any) => { const maxData = Math.max(...lineData.line1.flat()); const option = { - backgroundColor: '', tooltip: { trigger: 'axis', @@ -313,7 +313,7 @@ export const getLineOption = (lineData: any) => { axisLabel: { textStyle: { color: '#fff' - }, + } } }, yAxis: { @@ -579,10 +579,10 @@ export const getDishesOption = (data?: any) => { // 菜品库存图 export const getInventoryOption = () => { const res = { - data: [2800, 300, 3900, 3000, 2450, 2670, 3320], - name: ['麻辣牛肉', '水煮肉片', '酸菜鱼', '辣子鸡丁', '烧白', '冬瓜排骨汤', '清炒油麦菜'], - ratio: [4000, 4000, 4000, 4000, 4000, 4000, 4000] - }, + data: [2800, 300, 3900, 3000, 2450, 2670, 3320], + name: ['麻辣牛肉', '水煮肉片', '酸菜鱼', '辣子鸡丁', '烧白', '冬瓜排骨汤', '清炒油麦菜'], + ratio: [4000, 4000, 4000, 4000, 4000, 4000, 4000] + }, dataIndex = 1; const option = { xAxis: { @@ -698,13 +698,13 @@ export const getBarOptions = (data: any) => { const option = { backgroundColor: '', grid: { - left: '8%', - top: '10%', // 顶部留一点空间给 legend + left: '9%', + top: '10%', // 顶部留一点空间给 legend bottom: '8%', right: '2%' }, legend: { - data: ['现金流入', '现金流出'], // 与 series.name 对应 + data: ['现金流入', '现金流出'], // 与 series.name 对应 top: '0%', textStyle: { color: '#fff', fontSize: 12 } }, @@ -716,7 +716,8 @@ export const getBarOptions = (data: any) => { formatter: (params: any) => { // params 是数组,对应每条柱子 return params - .map((p: any) => `${p.seriesName}:${p.value} 万元`) + .map((p: any) => `${p.seriesName}:${Number(p.value).toFixed(2)} 万元`) + .join('
'); }, textStyle: { @@ -758,8 +759,11 @@ export const getBarOptions = (data: any) => { { axisLabel: { formatter: function (value) { - value = value + '万'; - return value; + if (value >= 1000) { + return value / 1000 + '千万'; + } else { + return value + '万'; + } }, color: 'rgba(255, 255, 255, 0.8)' }, @@ -825,7 +829,9 @@ export const getBarOptions = (data: any) => { }, label: { show: false, - formatter: '{c}', + formatter: function (params) { + return Number(params.value).toFixed(2); + }, position: 'top', color: '#fff', fontSize: 10 @@ -864,11 +870,12 @@ export const getBarOptions = (data: any) => { }, label: { show: true, - formatter: '{c}', + formatter: function (params) { + return Number(params.value).toFixed(2); + }, position: 'top', color: '#fff', - fontSize: 10, - padding: 5 + fontSize: 10 } } ] @@ -898,7 +905,6 @@ export const getBarOptions2 = (data: any) => { tooltip: { trigger: 'item', show: true - }, legend: { top: '5%', @@ -929,10 +935,10 @@ export const getBarOptions2 = (data: any) => { { value: 3, name: '100万以下' }, { value: 4, name: '100-500万' }, { value: 5, name: '500-1000万' }, - { value: 4, name: '1000万以上' }, + { value: 4, name: '1000万以上' } ] } ] }; return option; -} \ No newline at end of file +};