This commit is contained in:
g7hoo 2023-05-13 18:10:05 +08:00
parent ab3575b596
commit e6c7a143e8
6 changed files with 283 additions and 235 deletions

View File

@ -14,13 +14,14 @@
<th>设备状态</th> <th>设备状态</th>
</tr> </tr>
</thead> </thead>
<tbody> <!-- <tbody> -->
<!-- <tr <!-- <tr
v-for="(row, index) in tableData1" v-for="(row, index) in tableData1"
:key="index" :key="index"
style="font-size: 7px; background: #0b5499; opacity: 35%" style="font-size: 7px; background: #0b5499; opacity: 35%"
> --> > -->
<tr class="t-row" v-for="(row, index) in tableData1" :key="index"> <transition-group name="fan-list" tag="tbody" mode="out-in">
<tr class="t-row" v-for="row in tableData1" :key="(row && 'length' in row) ? row[0] : Math.random()">
<td v-for="(d, idx) in row" :key="idx"> <td v-for="(d, idx) in row" :key="idx">
<template v-if="idx === 2"> <template v-if="idx === 2">
<FrequentComp :value="d" /> <FrequentComp :value="d" />
@ -33,7 +34,8 @@
</template> </template>
</td> </td>
</tr> </tr>
</tbody> </transition-group>
<!-- </tbody> -->
</table> </table>
</div> </div>
<!-- <!--
@ -73,6 +75,7 @@ import Container from "../layout/Container.vue";
import SubContainer from "../layout/SubContainer.vue"; import SubContainer from "../layout/SubContainer.vue";
import FrequentComp from "./subcomponents/TableFrequence.vue"; import FrequentComp from "./subcomponents/TableFrequence.vue";
import StatusComp from "./subcomponents/TableStatus.vue"; import StatusComp from "./subcomponents/TableStatus.vue";
import { mapState } from "vuex";
export default { export default {
name: "KilnPressure", name: "KilnPressure",
@ -81,29 +84,55 @@ export default {
data() { data() {
return { return {
tableHead: ["序号", "设备名称", "运行频率", "设备状态"], tableHead: ["序号", "设备名称", "运行频率", "设备状态"],
tableCache: [
// [11, "11", "", "" /**or 0,1*/],
// [12, "12", "", "" /**or 0,1*/],
// [13, "13", "73Hz", "" /**or 0,1*/],
],
tableData1: [ tableData1: [
// { // [1, "1", "2332Hz", "" /**or 0,1*/],
// id: 1, // [2, "2", "", "" /**or 0,1*/],
// name: '1', // [3, "3", "333Hz", "" /**or 0,1*/],
// sequence: '', // [4, "4", "100Hz", "" /**or 0,1*/],
// status: '', // or 0 // [5, "5", "", "" /**or 0,1*/],
// } // [6, "6", "", "" /**or 0,1*/],
[1, "风机1", "2332Hz", "正常" /**or 0,1*/], // [7, "7", "3000Hz", "" /**or 0,1*/],
[2, "风机2", "未运行", "故障" /**or 0,1*/], // [8, "8", "", "" /**or 0,1*/],
[3, "风机3", "333Hz", "正常" /**or 0,1*/], // [9, "9", "", "" /**or 0,1*/],
[4, "风机4", "100Hz", "正常" /**or 0,1*/], // [10, "10", "86423Hz", "" /**or 0,1*/],
[5, "风机5", "未运行", "正常" /**or 0,1*/],
[6, "风机6", "未运行", "故障" /**or 0,1*/],
[7, "风机7", "3000Hz", "正常" /**or 0,1*/],
[8, "风机8", "未运行", "正常" /**or 0,1*/],
[9, "风机9", "未运行", "正常" /**or 0,1*/],
[10, "风机10", "86423Hz", "正常" /**or 0,1*/],
[11, "风机11", "未运行", "正常" /**or 0,1*/],
[12, "风机12", "未运行", "正常" /**or 0,1*/],
[13, "风机13", "73Hz", "正常" /**or 0,1*/],
], ],
}; };
}, },
computed: {
...mapState(["fan"]),
},
watch: {
fan: {
handler: function (data) {
if (!data) return
let idx = 0;
this.tableData1 = data.slice(0, 10).map((item, index) => {
idx += 1;
return [idx, ...item];
});
this.tableCache = data
.slice(10)
.map((item, index) => [index + 1 + idx, ...item]);
},
deep: true,
immediate: true,
},
},
mounted() {
setInterval(() => {
const inData = this.tableCache.shift();
const outData = this.tableData1.shift();
setTimeout(() => {
this.tableData1.splice(this.tableData1.length, 0, inData);
}, 200);
this.tableCache.push(outData);
}, 3000);
},
}; };
</script> </script>
@ -121,9 +150,23 @@ export default {
background: #eee3; background: #eee3;
} }
.fan-list-enter-active,
.fan-list-leave-active {
transition: all 0.5s;
}
// .fan-list-leave-move {
// transition: all 1s;
// }
.fan-list-enter,
.fan-list-leave-to {
opacity: 0;
transform: scaleY(0);
}
.flex-1 { .flex-1 {
flex: 1; flex: 1;
// background: #eee;
} }
.vertical-line { .vertical-line {
@ -138,9 +181,10 @@ export default {
); );
} }
.table-wrapper { .table-wrapper {
padding-right: 6px; // padding-right: 6px;
height: 400px; height: 400px;
overflow-y: auto; // overflow-y: auto;
overflow: hidden;
} }
table { table {
@ -153,7 +197,7 @@ table {
// } // }
.t-row { .t-row {
height: adjust(13.88px); height: adjust(14px);
} }
.tables > table { .tables > table {
@ -169,9 +213,9 @@ thead > tr th:first-child {
} }
thead > tr th { thead > tr th {
font-size: adjust(9px); font-size: adjust(10px);
line-height: 1.5; line-height: 1.5;
padding: adjust(2px) adjust(8px); padding: adjust(3px) adjust(8px);
font-weight: 400; font-weight: 400;
background: #044a8446; background: #044a8446;
text-align: left; text-align: left;
@ -182,7 +226,7 @@ tbody > tr:nth-child(odd) {
} }
tbody > tr td { tbody > tr td {
font-size: adjust(9px); font-size: adjust(10px);
line-height: 1.25; line-height: 1.25;
padding: adjust(2px) adjust(8px); padding: adjust(2px) adjust(8px);
font-weight: 400; font-weight: 400;

View File

@ -1,28 +1,32 @@
<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" :series="series" />
</div> <!-- :data="compType === 'inWater' ? kilnWaterIn : kilnWaterOut" -->
</div>
</template> </template>
<script> <script>
import BarChart from "../charts/BarChart.vue"; import BarChart from "../charts/BarChart.vue";
import { mapState } from "vuex";
export default { export default {
name: "HistoryTemp", name: "HistoryTemp",
components: { BarChart }, components: { BarChart },
props: { props: {
series: { series: {
type: Object, type: Array,
default: () => ({}), default: () => [],
}, },
}, },
data() { data() {
return {}; return {};
}, },
created() {}, computed: {
mounted() {}, ...mapState(["kilnWaterIn", "kilnWaterOut"]),
methods: {}, },
mounted() {},
methods: {},
}; };
</script> </script>
@ -30,17 +34,17 @@ export default {
@import "../../assets/styles/functions"; @import "../../assets/styles/functions";
.flex-1 { .flex-1 {
flex: 1; flex: 1;
// background: #eee; // background: #eee;
} }
h3 { h3 {
margin: 0; margin: 0;
font-family: sans-serif; font-family: sans-serif;
font-weight: 400; font-weight: 400;
font-size: adjust(14px); font-size: adjust(14px);
letter-spacing: adjust(1px); letter-spacing: adjust(1px);
color: #52fff8; color: #52fff8;
margin: adjust(12px) 0; margin: adjust(12px) 0;
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- bar chart --> <!-- bar chart -->
<div class="bar-chart" :id="id"></div> <div class="bar-chart" :id="id"></div>
</template> </template>
<script> <script>
@ -8,9 +8,9 @@ import * as echarts from "echarts/core";
import { BarChart } from "echarts/charts"; import { BarChart } from "echarts/charts";
import { import {
TitleComponent, TitleComponent,
TooltipComponent, TooltipComponent,
GridComponent, GridComponent,
} from "echarts/components"; } from "echarts/components";
import { LabelLayout, UniversalTransition } from "echarts/features"; import { LabelLayout, UniversalTransition } from "echarts/features";
@ -18,142 +18,142 @@ import { LabelLayout, UniversalTransition } from "echarts/features";
import { CanvasRenderer } from "echarts/renderers"; import { CanvasRenderer } from "echarts/renderers";
echarts.use([ echarts.use([
TitleComponent, TitleComponent,
TooltipComponent, TooltipComponent,
GridComponent, GridComponent,
BarChart, BarChart,
LabelLayout, LabelLayout,
UniversalTransition, UniversalTransition,
CanvasRenderer, CanvasRenderer,
]); ]);
function adjust(v) { function adjust(v) {
return v * 2; return v * 2;
} }
export default { export default {
name: "BarChart", name: "BarChart",
props: { props: {
config: { series: {
type: Object, type: Array,
default: () => ({}), default: () => [],
}, },
}, },
data() { data() {
return { return {
id: Math.random().toString(), id: Math.random().toString(),
chart: null, chart: null,
}; };
}, },
mounted() { mounted() {
this.init(); this.init();
}, },
watch: { watch: {
series: { series: {
deep: true, deep: true,
handler: function () { handler: function () {
console.log("BarChart: series changed!"); console.log("BarChart: series changed!");
this.init(); this.init();
}, },
}, },
}, },
methods: { methods: {
init() { init() {
if (!this.chart) if (!this.chart)
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(10), top: adjust(10),
left: adjust(28), left: adjust(28),
bottom: adjust(18), bottom: adjust(18),
right: adjust(12), right: adjust(12),
}, },
xAxis: { xAxis: {
type: "category", type: "category",
data: Array(24) data: Array(24)
.fill(1) .fill(1)
.map((_, index) => index + 1 + ':00'), .map((_, index) => index + 1 + ":00"),
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#5982b2a0", color: "#5982b2a0",
}, },
}, },
axisTick: { axisTick: {
show: false, show: false,
}, },
axisLabel: { axisLabel: {
color: "#ffffff", color: "#fff9",
fontSize: adjust(7), fontSize: adjust(7),
lineHeight: adjust(1), lineHeight: adjust(1),
margin: adjust(6), margin: adjust(6),
rotate: 30 rotate: 30,
}, },
}, },
yAxis: { yAxis: {
type: "value", type: "value",
// name: "/", // name: "/",
// nameTextStyle: { // nameTextStyle: {
// color: "#fff9", // color: "#fff9",
// fontSize: adjust(8), // fontSize: adjust(8),
// align: "right", // align: "right",
// }, // },
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "#5982b2a0", color: "#5982b2a0",
}, },
}, },
axisTick: { axisTick: {
show: false, show: false,
}, },
axisLabel: { axisLabel: {
formatter: "{value} ℃", formatter: "{value} ℃",
color: "#fff9", color: "#fff9",
fontSize: adjust(7), fontSize: adjust(7),
lineHeight: adjust(1), lineHeight: adjust(1),
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: "#5982b2a0", color: "#5982b2a0",
}, },
}, },
// data: [100, 200, 300, 400, 500], // data: [100, 200, 300, 400, 500],
}, },
series: [ series: [
{ {
data: data:
// this.series this.series,
Array(31) // Array(24)
.fill(1) // .fill(1)
.map(() => { // .map(() => {
let v = Math.ceil(Math.random() * 100); // let v = Math.ceil(Math.random() * 100);
while (v < 60) { // while (v < 60) {
v = Math.ceil(Math.random() * 100); // v = Math.ceil(Math.random() * 100);
} // }
return v; // return v;
}), // }),
type: "bar", type: "bar",
barWidth: adjust(4), barWidth: adjust(4),
label: { label: {
show: true, show: true,
fontSize: adjust(6), fontSize: adjust(6),
color: "#eee8", color: "#eee8",
position: "top", position: "top",
}, },
itemStyle: { itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#A0FF49" }, { offset: 0, color: "#A0FF49" },
{ offset: 0.35, color: "#49FF9A" }, { offset: 0.35, color: "#49FF9A" },
{ offset: 0.7, color: "#49F2FF" }, { offset: 0.7, color: "#49F2FF" },
{ offset: 1, color: "#0D6FFF" }, { offset: 1, color: "#0D6FFF" },
]), ]),
}, },
}, },
], ],
}); });
}, },
initData() {}, initData() {},
}, },
}; };
</script> </script>

View File

@ -134,7 +134,7 @@ export default {
show: false, show: false,
}, },
axisLabel: { axisLabel: {
color: "#ffffff", color: "#fff9",
fontSize: adjust(6), fontSize: adjust(6),
lineHeight: adjust(1), lineHeight: adjust(1),
margin: adjust(8), margin: adjust(8),
@ -253,11 +253,22 @@ li {
ul { ul {
margin-left: adjust(8px); margin-left: adjust(8px);
padding-left: adjust(8px); padding: 0 adjust(8px);
// background: #eee3;
// flex: 1;
// width: adjust(154px);
display: flex;
overflow-x: auto;
padding-bottom: adjust(2px);
}
li:not(:last-child) {
margin-right: adjust(16px);
} }
li { li {
position: relative; position: relative;
width: 40px;
} }
li::before { li::before {
@ -305,18 +316,6 @@ li:nth-child(11)::before {
background: #98f; background: #98f;
} }
ul {
flex: 1;
width: adjust(154px);
display: flex;
overflow-x: auto;
padding-bottom: adjust(2px);
}
li:not(:last-child) {
margin-right: adjust(8px);
}
.line-chart__wrapper { .line-chart__wrapper {
position: relative; position: relative;
background: #7771; background: #7771;
@ -335,7 +334,8 @@ li:not(:last-child) {
font-family: Ubuntu, sans-serif; font-family: Ubuntu, sans-serif;
// background: #fff2; // background: #fff2;
padding: 0; padding: 0;
max-width: 100%; // max-width: 100%;
width: 60%;
align-items: flex-start; align-items: flex-start;
justify-content: flex-end; justify-content: flex-end;
} }

View File

@ -16,9 +16,9 @@ export default new Vuex.Store({
kilnBtm2: {}, kilnBtm2: {},
xiCao1: {}, xiCao1: {},
xiCao2: {}, xiCao2: {},
kilnWaterIn: {}, kilnWaterIn: [],
kilnWaterOut: {}, kilnWaterOut: [],
fan: {}, fan: [],
fireDirection: "南火", fireDirection: "南火",
kilnPressure: '99', kilnPressure: '99',
fireChangeTime: '13:30:11', fireChangeTime: '13:30:11',
@ -33,107 +33,107 @@ export default new Vuex.Store({
switch (payload.target) { switch (payload.target) {
case 'oil-1': { case 'oil-1': {
state.oilTable1 = payload.data state.oilTable1 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'oil-2': { case 'oil-2': {
state.oilTable2 = payload.data state.oilTable2 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'gas-1': { case 'gas-1': {
state.gasTable1 = payload.data state.gasTable1 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'gas-2': { case 'gas-2': {
state.gasTable2 = payload.data state.gasTable2 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-top-1': { case 'kiln-top-1': {
state.kilnTop1 = payload.data state.kilnTop1 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-top-2': { case 'kiln-top-2': {
state.kilnTop2 = payload.data state.kilnTop2 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-btm-1': { case 'kiln-btm-1': {
state.kilnBtm1 = payload.data state.kilnBtm1 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-btm-2': { case 'kiln-btm-2': {
state.kilnBtm2 = payload.data state.kilnBtm2 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-water-in': { case 'kiln-water-in': {
state.kilnWaterIn = payload.data state.kilnWaterIn = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-water-out': { case 'kiln-water-out': {
state.kilnWaterOut = payload.data state.kilnWaterOut = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'water-in-temp': { case 'water-in-temp': {
state.waterInTemp = payload.data state.waterInTemp = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'water-out-temp': { case 'water-out-temp': {
state.waterOutTemp = payload.data state.waterOutTemp = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'xicao-1': { case 'xicao-1': {
state.xiCao1 = payload.data state.xiCao1 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'xicao-2': { case 'xicao-2': {
state.xiCao2 = payload.data state.xiCao2 = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'fan': { case 'fan': {
state.fan = payload.data state.fan = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'fire-direction': { case 'fire-direction': {
state.fireDirection = payload.data state.fireDirection = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'last-fire-change-time': { case 'last-fire-change-time': {
state.lastFireChangeTime = payload.data state.lastFireChangeTime = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'kiln-pressure': { case 'kiln-pressure': {
state.kilnPressure = payload.data state.kilnPressure = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'fire-change-time': { case 'fire-change-time': {
state.fireChangeTime = payload.data state.fireChangeTime = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'water-in-temp': { case 'water-in-temp': {
state.waterInTemp = payload.data state.waterInTemp = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
case 'water-out-temp': { case 'water-out-temp': {
state.waterOutTemp = payload.data state.waterOutTemp = payload.data
console.log('更换' + payload.target + '的数据' + payload.data) //console.log('更换' + payload.target + '的数据' + payload.data)
break break
} }
} }

View File

@ -42,10 +42,10 @@ export default class WsClient {
'kilnTempTopT2': 'kiln-top-2', 'kilnTempTopT2': 'kiln-top-2',
'kilnTempBottomT1': 'kiln-btm-1', 'kilnTempBottomT1': 'kiln-btm-1',
'kilnTempBottomT2': 'kiln-btm-2', 'kilnTempBottomT2': 'kiln-btm-2',
'kilnTempWaterT1': 'kiln-water-in', 'inWater': 'kiln-water-in',
'kilnTempWaterT2': 'kiln-water-out', 'outWater': 'kiln-water-out',
'kilnTempTinbathT1': 'kiln-water-in', 'kilnTempTinbathT1': 'xicao-1',
'kilnTempTinbathT2': 'kiln-water-out', 'kilnTempTinbathT2': 'xicao-2',
'kilnGasT1': 'gas-1', 'kilnGasT1': 'gas-1',
'kilnGasT2': 'gas-2', 'kilnGasT2': 'gas-2',
'kilnOilT1': 'oil-1', 'kilnOilT1': 'oil-1',