guanqb
2023-01-30 9bc4dcfe0928011e4e986014a2bb5bf3b897e292
src/views/activity/index.vue
@@ -466,6 +466,7 @@
<script>
import { getSecurityList, getPoliceList, getCarList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, updateActivityPolice, updateActivityCar, getServiceDictionary, getActivityType, addSecurityPlot, getSecurityPlotList, updateSecurityPlot } from '@/api/activity/index.js'
import { getSearchExtensively } from '@/api/dept/index.js'
import { getRegionList, getDevices } from '@/api/video/index.js'
import flvjs from 'flv.js'
let analyseLayer = null
@@ -677,6 +678,16 @@
                video7: true,
                video8: true,
            },
            flvListPlayer: {
                flvPlayer1: null,
                flvPlayer2: null,
                flvPlayer3: null,
                flvPlayer4: null,
                flvPlayer5: null,
                flvPlayer6: null,
                flvPlayer7: null,
                flvPlayer8: null,
            },
        }
    },
    created () {
@@ -694,6 +705,9 @@
        this.getCarList()
        this.getSecurityList(this.currentPage, this.pagesize)
    },
    mounted () {
        this.$parent.$parent.resize('400px', true)
@@ -866,6 +880,7 @@
                layerName: 'newCarDrawLayers',
                type: 'VectorLayer'
            })
            polylineAreaLayer.clear()
            getSecurityCarList(securityId).then(res => {
                this.isHavePoliceCar = res.data.data.some(item => {
                    return item.type == 3
@@ -892,10 +907,14 @@
                            let polygon = new global.DC.Polygon(coords)
                            polygon.setStyle({
                                material: global.DC.Color.RED.withAlpha(0.4)
                            })
                            polylineAreaLayer.addOverlay(polygon)
                            // polylineAreaLayer.show = false
                            let positionStr = ''
                            coords.forEach(item => {
                                positionStr += item[0] + ',' + item[1] + ';'
                            })
                            this.getRegionList(positionStr)
                        }
                        this.$EventBus.$emit('layerPolylineAdd', {
                            layerName: 'newCarDrawLayers',
@@ -1530,6 +1549,61 @@
            this.searchExtensivelyValue = ''
            this.searchExtensivelyChange()
        },
        getRegionList (positionNewStr) {
            getRegionList(1, 15, positionNewStr).then(res => {
                console.log(11, res.data.data.list)
                let monitorData = res.data.data.list
                this.monitorOption = []
                monitorData.forEach((item, index) => {
                    let flvAddress = ''
                    getDevices(item.channelId).then(res => {
                        if ('data' in res.data) {
                            flvAddress = res.data.data.flv
                            console.log(1111, flvAddress)
                        } else {
                            flvAddress = 'nodata'
                            console.log(222, flvAddress)
                        }
                        this.monitorOption.push({ value: `${index}`, label: `${item.name}`, flvUrl: `${flvAddress}` })
                        if (index == monitorData.length - 1) {
                            this.monitorOption.forEach((itemm, indexx) => {
                                if (indexx < 4) {
                                    this.monitor[`type${indexx + 5}`] = itemm.label
                                    this.playVideoList(`flvPlayer${indexx + 5}`, `${itemm.flvUrl}`, `videoElement${indexx + 5}`)
                                }
                            })
                        }
                    })
                })
            })
        },
        playVideoList (flvItemPlayer, flvUrl, videoEleName) {
            if (this.flvListPlayer[flvItemPlayer] != null) {
                this.flvListPlayer[flvItemPlayer].pause()
                this.flvListPlayer[flvItemPlayer].unload()
                this.flvListPlayer[flvItemPlayer].detachMediaElement()
                this.flvListPlayer[flvItemPlayer].destroy()
                this.flvListPlayer[flvItemPlayer] = null
            }
            if (flvjs.isSupported() && flvUrl != 'nodata') {
                let videoElement = document.getElementById(videoEleName)
                this.flvListPlayer[flvItemPlayer] = flvjs.createPlayer({
                    type: 'flv',
                    isLive: true,
                    hasAudio: false,
                    url: flvUrl
                })
                this.flvListPlayer[flvItemPlayer].attachMediaElement(videoElement)
                this.flvListPlayer[flvItemPlayer].load()
                this.flvListPlayer[flvItemPlayer].play()
            }
        },
    },
    computed: {