From 890594461d51452f9eb8e8c17e85e5de0a16aa23 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Wed, 15 Mar 2023 15:31:15 +0800
Subject: [PATCH] 警员警车删除更新调整

---
 src/views/activity/components/drawBtnBox.vue |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/src/views/activity/components/drawBtnBox.vue b/src/views/activity/components/drawBtnBox.vue
index 13f4923..336af78 100644
--- a/src/views/activity/components/drawBtnBox.vue
+++ b/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)
             })
         },
 

--
Gitblit v1.9.3