| | |
| | | end-placeholder="结束日期" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | :default-time="['00:00:00','23:59:59']" |
| | | |
| | | ></el-date-picker> |
| | | <el-button @click="searchData" size="small" type="primary" class="btn-search">查 询</el-button> |
| | | </div> |
| | | <!-- <p class="p-date" style="width:19%;vertical-align: top;"> |
| | | <el-date-picker |
| | | size="mini" |
| | | v-model="searchTime" |
| | | @change="searchData" |
| | | type="datetimerange" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | :default-time="['00:00:00','23:59:59']" |
| | | style="width:99%;min-width:200px" |
| | | ></el-date-picker> |
| | | </p> --> |
| | | <canvas ref="trackArea" width="960" height="540" :style="{backgroundImage:`url(${panoramaPath})`}"></canvas> |
| | | |
| | | <canvas |
| | | ref="trackArea" |
| | | :width="cW" |
| | | :height="cH" |
| | | :style="{backgroundImage:`url(${panoramaPath})`}" |
| | | ></canvas> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | export default { |
| | | data () { |
| | | return { |
| | | cW: 0, |
| | | cH: 0, |
| | | panoramaPath:'', |
| | | trackData: [], |
| | | activeObjHashMap: {}, |
| | |
| | | }, |
| | | mounted () { |
| | | this.searchData(); |
| | | this.getPanoramaPic(); |
| | | this.getPanorama(); |
| | | this.timer = setInterval(()=>{ |
| | | this.searchData(); |
| | | },7000); |
| | |
| | | clearInterval(this.timer); |
| | | }, |
| | | methods: { |
| | | getPanoramaPic () { |
| | | getPanorama () { |
| | | let _this = this; |
| | | getPanoramaPic().then(res=>{ |
| | | _this.panoramaPath = res.data.panoramaPath |
| | | let { panoramaPath, width, height } = res.data; |
| | | _this.panoramaPath = panoramaPath; |
| | | _this.cW = width; |
| | | _this.cH = height; |
| | | |
| | | }) |
| | | }, |
| | | drawTracePath () { |
| | | //let canvas = document.querySelector('#trackArea'); |
| | | let colorArr = ['#F4DA40','#0092BC','#97D700','#D0006F','#D86018','#653279','#A45A2A','#004B87','#008C95','#AA0061']; |
| | | let canvas = this.$refs['trackArea']; |
| | | let ctx = canvas.getContext('2d'); |
| | | ctx.clearRect(0,0,canvas.width,canvas.height); |
| | | ctx.strokeStyle = 'yellow'; |
| | | ctx.fillStyle = 'aqua'; |
| | | //ctx.globalAlpha=0.5; |
| | | ctx.lineWidth = 2; |
| | | ctx.lineWidth = 3; |
| | | //ctx.lineJoin='round'; |
| | | ctx.lineCap = 'round'; |
| | | for (var target in this.actObj) { |
| | | debugger |
| | | ctx.beginPath(); |
| | | ctx.fillStyle = `rgb(${Math.floor(Math.random() * 20 + 220)},${Math.floor(Math.random() * 35 + 200)},${Math.floor(Math.random() * 55 + 200)})`; |
| | | ctx.fillStyle = `rgb(${Math.floor(Math.random() * 55 + 150)},${Math.floor(Math.random() * 55 + 150)},${Math.floor(Math.random() * 55 + 150)})`; |
| | | |
| | | //ctx.fillRect(this.actObj[target][0].globalCoordX+3, this.actObj[target][0].globalCoordY+3, 6, 6); |
| | | ctx.arc(this.actObj[target][0].globalCoordX, this.actObj[target][0].globalCoordY, 3, 0, Math.PI*2); |
| | | ctx.fill(); |
| | | //ctx.beginPath(); |
| | | //ctx.moveTo(this.actObj[target][0].globalCoordX, this.actObj[target][0].globalCoordY); |
| | | for (var i = 1; i < this.actObj[target].length; i++) { |
| | | ctx.beginPath(); |
| | | ctx.arc(this.actObj[target][i].globalCoordX, this.actObj[target][i].globalCoordY, 3, 0, Math.PI*2); |
| | | ctx.fill() |
| | | //ctx.lineTo(this.actObj[target][i].globalCoordX, this.actObj[target][i].globalCoordY); |
| | | |
| | | //ctx.fillRect(this.actObj[target][i].globalCoordX, this.actObj[target][i].globalCoordY, 9, 9); |
| | | } |
| | | //ctx.stroke(); |
| | | } |
| | | for (var target in this.actObj) { |
| | | ctx.beginPath(); |
| | | ctx.strokeStyle = `rgb(${Math.floor(Math.random() * 20 + 220)},${Math.floor(Math.random() * 20 + 210)},${Math.floor(Math.random() * 55 + 200)})`; |
| | | ctx.fillRect(this.actObj[target][0].globalCoordX, this.actObj[target][0].globalCoordY, 9, 9); |
| | | ctx.moveTo(this.actObj[target][0].globalCoordX, this.actObj[target][0].globalCoordY); |
| | | for (var i = 1; i < this.actObj[target].length; i++) { |
| | | ctx.lineTo(this.actObj[target][i].globalCoordX, this.actObj[target][i].globalCoordY); |
| | | ctx.fillRect(this.actObj[target][i].globalCoordX, this.actObj[target][i].globalCoordY, 9, 9); |
| | | } |
| | | ctx.stroke(); |
| | | } |
| | |
| | | let _this = this; |
| | | var param = { |
| | | page: 1, |
| | | size: 70, |
| | | size: 15, |
| | | searchTime: this.searchTime, |
| | | alarmlevel: [], |
| | | inputValue: '', |
| | | tabs: [], |
| | | tasks: [], |
| | | treeNodes: [], |
| | | isAll: true |
| | | isAll: false |
| | | }; |
| | | getSearchList(param).then(res => { |
| | | let filterArr = []; |
| | |
| | | if (target.targetType == 'UniquelID') { |
| | | let attribute = JSON.parse(target.attribute) |
| | | if (_this.actObj[target.targetId]) { |
| | | _this.actObj[target.targetId].push({ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY }); |
| | | _this.actObj[target.targetId].unshift({ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY }); |
| | | } else { |
| | | _this.actObj[target.targetId] = [{ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY }]; |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | console.log(_this.actObj) |
| | | console.log(new Date().getTime(),_this.actObj) |
| | | _this.drawTracePath() |
| | | }) |
| | | } |
| | |
| | | canvas { |
| | | background: lightsteelblue; |
| | | background-repeat: no-repeat; |
| | | |
| | | } |
| | | } |
| | | </style> |