Commit f732634b authored by dlkong's avatar dlkong
Browse files

四色图修改

parent 16dc1cc0
Loading
Loading
Loading
Loading
+62 −27
Original line number Original line Diff line number Diff line
@@ -28,14 +28,15 @@
                       :isResizable="item.isResizable"
                       :isResizable="item.isResizable"
                       @resized="resizedEvent"
                       @resized="resizedEvent"
                       @moved="movedEvent"
                       @moved="movedEvent"
                       :style="{'backgroundColor':item.c,}"
                       :style="{'backgroundColor':item.c,'border':(item.type == 'thorough'? 'none !important':'')}"
            >
            >
                <span class="text">{{item.name}}</span>
                <span class="text" :class="item.w>(item.h*5) ? '': 'rowText'">{{item.name}}</span>
                <span class="remove" @click="removeItem(item.i)" v-if="!item.i">x</span>
                <span class="remove" @click="removeItem(item.i)" v-if="!item.i">x</span>
            </grid-item>
            </grid-item>
        </grid-layout>
        </grid-layout>
        <div class="setBtns">
        <div class="setBtns">
            <van-button @click="addItem" type="info" size="mini" v-if="!isViews">添加房间</van-button>
            <van-button @click="addItem" type="info" size="mini" v-if="!isViews">添加房间</van-button>
            <van-button @click="addOther" type="info" size="mini" v-if="!isViews">添加其他</van-button>
            <van-grid direction="horizontal" :column-num="2" class="footer" v-if="isViews">
            <van-grid direction="horizontal" :column-num="2" class="footer" v-if="isViews">
                风险等级图例:
                风险等级图例:
                <span class="riskTab type1"></span>重大风险
                <span class="riskTab type1"></span>重大风险
@@ -44,8 +45,8 @@
                <span class="riskTab type4"></span>较小风险
                <span class="riskTab type4"></span>较小风险
            </van-grid>
            </van-grid>
        </div>
        </div>
        <van-dialog v-model="show" title="创建房间" show-cancel-button @confirm="saveRoomName" @close = "closeDialog">
        <van-dialog v-model="show" :title="title" show-cancel-button @confirm="saveRoomName" @cancel = "cancelDialog">
            <van-cell-group>
            <van-cell-group v-if="isRoom">
               <van-field v-model="roomName" label="房间名称" placeholder="请输入房间名称" />
               <van-field v-model="roomName" label="房间名称" placeholder="请输入房间名称" />
               <van-field
               <van-field
                readonly
                readonly
@@ -57,6 +58,9 @@
                />
                />
                
                
            </van-cell-group>
            </van-cell-group>
            <van-cell-group v-else>
                <van-field v-model="roomName" label="名称" placeholder="请输入名称" />
            </van-cell-group>
        </van-dialog>
        </van-dialog>
        <van-popup v-model="showPicker" round position="bottom">
        <van-popup v-model="showPicker" round position="bottom">
            <van-picker
            <van-picker
@@ -94,16 +98,18 @@ export default {
            draggable: false,
            draggable: false,
            resizable: true,
            resizable: true,
            colNum: 12,
            colNum: 12,
            isScreenFull :null,
            // isScreenFull :null,
            layOutItem:{},//新增的房间对象
            layOutItem:{},//新增的房间对象
            show:false,
            show:false,
            title:'',
            showPicker: false,
            showPicker: false,
            roomType:'',
            roomType:'',
            roomName:'',
            roomName:'',
            columns: ['办公', '餐饮', '住宅', '超市'],
            columns: ['办公', '餐饮', '住宅', '超市'],
            colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'],
            colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'],
            isViews:false,// true:查看页面;  false: 添加页面
            isViews:false,// true:查看页面;  false: 添加页面
            showHeader:true
            showHeader:true,
            isRoom:true,//是否为添加房间
        }
        }
    },
    },
    props:{
    props:{
@@ -160,7 +166,7 @@ export default {
                wrapper.style.cssText = style;
                wrapper.style.cssText = style;
        },
        },
        rotateBox() {
        rotateBox() {
            this.isScreenFull = !this.isScreenFull;//是否全屏状态
            // this.isScreenFull = !this.isScreenFull;//是否全屏状态
            let width = document.documentElement.clientWidth,//页面宽度
            let width = document.documentElement.clientWidth,//页面宽度
                height = document.documentElement.clientHeight,//页面高度
                height = document.documentElement.clientHeight,//页面高度
                wrapper = this.$refs.mapmidbox,//需要横屏的块,与全屏的块要区分开,不区分全屏的块无法显示横屏效果
                wrapper = this.$refs.mapmidbox,//需要横屏的块,与全屏的块要区分开,不区分全屏的块无法显示横屏效果
@@ -209,8 +215,8 @@ export default {
                   item.position.i = item.id
                   item.position.i = item.id
                   item.position.isDraggable = false
                   item.position.isDraggable = false
                   item.position.isResizable = false
                   item.position.isResizable = false
                   if (!this.isViews) { //添加页面不显示颜色
                   if (!this.isViews || item.position.type == 'thorough') { //添加页面不显示颜色
                        item.position.c = '#eee'
                        item.position.c = '#e6e5e5'
                    }else{
                    }else{
                        item.position.c = this.colorList[Math.floor(Math.random()*4)]
                        item.position.c = this.colorList[Math.floor(Math.random()*4)]
                    }
                    }
@@ -223,21 +229,39 @@ export default {
            })
            })
        },
        },
        // 增加
        // 增加
        addItem: function () {
        addItem () {
            if (this.layout.find((item) => item.i == '')) {
                Toast.fail({
                    title: '提示',
                    forbidClick: true,
                    message: '请先点击确定,保存当前房间信息',
                })
                return
            }
            this.roomType = ''
            this.roomName = ''
            this.title = '创建房间'
            this.isRoom = true
            this.show = true
        },
        // 添加其他
        addOther(){
            if (this.layout.find((item) => item.i == '')) {
            if (this.layout.find((item) => item.i == '')) {
                Toast.fail({
                Toast.fail({
                    title: '提示',
                    title: '提示',
                    forbidClick: true,
                    forbidClick: true,
                    message: '一次只能增加一个房间',
                    message: '请先点击确定,保存当前房间信息',
                })
                })
                return
                return
            }
            }
            this.isRoom = false
            this.roomType = ''
            this.roomType = ''
            this.roomName = ''
            this.roomName = ''
            this.title = '创建其他'
            this.show = true
            this.show = true
        },
        },
        // 删除
        // 删除
        removeItem: function (val) {
        removeItem (val) {
            if (val == '') {
            if (val == '') {
                const index = this.layout.map(item => item.i).indexOf(val);
                const index = this.layout.map(item => item.i).indexOf(val);
                this.layout.splice(index, 1);
                this.layout.splice(index, 1);
@@ -282,7 +306,7 @@ export default {
                floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
                floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
                name:this.roomName,
                name:this.roomName,
                position: JSON.stringify(this.layOutItem),
                position: JSON.stringify(this.layOutItem),
                roomType: this.roomType
                roomType: this.isRoom ? this.roomType : '9999',
            }
            }
            postFun('/ledger/room/save', data).then((res) => {
            postFun('/ledger/room/save', data).then((res) => {
                if (res.code == 200) {
                if (res.code == 200) {
@@ -297,6 +321,14 @@ export default {
        },
        },
        //保存房间名称
        //保存房间名称
        saveRoomName(){
        saveRoomName(){
            if (this.roomName == '') {
                 Toast.fail({
                    title: '提示',
                    forbidClick: true,
                    message: '请输入名称!',
                })
                return
            }
             this.layOutItem = {
             this.layOutItem = {
                x: (this.layout.length * 2) % (this.colNum || 12),
                x: (this.layout.length * 2) % (this.colNum || 12),
                y: this.layout.length + (this.colNum/2 || 12),
                y: this.layout.length + (this.colNum/2 || 12),
@@ -305,14 +337,14 @@ export default {
                i: '',
                i: '',
                name: this.roomName,
                name: this.roomName,
                c: '#0091EA',
                c: '#0091EA',
                type:this.roomType,
                type:this.isRoom ? this.roomType : 'thorough',
                isDraggable:true,
                isDraggable:true,
                isResizable:true
                isResizable:true
            }
            }
            this.layout.push(this.layOutItem)
            this.layout.push(this.layOutItem)
            // console.log('layOutItem==>>',this.layOutItem)
            console.log('layOutItem==>>',this.layOutItem)
        },
        },
        closeDialog(){
        cancelDialog(){
            this.roomType = ''
            this.roomType = ''
            this.roomName = ''
            this.roomName = ''
        },
        },
@@ -329,10 +361,8 @@ export default {
    padding-bottom: 0px !important;
    padding-bottom: 0px !important;
}
}
.wrap{
.wrap{
    height: 100vh;
    /* height: 100vh; */
    width: 100vw;
    width: 100vw;
    /* transform: rotate(90deg);
   transform-origin: bottom left; */
   position: relative;
   position: relative;
}
}
.footer{
.footer{
@@ -386,7 +416,7 @@ export default {
    vertical-align: middle;
    vertical-align: middle;
    display: flex;
    display: flex;
    align-items: flex-start;
    align-items: flex-start;
    flex-direction: column;
    /* flex-direction: column; */
}
}
.setBtns .van-button--mini{
.setBtns .van-button--mini{
    padding: 0 10px;
    padding: 0 10px;
@@ -397,11 +427,15 @@ export default {
    top: 0;
    top: 0;
    cursor: pointer;
    cursor: pointer;
}
}
::v-deep .van-dialog__header{
    padding-top: 15px !important;
    padding-bottom: 15px !important;
}
.vue-grid-item {
.vue-grid-item {
    -ms-touch-action: none;
    -ms-touch-action: none;
    touch-action: none;
    touch-action: none;
    box-sizing: border-box;
    box-sizing: border-box;
    container-type: inline-size;
    /* container-type: inline-size; */
}
}
.vue-grid-layout {
.vue-grid-layout {
    background: #f0f1f5;
    background: #f0f1f5;
@@ -421,22 +455,23 @@ export default {
}
}


.vue-grid-item .text {
.vue-grid-item .text {
    writing-mode:vertical-rl;
    /* font-size: 6cqw; */
    -webkit-writing-mode: vertical-rl;
    font-size: 10cqw;
    display: flex;
    display: flex;
    align-items: center;
    align-items: center;
    justify-content: center;
    justify-content: center;
    position: absolute;
    /* position: absolute;
    top: 0;
    top: 0;
    bottom: 0;
    bottom: 0;
    left: 0;
    left: 0;
    right: 0;
    right: 0; */
    margin: auto;
    margin: auto;
    height: 100%;
    height: 100%;
    width: 100%;
    width: 100%;
}
}

.rowText{
    writing-mode:vertical-rl;
    -webkit-writing-mode: vertical-rl;
}
.vue-grid-item .no-drag {
.vue-grid-item .no-drag {
    height: 100%;
    height: 100%;
    width: 100%;
    width: 100%;
+2 −2
Original line number Original line Diff line number Diff line
@@ -129,13 +129,13 @@ export default {


<style scoped>
<style scoped>
.wrap {
.wrap {
  height: 100vh;
  /* height: 100vh; */
  width: 100vw;
  width: 100vw;
}
}


.section {
.section {
  width: 100%;
  width: 100%;
  height: 100%;
  /* height: 100%; */
  overflow-y: auto;
  overflow-y: auto;
}
}
.quolist{
.quolist{