YaolongHan 5 years ago
parent
commit
3b37242a20

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

@@ -97,8 +97,8 @@ export default {
     eventBus.$on("suitableRatios", function() {
       that.view.fitSceneToView();
     });
-     eventBus.$on("changeRatios", function(val) {
-       that.changeRatios(val)
+    eventBus.$on("changeRatios", function(val) {
+      that.changeRatios(val);
     });
   },
   methods: {
@@ -157,8 +157,17 @@ export default {
     leftClickMove(a, b) {
       //  console.log('move',a,b)
     },
-    changeRatios(val){
-      console.log('val',val)
+    changeRatios(val) {
+      //获取中心点
+      let rect = this.view.scene.worldRect();
+      // //计算缩放比例
+      this.view.scale = this.view.scale * val *5;
+      // // 移动画布
+      this.view.origin.x =
+        (-(rect.right + rect.left) / 2) * this.view.scale + this.view.width / 2;
+      this.view.origin.y =
+        (-(rect.bottom + rect.top) / 2) * this.view.scale +
+        this.view.height / 2;
     }
   },
   watch: {

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

@@ -0,0 +1,69 @@
+<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>