| | |
| | | if (type == 1) { |
| | | |
| | | this.policeStationOptions = res.data.data |
| | | console.log('policeStationOptions',this.policeStationOptions ); |
| | | |
| | | this.policeStationOptions.unshift({ |
| | | name: '全部', |
| | |
| | | |
| | | } else if (type == 2) { |
| | | this.areaOptions = res.data.data |
| | | console.log(type,2222); |
| | | this.initAreaOptionLayer() |
| | | |
| | | this.areaOptions.unshift({ |
| | | name: '全部', |
| | | id: 1 |
| | | }) |
| | | } else { |
| | | this.housingOptions = res.data.data |
| | | |
| | | this.housingOptions.lnegth > 0 && this.housingOptions.forEach(item => { |
| | | const positions = JSON.parse(item.position[0]).coordinates |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'billboard', |
| | | params: { |
| | | lng: Number(positions[0]), |
| | | lat: Number(positions[1]), |
| | | alt: 1, |
| | | url: '/img/icon/house.png', |
| | | id: item.id |
| | | }, |
| | | incident: this.houseSiteClick, |
| | | distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | }) |
| | | this.initHousingLayer () |
| | | this.housingOptions.unshift({ |
| | | name: '全部', |
| | | id: 1 |
| | | }) |
| | | |
| | | } |
| | | }) |
| | | }, |
| | |
| | | this.housingCheckValue = '请选择小区' |
| | | this.getPoliceStationTree(3, item.id) |
| | | this.areaChecked = item |
| | | this.initAreaOptionLayer() |
| | | |
| | | |
| | | } |
| | | }, |
| | | |
| | | housingSelect (item) { |
| | | this.housingCheckValue = item.name |
| | | // if (item.housingsName == "全部") { |
| | | // this.initHousingLayer(this.areaChecked) |
| | | // } else { |
| | | // this.initLivingLayer(item) |
| | | // } |
| | | |
| | | const positions = JSON.parse(item.position[0]).coordinates |
| | | |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: Number(positions[0]), |
| | | siteWd: Number(positions[1]) - 0.0021, |
| | | siteGd: 240, |
| | | sitePitch: -45 |
| | | }) |
| | | if (item.name == "全部") { |
| | | this.initHousingLayer(this.areaChecked) |
| | | } else { |
| | | this.initLivingLayer(item) |
| | | } |
| | | }, |
| | | |
| | | getCenter (str) { |
| | |
| | | } |
| | | }, |
| | | |
| | | // initAreaCheckoptions (areaArr) { |
| | | // areaArr.forEach((item, index) => { |
| | | // if (item.areaCheckName != '全部') { |
| | | // let str = '' |
| | | // item.position.forEach(it => { |
| | | // str = str + `${it[0]},${it[1]},${it[2]};` |
| | | // }) |
| | | // this.$EventBus.$emit('layerPolygonAdd', { |
| | | // layerName: 'polygonLayer', |
| | | // positions: str, |
| | | // material: positionColor[index] |
| | | // }) |
| | | // const center = this.getCenter(item.position) |
| | | // this.$EventBus.$emit('layerPointAdd', { |
| | | // layerName: 'polygonLayer', |
| | | // type: 'label', |
| | | // params: { |
| | | // lng: center[0], |
| | | // lat: center[1], |
| | | // alt: 0, |
| | | // text: item.areaCheckName |
| | | // }, |
| | | // distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }, |
| | | initAreaCheckoptions (areaArr) { |
| | | areaArr.forEach((item, index) => { |
| | | if (item.areaCheckName != '全部') { |
| | | let str = '' |
| | | item.position.forEach(it => { |
| | | str = str + `${it[0]},${it[1]},${it[2]};` |
| | | }) |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'polygonLayer', |
| | | positions: str, |
| | | material: positionColor[index] |
| | | }) |
| | | const center = this.getCenter(item.position) |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: center[0], |
| | | lat: center[1], |
| | | alt: 0, |
| | | text: item.areaCheckName |
| | | }, |
| | | distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | initHousingOptions (housingArr) { |
| | | housingArr.forEach((item, index) => { |
| | |
| | | |
| | | const center = this.getRegionCenter(item.position) |
| | | |
| | | |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'areaPolygonLabel', |
| | | type: 'label', |
| | |
| | | initAreaOptionLayer () { |
| | | const that = this |
| | | this.clearPolygonLayer() |
| | | console.log(this.areaOptions,11122) |
| | | this.areaOptions.forEach((item, index) => { |
| | | |
| | | item.position && item.position.forEach(sourceItem => { |
| | |
| | | }) |
| | | }, |
| | | |
| | | initHousingLayer (item) { |
| | | this.clearPolygonLayer() |
| | | let itPositionStr = item.position[0].replace(/MULTIPOLYGON\(\(\(/g, '') |
| | | itPositionStr = itPositionStr.replace(/\)\)\)/g, '') |
| | | itPositionStr = itPositionStr.replace(/,/g, ";") |
| | | itPositionStr = itPositionStr.replace(/ /g, ",") |
| | | let center = this.getCenter(item.position[0]) |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'polygonLayer', |
| | | positions: itPositionStr, |
| | | material: positionColor[0], |
| | | }) |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: center[0], |
| | | siteWd: center[1], |
| | | siteGd: 6000, |
| | | siteHeading: -3, |
| | | sitePitch: -90 |
| | | }) |
| | | }, |
| | | |
| | | initLivingLayer (item) { |
| | | let center = this.getCenter(item.position) |
| | | initHousingLayer () { |
| | | let positionArr = JSON.parse(this.areaChecked.position).coordinates[0][0] |
| | | let polygon = this.$turf.polygon([positionArr]) |
| | | let center = this.$turf.centroid(polygon) |
| | | let centerPosition = [center.geometry.coordinates[0], center.geometry.coordinates[1]] |
| | | this.clearPolygonLayer() |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: center[0], |
| | | siteWd: center[1], |
| | | siteGd: 18000, |
| | | siteJd: centerPosition[0], |
| | | siteWd: centerPosition[1], |
| | | siteGd: 3000, |
| | | siteHeading: -3, |
| | | sitePitch: -90 |
| | | }) |
| | | let str = '' |
| | | item.position.forEach(it => { |
| | | str = str + `${it[0]},${it[1]},${it[2]};` |
| | | positionArr.forEach(it => { |
| | | str = str + `${it[0]},${it[1]};` |
| | | }) |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'polygonLayer', |
| | |
| | | lng: center[0], |
| | | lat: center[1], |
| | | alt: 1, |
| | | text: item.housingsName |
| | | text: this.areaChecked.name |
| | | } |
| | | }) |
| | | |
| | | this.housingOptions.length > 0 && this.housingOptions.forEach(item => { |
| | | if(item.name == '全部') return |
| | | const positions = JSON.parse(item.position[0]).coordinates |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'billboard', |
| | | params: { |
| | | lng: Number(positions[0]), |
| | | lat: Number(positions[1]), |
| | | alt: 1, |
| | | url: '/img/icon/house.png', |
| | | id: item.id |
| | | }, |
| | | incident: this.houseSiteClick, |
| | | distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | }) |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: Number(positions[0]), |
| | | lat: Number(positions[1]), |
| | | alt: 1, |
| | | text: item.name |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | initLivingLayer (item) { |
| | | let positionArr = JSON.parse(item.position).coordinates |
| | | this.clearPolygonLayer() |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: positionArr[0], |
| | | siteWd: positionArr[1], |
| | | siteGd: 3000, |
| | | siteHeading: -3, |
| | | sitePitch: -90 |
| | | }) |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: positionArr[0], |
| | | lat: positionArr[1], |
| | | alt: 1, |
| | | text: item.name |
| | | } |
| | | }) |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'billboard', |
| | | params: { |
| | | lng: positionArr[0], |
| | | lat: positionArr[1], |
| | | alt: 1, |
| | | url: '/img/icon/house.png', |
| | | id: item.id |
| | | }, |
| | | incident: this.houseSiteClick, |
| | | distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | }) |
| | | }, |
| | | |
| | |
| | | // cylinderLayer.clear() |
| | | }, |
| | | |
| | | getAreaCenter (name) { |
| | | let center = [] |
| | | this.areaOptionData.some((item) => { |
| | | if (this.policeStaionChecked.policeStationName == item.policeStationName && this.policeStaionChecked.policeStationName != "全部") { |
| | | item.areaCheckOptions.some((one) => { |
| | | if (name == one.areaCheckName) { |
| | | center = this.getCenter(one.position) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | return center |
| | | }, |
| | | |
| | | // 修改下拉容器的left |
| | | |
| | | setDomStyle () { |
| | | const bodyWidth = document.body.clientWidth |
| | | const domWidth = this.$refs.RegionSelect.offsetWidth |
| | |
| | | |
| | | getPoliceCameraEquimentPage (params) { |
| | | getPoliceCameraEquimentPage(params).then(res => { |
| | | console.log(res) |
| | | }) |
| | | }, |
| | | |
| | |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 获取派出所和责任区数据 |
| | | */ |
| | | // getPoliceStationList () { |
| | | // getPoliceStationList().then(res => { |
| | | // if (res.data.code == 200) { |
| | | // let data = res.data.data |
| | | // console.log(data,111) |
| | | // 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 |
| | | // } |
| | | // }) |
| | | // }, |
| | | |
| | | indexMethod (index) { |
| | | return index + 1 |