瀏覽代碼

修改路由传参布尔转字符串bug

haojianlong 4 年之前
父節點
當前提交
6293eb3474
共有 1 個文件被更改,包括 14 次插入10 次删除
  1. 14 10
      src/views/ledger/cenotelist/relatedSpace.vue

+ 14 - 10
src/views/ledger/cenotelist/relatedSpace.vue

@@ -3,7 +3,7 @@
     <div class="condition">
       <div class="header">
         <el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goBack"></el-button>
-        <div class="edit-tool" v-if="!cenoteObj.onlyRead">
+        <div class="edit-tool" v-if="!(cenoteObj.onlyRead == 'true')">
           <el-button v-if="isMyTab == 2" size="small" style="float:right" @click="dialogVisible = true">添加</el-button>
           <div v-else>
             <el-button v-show="!isEdit" @click="changeEditType" size="small" style="float:right">编辑</el-button>
@@ -33,7 +33,7 @@
               :value="item.BuildID"></el-option>
           </el-select>
         </el-badge>
-        <el-switch v-if="!cenoteObj.onlyRead" style="margin-left:15px;" v-model="isAI" @change="handleChangeAI" active-text="打开AI">
+        <el-switch v-if="!(cenoteObj.onlyRead == 'true')" style="margin-left:15px;" v-model="isAI" @change="handleChangeAI" active-text="打开AI">
         </el-switch>
         <div style="height:calc(100% - 42px);margin:10px 0 0 0;width:100%;">
           <el-row style="height:100%;margin:0;width:55%;position:relative;display:inline-block;border:1px solid #e4e4e4;">
@@ -53,7 +53,7 @@
             </el-col>
           </el-row>
           <div class="elevation-box">
-            <elevation-map ref="elevationMap" :onlyRead="cenoteObj.onlyRead" :isEdit="isEdit" :isAI="isAI" @elevationChecked="handleCheckedSpace"
+            <elevation-map ref="elevationMap" :onlyRead="cenoteObj.onlyRead=='true'" :isEdit="isEdit" :isAI="isAI" @elevationChecked="handleCheckedSpace"
               @elevationUncheck="handleUncheckSpace" :params="{BuildingId: building, ObjectType: ObjectType, ShaftId: $route.query.ShaftId}">
             </elevation-map>
           </div>
@@ -103,10 +103,10 @@ export default {
       return this.$route.query;
     },
     showSpaceDot() {
-      return this.spaceList.length > 1 && this.cenoteObj.onlyRead ? true : false;
+      return this.spaceList.length > 1 && this.cenoteObj.onlyRead == 'true' ? true : false;
     },
     showBuildDot() {
-      return this.buildingList.length > 1 && this.cenoteObj.onlyRead ? true : false;
+      return this.buildingList.length > 1 && this.cenoteObj.onlyRead == 'true' ? true : false;
     },
     ...mapGetters("layout", ["projectId"])
   },
@@ -121,13 +121,13 @@ export default {
     elevationMap
   },
   created() {
-    this.isAI = this.$route.query.onlyRead ? false : true;
+    this.isAI = this.$route.query.onlyRead == "true" ? false : true;
     this.getSpaceData();
   },
   methods: {
     //获取空间信息
     getSpaceData() {
-      if (this.cenoteObj.onlyRead) {
+      if (this.cenoteObj.onlyRead == 'true') {
         let pa = {
           shaftId: this.$route.query.ShaftId
         }
@@ -158,7 +158,11 @@ export default {
             }
             return t;
           });
-          this.space = [val2.Content[0].ObjectType];
+          if (val2.Content.length) {
+            this.space = [val2.Content[0].ObjectType];
+          } else {
+            this.space = this.spaceList.find((item) => { return item.Code == "GeneralZone" }) ? ["GeneralZone"] : [this.spaceList[0].Code];
+          }
           this.ObjectType = this.space[0];
           //加载楼层信息
           this.loadBuildingData();
@@ -167,7 +171,7 @@ export default {
     },
     //默认显示默认分区,无默认分区显示第一个分区
     showDefaultSpace() {
-      if (this.spaceList.length && this.cenoteObj.onlyRead) {
+      if (this.spaceList.length && this.cenoteObj.onlyRead == "true") {
         this.space = this.spaceList.find((item) => { return item.Code == "GeneralZone" }) ? ["GeneralZone"] : [this.spaceList[0].Code];
         this.ObjectType = this.space[0];
       }
@@ -182,7 +186,7 @@ export default {
     },
     //获取楼层信息
     loadBuildingData() {
-      if (this.cenoteObj.onlyRead) {
+      if (this.cenoteObj.onlyRead == 'true') {
         let param = {
           ShaftId: this.$route.query.ShaftId,
           ObjectType: this.ObjectType