Commit 1dd27aef authored by yf's avatar yf

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

parents 47211a5a 323b9202
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* 可正常分享和学习源码,不得用于违法犯罪活动,违者必究! * 可正常分享和学习源码,不得用于违法犯罪活动,违者必究!
* Copyright (c) 2020 陈尼克 all rights reserved. * Copyright (c) 2020 陈尼克 all rights reserved.
* 版权所有,侵权必究! * 版权所有,侵权必究!
* * 123
--> -->
<template> <template>
<div id="app"> <div id="app">
......
...@@ -63,6 +63,17 @@ ...@@ -63,6 +63,17 @@
@click="showPicker = true" @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>
<van-cell-group v-else> <van-cell-group v-else>
<van-field v-model="roomName" label="名称" placeholder="请输入名称" /> <van-field v-model="roomName" label="名称" placeholder="请输入名称" />
...@@ -71,9 +82,10 @@ ...@@ -71,9 +82,10 @@
<van-popup v-model="showPicker" round position="bottom"> <van-popup v-model="showPicker" round position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="columns" :columns="isRoom?roomArr:baseArr"
@cancel="showPicker = false" @cancel="showPicker = false"
@confirm="onConfirm" @confirm="onConfirm"
value-key="dictLabel"
/> />
</van-popup> </van-popup>
</div> </div>
...@@ -111,11 +123,14 @@ export default { ...@@ -111,11 +123,14 @@ export default {
showPicker: false, showPicker: false,
roomType:'', roomType:'',
roomName:'', roomName:'',
columns: ['办公', '餐饮', '住宅', '超市'], roomArr: [],
colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'], colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'],
isViews:false,// true:查看页面; false: 添加页面 isViews:false,// true:查看页面; false: 添加页面
showHeader:true, showHeader:true,
isRoom:true,//是否为添加房间 isRoom:true,//是否为添加房间
isBase:false,
baseName:'',
baseArr:[],
layoutData:[] layoutData:[]
} }
}, },
...@@ -253,6 +268,18 @@ export default { ...@@ -253,6 +268,18 @@ export default {
}).catch((err) => { }).catch((err) => {
console.log('err==>>',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 () { addItem () {
...@@ -269,6 +296,7 @@ export default { ...@@ -269,6 +296,7 @@ export default {
this.title = '创建房间' this.title = '创建房间'
this.isRoom = true this.isRoom = true
this.show = true this.show = true
this.isBase = false;
}, },
// 添加其他 // 添加其他
addOther(){ addOther(){
...@@ -280,7 +308,8 @@ export default { ...@@ -280,7 +308,8 @@ export default {
}) })
return return
} }
this.isRoom = false this.isRoom = false;
this.isBase = false;
this.roomType = '' this.roomType = ''
this.roomName = '' this.roomName = ''
this.title = '创建其他' this.title = '创建其他'
...@@ -313,7 +342,20 @@ export default { ...@@ -313,7 +342,20 @@ export default {
}, },
//添加基础设施 //添加基础设施
addBase(){ 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){ movedEvent(i, newX, newY){
...@@ -360,6 +402,7 @@ export default { ...@@ -360,6 +402,7 @@ export default {
}, },
//保存房间名称 //保存房间名称
saveRoomName(){ saveRoomName(){
if (this.roomName == '') { if (this.roomName == '') {
Toast.fail({ Toast.fail({
title: '提示', title: '提示',
...@@ -368,6 +411,9 @@ export default { ...@@ -368,6 +411,9 @@ export default {
}) })
return 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),
...@@ -376,7 +422,7 @@ export default { ...@@ -376,7 +422,7 @@ export default {
i: '', i: '',
name: this.roomName, name: this.roomName,
c: '#e6e5e5', c: '#e6e5e5',
type:this.isRoom ? this.roomType : 'thorough', type:this.isRoom ? this.roomType :(this.isBase? '基础设施':'thorough'),
isDraggable:true, isDraggable:true,
isResizable:true isResizable:true
} }
...@@ -386,7 +432,7 @@ export default { ...@@ -386,7 +432,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.isRoom ? this.roomType : '9999', roomType: this.isRoom ? this.roomType : (this.isBase? '基础设施':'9999'),
} }
postFun('/ledger/room/save', data).then((res) => { postFun('/ledger/room/save', data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
...@@ -404,7 +450,11 @@ export default { ...@@ -404,7 +450,11 @@ export default {
this.roomName = '' this.roomName = ''
}, },
onConfirm(value) { onConfirm(value) {
this.roomType = value; if(this.isRoom){
this.roomType = value.dictValue;
}else{
this.roomName = value.dictValue
}
this.showPicker = false; this.showPicker = false;
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment