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 }) {
const dataArr = await getHomeInfo();
const targetArr = await getHomeTarget();
const chipInvest = {
current: Array(7).fill(0),
previous: Array(7).fill(0),
@ -79,11 +81,17 @@ const actions = {
const chipOutput = {
current: 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 = {
current: Array(7).fill(0),
previous: Array(7).fill(0),
target: Array(7).fill(0),
}; // BIPV产出
if (dataArr) {
@ -130,6 +138,16 @@ const actions = {
break;
case 1:
// 标准组件 产出
stdOutput.current.splice(
factoryId,
1,
factory.outputNumber ?? random_default()
);
stdOutput.previous.splice(
factoryId,
1,
factory.previousYearOutputNumber ?? random_default()
);
break;
case 2:
// BIPV 产出

View File

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

View File

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