guanqb
2023-03-18 daf268f2457bcd303da96ca7829b31699be22388
活动实时警力打卡功能
2 files modified
8 files added
140 ■■■■ changed files
public/img/icon/real-car-ok.png patch | view | raw | blame | history
public/img/icon/real-car.png patch | view | raw | blame | history
public/img/icon/real-phone-ok.png patch | view | raw | blame | history
public/img/icon/real-phone.png patch | view | raw | blame | history
public/img/icon/real-public-recorder-ok.png patch | view | raw | blame | history
public/img/icon/real-public-recorder.png patch | view | raw | blame | history
public/img/icon/real-recorder-ok.png patch | view | raw | blame | history
public/img/icon/real-recorder.png patch | view | raw | blame | history
src/views/activity/components/drawBtnBox.vue 1 ●●●● patch | view | raw | blame | history
src/views/activity/index.vue 139 ●●●● patch | view | raw | blame | history
public/img/icon/real-car-ok.png
public/img/icon/real-car.png
public/img/icon/real-phone-ok.png
public/img/icon/real-phone.png
public/img/icon/real-public-recorder-ok.png
public/img/icon/real-public-recorder.png
public/img/icon/real-recorder-ok.png
public/img/icon/real-recorder.png
src/views/activity/components/drawBtnBox.vue
@@ -141,7 +141,6 @@
            global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, this.viewerLableMove)
            global.viewer.on(global.DC.MouseEventType.LEFT_UP, this.labelUp)
        })
       
    },
src/views/activity/index.vue
@@ -288,6 +288,7 @@
let drawLabelStatus = 'end'
let curLinePolygonPosition = ''
let curLinePosition = ''
let realPoliceTimer = {}
export default {
    inject: ['userInfo'],
@@ -492,6 +493,7 @@
            isNeedPolygonType: false,
            plotPointPositionStr: '',
            pointAreaWidth:100,
            dataTreeCheckedNodes:[],
        }
    },
@@ -517,15 +519,15 @@
        this.getSecurityList(this.currentPage, this.pagesize)
        //摄像头
        this.getEquipmentAll({ type: 1 })
        this.getEquipmentAll({ type: 1},'')
        //警车
        this.getEquipmentAll({ type: 0 });
        this.getEquipmentAll({ type: 0},'');
        //手台-公网
        this.getEquipmentAll({ type: "2-1" });
        this.getEquipmentAll({ type: "2-1" },'');
        //手台-专网
        this.getEquipmentAll({ type: "2-2" });
        this.getEquipmentAll({ type: "2-2" },'');
        //执法记录仪
        this.getEquipmentAll({ type: 3 })
        this.getEquipmentAll({ type: 3 },'')
    },
@@ -651,10 +653,6 @@
         * @return {*}
         */
        activityListClick (item, index) {
            if (this.currentClickIndex !== '' && this.currentClickIndex == index) {
                return
            }
            this.policeSwitch = true
            this.arrowBtnSwitch = true
            this.polylineBtnSwitch = false
@@ -721,6 +719,9 @@
            })
            this.dialogVisible = true
            // 遍历实时警力
            this.eachDataTreeCheckedNodes(this.dataTreeCheckedNodes)
        },
        // 分页页码变化事件
@@ -1246,11 +1247,13 @@
        // 树形控件选中事件
        treeCheckClick (e1, e2) {
            // 没有选中活动就不展示实时图标
            const that = this
            this.$EventBus.$emit('mapRemoveLayer', {
                layerName: 'activeHeatLayer',
                type: 'HeatLayer'
            })
            if (e1.label == '热力图' && e2.checkedKeys.some(item => {
                return item == 777
            })) {
@@ -1291,29 +1294,41 @@
                    }
                })
            }
            this.dataTreeCheckedNodes = e2.checkedNodes
            this.eachDataTreeCheckedNodes(this.dataTreeCheckedNodes)
        },
            e2.checkedNodes.some(item => {
                return item.label == '视频监控'
            }) ? this.iconImageShowOrHidden('/img/icon/camera.png', cameraList, 'activityCameraLayers') : this.clearLayerIconForMap('activityCameraLayers');
        // 遍历树数据实时图标
        eachDataTreeCheckedNodes(data){
            // 清除定时器
            if(realPoliceTimer != {}) {
                for(let item in realPoliceTimer) {
                    console.log(`定时器realPoliceTimer[${item}]关闭了`);
                    clearInterval(realPoliceTimer[item])
                }
            }
            if(data != []){
                 data.some(item => {
                     return item.label == '视频监控'
                 }) ? this.iconImageShowOrHidden('/img/icon/camera.png', '',cameraList, 'activityCameraLayers') : this.clearLayerIconForMap('activityCameraLayers');
            e2.checkedNodes.some(item => {
                return item.label == '警车'
            }) ? this.iconImageShowOrHidden('/img/icon/car.png', carList, 'activityCarLayers') : this.clearLayerIconForMap('activityCarLayers');
                 data.some(item => {
                     return item.label == '警车'
                 }) ? this.iconImageShowOrHidden('/img/icon/real-car.png','/img/icon/real-car-ok.png', carList, 'activityCarLayers') : this.clearLayerIconForMap('activityCarLayers');
            e2.checkedNodes.some(item => {
                return item.label == '公网'
            }) ? this.iconImageShowOrHidden('/img/icon/p-talk.png', talkBackEquipmentPublicList, 'activityTalkBackEquipmentPublicLayers') : this.clearLayerIconForMap('activityTalkBackEquipmentPublicLayers');
                 data.some(item => {
                     return item.label == '公网'
                 }) ? this.iconImageShowOrHidden('/img/icon/real-public-recorder.png','/img/icon/real-public-recorder-ok.png', talkBackEquipmentPublicList, 'activityTalkBackEquipmentPublicLayers') : this.clearLayerIconForMap('activityTalkBackEquipmentPublicLayers');
                 data.some(item => {
                     return item.label == '专网'
                 }) ? this.iconImageShowOrHidden('/img/icon/real-recorder.png','/img/icon/real-recorder-ok.png', talkBackEquipmentList, 'activityTalkBackEquipmentLayers') : this.clearLayerIconForMap('activityTalkBackEquipmentLayers');
            e2.checkedNodes.some(item => {
                return item.label == '专网'
            }) ? this.iconImageShowOrHidden('/img/icon/p-b-talk.png', talkBackEquipmentList, 'activityTalkBackEquipmentLayers') : this.clearLayerIconForMap('activityTalkBackEquipmentLayers');
            e2.checkedNodes.some(item => {
                return item.label == '执法记录仪'
            }) ? this.iconImageShowOrHidden('/img/icon/p-b-camera.png', policeCarmeraList, 'activityPoliceCameraLayers') : this.clearLayerIconForMap('activityPoliceCameraLayers');
                 data.some(item => {
                     return item.label == '执法记录仪'
                 }) ? this.iconImageShowOrHidden('/img/icon/real-phone.png', '/img/icon/real-phone-ok.png',policeCarmeraList, 'activityPoliceCameraLayers') : this.clearLayerIconForMap('activityPoliceCameraLayers');
            }
        },
        /**
@@ -1321,6 +1336,8 @@
         * @param {*} layerName 图层名称
         */
         clearLayerIconForMap(layerName) {
            realPoliceTimer[layerName] && clearInterval(realPoliceTimer[layerName])
            console.log(`定时器realPoliceTimer[${layerName}]关闭了`);
            this.$EventBus.$emit('mapClearLayer', {
                layerName: layerName,
                type: 'VectorLayer'
@@ -1333,9 +1350,18 @@
         * @param {*} data 传入的数据(摄像头,手台等集合数据)
         * @param {*} layerName 选中图层名称
         */
        iconImageShowOrHidden(img, data, layerName) {
            if (data.length > 0) {
                data.forEach(item => {
        iconImageShowOrHidden(img, imgOk, data, layerName, isChooseSecurity) {
            if(this.showingSecurityId && !isChooseSecurity) {
                // 实时图标刷新时间间隔
                let refreshTime = 1000
                realPoliceTimer[layerName] = setInterval(()=> this.searchRealResources(layerName),refreshTime)
            } else {
                this.$EventBus.$emit('mapRemoveLayer', {
                   layerName: layerName,
                   type: 'VectorLayer'
                })
                if (data.length > 0) {
                   data.forEach(item => {
                    if (item.longitude && item.latitude) {
                        this.$EventBus.$emit('layerPointAdd', {
                            layerName: layerName,
@@ -1345,11 +1371,12 @@
                                lng: item.longitude,
                                lat: item.latitude,
                                alt: 1,
                                url: img
                                url: item.clockStatus == 0 ? img:imgOk
                            },
                        })
                    }
                })
                   })
                }
            }
        },
@@ -1375,6 +1402,22 @@
            if (pointCircleCarLayer != null) {
                pointCircleCarLayer.clear()
            }
        },
        // 定时查找实时警力资源
        searchRealResources(layerName){
            console.log(`定时器realPoliceTimer[${layerName}]开启了`);
            let type = ''
            if(layerName == 'activityCarLayers') {
                type = 0
            }else if (layerName == 'activityTalkBackEquipmentPublicLayers'){
                type = '2-1'
            }else if (layerName == 'activityTalkBackEquipmentLayers'){
                type = '2-2'
            }else if (layerName == 'activityPoliceCameraLayers'){
                type = 3
            }
            this.getEquipmentAll({ type: type ,query:this.showingSecurityId },layerName);
        },
        // 大小重置
@@ -1831,23 +1874,35 @@
        },
        // 获取设备列表
        getEquipmentAll (params) {
        getEquipmentAll (params,layerName) {
            getEquipmentAll({ ...params, deptId: this.userInfo.dept_id }).then(res => {
                if (params.type == 0) {
                    // 警车
                    //警车
                    carList = res.data.data
                    if(layerName){
                        this.iconImageShowOrHidden('/img/icon/real-car.png','/img/icon/real-car-ok.png',carList, layerName,true)
                    }
                } else if (params.type == 1) {
                    // 摄像头
                    //摄像头
                    cameraList = res.data.data
                } else if (params.type == '2-1') {
                    // 公网-手台
                    //公网-手台
                    talkBackEquipmentPublicList = res.data.data
                    if(layerName){
                        this.iconImageShowOrHidden('/img/icon/real-public-recorder.png','/img/icon/real-public-recorder-ok.png', talkBackEquipmentPublicList, layerName,true)
                    }
                } else if (params.type == '2-2') {
                    // 专网-手台
                    //专网-手台
                    talkBackEquipmentList = res.data.data
                    if(layerName){
                        this.iconImageShowOrHidden('/img/icon/real-recorder.png','/img/icon/real-recorder-ok.png', talkBackEquipmentList, layerName,true)
                    }
                } else {
                    //执法记录仪
                    policeCarmeraList = res.data.data
                    if(layerName){
                        this.iconImageShowOrHidden('/img/icon/real-phone.png', '/img/icon/real-phone-ok.png', policeCarmeraList, layerName,true)
                    }
                }
            })
        },
@@ -1947,6 +2002,16 @@
        }
    },
    beforeDestroy() {
        // 清除定时器
        if(realPoliceTimer != {}) {
            for(let item in realPoliceTimer) {
                console.log(`定时器realPoliceTimer[${item}]关闭了`);
                clearInterval(realPoliceTimer[item])
            }
        }
    },
    destroyed () {
        this.$EventBus.$emit('mapRemoveLayer', {
            layerName: 'activeLayer',