update bipv产出

This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-04-18 14:58:16 +08:00
parent 691f63438a
commit e0058df873
3 changed files with 69 additions and 31 deletions

View File

@ -68,6 +68,8 @@ const actions = {
/** 初始化首页数据 */ /** 初始化首页数据 */
async initHome({ commit }) { async initHome({ commit }) {
const dataArr = await getHomeInfo(); const dataArr = await getHomeInfo();
const targetArr = await getHomeTarget();
const chipInvest = { const chipInvest = {
current: Array(7).fill(0), current: Array(7).fill(0),
previous: Array(7).fill(0), previous: Array(7).fill(0),
@ -79,11 +81,17 @@ const actions = {
const chipOutput = { const chipOutput = {
current: Array(7).fill(0), current: Array(7).fill(0),
previous: Array(7).fill(0), previous: Array(7).fill(0),
target: Array(7).fill(0),
}; // 芯片产出 }; // 芯片产出
const stdOutput = []; // 标准组件产出 const stdOutput = {
current: Array(7).fill(0),
previous: Array(7).fill(0),
target: Array(7).fill(0),
}; // 标准组件产出
const bipvOutput = { const bipvOutput = {
current: Array(7).fill(0), current: Array(7).fill(0),
previous: Array(7).fill(0), previous: Array(7).fill(0),
target: Array(7).fill(0),
}; // BIPV产出 }; // BIPV产出
if (dataArr) { if (dataArr) {
@ -130,6 +138,16 @@ const actions = {
break; break;
case 1: case 1:
// 标准组件 产出 // 标准组件 产出
stdOutput.current.splice(
factoryId,
1,
factory.outputNumber ?? random_default()
);
stdOutput.previous.splice(
factoryId,
1,
factory.previousYearOutputNumber ?? random_default()
);
break; break;
case 2: case 2:
// BIPV 产出 // BIPV 产出

View File

@ -21,41 +21,61 @@ import RightChartBase from "./RightChartBase.vue";
export default { export default {
name: "BipvChart", name: "BipvChart",
components: { RightChartBase }, components: { RightChartBase },
props: { data() {
legend: { const year = new Date().getFullYear();
type: Array, //
default: () => [ const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
{ label: "2024年目标值", color: "#f3c000" }, return {
{ label: "2023年", color: "#12f7f1" }, legend: [
{ label: "2024年", color: "#58adfa" }, { label: `${year}年目标值`, color: "#f3c000" },
{ label: `${year - 1}`, color: "#12f7f1" },
{ label: `${year}`, color: "#58adfa" },
], ],
}, xAxis: cities,
xAxis: { };
type: Array, },
default: () => ["成都", "邯郸", "株洲", "瑞昌", "heels", "socks"], computed: {
}, series() {
series: { const bipvOutput = this.$store.getters.home.bipvOutput;
type: Array, // const bipvTarget = this.$store.getters.home.bipvTarget;
default: () => [
if (!bipvOutput || !bipvOutput.current || !bipvOutput.previous) {
return [
{
name: "样例数据--2024年目标值",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
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: "2024年目标值", name: `${new Date().getFullYear()}年目标值`,
data: Array.from({ length: 7 }, () => data: bipvOutput.target,
Math.floor(Math.random() * 1000)
),
}, },
{ {
name: "2023年", name: `${new Date().getFullYear() - 1}`,
data: Array.from({ length: 7 }, () => data: bipvOutput.previous,
Math.floor(Math.random() * 1000)
),
}, },
{ {
name: "2024年", name: `${new Date().getFullYear()}`,
data: Array.from({ length: 7 }, () => data: bipvOutput.current,
Math.floor(Math.random() * 1000)
),
}, },
], ];
}, },
}, },
}; };

View File

@ -107,7 +107,7 @@ export default {
}, },
series: [ series: [
{ {
name: "2023年", name: this.series[0].name,
type: "bar", type: "bar",
barWidth: 12, barWidth: 12,
itemStyle: { itemStyle: {
@ -142,7 +142,7 @@ export default {
data: this.series[0].data, data: this.series[0].data,
}, },
{ {
name: "2024年", name: this.series[1].name,
type: "bar", type: "bar",
barWidth: 12, barWidth: 12,
// tooltip: { // tooltip: {