1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
| <template>
| <div>
| <el-row justify="space-between">
| <FactorIconText
| faIcon="fa-solid fa-temperature-half"
| label="TEMP"
| :value="temprature"
| unit="℃"
| ></FactorIconText>
| <FactorIconText
| faIcon="fa-droplet"
| label="HUM"
| :value="humidity"
| unit="%"
| ></FactorIconText>
| </el-row>
| <el-row justify="space-between" class="m-t-4">
| <FactorIconText
| :img="wdrSvg"
| label="WDR"
| :value="_windDir"
| ></FactorIconText>
| <FactorIconText
| faIcon="fa-wind"
| label="WS"
| :value="windSpeed"
| unit="m/s"
| ></FactorIconText>
| </el-row>
| </div>
| </template>
| <script>
| import { FactorDatas } from '@/model/FactorDatas';
| import { windDir } from '@/constant/wind-dir';
| import FactorIconText from './FactorIconText.vue';
| import wdrSvg from '@/assets/wdr.svg';
|
| export default {
| props: {
| loading: Boolean,
| factorDatas: FactorDatas,
| temprature: {
| type: String,
| default: '--'
| },
| humidity: {
| type: String,
| default: '--'
| },
| windDirection: {
| type: String,
| default: '--'
| },
| windSpeed: {
| type: String,
| default: '--'
| }
| },
| data() {
| return {
| wdrSvg: wdrSvg
| };
| },
| watch: {
| factorDatas: {
| handler(nV) {
| // this.temprature = this.lastOne(nV, '8') + '℃';
| // this.humidity = this.lastOne(nV, '9') + '%';
| // this.windDirection = this.lastOne(nV, '17');
| // this.windSpeed = this.lastOne(nV, '16') + 'm/s';
| },
| deep: true
| }
| },
| computed: {
| _windDir() {
| return windDir(this.windDirection);
| }
| },
| methods: {
| lastOne(factorDatas, key) {
| const f = factorDatas.factor[key];
| if (f) {
| const lastIndex = f.datas.length - 1;
| return factorDatas.factor[key].datas[lastIndex].factorData;
| } else {
| return '--';
| }
| }
| }
| };
| </script>
| <style scoped>
| .w-tag {
| padding: 2px 4px;
| /* background-color: green; */
| border: 1px solid white;
| border-radius: 2px;
| -moz-border-radius: 25px;
| width: 130px;
| /* Old Firefox */
| }
|
| .form {
| display: flex;
| gap: 4px;
| }
|
| .el-form-item {
| margin-bottom: 4px;
| margin-right: 0px !important;
| }
| </style>
|
|