From ec38056995178c94bea0689d6c6fd64ed5da8014 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 27 Dec 2023 15:38:28 +0800
Subject: [PATCH] fix:日期限制取消
---
src/views/car/index.vue | 389 ++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 283 insertions(+), 106 deletions(-)
diff --git a/src/views/car/index.vue b/src/views/car/index.vue
index ace7c2d..617a935 100644
--- a/src/views/car/index.vue
+++ b/src/views/car/index.vue
@@ -1,44 +1,84 @@
<template>
<div class="main_body">
<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">
- <span style="
+ <el-aside
+ v-if="$store.state.aside"
+ width="300px"
+ style="background-color: rgb(238, 241, 246); padding-top: 10px"
+ >
+ <span
+ style="
font-size: 13px;
padding-left: 10px;
font-weight: 500;
color: rgb(64, 158, 255);
- ">���������������</span>
+ "
+ >���������������</span>
<el-menu style="margin-top: 10px">
- <el-menu-item v-for="(item, index) in defaultData" :key="index" style="
+ <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)">
+ "
+ :index="(index + 1 + '-' + index + 1).toString()"
+ @click="changeCarData(item)"
+ >
<span>{{ item.name }}</span>
- <i style="
+ <i
+ style="
vertical-align: -2.5px;
font-size: 20px;
margin-right: 10px;
margin-left: auto;
- " class="iconfont iconfaxianzuobiao" @click="deviceDetail(item.mac, null, item, 0)" />
+ "
+ class="iconfont iconfaxianzuobiao"
+ @click="deviceDetail(item.mac, null, item, 0)"
+ />
<!-- @click="deviceDetail('p5dnd7a0245390',null,item,0)"-->
</el-menu-item>
</el-menu>
</el-aside>
- <el-dialog> </el-dialog>
+ <el-dialog />
<el-container style="position: relative">
<div class="carTop">
<span style="float: left; margin: 1px 10px 0 0">
- <el-button size="medium" type="primary" icon="el-icon-setting" @click="dialogFormVisible = true">6���������</el-button>
+ <el-button
+ size="medium"
+ type="primary"
+ icon="el-icon-setting"
+ @click="dialogFormVisible = true"
+ >6���������</el-button>
</span>
- <span v-for="(item, index) in snesorParams" :key="index" class="left" :class="{ click: changeColor == index }" @click="changeCode(index)">{{ item }}
+ <span
+ 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 }}
+ <span
+ 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()">������������</el-button>
+ <span
+ v-if="webSocketView"
+ style="float: right; margin: 2px 10px 0 0"
+ >
+ <el-button
+ size="medium"
+ type="primary"
+ @click="wsStart()"
+ >������������</el-button>
</span>
<!-- <el-date-picker
v-if="historyView"
@@ -74,14 +114,44 @@
<!-- />-->
<!-- </el-select>-->
- <el-button type="primary" size="small" style="margin-left: 1.5rem" @click="insertL">������</el-button>
- <el-input placeholder="���������������" v-model="inputnum" class="inputNum" clearable>
- </el-input>
+ <el-button
+ type="primary"
+ size="small"
+ style="margin-left: 1.5rem"
+ @click="insertL"
+ >
+ ������
+ </el-button>
+ <el-input
+ v-model="inputnum"
+ placeholder="���������������"
+ class="inputNum"
+ clearable
+ />
<div class="insLu">
- <el-upload class="upload-demo" ref="upload" action="" :on-change="handleChange" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false" :limit="1">
- <el-button slot="trigger" size="small" type="primary">������������</el-button>
- <div slot="tip" class="el-upload__tip" style="color: red">
+ <el-upload
+ ref="upload"
+ class="upload-demo"
+ action=""
+ :on-change="handleChange"
+ :on-remove="handleRemove"
+ :file-list="fileList"
+ :auto-upload="false"
+ :limit="1"
+ >
+ <el-button
+ slot="trigger"
+ size="small"
+ type="primary"
+ >
+ ������������
+ </el-button>
+ <div
+ slot="tip"
+ class="el-upload__tip"
+ style="color: red"
+ >
������������������������(���������������)
</div>
</el-upload>
@@ -105,41 +175,86 @@
<el-button @click="insqu">������</el-button>
<el-button @click="qnull">������</el-button>
</div> -->
- <el-table :data="tableData" style="width: 100%">
- <el-table-column label="������������" width="180">
+ <el-table
+ :data="tableData"
+ style="width: 100%"
+ >
+ <el-table-column
+ label="������������"
+ width="180"
+ >
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.start }}</span>
</template>
</el-table-column>
- <el-table-column label="������������" width="180">
+ <el-table-column
+ label="������������"
+ width="180"
+ >
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.end }}</span>
</template>
</el-table-column>
</el-table>
<div style="display: flex">
- <span class="statspan">������������:</span><el-input v-model="Lname" style="width: 12rem; margin-left: 1.7rem"></el-input>
+ <span class="statspan">������������:</span><el-input
+ v-model="Lname"
+ style="width: 12rem; margin-left: 1.7rem"
+ />
</div>
<div style="display: flex; margin-left: 4rem">
- <el-button type="primary" @click="insLuDuan">������</el-button>
- <el-button @click="insqu">������</el-button>
- <el-button @click="qnull">������</el-button>
+ <el-button
+ type="primary"
+ @click="insLuDuan"
+ >
+ ������
+ </el-button>
+ <el-button @click="insqu">
+ ������
+ </el-button>
+ <el-button @click="qnull">
+ ������
+ </el-button>
</div>
</div>
- <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="������������">
- </el-date-picker>
+ <el-date-picker
+ v-model="dateValue"
+ style="float: right; margin-right: 10px"
+ type="datetimerange"
+ range-separator="���"
+ start-placeholder="������������"
+ end-placeholder="������������"
+ @change="dateChange"
+ />
<!-- ������/��������������������� -->
- <el-select v-model="dataTypeValue" placeholder="������������" style="
+ <el-select
+ v-model="dataTypeValue"
+ placeholder="������������"
+ style="
float: right;
line-height: 40px;
margin-right: 10px;
width: 103px;
- ">
- <el-option v-for="item in dataTypeList" :key="item.value" :label="item.label" :value="item.value" />
+ "
+ >
+ <el-option
+ v-for="item in dataTypeList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
</el-select>
</div>
- <div v-if="noneData" class="noneData">������������������������������</div>
- <div id="map_container" v-loading="loading" />
+ <div
+ v-if="noneData"
+ class="noneData"
+ >
+ ������������������������������
+ </div>
+ <div
+ id="map_container"
+ v-loading="loading"
+ />
<!-- ������������ -->
</el-container>
</el-container>
@@ -155,65 +270,128 @@
<!-- <img src="/img/pollutionlevel.png" class="sensorLevel">
<div id="cpm">���������������������</div> -->
<!-- 6��������������� -->
- <el-dialog title="6���������" :visible.sync="dialogFormVisible" width="1000px">
- <el-descriptions title="������6���" :column="3" border>
- <el-descriptions-item label="PM2.5 | ug/m��" label-class-name="my-label" content-class-name="my-content">22</el-descriptions-item>
- <el-descriptions-item label="PM10 | ug/m��">34</el-descriptions-item>
- <el-descriptions-item label="SO2 | ug/m��">4</el-descriptions-item>
- <el-descriptions-item label="NO2 | ug/m��">16</el-descriptions-item>
- <el-descriptions-item label="CO | mg/m��">0.5</el-descriptions-item>
- <el-descriptions-item label="O3 | ug/m��">149</el-descriptions-item>
+ <el-dialog
+ title="6���������"
+ :visible.sync="dialogFormVisible"
+ width="1000px"
+ >
+ <el-descriptions
+ title="������6���"
+ :column="3"
+ border
+ >
+ <el-descriptions-item
+ label="PM2.5 | ug/m��"
+ label-class-name="my-label"
+ content-class-name="my-content"
+ >
+ 22
+ </el-descriptions-item>
+ <el-descriptions-item label="PM10 | ug/m��">
+ 34
+ </el-descriptions-item>
+ <el-descriptions-item label="SO2 | ug/m��">
+ 4
+ </el-descriptions-item>
+ <el-descriptions-item label="NO2 | ug/m��">
+ 16
+ </el-descriptions-item>
+ <el-descriptions-item label="CO | mg/m��">
+ 0.5
+ </el-descriptions-item>
+ <el-descriptions-item label="O3 | ug/m��">
+ 149
+ </el-descriptions-item>
</el-descriptions>
<!-- <el-descriptions title="���������������" border>
</el-descriptions> -->
- <div style="
+ <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
+ :data="sensorTableData"
+ border
+ >
+ <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="���������������" />
+ <el-input
+ v-model="scope.row.tab1"
+ placeholder="���������������"
+ />
<!-- <span v-show="!scope.row.show">{{ scope.row.tab1 }}</span> -->
</template>
</el-table-column>
<el-table-column label="������">
<template slot-scope="scope">
- <el-input v-model="scope.row.tab2" placeholder="���������������" />
+ <el-input
+ v-model="scope.row.tab2"
+ placeholder="���������������"
+ />
</template>
</el-table-column>
<el-table-column label="������">
<template slot-scope="scope">
- <el-input v-model="scope.row.tab3" placeholder="���������������" />
+ <el-input
+ v-model="scope.row.tab3"
+ placeholder="���������������"
+ />
</template>
</el-table-column>
<el-table-column label="������">
<template slot-scope="scope">
- <el-input v-model="scope.row.tab4" placeholder="���������������" />
+ <el-input
+ v-model="scope.row.tab4"
+ placeholder="���������������"
+ />
</template>
</el-table-column>
<el-table-column label="������">
<template slot-scope="scope">
- <el-input v-model="scope.row.tab5" placeholder="���������������" />
+ <el-input
+ v-model="scope.row.tab5"
+ placeholder="���������������"
+ />
</template>
</el-table-column>
<el-table-column label="������">
<template slot-scope="scope">
- <el-input v-model="scope.row.tab6" placeholder="���������������" />
+ <el-input
+ v-model="scope.row.tab6"
+ placeholder="���������������"
+ />
</template>
</el-table-column>
</el-table>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">��� ���</el-button>
- <el-button type="primary" @click="customLevel">��� ���</el-button>
+ <div
+ slot="footer"
+ class="dialog-footer"
+ >
+ <el-button @click="dialogFormVisible = false">
+ ��� ���
+ </el-button>
+ <el-button
+ type="primary"
+ @click="customLevel"
+ >
+ ��� ���
+ </el-button>
</div>
</el-dialog>
</div>
@@ -406,7 +584,7 @@
}
export default {
components: { index },
- data() {
+ data () {
return {
inputnum: 50,
tableData: [],
@@ -436,19 +614,19 @@
viewOptions: ['������', '������'],
dateValue: [],
pickerOptions: {
- disabledDate(time) {
+ disabledDate (time) {
return time.getTime() > Date.now()
},
shortcuts: [
{
text: '������',
- onClick(picker) {
+ onClick (picker) {
picker.$emit('pick', new Date())
}
},
{
text: '������',
- onClick(picker) {
+ onClick (picker) {
const date = new Date()
date.setTime(date.getTime() - 3600 * 1000 * 24)
picker.$emit('pick', date)
@@ -456,7 +634,7 @@
},
{
text: '���������',
- onClick(picker) {
+ onClick (picker) {
const date = new Date()
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', date)
@@ -645,7 +823,7 @@
}
},
watch: {
- dataTypeValue(n, o) {
+ dataTypeValue (n, o) {
if (this.dataTypeValue === 'webSocket') {
this.dateValue = []
this.historyView = false
@@ -656,12 +834,12 @@
this.webSocketView = false
}
},
- dateValue(n, o) {
+ dateValue (n, o) {
if (n === null) {
this.dateValue = []
}
},
- viewKey(n, o) {
+ viewKey (n, o) {
// console.log(n)
},
deep: true,
@@ -686,7 +864,7 @@
// immediate: true
// }
},
- mounted() {
+ mounted () {
// this.$watch('carMac', () => {
if (this.dataType === 'history') {
this.getStart()
@@ -695,8 +873,8 @@
}
// })
},
- beforeDestroy() {},
- created() {
+ beforeDestroy () {},
+ created () {
this.newTime(this.timeValue)
this.newDate()
this.getCarData()
@@ -705,11 +883,11 @@
// })
},
methods: {
- handleRemove(file, fileList) {
+ handleRemove (file, fileList) {
// console.log(file, fileList)
},
- handleChange(file, fileList) {
- var str = file.name //���������4���
+ handleChange (file, fileList) {
+ var str = file.name // ���������4���
let a = str.substring(str.length - 3)
// console.log(a)
if (a === 'png') {
@@ -721,7 +899,7 @@
}
// console.log(file.name, 'file')
},
- insLuDuan() {
+ insLuDuan () {
// if (this.startL == '') {
// this.$message({
// message: '���������������������',
@@ -794,22 +972,22 @@
})
},
- //������������
- insertL() {
+ // ������������
+ insertL () {
$('.insLu').show()
},
- insqu() {
+ insqu () {
$('.insLu').hide()
this.qnull()
},
- qnull() {
+ qnull () {
// this.startL = ''
// this.endL = ''
this.tableData = []
this.Lname = ''
},
// ������������������
- newTime2(timeArr) {
+ newTime2 (timeArr) {
var arr = []
timeArr.map(v => {
var date = new Date(v)
@@ -829,7 +1007,7 @@
return arr
},
// ���������������������
- deviceDetail(mac, item, items, indexs) {
+ deviceDetail (mac, item, items, indexs) {
// console.log('������������������������')
// console.log(mac)
// console.log(item)
@@ -857,17 +1035,17 @@
})
},
// 6���������������
- customLevel() {
+ customLevel () {
this.getStart()
this.dialogFormVisible = false
},
// ���������������������������������
- changeCarData(e) {
+ changeCarData (e) {
this.carMac = e.mac
this.getStart()
},
// ���������������������������
- getCarData() {
+ getCarData () {
this.$request({
url: '/cruiser/selectCruisers',
method: 'get'
@@ -881,7 +1059,7 @@
})
},
// ������mac������������������������������
- getMacDate() {
+ getMacDate () {
this.isDataList = []
this.$request({
url: '/cruiser/getDates',
@@ -906,11 +1084,11 @@
})
},
// ���������������������������������������
- Rad(d) {
+ Rad (d) {
return (d * Math.PI) / 180.0 // ���������������������������������������������������
},
// ���������������������������������������������������������������������������������������
- GetDistance(lat1, lng1, lat2, lng2) {
+ GetDistance (lat1, lng1, lat2, lng2) {
var radLat1 = this.Rad(lat1)
var radLat2 = this.Rad(lat2)
var a = radLat1 - radLat2
@@ -931,7 +1109,7 @@
return s
},
// ���������������
- newDate() {
+ newDate () {
var aData = new Date()
var month =
aData.getMonth() < 9
@@ -941,7 +1119,7 @@
this.sensorDate = aData.getFullYear() + '-' + month + '-' + date
},
// ���������������
- newTime(timeArr) {
+ newTime (timeArr) {
let str = ''
let str2 = ''
this.sensorTime = []
@@ -957,7 +1135,7 @@
})
},
// ������������
- dateChange(e) {
+ dateChange (e) {
if (e === null) {
this.sensorDate = []
} else {
@@ -991,7 +1169,7 @@
// this.isDisTime = false
// },
// ������������������������
- blurChange() {
+ blurChange () {
// ������������������
this.newTime(this.timeValue)
if (this.view) {
@@ -1004,7 +1182,7 @@
this.getStart()
},
// ���������������������������
- wsStart() {
+ wsStart () {
if (this.ws) {
this.ws.close()
console.log('������ws')
@@ -1052,7 +1230,7 @@
}
},
// ���������������������
- getStart() {
+ getStart () {
this.noneData = false
if (this.ws) {
this.ws.close()
@@ -1086,7 +1264,7 @@
})
},
// ������������������������
- initStart(res) {
+ initStart (res) {
// console.log(res.data, 'res.data')
this.abc += 1
const that = this
@@ -1146,8 +1324,7 @@
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.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) {
@@ -1236,7 +1413,7 @@
draw(that.sensor, that.viewType, that.carMac)
// drawLine()// ������
drawStartAndEnd() // ���������������������
- function draw(sensor, type, carMac, point) {
+ function draw (sensor, type, carMac, point) {
var levels = getGrading(sensor, type, carMac, point)
$.each(levels, function (index, value) {
var color = value.color
@@ -1265,7 +1442,7 @@
}
// ���������������������������������
- function drawPolygon(sensor) {
+ function drawPolygon (sensor) {
$.each(that.showPoints, function (item, point) {
var sw = getPoint(225, point.lng, point.lat, that.distance)
var ne = getPoint(45, point.lng, point.lat, that.distance)
@@ -1288,7 +1465,7 @@
}
// ���������������������
- function drawStartAndEnd() {
+ function drawStartAndEnd () {
var startIcon = new BMapGL.Icon(
require('@/assets/images/start.png'),
new BMapGL.Size(48, 48)
@@ -1313,7 +1490,7 @@
}
// ���������������������
- function drawLine() {
+ function drawLine () {
var data = []
var points = []
$.each(trackPoints, function (index, value) {
@@ -1340,7 +1517,7 @@
}
// ������������>=size���������points
- function getShowPoints(size) {
+ function getShowPoints (size) {
var points = []
points.push(trackPoints[0])
for (var i = 1; i < trackPoints.length; i++) {
@@ -1365,7 +1542,7 @@
}
// ���������������������������������������
- function getPoint(angle, lng, lat, distance) {
+ function getPoint (angle, lng, lat, distance) {
var EARTH_RADIUS = 6378137
// ���������������������������������������
var ra = distance / EARTH_RADIUS
@@ -1390,7 +1567,7 @@
return new BMapGL.Point(lng, lat)
}
- function getGrading(sensor, type, carMac) {
+ function getGrading (sensor, type, carMac) {
var levels = []
var level0 = {}
var level1 = {}
@@ -1538,7 +1715,7 @@
levels.push(level0, level1, level2, level3, level4, level5, level6)
return levels
}
- function getColorAndLevel(senosor, data) {
+ function getColorAndLevel (senosor, data) {
var levelData = that.sensorTableData
var colorAndLevel = {}
var color
@@ -1719,7 +1896,7 @@
}
// point���������label������
- function setLabelStyle(content, point) {
+ function setLabelStyle (content, point) {
var label = new BMapGL.Label(
`<span class="my-maptip" data-times="${point.times}">${content}<span>`, // ���lable������������
{
@@ -1773,8 +1950,8 @@
label.setStyle(labelStyle)
that.map.addOverlay(label)
}
- //���������������������������
- function comparedate(date1, date2) {
+ // ���������������������������
+ function comparedate (date1, date2) {
let oDate1 = new Date(date1)
let oDate2 = new Date(date2)
if (oDate1.getTime() > oDate2.getTime()) {
@@ -1792,7 +1969,7 @@
}
// ������������,������������������
- function showNoPoints() {
+ function showNoPoints () {
that.map.centerAndZoom('���������', 17)
setTimeout(function () {
document.getElementById('cpm').style.display = 'block'
@@ -1812,7 +1989,7 @@
})
// var that = this
- function clickChange() {
+ function clickChange () {
$('.carTop').on('click', () => {
// console.log('���������')
that.view.removeAllLayers()
@@ -1841,7 +2018,7 @@
clickChange()
}
},
- changeCode(index) {
+ changeCode (index) {
this.changeColor = index
// var pr = ''
switch (index) {
@@ -1883,7 +2060,7 @@
})
this.initStart()
},
- changeCode1(index) {
+ changeCode1 (index) {
this.changeColor1 = index
if (index === 0) {
this.viewKey = '2D'
--
Gitblit v1.8.0