| | |
| | | @change="dateChange" |
| | | />--> |
| | | <!-- 选择时间段 --> |
| | | <el-time-picker |
| | | :disabled="isDisTime" |
| | | style="float:right;width: 210px" |
| | | is-range |
| | | v-model="timeValue" |
| | | @blur="blurChange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | placeholder="选择时间范围"> |
| | | </el-time-picker> |
| | | <!-- <el-time-picker--> |
| | | <!-- :disabled="isDisTime"--> |
| | | <!-- style="float:right;width: 210px"--> |
| | | <!-- is-range--> |
| | | <!-- v-model="timeValue"--> |
| | | <!-- @blur="blurChange"--> |
| | | <!-- range-separator="至"--> |
| | | <!-- start-placeholder="开始时间"--> |
| | | <!-- end-placeholder="结束时间"--> |
| | | <!-- placeholder="选择时间范围">--> |
| | | <!-- </el-time-picker>--> |
| | | <!-- 历史日期选择下拉框 --> |
| | | <el-select v-if="historyView" v-model="dateValue" placeholder="选择日期" style="float:right;line-height:40px;margin-right:10px;width:140px" @change="dateChange"> |
| | | <el-option |
| | | v-for="item in isDataList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | @click.native="dataChangeClick" |
| | | /> |
| | | </el-select> |
| | | <!-- <el-select v-if="historyView" v-model="dateValue" placeholder="选择日期" style="float:right;line-height:40px;margin-right:10px;width:140px" @change="dateChange">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in isDataList"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.value"--> |
| | | <!-- @click.native="dataChangeClick"--> |
| | | <!-- />--> |
| | | <!-- </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="结束日期"> |
| | | </el-date-picker> |
| | | <!-- 历史/实时切换下拉框 --> |
| | | <el-select v-model="dataTypeValue" placeholder="数据类型" style="float:right;line-height:40px;margin-right:10px;width:103px"> |
| | | <el-option |
| | |
| | | <script> |
| | | import $ from 'jquery' |
| | | import '@/assets/icon/iconfont.css' |
| | | import requestObj from '@/utils/request' |
| | | var GPS = { |
| | | PI: 3.14159265358979324, |
| | | x_pi: 3.14159265358979324 * 3000.0 / 180.0, |
| | |
| | | '平铺', |
| | | '立体' |
| | | ], |
| | | dateValue: null, |
| | | dateValue: [], |
| | | pickerOptions: { |
| | | disabledDate(time) { |
| | | return time.getTime() > Date.now() |
| | |
| | | picker.$emit('pick', date) |
| | | } |
| | | }] |
| | | }, |
| | | timeOne: '', |
| | | threeOptions: { |
| | | onPick: ({ maxDate, minDate }) => { |
| | | // 最大时间 最小时间 |
| | | this.timeOne = minDate.getTime() // 当选一个日期时 就是最小日期 |
| | | // 如何你选择了两个日期了,就把那个变量置空 |
| | | if (maxDate) this.timeOne = '' |
| | | }, |
| | | disabledDate: time => { |
| | | if (this.timeOne) { |
| | | const WEEK = 3 * 24 * 3600 * 1000 - 1 // 这里乘以3再减去1相当于 限制3天以内 |
| | | const minTime = this.timeOne// 三天之前 |
| | | const maxTime = this.timeOne + WEEK // 三天之后 |
| | | return time.getTime() < minTime || time.getTime() > maxTime || time.getTime() > new Date() |
| | | } else { |
| | | return time.getTime() > new Date() |
| | | } |
| | | } |
| | | }, |
| | | sensorDate: null, |
| | | noneData: false, |
| | |
| | | watch: { |
| | | dataTypeValue(n, o) { |
| | | if (this.dataTypeValue === 'webSocket') { |
| | | this.dateValue = null |
| | | this.dateValue = [] |
| | | this.historyView = false |
| | | this.webSocketView = true |
| | | } else { |
| | | this.dateValue = null |
| | | this.dateValue = [] |
| | | this.historyView = true |
| | | this.webSocketView = false |
| | | } |
| | | }, |
| | | dateValue(n, o) { |
| | | if (n === null) { |
| | | this.dateValue = [] |
| | | } |
| | | }, |
| | | viewKey(n, o) { |
| | | // console.log(n) |
| | | } |
| | | }, |
| | | deep: true, |
| | | immediate: true |
| | | // timeValue: { |
| | | // handler(newVal, oldVal) { |
| | | // this.sensorTime = this.newTime() |
| | |
| | | this.newTime(this.timeValue) |
| | | this.newDate() |
| | | this.getCarData() |
| | | this.$watch('carMac', () => { |
| | | this.getMacDate() |
| | | }) |
| | | // this.$watch('carMac', () => { |
| | | // this.getMacDate() |
| | | // }) |
| | | }, |
| | | methods: { |
| | | // 时间处理函数 |
| | | newTime2(timeArr) { |
| | | var arr = [] |
| | | timeArr.map(v => { |
| | | var date = new Date(v) |
| | | var y = date.getFullYear() |
| | | var m = date.getMonth() + 1 |
| | | m = m < 10 ? '0' + m : m |
| | | var d = date.getDate() |
| | | d = d < 10 ? '0' + d : d |
| | | var h = date.getHours() |
| | | h = h < 10 ? '0' + h : h |
| | | var minute = date.getMinutes() |
| | | minute = minute < 10 ? '0' + minute : minute |
| | | var s = date.getSeconds() |
| | | s = s < 10 ? '0' + s : s |
| | | arr.push(y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s) |
| | | }) |
| | | return arr |
| | | }, |
| | | // 跳转设备详情页 |
| | | deviceDetail(mac, item, items, indexs) { |
| | | // console.log('这是传输过去的值') |
| | |
| | | this.$request({ |
| | | url: '/cruiser/selectCruisers', |
| | | method: 'get' |
| | | }) |
| | | .then(res => { |
| | | }).then(res => { |
| | | this.defaultData = res.data |
| | | this.carMac = res.data[0].mac |
| | | }) |
| | | .catch(err => { |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | |
| | | params: { |
| | | mac: this.carMac |
| | | } |
| | | }) |
| | | .then(res => { |
| | | }).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] |
| | |
| | | label: res.data[i] |
| | | }) |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | // 数据类型 |
| | | dateChange(e) { |
| | | this.sensorDate = e; |
| | | // if (this.view) { |
| | | // this.view.removeAllLayers() |
| | | // this.map.clearOverlays() |
| | | // // console.log('清除图层') |
| | | // } |
| | | // this.dataType = 'history' |
| | | // // this.map = null |
| | | // this.getStart() |
| | | }, |
| | | // 日期选择点击事件 |
| | | dataChangeClick(e) { |
| | | if (!this.isDisTime) { |
| | | // 更改时间格式 |
| | | this.newTime(this.timeValue) |
| | | if (e === null) { |
| | | this.sensorDate = [] |
| | | } else { |
| | | this.sensorDate = this.newTime2(e) |
| | | if (this.view) { |
| | | this.view.removeAllLayers() |
| | | this.map.clearOverlays() |
| | |
| | | // this.map = null |
| | | this.getStart() |
| | | } |
| | | this.isDisTime = false |
| | | }, |
| | | // 日期选择点击事件 |
| | | // dataChangeClick(e) { |
| | | // if (!this.isDisTime) { |
| | | // // 更改时间格式 |
| | | // if (this.dateValue.length <= 1) { |
| | | // this.newTime(this.timeValue) |
| | | // } |
| | | // if (this.view) { |
| | | // this.view.removeAllLayers() |
| | | // this.map.clearOverlays() |
| | | // // console.log('清除图层') |
| | | // } |
| | | // this.dataType = 'history' |
| | | // // this.map = null |
| | | // this.getStart() |
| | | // } |
| | | // this.isDisTime = false |
| | | // }, |
| | | // 时间选框失去焦点 |
| | | blurChange() { |
| | | // 更改时间格式 |
| | |
| | | } |
| | | that.dataType = 'webSocket' |
| | | // 拼写URL |
| | | // const baseUrl = `${requestObj.baseUrl}` |
| | | var socketUrl = 'cruiserWebsocket/' + this.carMac |
| | | // 替换http为WS |
| | | socketUrl = socketUrl.replace('https', 'ws').replace('http', 'ws') |
| | |
| | | that.msgTemp.pop() |
| | | } |
| | | } |
| | | |
| | | }, |
| | | // 走航车轨迹数据 |
| | | getStart() { |
| | |
| | | this.view.removeAllLayers() |
| | | this.map.clearOverlays() |
| | | } |
| | | var time1 = this.sensorDate + ' ' + this.sensorTime[0] |
| | | var time2 = this.sensorDate + ' ' + this.sensorTime[1] |
| | | |
| | | this.$request({ |
| | | url: '/cruiser/cruiserTrajectory', |
| | | method: 'get', |
| | | params: { |
| | | mac: this.carMac, |
| | | time1, |
| | | time2 |
| | | time1: this.sensorDate[0], |
| | | time2: this.sensorDate[1] |
| | | } |
| | | }).then(res => { |
| | | console.log(res); |
| | | if (!res.data.length) { |
| | | this.noneData = true |
| | | this.loading = false |
| | |
| | | this.loading = false |
| | | if (this.responseJSON.length > 0) { |
| | | this.noneData = false |
| | | console.log(that.carMac, 'mac') |
| | | $.each(this.responseJSON, (item, value) => { |
| | | if (typeof (value.flylon) === 'undefined') { |
| | | showNoPoints() |
| | |
| | | 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') { |
| | | if (value.dustld - 0 !== 0 && value.dustld - 0 < 100 && (that.carMac === 'p5dnd7a0243622' || that.carMac === 'p5dnd7a0243625')) { |
| | | point.dustld = 100 |
| | | } else { |
| | | point.dustld = value.dustld - 0 |