gaosp
2024-03-08 8b887f86a35b9711135087c9fc54f85a6ebf50d5
src/container/Map/Map.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-05 23:47:53
 * @LastEditors: Sneed
 * @LastEditTime: 2024-02-05 16:57:29
 * @LastEditTime: 2024-03-08 09:11:52
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/Map/Map.vue
-->
<template>
@@ -66,15 +66,15 @@
            </span>
        </el-dialog>
        <el-dialog class="add-device" title="生成地图" top="94px" :close-on-click-modal="false" width="400px"
            :visible.sync="showMapSet" :show-close="false">
            :visible.sync="showMapSet" :show-close="true" @close="closeCreate">
            <div>
                <p>
                    <span>行数:</span>
                    <el-input style="width: 100px;" class="input" v-show="status !== 2" v-model="rows" />
                    <el-input style="width: 100px;" class="input" v-model="rows" />
                </p>
                <p style="margin-top: 20px;">
                    <span>列数:</span>
                    <el-input style="width: 100px;" class="input" v-show="status !== 2" v-model="cols" />
                    <el-input style="width: 100px;" class="input" v-model="cols" />
                </p>
            </div>
            <span slot="footer" class="dialog-footer">
@@ -142,6 +142,7 @@
    },
    data() {
        return {
            showMapSet: false,
            height: 0,
            plantName: '',
            rows: 20,
@@ -273,6 +274,14 @@
            this.$router.push({
                name: 'mapList'
            })
        },
        closeCreate () {
            if (!this.map) {
                this.$router.push({
                    name: 'mapList'
                })
            }
            this.showMapSet = false
        },
        addRow() {
            this.rows += 1
@@ -417,15 +426,31 @@
            // setShowMenu(false)
        },
        sign(type) {
            const { x, x1, y, y1 } = this.range
            for (var i = x; i <= x1; i++) {
                for (var j = y; j <= y1; j++) {
                    let arr = [...(this.map[i])]
                    arr[j].type = type
                    arr[j].id = undefined
                    this.$set(this.map, i, arr)
                }
            }
         //if(type == 2){//2:设备
            //console.log('hh',this);
            const { x, x1, y, y1 } = this.range
            for (var i = x; i <= x1; i++) {
               for (var j = y; j <= y1; j++) {
                  let arr = [...(this.map[i])]
                  if (type == 2 && (arr[j].colspan < 4 || arr[j].rowspan  <  4)) { //x1-x<3 || y1-y<3
                     return this.$message({
                        type: 'error',
                        message: '单元格较小,无法展示设备,请至少合并4行4列单元格'
                     })
                  }
                  arr[j].type = type
                  arr[j].id = undefined
                  this.$set(this.map, i, arr)
               }
            }
         //}
            this.showAction = false
            this.$forceUpdate()
        },
@@ -564,6 +589,7 @@
        position: relative;
        display: flex;
        flex-direction: column;
        background: rgba(0,0,0,.6);
    }
}