guanqb
2023-03-15 890594461d51452f9eb8e8c17e85e5de0a16aa23
警员警车删除更新调整
2 files modified
77 ■■■■ changed files
src/views/activity/components/drawBtnBox.vue 57 ●●●●● patch | view | raw | blame | history
src/views/activity/index.vue 20 ●●●●● patch | view | raw | blame | history
src/views/activity/components/drawBtnBox.vue
@@ -83,7 +83,7 @@
<script>
import {
    updateActivityCar,
    updateActivityCar,updateActivityPolice,
    updateSecurityPlot
} from '@/api/activity/index.js'
@@ -476,7 +476,7 @@
               })
            }
        },
        // 保存新增警力资源
        addNewPolice(data,type){
                let positionObj = this.$parent.convertBillboardPositionDate(data, type)
                let positionArr = data.position.slice(7, data.position.length - 2).split(',')[0].split(' ')
@@ -537,7 +537,7 @@
                            "outlineColor": color, //边框颜色
                            "outlineWidth": 0, //边框大小,
                            "pixelSize": 32,
                        })
                    })
                }
            }
            if('name' in params){
@@ -545,11 +545,38 @@
            }
        },
        // 修改警车样式
        editPoliceStyle(params,overlay) {
            if('color' in params && 'pointOverlayData' in overlay.attrParams){
                overlay.attrParams.color = params.color
                overlay.attrParams.pointOverlayData.attrParams.color = params.color
                let r = parseInt(params.color.slice(1, 3), 16)
                let g = parseInt(params.color.slice(3, 5), 16)
                let b = parseInt(params.color.slice(5, 7), 16)
                let color = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 255)
                overlay.attrParams.pointOverlayData.setStyle({
                    "color": color, //颜色
                    "outlineColor": color, //边框颜色
                    "outlineWidth": 0, //边框大小,
                    "pixelSize": 32,
                 })
            }
            if('carId' in params){
                overlay.attrParams.data.carId=  params.carId
            }
            if('policemanId' in params){
                overlay.attrParams.data.policemanId=  params.policemanId
            }
        },
        // 修改活动警车
        // id活动id, carId警车id, color颜色, width巡逻路线范围宽度, type线面类型, position坐标
        updateActivityCar (params) {
        updateActivityCar (params,overlay) {
            updateActivityCar(params).then(res => {
                if (res.data.success) {
                    this.editPoliceStyle(params,overlay)
                    this.$message({
                        message: '保存成功',
                        type: 'success'
@@ -561,7 +588,27 @@
                    })
                }
                this.$parent.getSecurityCarList(this.showingSecurityId, this.policeSwitch, this.polylineBtnSwitch)
                // this.$parent.getSecurityCarList(this.showingSecurityId, this.policeSwitch, this.polylineBtnSwitch)
            })
        },
         // 修改活动警员
        // id活动id, policemanId警察id ,color颜色
        updateActivityPolice (params,overlay) {
            updateActivityPolice(params).then(res => {
                if (res.data.success) {
                    this.editPoliceStyle(params,overlay)
                    this.$message({
                        message: '保存成功',
                        type: 'success'
                    })
                } else {
                    this.$message({
                        message: '保存失败',
                        type: 'error'
                    })
                }
                // this.getSecurityPoliceList(this.showingSecurityId, this.policeSwitch)
            })
        },
src/views/activity/index.vue
@@ -242,7 +242,7 @@
</template>
<script>
import { getSecurityList, getPoliceList, getCarList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, updateActivityPolice, getServiceDictionary, getActivityType, addSecurityPlot, getSecurityPlotList, deleteActivityCar, deleteActivityPolice, deleteSecurityPlot, getSearchInfo, getPolicemanTree } from '@/api/activity/index.js'
import { getSecurityList, getPoliceList, getCarList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, getServiceDictionary, getActivityType, addSecurityPlot, getSecurityPlotList, deleteActivityCar, deleteActivityPolice, deleteSecurityPlot, getSearchInfo, getPolicemanTree } from '@/api/activity/index.js'
import { getEquipmentAll } from '@/api/home/index.js'
import activityDetail from './components/activityDetail.vue'
import drawBtnBox from './components/drawBtnBox.vue'
@@ -923,7 +923,7 @@
                this.isHaveLine = res.data.data.some(item => {
                    return item.type == 1
                })
                type == 'car' && pointShow && this.addMapCarAndPersonLayers(
                    res.data.data.filter(item => item.type == 3),
                    'policecar',
@@ -992,7 +992,9 @@
         * @return {*}
         */
        addMapLineLayers (data) {
            console.log('data',data);
            data.forEach(item => {
                console.log('item',item);
                let positionNewArr = this.convertPolylineOrPolygonPositionDate(item.position, item.type)
                // 线坐标字符串
                item.linePositionStr = positionNewArr
@@ -1136,14 +1138,6 @@
            })
        },
        // 修改活动警员
        // id活动id, policemanId警察id ,color颜色
        updateActivityPolice (params) {
            updateActivityPolice(params).then(res => {
                this.getSecurityPoliceList(this.showingSecurityId, this.policeSwitch)
            })
        },
        // 活动添加警车和范围
        // carId警车id, position坐标, securityId活动id, type线面类型,width缓存范围,color范围颜色
        addCarAndRange (params) {
@@ -1160,7 +1154,6 @@
                        type: 'error'
                    })
                }
                // this.getSecurityCarList(params.securityId, this.policeSwitch, this.polylineBtnSwitch, params.type == 1 ? 'line' : 'car')
            })
        },
@@ -1180,7 +1173,6 @@
                        type: 'error'
                    })
                }
                // this.getSecurityPoliceList(params.securityId, this.policeSwitch)
            })
        },
@@ -1424,10 +1416,10 @@
                }
            } else {
                if (this.policeChooseVisible == true) {
                    this.updateActivityPolice({ id: this.policeIconId, policemanId: this.searchPoliceTreeId, color: this.choosePoliceColor })
                    this.$refs.DRAWBTNBOX.updateActivityPolice({ id: this.policeIconId, policemanId: this.searchPoliceTreeId, color: this.choosePoliceColor },policeOverlayData.overlay)
                    this.policeChooseVisible = false
                } else if (this.policeChooseCarVisible == true) {
                    this.$refs.DRAWBTNBOX.updateActivityCar({ id: this.policeIconId, carId: this.policeType, color: this.chooseCarColor })
                    this.$refs.DRAWBTNBOX.updateActivityCar({ id: this.policeIconId, carId: this.policeType, color: this.chooseCarColor },policeOverlayData.overlay)
                    this.policeChooseCarVisible = false
                }
                this.policeIconIsCreated = false