From 7beb37c5170f93a33c059c72fac3233b82865481 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Sun, 04 Feb 2024 09:43:09 +0800
Subject: [PATCH] fix:修改成16位风向值
---
src/components/Wind/WRatingArr.js | 491 +++++++++++++++++++++++++++---------------------------
1 files changed, 245 insertions(+), 246 deletions(-)
diff --git a/src/components/Wind/WRatingArr.js b/src/components/Wind/WRatingArr.js
index b33a681..d29ba9f 100644
--- a/src/components/Wind/WRatingArr.js
+++ b/src/components/Wind/WRatingArr.js
@@ -1,228 +1,227 @@
/**
* ������-������������������
*/
-var WWindUtil = {};
+var WWindUtil = {}
/**
* ������json
*/
WWindUtil.WDJson = {
- "N": {
- "en": "N",
- "cn": "���",
- "desc": "���"
+ N: {
+ en: 'N',
+ cn: '���',
+ desc: '���'
},
- "NNE": {
- "en": "NNE",
- "cn": "���������",
- "desc": "������������"
+ NNE: {
+ en: 'NNE',
+ cn: '���������',
+ desc: '������������'
},
- "NE": {
- "en": "NE",
- "cn": "������",
- "desc": "������"
+ NE: {
+ en: 'NE',
+ cn: '������',
+ desc: '������'
},
- "ENE": {
- "en": "ENE",
- "cn": "���������",
- "desc": "������������"
+ ENE: {
+ en: 'ENE',
+ cn: '���������',
+ desc: '������������'
},
- "E": {
- "en": "E",
- "cn": "���",
- "desc": "���"
+ E: {
+ en: 'E',
+ cn: '���',
+ desc: '���'
},
- "ESE": {
- "en": "ESE",
- "cn": "���������",
- "desc": "������������"
+ ESE: {
+ en: 'ESE',
+ cn: '���������',
+ desc: '������������'
},
- "SE": {
- "en": "SNE",
- "cn": "������",
- "desc": "������"
+ SE: {
+ en: 'SNE',
+ cn: '������',
+ desc: '������'
},
- "SSE": {
- "en": "SSE",
- "cn": "���������",
- "desc": "������������"
+ SSE: {
+ en: 'SSE',
+ cn: '���������',
+ desc: '������������'
},
- "S": {
- "en": "S",
- "cn": "���",
- "desc": "���"
+ S: {
+ en: 'S',
+ cn: '���',
+ desc: '���'
},
- "SSW": {
- "en": "SSW",
- "cn": "���������",
- "desc": "������������"
+ SSW: {
+ en: 'SSW',
+ cn: '���������',
+ desc: '������������'
},
- "SW": {
- "en": "SW",
- "cn": "������",
- "desc": "������"
+ SW: {
+ en: 'SW',
+ cn: '������',
+ desc: '������'
},
- "WSW": {
- "en": "WSW",
- "cn": "���������",
- "desc": "������������"
+ WSW: {
+ en: 'WSW',
+ cn: '���������',
+ desc: '������������'
},
- "W": {
- "en": "W",
- "cn": "���",
- "desc": "���"
+ W: {
+ en: 'W',
+ cn: '���',
+ desc: '���'
},
- "WNW": {
- "en": "WNW",
- "cn": "���������",
- "desc": "������������"
+ WNW: {
+ en: 'WNW',
+ cn: '���������',
+ desc: '������������'
},
- "NW": {
- "en": "NW",
- "cn": "������",
- "desc": "������"
+ NW: {
+ en: 'NW',
+ cn: '������',
+ desc: '������'
},
- "NNW": {
- "en": "NW",
- "cn": "���������",
- "desc": "������������"
+ NNW: {
+ en: 'NW',
+ cn: '���������',
+ desc: '������������'
},
- "ERROR": {
- "en": "error value",
- "cn": "������������",
- "desc": "������������"
+ ERROR: {
+ en: 'error value',
+ cn: '������������',
+ desc: '������������'
}
-
-};
+}
/**
* ������������
*/
WWindUtil.WRatingArr = [
{
- "min": 0,
- "max": 0.2,
- "level": 0,
- "name": "������",
- "landScene": "������������"
+ min: 0,
+ max: 0.2,
+ level: 0,
+ name: '������',
+ landScene: '������������'
},
{
- "min": 0.3,
- "max": 1.5,
- "level": 1,
- "name": "1 ���",
- "landScene": "������������"
+ min: 0.3,
+ max: 1.5,
+ level: 1,
+ name: '1 ���',
+ landScene: '������������'
},
{
- "min": 1.6,
- "max": 3.3,
- "level": 2,
- "name": "2 ���",
- "landScene": "������������"
+ min: 1.6,
+ max: 3.3,
+ level: 2,
+ name: '2 ���',
+ landScene: '������������'
},
{
- "min": 3.4,
- "max": 5.4,
- "level": 3,
- "name": "3 ���",
- "landScene": "������������"
+ min: 3.4,
+ max: 5.4,
+ level: 3,
+ name: '3 ���',
+ landScene: '������������'
},
{
- "min": 5.5,
- "max": 7.9,
- "level": 4,
- "name": "4 ���",
- "landScene": "������������"
+ min: 5.5,
+ max: 7.9,
+ level: 4,
+ name: '4 ���',
+ landScene: '������������'
},
{
- "min": 8.0,
- "max": 10.7,
- "level": 5,
- "name": "5 ���",
- "landScene": "������������"
+ min: 8.0,
+ max: 10.7,
+ level: 5,
+ name: '5 ���',
+ landScene: '������������'
},
{
- "min": 10.8,
- "max": 13.8,
- "level": 6,
- "name": "6 ���",
- "landScene": "������������"
+ min: 10.8,
+ max: 13.8,
+ level: 6,
+ name: '6 ���',
+ landScene: '������������'
},
{
- "min": 13.9,
- "max": 17.1,
- "level": 7,
- "name": "7 ���",
- "landScene": "������������"
+ min: 13.9,
+ max: 17.1,
+ level: 7,
+ name: '7 ���',
+ landScene: '������������'
},
{
- "min": 17.2,
- "max": 20.7,
- "level": 8,
- "name": "8 ���",
- "landScene": "������������"
+ min: 17.2,
+ max: 20.7,
+ level: 8,
+ name: '8 ���',
+ landScene: '������������'
},
{
- "min": 20.8,
- "max": 24.4,
- "level": 9,
- "name": "9 ���",
- "landScene": "������������"
+ min: 20.8,
+ max: 24.4,
+ level: 9,
+ name: '9 ���',
+ landScene: '������������'
},
{
- "min": 24.5,
- "max": 28.4,
- "level": 10,
- "name": "10 ���",
- "landScene": "������������"
+ min: 24.5,
+ max: 28.4,
+ level: 10,
+ name: '10 ���',
+ landScene: '������������'
},
{
- "min": 28.5,
- "max": 32.6,
- "level": 11,
- "name": "11 ���",
- "landScene": "������������"
+ min: 28.5,
+ max: 32.6,
+ level: 11,
+ name: '11 ���',
+ landScene: '������������'
},
{
- "min": 32.7,
- "max": 36.9,
- "level": 12,
- "name": "12 ���",
- "landScene": "������������"
+ min: 32.7,
+ max: 36.9,
+ level: 12,
+ name: '12 ���',
+ landScene: '������������'
},
{
- "min": 37.0,
- "max": 41.4,
- "level": 13,
- "name": "13 ���",
- "landScene": ""
+ min: 37.0,
+ max: 41.4,
+ level: 13,
+ name: '13 ���',
+ landScene: ''
},
{
- "min": 41.5,
- "max": 46.1,
- "level": 14,
- "name": "14 ���",
- "landScene": ""
+ min: 41.5,
+ max: 46.1,
+ level: 14,
+ name: '14 ���',
+ landScene: ''
},
{
- "min": 46.2,
- "max": 50.9,
- "level": 15,
- "name": "15 ���",
- "landScene": ""
+ min: 46.2,
+ max: 50.9,
+ level: 15,
+ name: '15 ���',
+ landScene: ''
},
{
- "min": 51.0,
- "max": 56.0,
- "level": 16,
- "name": "16 ���",
- "landScene": ""
+ min: 51.0,
+ max: 56.0,
+ level: 16,
+ name: '16 ���',
+ landScene: ''
},
{
- "min": 56.1,
- "max": null,
- "level": 17,
- "name": "17 ���",
- "landScene": ""
+ min: 56.1,
+ max: null,
+ level: 17,
+ name: '17 ���',
+ landScene: ''
}
]
@@ -231,98 +230,97 @@
*/
WWindUtil.to16WindDirection = function (windNumberValue) {
if (windNumberValue > 360) {
- return WWindUtil.WDJson.ERROR;
+ return WWindUtil.WDJson.ERROR
}
- let a = Math.ceil(windNumberValue / 11.25);
- let ret;
+ let a = Math.ceil(windNumberValue / 11.25)
+ console.log('aaaaa', a)
+ let ret
switch (a) {
case 32:
- case 1:
- ret = WWindUtil.WDJson.N;
- break;
+ case 0:
+ ret = WWindUtil.WDJson.N
+ break
case 2:
case 3:
- ret = WWindUtil.WDJson.NNE;
- break;
-
+ ret = WWindUtil.WDJson.NNE
+ break
case 4:
case 5:
- ret = WWindUtil.WDJson.NE;
- break;
+ ret = WWindUtil.WDJson.NE
+ break
case 6:
case 7:
- ret = WWindUtil.WDJson.ENE;
- break;
+ ret = WWindUtil.WDJson.ENE
+ break
case 8:
case 9:
- ret = WWindUtil.WDJson.E;
- break;
+ ret = WWindUtil.WDJson.E
+ break
case 10:
case 11:
- ret = WWindUtil.WDJson.ESE;
- break;
+ ret = WWindUtil.WDJson.ESE
+ break
case 12:
case 13:
- ret = WWindUtil.WDJson.SE;
- break;
+ ret = WWindUtil.WDJson.SE
+ break
case 14:
case 15:
- ret = WWindUtil.WDJson.SSE;
- break;
+ ret = WWindUtil.WDJson.SSE
+ break
case 16:
case 17:
- ret = WWindUtil.WDJson.S;
- break;
+ ret = WWindUtil.WDJson.S
+ break
case 18:
case 19:
- ret = WWindUtil.WDJson.SSW;
- break;
+ ret = WWindUtil.WDJson.SSW
+ break
case 20:
case 21:
- ret = WWindUtil.WDJson.SW;
- break;
+ ret = WWindUtil.WDJson.SW
+ break
case 22:
case 23:
- ret = WWindUtil.WDJson.WSW;
- break;
+ ret = WWindUtil.WDJson.WSW
+ break
case 24:
case 25:
- ret = WWindUtil.WDJson.W;
- break;
+ ret = WWindUtil.WDJson.W
+ break
case 26:
case 27:
- ret = WWindUtil.WDJson.WNW;
- break;
+ ret = WWindUtil.WDJson.WNW
+ break
case 28:
case 29:
- ret = WWindUtil.WDJson.NW;
- break;
+ ret = WWindUtil.WDJson.NW
+ break
case 30:
case 31:
- ret = WWindUtil.WDJson.NNW;
- break;
+ ret = WWindUtil.WDJson.NNW
+ break
default:
- ret = WWindUtil.WDJson.ERROR;
- break;
-
+ ret = WWindUtil.WDJson.ERROR
+ break
}
- return ret;
+ return ret
}
/** ������������������������
@@ -330,90 +328,89 @@
*/
WWindUtil.to8WindDirection = function (windNumberValue) {
if (windNumberValue > 360) {
- return WWindUtil.WDJson.ERROR;
+ return WWindUtil.WDJson.ERROR
}
- let a = Math.ceil(windNumberValue / 22.5);
- let ret;
+ let a = Math.ceil(windNumberValue / 22.5)
+ let ret
switch (a) {
case 16:
case 1:
- ret = WWindUtil.WDJson.N;
- break;
+ ret = WWindUtil.WDJson.N
+ break
case 2:
case 3:
- ret = WWindUtil.WDJson.NE;
- break;
-
+ ret = WWindUtil.WDJson.NE
+ break
case 4:
case 5:
- ret = WWindUtil.WDJson.E;
- break;
+ ret = WWindUtil.WDJson.E
+ break
case 6:
case 7:
- ret = WWindUtil.WDJson.SE;
- break;
+ ret = WWindUtil.WDJson.SE
+ break
case 8:
case 9:
- ret = WWindUtil.WDJson.S;
- break;
+ ret = WWindUtil.WDJson.S
+ break
case 10:
case 11:
- ret = WWindUtil.WDJson.SW;
- break;
+ ret = WWindUtil.WDJson.SW
+ break
case 12:
case 13:
- ret = WWindUtil.WDJson.W;
- break;
+ ret = WWindUtil.WDJson.W
+ break
case 14:
case 15:
- ret = WWindUtil.WDJson.NW;
- break;
+ ret = WWindUtil.WDJson.NW
+ break
default:
- ret = WWindUtil.WDJson.ERROR;
- break;
-
+ ret = WWindUtil.WDJson.ERROR
+ break
}
- return ret;
+ return ret
}
/** ���������������������
* @param {Object} value ��������� (m/s)
*/
WWindUtil.WindtoLevel = function (value) {
- let vl = Number(value)
- .toFixed(1);
- console.log('vl:', vl);
- if (!vl || vl < 0) { return null; }
- let arr = WWindUtil.WRatingArr;
+ let vl = Number(value).toFixed(1)
+ console.log('vl:', vl)
+ if (!vl || vl < 0) {
+ return null
+ }
+ let arr = WWindUtil.WRatingArr
if (vl >= arr[arr.length - 1].min) {
- return arr[arr.length - 1];
+ return arr[arr.length - 1]
}
for (let i = 0; i < arr.length; i++) {
if (vl >= arr[i].min && vl <= arr[i].max) {
- return arr[i];
+ return arr[i]
}
}
- return null;
+ return null
}
// ������������������
WWindUtil.windValueFormat = function (value) {
try {
- let vl = Number(value);
+ let vl = Number(value)
if (!vl || vl > 360 || vl < 0) {
- return '-';
+ return '-'
}
- return WWindUtil.to16WindDirection(value).desc;
+ return WWindUtil.to16WindDirection(value).desc
} catch (e) {
- return '-';
+ return '-'
}
}
@@ -422,17 +419,19 @@
*/
WWindUtil.windFormatLevel = function (value) {
try {
- let vl = Number(value);
+ let vl = Number(value)
if (!vl || vl > 100 || vl < 0) {
- return "-";
+ return '-'
}
- return WWindUtil.WindtoLevel(value).level + "���(" + WWindUtil.WindtoLevel(value).name + ")";
+ return (
+ WWindUtil.WindtoLevel(value).level +
+ '���(' +
+ WWindUtil.WindtoLevel(value).name +
+ ')'
+ )
} catch (e) {
- return "-";
+ return '-'
}
}
-
-export {
- WWindUtil
-};
+export { WWindUtil }
--
Gitblit v1.8.0