guanqb
2022-12-06 38e6912dd9e3ce5b6bd000785122aac4fa65da5b
活动警车添加修改
4 files modified
1 files added
187 ■■■■ changed files
public/img/policeCar.png patch | view | raw | blame | history
src/api/activity/index.js 32 ●●●●● patch | view | raw | blame | history
src/router/axios.js 6 ●●●●● patch | view | raw | blame | history
src/views/activity/index.vue 148 ●●●● patch | view | raw | blame | history
src/views/video/region.vue 1 ●●●● patch | view | raw | blame | history
public/img/policeCar.png
src/api/activity/index.js
@@ -16,6 +16,20 @@
}
/**
 * 获取警车列表
 * @param {*} params
 * @returns
 */
export const getCarList = (params, requestBaseUrl = 'outside') => {
    return request({
        url: `/policecar/policecar/all`,
        method: 'get',
        requestBaseUrl,
        params: params
    })
}
/**
 * 获取警员列表
 * @param {*} params  
 * @returns 
@@ -52,6 +66,24 @@
}
/**
 * 活动修改警车
 * @param {*} carId 警员ID
 * @param {*} id 数据唯一标识
 * @returns
 */
export const updateActivityCar = (id, carId, requestBaseUrl = 'outside') => {
    return request({
        url: `/securityManageCar/securityManageCar/update`,
        method: 'post',
        requestBaseUrl,
        params: {
            id,
            carId,
        }
    })
}
/**
 * 活动添加警员
 * @param {*} policemanId  警员ID
 * @param {*} position  坐标
src/router/axios.js
@@ -24,7 +24,8 @@
const service = axios.create({
    // baseURL: 'http://36.14.255.242:18080/api',
    // baseURL: 'http://192.168.0.102:1888/api',
    baseURL: 'http://192.168.0.105:18080/api',
    // baseURL: 'http://192.168.0.105:18080/api',
    baseURL: 'http://192.168.0.115:82',
    // baseURL: 'http://192.168.0.106:1888/api',
    timeout: 600000 // request timeout
})
@@ -43,7 +44,8 @@
        if (config.requestBaseUrl == 'outside') {
            // config.baseURL = 'http://192.168.0.102:1888/api'
            config.baseURL = 'http://192.168.0.105:80/api'
            // config.baseURL = 'http://192.168.0.105:80/api'
            config.baseURL = 'http://192.168.0.115:82'
            // config.baseURL = 'http://192.168.0.106:1888/api'
        }
src/views/activity/index.vue
@@ -63,6 +63,10 @@
                                <div class="category-value">{{ item.name }}</div>
                            </div>
                            <div>
                                <div class="category">申报人数:</div>
                                <div class="category-value">{{ item.number }}</div>
                            </div>
                            <div>
                                <div class="category">活动时间:</div>
                                <div
                                    class="category-value"
@@ -272,7 +276,7 @@
</template>
<script>
import { getSecurityList, getPoliceList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, updateActivityPolice } from '@/api/activity/index.js'
import { getSecurityList, getPoliceList, getCarList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, updateActivityPolice, updateActivityCar } from '@/api/activity/index.js'
let analyseLayer = null
let analysePolygon = null
@@ -286,21 +290,26 @@
        return {
            activityOptions: [{
                value: '选项1',
                label: '黄金糕'
                label: '教育活动'
            }, {
                value: '选项2',
                label: '双皮奶'
                label: '科技活动'
            }, {
                value: '选项3',
                label: '蚵仔煎'
                label: '公益活动'
            }, {
                value: '选项4',
                label: '龙须面'
                label: '组织活动'
            }, {
                value: '选项5',
                label: '北京烤鸭'
                label: '文娱活动'
            }, {
                value: '选项6',
                label: '体育活动'
            }],
            policeOption: [],
            policemanOption: [],
            policecarOption: [],
            activityType: '',
            policeType: '',
            searchActivity: '',
@@ -466,11 +475,8 @@
    },
    created () {
        this.getPoliceList()
        // this.addCarAndRange('1595988751891415042', '1 2,3 4', 1, 1)
        // this.addActivityPolice()
        this.getCarList()
        this.getSecurityList()
        // this.getSecurityPoliceList()
        // this.getSecurityCarList()
    },
    mounted () {
@@ -527,7 +533,7 @@
                        this.$EventBus.$emit('layerPolylineAdd', {
                            layerName: 'newDrawLayers',
                            positions: positionNewArr,
                            material: global.DC.Color.RED,
                            material: global.DC.Color.RED.withAlpha(0.4),
                            width: 4,
                            params: {
                                id: item.id,
@@ -540,7 +546,7 @@
                        this.$EventBus.$emit('layerPolygonAdd', {
                            layerName: 'newDrawLayers',
                            positions: positionNewArr,
                            material: global.DC.Color.RED,
                            material: global.DC.Color.RED.withAlpha(0.4),
                            params: {
                                id: item.id,
                                policemanId: item.policemanId
@@ -549,7 +555,7 @@
                        })
                    } else if (item.type == 3) {
                        let positionObj = this.convertBillboardPositionDate(item.position, 'police', item.id, item.policemanId)
                        let positionObj = this.convertBillboardPositionDate(item.position, 'policeman', item.id, item.policemanId)
                        this.$EventBus.$emit('layerPointAdd', {
                            layerName: 'newDrawLayers',
                            type: 'billboard',
@@ -563,8 +569,49 @@
        // 获取活动警车分布信息
        getSecurityCarList (securityId) {
            this.removeAll()
            this.$EventBus.$emit('mapClearLayer', {
                layerName: 'newCarDrawLayers',
                type: 'VectorLayer'
            })
            getSecurityCarList(securityId).then(res => {
                console.log('活动警车列表', res.data.data)
                res.data.data.forEach(item => {
                    if (item.type == 1) {
                        let positionNewArr = this.convertPolylineOrPolygonPositionDate(item.position, item.type)
                        this.$EventBus.$emit('layerPolylineAdd', {
                            layerName: 'newCarDrawLayers',
                            positions: positionNewArr,
                            material: global.DC.Color.BLUE.withAlpha(0.4),
                            width: 4,
                            params: {
                                id: item.id,
                                carId: item.carId
                            },
                            incident: this.overlayTypeClick
                        })
                    } else if (item.type == 2) {
                        let positionNewArr = this.convertPolylineOrPolygonPositionDate(item.position, item.type)
                        this.$EventBus.$emit('layerPolygonAdd', {
                            layerName: 'newCarDrawLayers',
                            positions: positionNewArr,
                            material: global.DC.Color.BLUE.withAlpha(0.4),
                            params: {
                                id: item.id,
                                carId: item.carId
                            },
                            incident: this.overlayTypeClick
                        })
                    } else if (item.type == 3) {
                        let positionObj = this.convertBillboardPositionDate(item.position, 'policecar', item.id, item.carId)
                        this.$EventBus.$emit('layerPointAdd', {
                            layerName: 'newCarDrawLayers',
                            type: 'billboard',
                            params: positionObj,
                            incident: this.overlayTypeClick
                        })
                    }
                })
            })
        },
        // 获取活动列表
@@ -572,16 +619,23 @@
            getSecurityList().then(res => {
                this.activityList = res.data.data
                this.addActivityPoint()
                console.log('活动列表', res.data.data)
            })
        },
        // 获取警员列表,生成下拉数据
        getPoliceList () {
            getPoliceList().then(res => {
                console.log('警员列表', res.data.data)
                res.data.data.forEach(item => {
                    this.policeOption.push({ value: `${item.id}`, label: `${item.name}` })
                    this.policemanOption.push({ value: `${item.id}`, label: `${item.name}` })
                })
            })
        },
        // 获取警车列表,生成下拉数据
        getCarList () {
            getCarList().then(res => {
                res.data.data.forEach(item => {
                    this.policecarOption.push({ value: `${item.id}`, label: `${item.serialNumber}` })
                })
            })
        },
@@ -593,10 +647,17 @@
            })
        },
        // 修改活动警车
        updateActivityCar (id, carId) {
            updateActivityCar(id, carId).then(res => {
                this.getSecurityCarList(this.showingSecurityId)
            })
        },
        // 活动添加警车和范围
        addCarAndRange (carId, position, securityId, type) {
            addCarAndRange(carId, position, securityId, type).then(res => {
                console.log(res, 2323)
                this.getSecurityCarList(securityId)
            })
        },
@@ -616,21 +677,22 @@
        // 活动添加警员
        addActivityPolice (policemanId, position, securityId, type) {
            addActivityPolice(policemanId, position, securityId, type).then(res => {
                console.log(res, 3333)
                this.getSecurityPoliceList(securityId)
            })
        },
        // 转换 点 坐标数据
        convertBillboardPositionDate (data, iconName, plotId, policemanId) {
        convertBillboardPositionDate (data, iconName, plotId, policeId) {
            let positionStr = data
            positionStr = data.slice(6, positionStr.length - 1)
            let positionArr = positionStr.split(" ")
            let positionObj = {}
            if (iconName == 'activity') {
                positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/icon/activity.png' }
            } else {
                positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/policeIcon.png', id: plotId, policemanId: policemanId }
            } else if (iconName == 'policeman') {
                positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/policeIcon.png', id: plotId, policemanId: policeId }
            } else if (iconName == 'policecar') {
                positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/policeCar.png', id: plotId, carId: policeId }
            }
            return positionObj
        },
@@ -695,6 +757,7 @@
                type: 'VectorLayer'
            })
            this.getSecurityPoliceList(item.id)
            this.getSecurityCarList(item.id)
            if (this.currentClickIndex !== '' && this.currentClickIndex == index) {
                return
            }
@@ -804,7 +867,7 @@
                if (poltType == 'billboard' && policeType == 'policeman') {
                    overlay.icon = '/img/policeIcon.png'
                } else if (poltType == 'billboard' && policeType == 'policecar') {
                    overlay.icon = '/img/policeCar.png'
                    overlay.icon = '/img/policeCar.jfif'
                }
                if (overlay) {
@@ -814,9 +877,17 @@
                        flag = true
                        overlay.on(global.DC.MouseEventType.CLICK, this.overlayTypeClick)
                        overlay.drawType = poltType
                        overlay.policeType = policeType
                        this.overlayObj = overlay
                        document.oncontextmenu = function () {
                            if (flag == true) {
                                if (policeType == 'policeman') {
                                    that.policeChooseTitle = '选择警员'
                                    that.policeOption = that.policemanOption
                                } else if (policeType == 'policecar') {
                                    that.policeChooseTitle = '选择警车'
                                    that.policeOption = that.policecarOption
                                }
                                that.policeChooseVisible = true
                                flag = false
                            }
@@ -900,12 +971,19 @@
                    position += this.overlayObj._positions[0]._lng + ' ' + this.overlayObj._positions[0]._lat + ','
                    position = position.slice(0, position.length - 1)
                }
                this.addActivityPolice(this.policeType, position, this.showingSecurityId, type)
                if (this.overlayObj.policeType == 'policeman') {
                    this.addActivityPolice(this.policeType, position, this.showingSecurityId, type)
                } else if (this.overlayObj.policeType == 'policecar') {
                    this.addCarAndRange(this.policeType, position, this.showingSecurityId, type)
                }
                this.policeChooseVisible = false
                this.policeIconIsCreated = false
            } else {
                this.updateActivityPolice(this.policeIconId, this.policeType)
                if (this.policeChooseTitle == '选择警员') {
                    this.updateActivityPolice(this.policeIconId, this.policeType)
                } else if (this.policeChooseTitle == '选择警车') {
                    this.updateActivityCar(this.policeIconId, this.policeType)
                }
                this.policeChooseVisible = false
                this.policeIconIsCreated = false
            }
@@ -913,10 +991,18 @@
        // 地图绘制元素点击事件
        overlayTypeClick (e) {
            // console.log('点击了元素', e.overlay.attrParams)
            this.policeIconIsCreated = true
            this.policeIconId = e.overlay.attrParams.id
            this.policeType = e.overlay.attrParams.policemanId
            if ('policemanId' in e.overlay.attrParams) {
                this.policeChooseTitle = '选择警员'
                this.policeOption = this.policemanOption
                this.policeIconId = e.overlay.attrParams.id
                this.policeType = e.overlay.attrParams.policemanId
            } else if ('carId' in e.overlay.attrParams) {
                this.policeChooseTitle = '选择警车'
                this.policeOption = this.policecarOption
                this.policeIconId = e.overlay.attrParams.id
                this.policeType = e.overlay.attrParams.carId
            }
            this.policeChooseVisible = true
        }
    },
@@ -946,6 +1032,10 @@
            layerName: 'newDrawLayers',
            type: 'VectorLayer'
        })
        this.$EventBus.$emit('mapClearLayer', {
            layerName: 'newCarDrawLayers',
            type: 'VectorLayer'
        })
        analyseLayer.clear()
src/views/video/region.vue
@@ -299,7 +299,6 @@
                flvPlayer5: null,
                flvPlayer6: null,
            },
            saveRangeList: [],
            monitorOption: [],
            monitorType1: '',