28383
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ai-dialog>
|
</ai-dialog>
|
||||||
<locate-dialog v-model="locate" :ins="instance" @confirm="v=>handleLocate(selected,v)"/>
|
<locate-dialog v-model="locate" :ins="instance" :latlng="latlng" @confirm="v=>handleLocate(selected,v)"/>
|
||||||
<ai-area custom-clicker :input-clicker="false" v-model="selected.areaId" :hideLevel="disabledLevel" :instance="instance" ref="BindArea"
|
<ai-area custom-clicker :input-clicker="false" v-model="selected.areaId" :hideLevel="disabledLevel" :instance="instance" ref="BindArea"
|
||||||
@change="handleSubmit(selected)"/>
|
@change="handleSubmit(selected)"/>
|
||||||
</section>
|
</section>
|
||||||
@@ -71,6 +71,7 @@
|
|||||||
selected: {
|
selected: {
|
||||||
areaId: ''
|
areaId: ''
|
||||||
},
|
},
|
||||||
|
latlng: null,
|
||||||
disabledLevel: 0,
|
disabledLevel: 0,
|
||||||
rules: {
|
rules: {
|
||||||
name: [{required: true, message: "请填写 设备名称"}]
|
name: [{required: true, message: "请填写 设备名称"}]
|
||||||
@@ -155,6 +156,10 @@
|
|||||||
} else if (command == "area") {//绑定areaId
|
} else if (command == "area") {//绑定areaId
|
||||||
this.$refs.BindArea?.chooseArea()
|
this.$refs.BindArea?.chooseArea()
|
||||||
} else if (command == "locate") {//地图标绘
|
} else if (command == "locate") {//地图标绘
|
||||||
|
this.latlng = data.lat && data.lng ? {
|
||||||
|
lat: data.lat,
|
||||||
|
lng: data.lng
|
||||||
|
} : ''
|
||||||
this.locate = true
|
this.locate = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ export default {
|
|||||||
prop: "visible",
|
prop: "visible",
|
||||||
event: "visible",
|
event: "visible",
|
||||||
},
|
},
|
||||||
props: {
|
props: ['latlng', 'visible'],
|
||||||
visible: Boolean
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialog: false,
|
dialog: false,
|
||||||
@@ -57,13 +55,21 @@ export default {
|
|||||||
plugins: ['AMap.PlaceSearch', 'AMap.Marker', 'AMap.Geolocation'],
|
plugins: ['AMap.PlaceSearch', 'AMap.Marker', 'AMap.Geolocation'],
|
||||||
}).then(AMap => {
|
}).then(AMap => {
|
||||||
this.AMap = AMap
|
this.AMap = AMap
|
||||||
|
console.log(this.latlng)
|
||||||
this.map = new AMap.Map('amap', {
|
this.map = new AMap.Map('amap', {
|
||||||
zoom: 14,
|
zoom: 14,
|
||||||
|
center: this.latlng ? [this.latlng.lng, this.latlng.lat] : ''
|
||||||
}).on('click', res => {
|
}).on('click', res => {
|
||||||
this.map.clearMap()
|
this.map.clearMap()
|
||||||
this.selected = {location: res.lnglat}
|
this.selected = {location: res.lnglat}
|
||||||
this.poi?.searchNearBy('', res.lnglat, 100)
|
this.poi?.searchNearBy('', res.lnglat, 100)
|
||||||
});
|
});
|
||||||
|
if (this.latlng) {
|
||||||
|
let marker = new AMap.Marker({
|
||||||
|
position: [this.latlng.lng, this.latlng.lat]
|
||||||
|
})
|
||||||
|
this.map.add(marker)
|
||||||
|
}
|
||||||
this.poi = new AMap.PlaceSearch().on('complete', ({poiList}) => {
|
this.poi = new AMap.PlaceSearch().on('complete', ({poiList}) => {
|
||||||
this.map.clearMap()
|
this.map.clearMap()
|
||||||
if (poiList?.length > 0) {
|
if (poiList?.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user