Bladeren bron

修改bug7532 7531 7527 7509

haojianlong 4 jaren geleden
bovenliggende
commit
b62aaab52d

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

@@ -122,13 +122,14 @@ export default {
         floorId: this.floor.FloorID,
         buildingId: this.floor.BuildID,
         cover: true,
+        currentModelId: this.floor.CurrentModelId
       }
       if (this.jsonKey) {
         pa.id = this.modelIdToFloorId[this.jsonKey]
         bindFloorModel(pa, (res) => {
           this.$message.success('更新成功')
           this.handleClose()
-          this.$emit('refresh', this.jsonKey)
+          this.$emit('refresh', this.jsonKey, pa)
         })
       }
       if (this.key) {

+ 19 - 40
src/views/ready/buildfloor/index.vue

@@ -4,23 +4,18 @@
       <div class="l-list">
         <div class="action-box">
           <div>
-            <el-button @click="addBuild" icon="el-icon-plus" size="small" type="default"/>
-            <el-button @click="delBuild" icon="el-icon-minus" size="small" type="default"
-                       :disabled="!buildList.length"/>
-            <el-button @click="editBuild" icon="el-icon-edit-outline" size="small" type="default"
-                       :disabled="!buildList.length"/>
+            <el-button @click="addBuild" icon="el-icon-plus" size="small" type="default" />
+            <el-button @click="delBuild" icon="el-icon-minus" size="small" type="default" :disabled="!buildList.length" />
+            <el-button @click="editBuild" icon="el-icon-edit-outline" size="small" type="default" :disabled="!buildList.length" />
           </div>
         </div>
         <h4>建筑</h4>
         <div class="build-list">
-          <div :class="{'floor-item':true,active:item.active}"
-               :key="item.id"
-               @click="changeBuild(index)"
-               style="cursor: pointer"
-               v-for="(item,index) in buildList">
+          <div :class="{'floor-item':true,active:item.active}" :key="item.id" @click="changeBuild(index)" style="cursor: pointer"
+            v-for="(item,index) in buildList">
             <span>
               {{ item.localName || item.name }}
-              <el-badge :value="item.count" class="mark" v-if="item.count>0"/>
+              <el-badge :value="item.count" class="mark" v-if="item.count>0" />
             </span>
           </div>
         </div>
@@ -31,8 +26,7 @@
           </el-button>
         </div>
         <div class="table-box">
-          <el-table :data="tableData" :header-cell-style="headerStyle" height="100%" style="width: 100%"
-                    v-loading="loading">
+          <el-table :data="tableData" :header-cell-style="headerStyle" height="100%" style="width: 100%" v-loading="loading">
             <el-table-column label="楼层本地名">
               <template slot-scope="scope">{{ scope.row.localName }}</template>
             </el-table-column>
@@ -48,31 +42,29 @@
               <template slot-scope="scope">
                 <p @click="checkDrawImg(scope.row,2)" v-if="scope.row.sign>0">
                   <el-badge is-dot>
-                    <i class="iconfont icon-floorplan"/>
+                    <i class="iconfont icon-floorplan" />
                   </el-badge>
                   平面图重复
                 </p>
-                <p @click="checkDrawImg(scope.row,1)"
-                   v-else-if="scope.row.infos?scope.row.infos.floorMap:false">
-                  <i class="iconfont icon-floorplan"/>
+                <p @click="checkDrawImg(scope.row,1)" v-else-if="scope.row.infos?scope.row.infos.floorMap:false">
+                  <i class="iconfont icon-floorplan" />
                   查看平面图
                 </p>
                 <p @click="checkDrawImg(scope.row,3)" v-else>
-                  <i class="iconfont icon-nopicture"/>
+                  <i class="iconfont icon-nopicture" />
                   暂无平面图
                 </p>
               </template>
             </el-table-column>
             <el-table-column label="楼层贯通关系" prop="SubTypeName">
               <template slot-scope="scope">
-                <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"/>
+                <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" />
               </template>
             </el-table-column>
             <el-table-column label="操作" prop="action">
               <template slot-scope="scope">
-                <el-button @click="handleDelete(scope.row)" icon="el-icon-delete" plain size="mini" type="danger"/>
+                <el-button @click="handleDelete(scope.row)" icon="el-icon-delete" plain size="mini" type="danger" />
               </template>
             </el-table-column>
           </el-table>
@@ -85,24 +77,11 @@
       </div>
     </el-row>
     <!-- 添加-修改楼层 -->
-    <addFloor :curBuildId="curBuildId" :curFloorId="curFloorId" :title="floorTitle" @refresh="refresh"
-              ref="addFloorDialog"/>
+    <addFloor :curBuildId="curBuildId" :curFloorId="curFloorId" :title="floorTitle" @refresh="refresh" ref="addFloorDialog" />
     <!-- 添加-修改建筑 :currentType="currentType"-->
-    <addBuild
-      :buildTitle="buildTitle"
-      ref="addBuildDialog"
-      :buildMessage="buildMessage"
-      @handleBuild="handleBuild"
-    />
+    <addBuild :buildTitle="buildTitle" ref="addBuildDialog" :buildMessage="buildMessage" @handleBuild="handleBuild" />
     <!-- 删除建筑-删除楼层 -->
-    <el-dialog
-      :visible.sync="delDialogVis"
-      @close="handleClose"
-      id="messageDialog"
-      title="提示"
-      width="20%"
-
-    >
+    <el-dialog :visible.sync="delDialogVis" @close="handleClose" id="messageDialog" title="提示" width="20%">
       <div>确定要删除该{{ delText }}?</div>
       <span class="dialog-footer" slot="footer">
         <el-button @click="delDialogVis=false" size="small">取消</el-button>
@@ -110,7 +89,7 @@
       </span>
     </el-dialog>
     <!-- 添加贯通关系弹窗 -->
-    <addConnectivity @refresh="refresh" ref="addConnectivity"/>
+    <addConnectivity @refresh="refresh" ref="addConnectivity" />
   </div>
 </template>
 
@@ -187,7 +166,7 @@ export default {
       buildingQueryAndCount(bdParam, res => {
         this.buildList = res.content;
         if (this.buildList.length) {
-          this.changeBuild(this.selectedBuildIndex);
+          this.changeBuild(this.selectedBuildIndex > this.buildList.length - 1 ? 0 : this.selectedBuildIndex);
         }
       });
     },

+ 47 - 26
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -4,7 +4,8 @@
     <div class='buttons'>
       <el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
       <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" :before-upload="beforeUpload">
+        <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1" accept=".jpg,.png"
+          :before-upload="beforeUpload">
           <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>
@@ -99,6 +100,7 @@ export default {
       scaleItem: null, // 比例尺item
       baseImgItem: null, // 当前楼层图的图片
       nextStepBtnDisable: true, // 比例尺item创建标识
+      timeOut: true, // 保存按钮延时3秒可操作
     }
   },
   created() {
@@ -115,13 +117,15 @@ export default {
       } else {
         this.init()
       }
+    } else {
+      this.init()
     }
     this.getCountModel()
     this.$nextTick(() => {
       this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
     })
   },
-  mounted() {},
+  mounted() { },
   methods: {
     init() {
       this.getFloorData()
@@ -140,7 +144,7 @@ export default {
     },
     // 替换模型文件
     changeGraphy() {
-      this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID })
+      this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID, CurrentModelId: this.currentModelId })
     },
     // 确认保存
     confirm() {
@@ -159,14 +163,16 @@ export default {
         Outline = this.$refs.drawFloor.drawMainScene.sceneMark.outLine
         Outline = Outline.map((t) => {
           return {
-            x: t.x.toFixed(2),
-            y: -t.y.toFixed(2),
+            X: t.x.toFixed(2),
+            Y: -t.y.toFixed(2),
           }
         })
       }
       let pa = {
-        content: [{ id: this.FloorID, outline: Outline }],
-        projection: ['outline'],
+        content: [{ id: this.FloorID, outline: Outline }]
+      }
+      if (!Outline) {
+        pa.nullItems = ['outline']
       }
       floorUpdateOutline(pa, (res) => {
         this.isEdit = false
@@ -183,12 +189,20 @@ export default {
       this.isEdit = true
     },
     // 替换模型文件成功
-    refresh(modelId) {
+    refresh(modelId,pa) {
       this.modelId = modelId
       this.hasGraph = true;
       const temp = this.modelId.split('.');
-      if (temp[1] && temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
+      if (temp[1]) {
+        if (temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
+          // do nothing
+        } else {
+          // do nothing
+        }
+      } else {
         this.key = '';
+        pa && pa.id && this.getFileName(pa.id)
+        this.initFromModelId(this.modelId)
       }
     },
     // 获取文件夹名称
@@ -221,6 +235,7 @@ export default {
         this.alreadyRelatedModel = res.content.map((t) => {
           if (t.id != this.FloorID) return t.modelId
           this.sign = t.Sign > 0
+          this.currentModelId = t.modelId;
           t.modelId && this.getFileName(t.modelId)
         }).filter((t) => t)
       })
@@ -230,7 +245,7 @@ export default {
     },
     // 统计项目下是否有模型文件
     getCountModel() {
-      countModel({Filters:"Status in [4]"}, res => {
+      countModel({ Filters: "Status in [4]" }, res => {
         this.hasModel = res.Count > 0
       })
     },
@@ -266,9 +281,11 @@ export default {
                 // 设置步骤为第一步
                 vm.step = 0;
                 // watch中不会走到initGraph,所以手动触发
-                vm.$nextTick(()=>{
+                vm.$nextTick(() => {
                   vm.initFromModelId(uploadKey + '.' + type)
                 })
+                // 设定保存按钮不可操作
+                this.timeOut = true;
               }
             }
           }
@@ -281,8 +298,8 @@ export default {
       // 拿到当前上传图片的name,判断其后缀名是否符合
       let type = this.isImage(file.name);
       if (!type) {
-          this.$message.error('仅支持png、jpg格式的图片');
-          return false
+        this.$message.error('仅支持png、jpg格式的图片');
+        return false
       }
       return true
     },
@@ -306,10 +323,10 @@ export default {
       let Param = {
         content: [{
           id: this.FloorID,
-          infos: { 
+          infos: {
             floorMap: this.key,
             floorMapRatio: proScale,
-            floorMapShift: JSON.stringify({x: this.baseImgItem.x, y: this.baseImgItem.y})
+            floorMapShift: JSON.stringify({ x: this.baseImgItem.x, y: this.baseImgItem.y })
           },
           properties: {
             line: line,
@@ -359,6 +376,10 @@ export default {
         this.$refs.drawFloor.scaleItem.hide();
         // 获取楼层列表
         this.getFloorData('next')
+        // 延时3秒可操作性保存按钮
+        setTimeout(() => {
+          this.timeOut = false
+        }, 3000)
       } else if (this.step == 1) {
         // 保存
         this.updateFloorKey();
@@ -394,7 +415,7 @@ export default {
       this.loadOtherImg(v)
     },
     // 加载其他楼层图片
-    loadOtherImg(v){
+    loadOtherImg(v) {
       if (v.infos && v.infos.floorMap) {
         const temp = this.modelId.split('.');
         if (temp[1] && (temp[1].toLowerCase() == 'png' || temp[1].toLowerCase() == 'jpg')) {
@@ -459,16 +480,16 @@ export default {
     }
   },
   watch: {
-    modelId(n, o) {
-      if (o && n != o) {
-        if (n) {
-          // 替换的时候需要走
-          this.$nextTick(()=>{
-            this.initFromModelId(n)
-          })
-        }
-      }
-    },
+    // modelId(n, o) {
+    //   if (o && n != o) {
+    //     if (n) {
+    //       // 替换的时候需要走
+    //       this.$nextTick(() => {
+    //         this.initFromModelId(n)
+    //       })
+    //     }
+    //   }
+    // },
   },
 }
 </script>