优化资金

This commit is contained in:
ljx
2025-08-26 19:35:21 +08:00
parent c1d6a8d92c
commit 0b6b578d25

View File

@ -1,3 +1,4 @@
import { to } from 'await-to-js';
import * as echarts from 'echarts/core'; import * as echarts from 'echarts/core';
import { text } from 'stream/consumers'; import { text } from 'stream/consumers';
// import { PictorialBarChart } from 'echarts/charts' // import { PictorialBarChart } from 'echarts/charts'
@ -255,7 +256,6 @@ export const getLineOption = (lineData: any) => {
const maxData = Math.max(...lineData.line1.flat()); const maxData = Math.max(...lineData.line1.flat());
const option = { const option = {
backgroundColor: '', backgroundColor: '',
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@ -313,7 +313,7 @@ export const getLineOption = (lineData: any) => {
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: '#fff' color: '#fff'
}, }
} }
}, },
yAxis: { yAxis: {
@ -579,10 +579,10 @@ export const getDishesOption = (data?: any) => {
// 菜品库存图 // 菜品库存图
export const getInventoryOption = () => { export const getInventoryOption = () => {
const res = { const res = {
data: [2800, 300, 3900, 3000, 2450, 2670, 3320], data: [2800, 300, 3900, 3000, 2450, 2670, 3320],
name: ['麻辣牛肉', '水煮肉片', '酸菜鱼', '辣子鸡丁', '烧白', '冬瓜排骨汤', '清炒油麦菜'], name: ['麻辣牛肉', '水煮肉片', '酸菜鱼', '辣子鸡丁', '烧白', '冬瓜排骨汤', '清炒油麦菜'],
ratio: [4000, 4000, 4000, 4000, 4000, 4000, 4000] ratio: [4000, 4000, 4000, 4000, 4000, 4000, 4000]
}, },
dataIndex = 1; dataIndex = 1;
const option = { const option = {
xAxis: { xAxis: {
@ -698,13 +698,13 @@ export const getBarOptions = (data: any) => {
const option = { const option = {
backgroundColor: '', backgroundColor: '',
grid: { grid: {
left: '8%', left: '9%',
top: '10%', // 顶部留一点空间给 legend top: '10%', // 顶部留一点空间给 legend
bottom: '8%', bottom: '8%',
right: '2%' right: '2%'
}, },
legend: { legend: {
data: ['现金流入', '现金流出'], // 与 series.name 对应 data: ['现金流入', '现金流出'], // 与 series.name 对应
top: '0%', top: '0%',
textStyle: { color: '#fff', fontSize: 12 } textStyle: { color: '#fff', fontSize: 12 }
}, },
@ -716,7 +716,8 @@ export const getBarOptions = (data: any) => {
formatter: (params: any) => { formatter: (params: any) => {
// params 是数组,对应每条柱子 // params 是数组,对应每条柱子
return params return params
.map((p: any) => `${p.seriesName}${p.value} 万元`) .map((p: any) => `${p.seriesName}${Number(p.value).toFixed(2)} 万元`)
.join('<br/>'); .join('<br/>');
}, },
textStyle: { textStyle: {
@ -758,8 +759,11 @@ export const getBarOptions = (data: any) => {
{ {
axisLabel: { axisLabel: {
formatter: function (value) { formatter: function (value) {
value = value + '万'; if (value >= 1000) {
return value; return value / 1000 + '千万';
} else {
return value + '万';
}
}, },
color: 'rgba(255, 255, 255, 0.8)' color: 'rgba(255, 255, 255, 0.8)'
}, },
@ -825,7 +829,9 @@ export const getBarOptions = (data: any) => {
}, },
label: { label: {
show: false, show: false,
formatter: '{c}', formatter: function (params) {
return Number(params.value).toFixed(2);
},
position: 'top', position: 'top',
color: '#fff', color: '#fff',
fontSize: 10 fontSize: 10
@ -864,11 +870,12 @@ export const getBarOptions = (data: any) => {
}, },
label: { label: {
show: true, show: true,
formatter: '{c}', formatter: function (params) {
return Number(params.value).toFixed(2);
},
position: 'top', position: 'top',
color: '#fff', color: '#fff',
fontSize: 10, fontSize: 10
padding: 5
} }
} }
] ]
@ -898,7 +905,6 @@ export const getBarOptions2 = (data: any) => {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
show: true show: true
}, },
legend: { legend: {
top: '5%', top: '5%',
@ -929,10 +935,10 @@ export const getBarOptions2 = (data: any) => {
{ value: 3, name: '100万以下' }, { value: 3, name: '100万以下' },
{ value: 4, name: '100-500万' }, { value: 4, name: '100-500万' },
{ value: 5, name: '500-1000万' }, { value: 5, name: '500-1000万' },
{ value: 4, name: '1000万以上' }, { value: 4, name: '1000万以上' }
] ]
} }
] ]
}; };
return option; return option;
} };