|
|
|
@ -10,16 +10,22 @@
|
|
|
|
|
{{ info.floor - index }} 层
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="building-house-container">
|
|
|
|
|
<div
|
|
|
|
|
ref="build"
|
|
|
|
|
class="building-house-container"
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
|
|
element-loading-text="加载中"
|
|
|
|
|
>
|
|
|
|
|
<div class="building-name">{{ info.deptname }}{{ info.name }}</div>
|
|
|
|
|
<div class="house" v-for="(item, index) in groupedRooms" :key="index">
|
|
|
|
|
<colorCell
|
|
|
|
|
:active="currentIndex == house.keyId ? 'activeCell' : ''"
|
|
|
|
|
:active="currentIndex == house.id ? 'activeCell' : ''"
|
|
|
|
|
:isClcik="true"
|
|
|
|
|
:item="house"
|
|
|
|
|
v-for="(house, houseIndex) in item"
|
|
|
|
|
:key="houseIndex"
|
|
|
|
|
@clickHouse="clickHouse(house, house.keyId)"
|
|
|
|
|
@clickHouse="clickHouse(house, house.id)"
|
|
|
|
|
></colorCell>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -36,6 +42,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
loading: true,
|
|
|
|
|
show: false,
|
|
|
|
|
info: {},
|
|
|
|
|
list: [],
|
|
|
|
@ -48,9 +55,11 @@ export default {
|
|
|
|
|
"leftColor",
|
|
|
|
|
"rightTopColor",
|
|
|
|
|
"houseItem",
|
|
|
|
|
"refreshBuild",
|
|
|
|
|
]),
|
|
|
|
|
groupedRooms() {
|
|
|
|
|
console.log(this.list.length, "总房屋数");
|
|
|
|
|
if (this.list.length == 0) return;
|
|
|
|
|
|
|
|
|
|
if (this.info.deptname == "嘉华园") {
|
|
|
|
|
// 对房间数据进行排序
|
|
|
|
|
const sortedRooms = this.list.sort((a, b) => {
|
|
|
|
@ -83,7 +92,7 @@ export default {
|
|
|
|
|
floors.forEach((floorRooms) => {
|
|
|
|
|
floorRooms.sort((a, b) => parseInt(a.name) - parseInt(b.name));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// console.log(floors);
|
|
|
|
|
return floors.reverse();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -94,6 +103,7 @@ export default {
|
|
|
|
|
watch: {
|
|
|
|
|
"queryParamsXiaoqu.buildingId"(newValue, oldValue) {
|
|
|
|
|
if (newValue) {
|
|
|
|
|
this.show = true;
|
|
|
|
|
this.getBuildingInfo();
|
|
|
|
|
this.getBuildingList();
|
|
|
|
|
} else {
|
|
|
|
@ -104,6 +114,11 @@ export default {
|
|
|
|
|
"houseItem.id"(newValue, oldValue) {
|
|
|
|
|
if (!newValue) this.currentIndex = 0;
|
|
|
|
|
},
|
|
|
|
|
refreshBuild(newValue, oldValue) {
|
|
|
|
|
if (newValue > 1) {
|
|
|
|
|
this.getBuildingList();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {},
|
|
|
|
|
methods: {
|
|
|
|
@ -123,14 +138,7 @@ export default {
|
|
|
|
|
? this.houseItem.buildingWidth
|
|
|
|
|
: window.innerWidth - this.$refs.houseItem.offsetWidth,
|
|
|
|
|
name: item.name,
|
|
|
|
|
// color: item.color,
|
|
|
|
|
// isD: item.is_d,
|
|
|
|
|
// isJ: item.is_j,
|
|
|
|
|
// isK: item.is_k,
|
|
|
|
|
// isx: item.is_x,
|
|
|
|
|
// typename: item.typename,
|
|
|
|
|
// leftColor: item.leftColor,
|
|
|
|
|
// rightTopColor: item.rightTopColor,
|
|
|
|
|
keyId: keyId,
|
|
|
|
|
});
|
|
|
|
|
this.currentIndex = keyId;
|
|
|
|
|
},
|
|
|
|
@ -139,19 +147,17 @@ export default {
|
|
|
|
|
this.info = info.data;
|
|
|
|
|
},
|
|
|
|
|
async getBuildingList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.$refs.build.scrollIntoView({
|
|
|
|
|
behavior: "smooth", // 平滑滚动
|
|
|
|
|
});
|
|
|
|
|
let res = await getNum({
|
|
|
|
|
buildingId: this.queryParamsXiaoqu.buildingId,
|
|
|
|
|
});
|
|
|
|
|
this.currentIndex = this.houseItem.keyId;
|
|
|
|
|
this.list = res.data;
|
|
|
|
|
|
|
|
|
|
this.show = true;
|
|
|
|
|
|
|
|
|
|
// this.list = this.groupedRooms(res.data);
|
|
|
|
|
// let num = 0;
|
|
|
|
|
// this.list.forEach((item) => {
|
|
|
|
|
// num = num + item.length;
|
|
|
|
|
// });
|
|
|
|
|
// console.log(num, res.data.length);
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.$store.commit("SET_REFRESH", 1);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 颜色处理
|
|
|
|
|