Commit 1dd27aef authored by yf's avatar yf
Browse files

Merge branch 'develop' of http://git.censoft.com.cn/rongtong/rongtong-app into dev-yf'

parents 47211a5a 323b9202
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 * 可正常分享和学习源码,不得用于违法犯罪活动,违者必究!
 * Copyright (c) 2020 陈尼克 all rights reserved.
 * 版权所有,侵权必究!
 *
 * 123
-->
<template>
  <div id="app">
+57 −7
Original line number Diff line number Diff line
@@ -63,6 +63,17 @@
                @click="showPicker = true"
                />
                
            </van-cell-group>
            <van-cell-group v-else-if="isBase">
               <van-field
                readonly
                clickable
                label="房间名称"
                :value="roomName"
                placeholder="选择房间名称"
                @click="showPicker = true"
                />
                
            </van-cell-group>
            <van-cell-group v-else>
                <van-field v-model="roomName" label="名称" placeholder="请输入名称" />
@@ -71,9 +82,10 @@
        <van-popup v-model="showPicker" round position="bottom">
            <van-picker
                show-toolbar
                :columns="columns"
                :columns="isRoom?roomArr:baseArr"
                @cancel="showPicker = false"
                @confirm="onConfirm"
                value-key="dictLabel"
            />
        </van-popup>
    </div>
@@ -111,11 +123,14 @@ export default {
            showPicker: false,
            roomType:'',
            roomName:'',
            columns: ['办公', '餐饮', '住宅', '超市'],
            roomArr: [],
            colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'],
            isViews:false,// true:查看页面;  false: 添加页面
            showHeader:true,
            isRoom:true,//是否为添加房间
            isBase:false,
            baseName:'',
            baseArr:[],
            layoutData:[]
        }
    },
@@ -253,6 +268,18 @@ export default {
            }).catch((err) => {
               console.log('err==>>',err)
            })

            getFun('/risk/plan/dict/data/list',{
                dictType:'risk_plan_room_type'
            }).then(res=>{
                this.roomArr = res.data
            })
             getFun('/risk/plan/dict/data/list',{
                dictType:'risk_plan_base_room'
            }).then(res=>{
                this.baseArr = res.data
            })

        },
        // 增加
        addItem () {
@@ -269,6 +296,7 @@ export default {
            this.title = '创建房间'
            this.isRoom = true
            this.show = true
            this.isBase = false;
        },
        // 添加其他
        addOther(){
@@ -280,7 +308,8 @@ export default {
                })
                return
            }
            this.isRoom = false
            this.isRoom = false;
            this.isBase = false;
            this.roomType = ''
            this.roomName = ''
            this.title = '创建其他'
@@ -313,7 +342,20 @@ export default {
        },
        //添加基础设施
        addBase(){

             if (this.layout.find((item) => item.i == '')) {
                Toast.fail({
                    title: '提示',
                    forbidClick: true,
                    message: '请先点击确定,保存当前房间信息',
                })
                return
            }
            this.roomType = ''
            this.roomName = ''
            this.title = '添加基础设备'
            this.isRoom = false;
            this.isBase = true;
            this.show = true
        },
        // 移动后的事件
        movedEvent(i, newX, newY){
@@ -360,6 +402,7 @@ export default {
        },
        //保存房间名称
        saveRoomName(){

            if (this.roomName == '') {
                 Toast.fail({
                    title: '提示',
@@ -368,6 +411,9 @@ export default {
                })
                return
            }



             this.layOutItem = {
                x: (this.layout.length * 2) % (this.colNum || 12),
                y: this.layout.length + (this.colNum/2 || 12),
@@ -376,7 +422,7 @@ export default {
                i: '',
                name: this.roomName,
                c: '#e6e5e5',
                type:this.isRoom ? this.roomType : 'thorough',
                type:this.isRoom ? this.roomType :(this.isBase? '基础设施':'thorough'),
                isDraggable:true,
                isResizable:true
            }
@@ -386,7 +432,7 @@ export default {
                floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
                name:this.roomName,
                position: JSON.stringify(this.layOutItem),
                roomType: this.isRoom ? this.roomType : '9999',
                roomType: this.isRoom ? this.roomType : (this.isBase? '基础设施':'9999'),
            }
            postFun('/ledger/room/save', data).then((res) => {
                if (res.code == 200) {
@@ -404,7 +450,11 @@ export default {
            this.roomName = ''
        },
        onConfirm(value) {
            this.roomType = value;
            if(this.isRoom){
                this.roomType = value.dictValue;
            }else{
                this.roomName = value.dictValue
            }
            this.showPicker = false;
        },
    }