增加查询派出所、责任区、小区的接口;增加字符串坐标转换成数组坐标的方法;
1 files modified
2 files added
116 ■■■■■ changed files
src/api/dept/index.js 13 ●●●●● patch | view | raw | blame | history
src/utils/geometryStringTool.js 23 ●●●●● patch | view | raw | blame | history
src/views/home/index.vue 80 ●●●●● patch | view | raw | blame | history
src/api/dept/index.js
New file
@@ -0,0 +1,13 @@
import request from "@/router/axios.js"
/**
 * 获取派出所和责任区数据
 * @param {*} params
 * @returns
 */
export const getPoliceStationList = () => {
    return request({
        url: '/blade-system/dept/getAllPoliceStation',
        method: 'get',
    })
}
src/utils/geometryStringTool.js
New file
@@ -0,0 +1,23 @@
/**
 * 字符串坐标转数组坐标
 * @param geometryString
 */
export function convertStringToList(geometryString){
    if (geometryString){
        let finalString = geometryString.replaceAll(",",";").replaceAll(" ",",")
        let list = finalString.split(";")
        let finalList = []
        list.forEach(e=>{
            let tempList = e.split(",")
            let tempList1 = []
            tempList.forEach(k=>{
                tempList1.push(k-0)
            })
            tempList1.push(0)
            finalList.push(tempList1)
        })
        return finalList
    }else {
        return []
    }
}
src/views/home/index.vue
@@ -371,6 +371,8 @@
import underwayArr from '@/assets/data/activitysData/underway.js'
import realtimeArr from '@/assets/data/policeSituationArr/realtimeArr.js'
import policeSituationHistoryArr from '@/assets/data/policeSituationArr/historyArr.js'
import {getPoliceStationList} from "@/api/dept";
import {convertStringToList} from "@/utils/geometryStringTool";
export default {
    data () {
@@ -516,9 +518,11 @@
        this.phoneList = phoneList
        this.monitoringList = monitoringList
        this.houseList = houseList
        this.areaOptionData = areaOptionData
        this.policeStationOptions = policeStationOptions
        this.housingDate = housingDate
        // this.areaOptionData = areaOptionData
        // this.policeStationOptions = policeStationOptions
        // this.housingDate = housingDate
        //获取派出所责任区小区数据
        this.getPoliceStationList()
        this.historyArr = historyArr
        this.underwayArr = underwayArr
        this.policeSituationRealtimeArr = realtimeArr
@@ -527,7 +531,7 @@
    },
    mounted () {
        this.$nextTick(() => {
      this.$nextTick(() => {
            this.initPoliceStationLayer()
            circleLayer = new global.DC.VectorLayer('circleLayer')
            global.viewer.addLayer(circleLayer)
@@ -544,6 +548,30 @@
        // }}
        window.addEventListener('resize', this.setDomStyle)
    },
    watch:{
      "policeStationOptions":{
        handler(newVal){
          this.$nextTick(() => {
            this.initPoliceStationLayer()
            circleLayer = new global.DC.VectorLayer('circleLayer')
            global.viewer.addLayer(circleLayer)
            document.querySelector('.dc-container .dc-zoom-controller').classList.add('homebottom')
            document.querySelector('.dc-container .dc-location-bar').classList.add('homebottom')
            document.querySelector('.screen-full-btn').classList.add('homebottom')
            document.querySelector('.image-switch-icon-btn').classList.add('iconbottom')
            document.querySelector('.image-switch-img-btn').classList.add('imgbottom')
            this.setDomStyle()
          })
          // axios.get('/user/getUserList').then((res) => {
          //     console.log(res, 999)
          // }}
          window.addEventListener('resize', this.setDomStyle)
        }
      }
    },
    methods: {
@@ -1359,6 +1387,50 @@
            }
          })
        },
        /**
         * 获取派出所和责任区数据
         */
        getPoliceStationList(){
            getPoliceStationList().then(res=>{
              if (res.data.code == 200){
                let data = res.data.data
                data.forEach(policeStation=>{
                  //派出所数据匹配
                  policeStation.policeStationName= policeStation.deptName
                  policeStation.policeStationId =  policeStation.id
                  policeStation.position = convertStringToList(policeStation.positionString)
                  if (policeStation.children&&policeStation.children.length>0){
                    //责任区数据匹配
                    policeStation.areaCheckOptions = policeStation.children
                    policeStation.areaCheckOptions.forEach(child=>{
                      child.policeStationId = child.parentId
                      child.areaCheckId = child.id
                      child.areaCheckName = child.deptName
                      child.position = convertStringToList(child.positionString)
                      //小区数据匹配
                      if (child.housingArr && child.housingArr.length>0){
                        child.housingArr.forEach(community=>{
                          community.policeStationId =policeStation.id
                          community.areaCheckId = child.id
                          community.housingsId=community.id
                          community.housingsName = community.name
                          community.position = convertStringToList(community.position)
                        })
                        child.housingArr.unshift({housingsName: '全部'})
                      }
                    })
                    policeStation.areaCheckOptions.unshift({areaCheckName: '全部'})
                    policeStation.areaOptionArr = policeStation.areaCheckOptions
                  }
                })
                data.unshift({policeStationName: '全部'})
                this.policeStationOptions = data
                this.areaOptionData = data
                this.housingDate = data
              }
            })
        }
    },