This commit is contained in:
lb 2023-05-12 16:35:38 +08:00
parent c60e8abec8
commit bfc5dca853
5 changed files with 332 additions and 308 deletions

View File

@ -1,17 +1,22 @@
<template> <template>
<div class="history-temp flex flex-col" style="height: 100%;"> <div class="history-temp flex flex-col" style="height: 100%">
<h3>窑炉历史温度趋势</h3> <h3>窑炉历史温度趋势</h3>
<BarChart class="flex-1"/> <BarChart class="flex-1" />
</div> </div>
</template> </template>
<script> <script>
import BarChart from '../charts/BarChart.vue' import BarChart from "../charts/BarChart.vue";
export default { export default {
name: "HistoryTemp", name: "HistoryTemp",
components: { BarChart }, components: { BarChart },
props: {}, props: {
series: {
type: Object,
default: () => ({}),
},
},
data() { data() {
return {}; return {};
}, },
@ -24,7 +29,6 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
@import "../../assets/styles/functions"; @import "../../assets/styles/functions";
.flex-1 { .flex-1 {
flex: 1; flex: 1;
// background: #eee; // background: #eee;

View File

@ -18,7 +18,7 @@
</div> </div>
<div class="wave"></div> <div class="wave"></div>
<div class="graph flex-1"> <div class="graph flex-1">
<HistoryTrend /> <HistoryTrend key="water-in" :series="kilnWaterIn" />
</div> </div>
</div> </div>
</SubContainer> </SubContainer>
@ -31,9 +31,10 @@ import Container from "../layout/Container.vue";
import SubContainer from "../layout/SubContainer.vue"; import SubContainer from "../layout/SubContainer.vue";
import DigitalBox from "../common/DigitalBox.vue"; import DigitalBox from "../common/DigitalBox.vue";
import HistoryTrend from "./HistoryTemp.vue"; import HistoryTrend from "./HistoryTemp.vue";
import { mapState } from "vuex";
export default { export default {
name: "XicaoTemp", name: "InWater",
props: {}, props: {},
components: { Container, SubContainer, LineChart, DigitalBox, HistoryTrend }, components: { Container, SubContainer, LineChart, DigitalBox, HistoryTrend },
data() { data() {
@ -41,6 +42,9 @@ export default {
chartConfig: {}, chartConfig: {},
}; };
}, },
computed: {
...mapState(["kilnWaterIn"]),
},
}; };
</script> </script>
@ -54,7 +58,7 @@ export default {
position: absolute; position: absolute;
top: adjust(24px); top: adjust(24px);
right: 0; right: 0;
width:adjust(w(386px)); width: adjust(w(386px));
height: adjust(h(364px)); height: adjust(h(364px));
} }

View File

@ -18,7 +18,7 @@
</div> </div>
<div class="wave"></div> <div class="wave"></div>
<div class="graph flex-1"> <div class="graph flex-1">
<HistoryTrend /> <HistoryTrend key="water-out" :series="kilnWaterOut" />
</div> </div>
</div> </div>
</SubContainer> </SubContainer>
@ -31,9 +31,10 @@ import Container from "../layout/Container.vue";
import SubContainer from "../layout/SubContainer.vue"; import SubContainer from "../layout/SubContainer.vue";
import DigitalBox from "../common/DigitalBox.vue"; import DigitalBox from "../common/DigitalBox.vue";
import HistoryTrend from "./HistoryTemp.vue"; import HistoryTrend from "./HistoryTemp.vue";
import { mapState } from "vuex";
export default { export default {
name: "XicaoTemp", name: "OutWater",
props: {}, props: {},
components: { Container, SubContainer, LineChart, DigitalBox, HistoryTrend }, components: { Container, SubContainer, LineChart, DigitalBox, HistoryTrend },
data() { data() {
@ -41,6 +42,9 @@ export default {
chartConfig: {}, chartConfig: {},
}; };
}, },
computed: {
...mapState(["kilnWaterOut"]),
},
}; };
</script> </script>

View File

@ -28,7 +28,7 @@ echarts.use([
]); ]);
function adjust(v) { function adjust(v) {
return v * 2 return v * 2;
} }
export default { export default {
@ -42,12 +42,21 @@ export default {
data() { data() {
return { return {
id: Math.random().toString(), id: Math.random().toString(),
chart: null chart: null,
}; };
}, },
mounted() { mounted() {
this.init(); this.init();
}, },
watch: {
series: {
deep: true,
handler: function () {
console.log("BarChart: series changed!");
this.init();
},
},
},
methods: { methods: {
init() { init() {
if (!this.chart) if (!this.chart)
@ -76,7 +85,7 @@ export default {
color: "#ffffff", color: "#ffffff",
fontSize: adjust(7), fontSize: adjust(7),
lineHeight: adjust(1), lineHeight: adjust(1),
margin: adjust(8) margin: adjust(8),
}, },
}, },
yAxis: { yAxis: {
@ -111,7 +120,9 @@ export default {
}, },
series: [ series: [
{ {
data: Array(31) data:
// this.series
Array(31)
.fill(1) .fill(1)
.map(() => { .map(() => {
let v = Math.ceil(Math.random() * 100); let v = Math.ceil(Math.random() * 100);

View File

@ -105,6 +105,7 @@ export default {
series: { series: {
deep: true, deep: true,
handler: function () { handler: function () {
console.log('LineChart: series changed!')
this.init(); this.init();
}, },
}, },