| | |
| | | import { |
| | | liushisijiayuanqudizhibianmafuwu, |
| | | findAddressCandidates, |
| | | getDiKuanFanWei, |
| | | getLandBorder, |
| | | getParkBorder, |
| | | ent_selectByName |
| | | } from "../../api/api"; |
| | | import vueEvents from "@/utils/vueEvent.js"; |
| | |
| | | ]).then(result => { |
| | | var that = this; |
| | | store.queryLayer.data = []; |
| | | //企v业 |
| | | //企业 |
| | | var EntArr = result[0].result.filter(item => { |
| | | return item.entName.includes(res); |
| | | }); |
| | |
| | | that.objArr.push(itemObj); |
| | | }); |
| | | //地块 |
| | | var LandArr = result[2].candidates.filter(item => { |
| | | var LandArr = result[2].candidates.filter((item) => { |
| | | return item.attributes.QYMC.includes(res); |
| | | }); |
| | | }) |
| | | // 结果根据QYMC从短到长排序 |
| | | LandArr.sort((a, b) => |
| | | b.attributes.QYMC.length === a.attributes.QYMC.length |
| | | ? 0 |
| | | : a.attributes.QYMC.length > b.attributes.QYMC.length |
| | | ? 1 |
| | | : -1 |
| | | ); |
| | | |
| | | LandArr.forEach(val => { |
| | | LandArr.sort((a, b) => (b.attributes.QYMC.length === a.attributes.QYMC.length ? 0 : a.attributes.QYMC.length > b.attributes.QYMC.length ? 1 : -1)) |
| | | LandArr.forEach((val) => { |
| | | let itemObj = { |
| | | type: "地块", |
| | | name: val.attributes.QYMC, |
| | | area: val.attributes.area, |
| | | code: val.attributes["地块编"], |
| | | lon: val.location.x, |
| | | lat: val.location.y |
| | | lat: val.location.y, |
| | | }; |
| | | that.objArr.push(itemObj); |
| | | objArr.push(itemObj); |
| | | }); |
| | | |
| | | if (index == length) { |
| | | if (that.objArr.length <= 0) { |
| | | |
| | |
| | | // 显示地块范围 |
| | | getLandmass(res) { |
| | | let that = this; |
| | | // 划线 |
| | | getDiKuanFanWei(res.lon, res.lat).then(response => { |
| | | getLandBorder(res.lon, res.lat).then(response => { |
| | | let center = { lon: 0, lat: 0 }; |
| | | let polygon = that.read(response.geometry); |
| | | if (polygon.length > 0) { |
| | | var geometry = []; |
| | | let points = polygon[0].split(","); |
| | | for (let i = 0; i < points.length; i++) { |
| | | let point = points[i].replace(/^\s+|\s+$/g, "").split(" "); |
| | | center.lon += parseFloat(point[0]) / points.length; |
| | | center.lat += parseFloat(point[1]) / points.length; |
| | | geometry.push({ |
| | | x: parseFloat(point[0]), |
| | | y: parseFloat(point[1]), |
| | | z: 0 |
| | | }); |
| | | } |
| | | if (that.lacationLine) { |
| | | sgworld.Creator.DeleteObject(that.lacationLine); |
| | | that.lacationLine = null; |
| | | } |
| | | that.lacationLine = sgworld.Creator.createPolyline( |
| | | geometry, |
| | | "#ff0000", |
| | | 1, |
| | | 0, |
| | | "线" |
| | | ); |
| | | } |
| | | }); |
| | | }, |
| | | // 显示园区范围 |
| | | getPark(res) { |
| | | let that = this; |
| | | getParkBorder(res.lon, res.lat).then(response => { |
| | | let center = { lon: 0, lat: 0 }; |
| | | let polygon = that.read(response.geometry); |
| | | if (polygon.length > 0) { |
| | |
| | | //添加定位弹窗 |
| | | this.setAddPointLocation(objdata); |
| | | //范围调用 |
| | | this.getLandmass(res); |
| | | if (res.type == '园区') { |
| | | this.getPark(res) |
| | | } else if (res.type == '地块') { |
| | | this.getLandmass(res); |
| | | } |
| | | }, |
| | | |
| | | setAddPointLocation(res) { |