repetitionGraphy.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <!-- 查看平面图页面 -->
  3. <div id="repetitionGraphy">
  4. <div class="buttons">
  5. <el-button icon="el-icon-back" size="mini" @click="backRouter"></el-button>
  6. <el-button v-if="!isEdit" size="mini" @click="changeGraphy">替换平面图</el-button>
  7. <el-button v-if="!isEdit" size="mini" @click="editGraphy">编辑平面图</el-button>
  8. <el-button v-if="isEdit" size="mini" @click="cancel">取消</el-button>
  9. <el-button v-if="isEdit" size="mini" @click="confirm" type="primary">确认</el-button>
  10. </div>
  11. <!-- 展示图片 -->
  12. <div class="drawImg">
  13. <drawFloor ref="drawFloor" :isEdit="isEdit" :showTools="true" :id="1"></drawFloor>
  14. </div>
  15. <!-- 查看图片弹窗 -->
  16. <checkGraphy ref="checkGraphy" @refresh="refresh"></checkGraphy>
  17. </div>
  18. </template>
  19. <script>
  20. import drawFloor from "./drawGraphy/drawFloor";
  21. import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
  22. import { floorUpdate } from "@/api/scan/request";
  23. export default {
  24. components: {
  25. drawFloor,
  26. checkGraphy
  27. },
  28. data() {
  29. return {
  30. modelId: "", //
  31. isEdit: false, // 是否编辑模式
  32. };
  33. },
  34. created() {
  35. this.modelId = this.$route.query.modelId;
  36. this.FloorID = this.$route.query.FloorID;
  37. },
  38. mounted() {
  39. this.$refs.drawFloor.initGraphy(this.modelId)
  40. },
  41. methods: {
  42. // 返回路由
  43. backRouter() {
  44. this.$router.push({ name: 'buildFloor' })
  45. },
  46. // 替换模型文件
  47. changeGraphy() {
  48. this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID })
  49. },
  50. // 确认保存
  51. confirm() {
  52. let sceneMark = this.$refs.drawFloor.drawMainScene.sceneMark;
  53. if (!sceneMark || sceneMark.outLine.length < 3) {
  54. this.$message.warning('请添加轮廓线');
  55. return;
  56. }
  57. if (!sceneMark.closeFlag) {
  58. this.$message.warning('请按回车闭合轮廓线');
  59. this.$refs.drawFloor.focus();
  60. return;
  61. }
  62. let pa = {
  63. Content: [{ FloorID: this.FloorID, Outline: this.$refs.drawFloor.drawMainScene.sceneMark.outLine }],
  64. Projection: ['Outline']
  65. }
  66. floorUpdate(pa, res => {
  67. this.isEdit = false;
  68. this.$message.success("更新成功");
  69. })
  70. },
  71. // 取消
  72. cancel() {
  73. this.isEdit = false;
  74. this.$refs.drawFloor.initGraphy(this.modelId)
  75. },
  76. // 编辑平面图
  77. editGraphy() {
  78. this.isEdit = true;
  79. },
  80. refresh() { }
  81. },
  82. };
  83. </script>
  84. <style lang="less">
  85. #repetitionGraphy {
  86. width: 100%;
  87. height: 100%;
  88. background: #fff;
  89. position: relative;
  90. padding: 10px;
  91. box-sizing: border-box;
  92. .drawImg {
  93. width: 100%;
  94. margin-top: 10px;
  95. height: calc(100% - 40px);
  96. }
  97. }
  98. </style>