projects/mescc/zhp #12

Merged
juzi merged 13 commits from projects/mescc/zhp into projects/mescc/develop 2024-05-08 16:40:47 +08:00
10 changed files with 190 additions and 268 deletions
Showing only changes of commit 646eb9c270 - Show all commits

View File

@ -64,9 +64,11 @@ const actions = {
},
/** 初始化驾驶舱数据 */
async initCopilot({ commit }, { period, source }) {
if (source == 'comprehensive') return;
const fetcher = {
yield: getCopilotYield,
energy: getCopilotEnergy,
comprehensive: getCopilotEnergy,
efficiency: getCopilotEfficiency,
}[source];
// 获取产量数据

View File

@ -9,7 +9,7 @@
<div class="copilot-header">
<section class="menu">
<CopilotButton
v-for="i in ['产量', '效率', '能源']"
v-for="i in ['产量', '效率', '综合']"
:key="i"
:label="i"
:active="i === active"

View File

@ -15,7 +15,7 @@
/>
<YieldCopilot v-if="page == '产量'" :period="period" />
<EnergyCopilot v-if="page == '能源'" :period="period" />
<EnergyCopilot v-if="page == '综合'" :period="period" />
<EfficiencyCopilot v-if="page == '效率'" :period="period" />
<div class="copilot-footer">© 中建材智能自动化研究院有限公司</div>

View File

@ -0,0 +1,30 @@
<!--
filename: ElecCost.vue
author: liubin
date: 2024-04-29 16:37:01
description: 电能耗
-->
<template>
<div class="elec-cost">elec cost</div>
</template>
<script>
export default {
name: "ElecCost",
components: {},
props: {},
data() {
return {};
},
computed: {},
methods: {},
};
</script>
<style scoped lang="scss">
.elec-cost {
background: #cc03;
flex: 1;
}
</style>

View File

@ -0,0 +1,30 @@
<!--
filename: NatGas.vue
author: liubin
date: 2024-04-29 16:36:27
description: 天然气能耗
-->
<template>
<div class="nat-gas">nat-gas</div>
</template>
<script>
export default {
name: "NatGas",
components: {},
props: {},
data() {
return {};
},
computed: {},
methods: {},
};
</script>
<style scoped lang="scss">
.nat-gas {
background: #31f2;
flex: 1;
}
</style>

View File

@ -0,0 +1,30 @@
<!--
filename: StockMonitor.vue
author: liubin
date: 2024-04-29 16:35:40
description: 仓库监控·当前
-->
<template>
<div class="stock-monitor">仓库监控</div>
</template>
<script>
export default {
name: "StockMonitor",
components: {},
props: {},
data() {
return {};
},
computed: {},
methods: {},
};
</script>
<style scoped lang="scss">
.stock-monitor {
background: #fff2;
flex: 1;
}
</style>

View File

@ -0,0 +1,30 @@
<!--
filename: WaterCost.vue
author: liubin
date: 2024-04-29 16:37:34
description: 水能耗
-->
<template>
<div class="water-cost">water cost</div>
</template>
<script>
export default {
name: "WaterCost",
components: {},
props: {},
data() {
return {};
},
computed: {},
methods: {},
};
</script>
<style scoped lang="scss">
.water-cost {
background: #f002;
flex: 1;
}
</style>

View File

@ -2,24 +2,81 @@
filename: index.vue
author: liubin
date: 2024-04-16 14:40:15
description: 能源驾驶舱
description: 综合驾驶舱
-->
<template>
<div class="energy-copilot">能源驾驶舱</div>
<div class="energy-copilot">
<Container title="仓库监控·当前" icon="chip2">
<StockMonitorVue />
</Container>
<Container title="天然气能耗" icon="std">
<NatGasVue />
</Container>
<Container title="电能耗" icon="chip">
<ElecCostVue :period="period" />
</Container>
<Container title="水能耗" icon="cube">
<WaterCostVue :period="period" />
</Container>
</div>
</template>
<script>
import Container from "@/views/copilot/components/Container.vue";
import StockMonitorVue from "./components/StockMonitor.vue";
import ElecCostVue from "./components/ElecCost.vue";
import NatGasVue from "./components/NatGas.vue";
import WaterCostVue from "./components/WaterCost.vue";
export default {
name: "EnergyCopilot",
components: {},
props: {},
components: {
Container,
StockMonitorVue,
ElecCostVue,
NatGasVue,
WaterCostVue,
},
props: {
period: {
type: String,
default: "日",
},
},
data() {
return {};
},
computed: {},
methods: {},
watch: {
period: {
handler(val) {
val && this.fetchData(val);
},
immediate: true,
},
},
methods: {
fetchData(period = "日") {
console.log(`效率驾驶舱,获取${period}数据`);
this.$store.dispatch("copilot/initCopilot", {
period,
source: "comprehensive",
});
},
},
};
</script>
<style scoped></style>
<style scoped>
.energy-copilot {
flex: 1;
display: grid;
gap: 16px;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
}
.energy-copilot > div {
height: 100%;
}
</style>

View File

@ -16,7 +16,7 @@
</template>
<script>
import BarChartBase from "./sub/bar/BarChartBase.vue";
import BarChartBase from "@/views/copilot/components/BarChartBase.vue";
export default {
name: "ChipInvest",

View File

@ -1,257 +0,0 @@
<!--
filename: BarChartBase.vue
author: liubin
date: 2024-04-10 08:59:28
description:
-->
<template>
<chart-container class="bar-chart-base">
<div class="legend">
<span
v-for="item in legend"
:key="item.label"
class="legend-item"
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }"
>{{ item.label }}</span
>
</div>
<div
ref="chart"
style="max-width: 50vw"
:style="{ height: vHeight + 'vh' }"
></div>
</chart-container>
</template>
<script>
import screenfull from "screenfull";
import ChartContainer from "../../../../components/ChartContainer.vue";
import chartMixin from "@/mixins/chart.js";
export default {
name: "BarChartBase",
components: {
ChartContainer,
},
mixins: [chartMixin],
props: {
vHeight: {
type: Number,
default: 34,
},
legend: {
type: Array,
required: true,
},
xAxis: {
type: Array,
required: true,
},
series: {
type: Array,
required: true,
},
in: {
type: String,
default: "",
},
},
data() {
return {
isFullscreen: false,
actualOptions: null,
options: {
grid: {
left: "5%",
right: "4%",
bottom: "3%",
top: "15%",
containLabel: true,
},
tooltip: {},
xAxis: {
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#4561AE",
},
},
axisLabel: {
color: "#fff",
fontSize: 12,
},
data: this.xAxis,
},
yAxis: {
name: "单位/片",
nameTextStyle: {
color: "#fff",
fontSize: 12,
},
axisTick: {
show: false,
},
axisLabel: {
color: "#fff",
fontSize: 12,
},
axisLine: {
show: true,
lineStyle: {
color: "#4561AE",
},
},
splitLine: {
lineStyle: {
color: "#4561AE",
},
},
},
series: [
{
name: "", // this.series[0].name,
type: "bar",
barWidth: 12,
itemStyle: {
borderRadius: [10, 10, 0, 0],
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#12f7f1", // 0%
},
{
offset: 0.35,
color: "#12f7f177", // 100%
},
{
offset: 0.75,
color: "#12f7f133", // 100%
},
{
offset: 1,
color: "transparent", // 100%
},
],
global: false, // false
},
},
data: [], // this.series[0].data,
},
{
name: "", // this.series[1].name,
type: "bar",
barWidth: 12,
// tooltip: {
// valueFormatter: function (value) {
// return value + " ml";
// },
// },
itemStyle: {
borderRadius: [10, 10, 0, 0],
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#57abf8", // 0%
},
{
offset: 1,
color: "#364BFE66", // 100%
},
],
global: false, // false
},
},
data: [], // this.series[1].data,
},
],
},
};
},
watch: {
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
isFullscreen(val) {
this.actualOptions.series.map((item) => {
item.barWidth = val ? 18 : 12;
});
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initOptions(this.actualOptions);
},
series(val) {
if (!val) {
this.initOptions(this.options);
return;
}
const actualOptions = JSON.parse(JSON.stringify(this.options));
actualOptions.series[0].data = val[0].data;
actualOptions.series[0].name = val[0].name;
actualOptions.series[1].data = val?.[1]?.data || [];
actualOptions.series[1].name = val?.[1]?.name || "";
this.actualOptions = actualOptions;
this.initOptions(actualOptions);
},
},
mounted() {
this.actualOptions = this.options;
this.initOptions(this.options);
if (screenfull.isEnabled) {
screenfull.on("change", () => {
this.isFullscreen = screenfull.isFullscreen;
});
}
},
};
</script>
<style scoped lang="scss">
.bar-chart-base {
// position: relative;
.legend {
position: absolute;
top: 5.2vh;
right: 1vw;
}
.legend-item {
position: relative;
// font-size: 12px;
margin-right: 0.67vw;
&::before {
content: "";
display: inline-block;
width: 0.531vw;
height: 0.531vw;
background-color: #ccc;
border-radius: 2px;
margin-right: 0.22vw;
}
}
.legend-item:nth-child(1):before {
background-color: #12f7f1;
}
.legend-item:nth-child(2):before {
background-color: #58adfa;
}
}
</style>