From 2f2fc8178b85edd198dab6f5fb50c7d5d6e4cec8 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Wed, 15 Feb 2023 17:16:07 +0800
Subject: [PATCH] 活动警员警车巡逻路线和标绘删除功能

---
 src/views/activity/index.vue |  115 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 99 insertions(+), 16 deletions(-)

diff --git a/src/views/activity/index.vue b/src/views/activity/index.vue
index baab449..eee1dcc 100644
--- a/src/views/activity/index.vue
+++ b/src/views/activity/index.vue
@@ -130,7 +130,7 @@
             </div>
         </div>
 
-        <div v-show="dialogVisible" class="draw-btn-box">
+        <div v-show="dialogVisible&&isShowActivityEditBox" class="draw-btn-box">
             <div class="left">
                 <h3>预案布置</h3>
                 <div>
@@ -467,7 +467,12 @@
             class="choose-police-box"
         >
             <div>
-                <el-select size="small" v-model="policeType" placeholder="请选择">
+                <el-select
+                    size="small"
+                    v-model="policeType"
+                    placeholder="请选择"
+                    :disabled="isChoosePoliceElementDisabled"
+                >
                     <el-option
                         v-for="item in policeOption"
                         :key="item.value"
@@ -475,9 +480,9 @@
                         :value="item.value"
                     ></el-option>
                 </el-select>
-                <el-button @click="determine">确定</el-button>
-                <el-button @click="cancel">取消</el-button>
-                <el-button @click="deletePoliceElement" v-show="isdeleteBtnShow">删除</el-button>
+                <el-button @click="determine" v-show="!isChoosePoliceElementDisabled">确定</el-button>
+                <el-button @click="cancel" v-show="!isChoosePoliceElementDisabled">取消</el-button>
+                <el-button @click="deletePoliceElement" v-show="isPoliceElementDeleteBtnShow">删除</el-button>
             </div>
         </el-dialog>
 
@@ -514,6 +519,7 @@
             <div>
                 <el-button @click="watchVideo">查看视频</el-button>
                 <el-button @click="saveLineInfo">保存</el-button>
+                <el-button @click="deleteLine">删除</el-button>
             </div>
         </el-dialog>
 
@@ -534,11 +540,24 @@
                 <el-button @click="savePolygonInfo">保存</el-button>
             </div>
         </el-dialog>
+
+        <el-dialog
+            title="是否删除该标绘"
+            :modal="false"
+            :visible.sync="deletePlotVisible"
+            :close-on-click-modal="true"
+            class="delete-plot-box"
+        >
+            <div>
+                <el-button @click="deletePlot">删除</el-button>
+                <el-button @click="deletePlotVisible = false">取消</el-button>
+            </div>
+        </el-dialog>
     </div>
 </template>
 
 <script>
-import { getSecurityList, getPoliceList, getCarList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, updateActivityPolice, updateActivityCar, getServiceDictionary, getActivityType, addSecurityPlot, getSecurityPlotList, updateSecurityPlot, deleteActivityCar, deleteActivityPolice } from '@/api/activity/index.js'
+import { getSecurityList, getPoliceList, getCarList, addCarAndRange, addActivityPolice, getSecurityPoliceList, getSecurityCarList, updateActivityPolice, updateActivityCar, getServiceDictionary, getActivityType, addSecurityPlot, getSecurityPlotList, updateSecurityPlot, deleteActivityCar, deleteActivityPolice, deleteSecurityPlot } 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'
@@ -765,7 +784,11 @@
             chooseLineData: {},
             lineWidth: 100,
             linePosition: '',
-            isdeleteBtnShow: true,
+            isPoliceElementDeleteBtnShow: true,
+            isChoosePoliceElementDisabled: false,
+            isShowActivityEditBox: false,
+            deletePlotVisible: false,
+            plotId: '',
         }
     },
     created () {
@@ -941,7 +964,6 @@
                         })
 
                     } else if (item.type == 3 && pointShow) {
-                        console.log(item, 363636)
                         let positionObj = this.convertBillboardPositionDate(item.position, 'policeman', item.id, item.policemanId, item.deptId)
                         this.$EventBus.$emit('layerPointAdd', {
                             layerName: 'newDrawLayers',
@@ -1022,7 +1044,7 @@
                         })
 
                     } else if (item.type == 3 && pointShow) {
-                        let positionObj = this.convertBillboardPositionDate(item.position, 'policecar', item.id, item.carId)
+                        let positionObj = this.convertBillboardPositionDate(item.position, 'policecar', item.id, item.carId, item.deptId)
                         this.$EventBus.$emit('layerPointAdd', {
                             layerName: 'newCarDrawLayers',
                             type: 'billboard',
@@ -1158,7 +1180,7 @@
             } else if (iconName == 'policeman') {
                 positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/icon/police-people.png', id: plotId, policemanId: policeId, deptId: deptId }
             } else if (iconName == 'policecar') {
-                positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/icon/car.png', id: plotId, carId: policeId }
+                positionObj = { lng: `${positionArr[0]}`, lat: `${positionArr[1]}`, alt: 100, url: '/img/icon/car.png', id: plotId, carId: policeId, deptId: deptId }
             }
             return positionObj
         },
@@ -1267,6 +1289,12 @@
             })
 
             this.dialogVisible = true
+            if (this.userInfo.dept_id == '1123598813738675201' || this.userInfo.dept_id == item.deptId) {
+                this.isShowActivityEditBox = true
+            } else {
+                this.isShowActivityEditBox = false
+            }
+            this.activityDeptId = item.deptId
 
             this.currentClickIndex = index
 
@@ -1363,7 +1391,7 @@
                                     that.policeChooseTitle = '选择警车'
                                     that.policeOption = that.policecarOption
                                 }
-                                that.isdeleteBtnShow = false
+                                that.isPoliceElementDeleteBtnShow = false
                                 that.policeChooseVisible = true
                                 flag = false
                             } else if (flag == true && poltType == 'polyline') {
@@ -1550,8 +1578,13 @@
 
         // 地图绘制元素点击事件
         overlayTypeClick (e) {
-            this.isdeleteBtnShow = true
-            this.policeIconIsCreated = true
+            if (this.userInfo.dept_id == '1123598813738675201' || this.userInfo.dept_id == this.activityDeptId) {
+                this.isPoliceElementDeleteBtnShow = true
+                this.isChoosePoliceElementDisabled = false
+            } else {
+                this.isPoliceElementDeleteBtnShow = false
+                this.isChoosePoliceElementDisabled = true
+            }
             if ('policemanId' in e.overlay.attrParams) {
                 this.policeChooseTitle = '选择警员'
                 this.policeOption = this.policemanOption
@@ -1574,8 +1607,11 @@
             this.chooseColor = e.overlay.attrParams.color != '' ? e.overlay.attrParams.color : '#FF0000'
             this.policeIconId = e.overlay.attrParams.id
             this.linePosition = e.overlay.attrParams.positionStr
-            console.log(11, e, e.overlay.attrParams.id)
-            this.lineEditVisible = true
+            if (this.userInfo.dept_id == '1123598813738675201' || this.userInfo.dept_id == this.activityDeptId) {
+                this.lineEditVisible = true
+            } else {
+                this.lineEditVisible = false
+            }
         },
 
         // 保存活动标绘箭头
@@ -1632,6 +1668,7 @@
                         "material": global.DC.Color.ORANGE.withAlpha(0.4),
                     })
                     chooseArrow.on(global.DC.MouseEventType.DB_CLICK, this.reeditArrowDbClick)
+                    chooseArrow.on(global.DC.MouseEventType.CLICK, this.reeditArrowClick)
                 })
             })
         },
@@ -1650,8 +1687,26 @@
             })
         },
 
+        // 单击。标绘箭头
+        reeditArrowClick (e) {
+            if (this.userInfo.dept_id == '1123598813738675201' || this.userInfo.dept_id == this.activityDeptId) {
+                this.plotId = e.overlay.attrParams.id
+                this.deletePlotVisible = true
+            }
+        },
+
         updateSecurityPlot (id, position, name) {
             updateSecurityPlot(id, position, name).then(res => {
+                if (res.data.success) {
+                    this.$message({
+                        message: '删除成功',
+                        type: 'warning'
+                    })
+                } else {
+                    this.$message({
+                        message: '删除失败'
+                    })
+                }
                 this.getSecurityPlotList(this.showingSecurityId, this.arrowBtnSwitch)
             })
         },
@@ -1863,7 +1918,6 @@
         // 删除警车
         deleteActivityCar (id) {
             deleteActivityCar(id).then(res => {
-                console.log(res, 1111)
                 if (res.data.success) {
                     this.$message({
                         message: '删除成功',
@@ -1905,6 +1959,35 @@
             this.policeChooseVisible = false
         },
 
+        // 删除巡逻路线
+        deleteLine () {
+            this.deleteActivityCar(this.policeIconId)
+            this.lineEditVisible = false
+        },
+
+        // 删除活动标绘接口
+        deleteSecurityPlot (id) {
+            deleteSecurityPlot(id).then(res => {
+                if (res.data.success) {
+                    this.$message({
+                        message: '删除成功',
+                        type: 'warning'
+                    })
+                } else {
+                    this.$message({
+                        message: '删除失败'
+                    })
+                }
+                this.getSecurityPlotList(this.showingSecurityId, this.arrowBtnSwitch)
+            })
+        },
+
+        // 删除活动标绘
+        deletePlot () {
+            this.deleteSecurityPlot(this.plotId)
+            this.deletePlotVisible = false
+        },
+
     },
 
     computed: {

--
Gitblit v1.9.3