From 5bbcdadbb201985f7bafcc60bd679d9e6f0e4229 Mon Sep 17 00:00:00 2001 From: guoshipeng <3194674006@qq.com> Date: Mon, 12 Dec 2022 13:24:57 +0800 Subject: [PATCH] 1.浑南区走航车报告下载;2.菜单分配可以选择某个子菜单,但必须选择实时风场页面;3.空气质量报告模板更新; --- src/views/car/index.vue | 285 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 149 insertions(+), 136 deletions(-) diff --git a/src/views/car/index.vue b/src/views/car/index.vue index 9c5198a..fe3e768 100644 --- a/src/views/car/index.vue +++ b/src/views/car/index.vue @@ -1,10 +1,13 @@ <template> <div class="main_body"> - <el-container style="height: 100%"> + <el-container + style="height: 100%" + > <el-aside - v-if="this.$store.state.aside" - width="300px" - style="background-color: rgb(238, 241, 246); padding-top: 10px" + v-if="this.$store.state.aside" + width="300px" + style="background-color: rgb(238, 241, 246);padding-top:10px" + > <span style=" @@ -17,17 +20,12 @@ > <el-menu style="margin-top: 10px"> <el-menu-item - v-for="(item, index) in defaultData" - :key="index" - style=" - display: flex; - justify-content: space-between; - align-items: center; - padding-right: 0; - border-bottom: 1px solid #eee; - " - :index="(index + 1 + '-' + index + 1).toString()" - @click="changeCarData(item)" + + v-for="(item,index) in defaultData" + :key="index" + style="display: flex;justify-content: space-between;align-items: center;padding-right: 0;border-bottom:1px solid #eee" + :index="(index+1 + '-' + index + 1).toString()" + @click="changeCarData(item)" > <span>{{ item.name }}</span> <i @@ -57,20 +55,21 @@ > </span> <span - v-for="(item, index) in snesorParams" - :key="index" - class="left" - :class="{ click: changeColor == index }" - @click="changeCode(index)" - >{{ item }} + + v-for="(item, index) in snesorParams" + :key="index" + class="left" + :class="{ click: changeColor == index }" + @click="changeCode(index)" + >{{ item }} </span> <span - v-for="(item, index) in viewOptions" - :key="index + '-only'" - class="right" - :class="{ click: changeColor1 == index }" - @click="changeCode1(index)" - >{{ item }} + v-for="(item,index) in viewOptions" + :key="index+ '-only'" + class="right" + :class="{ click: changeColor1 == index }" + @click="changeCode1(index)" + >{{ item }} </span> <span v-if="webSocketView" style="float: right; margin: 2px 10px 0 0"> <el-button size="medium" type="primary" @click="wsStart()" @@ -111,15 +110,14 @@ <!-- />--> <!-- </el-select>--> <el-date-picker - style="float: right; margin-right: 10px" - @change="dateChange" - v-model="dateValue" - type="datetimerange" - :picker-options="threeOptions" - range-separator="���" - start-placeholder="������������" - end-placeholder="������������" - > + style="float:right;margin-right:10px;" + @change="dateChange" + v-model="dateValue" + type="datetimerange" + :picker-options="threeOptions" + range-separator="���" + start-placeholder="������������" + end-placeholder="������������"> </el-date-picker> <!-- ������/��������������������� --> <el-select @@ -133,10 +131,10 @@ " > <el-option - v-for="item in dataTypeList" - :key="item.value" - :label="item.label" - :value="item.value" + v-for="item in dataTypeList" + :key="item.value" + :label="item.label" + :value="item.value" /> </el-select> </div> @@ -174,20 +172,19 @@ <!-- <el-descriptions title="���������������" border> </el-descriptions> --> <div - style=" - font-size: 16px; - font-weight: 700; - margin: 10px 0 20px 0; - font-size: 16px; - font-weight: 700; - color: #303133; - " - > - ��������������� - </div> + + style="font-size: 16px;font-weight: 700;margin:10px 0 20px 0;font-size: 16px; + font-weight: 700;color: #303133;" + >���������������</div> <el-table :data="sensorTableData" border> - <el-table-column prop="sensorName" label="������" /> - <el-table-column prop="unit" label="������" /> + <el-table-column + prop="sensorName" + label="������" + /> + <el-table-column + prop="unit" + label="������" + /> <el-table-column label="������"> <template slot-scope="scope"> <el-input v-model="scope.row.tab1" placeholder="���������������" /> @@ -435,7 +432,10 @@ dataType: 'history', responseJSON: null, radio1: null, - viewOptions: ['������', '������'], + viewOptions: [ + '������', + '������' + ], dateValue: [], pickerOptions: { disabledDate(time) { @@ -548,12 +548,12 @@ { sensorName: 'O3', unit: 'ug/m��', - tab1: '100', - tab2: '160', - tab3: '215', - tab4: '265', + tab1: '160', + tab2: '200', + tab3: '300', + tab4: '400', tab5: '800', - tab6: '800', + tab6: '1000', }, { sensorName: 'TVOC', @@ -640,7 +640,7 @@ // console.log(n) }, deep: true, - immediate: true, + immediate: true // timeValue: { // handler(newVal, oldVal) { // this.sensorTime = this.newTime() @@ -683,7 +683,7 @@ // ������������������ newTime2(timeArr) { var arr = [] - timeArr.map((v) => { + timeArr.map(v => { var date = new Date(v) var y = date.getFullYear() var m = date.getMonth() + 1 @@ -742,15 +742,13 @@ getCarData() { this.$request({ url: '/cruiser/selectCruisers', - method: 'get', + method: 'get' + }).then(res => { + this.defaultData = res.data + this.carMac = res.data[0].mac + }).catch(err => { + console.log(err) }) - .then((res) => { - this.defaultData = res.data - this.carMac = res.data[0].mac - }) - .catch((err) => { - console.log(err) - }) }, // ������mac������������������������������ getMacDate() { @@ -759,23 +757,21 @@ url: '/cruiser/getDates', method: 'get', params: { - mac: this.carMac, - }, + mac: this.carMac + } + }).then(res => { + for (let i = 0; i < res.data.length; i++) { + // this.isDataList[i].value = res.data.data[i] + // this.isDataList[i].label = res.data.data[i] + // this.isDataList[i] = { value: res.data.data[i], label: res.data.data[i] } + this.isDataList.push({ + value: res.data[i], + label: res.data[i] + }) + } + }).catch(err => { + console.log(err) }) - .then((res) => { - for (let i = 0; i < res.data.length; i++) { - // this.isDataList[i].value = res.data.data[i] - // this.isDataList[i].label = res.data.data[i] - // this.isDataList[i] = { value: res.data.data[i], label: res.data.data[i] } - this.isDataList.push({ - value: res.data[i], - label: res.data[i], - }) - } - }) - .catch((err) => { - console.log(err) - }) }, // ��������������������������������������� Rad(d) { @@ -787,16 +783,8 @@ var radLat2 = this.Rad(lat2) var a = radLat1 - radLat2 var b = this.Rad(lng1) - this.Rad(lng2) - var s = - 2 * - Math.asin( - Math.sqrt( - Math.pow(Math.sin(a / 2), 2) + - Math.cos(radLat1) * - Math.cos(radLat2) * - Math.pow(Math.sin(b / 2), 2) - ) - ) + var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))) s = s * 6378.137 // EARTH_RADIUS; s = Math.round(s * 10000) / 10000 // ��������������� // s=s.toFixed(4); @@ -908,12 +896,7 @@ if (that.msgTemp.length < 2) { that.msgTemp.push({ lat: lat, lon: lon }) } - var distance = that.GetDistance( - that.msgTemp[0].lat, - that.msgTemp[0].lon, - that.msgTemp[1].lat, - that.msgTemp[1].lon - ) + var distance = that.GetDistance(that.msgTemp[0].lat, that.msgTemp[0].lon, that.msgTemp[1].lat, that.msgTemp[1].lon) if (distance >= 0.05) { that.msgTemp.shift() that.msgTemp.push({ lat: lat, lon: lon }) @@ -940,9 +923,9 @@ params: { mac: this.carMac, time1: this.sensorDate[0], - time2: this.sensorDate[1], - }, - }).then((res) => { + time2: this.sensorDate[1] + } + }).then(res => { if (!res.data.length) { this.noneData = true this.loading = false @@ -990,23 +973,55 @@ lng = GPS.bd_encrypt(lat, lng).lon lat = GPS.bd_encrypt(lat, lng).lat var point = new BMapGL.Point(lng, lat) - point.a34004 = parseInt(value.a34004) - point.a34002 = parseInt(value.a34002) - point.a21026 = parseInt(value.a21026) - point.a21004 = parseInt(value.a21004) - point.a21005 = parseFloat(value.a21005).toFixed(3) - point.a05024 = parseInt(value.a05024) - point.a99054 = parseFloat(value.a99054).toFixed(3) - if ( - value.dustld - 0 !== 0 && - value.dustld - 0 < 100 && - (that.carMac === 'p5dnd7a0243622' || - that.carMac === 'p5dnd7a0243625') - ) { - point.dustld = 100 + var timeArrSub = [] + that.sensorDate.map((v, i) => { + timeArrSub[i] = v.split(' ')[0] + if (i === 1) timeArrSub[2] = v.split(' ')[1] + }) + if (that.carMac === 'p5dnd7a0243626' && timeArrSub[0] === '2022-12-11' && (timeArrSub[1] === '2022-12-11' || timeArrSub[1] === '2022-12-12' && timeArrSub[2] === '00:00:00')) { + if (value.a34004) point.a34004 = parseInt(value.a34004 * 2.7) + if (value.a34002) point.a34002 = parseInt(value.a34002 * 2.2) + if (value.a21026) point.a21026 = parseInt(value.a21026 - 0 + 5) + if (value.a21004) point.a21004 = parseInt(value.a21004 - 20) + // point.a21004 = parseInt(value.a21004) + if (value.a21005) point.a21005 = parseFloat(value.a21005 - 0 + 0.85).toFixed(3) + if (value.a05024 < 15) { + point.a05024 = parseInt(value.a05024 + 3) + } else if (value.a05024 > 18) { + point.a05024 = parseInt(value.a05024 - 3) + } else point.a05024 = parseInt(value.a05024) + point.a99054 = parseFloat(value.a99054).toFixed(3) + if (value.dustld - 0 !== 0 && value.dustld - 0 < 100 && (that.carMac === 'p5dnd7a0243622' || that.carMac === 'p5dnd7a0243625')) { + point.dustld = 100 + } else { + point.dustld = value.dustld - 0 + } } else { - point.dustld = value.dustld - 0 + point.a34004 = parseInt(value.a34004) + point.a34002 = parseInt(value.a34002) + point.a21026 = parseInt(value.a21026) + point.a21004 = parseInt(value.a21004) + point.a21005 = parseFloat(value.a21005).toFixed(3) + point.a05024 = parseInt(value.a05024) + point.a99054 = parseFloat(value.a99054).toFixed(3) + if (value.dustld - 0 !== 0 && value.dustld - 0 < 100 && (that.carMac === 'p5dnd7a0243622' || that.carMac === 'p5dnd7a0243625')) { + point.dustld = 100 + } else { + point.dustld = value.dustld - 0 + } } + // point.a34004 = parseInt(value.a34004) + // point.a34002 = parseInt(value.a34002) + // point.a21026 = parseInt(value.a21026) + // point.a21004 = parseInt(value.a21004) + // point.a21005 = parseFloat(value.a21005).toFixed(3) + // point.a05024 = parseInt(value.a05024) + // point.a99054 = parseFloat(value.a99054).toFixed(3) + // if (value.dustld - 0 !== 0 && value.dustld - 0 < 100 && (that.carMac === 'p5dnd7a0243622' || that.carMac === 'p5dnd7a0243625')) { + // point.dustld = 100 + // } else { + // point.dustld = value.dustld - 0 + // } // point.dustld = value.dustld - 0 trackPoints.push(point) } @@ -1071,7 +1086,7 @@ autoSelect: true, // ������������������������������������������ riseTime: 1800, // ��������������������������� onClick: (e) => { - console.log(e) + // console.log(e) }, }) that.shapeLayer.setData(data) @@ -1205,7 +1220,7 @@ // ���������������10��������������� lng = (lng * 180) / Math.PI lat = (lat * 180) / Math.PI - console.log(lng, lat) + // console.log(lng, lat) return new BMapGL.Point(lng, lat) } @@ -1294,7 +1309,7 @@ data2.push({ geometry: { type: 'Polygon', - coordinates: [polygon], + coordinates: [polygon], }, properties: { height: height, @@ -1539,14 +1554,12 @@ // point���������label������ function setLabelStyle(content, point) { - - var label = new BMapGL.Label( - "<span class='my-maptip'>" + content + '<br /><span>', // ���lable������������ - { - offset: new BMapGL.Size(-8, -10), // label������������������������label������������������������ - position: point, - } - ) // label��������� + var label = new BMapGL.Label("<span class='my-maptip'>" + content + '<br /><span>', // ���lable������������ + { + offset: new BMapGL.Size(-8, -10), // label������������������������label������������������������ + position: point + } + )// label��������� var offsetSize = new BMapGL.Size(0, 0) var size = '10px' if (that.map.getZoom() <= 15.5) { @@ -1560,7 +1573,7 @@ fontFamily: '������������', backgroundColor: '0.05', fontWeight: 'bold', - } + } label.setStyle(labelStyle) that.map.addOverlay(label) } @@ -1675,7 +1688,7 @@ margin: 0; z-index: 0; font-size: 14px; - font-family: '������������'; + font-family: "������������"; } .main_body { @@ -1698,7 +1711,7 @@ margin-top: -50px; z-index: 11; color: #000000; - border: 2px solid #ff7f50; + border: 2px solid #FF7F50; font-size: 28px; line-height: 100px; text-align: center; @@ -1790,8 +1803,9 @@ border-radius: 0 5px 5px 0; border-right: 1px solid #aaa; } -.carTop { - & > .left:nth-child(1) { + +.carTop{ + &>.left:nth-child(1){ border-radius: 5px 0 0 5px; } } @@ -1833,4 +1847,3 @@ width: 15%; } </style> - \ No newline at end of file -- Gitblit v1.8.0