Commit d7a95d2f authored by yf's avatar yf

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

parents e6a7bb9b a41fc83c
......@@ -8,6 +8,9 @@
<span class="iconRight" v-show="isViews"></span>
</header>
</van-sticky>
<div class="north">
<img src="../../assets/imgs/north.png" alt="">
</div>
<grid-layout :layout.sync="layout"
:col-num="colNum"
:row-height="30"
......@@ -16,7 +19,7 @@
:prevent-collision="false"
:preventCollision="true"
>
<grid-item v-for="item in layout"
<grid-item v-for="(item) in layout"
:static="item.static"
:x="item.x"
:y="item.y"
......@@ -31,12 +34,15 @@
:style="{'backgroundColor':item.c,'border':(item.type == 'thorough'? 'none !important':'')}"
>
<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="showHeader">x</span>
<!-- <span class="remove" @click="removeItem(item.i)" v-if="item.i && isEdit">x</span> -->
</grid-item>
</grid-layout>
<div class="setBtns">
<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-button @click="addBase" type="info" size="mini" v-if="!isViews">添加基础设施</van-button>
<!-- <van-button @click="editItem" type="info" size="mini" v-if="!isViews">修改</van-button> -->
<van-grid direction="horizontal" :column-num="2" class="footer" v-if="isViews">
风险等级图例:
<span class="riskTab type1"></span>重大风险
......@@ -110,6 +116,7 @@ export default {
isViews:false,// true:查看页面; false: 添加页面
showHeader:true,
isRoom:true,//是否为添加房间
layoutData:[]
}
},
props:{
......@@ -123,6 +130,7 @@ export default {
// this.$nextTick(() => {
// this.rotateBox();
// });
console.log('floorId==>>',this.$route.params.floorId )
if (this._props.isView) {
console.log('作为组件传值==>>',)
this.isViews = true
......@@ -210,11 +218,15 @@ export default {
getFun('/ledger/room/list',data).then((res) => {
if (res.code == 200) {
this.layout = []
res.rows.forEach((item) => {
this.layoutData = res.data
res.data.forEach((item) => {
item.position = JSON.parse(item.position)
item.position.i = item.id
item.position.isDraggable = false
item.position.isResizable = false
item.position.id = item.id
if (!this.showHeader) {
item.position.isDraggable = false
item.position.isResizable = false
}
if (!this.isViews || item.position.type == 'thorough') { //添加页面不显示颜色
item.position.c = '#e6e5e5'
}else{
......@@ -281,53 +293,66 @@ export default {
this.layout.splice(index, 1);
return
}
postFun('/ledger/room/delete/'+val).then((res) => {
if (res.code == 200) {
Toast.success('删除成功');
this.getRoomInfo()
}
}).catch((err) => {
console.log('err==>>',err)
this.$dialog.confirm({
title: '提示',
message: '是否删除',
})
.then(() => {
postFun('/ledger/room/delete/'+val).then((res) => {
if (res.code == 200) {
Toast.success('删除成功');
this.getRoomInfo()
}
}).catch((err) => {
console.log('err==>>',err)
})
})
.catch(() => {
// on cancel
});
},
//添加基础设施
addBase(){
},
// 移动后的事件
movedEvent(i, newX, newY){
this.layOutItem.x = newX
this.layOutItem.y = newY
console.log('layOutItem==>>',this.layOutItem)
// console.log('layOutItem==>>',this.layOutItem)
// console.log('this.layout==>>',this.layout)
},
// 调整大小后的事件
resizedEvent: function(i, newH, newW){
this.layOutItem.w = newW
this.layOutItem.h = newH
console.log('layOutItem==>>',this.layOutItem)
// console.log('layOutItem==>>',this.layOutItem)
// console.log('this.layout==>>',this.layout)
},
//关闭
close(){
history.go(-1)
},
// 确定 保存房间信息
//edger/room/update/batch
// 确定 执行批量编辑保存
confim(){
if (this.roomName == '') {
Toast.fail({
title: '提示',
forbidClick: true,
message: '请先添加房间!',
})
return
}
let data = {
floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
name:this.roomName,
position: JSON.stringify(this.layOutItem),
roomType: this.isRoom ? this.roomType : '9999',
}
postFun('/ledger/room/save', data).then((res) => {
// if (this.roomName == '') {
// Toast.fail({
// title: '提示',
// forbidClick: true,
// message: '请先添加房间!',
// })
// return
// }
let data = this.layoutData
this.layoutData.forEach((item) => {
item.position = JSON.stringify(item.position)
})
console.log('data==>>',data)
postFun('/ledger/room/update/batch', data).then((res) => {
if (res.code == 200) {
Toast.success('提交成功');
Toast.success('保存成功');
this.getRoomInfo()
this.roomType = ''
this.roomName = ''
}
}).catch((err) => {
console.log('err==>>',err)
......@@ -350,13 +375,29 @@ export default {
h: 3,
i: '',
name: this.roomName,
c: '#0091EA',
c: '#e6e5e5',
type:this.isRoom ? this.roomType : 'thorough',
isDraggable:true,
isResizable:true
}
this.layout.push(this.layOutItem)
console.log('layOutItem==>>',this.layOutItem)
// console.log('layOutItem==>>',this.layOutItem)
let data = {
floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
name:this.roomName,
position: JSON.stringify(this.layOutItem),
roomType: this.isRoom ? this.roomType : '9999',
}
postFun('/ledger/room/save', data).then((res) => {
if (res.code == 200) {
// Toast.success('保存成功');
this.getRoomInfo()
this.roomType = ''
this.roomName = ''
}
}).catch((err) => {
console.log('err==>>',err)
})
},
cancelDialog(){
this.roomType = ''
......@@ -379,6 +420,17 @@ export default {
width: 100vw;
position: relative;
}
.north{
position: absolute;
display: inline-block;
top: 1.5rem;
right: 0.5rem;
z-index: 999;
}
.north img{
width: 15px;
height: 30px;
}
.footer{
/* position: fixed; */
/* left: 0; */
......
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