Bladeren bron

业务空间按钮逻辑修改

haojianlong 4 jaren geleden
bovenliggende
commit
bf5129a371

+ 9 - 0
src/utils/graph/FloorScene.ts

@@ -289,6 +289,15 @@ export class FloorScene extends SGraphScene {
     }
 
     /**
+     * 初始化墙颜色
+    */
+    initWallColor(): void {
+        this.wallList.forEach((t: SWallItem, i: number) => {
+            t.fillColor = ItemColor.wallColor;
+        })
+    }
+
+    /**
      * 清空业务空间
      */
     removeAllZone() {

+ 8 - 3
src/views/maintain/space/components/spaceGraph.vue

@@ -146,6 +146,7 @@ export default class spaceGraph extends Vue {
     noMap() {
         this.floorKey = "";
         this.canvasLoading = false;
+        this.$emit('initCreatBtn', true)
     }
     // 初始化
     init(initType: number): void {
@@ -153,11 +154,13 @@ export default class spaceGraph extends Vue {
         if (this.scene) {
             this.scene.selectContainer.clear();
             this.scene.initSpaceColor();
+            this.scene.initWallColor();
             this.scene.clearCut();
             this.scene.clearWalls();
             // this.zoneDisable = true;
             this.scene.isZoneSelectable = true;
             this.scene.isSpaceSelectable = false;
+            this.scene.isWallSelectable = false
         }
         if (
             this.buildFloor.indexOf("all") > -1 ||
@@ -165,7 +168,7 @@ export default class spaceGraph extends Vue {
         ) {
             return;
         }
-
+        this.$emit('initCreatBtn', false)
         if (initType == 1) {
             // 底图
             this.getGraph();
@@ -249,6 +252,7 @@ export default class spaceGraph extends Vue {
         if (this.scene) {
             this.scene.isSpaceSelectable = true;
             this.scene.isZoneSelectable = false;
+            this.scene.isWallSelectable = false
             this.scene.selectContainer.clear();
         }
         this.view?.update();
@@ -290,6 +294,7 @@ export default class spaceGraph extends Vue {
             if (this.scene) {
                 this.scene.isSpaceSelectable = false;
                 this.scene.isZoneSelectable = false;
+                this.scene.isWallSelectable = true
             }
         }
     }
@@ -302,6 +307,7 @@ export default class spaceGraph extends Vue {
         if (this.scene) {
             this.scene.isZoneSelectable = false;
             this.scene.isSpaceSelectable = true;
+            this.scene.isWallSelectable = false
             this.scene.selectContainer.clear();
         }
         this.type = 4;
@@ -475,8 +481,7 @@ export default class spaceGraph extends Vue {
      */
     saveMap() {
         if (this.scene) {
-            const json = this.scene.getMapObject();
-            console.log(json);
+            this.scene.generateFile(this.floorKey);
         }
     }
 

+ 30 - 8
src/views/maintain/space/index.vue

@@ -35,13 +35,16 @@
                                 </div>
                             </template>
                         </el-autocomplete>
-                        <el-dropdown split-button type="primary" @click="editGraphy" @command="handleCommand" style="float:right;">
-                            创建空间
-                            <el-dropdown-menu slot="dropdown">
-                                <!-- <el-dropdown-item command="groupCreateBSpace">批量创建业务空间</el-dropdown-item> -->
-                                <el-dropdown-item command="createWall">创建墙体</el-dropdown-item>
-                            </el-dropdown-menu>
-                        </el-dropdown>
+                        <div style="float:right;position: relative;">
+                            <div v-if="createDisable" class="createMask"></div>
+                            <el-dropdown split-button type="primary" @click="editGraphy" @command="handleCommand">
+                                创建空间
+                                <el-dropdown-menu slot="dropdown">
+                                    <!-- <el-dropdown-item command="groupCreateBSpace">批量创建业务空间</el-dropdown-item> -->
+                                    <el-dropdown-item command="createWall">创建墙体</el-dropdown-item>
+                                </el-dropdown-menu>
+                            </el-dropdown>
+                        </div>
                     </template>
                 </div>
                 <div v-if="activeName==='table'" v-loading="loading" style="height: calc(100% - 100px);padding: 0 12px">
@@ -62,7 +65,7 @@
                     </div>
                 </div>
                 <div class="graph" v-if="activeName==='picture'">
-                    <spaceGraph @getZoneSuc="getZoneSuc" ref="spaceGraph"/>
+                    <spaceGraph @getZoneSuc="getZoneSuc" @initCreatBtn="initCreatBtn" ref="spaceGraph"/>
                 </div>
             </div>
         </div>
@@ -166,6 +169,8 @@ export default class spaceIndex extends Vue {
     autoCompleteSearch = "";
     // 业务空间列表
     zoneList = []
+    // 禁用
+    createDisable = true
     // 项目id
     private get projectId(): string {
         return UserModule.projectId;
@@ -210,6 +215,7 @@ export default class spaceIndex extends Vue {
     // 创建空间
     editGraphy() {
         if(this.$refs.spaceGraph) {
+            this.createDisable = true
             this.$refs.spaceGraph.editGraphy()
         }
     }
@@ -217,10 +223,18 @@ export default class spaceIndex extends Vue {
     // 下拉菜单
     handleCommand(command: string) {
         if(this.$refs.spaceGraph) {
+            this.createDisable = true
             this.$refs.spaceGraph.handleCommand(command)
         }
     }
 
+    /**
+     * 初始化创建按钮
+    */
+    initCreatBtn(flag: boolean) {
+        this.createDisable = flag
+    }
+
     //查询统计数量
     dataCount() {
         queryCountSpace({}).then((res) => {
@@ -683,6 +697,14 @@ export default class spaceIndex extends Vue {
                 & > .item + .item {
                     margin-left: 16px;
                 }
+                .createMask{
+                    position: absolute;
+                    width: 100%;
+                    height: 100%;
+                    background: #ffffff80;
+                    cursor: not-allowed;
+                    z-index: 9;
+                }
             }
 
             .borderBottom {