parent
38a5653185
commit
ad3410cb7a
@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<navigation-general :title="title">
|
||||
<view class="building-list" :style="{height: `calc(100% - ${boxTop}rpx)`}">
|
||||
|
||||
<view class="house">
|
||||
<view class="house-list">
|
||||
<view class="house-rows" v-for="(item,index) in groupedRooms" :key="index">
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<view class="floor-item">{{buildingInfo.floor - index}}</view>
|
||||
<!-- <color-item :item="house" v-for="house in item" :key="house.id"
|
||||
:showColorName="false"></color-item> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="house-unit"></view>
|
||||
</view>
|
||||
</view>
|
||||
</navigation-general>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getBuilding,
|
||||
} from '@/api/taicangpop/building'
|
||||
import {
|
||||
handleColor
|
||||
} from '@/utils/handlerColor.js'
|
||||
import {
|
||||
getNumNew
|
||||
} from '@/api/taicangpop/data'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
boxTop: 0,
|
||||
queryParams: {
|
||||
buildingId: undefined
|
||||
},
|
||||
title: '',
|
||||
buildingInfo: {},
|
||||
newHouseList: [],
|
||||
totalHouse: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
groupedRooms() {
|
||||
if (this.newHouseList.length == 0) return
|
||||
|
||||
// 初始化每层楼的数组
|
||||
let floors = Array.from({
|
||||
length: this.buildingInfo.floor
|
||||
}, () => [])
|
||||
// 遍历房间数据
|
||||
this.newHouseList.forEach((room) => {
|
||||
// 提取房间号前几位作为楼层号
|
||||
let floor = (parseInt(room.name) / 100) | 0
|
||||
// 将房间加入对应楼层数组
|
||||
if (floor > 0 && floor <= this.buildingInfo.floor) {
|
||||
floors[floor - 1].push(handleColor(room))
|
||||
}
|
||||
})
|
||||
|
||||
// 对每层楼的房间进行排序
|
||||
floors.forEach((floorRooms) => {
|
||||
floorRooms.sort((a, b) => parseInt(a.name) - parseInt(b.name))
|
||||
})
|
||||
uni.hideLoading()
|
||||
return floors.reverse()
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
const systemData = this.$u.sys()
|
||||
this.boxTop = (systemData.statusBarHeight + 44) * 2
|
||||
this.title = option.deptname
|
||||
this.queryParams.buildingId = option.buildingId
|
||||
this.getBuildingInfo()
|
||||
|
||||
},
|
||||
methods: {
|
||||
//楼信息
|
||||
async getBuildingInfo() {
|
||||
const res = await getBuilding(this.queryParams.buildingId)
|
||||
this.buildingInfo = res.data
|
||||
this.getAllHouse()
|
||||
},
|
||||
//获取所有的户
|
||||
async getAllHouse() {
|
||||
// uni.showLoading({
|
||||
// title: '加载中'
|
||||
// })
|
||||
let res = await getNumNew({
|
||||
buildingId: this.queryParams.buildingId
|
||||
})
|
||||
this.newHouseList = res.data
|
||||
this.totalHouse = this.newHouseList.length
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
height: 100%;
|
||||
background: #113666;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.building-list {
|
||||
width: 1000px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
|
||||
.house {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid red;
|
||||
|
||||
.house-list {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.house-rows {
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.floor-item {
|
||||
height: 100%;
|
||||
width: 80rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #409eff;
|
||||
}
|
||||
|
||||
&>view {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue