| | |
| | | <input v-model="searchValue" @input="searchChange" type="text" placeholder="请输入搜索条件" /> |
| | | <button @click="searchClick" class="el-icon-search"></button> |
| | | </div> |
| | | <div class="draw-btn"> |
| | | 新增路线: |
| | | <el-button type="primary" size="mini" @click="draw('polyline')">新增路线</el-button> |
| | | <el-button type="primary" size="mini" @click="removeDrawLayer">清除</el-button> |
| | | </div> |
| | | |
| | | <div v-show="true" class="search-val-box"> |
| | | <div @click="searchVlaClick(item)" v-for="(item, index) in searchArray" :key="index">{{ item.name }} |
| | |
| | | <el-table-column prop="name" label="范围名称" min-width="50%"></el-table-column> |
| | | <el-table-column prop="extent" label="长度km/面积㎡" min-width="50%"> |
| | | <!-- <template slot-scope="scope"> |
| | | <span>{{ scope.row.extent }}</span> |
| | | <span>千米</span> |
| | | </template>--> |
| | | <span>{{ scope.row.extent }}</span> |
| | | <span>千米</span> |
| | | </template>--> |
| | | </el-table-column> |
| | | <el-table-column prop="id" label="操作" min-width="50%"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-button @click="editRangeVisible = false">取消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog title="新增路线" :modal="false" :visible.sync="drawDialogVisible" :before-close="drawDialogBeforeClose" |
| | | :close-on-click-modal="true" class="video-draw-box"> |
| | | <div> |
| | | <div>名称:</div> |
| | | <input type="text" v-model="drawName" placeholder="请输入绘制线的名称" /> |
| | | </div> |
| | | <div> |
| | | <div>范围:</div> |
| | | <input type="text" v-model="range" placeholder="请输入绘制线的范围" /> |
| | | </div> |
| | | <div class="line"> |
| | | <div class="value-name-box">颜色:</div> |
| | | <div class="pick-color-box"> |
| | | <el-color-picker v-model="chooseAddRangeColor" :predefine="predefineColors" size="small"> |
| | | </el-color-picker> |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <button @click="saveDrawInfo">保存</button> |
| | | <button @click="cancelSaveDrawInfo">取消</button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import EntityDraw from "@/utils/EntityDraw.js" |
| | | import { listQuery, accurateSearch } from "@/utils/search.js" |
| | | import { getVideoList, getDevices, getRegionSaveList, deleteRegionSaveList, getRegionList, updataRegionSaveList } from '@/api/video/index.js' |
| | | import { getVideoList, getDevices, getRegionSaveList, deleteRegionSaveList, getRegionList, updataRegionSaveList, insertRegionSaveList, getRegionListAll } from '@/api/video/index.js' |
| | | import flvjs from 'flv.js' |
| | | |
| | | // let graphicLayer = null |
| | | let rangeLayer = null |
| | | let rangeLineLayer = null |
| | | let drawPlotLayers = null |
| | | let plot = undefined |
| | | let drwaPlot = undefined |
| | | let videoTimer = null |
| | | let videoLineIndex = -1 |
| | | |
| | | import { initMapPosition } from '@/utils/mapPositionInit' |
| | | |
| | |
| | | |
| | | data () { |
| | | return { |
| | | drawDialogVisible: false, |
| | | currentPage: 1, |
| | | pagesize: 13, |
| | | pagesCount: 1, |
| | |
| | | video8: false, |
| | | }, |
| | | chooseRangeColor: '#FF0000', |
| | | chooseAddRangeColor: '#FF0000', |
| | | editRangeVisible: false, |
| | | lineWidth: '', |
| | | rangeOverlayData: {}, |
| | |
| | | 'hsla(209, 100%, 56%)', |
| | | '#c7158577' |
| | | ], |
| | | drawType: 1, |
| | | } |
| | | }, |
| | | |
| | |
| | | if (rangeLineLayer == null) { |
| | | rangeLineLayer = new global.DC.VectorLayer('rangeLineLayer') |
| | | global.viewer.addLayer(rangeLineLayer) |
| | | } |
| | | if (drawPlotLayers == null) { |
| | | drawPlotLayers = new global.DC.VectorLayer('drawPlotLayers') |
| | | global.viewer.addLayer(drawPlotLayers) |
| | | drwaPlot = new global.DC.Plot(global.viewer, { |
| | | clampToModel: true |
| | | }) |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | this.saveRangeList.forEach(item => { |
| | | console.log(item, 656565656) |
| | | let positionStr = '' |
| | | if (item.type == 1) { |
| | | let linePositionStr = '' |
| | | linePositionStr = item.positions.replace(/,/g, ';') |
| | | linePositionStr = linePositionStr.replace(/ /g, ',') |
| | | linePositionStr += ';' |
| | | let coords = global.DC.GeoTools.polylineBuffer(linePositionStr, 100) |
| | | let coords = global.DC.GeoTools.polylineBuffer(linePositionStr, item.width) |
| | | let polygon = new global.DC.Polygon(coords) |
| | | let position = '' |
| | | polygon._positions.forEach(item => { |
| | |
| | | |
| | | initMonitoringIcon () { |
| | | this.monitoringList.forEach((item, index) => { |
| | | let iconUrl = item.status == 0 ? '/img/icon/video-off.png' : '/img/icon/video.png' |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'monitoringLayers', |
| | | type: "billboard", |
| | |
| | | lng: item.longitude, |
| | | lat: item.latitude, |
| | | alt: 1, |
| | | url: '/img/icon/video.png', |
| | | url: iconUrl, |
| | | // deviceId: item.deviceId |
| | | }, |
| | | // incident: this.siteClick |
| | |
| | | type: 'VectorLayer' |
| | | }) |
| | | } else { |
| | | clearInterval(videoTimer) |
| | | |
| | | this.isShowVideo = { |
| | | video1: false, |
| | | video2: false, |
| | |
| | | id: row.id |
| | | }).then(res => { |
| | | let monitorData = res.data.data.list |
| | | |
| | | this.monitoringList = res.data.data.list |
| | | this.$EventBus.$emit('mapRemoveLayer', { |
| | | layerName: 'monitoringLayers', |
| | |
| | | let positionStr = row.positions.replace(/,/g, ';') |
| | | positionStr = positionStr.replace(/ /g, ',') |
| | | positionStr += ';' |
| | | let coords = global.DC.GeoTools.polylineBuffer(positionStr, row.width) |
| | | let polygon = new global.DC.Polygon(coords) |
| | | let position = '' |
| | | polygon._positions.forEach(item => { |
| | | position += item._lng + ',' + item._lat + ';' |
| | | let positionArr = positionStr.slice(0, positionStr.length - 1).split(';') |
| | | let positionNewArr = [] |
| | | positionArr.forEach(item => { |
| | | positionNewArr.push([Number(item.split(',')[0]), Number(item.split(',')[1])]) |
| | | }) |
| | | getRegionList({ |
| | | page: 1, |
| | | count: 20, |
| | | range: position |
| | | }).then(res => { |
| | | let monitorData = res.data.data.list |
| | | // 按距离获取路线划分块 |
| | | let videoLine = this.$turf.lineString(positionNewArr) |
| | | let videoChunk = this.$turf.lineChunk(videoLine, 0.1, { units: 'kilometers' }) |
| | | videoLineIndex = -1 |
| | | this.initVideoLineFrag(videoChunk, row) |
| | | videoTimer = setInterval(() => { |
| | | this.initVideoLineFrag(videoChunk, row) |
| | | }, 60000) |
| | | |
| | | this.monitoringList = res.data.data.list |
| | | this.$EventBus.$emit('mapRemoveLayer', { |
| | | layerName: 'monitoringLayers', |
| | | type: 'VectorLayer' |
| | | }) |
| | | |
| | | this.initMonitoringIcon() |
| | | |
| | | this.monitorOption = [] |
| | | |
| | | monitorData.forEach((item, index) => { |
| | | this.monitorOption.push({ value: index, label: item.name, item }) |
| | | |
| | | if (index < 8) { |
| | | const ind = index + 1 |
| | | this.isShowVideo[`video${ind}`] = true |
| | | this.monitor[`type${ind}`] = item.name |
| | | if (item.status == 0) { |
| | | this.isShowOutline[`video${ind}`] = true |
| | | } |
| | | |
| | | this.getDevices(item.channelId).then(res => { |
| | | this.playVideoList(`flvPlayer${ind}`, `${res}`, `videoElement${ind}`, `${ind}`) |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | } |
| | |
| | | // this.flvPlayer.play() |
| | | // } |
| | | // }, |
| | | |
| | | initVideoLineFrag (videoChunk, row) { |
| | | videoLineIndex++ |
| | | if (videoLineIndex == videoChunk.features.length) { |
| | | clearInterval(videoTimer) |
| | | } |
| | | let positionStr = '' |
| | | let positionArr = videoChunk.features[videoLineIndex].geometry.coordinates |
| | | positionArr.forEach(item => { |
| | | positionStr += item[0] + ',' + item[1] + ';' |
| | | }) |
| | | let point1 = this.$turf.point(positionArr[0]) |
| | | let point2 = this.$turf.point(positionArr[1]) |
| | | let midpoint = this.$turf.midpoint(point1, point2).geometry.coordinates |
| | | console.log('midpoint', midpoint) |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: midpoint[0], |
| | | siteWd: midpoint[1], |
| | | siteGd: 5000, |
| | | }) |
| | | let coords = global.DC.GeoTools.polylineBuffer(positionStr, row.width) |
| | | let polygon = new global.DC.Polygon(coords) |
| | | let position = '' |
| | | polygon._positions.forEach(item => { |
| | | position += item._lng + ',' + item._lat + ';' |
| | | }) |
| | | getRegionListAll({ |
| | | range: position |
| | | }).then(res => { |
| | | let monitorData = res.data.data.filter(item => { return item.status == 1 }) |
| | | this.monitoringList = res.data.data |
| | | this.$EventBus.$emit('mapRemoveLayer', { |
| | | layerName: 'monitoringLayers', |
| | | type: 'VectorLayer' |
| | | }) |
| | | |
| | | this.initMonitoringIcon() |
| | | this.monitorOption = [] |
| | | monitorData.forEach((item, index) => { |
| | | this.monitorOption.push({ value: index, label: item.name, item }) |
| | | |
| | | if (index < 8) { |
| | | const ind = index + 1 |
| | | this.isShowVideo[`video${ind}`] = true |
| | | this.monitor[`type${ind}`] = item.name |
| | | if (item.status == 0) { |
| | | this.isShowOutline[`video${ind}`] = true |
| | | } |
| | | |
| | | this.getDevices(item.channelId).then(res => { |
| | | this.playVideoList(`flvPlayer${ind}`, `${res}`, `videoElement${ind}`, `${ind}`) |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | dialogBeforeClose () { |
| | | this.dialogVisible = false |
| | |
| | | } |
| | | }, |
| | | |
| | | // 绘制新增路线 |
| | | draw (type) { |
| | | this.drawType = 1 |
| | | |
| | | drwaPlot && drwaPlot.draw(type, overlay => { |
| | | if (overlay) { |
| | | drawPlotLayers.addOverlay(overlay) |
| | | drwaPlot.edit(overlay) |
| | | if (overlay) { |
| | | drawPlotLayers.addOverlay(overlay) |
| | | drwaPlot.edit(overlay, (e) => { |
| | | this.drawDialogVisible = true |
| | | this.range = 100 |
| | | this.drawPlotData = overlay |
| | | document.oncontextmenu = function () { |
| | | return false |
| | | } |
| | | // this.getRegionList(type, overlay) |
| | | }) |
| | | } |
| | | } |
| | | }, { material: global.DC.Color.RED }) |
| | | }, |
| | | |
| | | // 清楚绘制图层 |
| | | removeDrawLayer () { |
| | | if (drawPlotLayers != null) { |
| | | drawPlotLayers.clear() |
| | | } |
| | | }, |
| | | |
| | | // 保存绘制的线面 |
| | | saveDrawInfo () { |
| | | if (this.drawName == '') { |
| | | this.$message({ |
| | | message: '请输入名称', |
| | | type: 'error' |
| | | }) |
| | | } else { |
| | | let drawPositionStr = '' |
| | | let extent = 0 |
| | | |
| | | if (this.drawType == 1) { |
| | | // 获取线坐标 |
| | | this.drawPlotData._positions.forEach(item => { |
| | | drawPositionStr += item._lng + ' ' + item._lat + ',' |
| | | }) |
| | | drawPositionStr = drawPositionStr.slice(0, drawPositionStr.length - 1) |
| | | // 求线长度 |
| | | let linePosition = [] |
| | | this.drawPlotData._positions.forEach(item => { |
| | | linePosition.push([item._lng, item._lat]) |
| | | }) |
| | | let line = this.$turf.lineString(linePosition) |
| | | let length = this.$turf.length(line, { units: 'kilometers' }) |
| | | extent = length.toFixed(3) |
| | | } |
| | | this.insertRegionSaveList({ type: this.drawType, positions: drawPositionStr, name: this.drawName, extent: extent, width: this.range, color: this.chooseAddRangeColor }) |
| | | this.drawDialogVisible = false |
| | | this.drawName = '' |
| | | if (drawPlotLayers != null) { |
| | | drawPlotLayers.clear() |
| | | } |
| | | // this.$EventBus.$emit('mapRemoveLayer', { |
| | | // layerName: 'monitoringLayers', |
| | | // type: 'VectorLayer' |
| | | // }) |
| | | } |
| | | }, |
| | | |
| | | // 关闭新增路线弹窗 |
| | | drawDialogBeforeClose () { |
| | | this.drawName = '' |
| | | if (drawPlotLayers != null) { |
| | | drawPlotLayers.clear() |
| | | } |
| | | this.$EventBus.$emit('mapRemoveLayer', { |
| | | layerName: 'monitoringLayers', |
| | | type: 'VectorLayer' |
| | | }) |
| | | this.drawDialogVisible = false |
| | | }, |
| | | |
| | | // 取消绘制线面 |
| | | cancelSaveDrawInfo () { |
| | | this.drawDialogBeforeClose() |
| | | }, |
| | | |
| | | // type线面类型, positions坐标, name名称, width线宽度, extent线长度或面面积 |
| | | insertRegionSaveList (parmas) { |
| | | insertRegionSaveList(parmas).then(res => { |
| | | if (res.data.success) { |
| | | this.$message({ |
| | | message: '保存成功', |
| | | type: 'warning' |
| | | }) |
| | | this.getRegionSaveList(this.currentPage, this.pagesize, this.userInfo.dept_id) |
| | | } else { |
| | | this.$message({ |
| | | message: '保存失败' |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | |
| | | |
| | | //#region |
| | | // enterVideoBox (num) { |
| | |
| | | this.flvPlayer.destroy() |
| | | this.flvPlayer = null |
| | | } |
| | | |
| | | this.removeDrawLayer() |
| | | |
| | | clearInterval(videoTimer) |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | .draw-btn { |
| | | margin: 8px; |
| | | margin-top: 0; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-around; |
| | | height: 26px; |
| | | |
| | | .el-button { |
| | | flex: 1; |
| | | } |
| | | |
| | | :deep(.el-button--primary) { |
| | | background-color: #1d5ce4; |
| | | border-color: #1d5ce4; |
| | | } |
| | | } |
| | | |
| | | .list-show { |
| | | flex: 1; |
| | | |