shuishen
2023-02-06 6d8ece5ffc51c957340c43adc7cc24100218338f
树结构更改
1 files modified
57 ■■■■■ changed files
src/views/house/index.vue 57 ●●●●● patch | view | raw | blame | history
src/views/house/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:18:17
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-02-04 11:15:30
 * @LastEditTime: 2023-02-06 17:17:53
 * @FilePath: \srs-police-affairs\src\views\house\index.vue
 * @Description: 小区-栋-层-房屋
 * 
@@ -579,9 +579,6 @@
    },
    created () {
        // 首页跳转社区包含参数
        if (this.$route.query.id) {
            this.getVillageInfo(this.$route.query.id)
@@ -687,28 +684,40 @@
         * @return {*}
         */
        async loadNode (node, resolve) {
            if (node.level === 0) {
                let policeStaionList = []
                await getPoliceStationLazyTree(1).then(res => {
                    policeStaionList = res.data.data
                })
                return resolve(policeStaionList)
            }
            if (node.level == 1) {
                let areaList = []
                await getPoliceStationLazyTree(2, node.data.id).then(res => {
                    areaList = res.data.data
                })
                return resolve(areaList)
            }
            if (node.level == 2) {
                let villageList = []
                await getPoliceStationLazyTree(3, node.data.id).then(res => {
                    res.data.data.forEach(item => {
                        villageList = res.data.data
            if (this.userInfo.dept_id != '1123598813738675201') {
                let list = []
                let type = node.level + 1
                await getPoliceStationLazyTree(type, node.level === 0 ? this.userInfo.dept_id : node.data.id).then(res => {
                    if (res.data.data instanceof Array) {
                        list = res.data.data
                    }
                    if (Object.getPrototypeOf(res.data.data) === Object.prototype) {
                        list.push(res.data.data)
                    }
                    list.forEach(item => {
                        item.leaf = !item.hasChildren
                    })
                })
                return resolve(villageList)
                return resolve(list)
            } else {
                let list = []
                let type = node.level + 1
                await getPoliceStationLazyTree(type, node.level === 0 ? '' : node.data.id).then(res => {
                    if (res.data.data instanceof Array) {
                        list = res.data.data
                    }
                    if (Object.getPrototypeOf(res.data.data) === Object.prototype) {
                        list.push(res.data.data)
                    }
                    list.forEach(item => {
                        item.leaf = !item.hasChildren
                    })
                })
                return resolve(list)
            }
        },