Browse Source

创建业务空间 字段小写;;建筑楼层3.8

haojianlong 4 years ago
parent
commit
db854803d6

+ 5 - 0
src/api/model/file.js

@@ -345,3 +345,8 @@ export function unassignQuery(param, success) {
     let url = `${revitUrl}/task/query`;
     let url = `${revitUrl}/task/query`;
     httputils.postJson(url, param, success)
     httputils.postJson(url, param, success)
 }
 }
+
+// 根据条件查询统计数量
+export function countModel(params, success) {
+    return httputils.postJson(`${baseUrl}/model-file/count`, params, success)
+}

+ 1 - 1
src/components/business_space/business/handsontable.vue

@@ -506,7 +506,7 @@ export default {
           }
           }
         }
         }
       }
       }
-      param.objectType = this.zoneParam.ZoneType ? this.zoneParam.ZoneType : this.zoneCode;
+      param.classCode = this.zoneParam.ZoneType ? this.zoneParam.ZoneType : this.zoneCode;
       let params = {
       let params = {
         content: [param]
         content: [param]
       };
       };

+ 31 - 0
src/components/ready/buildfloor/backTips.vue

@@ -0,0 +1,31 @@
+<template>
+  <el-dialog title="提示" :visible.sync="dialogVis" width="500px" id="tipsDialog" :close-on-click-modal='false'>
+    <el-row>
+      <div style="line-height:32px;">上传图片未保存,退出后上传图片将失效。是否确认退出?</div>
+    </el-row>
+    <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="dialogVis=false">取消</el-button>
+      <el-button size="small" type="primary" @click="confirm">确认</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+export default {
+  data() {
+    return {
+      dialogVis: false,
+      scaleInput: '',
+      item: '', // 当前修改的item
+    }
+  },
+  methods: {
+    showDialog(v) {
+      this.dialogVis = true
+    },
+    confirm() {
+      this.dialogVis = false;
+      this.$emit('back');
+    }
+  }
+}
+</script>

+ 58 - 0
src/components/ready/buildfloor/setScaleDialog.vue

@@ -0,0 +1,58 @@
+<template>
+  <el-dialog title="设定比例尺" :visible.sync="dialogVis" width="500px" id="scaleDialog" :close-on-click-modal='false'>
+    <el-row>
+      <div style="line-height:32px;">设定比例尺长度 : </div>
+      <div style="width:70%">
+        <el-input-number v-model="scaleInput" controls-position="right" :min="0"></el-input-number> mm
+      </div>
+    </el-row>
+    <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="dialogVis=false">取消</el-button>
+      <el-button size="small" type="primary" @click="confirm">确认</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+import { createRelationInFloor } from "@/api/scan/request";
+export default {
+  data() {
+    return {
+      dialogVis: false,
+      scaleInput: '',
+      item: '', // 当前修改的item
+    }
+  },
+  methods: {
+    showDialog(v) {
+      this.dialogVis = true
+      this.item = v;
+      this.scaleInput = v.text.substring(0, v.text.length - 3);
+    },
+    confirm() {
+      this.item.text = this.scaleInput + ' mm';
+      this.item.update()
+      this.$emit('textChange', this.scaleInput)
+      this.dialogVis = false
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+#scaleDialog {
+  .el-row{
+    height: 50px;
+    max-height: 200px;
+    overflow-y: auto;
+    overflow-x: hidden;
+  }
+  .el-row > div {
+    float: left;
+  }
+  .el-row > div + div {
+    margin-left: 10px;
+  }
+  /deep/ .el-input__inner {
+    vertical-align: baseline;
+  }
+}
+</style>

+ 1 - 1
src/views/data_admin/buildGraphy/createPointZone.vue

@@ -102,7 +102,7 @@ export default {
         Type: item.Type
         Type: item.Type
       }))
       }))
       if (this.RoomLocalName && this.buildFloor.length && this.space) {
       if (this.RoomLocalName && this.buildFloor.length && this.space) {
-        zObj.objectType = this.space;
+        zObj.classCode = this.space;
         zObj.localName = this.RoomLocalName;
         zObj.localName = this.RoomLocalName;
         zObj.localId = this.RoomLocalID;
         zObj.localId = this.RoomLocalID;
         zObj.buildingId = this.buildFloor[0];
         zObj.buildingId = this.buildFloor[0];

+ 1 - 1
src/views/ledger/spacelist/spaceadd/index.vue

@@ -189,7 +189,7 @@ export default {
             item.floorId = item.flowBuild.split("-")[1]
             item.floorId = item.flowBuild.split("-")[1]
           }
           }
         }
         }
-        item.objectType = this.space.spaceType;
+        item.classCode = this.space.spaceType;
       })
       })
       if (flag) {
       if (flag) {
         this.$message.info("存在业务空间的本地名称为空,请检查")
         this.$message.info("存在业务空间的本地名称为空,请检查")

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

@@ -1,5 +1,5 @@
 <template>
 <template>
-  <el-dialog id='checkGraphy' title='添加平面图' :visible.sync='checkGraphyVisible' width='900px' @close='handleClose'>
+  <el-dialog id='checkGraphy' title='添加平面图' :visible.sync='checkGraphyVisible' width='500px' @close='handleClose'>
     <div class='bodys'>
     <div class='bodys'>
       <el-cascader
       <el-cascader
         :options='options'
         :options='options'
@@ -10,17 +10,17 @@
         placeholder='请选择模型文件'
         placeholder='请选择模型文件'
         v-model='casVal'
         v-model='casVal'
       ></el-cascader>
       ></el-cascader>
-      <span>
+      <!-- <span>
                 &nbsp;&nbsp;或&nbsp;&nbsp;
                 &nbsp;&nbsp;或&nbsp;&nbsp;
                 <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false'>
                 <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false'>
                     <el-button type>上传图片</el-button>
                     <el-button type>上传图片</el-button>
                 </el-upload>
                 </el-upload>
                 <span>(支持jpg,png格式)</span>
                 <span>(支持jpg,png格式)</span>
-            </span>
+            </span> -->
       <!-- 展示框 -->
       <!-- 展示框 -->
-      <div class='showBox'>
+      <!-- <div class='showBox'>
         <drawFloor ref='drawFloorDialog' :showTools='false' :id='0' :dialog='true'></drawFloor>
         <drawFloor ref='drawFloorDialog' :showTools='false' :id='0' :dialog='true'></drawFloor>
-      </div>
+      </div> -->
     </div>
     </div>
     <span slot='footer' class='dialog-footer'>
     <span slot='footer' class='dialog-footer'>
             <el-button @click='handleClose'>取 消</el-button>
             <el-button @click='handleClose'>取 消</el-button>

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

@@ -34,7 +34,10 @@ export default {
         isEdit: false,
         isEdit: false,
         divide: true
         divide: true
       },
       },
-      shadeList: []
+      shadeList: [],
+      type: 1, // 当前图展示类型
+      scaleItem: null, // 比例尺item
+      urlModelId: '', // url中传入的modelid
     };
     };
   },
   },
   props: {
   props: {
@@ -62,6 +65,7 @@ export default {
   },
   },
   created() {
   created() {
     this.FloorID = this.$route.query.FloorID;
     this.FloorID = this.$route.query.FloorID;
+    this.urlModelId = this.$route.query.modelId
     Opt.sceneMarkColor = new SColor('#00000080');
     Opt.sceneMarkColor = new SColor('#00000080');
     if (!this.dialog) {
     if (!this.dialog) {
       this.init();
       this.init();
@@ -122,8 +126,8 @@ export default {
         this.view.minScale = this.view.scale;
         this.view.minScale = this.view.scale;
         this.$refs.canvasFun.everyScale = this.view.scale;
         this.$refs.canvasFun.everyScale = this.view.scale;
       }
       }
-      if (this.floorData.Outline && this.floorData.Outline.length) {
-        let newArr = this.floorData.Outline.map(t => {
+      if (this.floorData.outline && this.floorData.outline.length) {
+        let newArr = this.floorData.outline.map(t => {
           return new SPoint(t.X, t.Y);
           return new SPoint(t.X, t.Y);
         })
         })
         this.drawMainScene.addSceneMark(newArr)
         this.drawMainScene.addSceneMark(newArr)

+ 5 - 37
src/views/ready/buildfloor/index.vue

@@ -66,9 +66,7 @@
             <el-table-column label="楼层贯通关系" prop="SubTypeName">
             <el-table-column label="楼层贯通关系" prop="SubTypeName">
               <template slot-scope="scope">
               <template slot-scope="scope">
                 <span
                 <span
-                  style="margin-right:20px">{{
-                    scope.row.floorThroughList ? scope.row.floorThroughList.length : 0
-                  }}</span>
+                  style="margin-right:20px">{{ scope.row.floorThroughList ? scope.row.floorThroughList.length : 0 }}</span>
                 <el-button @click="changeConnection(scope.row)" icon="el-icon-edit-outline" plain size="mini"/>
                 <el-button @click="changeConnection(scope.row)" icon="el-icon-edit-outline" plain size="mini"/>
               </template>
               </template>
             </el-table-column>
             </el-table-column>
@@ -113,10 +111,7 @@
     </el-dialog>
     </el-dialog>
     <!-- 添加贯通关系弹窗 -->
     <!-- 添加贯通关系弹窗 -->
     <addConnectivity @refresh="refresh" ref="addConnectivity"/>
     <addConnectivity @refresh="refresh" ref="addConnectivity"/>
-    <!-- 查看图片弹窗 -->
-    <checkGraphy :alreadyRelatedModel='alreadyRelatedModel' @refresh="bindRefresh" ref="checkGraphy"></checkGraphy>
   </div>
   </div>
-
 </template>
 </template>
 
 
 <script>
 <script>
@@ -124,7 +119,6 @@ import addFloor from "@/views/ready/buildfloor/addFloor/index";
 import addBuild from "@/components/ready/buildfloor/addBuild";
 import addBuild from "@/components/ready/buildfloor/addBuild";
 import { mapGetters } from "vuex";
 import { mapGetters } from "vuex";
 import addConnectivity from "@/components/ready/buildfloor/addConnectivity";
 import addConnectivity from "@/components/ready/buildfloor/addConnectivity";
-import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
 import tools from "@/utils/buildfloor/tools";
 import tools from "@/utils/buildfloor/tools";
 import {
 import {
   buildingQueryAndCount,
   buildingQueryAndCount,
@@ -137,13 +131,11 @@ import {
 } from "@/api/scan/request";
 } from "@/api/scan/request";
 import { getDataDictionary } from "@/api/dict";
 import { getDataDictionary } from "@/api/dict";
 
 
-
 export default {
 export default {
   components: {
   components: {
     addFloor,
     addFloor,
     addBuild,
     addBuild,
-    addConnectivity,
-    checkGraphy
+    addConnectivity
   },
   },
   data() {
   data() {
     return {
     return {
@@ -171,8 +163,6 @@ export default {
       curBuildName: "", //当前选中建筑的名称
       curBuildName: "", //当前选中建筑的名称
       curFloorId: "", //当前选中的楼层id
       curFloorId: "", //当前选中的楼层id
       modelId: "",
       modelId: "",
-      alreadyRelatedModel: [],
-      // currentType: 'add'
       buildMessage: {},
       buildMessage: {},
       selectedBuildIndex: 0
       selectedBuildIndex: 0
     };
     };
@@ -225,7 +215,6 @@ export default {
     handleSearchBuildKey() {
     handleSearchBuildKey() {
       let params = {
       let params = {
         type: 'building',
         type: 'building',
-        // orders: "sort asc,infoPointCode asc",
         pageNumber: 1,
         pageNumber: 1,
         pageSize: 1000
         pageSize: 1000
       };
       };
@@ -299,15 +288,6 @@ export default {
           this.$refs.addBuildDialog.closeDialog()
           this.$refs.addBuildDialog.closeDialog()
         })
         })
       } else {
       } else {
-        // if(Object.keys(newform).length > 0) {
-        //   objectCreateBuild(Param, res => {
-        //     this.$message.success('创建成功')
-        //     this.$refs.addBuildDialog.closeDialog()
-        //   })
-        // } else {
-        //   this.$refs.addBuildDialog.closeDialog()
-        //   return false
-        // }
         objectCreateBuild(Param, res => {
         objectCreateBuild(Param, res => {
           this.$message.success('创建成功')
           this.$message.success('创建成功')
           this.$refs.addBuildDialog.closeDialog()
           this.$refs.addBuildDialog.closeDialog()
@@ -344,15 +324,8 @@ export default {
       floorQueryAndSign(floorParam, res => {
       floorQueryAndSign(floorParam, res => {
         this.tableData = res.content;
         this.tableData = res.content;
         this.page.total = res.total;
         this.page.total = res.total;
-        this.alreadyRelatedModel = res.content.map(t => {
-          return t.modelId
-        }).filter(t => t);
       });
       });
     },
     },
-    // 绑定图以后刷新
-    bindRefresh() {
-      this.init();
-    },
     // 创建楼层成功-修改关系成功
     // 创建楼层成功-修改关系成功
     refresh() {
     refresh() {
       this.getFloorTableData();
       this.getFloorTableData();
@@ -389,7 +362,6 @@ export default {
     },
     },
     // 修改楼层信息
     // 修改楼层信息
     editFloorData(floor) {
     editFloorData(floor) {
-      console.log(floor, 'floor')
       this.floorTitle = "编辑楼层信息";
       this.floorTitle = "编辑楼层信息";
       this.curFloorId = floor.id;
       this.curFloorId = floor.id;
       this.$refs.addFloorDialog.showDialog(floor);
       this.$refs.addFloorDialog.showDialog(floor);
@@ -402,24 +374,20 @@ export default {
     // 查看平面图
     // 查看平面图
     checkDrawImg(row, index) {
     checkDrawImg(row, index) {
       if (3 == index) {
       if (3 == index) {
-        this.$refs.checkGraphy.showDialog(row);
         this.modelId = "";
         this.modelId = "";
       } else if (index == 1) {
       } else if (index == 1) {
-        // this.modelId = row.StructureInfo.FloorMap
         this.modelId = row.infos.floorMap
         this.modelId = row.infos.floorMap
-        let pa = { modelId: this.modelId, FloorID: row.id, BuildID: row.buildingId, BuildName: this.curBuildName };
-        this.$router.push({ name: "repetitionGraphy", query: pa });
       } else {
       } else {
         this.modelId = row.modelId;
         this.modelId = row.modelId;
-        let pa = { modelId: this.modelId, FloorID: row.id, BuildID: row.buildingId, BuildName: this.curBuildName };
-        this.$router.push({ name: "repetitionGraphy", query: pa });
       }
       }
+      const pa = { modelId: this.modelId, FloorID: row.id, BuildID: row.buildingId, BuildName: this.curBuildName }
+      this.$router.push({ name: "repetitionGraphy", query: pa });
     },
     },
     //  查询建筑信息
     //  查询建筑信息
     handleBuildQuery() {
     handleBuildQuery() {
       let param = {
       let param = {
         projectId: this.projectId,
         projectId: this.projectId,
-        // Orders: "BuildLocalName asc",
+        Orders: "localName asc",
         pageNumber: 1,
         pageNumber: 1,
         pageSize: 500
         pageSize: 500
       };
       };

+ 322 - 20
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -3,30 +3,78 @@
   <div id='repetitionGraphy'>
   <div id='repetitionGraphy'>
     <div class='buttons'>
     <div class='buttons'>
       <el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
       <el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
-      <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>替换平面图</el-button>
-      <el-button v-if='(sign||otherSign)&&!isEdit' size='mini' @click='editGraphy'>编辑平面图</el-button>
-      <el-button v-if='isEdit' size='mini' @click='cancel'>取消</el-button>
-      <el-button v-if='isEdit' size='mini' @click='confirm' type='primary'>确认</el-button>
-      <span style='float:right;' v-if='file.FolderName'>当前对应的模型文件:{{ file.FolderName }} - {{ file.FloorName }}</span>
+      <template v-if="!hasModel">
+        <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1" accept=".jpg,.png">
+          <el-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
+        </el-upload>
+        <el-button style='float:right;' size='mini' type='primary' v-if="step==0" @click="nextStep" :disabled="nextStepBtnDisable">下一步</el-button>
+        <el-button style='float:right;' size='mini' type='primary' v-if="step==1" @click="nextStep">保存</el-button>
+        <el-button style='float:right;' size='mini' v-if="step==1" @click="lastStep">上一步</el-button>
+      </template>
+      <template v-else>
+        <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>{{hasGraph?'替换模型文件':'关联模型文件'}}</el-button>
+        <el-button v-if='(sign||otherSign)&&!isEdit' size='mini' @click='editGraphy'>编辑平面图</el-button>
+        <el-button v-if='isEdit' size='mini' @click='cancel'>取消</el-button>
+        <el-button v-if='isEdit' size='mini' @click='confirm' type='primary'>确认</el-button>
+      </template>
+      <span style='float:right;' v-if='file.FolderName'>当前对应的模型文件:{{file.FolderName}} - {{file.FloorName}}</span>
     </div>
     </div>
     <!-- 展示图片 -->
     <!-- 展示图片 -->
     <div class='drawImg'>
     <div class='drawImg'>
-      <drawFloor ref='drawFloor' :isEdit='isEdit' :showTools='true' :id='1' @changeSign='changeSign'></drawFloor>
+      <div style="width: 100%;height: 100%;position: relative;" v-if="hasGraph">
+        <drawFloor ref='drawFloor' :isEdit='isEdit' :showTools='true' :id='1' @changeSign='changeSign' @getGraphSuc="getGraphSuc"></drawFloor>
+        <div class="stepContainer" v-if="step>-1">
+          <el-steps :active="step" align-center finish-status="success" process-status="process">
+            <el-step title="设定比例尺" :description="stepDes[0]"></el-step>
+            <el-step title="楼层对齐" :description="stepDes[1]"></el-step>
+          </el-steps>
+        </div>
+        <ul class="floorList" v-if="step==1">
+          <template v-if="floorList.length > 1">
+            <li style="border-bottom:1px solid #ccc;text-align: center;padding: 0">选择对齐楼层</li>
+            <li v-for="t in floorList" :key="t.FloorID">
+              <el-radio v-model="floorRadio" :label="t" @change="changeFloor" :disabled="t.FloorID == FloorID">{{t.FloorLocalID || t.FloorLocalName}}
+              </el-radio>
+            </li>
+          </template>
+          <template v-else>
+            <li style="text-align: center;padding: 0">
+              暂无对齐楼层
+            </li>
+          </template>
+        </ul>
+      </div>
+      <div style="width: 100%;height: 100%" v-else>
+        <div class="center" style="padding-top: 300px">
+          <i class="icon-wushuju iconfont"></i>暂无平面图
+        </div>
+      </div>
     </div>
     </div>
     <!-- 查看图片弹窗 -->
     <!-- 查看图片弹窗 -->
     <checkGraphy ref='checkGraphy' @refresh='refresh' :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
     <checkGraphy ref='checkGraphy' @refresh='refresh' :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
+    <!-- 设定比例尺弹窗 -->
+    <setScaleDialog ref="setScaleDialog" @textChange="scaleTextChange"></setScaleDialog>
+    <!-- 退出时弹窗提示 -->
+    <backTips ref='backTips' @back="runBack"></backTips>
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
 import drawFloor from './drawGraphy/drawFloor'
 import drawFloor from './drawGraphy/drawFloor'
 import checkGraphy from './drawGraphy/checkGraphy' //查看图片
 import checkGraphy from './drawGraphy/checkGraphy' //查看图片
-import { floorUpdateOutline, floorQueryAndSign } from '@/api/scan/request'
-import { getFileNameById } from '@/api/model/file'
-
+import setScaleDialog from '@/components/ready/buildfloor/setScaleDialog'
+import backTips from '@/components/ready/buildfloor/backTips'
+import { floorUpdateOutline, floorQueryAndSign, manageUpdateFloor } from '@/api/scan/request'
+import { getFileNameById, countModel } from '@/api/model/file'
+import { EditLineItem, SItemStatus, SImageShowType, IconTextItem } from "@saga-web/cad-engine"
+import { SColor } from "@saga-web/draw"
+import { SImageItem } from '@saga-web/graph/lib'
+import { SMathUtil } from "@saga-web/cad-engine/lib/utils/SMathUtil"
 export default {
 export default {
   components: {
   components: {
     drawFloor,
     drawFloor,
     checkGraphy,
     checkGraphy,
+    setScaleDialog,
+    backTips
   },
   },
   data() {
   data() {
     return {
     return {
@@ -36,6 +84,21 @@ export default {
       alreadyRelatedModel: [],
       alreadyRelatedModel: [],
       sign: false,
       sign: false,
       otherSign: false,
       otherSign: false,
+      hasGraph: false, // 当前楼层是否有平面图
+      hasModel: false, // 项目中时候有模型文件
+      step: -1, // 当前处于第几步 同时为比例尺item判断是否创建的可编辑的依据;能否返回上页的依据
+      key: '', // 当楼层图为图片时图的key
+      stepDes: [
+        '请在图上点击两点绘制线段并标记实际长度',
+        '请移动图片与其他楼层对齐'
+      ], // 描述文字
+      floorList: [], // 当前建筑下所有楼层
+      floorRadio: '', // 当前选中的楼层对象
+      imgService: `/image-service/common/image_get?systemId=dataPlatform&key=`,
+      curImgItem: null, // 对齐的楼层图片
+      scaleItem: null, // 比例尺item
+      baseImgItem: null, // 当前楼层图的图片
+      nextStepBtnDisable: true, // 比例尺item创建标识
     }
     }
   },
   },
   created() {
   created() {
@@ -43,12 +106,16 @@ export default {
     this.FloorID = this.$route.query.FloorID
     this.FloorID = this.$route.query.FloorID
     this.BuildID = this.$route.query.BuildID
     this.BuildID = this.$route.query.BuildID
     this.BuildName = this.$route.query.BuildName
     this.BuildName = this.$route.query.BuildName
-    if (this.modelId.split('.')[1].toString() == 'png' || this.modelId.split('.')[1].toString() == 'jpg') {
-      return
-    } else {
-      this.init()
+    if (this.modelId != '') {
+      this.hasGraph = true;
+      const temp = this.modelId.split('.');
+      if (temp[1] && (temp[1].toLowerCase() == 'png' || temp[1].toLowerCase() == 'jpg')) {
+        // return
+      } else {
+        this.init()
+      }
     }
     }
-
+    this.getCountModel()
   },
   },
   mounted() {
   mounted() {
   },
   },
@@ -59,6 +126,14 @@ export default {
     },
     },
     // 返回路由
     // 返回路由
     backRouter() {
     backRouter() {
+      // 底图为图片  上传完图片后未保存
+      if (this.step > -1) {
+        this.$refs.backTips.showDialog();
+      } else {
+        this.runBack()
+      }
+    },
+    runBack() {
       this.$router.push({ name: 'buildFloor' })
       this.$router.push({ name: 'buildFloor' })
     },
     },
     // 替换模型文件
     // 替换模型文件
@@ -88,7 +163,7 @@ export default {
         })
         })
       }
       }
       let pa = {
       let pa = {
-        Content: [{ FloorID: this.FloorID, Outline: Outline }],
+        Content: [{ id: this.FloorID, outline: Outline }],
         Projection: ['Outline'],
         Projection: ['Outline'],
       }
       }
       floorUpdateOutline(pa, (res) => {
       floorUpdateOutline(pa, (res) => {
@@ -108,7 +183,12 @@ export default {
     // 替换模型文件成功
     // 替换模型文件成功
     refresh(modelId) {
     refresh(modelId) {
       this.modelId = modelId
       this.modelId = modelId
-      this.getFileName(this.modelId)
+      this.hasGraph = true;
+      const temp = this.modelId.split('.');
+      if (temp[1] && temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
+        this.key = '';
+        this.getFileName(this.modelId)
+      }
     },
     },
     // 获取文件夹名称
     // 获取文件夹名称
     getFileName(modelId) {
     getFileName(modelId) {
@@ -124,13 +204,16 @@ export default {
     getFloorData() {
     getFloorData() {
       let floorParam = {
       let floorParam = {
         PageSize: 1000,
         PageSize: 1000,
-        Filters: `BuildID='${this.BuildID}'`,
+        Filters: `buildId='${this.BuildID}'`,
       }
       }
       floorQueryAndSign(floorParam, (res) => {
       floorQueryAndSign(floorParam, (res) => {
+        this.floorList = res.content;
+        // todo
+        this.floorRadio = res.content[0];
         this.alreadyRelatedModel = res.Content.map((t) => {
         this.alreadyRelatedModel = res.Content.map((t) => {
-          if (t.FloorID != this.FloorID) return t.ModelId
+          if (t.floorID != this.FloorID) return t.ModelId
           this.sign = t.Sign > 0
           this.sign = t.Sign > 0
-          this.FloorName = t.FloorLocalName || t.FloorName
+          this.FloorName = t.localName || t.name
           this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
           this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
         }).filter((t) => t)
         }).filter((t) => t)
       })
       })
@@ -138,6 +221,197 @@ export default {
     changeSign(flag) {
     changeSign(flag) {
       this.otherSign = flag
       this.otherSign = flag
     },
     },
+    // 统计项目下是否有模型文件
+    getCountModel() {
+      countModel({}, res => {
+        this.hasModel = res.Count > 0
+      })
+    },
+    //上传图片
+    uploadAndSubmit(item) {
+      let file = item.file
+      let reader = new FileReader()
+      let vm = this
+      let fileType = file.name.split('.')
+      let type = fileType[fileType.length - 1]
+      let uploadKey = file.uid
+      reader.onloadend = function () {
+        // 这个事件在读取结束后,无论成功或者失败都会触发
+        if (reader.error) {
+        } else {
+          // document.getElementById("bytesRead").textContent = file.size;
+          // 构造 XMLHttpRequest 对象,发送文件 Binary 数据
+          var xhr = new XMLHttpRequest()
+          xhr.open(
+                    /* method */ 'POST',
+            /* target url */
+            '/image-service/common/image_upload?systemId=dataPlatform&secret=9e0891a7a8c8e885&overwrite=true&key=' + uploadKey + '.' + type
+            /*, async, default to true */
+          )
+          //xhr.overrideMimeType("application/octet-stream");
+          xhr.send(reader.result)
+          xhr.onreadystatechange = function () {
+            if (xhr.readyState == 4) {
+              if (xhr.status == 200) {
+                vm.key = uploadKey + '.' + type
+                // 将图片展示
+                vm.refresh(uploadKey + '.' + type)
+                // 设置步骤为第一步
+                vm.step = 0;
+              }
+            }
+          }
+        }
+      }
+      reader.readAsArrayBuffer(file)
+    },
+    // 更新楼层key 为图片,同时更新比例尺
+    updateFloorKey() {
+      const scaleItem = this.$refs.drawFloor.scaleItem;
+      // 比例尺坐标处理,当底图被对齐操作后,需要跟随底图改变坐标
+      const line = scaleItem.line.map(t => {
+        return { x: t.x + this.baseImgItem.x, y: t.y + this.baseImgItem.y }
+      })
+      let Param = {
+        Content: [{
+          FloorId: this.FloorID,
+          StructureInfo: { FloorMap: this.key },
+          Properties: {
+            X: this.baseImgItem.x,
+            Y: this.baseImgItem.y,
+            Line: line,
+            Text: scaleItem.text
+          }
+        }],
+        Projection: ['StructureInfo', 'Properties'],
+      }
+      manageUpdateFloor(Param, (res) => {
+        this.$message.success('更新成功')
+        this.step = -1;
+        this.baseImgItem.globalAlpha = 1
+        this.removeLast()
+        this.$refs.drawFloor.fit()
+      })
+    },
+    // 根据modelid初始化
+    initFromModelId(id) {
+      const temp = id.split('.')[1];
+      if (temp && (temp.toLowerCase() == 'png' || temp.toLowerCase() == 'jpg')) {
+        this.$refs.drawFloor.initGraphy(id, 3)
+      } else {
+        this.$refs.drawFloor.initGraphy(id, 1)
+      }
+    },
+    // 上一步
+    lastStep() {
+      this.step = 0;
+      this.$refs.drawFloor.scaleItem.show()
+      this.baseImgItem.globalAlpha = 1
+      this.removeLast()
+    },
+    // 下一步||保存
+    nextStep() {
+      this.baseImgItem = this.$refs.drawFloor.drawMainScene.imgList[0]
+      this.baseImgItem.globalAlpha = 0.5
+      this.baseImgItem.moveable = true;
+      // 下一步
+      if (this.step == 0) {
+        this.step = 1;
+        this.$refs.drawFloor.scaleItem.hide();
+        // 获取楼层列表
+        this.getFloorData()
+      } else if (this.step == 1) {
+        // 保存
+        this.updateFloorKey();
+      }
+    },
+    // 加载图成功 仅在底图为图片时返回成功
+    getGraphSuc() {
+      const scaleItem = this.$refs.drawFloor.scaleItem
+      if (this.step == 0) {
+        scaleItem.status = SItemStatus.Create;
+        this.$refs.drawFloor.drawMainScene.grabItem = scaleItem;
+        scaleItem.connect('changText', this, this.changeText)
+        scaleItem.moveable = true;
+        this.clearScaleData(scaleItem);
+      } else if (this.step == -1) {
+        scaleItem.status = SItemStatus.Normal;
+      }
+    },
+    // 修改比例尺文字
+    changeText(t, e) {
+      this.$refs.setScaleDialog.showDialog(t)
+    },
+    // 文本修改
+    scaleTextChange(v) {
+      if (v > 0) {
+        this.nextStepBtnDisable = false
+      }
+    },
+    // 第二部楼层修改
+    changeFloor(v) {
+      // v->当前改为的楼层对象
+      this.removeLast();
+      if (v.StructureInfo && v.StructureInfo.FloorMap) {
+        const url = this.imgService + v.StructureInfo.FloorMap
+        this.curImgItem = new SImageItem(null, url);
+        this.curImgItem.enabled = false;
+        this.curImgItem.showType = SImageShowType.AutoFit;
+        if (v.Properties) {
+          try {
+            // 计算两个比例尺差距
+            const scaleItem = this.$refs.drawFloor.scaleItem
+            this.curImgItem.zOrder = scaleItem.zOrder - 1;
+            const r = this.calScaleGap(v.Properties, scaleItem);
+            if (r != 1) {
+              this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
+            }
+            this.curImgItem.showType == SImageShowType.Full;
+            this.curImgItem.moveTo(v.Properties.X, v.Properties.Y);
+            // this.curImgItem.width = v.Properties.width;
+            // this.curImgItem.height = v.Properties.height;
+          } catch (err) {
+            console.log(err);
+          }
+        }
+        this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
+        this.$refs.drawFloor.fit()
+      }
+    },
+    // 清除上一张底图
+    removeLast() {
+      if (this.curImgItem) {
+        this.$refs.drawFloor.drawMainScene.removeItem(this.curImgItem);
+        this.curImgItem = null;
+        this.$refs.drawFloor.view.update()
+      }
+    },
+    // 清空比例尺数据
+    clearScaleData(scaleItem) {
+      scaleItem.line = [];
+      scaleItem.pointChange();
+      scaleItem.text = '0 mm';
+    },
+    // 计算两个比例尺差距
+    calScaleGap(pro, item) {
+      // pro -> 楼层的properties
+      // item -> 当前的比例尺item
+      let result = 1
+      if (pro.Line.length && pro.Text) {
+        try {
+          const proDis = SMathUtil.pointDistance(pro.Line[0].x, pro.Line[0].y, pro.Line[1].x, pro.Line[1].y)
+          const proText = pro.Text.substring(0, pro.Text.length - 3);
+          const proScale = proDis / proText;
+          const itemDis = SMathUtil.pointDistance(item.line[0].x, item.line[0].y, item.line[1].x, item.line[1].y)
+          const itemText = item.text.substring(0, item.text.length - 3);
+          const itemScale = itemDis / itemText;
+          result = (proScale / itemScale).toFixed()
+        } catch (err) {
+          console.log(err);
+        }
+      }
+      return result;
+    }
   },
   },
   watch: {
   watch: {
     modelId(n, o) {
     modelId(n, o) {
@@ -161,11 +435,39 @@ export default {
   position: relative;
   position: relative;
   padding: 10px;
   padding: 10px;
   box-sizing: border-box;
   box-sizing: border-box;
-
   .drawImg {
   .drawImg {
     width: 100%;
     width: 100%;
     margin-top: 10px;
     margin-top: 10px;
     height: calc(100% - 40px);
     height: calc(100% - 40px);
   }
   }
+  .upload-demo {
+    display: inline-block;
+  }
+  .stepContainer {
+    width: 100%;
+    position: absolute;
+    top: 0;
+    left: 50%;
+    margin-left: -50%;
+    z-index: 9;
+    background-color: #fff;
+  }
+  .floorList {
+    position: absolute;
+    width: 100px;
+    max-height: 250px;
+    overflow-x: hidden;
+    overflow-y: auto;
+    left: 40px;
+    top: 200px;
+    z-index: 10;
+    background: #fff;
+    border: 1px solid #ccc;
+    li {
+      box-sizing: border-box;
+      padding: 0 10px;
+      width: 100%;
+    }
+  }
 }
 }
 </style>
 </style>