YaolongHan 5 years ago
parent
commit
8f25ffec69

+ 7 - 1
src/api/scan/request.js

@@ -1227,4 +1227,10 @@ export function createRelationInFloor(param, success) {
 export function queryBaseGraphy(param, success) {
     let url = `/modelapi/base-graph/query`;
     http.postJson(url, param, success)
-}
+}
+//楼层接口-----更新楼层信息
+export function floorUpdate(param, success) {
+    let url = `${baseUrl}/datacenter/floor/update`;
+    http.postJson(url, param, success)
+}
+

+ 48 - 20
src/views/ready/buildfloor/drawGraphy/checkGraphy.vue

@@ -7,7 +7,7 @@
     :before-close="handleClose"
   >
     <div class="bodys">
-      <el-cascader :props="props" :show-all-levels="false"  @change="handleChange"></el-cascader>
+      <el-cascader :props="props" :show-all-levels="false" @change="handleChange" placeholder="请选择模型文件"></el-cascader>
       <div>
         <el-button type="text">上传图片</el-button>
@@ -37,17 +37,14 @@ let id = 0;
 import drawFloor from "./drawFloor";
 import { mapGetters, mapActions } from "vuex";
 import request from "@/api/model/file.js";
+import { floorUpdate } from "@/api/scan/request";
 export default {
   components: {
     drawFloor
   },
   props: {
     checkGraphyVisible: Boolean,
-    jsonKey: {
-      type: String,
-      default: "",
-      required: false
-    }
+    checkGraphyItem: Object
   },
   computed: {
     ...mapGetters("layout", ["projectId"])
@@ -55,11 +52,13 @@ export default {
   data() {
     return {
       value: "",
-      dataKey:'',
+      dataKey: "", //url
+      jsonKey: "", //map.josn
       point: [40703.54760591985, 42678.14510522981], //坐标
       pointWidth: 2000,
-      findGraphyItemId: "", //高亮的id
-      props: {                 //联级框
+      findGraphyItemId: "", //高亮的i
+      props: {
+        //联级框
         lazy: true,
         lazyLoad(node, resolve) {
           const { level } = node;
@@ -80,17 +79,17 @@ export default {
               ProjectId: this.projectId
             };
             request.queryFloorList(data, res => {
-                const nodes = Array.from(res.Content).map(item => ({
-                  value: item.Url,
-                  label: item.FloorName,
-                  leaf: level >= 1
-                }));
-                // 通过调用resolve将子节点数据返回,通知组件数据加载完成
-                resolve(nodes);
+              const nodes = Array.from(res.Content).map(item => ({
+                value: item.Url,
+                label: item.FloorName,
+                leaf: level >= 1
+              }));
+              // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+              resolve(nodes);
             });
           }
         }
-      },
+      }
     };
   },
   methods: {
@@ -98,7 +97,34 @@ export default {
       this.$emit("handleCloseCGraphy");
     },
     // 绑定图片
-    bindGraphy() {},
+    bindGraphy() {
+      if(!this.jsonKey){
+            this.$message.warning("请选择模型文件");
+            return
+      }
+      let data = {
+        Content: [
+          {
+            FloorID: this.checkGraphyItem.FloorID,
+            StructureInfo: {
+              FloorMap: this.jsonKey
+            }
+          }
+        ]
+      };
+      floorUpdate(data, res => {
+        if (res.Result == "success") {
+          this.$message.success("添加成功");
+          this.handleClose()
+        } else {
+          if (res.Message) {
+            this.$message.warning(res.Message);
+          } else {
+            this.$message.warning("绑定失败");
+          }
+        }
+      });
+    },
     initOption() {
       // let data = {
       //   FloorName: item.FloorLocalName,
@@ -109,8 +135,10 @@ export default {
       return new Promose((resolve, reject) => {});
     },
     // 点击多级联动
-    handleChange(val){
-     this.dataKey = val[1];
+    handleChange(val) {
+      console.log(val)
+      // this.jsonKey = val[1];
+      // this.dataKey = `/image-service/common/file_get/${this.jsonKey}?systemId=revit`;
     }
   },
   mounted() {

+ 7 - 4
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -116,8 +116,8 @@ export default {
       this.drawMainScene = new mainScene(null);
       this.drawMainScene
         .urlGetData(
-          // "/image-service/common/file_get/Fl4201050001c72ff970d2ba11e8a57543fa3e79672520181120041440bim.jsonz?systemId=revit", ///////////测试路径
-          this.dataKey       //开发url 
+          "/image-service/common/file_get/Fl4201050001c72ff970d2ba11e8a57543fa3e79672520181120041440bim.jsonz?systemId=revit", ///////////测试路径
+          // this.dataKey       //开发url 
         )
         .then(() => {
           //  将场景赋给view对图进行绘制
@@ -127,6 +127,7 @@ export default {
           // 绘制地图颜色
           this.drawAllItemColor();
           // this.drawMainScene.click(this, this.clickItem);
+           this.drawMainScene.mouseMove(this,this.leftClickMove);
         });
         if(this.isScale){
           this.cancelScale(view)
@@ -138,9 +139,11 @@ export default {
     },
     // 取消放大缩小
     cancelScale(view){
-      console.log(2123)
       view.wheelZoom = 1;
-        console.log(view)
+    },
+    // 左键长按控制canvas的坐标
+    leftClickMove(a,b){ 
+        //  console.log('move',a,b)
     }
   },
   watch: {

+ 3 - 2
src/views/ready/buildfloor/drawGraphy/operateGraphyItem.vue

@@ -10,13 +10,13 @@
       <i class="el-icon-download"></i>
     </div>
     <div class="div-box">
-      <i class="el-icon-circle-plus-outline"></i>
+      <i class="el-icon-remove-outline"></i>
     </div>
     <div class="line">
       <el-slider tooltip-class="tooltip-class" v-model="value1"></el-slider>
     </div>
     <div class="div-box">
-      <i class="el-icon-remove-outline"></i>
+      <i class="el-icon-circle-plus-outline"></i>
     </div>
   </div>
 </template>
@@ -46,6 +46,7 @@ export default {
     align-items: center;
     color: #fff;
     border-right: 1px #ddd solid;
+    cursor: pointer;
   }
   .line {
     width: 200px;

+ 4 - 1
src/views/ready/buildfloor/index.vue

@@ -139,6 +139,7 @@
     <checkGraphy
       :checkGraphyVisible="checkGraphyVisible"
       @handleCloseCGraphy="checkGraphyVisible=false"
+      :checkGraphyItem="checkGraphyItem"
     ></checkGraphy>
   </div>
 </template>
@@ -189,7 +190,8 @@ export default {
       loading: false, //列表loading
       curBuildId: "", //当前选中的建筑id
       curFloorId: "", //当前选中的楼层id
-      jsonKey: ""
+      jsonKey: "",
+      checkGraphyItem:{}
     };
   },
   computed: {
@@ -302,6 +304,7 @@ export default {
       if (3 == index) {
         // 查看
         this.jsonKey = "";
+        this.checkGraphyItem = item
         this.checkGraphyVisible = true;
       } else {
         this.jsonKey = item.StructureInfo.FloorMap;