| | |
| | | @click="checkTarget(item)" |
| | | > |
| | | <!-- <img src alt :style="{backgroundColor:item.color}"/> --> |
| | | <img :src="'/httpImage/'+item.picSmUrl" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import { getSearchList } from '@/api/search'; |
| | | import { getPanoramaPic } from "@/api/panorama"; |
| | | export default { |
| | | data () { |
| | | data() { |
| | | return { |
| | | cW: 0, |
| | | cH: 0, |
| | |
| | | pickerOptions: { |
| | | shortcuts: [{ |
| | | text: '近一小时', |
| | | onClick (picker) { |
| | | onClick(picker) { |
| | | const end = new Date(); |
| | | const start = new Date(); |
| | | start.setTime(start.getTime() - 60 * 60 * 1000); |
| | |
| | | } |
| | | }, { |
| | | text: '近三小时', |
| | | onClick (picker) { |
| | | onClick(picker) { |
| | | const end = new Date(); |
| | | const start = new Date(); |
| | | start.setTime(start.getTime() - 60 * 60 * 1000 * 3); |
| | |
| | | } |
| | | }, { |
| | | text: '近六小时', |
| | | onClick (picker) { |
| | | onClick(picker) { |
| | | const end = new Date(); |
| | | const start = new Date(); |
| | | start.setTime(start.getTime() - 60 * 60 * 1000 * 6); |
| | |
| | | isInvert: false, |
| | | } |
| | | }, |
| | | mounted () { |
| | | mounted() { |
| | | this.searchData(); |
| | | //this.filterData(); |
| | | this.getPanorama(); |
| | | |
| | | }, |
| | | beforeDestroy () { |
| | | console.log('beforeDestroy') |
| | | beforeDestroy() { |
| | | clearInterval(this.timer); |
| | | }, |
| | | methods: { |
| | | checkTime () { |
| | | checkTime() { |
| | | if (!this.searchTime) { |
| | | this.$notify({ |
| | | type: 'warning', |
| | |
| | | }); |
| | | return; |
| | | } |
| | | clearInterval(this.timer); |
| | | //判断是否是查历史数据 |
| | | if (Date.parse(this.searchTime[1]) < Date.now()) { |
| | | this.filterData() |
| | |
| | | this.searchData(); |
| | | } |
| | | }, |
| | | filterData () { |
| | | filterData() { |
| | | let _this = this; |
| | | var param = { |
| | | page: 1, |
| | | size: 5000, |
| | | searchTime: this.searchTime, |
| | | timeMark: null, |
| | | alarmlevel: [], |
| | | inputValue: '', |
| | | tabs: [], |
| | |
| | | treeNodes: [], |
| | | isAll: false |
| | | }; |
| | | clearInterval(this.timer); |
| | | //clearInterval(this.timer); |
| | | getSearchList(param).then(res => { |
| | | _this.actObjs = []; |
| | | if (!res.data.datalist) { |
| | |
| | | }) |
| | | }); |
| | | for (var i = 0; i < _this.actObjs.length; i++) { |
| | | _this.actObjs[i].color = _this.colorArr[i % 10]; |
| | | this.$set(_this.actObjs[i], 'color', _this.colorArr[i % 10]); |
| | | this.$set(_this.actObjs[i], 'isHide', _this.actObjs[i].isHide); |
| | | } |
| | | _this.drawTracePath(); |
| | | }) |
| | | }, |
| | | hideAllChange () { |
| | | hideAllChange() { |
| | | this.actObjs.forEach(target => { |
| | | target.isHide = this.isHideAll; |
| | | }); |
| | | this.drawTracePath(); |
| | | }, |
| | | invertChange () { |
| | | invertChange() { |
| | | console.log(this.isInvert) |
| | | this.actObjs.forEach(target => { |
| | | target.isHide = !target.isHide; |
| | |
| | | } |
| | | this.drawTracePath(); |
| | | }, |
| | | checkTarget (item) { |
| | | checkTarget(item) { |
| | | item.isHide = !item.isHide; |
| | | this.isHideAll = item.isHide; |
| | | this.drawTracePath(); |
| | | }, |
| | | getPanorama () { |
| | | getPanorama() { |
| | | let _this = this; |
| | | getPanoramaPic().then(res => { |
| | | let { panoramaPath, width, height } = res.data; |
| | |
| | | } |
| | | }) |
| | | }, |
| | | drawTracePath () { |
| | | drawTracePath() { |
| | | let canvas = this.$refs['trackArea']; |
| | | let ctx = canvas.getContext('2d'); |
| | | ctx.clearRect(0, 0, canvas.width, canvas.height); |
| | |
| | | } |
| | | }) |
| | | }, |
| | | searchData () { |
| | | searchData() { |
| | | let _this = this; |
| | | var param = { |
| | | page: 1, |
| | |
| | | treeNodes: [], |
| | | isAll: false |
| | | }; |
| | | if ((new Date() - _this.timeMark) < _this.intervalTime) { |
| | | return |
| | | } |
| | | getSearchList(param).then(res => { |
| | | _this.activeObjHashMap = {}; |
| | | _this.actObjs = []; |
| | | if (!res.data.datalist) { |
| | | _this.activeObjHashMap = {}; |
| | | //_this.activeObjHashMap = {}; |
| | | //_this.actObj = {}; |
| | | _this.actObjs = []; |
| | | this.$notify({ |
| | |
| | | //filterArr.push(obj) |
| | | }); |
| | | |
| | | filterArr.forEach(item => { |
| | | //filterArr.forEach(item => { |
| | | res.data.datalist.forEach(item => { |
| | | item.activeObject.targetInfo.forEach(target => { |
| | | if (target.targetType == 'UniquelID') { |
| | | let attribute = JSON.parse(target.attribute); |
| | |
| | | _this.searchStartTimeStamp = Date.parse(_this.searchTime[0]); |
| | | _this.searchEndTimeStamp = Date.parse(_this.searchTime[1]); |
| | | |
| | | // for (var target in _this.actObj) { |
| | | // _this.actObj[target] = _this.actObj[target].filter(item => |
| | | // item.timeStamp >= _this.searchStartTimeStamp && item.timeStamp <= _this.searchEndTimeStamp |
| | | // ) |
| | | // if (_this.actObj[target].length == 0) { |
| | | // delete _this.actObj[target] |
| | | // } |
| | | // } |
| | | |
| | | for (var i = 0; i < _this.actObjs.length; i++) { |
| | | _this.actObjs[i].posInfo = _this.actObjs[i].posInfo.filter(item => item.timeStamp >= _this.searchStartTimeStamp && item.timeStamp <= _this.searchEndTimeStamp) |
| | | |
| | | if (!_this.actObjs[i].posInfo.length) { |
| | | _this.actObjs.splice(i, 1); |
| | | } |
| | | _this.actObjs[i].color = _this.colorArr[i % 10]; |
| | | |
| | | this.$set(_this.actObjs[i], 'color', _this.colorArr[i % 10]); |
| | | this.$set(_this.actObjs[i], 'isHide', _this.actObjs[i].isHide); |
| | | } |
| | | console.log(new Date(), _this.actObjs); |
| | | |
| | | // var keyArr = Object.keys(_this.actObj); |
| | | // for (var i = 0; i < keyArr.length; i++) { |
| | | // _this.actObj[keyArr[i]].forEach(dot => { |
| | | // dot.color = _this.colorArr[i % 10]; |
| | | // }) |
| | | // } |
| | | // console.log(new Date(), _this.actObj) |
| | | // console.log(_this.actObjs) |
| | | |
| | | _this.drawTracePath(); |
| | | _this.timeMark = new Date(); |
| | | _this.timer = setTimeout(() => { |
| | | _this.searchData() |
| | | }, _this.intervalTime) |
| | | |
| | | |
| | | }) |
| | | } |
| | | } |
| | |
| | | .trace-plot { |
| | | .filter-bar { |
| | | width: 960px; |
| | | margin: 20px auto; |
| | | margin: 20px 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-direction: end; |