guanqb
2023-05-08 8ff7d92c219d1519417c85d4714b906afd652bc5
三维户室逻辑调整
1 files modified
136 ■■■■■ changed files
src/views/house/index.vue 136 ●●●●● patch | view | raw | blame | history
src/views/house/index.vue
@@ -486,7 +486,6 @@
let timer = []
let curHousingName = ""
let curHousingHWTXA = {}
let JQSmychart = null
import { BjlxData } from "@/assets/police"
@@ -712,7 +711,9 @@
            },
            eventTime: [],
            eventTimeArr: [],
            residentCodeUrl: ''
            residentCodeUrl: '',
            unitChoosed3DList: [],
            curHousingHWTXAYjpca: '',
        }
    },
@@ -1244,7 +1245,7 @@
                        this.floorInfo.elev = this.unitAllArr.children_infos[0].elev == 1 ? '有' : '无'
                        // this.floorInfo.floor_num = this.unitAllArr.children_infos[0].children_infos.length
                        this.isShowFloorCount = false
                        this.getVillagePersonStatisticInfoByBuildId(this.unitAllArr.uid)
                        this.getVillagePersonStatisticInfoByBuildId(this.unitAllArr.std_addr_id.split("|")[1])
                        let houseCount = 0
                        this.unitChoosedArr.forEach(item => {
                            item.children_infos.forEach(it => {
@@ -1323,6 +1324,7 @@
        // 三维接口查询楼栋户室
        getHouses3DData (build_std_addr_id, adcode, aoiArr) {
            this.unitChoosed3DList = []
            getHouses(build_std_addr_id, adcode).then((res) => {
                let houseData = res.data.data.properties
                console.log('getHouses3DData--then')
@@ -1331,10 +1333,10 @@
                    minHeight: res.data.data.properties.hwtxa.features[0].properties.yjpca,
                    maxHeight: res.data.data.properties.hwtxa.features[0].properties.mbfdr,
                })
                let unitChoosedList = houseData.nwwqd.features
                this.unitChoosed3DList = houseData.nwwqd.features
                this.curHousingHWTXAYjpca = houseData.hwtxa.features[0].properties.yjpca
                if (aoiArr) {
                    unitChoosedList.forEach(item => {
                    this.unitChoosed3DList.forEach(item => {
                        let aoiHeight = aoiArr[1]
                        let minHeight = item.properties.szhfr
                        let maxHeight =
@@ -1342,23 +1344,29 @@
                            item.properties.hnagn
                        if (minHeight < aoiHeight && aoiHeight < maxHeight) {
                            let chooseIndex = ''
                            this.unitChoosedArr.forEach((one, index) => {
                                if (one.sname == item.properties.cftlg) {
                                    chooseIndex = index
                                }
                            })
                            this.floorsType = Math.ceil((chooseIndex + 1) / 5)
                            if (this.floorsType > 3) {
                                for (let i = 0; i < this.floorsType - 3; i++) {
                                    this.nextFloorBtn()
                                }
                            }
                            // this.unitChoosedArr.forEach((one, index) => {
                            //     if (one.sname == item.properties.cftlg) {
                            //         chooseIndex = index
                            //     }
                            // })
                            // this.floorsType = Math.ceil((chooseIndex + 1) / 5)
                            // if (this.floorsType > 3) {
                            //     for (let i = 0; i < this.floorsType - 3; i++) {
                            //         this.nextFloorBtn()
                            //     }
                            // }
                            let polygon = this.$turf.polygon([
                                JSON.parse(item.properties.kmj3a).coordinates[0],
                            ])
                            let point = this.$turf.point(aoiArr[0])
                            if (this.$turf.booleanContains(polygon, point)) {
                                this.residentDetailsClick(item)
                                this.unitChoosedArr.forEach(xIt => {
                                    xIt.children_infos.forEach(yIt => {
                                        if (item.properties.snxmi == yIt.std_addr_id.split('|')[2]) {
                                            this.residentDetailsClick(yIt)
                                        }
                                    })
                                })
                            }
                        }
                    })
@@ -1367,37 +1375,64 @@
        },
        // 三维接口高亮楼栋户室
        getResident3DData (build_std_addr_id, adcode, house_name) {
            getHouses(build_std_addr_id, adcode).then((res) => {
                let residentList = res.data.data.properties.nwwqd.features
                console.log('getResident3DData--then')
                let curHousingHWTXA = res.data.data.properties.hwtxa
                residentList.forEach(item => {
                    let item_house_name = Number(item.properties.fojcu.slice(0, item.properties.fojcu.length - 1))
                    if (item_house_name == house_name) {
                        const polygon = JSON.parse(item.properties.kmj3a).coordinates[0].reduce((pre, cur) => {
                            pre.push([cur[0], cur[1]])
                            return pre
                        }, [])
        // 三维接口高亮楼栋户室--户室不能直接用接口查找
        // getResident3DData (build_std_addr_id, adcode, house_name) {
        //     getHouses(build_std_addr_id, adcode).then((res) => {
        //         let residentList = res.data.data.properties.nwwqd.features
        //         console.log('getResident3DData--then')
        //         let curHousingHWTXA = res.data.data.properties.hwtxa
        //         residentList.forEach(item => {
        //             let item_house_name = Number(item.properties.fojcu.slice(0, item.properties.fojcu.length - 1))
        //             if (item_house_name == house_name) {
        //                 const polygon = JSON.parse(item.properties.kmj3a).coordinates[0].reduce((pre, cur) => {
        //                     pre.push([cur[0], cur[1]])
        //                     return pre
        //                 }, [])
                        const homeCenter = this.$turf.centroid(this.$turf.polygon([polygon])).geometry.coordinates
        //                 const homeCenter = this.$turf.centroid(this.$turf.polygon([polygon])).geometry.coordinates
                        this.$EventBus.$emit("toPosition", {
                            siteJd: Number(homeCenter[0]) + 0.00006,
                            siteWd: Number(homeCenter[1]) - 0.00030,
                            siteGd: item.properties.szhfr + 240,
                            sitePitch: -80,
                        })
                        this.$EventBus.$emit("clearHouse3D")
                        this.$EventBus.$emit("showThreeDimensions", {
                            positions: item.properties.kmj3a,
                            minHeight: item.properties.szhfr + curHousingHWTXA.yjpca,
                            maxHeight: item.properties.szhfr + item.properties.hnagn + curHousingHWTXA.yjpca,
                        })
                    }
                })
        //                 this.$EventBus.$emit("toPosition", {
        //                     siteJd: Number(homeCenter[0]) + 0.00006,
        //                     siteWd: Number(homeCenter[1]) - 0.00030,
        //                     siteGd: item.properties.szhfr + 240,
        //                     sitePitch: -80,
        //                 })
        //                 this.$EventBus.$emit("clearHouse3D")
        //                 this.$EventBus.$emit("showThreeDimensions", {
        //                     positions: item.properties.kmj3a,
        //                     minHeight: item.properties.szhfr + curHousingHWTXA.yjpca,
        //                     maxHeight: item.properties.szhfr + item.properties.hnagn + curHousingHWTXA.yjpca,
        //                 })
        //             }
        //         })
        //     })
        // },
        getResident3DData (build_std_addr_id) {
            this.unitChoosed3DList.forEach(item => {
                if (item.properties.snxmi == build_std_addr_id) {
                    let sanWeiData = item.properties.kmj3a
                    const polygon = JSON.parse(sanWeiData).coordinates[0].reduce((pre, cur) => {
                        pre.push([cur[0], cur[1]])
                        return pre
                    }, [])
                    const homeCenter = this.$turf.centroid(this.$turf.polygon([polygon])).geometry.coordinates
                    this.$EventBus.$emit("toPosition", {
                        siteJd: Number(homeCenter[0]) + 0.00006,
                        siteWd: Number(homeCenter[1]) - 0.00030,
                        siteGd: item.properties.szhfr + 240,
                        sitePitch: -80,
                    })
                    this.$EventBus.$emit("clearHouse3D")
                    this.$EventBus.$emit("showThreeDimensions", {
                        positions: item.properties.kmj3a,
                        minHeight: item.properties.szhfr + this.curHousingHWTXAYjpca,
                        maxHeight: item.properties.szhfr + item.properties.hnagn + this.curHousingHWTXAYjpca,
                    })
                }
            })
        },
@@ -1411,9 +1446,10 @@
            this.floorChoosed = params.sname
            console.log('residentDetailsClick--then')
            let residentId = params.std_addr_id.split('|')[2]
            this.getResident3DData(residentId, "361102", params.sname)
            this.getVillagePersonInfo(params.uid)
            this.getPicURL(params.uid)
            // this.getResident3DData(residentId, "361102", params.sname)
            this.getResident3DData(residentId)
            this.getVillagePersonInfo(residentId)
            this.getPicURL(residentId)
            this.residentDetailsTitle = `${params.name}住户信息`
            this.residentDetailsShow = true
            this.residentNoDataText = ' '
@@ -1453,7 +1489,7 @@
            this.choosedBuildUid = item.build_uid
            this.choosedBuildStdId = item.build_std_addr_id
            // 重点人口户籍人口
            this.getVillagePersonStatisticInfoByBuildId(item.build_uid)
            this.getVillagePersonStatisticInfoByBuildId(item.build_std_addr_id)
            // 楼栋单元楼层户室查询-大搜
            this.getUnitHousesData(
                "ebf48ecaa1fd436fa3d40c4600aa051f",