yudao-init/src/views/dashboard/charts/Fto.vue
‘937886381’ 7b8f4cac21 修改bug
2024-06-28 13:15:43 +08:00

72 lines
1.6 KiB
Vue

<!--
* @Author: zhp
* @Date: 2024-04-28 13:42:51
* @LastEditTime: 2024-06-27 16:30:58
* @LastEditors: zhp
* @Description:
-->
<template>
<left-chart-base
:legend="legend"
:series="series"
:xAxis="xAxis"
class="fto-chart"
/>
</template>
<script>
import LeftChartBase from "./LeftChartBase.vue";
export default {
name: "FtoChart",
components: { LeftChartBase },
data() {
const year = new Date().getFullYear();
// 城市数组的顺序必须是固定的
const cities = ["瑞昌", "邯郸",
// "株洲", "佳木斯", "成都", "凯盛", "蚌埠"
];
return {
legend: [
{ label: `${year - 1}`, color: "#12f7f1" },
{ label: `${year}`, color: "#58adfa" },
],
xAxis: cities,
};
},
computed: {
series() {
const ftoInvest = this.$store.getters.home.ftoInvest;
if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) {
return [
{
name: "样例数据--2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
name: "样例数据--2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
];
}
return [
{
name: `${new Date().getFullYear() - 1}`,
data: ftoInvest.previous,
},
{
name: `${new Date().getFullYear()}`,
data: ftoInvest.current,
},
];
},
},
};
</script>