Browse Source

update bipv产出

projects/mescc/lb-home-map
DESKTOP-FUDKNA8\znjsz 5 months ago
parent
commit
e0058df873
3 changed files with 69 additions and 31 deletions
  1. +19
    -1
      src/store/modules/home.js
  2. +48
    -28
      src/views/dashboard/charts/Bipv.vue
  3. +2
    -2
      src/views/dashboard/charts/LeftChartBase.vue

+ 19
- 1
src/store/modules/home.js 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 产出


+ 48
- 28
src/views/dashboard/charts/Bipv.vue 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: {
type: Array,
default: () => ["成都", "邯郸", "株洲", "瑞昌", "heels", "socks"],
},
series: {
type: Array,
default: () => [
xAxis: cities,
};
},
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年目标值",
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年目标值",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
name: `${new Date().getFullYear()}年目标值`,
data: bipvOutput.target,
},
{
name: "2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
name: `${new Date().getFullYear() - 1}年`,
data: bipvOutput.previous,
},
{
name: "2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
name: `${new Date().getFullYear()}年`,
data: bipvOutput.current,
},
],
];
},
},
};


+ 2
- 2
src/views/dashboard/charts/LeftChartBase.vue 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: {


Loading…
Cancel
Save