Browse Source

调用楼栋接口

V1.0
SongZhen 2 years ago
parent
commit
92186cbf64
  1. 118
      src/views/dataBoard/cpts/homeDetails/index.vue

118
src/views/dataBoard/cpts/homeDetails/index.vue

@ -12,6 +12,9 @@
}, },
]" /> ]" />
</div> </div>
<div class="top-nav-list">
<div v-for="item in buildingList" :key="item.id" :class="[item.ifActive ? 'top-nav-itemAC' : 'top-nav-item']" @click="chooseNav(item)">{{ item.buildingName }}{{ item.unitName }}</div>
</div>
<el-row :gutter="48"> <el-row :gutter="48">
<el-col :span="8"> <el-col :span="8">
<div class="bg"> <div class="bg">
@ -104,6 +107,7 @@ export default {
homeMsg: {}, homeMsg: {},
list: [], list: [],
homeText: "", homeText: "",
buildingList: [],
houseMountArr: [], houseMountArr: [],
}; };
}, },
@ -150,36 +154,50 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
const homeType = this.$route.query.type; const homeType = this.$route.query.type;
// if (homeType === "building") { if (homeType === "building") {
// this.$http.get(`/actual/base/streetOverview/getUnitHouseOverviewList?unitId=` + this.$route.query.id).then((res) => { this.$http.get(`/actual/base/streetOverview/getUnitListByBuilding?buildingId=` + "1514914015259979777").then((res) => {
// console.log(res); const { code, data } = res.data;
// }); if (code === 0) {
// } else { this.buildingList = data;
this.$http.get(`/actual/base/streetOverview/getUnitHouseList?unitId=` + this.$route.query.id).then((res) => { this.homeText = this.buildingList[0].buildingName + this.buildingList[0].unitName;
const { this.buildingList.forEach((item, i) => {
code, if (i === 0) {
data: { houseList, unitInfo }, item.ifActive = true;
} = res.data; } else {
if (code === 0) { item.ifActive = false;
let unitInfos = unitInfo || {}; }
this.list = houseList; });
this.homeMsg = unitInfos; this.loading = false;
this.homeText = (unitInfos.quartersName ? unitInfos.quartersName : "") + (unitInfos.buildingName ? unitInfos.buildingName : "") + (unitInfos.unitNum ? unitInfos.unitNum + "单元" : ""); } else {
console.log(this.homeText, " this.homeText"); this.loading = false;
this.houseMountArr = this.getDoorNameList(this.list);
// this.houseMountArr = [
// [{ doorName: 101 }, { doorName: 102 }, { doorName: 103 }, { doorName: 104 }, { doorName: 105 }, { doorName: 106 }, { doorName: 107 }, { doorName: 108 }, { doorName: 109 }],
// [{ doorName: 201 }, { doorName: 202 }, { doorName: 203 }, { doorName: 204 }, { doorName: 205 }, { doorName: 206 }, { doorName: 207 }, { doorName: 208 }, { doorName: 209 }],
// ];
if (this.houseMountArr.length > 0) {
this.flexWidth = this.houseMountArr[0].length * 58;
} }
this.loading = false; });
} else { } else {
this.loading = false; this.$http.get(`/actual/base/streetOverview/getUnitHouseList?unitId=` + this.$route.query.id).then((res) => {
} const {
}); code,
// } data: { houseList, unitInfo },
} = res.data;
if (code === 0) {
let unitInfos = unitInfo || {};
this.list = houseList;
this.homeMsg = unitInfos;
this.homeText = (unitInfos.quartersName ? unitInfos.quartersName : "") + (unitInfos.buildingName ? unitInfos.buildingName : "") + (unitInfos.unitNum ? unitInfos.unitNum + "单元" : "");
console.log(this.homeText, " this.homeText");
this.houseMountArr = this.getDoorNameList(this.list);
// this.houseMountArr = [
// [{ doorName: 101 }, { doorName: 102 }, { doorName: 103 }, { doorName: 104 }, { doorName: 105 }, { doorName: 106 }, { doorName: 107 }, { doorName: 108 }, { doorName: 109 }],
// [{ doorName: 201 }, { doorName: 202 }, { doorName: 203 }, { doorName: 204 }, { doorName: 205 }, { doorName: 206 }, { doorName: 207 }, { doorName: 208 }, { doorName: 209 }],
// ];
if (this.houseMountArr.length > 0) {
this.flexWidth = this.houseMountArr[0].length * 58;
}
this.loading = false;
} else {
this.loading = false;
}
});
}
}, },
getRentFlag(type) { getRentFlag(type) {
@ -200,6 +218,19 @@ export default {
]); ]);
return houseTypeMap.get(type); return houseTypeMap.get(type);
}, },
chooseNav(item) {
let buildList = [...this.buildingList];
this.homeText = item.buildingName + item.unitName;
buildList.forEach((d) => {
if (item.id === d.id) {
d.ifActive = true;
} else {
d.ifActive = false;
}
});
this.buildingList = buildList;
},
}, },
}; };
</script> </script>
@ -221,9 +252,36 @@ export default {
font-weight: 500; font-weight: 500;
} }
@mixin navListCommon {
min-width: 120px;
height: 36px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 500;
margin-right: 4px;
text-align: center;
line-height: 36px;
cursor: pointer;
}
.top-nav-list {
display: flex;
margin-bottom: 16px;
.top-nav-item {
@include navListCommon;
background-image: url("~@/assets/images/home/noChooseMain.png");
color: #96b1ce;
}
.top-nav-itemAC {
@include navListCommon;
background-image: url("~@/assets/images/home/chooseMain.png");
color: #fff;
}
}
.homeWrap { .homeWrap {
.bread { .bread {
margin-bottom: 25px; margin-bottom: 16px;
} }
.apar_top { .apar_top {

Loading…
Cancel
Save