| | |
| | | <template> |
| | | <div class="basic-container"> |
| | | <div class="search-line"> |
| | | <el-input class="search-input" v-model="queryString" placeholder="请输入内容"></el-input> |
| | | <el-button class="search-button" @click="getAddressByQuery">查询</el-button> |
| | | <el-select |
| | | class="search-input" |
| | | v-model="queryString" |
| | | filterable |
| | | remote |
| | | reserve-keyword |
| | | placeholder="请输入关键词" |
| | | :remote-method="remoteMethod" |
| | | :loading="loading" |
| | | @change="selectChange"> |
| | | <el-option |
| | | v-for="item in searchList" |
| | | :key="item.uid" |
| | | :label="item.address" |
| | | :value="JSON.stringify(item)"> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-button class="search-button" @click="getAddressByQuery">查询</el-button>--> |
| | | </div> |
| | | <search-map-box ref="OpenLayersMap" @getMapData="getMapData" :route-range="point" |
| | | :is-detail="true"></search-map-box> |
| | |
| | | <script> |
| | | import SearchMapBox from "@/components/map/searchMapBox"; |
| | | import {getAoiByPt, search, searchByLonLat, searchByQuery} from "@/api/security/security"; |
| | | import data from "@/views/util/data"; |
| | | |
| | | export default { |
| | | name: "searchMap", |
| | |
| | | latitude: "", |
| | | queryString: "", |
| | | point: "", |
| | | searchList:[], |
| | | loading:false, |
| | | } |
| | | }, |
| | | watch:{ |
| | |
| | | this.latitude = data[0][1] |
| | | this.$emit("getLonLat", data[0]) |
| | | }, |
| | | remoteMethod(data){ |
| | | this.queryString = data |
| | | this.getAddressByQuery() |
| | | }, |
| | | getAddressByQuery() { |
| | | let ak = this.ak |
| | | let region = this.region |
| | | let query = this.queryString |
| | | let ids = "61743e28bbf11700e9fc4ef03dd8bea9" |
| | | searchByQuery(ak,region,query,ids).then(res => { |
| | | console.log(res) |
| | | let dataList = res.data.result |
| | | this.searchList = dataList |
| | | }) |
| | | }, |
| | | getAddressByLonLat(){ |
| | |
| | | let query = "" |
| | | let region = this.region |
| | | let region_type = "circle" |
| | | let page_size = "3" |
| | | let page_size = "1" |
| | | let page_num = "1" |
| | | let infos = 1 |
| | | let radius = 10 |
| | | let radius = 500 |
| | | let location = this.longitude+" "+this.latitude |
| | | |
| | | searchByLonLat(ak,query,region,region_type,page_size,page_num,infos,radius,location).then(res=>{ |
| | | console.log(res) |
| | | let data = res.data.result[0] |
| | | this.queryString = data.address |
| | | this.$emit("getAddress",this.queryString) |
| | | }) |
| | | }, |
| | | selectChange(data){ |
| | | let selectData = JSON.parse(data) |
| | | this.$refs.OpenLayersMap.setView(selectData.location) |
| | | } |
| | | } |
| | | } |
| | |
| | | <style scoped> |
| | | .search-line { |
| | | display: flex; |
| | | width: 1286px; |
| | | } |
| | | |
| | | .search-input { |
| | | margin-bottom: 2%; |
| | | } |
| | | |
| | | .search-button { |
| | | height: 10%; |
| | | width: 100%; |
| | | } |
| | | |
| | | </style> |