guanqb
2023-02-22 93453a9e46c0081579a9370c69e575dd5ababa33
活动巡逻属性修改功能
2 files modified
96 ■■■■ changed files
src/api/activity/index.js 6 ●●●●● patch | view | raw | blame | history
src/views/activity/index.vue 90 ●●●● patch | view | raw | blame | history
src/api/activity/index.js
@@ -88,7 +88,7 @@
 * @param {*} id 数据唯一标识
 * @returns
 */
export const updateActivityCar = (id, carId, color, width) => {
export const updateActivityCar = (id, carId, color, width, type, position) => {
    return request({
        url: `/api/securityManageCar/securityManageCar/update`,
        method: 'post',
@@ -96,7 +96,9 @@
            id,
            carId,
            color,
            width
            width,
            type,
            position
        }
    })
}
src/views/activity/index.vue
@@ -585,8 +585,10 @@
            </div>
            <div>
                <el-button @click="watchVideo">查看视频</el-button>
                <el-button @click="editLineInfo">编辑</el-button>
                <el-button @click="saveLineInfo">保存</el-button>
                <el-button @click="deleteLine">删除</el-button>
                <el-button @click="lineEditVisible = false">取消</el-button>
            </div>
        </el-dialog>
@@ -657,6 +659,7 @@
let arrowsListLayer = null
let plot = undefined
let arrowPlot = undefined
let lineLayer = undefined
let tc = undefined
let track = undefined
let loading = null
@@ -869,6 +872,7 @@
            searchPoliceTreeId: '',
            searchTreeShowFlag: false,
            plotOverlayData: null,
            lineObjdata: null,
        }
    },
    created () {
@@ -916,6 +920,11 @@
            if (arrowsListLayer == null) {
                arrowsListLayer = new global.DC.VectorLayer('arrowsListLayer')
                global.viewer.addLayer(arrowsListLayer)
            }
            if (lineLayer == null) {
                lineLayer = new global.DC.VectorLayer('lineLayer')
                global.viewer.addLayer(lineLayer)
            }
            if (polylineAreaLayer == null) {
@@ -1095,7 +1104,17 @@
                layerName: 'newCarDrawLayers',
                type: 'VectorLayer'
            })
            polylineAreaLayer.clear()
            this.$EventBus.$emit('mapClearLayer', {
                layerName: 'newCarDrawLineLayers',
                type: 'VectorLayer'
            })
            if (polylineAreaLayer != null) {
                polylineAreaLayer.clear()
            }
            if (lineLayer != null) {
                lineLayer.clear()
            }
            getSecurityCarList(securityId).then(res => {
                this.isHavePoliceCar = res.data.data.some(item => {
                    return item.type == 3
@@ -1125,25 +1144,33 @@
                            position += item._lng + ',' + item._lat + ';'
                        })
                        item.polygonPositionStr = position
                        this.$EventBus.$emit('layerPolygonAdd', {
                            layerName: 'newCarDrawLayers',
                            positions: position,
                            material: color,
                            params: item,
                            incident: this.lineOverlayTypeClick
                        })
                        // polylineAreaLayer.show = false
                        let positionStr = ''
                        coords.forEach(item => {
                            positionStr += item[0] + ',' + item[1] + ';'
                        })
                        // this.getRegionList(positionStr)
                        this.$EventBus.$emit('layerPolylineAdd', {
                            layerName: 'newCarDrawLayers',
                            positions: positionNewArr,
                            material: global.DC.Color.RED.withAlpha(0.8),
                            width: 3,
                        let lineObj = new global.DC.Polyline(positionNewArr)
                        lineLayer.addOverlay(lineObj)
                        lineObj.setStyle({
                            'material': global.DC.Color.RED.withAlpha(0.8),
                            'width': 3
                        })
                        item.lineObj = lineObj
                        // this.$EventBus.$emit('layerPolylineAdd', {
                        //     layerName: 'newCarDrawLayers',
                        //     positions: positionNewArr,
                        //     material: global.DC.Color.RED.withAlpha(0.8),
                        //     width: 3,
                        //     params: item,
                        // })
                        this.$EventBus.$emit('layerPolygonAdd', {
                            layerName: 'newCarDrawLineLayers',
                            positions: position,
                            material: color,
                            params: item,
                            incident: this.lineOverlayTypeClick
                        })
                    } else if (item.type == 2) {
                        let positionNewArr = this.convertPolylineOrPolygonPositionDate(item.position, item.type)
@@ -1228,8 +1255,8 @@
        },
        // 修改活动警车
        updateActivityCar (id, carId, color, width) {
            updateActivityCar(id, carId, color, width).then(res => {
        updateActivityCar (id, carId, color, width, type, position) {
            updateActivityCar(id, carId, color, width, type, position).then(res => {
                if (res.data.success) {
                    this.$message({
                        message: '保存成功',
@@ -1735,6 +1762,7 @@
                    this.addCarAndRange(this.policeType, position, this.showingSecurityId, type)
                } else if (this.policeChooseVisible == true) {
                    this.policeChooseVisible = false
                    this.addActivityPolice(this.searchPoliceTreeId, position, this.showingSecurityId, type)
                }
                this.policeIconIsCreated = false
@@ -1773,12 +1801,14 @@
            }
        },
        // 巡逻路线面点击事件
        lineOverlayTypeClick (e) {
            this.videoShow = false
            this.lineWidth = e.overlay.attrParams.width != -1 ? e.overlay.attrParams.width : 100
            this.chooseColor = e.overlay.attrParams.color != '' ? e.overlay.attrParams.color : '#FF0000'
            this.policeIconId = e.overlay.attrParams.id
            this.linePosition = e.overlay.attrParams.linePositionStr
            this.lineObjdata = e.overlay.attrParams.lineObj
            this.polygonPosition = e.overlay.attrParams.polygonPositionStr
            if (this.userInfo.dept_id == '1123598813738675201' || this.userInfo.dept_id == this.activityDeptId) {
                this.lineEditVisible = true
@@ -1843,9 +1873,6 @@
                        let g = parseInt(item.color.slice(3, 5), 16)
                        let b = parseInt(item.color.slice(5, 7), 16)
                        color = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 150)
                    }
                    if (item.id == 202) {
                        console.log('item', item)
                    }
                    chooseArrow.attrParams = { 'id': item.id, 'color': item.color }
                    arrowsListLayer.addOverlay(chooseArrow)
@@ -2102,8 +2129,27 @@
        // 保存巡逻路线信息
        saveLineInfo () {
            this.updateActivityCar(this.policeIconId, 2, this.chooseColor, this.lineWidth)
            this.updateActivityCar(this.policeIconId, '', this.chooseColor, this.lineWidth)
            this.lineEditVisible = false
        },
        // 修改巡逻路线位置信息
        editLineInfo () {
            this.lineEditVisible = false
            this.$EventBus.$emit('mapClearLayer', {
                layerName: 'newCarDrawLineLayers',
                type: 'VectorLayer'
            })
            let overlayData = this.lineObjdata
            plot.edit(overlayData, (e) => {
                let position = ''
                overlayData._positions.forEach(item => {
                    position += item._lng + ' ' + item._lat + ','
                })
                position = position.slice(0, position.length - 1)
                lineLayer.addOverlay(overlayData)
                this.updateActivityCar(this.policeIconId, '', this.chooseColor, this.lineWidth, 1, position)
            })
        },
        // 点击区域
@@ -2279,6 +2325,11 @@
        })
        this.$EventBus.$emit('mapClearLayer', {
            layerName: 'newCarDrawLineLayers',
            type: 'VectorLayer'
        })
        this.$EventBus.$emit('mapClearLayer', {
            layerName: 'searchLayer',
            type: 'VectorLayer'
        })
@@ -2295,6 +2346,7 @@
        analyseLayer.clear()
        arrowsListLayer.clear()
        lineLayer.clear()
        this.removeAll()
        this.removeAllArrow()