Преглед на файлове

保存插旗,再次点击取消插旗

LXXXY преди 5 години
родител
ревизия
91f2ec3941
променени са 2 файла, в които са добавени 32 реда и са изтрити 10 реда
  1. 6 0
      src/api/scan/request.js
  2. 26 10
      src/views/data_admin/buildGraphy/graphyCanvas.vue

+ 6 - 0
src/api/scan/request.js

@@ -200,6 +200,12 @@ export function updatePoint(param) {
     return fetch({ method: 'POST', url: `${api}/service/point/update`, data })
 }
 
+//点位标签详情修改【数据中心接口】
+export function updateLocationPoint(param, success) {
+    let url = `${baseUrl}/datacenter/location-point/update`;
+    http.postJson(url, param, success)
+}
+
 //点击点位标签获取tab设备族列表 
 export function getTabFamily(param) {
     let data = {

+ 26 - 10
src/views/data_admin/buildGraphy/graphyCanvas.vue

@@ -51,9 +51,9 @@ export default {
       point: {}, //右侧列表传来的位置标签
       canvasLoading: false, //loading
       markItem: null, // 当前选中的标签item
-      config:{
-          
-      }
+      config: {
+        isEdit: false
+      },
     };
   },
   computed: {
@@ -103,7 +103,9 @@ export default {
         that.view.maxScale = that.view.scale * 10;
         that.view.minScale = that.view.scale;
         // that.view.minScale = 0.000001;
-        that.$refs.canvasFun.everyScale = that.view.scale;
+        if (that.$refs.canvasFun) {
+          that.$refs.canvasFun.everyScale = that.view.scale;
+        }
         this.disableRightButton();
       })
     },
@@ -161,9 +163,22 @@ export default {
     },
     //点击按钮
     addPoint(point) {
-      this.point = point;
-      this.view.canvasView.style.cursor = `url(${this.imageUrl}) 14 33,auto`;
-      this.setFlag = true
+      
+      if (this.point.Id != point.Id) {
+        console.log(point)
+        this.point = point;
+        this.view.canvasView.style.cursor = `url(${this.imageUrl}) 14 33,auto`;
+        this.setFlag = true
+      }
+      else {//再次点击取消插旗
+        this.cancelSetFlag();
+      }
+    },
+    //取消插旗状态
+    cancelSetFlag() {
+      this.point = {};
+      this.view.canvasView.style.cursor = `Default`;
+      this.setFlag = false;
     },
     //右键菜单
     showRightClick(e) {
@@ -174,6 +189,7 @@ export default {
     },
     //插旗 item - 点击的空间item
     spaceClick(item, event) {
+      console.log("click sapce")
       this.menuShow = false;
       if (this.setFlag) {
         this.scene.addMarker({
@@ -183,16 +199,16 @@ export default {
           Y: event[0].y
         })
         this.scene.markerClick(this, this.markClick);
-        this.view.canvasView.style.cursor = `default`;
-
         this.point.X = event[0].x
         this.point.Y = -event[0].y
         this.updatePoint('setFlag')
+        this.cancelSetFlag()
       }
       this.setFlag = false
     },
     //标签点击事件(包含左键,右键)
     markClick(item, event) {
+      console.log("click mark")
       if (event[0].type == 'contextmenu') {
         this.markItem = item;
         this.point = item.data;
@@ -280,7 +296,7 @@ export default {
         return;
       }
       let scale = this.view.scale;
-      // this.view.scaleByPoint(val / scale, this.cadWidth / 2, this.cadHeight / 2)
+      this.view.scaleByPoint(val / scale, this.canvasW / 2, this.canvasH / 2)
     },
   },
   watch: {