YaolongHan 5 年 前
コミット
7cec426051

+ 2 - 0
src/views/ready/buildfloor/drawGraphy/bus.js

@@ -0,0 +1,2 @@
+import Vue from 'Vue';
+export default new Vue()

+ 1 - 1
src/views/ready/buildfloor/drawGraphy/checkGraphy.vue

@@ -107,7 +107,7 @@ export default {
           {
             FloorID: this.checkGraphyItem.FloorID,
             StructureInfo: {
-              FloorMap: this.jsonKey
+              // FloorMap: this.jsonKey
             }
           }
         ]

+ 31 - 22
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -14,16 +14,17 @@ import axios from "axios";
 import { SPoint } from "@sybotan-web/base/lib";
 import { SPen, SPainter, SColor } from "@sybotan-web/draw";
 import { mainScene, SGraphyRectItem } from "@/assets/graphy/index.js";
+import eventBus from "./bus.js";
 export default {
   props: {
     cadWidth: {
       type: String | Number,
-      default: '100%',
+      default: "100%",
       required: false
     },
     cadHeight: {
       type: String | Number,
-      default: '100%',
+      default: "100%",
       required: false
     },
     dataKey: {
@@ -71,24 +72,31 @@ export default {
       default: "#1abc9c",
       required: false
     },
-    isScale: { //是否放大缩小
+    isScale: {
+      //是否放大缩小
       type: Boolean,
       default: false,
       required: false
     },
-    indexs:{ //是否放大缩小
-      type: Number|String,
-      default: '',
+    indexs: {
+      //是否放大缩小
+      type: Number | String,
+      default: "",
       required: false
-    },
+    }
   },
   data() {
     return {
-      drawMainScene: null
+      drawMainScene: null,
+      view: null
     };
   },
   mounted() {
     this.initGraphy();
+    let that = this;
+    eventBus.$on("suitableRatios", function() {
+      that.view.fitSceneToView();
+    });
   },
   methods: {
     clickItem(item) {
@@ -111,39 +119,40 @@ export default {
         return;
       }
       this.drawMainScene = null;
+      this.view = null;
       // 初始化view类
-      let view = new SGraphyView("canvas"+this.indexs);
+      this.view = new SGraphyView("canvas" + this.indexs);
       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对图进行绘制
-          view.scene = this.drawMainScene;
+          this.view.scene = this.drawMainScene;
           // 自动缩放比例
-          view.fitSceneToView();
+          this.view.fitSceneToView();
           // 绘制地图颜色
           this.drawAllItemColor();
           // this.drawMainScene.click(this, this.clickItem);
-           this.drawMainScene.mouseMove(this,this.leftClickMove);
+          this.drawMainScene.mouseMove(this, this.leftClickMove);
         });
-        if(this.isScale){
-          this.cancelScale(view)
-        }
+      if (this.isScale) {
+        this.cancelScale(this.view);
+      }
     },
     // 单个item 高亮
     heightLightitem(item, highlightColor) {
       this.drawItemColor(item, highlightColor);
     },
     // 取消放大缩小
-    cancelScale(view){
+    cancelScale(view) {
       view.wheelZoom = 1;
     },
     // 左键长按控制canvas的坐标
-    leftClickMove(a,b){ 
-        //  console.log('move',a,b)
+    leftClickMove(a, b) {
+      //  console.log('move',a,b)
     }
   },
   watch: {
@@ -165,10 +174,10 @@ export default {
   width: 100%;
   position: relative;
   height: auto;
-  canvas{
+  canvas {
     position: absolute;
     left: 50%;
-    transform: translateX(-50%)
+    transform: translateX(-50%);
   }
 }
 </style>

+ 30 - 8
src/views/ready/buildfloor/drawGraphy/operateGraphyItem.vue

@@ -1,32 +1,53 @@
 <template>
   <div id="operateGraphyItem">
-    <div class="div-box">
+    <div class="div-box" @click="openDrag">
       <i class="el-icon-rank"></i>
     </div>
-    <div class="div-box">
+    <div class="div-box" @click="suitableRatio">
       <i class="el-icon-rank"></i>
     </div>
     <div class="div-box">
       <i class="el-icon-download"></i>
     </div>
-    <div class="div-box">
+    <div class="div-box"  @click="addRatio">
       <i class="el-icon-remove-outline"></i>
     </div>
     <div class="line">
-      <el-slider tooltip-class="tooltip-class" v-model="value1"></el-slider>
+      <el-slider tooltip-class="tooltip-class" @change="adjustRatio"></el-slider>
     </div>
-    <div class="div-box">
+    <div class="div-box" @click="removeRatio">
       <i class="el-icon-circle-plus-outline"></i>
     </div>
   </div>
 </template>
 <script>
+import eventBus from "./bus.js"
 export default {
   data() {
     return {
-      value1: ""
     };
-  }
+  },
+  methods: {
+    // 开启拖动
+    openDrag(){
+      // eventBus.$emit('openDrags')
+    },
+    //合适比例
+    suitableRatio(){
+      eventBus.$emit('suitableRatios')
+    },
+    // 滑块调整比例
+    adjustRatio(){
+       
+    },
+    //增加比例
+    addRatio(){
+
+    },
+    //减少比例
+    removeRatio(){
+    }
+  },
 };
 </script>
 <style lang="less">
@@ -36,6 +57,7 @@ export default {
   border: 1px #ddd solid;
   border-radius: 5px;
   overflow: hidden;
+  z-index: 999;
   .div-box {
     font-size: 24px;
     width: 40px;
@@ -45,8 +67,8 @@ export default {
     justify-content: center;
     align-items: center;
     color: #fff;
-    border-right: 1px #ddd solid;
     cursor: pointer;
+    border-right: 1px #ddd solid;
   }
   .line {
     width: 200px;

+ 0 - 69
src/views/ready/buildfloor/drawGraphy/repetitionGraphy.vue

@@ -1,69 +0,0 @@
-<template>
-  <el-dialog
-    id="checkdrawimg"
-    title="前期准备/建筑楼层管理/平面图维护"
-    :visible.sync="repetitionGraphyVisible"
-    width="60%"
-    :before-close="handleClose"
-  >
-    <div class="bodys">
-      <div class="buttons">
-        <el-button icon="el-icon-back" size="mini"></el-button>
-        <el-button size="mini">替换平面图</el-button>
-        <el-button size="mini">编辑平面图</el-button>
-      </div>
-      <!-- 展示图片 -->
-      <div class="drawImg">
-        <drawFloor
-          ref="drawFloor"
-          :findGraphyItemId="findGraphyItemId"
-          :dataKey="dataKey"
-          :point="point"
-          :pointWidth="pointWidth"
-          :cadWidth="1000"
-          :cadHeight="500"
-          :isScale="true"
-        ></drawFloor>
-      </div>
-    </div>
-    <span slot="footer" class="dialog-footer">
-      <el-button @click="dialogVisible = false">取 消</el-button>
-      <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
-    </span>
-  </el-dialog>
-</template>
-<script>
-import drawFloor from "./drawFloor";
-export default {
-  components: {
-    drawFloor
-  },
-  props: {
-    repetitionGraphyVisible: Boolean
-  },
-  data() {
-    return {
-      dataKey:
-        "/image-service/common/file_get/Fl4201050001c72ff970d2ba11e8a57543fa3e79672520181120041440bim.jsonz?systemId=revit", // key
-      point: [40703.54760591985, 42678.14510522981], //坐标
-      pointWidth: 2000,
-      findGraphyItemId: "" //高亮的id
-    };
-  },
-  methods: {
-    handleClose() {
-      this.$emit("closeRepeatVisible");
-    }
-  }
-};
-</script>
-<style lang="less">
-#checkdrawimg {
-  .drawImg {
-    width: 100%;
-    height: 500px;
-    margin-top: 12px;
-    border: 1px solid #ccc;
-  }
-}
-</style>

+ 5 - 7
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -25,22 +25,19 @@
       @handleCloseCGraphy="checkGraphyVisible=false"
     ></checkGraphy>
     <div id="operateList">
-      <repetitionGraphy></repetitionGraphy>
+      <operateGraphyItem></operateGraphyItem>
     </div>
   </div>
 </template>
 <script>
 import drawFloor from "./drawGraphy/drawFloor";
 import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
-import repetitionGraphy from "./drawGraphy/operateGraphyItem" //各个item
+import operateGraphyItem from "./drawGraphy/operateGraphyItem" //各个item
 export default {
   components: {
     drawFloor,
     checkGraphy,
-    repetitionGraphy
-  },
-  props: {
-    repetitionGraphyVisible: Boolean,
+    operateGraphyItem
   },
   data() {
     return {
@@ -60,9 +57,10 @@ export default {
     backRouter() {
       this.$router.go(-1);
     },
+    // 替换模型文件
     changeGraphy() {
       this.checkGraphyVisible = true;
-    }
+    },
   },
   created() {
     this.dataKey = `/image-service/common/file_get/${this.$route.query.jsonKey}?systemId=revit`;