| | |
| | | import { ref, onMounted } from 'vue' |
| | | import Echarts from '@/components/Echarts/echarts.vue' |
| | | import PanelHeader from './PanelHeader.vue' |
| | | import { profitTrendAnalysis } from '@/api/viewIndex.js' |
| | | |
| | | const chartStyle = { width: '100%', height: '150%' } |
| | | const grid = { left: '3%', right: '4%', bottom: '3%', top: '4%', containLabel: true } |
| | |
| | | |
| | | const yAxis1 = [{ type: 'value', axisLabel: { color: '#B8C8E0' } }] |
| | | |
| | | const fetchData = () => { |
| | | profitTrendAnalysis() |
| | | .then((res) => { |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | const list = res.data |
| | | xAxis1.value[0].data = list.map((d) => d.name) |
| | | barSeries1.value[0].data = list.map((d) => parseFloat(d.value) || 0) |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.error('获取利润趋势分析失败:', err) |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | // 先用本地假数据(后续如有接口可替换) |
| | | xAxis1.value[0].data = ['1月', '2月', '3月', '4月', '5月', '6月'] |
| | | barSeries1.value[0].data = [12000, 18000, 9000, 16000, 14000, 20000] |
| | | fetchData() |
| | | }) |
| | | </script> |
| | | |