update oil flow

This commit is contained in:
lb 2023-07-07 11:00:24 +08:00
parent eb4a81b7b9
commit 133d2d6e23
8 changed files with 106 additions and 43 deletions

View File

@ -3,11 +3,23 @@
<Container usage="Charts"> <Container usage="Charts">
<SubContainer title="油流量" icon="oil" padding="24px 32px"> <SubContainer title="油流量" icon="oil" padding="24px 32px">
<div class="tables flex" style="height: 100%"> <div class="tables flex" style="height: 100%">
<LineChart key="1" id="line-chart-1" class="flex-1" unit="单位 kg/h" :legend="Object.keys(oilTable1)" <LineChart
:series="oilTable1" /> key="1"
id="line-chart-1"
class="flex-1"
unit="单位 kg/h"
:legend="Object.keys(oilTable1)"
:series="oilTable1"
/>
<div class="vertical-line"></div> <div class="vertical-line"></div>
<LineChart key="2" id="line-chart-2" class="flex-1" unit="单位 kg/h" :legend="Object.keys(oilTable2)" <LineChart
:series="oilTable2" /> key="2"
id="line-chart-2"
class="flex-1"
unit="单位 kg/h"
:legend="Object.keys(oilTable2)"
:series="oilTable2"
/>
</div> </div>
</SubContainer> </SubContainer>
</Container> </Container>
@ -18,6 +30,7 @@ import LineChart from "../charts/LineChart.vue";
import Container from "../layout/Container.vue"; import Container from "../layout/Container.vue";
import SubContainer from "../layout/SubContainer.vue"; import SubContainer from "../layout/SubContainer.vue";
import { mapState } from "vuex"; import { mapState } from "vuex";
import { randomInt } from "@/utils";
export default { export default {
name: "OilFlow", name: "OilFlow",
@ -26,10 +39,50 @@ export default {
data() { data() {
return { return {
chartConfig: {}, chartConfig: {},
oilTable1: {
FT111: Array(24)
.fill(1)
.map((_) => randomInt()),
FT112: Array(24)
.fill(1)
.map((_) => randomInt()),
FT113: Array(24)
.fill(1)
.map((_) => randomInt()),
FT114: Array(24)
.fill(1)
.map((_) => randomInt()),
FT115: Array(24)
.fill(1)
.map((_) => randomInt()),
},
oilTable2: {
OT001: Array(24)
.fill(1)
.map((_) => randomInt()),
OT002: Array(24)
.fill(1)
.map((_) => randomInt()),
OT004: Array(24)
.fill(1)
.map((_) => randomInt()),
OT003: Array(24)
.fill(1)
.map((_) => randomInt()),
OT005: Array(24)
.fill(1)
.map((_) => randomInt()),
OT006: Array(24)
.fill(1)
.map((_) => randomInt()),
OT007: Array(24)
.fill(1)
.map((_) => randomInt()),
},
}; };
}, },
computed: { computed: {
...mapState(["oilTable1", "oilTable2"]), // ...mapState(["oilTable1", "oilTable2"]),
}, },
}; };
</script> </script>
@ -45,10 +98,12 @@ export default {
.vertical-line { .vertical-line {
margin: 0 adjust(3px); margin: 0 adjust(3px);
width: adjust(3px); width: adjust(3px);
background: radial-gradient(ellipse at center, background: radial-gradient(
#3565ff, ellipse at center,
#3565ff51, #3565ff,
transparent, #3565ff51,
transparent); transparent,
transparent
);
} }
</style> </style>

View File

@ -143,9 +143,9 @@ export default {
this.chart = echarts.init(document.getElementById(this.id)); this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption({ this.chart.setOption({
grid: { grid: {
top: adjust(16), top: adjust(22),
left: adjust(20), left: adjust(22),
bottom: adjust(16), bottom: adjust(20),
right: adjust(8), right: adjust(8),
}, },
xAxis: { xAxis: {
@ -160,10 +160,10 @@ export default {
}, },
axisLabel: { axisLabel: {
color: "#3C4E8Baa", color: "#3C4E8Baa",
fontSize: adjust(7), fontSize: adjust(6),
lineHeight: adjust(0), lineHeight: adjust(0),
margin: adjust(5), margin: adjust(4),
rotate: 30, rotate: 45,
}, },
}, },
yAxis: { yAxis: {
@ -172,7 +172,7 @@ export default {
nameTextStyle: { nameTextStyle: {
color: "#3C4E8Baa", color: "#3C4E8Baa",
fontSize: adjust(8), fontSize: adjust(8),
lineHeight: 1, lineHeight: adjust(12),
align: "center", align: "center",
}, },
axisLine: { axisLine: {
@ -278,48 +278,45 @@ li {
} }
ul { ul {
// padding: 0 adjust(8px); width: 100%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-end; justify-content: space-between;
align-items: center; align-items: flex-end;
height: adjust(28px); height: adjust(14px);
white-space: pre-wrap; white-space: pre-wrap;
padding-bottom: adjust(2px); padding-bottom: 0;
padding-left: adjust(6px);
background: #0005;
} }
li { li {
text-align: right; text-align: right;
position: relative; position: relative;
min-width: 40px; min-width: 40px;
margin-right: adjust(9px); background: #f003;
padding: 0 adjust(2px);
}
li:not(:last-child) {
// margin-right: adjust(16px);
} }
.line-chart__custom-legend { .line-chart__custom-legend {
position: absolute; position: absolute;
top: adjust(-32px); top: adjust(-20px);
right: 0; right: 0;
font-size: adjust(9px); font-size: adjust(6px);
font-family: Ubuntu, sans-serif; font-family: Ubuntu, sans-serif;
padding: 0; padding: 0;
// max-width: 100%; // max-width: 100%;
width: 65%; width: 75%;
align-items: flex-start; align-items: flex-end;
justify-content: flex-end; justify-content: flex-end;
} }
li::before { li::before {
content: ""; content: "";
position: absolute; position: absolute;
top: adjust(2px); top: adjust(0px);
left: adjust(-8px); left: adjust(-6px);
width: adjust(8px); width: adjust(6px);
height: adjust(8px); height: adjust(6px);
border-radius: adjust(1px); border-radius: adjust(1px);
background: #eee6; background: #eee6;
} }

View File

@ -59,7 +59,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
padding: 0; padding: 0;
user-select: none; user-select: none;
width: adjust(w(744px)); width: adjust(w(820px));
height: adjust(h(350px)); height: adjust(h(350px));
display: flex; display: flex;
background: url(../../assets/top-middle.png) no-repeat; background: url(../../assets/top-middle.png) no-repeat;
@ -89,8 +89,8 @@ export default {
.value { .value {
color: #030609; color: #030609;
font-size: adjust(22px); font-size: adjust(18px);
line-height: adjust(23px); line-height: adjust(22px);
} }
} }
} }

View File

@ -8,7 +8,7 @@
// import { mapState } from "vuex"; // import { mapState } from "vuex";
export default { export default {
name: "MonitorGroup#2", name: "MonitorGroup-2",
props: {}, props: {},
components: {}, components: {},
data() { data() {

View File

@ -8,7 +8,7 @@
// import { mapState } from "vuex"; // import { mapState } from "vuex";
export default { export default {
name: "MonitorGroup#3", name: "MonitorGroup-3",
props: {}, props: {},
components: {}, components: {},
data() { data() {

View File

@ -36,7 +36,7 @@ export default {
// { icon: "temp", title: "", value: "27" }, // { icon: "temp", title: "", value: "27" },
{ icon: "fire", title: "当前火向", value: "" }, { icon: "fire", title: "当前火向", value: "" },
{ icon: "clock", title: "换火时间", value: "20分" }, { icon: "clock", title: "换火时间", value: "20分" },
{ icon: "sand", title: "剩余时间", value: "0" }, { icon: "sand", title: "剩余时间", value: "19分20" },
], ],
}; };
}, },

View File

@ -180,7 +180,7 @@ main {
.area-one { .area-one {
position: absolute; position: absolute;
top: adjust(150px); top: adjust(150px);
left: adjust(1340px); left: adjust(1310px);
} }
.video-crash { .video-crash {

11
src/utils/index.js Normal file
View File

@ -0,0 +1,11 @@
export function randomInt(min, max, closeRight = false) {
min = min ?? 0
max = max ?? 100
if (min >= max) { min = max - 100 > 0 ? max - 100 : 0 }
const fn = closeRight ? Math.ceil : Math.floor
let val = fn(Math.random() * max)
while (val < min) {
val = fn(Math.random() * max)
}
return val
}