feat:抽取地图选点组件
This commit is contained in:
@@ -767,7 +767,8 @@ const cn = {
|
|||||||
suspended: '停用',
|
suspended: '停用',
|
||||||
state: '状态',
|
state: '状态',
|
||||||
longitude: '经度',
|
longitude: '经度',
|
||||||
latitude: '纬度'
|
latitude: '纬度',
|
||||||
|
lnglat:'坐标'
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
model: '资产型号',
|
model: '资产型号',
|
||||||
@@ -839,11 +840,12 @@ const cn = {
|
|||||||
day: '天',
|
day: '天',
|
||||||
maxSeries: 'Query max series',
|
maxSeries: 'Query max series',
|
||||||
unsaved: '未保存提示',
|
unsaved: '未保存提示',
|
||||||
mapConfig: '地图属性',
|
mapConfig: '地图中心点',
|
||||||
mapTitle: '配置地图',
|
mapTitle: '配置地图',
|
||||||
lat: '纬度',
|
lat: '纬度',
|
||||||
lng: '经度',
|
lng: '经度',
|
||||||
zoom: '缩放'
|
zoom: '缩放',
|
||||||
|
lnglat:'坐标',
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
email: '邮件',
|
email: '邮件',
|
||||||
|
|||||||
@@ -712,7 +712,8 @@ const en = {
|
|||||||
suspended: 'Suspended',
|
suspended: 'Suspended',
|
||||||
state: 'State',
|
state: 'State',
|
||||||
longitude: 'Longitude',
|
longitude: 'Longitude',
|
||||||
latitude: 'Latitude'
|
latitude: 'Latitude',
|
||||||
|
lnglat:'Coordinate'
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
model: 'Asset model',
|
model: 'Asset model',
|
||||||
@@ -842,11 +843,12 @@ const en = {
|
|||||||
day: 'day',
|
day: 'day',
|
||||||
maxSeries: 'Query max series',
|
maxSeries: 'Query max series',
|
||||||
unsaved: 'Unsaved tip',
|
unsaved: 'Unsaved tip',
|
||||||
mapConfig: 'Map attribute',
|
mapConfig: 'Map center',
|
||||||
mapTitle: 'Configurate map',
|
mapTitle: 'Configurate map',
|
||||||
lat: 'latitude',
|
lat: 'latitude',
|
||||||
lng: 'longitude',
|
lng: 'longitude',
|
||||||
zoom: 'zoom'
|
zoom: 'zoom',
|
||||||
|
lnglat:'coordinate'
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
email: 'Email',
|
email: 'Email',
|
||||||
|
|||||||
162
nezha-fronted/src/components/common/latlngPicker.vue
Normal file
162
nezha-fronted/src/components/common/latlngPicker.vue
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<template>
|
||||||
|
<div class="latlng">
|
||||||
|
<div class="input-box">
|
||||||
|
<div class="input-box-item">
|
||||||
|
<el-input v-model="lnglat" >
|
||||||
|
<template slot="prepend" v-if="showZoom">{{$t('config.system.basic.lnglat')}}</template>
|
||||||
|
</el-input>
|
||||||
|
</div>
|
||||||
|
<div class="input-box-item" v-if="showZoom">
|
||||||
|
<el-input-number controls-position="right" :min="this.mapParam.minZoom" :max="this.mapParam.maxZoom" :step="1" v-model="mapParam.zoom">
|
||||||
|
<template slot="prepend">{{$t('config.system.basic.zoom')}}</template>
|
||||||
|
</el-input-number>
|
||||||
|
</div>
|
||||||
|
<div class="input-box-item" style="margin-right: unset !important;width: 30px !important;flex:unset;" @click="mapConfigVisible = true"><i class="nz-icon nz-icon-shuidi" style="color:rgb(238, 157, 63)"></i></div>
|
||||||
|
</div>
|
||||||
|
<el-dialog :visible.sync="mapConfigVisible" :title="$t('config.system.basic.mapTitle')" width="calc(50% - 10px)" @close="mapClose" @opened="initMap" class=" nz-dialog map-config-dialog" :modal-append-to-body="appendToBody">
|
||||||
|
<div id="map" style="height: 100%; width: 100%"></div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用
|
||||||
|
import 'leaflet/dist/leaflet.css'
|
||||||
|
import * as L from 'leaflet'
|
||||||
|
import icon from 'leaflet/dist/images/marker-icon.png'
|
||||||
|
import iconShadow from 'leaflet/dist/images/marker-shadow.png'
|
||||||
|
export default {
|
||||||
|
name: "latlngPicker",
|
||||||
|
props:{
|
||||||
|
initData:{type:Object},
|
||||||
|
appendToBody:{type:Boolean,default:true},
|
||||||
|
showZoom:{type:Boolean,default:true}
|
||||||
|
},
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
lnglat:"",
|
||||||
|
mapParam:{ longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 },
|
||||||
|
map: null,
|
||||||
|
marker: null,
|
||||||
|
mapConfigVisible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if(this.initData){
|
||||||
|
this.mapParam = JSON.parse(JSON.stringify(this.initData));
|
||||||
|
}else{
|
||||||
|
this.queryDefaultMapConfig();
|
||||||
|
}
|
||||||
|
this.lnglat = this.mapParam.longitude+","+this.mapParam.latitude;
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
initMap: function () {
|
||||||
|
if (this.map) {
|
||||||
|
this.map.remove()
|
||||||
|
this.map = null
|
||||||
|
}
|
||||||
|
this.setLatlng();
|
||||||
|
const DefaultIcon = L.icon({
|
||||||
|
iconUrl: icon,
|
||||||
|
iconSize: [26, 40],
|
||||||
|
iconAnchor: [13, 40],
|
||||||
|
shadowUrl: iconShadow
|
||||||
|
})
|
||||||
|
L.Marker.prototype.options.icon = DefaultIcon
|
||||||
|
const map = L.map('map', {
|
||||||
|
minZoom: this.mapParam.minZoom,
|
||||||
|
maxZoom: this.mapParam.maxZoom,
|
||||||
|
attributionControl: false,
|
||||||
|
zoomControl: false,
|
||||||
|
maxBounds: L.latLngBounds(L.latLng(-90, -180), L.latLng(90, 180))
|
||||||
|
}).setView([this.mapParam.latitude, this.mapParam.longitude], this.mapParam.zoom)
|
||||||
|
|
||||||
|
L.tileLayer(
|
||||||
|
'/static/Tiles/{z}/{x}/{y}.png',
|
||||||
|
{ noWrap: true }
|
||||||
|
).addTo(map)
|
||||||
|
|
||||||
|
const attribution = L.control.attribution({ position: 'bottomright', prefix: '' })
|
||||||
|
attribution.addAttribution(' © OpenStreetMap contributors')
|
||||||
|
attribution.addTo(map)
|
||||||
|
|
||||||
|
L.control.zoom({
|
||||||
|
position: 'bottomright',
|
||||||
|
zoomInText: '<i class="nz-icon nz-icon-enlarge"></i>',
|
||||||
|
zoomOutText: '<i class="nz-icon nz-icon-narrow"></i>',
|
||||||
|
zoomInTitle: '',
|
||||||
|
zoomOutTitle: ''
|
||||||
|
}).addTo(map)
|
||||||
|
|
||||||
|
const marker = L.marker([this.mapParam.latitude, this.mapParam.longitude]).addTo(map)
|
||||||
|
map.on('click', function (e) {
|
||||||
|
const latitude = e.latlng.lat
|
||||||
|
const longitude = e.latlng.lng
|
||||||
|
marker.setLatLng([latitude, longitude])
|
||||||
|
})
|
||||||
|
this.map = map
|
||||||
|
this.marker = marker
|
||||||
|
},
|
||||||
|
mapClose: function () {
|
||||||
|
this.mapConfigVisible = false
|
||||||
|
const latlng = this.marker.getLatLng()
|
||||||
|
this.mapParam.longitude = latlng.lng.toFixed(3);
|
||||||
|
this.mapParam.latitude = latlng.lat.toFixed(3);
|
||||||
|
this.lnglat = this.mapParam.longitude+","+this.mapParam.latitude;
|
||||||
|
|
||||||
|
this.mapParam.zoom = this.map.getZoom();
|
||||||
|
},
|
||||||
|
setLatlng:function(){
|
||||||
|
let lnglat = this.lnglat.split(",");
|
||||||
|
this.mapParam.longitude = lnglat[0]
|
||||||
|
this.mapParam.latitude = lnglat[1]
|
||||||
|
},
|
||||||
|
getAttribute:function(){
|
||||||
|
return JSON.parse(JSON.stringify(this.mapParam));
|
||||||
|
},
|
||||||
|
setLnglat:function(lat,lng){
|
||||||
|
if(lat&&lng){
|
||||||
|
this.mapParam.latitude=lat;
|
||||||
|
this.mapParam.longitude =lng;
|
||||||
|
this.lnglat = this.mapParam.longitude+","+this.mapParam.latitude;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryDefaultMapConfig:function(){
|
||||||
|
this.$get("/sysConfig?paramKey=map_center_config").then(response=>{
|
||||||
|
if(response.code == 200){
|
||||||
|
this.mapParam = JSON.parse(response.data.paramKey.map_center_config);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.latlng .input-box{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.latlng .input-box .input-box-item{
|
||||||
|
margin-right: 20px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.latlng .input-box .el-input,.latlng .input-box .el-input-number{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.latlng .map-config-dialog .el-dialog{
|
||||||
|
height: 45%;
|
||||||
|
}
|
||||||
|
.latlng .map-config-dialog .el-dialog__body{
|
||||||
|
height: calc(100% - 48px) !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.latlng .input-box .el-input .el-input-group__prepend{
|
||||||
|
padding:0px 5px!important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<!-- begin--表单-->
|
<!-- begin--表单-->
|
||||||
<div class="right-box-form-box">
|
<div class="right-box-form-box">
|
||||||
<el-form class="right-box-form right-box-form-left" label-width="120px" :model="editDc" label-position = "top" :rules="rules" ref="dcForm">
|
<el-form class="right-box-form right-box-form-left" label-width="120px" size="small" :model="editDc" label-position = "top" :rules="rules" ref="dcForm">
|
||||||
<el-form-item :label='$t("overall.name")' prop="name">
|
<el-form-item :label='$t("overall.name")' prop="name">
|
||||||
<el-input placeholder="" maxlength="64" show-word-limit v-model="editDc.name" size="small" id="dc-box-input-name"></el-input>
|
<el-input placeholder="" maxlength="64" show-word-limit v-model="editDc.name" size="small" id="dc-box-input-name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -39,6 +39,9 @@
|
|||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</select-area>-->
|
<!--</select-area>-->
|
||||||
<!--</el-form-item>-->
|
<!--</el-form-item>-->
|
||||||
|
<el-form-item :label="$t('config.dc.lnglat')" prop="state">
|
||||||
|
<latlng-picker ref="latlngPicker" :append-to-body="false" :show-zoom="false"></latlng-picker>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item :label='$t("config.dc.state")' prop="state">
|
<el-form-item :label='$t("config.dc.state")' prop="state">
|
||||||
<el-switch
|
<el-switch
|
||||||
id="dc-box-input-name"
|
id="dc-box-input-name"
|
||||||
@@ -49,34 +52,7 @@
|
|||||||
>
|
>
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label='$t("config.dc.longitude")' prop="longitude" :rules="[{required:coordinateFlag,trigger:'blur'}]">
|
|
||||||
<el-input-number
|
|
||||||
id="dc-box-input-longitude"
|
|
||||||
placeholder=""
|
|
||||||
v-model="editDc.longitude"
|
|
||||||
size="small"
|
|
||||||
controls-position="right"
|
|
||||||
:min="-180"
|
|
||||||
:max="180"
|
|
||||||
:step="0.00001"
|
|
||||||
:precision="5"
|
|
||||||
@change="(val)=>{coordinateChange(val,'longitude')}"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label='$t("config.dc.latitude")' prop="latitude" :rules="[{required:coordinateFlag,trigger:'blur'}]">
|
|
||||||
<el-input-number
|
|
||||||
id="dc-box-input-latitude"
|
|
||||||
placeholder=""
|
|
||||||
v-model="editDc.latitude"
|
|
||||||
size="small"
|
|
||||||
controls-position="right"
|
|
||||||
:min="-90"
|
|
||||||
:max="90"
|
|
||||||
:step="0.00001"
|
|
||||||
:precision="5"
|
|
||||||
@change="(val)=>{coordinateChange(val,'latitude')}"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -94,9 +70,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import latlngPicker from "../latlngPicker";
|
||||||
const regNum = /^[0-9]+.?[0-9]*/
|
const regNum = /^[0-9]+.?[0-9]*/
|
||||||
export default {
|
export default {
|
||||||
name: 'dcBox',
|
name: 'dcBox',
|
||||||
|
components:{latlngPicker},
|
||||||
props: {
|
props: {
|
||||||
dc: Object,
|
dc: Object,
|
||||||
userData: Array
|
userData: Array
|
||||||
@@ -131,34 +109,30 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* 保存 */
|
/* 保存 */
|
||||||
save () {
|
save: function () {
|
||||||
if (this.prevent_opt.save) { return } ;
|
if (this.prevent_opt.save) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
;
|
||||||
this.prevent_opt.save = true
|
this.prevent_opt.save = true
|
||||||
this.$refs.dcForm.validate((valid) => {
|
this.$refs.dcForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.editDc.id) {
|
if (this.editDc.id) {
|
||||||
const param = { ...this.editDc }
|
const param = {...this.editDc}
|
||||||
if (param.area) {
|
let attr = this.$refs.latlngPicker.getAttribute();
|
||||||
param.areaId = param.area.id
|
param.latitude = attr.latitude;
|
||||||
}
|
param.longitude = attr.longitude;
|
||||||
if (!regNum.test(param.longitude)) {
|
|
||||||
param.longitude = null
|
|
||||||
}
|
|
||||||
if (!regNum.test(param.latitude)) {
|
|
||||||
param.latitude = null
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$put('idc', param).then(response => {
|
this.$put('idc', param).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({duration: 1000, type: 'success', message: this.$t('tip.saveSuccess')})
|
||||||
this.esc(true)
|
this.esc(true)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(response.msg)
|
this.$message.error(response.msg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const param = { ...this.editDc }
|
const param = {...this.editDc}
|
||||||
if (param.area) {
|
if (param.area) {
|
||||||
param.areaId = param.area.id
|
param.areaId = param.area.id
|
||||||
}
|
}
|
||||||
@@ -171,7 +145,7 @@ export default {
|
|||||||
this.$post('idc', param).then(response => {
|
this.$post('idc', param).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({duration: 1000, type: 'success', message: this.$t('tip.saveSuccess')})
|
||||||
this.esc(true)
|
this.esc(true)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(response.msg)
|
this.$message.error(response.msg)
|
||||||
@@ -236,6 +210,9 @@ export default {
|
|||||||
deep: true,
|
deep: true,
|
||||||
handler (n, o) {
|
handler (n, o) {
|
||||||
this.editDc = JSON.parse(JSON.stringify(n))
|
this.editDc = JSON.parse(JSON.stringify(n))
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.latlngPicker.setLnglat(this.editDc.latitude,this.editDc.longitude);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('config.system.basic.mapConfig')" >
|
<el-form-item :label="$t('config.system.basic.mapConfig')" >
|
||||||
<div class="system-map">
|
<latlng-picker :init-data="basic.map_center_config" ref="latlngPicker"></latlng-picker>
|
||||||
<div class="system-map-item"><span class="label">{{$t('config.system.basic.lat')}}</span><span><el-input width="20px" v-model="basic.map_center_config.latitude"></el-input></span></div>
|
|
||||||
<div class="system-map-item"><span class="label">{{$t('config.system.basic.lng')}}</span><span><el-input width="20px" v-model="basic.map_center_config.longitude"></el-input></span></div>
|
|
||||||
<div class="system-map-item"><span class="label">{{$t('config.system.basic.zoom')}}</span><span><el-input width="20px" v-model="basic.map_center_config.zoom"></el-input></span></div>
|
|
||||||
<div class="system-map-item" style="margin-right: unset !important;" @click="mapConfigVisible = true"><i class="nz-icon nz-icon-shuidi" style="color:rgb(238, 157, 63)"></i></div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('config.system.basic.unsaved')" prop="unsaved_change">
|
<el-form-item :label="$t('config.system.basic.unsaved')" prop="unsaved_change">
|
||||||
<el-switch v-model.number="basic.unsaved_change" active-color="rgb(238, 157, 63)" active-value='on' inactive-value='off' id="system-baisc-unsaved_change">
|
<el-switch v-model.number="basic.unsaved_change" active-color="rgb(238, 157, 63)" active-value='on' inactive-value='off' id="system-baisc-unsaved_change">
|
||||||
@@ -62,9 +57,6 @@
|
|||||||
<button id="system-basic-save" @click="saveSetInfo('basic','basicForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_basic_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.submit')}}</button>
|
<button id="system-basic-save" @click="saveSetInfo('basic','basicForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_basic_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.submit')}}</button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-dialog :visible.sync="mapConfigVisible" :title="$t('config.system.basic.mapTitle')" width="calc(50% - 10px)" @close="mapClose" @opened="initMap" class=" nz-dialog map-config-dialog" :modal-append-to-body="true">
|
|
||||||
<div id="map" style="height: 100%; width: 100%"></div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('config.system.email.email')" name="email" >
|
<el-tab-pane :label="$t('config.system.email.email')" name="email" >
|
||||||
@@ -364,17 +356,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { positiveInteger, port, hostPlus, host, uSize } from '../../common/js/validate'
|
import { positiveInteger, port, hostPlus, host, uSize } from '../../common/js/validate'
|
||||||
|
import latlngPicker from "../../common/latlngPicker";
|
||||||
import bus from '../../../libs/bus'
|
import bus from '../../../libs/bus'
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
// 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用
|
|
||||||
import 'leaflet/dist/leaflet.css'
|
|
||||||
import * as L from 'leaflet'
|
|
||||||
import icon from 'leaflet/dist/images/marker-icon.png'
|
|
||||||
import iconShadow from 'leaflet/dist/images/marker-shadow.png'
|
|
||||||
export default {
|
export default {
|
||||||
name: 'system',
|
name: 'system',
|
||||||
components: { draggable },
|
components: { draggable ,latlngPicker},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
basic: {
|
basic: {
|
||||||
@@ -392,9 +380,6 @@ export default {
|
|||||||
unsaved_change: 'on',
|
unsaved_change: 'on',
|
||||||
map_center_config: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 }
|
map_center_config: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 }
|
||||||
},
|
},
|
||||||
mapConfigVisible: false,
|
|
||||||
map: null,
|
|
||||||
marker: null,
|
|
||||||
basicCopy: null,
|
basicCopy: null,
|
||||||
basicRules: {
|
basicRules: {
|
||||||
system_name: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
system_name: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||||
@@ -554,59 +539,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initMap: function () {
|
|
||||||
if (this.map) {
|
|
||||||
this.map.remove()
|
|
||||||
this.map = null
|
|
||||||
}
|
|
||||||
const DefaultIcon = L.icon({
|
|
||||||
iconUrl: icon,
|
|
||||||
iconSize: [26, 40],
|
|
||||||
iconAnchor: [13, 40],
|
|
||||||
shadowUrl: iconShadow
|
|
||||||
})
|
|
||||||
L.Marker.prototype.options.icon = DefaultIcon
|
|
||||||
const map = L.map('map', {
|
|
||||||
minZoom: this.basic.map_center_config.minZoom,
|
|
||||||
maxZoom: this.basic.map_center_config.maxZoom,
|
|
||||||
attributionControl: false,
|
|
||||||
zoomControl: false,
|
|
||||||
maxBounds: L.latLngBounds(L.latLng(-90, -180), L.latLng(90, 180))
|
|
||||||
}).setView([this.basic.map_center_config.latitude, this.basic.map_center_config.longitude], this.basic.map_center_config.zoom)
|
|
||||||
|
|
||||||
L.tileLayer(
|
|
||||||
'/static/Tiles/{z}/{x}/{y}.png',
|
|
||||||
{ noWrap: true }
|
|
||||||
).addTo(map)
|
|
||||||
|
|
||||||
const attribution = L.control.attribution({ position: 'bottomright', prefix: '' })
|
|
||||||
attribution.addAttribution(' © OpenStreetMap contributors')
|
|
||||||
attribution.addTo(map)
|
|
||||||
|
|
||||||
L.control.zoom({
|
|
||||||
position: 'bottomright',
|
|
||||||
zoomInText: '<i class="nz-icon nz-icon-enlarge"></i>',
|
|
||||||
zoomOutText: '<i class="nz-icon nz-icon-narrow"></i>',
|
|
||||||
zoomInTitle: '',
|
|
||||||
zoomOutTitle: ''
|
|
||||||
}).addTo(map)
|
|
||||||
|
|
||||||
const marker = L.marker([this.basic.map_center_config.latitude, this.basic.map_center_config.longitude]).addTo(map)
|
|
||||||
map.on('click', function (e) {
|
|
||||||
const lat = e.latlng.lat
|
|
||||||
const lng = e.latlng.lng
|
|
||||||
marker.setLatLng([lat, lng])
|
|
||||||
})
|
|
||||||
this.map = map
|
|
||||||
this.marker = marker
|
|
||||||
},
|
|
||||||
mapClose: function () {
|
|
||||||
this.mapConfigVisible = false
|
|
||||||
const latlng = this.marker.getLatLng()
|
|
||||||
this.basic.map_center_config.latitude = latlng.lat
|
|
||||||
this.basic.map_center_config.longitude = latlng.lng
|
|
||||||
this.basic.map_center_config.zoom = this.map.getZoom()
|
|
||||||
},
|
|
||||||
selectTab: function (tab) {
|
selectTab: function (tab) {
|
||||||
this.querySetInfo(tab.name)
|
this.querySetInfo(tab.name)
|
||||||
},
|
},
|
||||||
@@ -656,6 +588,7 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
const param = {}
|
const param = {}
|
||||||
if (type == 'basic') {
|
if (type == 'basic') {
|
||||||
|
this.basic.map_center_config = this.$refs.latlngPicker.getAttribute();
|
||||||
this.basic.map_center_config = JSON.stringify(this.basic.map_center_config)
|
this.basic.map_center_config = JSON.stringify(this.basic.map_center_config)
|
||||||
}
|
}
|
||||||
param[type] = Object.assign({}, this[type])
|
param[type] = Object.assign({}, this[type])
|
||||||
@@ -1001,20 +934,7 @@ export default {
|
|||||||
width: 61.8% !important;
|
width: 61.8% !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.system .system-map{
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
.system-map .system-map-item{
|
|
||||||
/*display: inline-block;*/
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
.system-map .system-map-item .label{
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
.system-map .el-input{
|
|
||||||
width: 92px !important;
|
|
||||||
}
|
|
||||||
.linkBox{
|
.linkBox{
|
||||||
max-height: 800px;
|
max-height: 800px;
|
||||||
width: 800px;
|
width: 800px;
|
||||||
@@ -1181,13 +1101,7 @@ export default {
|
|||||||
.system-config-form .el-form-item__content{
|
.system-config-form .el-form-item__content{
|
||||||
width: 512px;
|
width: 512px;
|
||||||
}
|
}
|
||||||
.system .map-config-dialog .el-dialog{
|
|
||||||
height: 45%;
|
|
||||||
}
|
|
||||||
.map-config-dialog .el-dialog__body{
|
|
||||||
height: calc(100% - 48px) !important;
|
|
||||||
|
|
||||||
}
|
|
||||||
.system-config-form .el-input{
|
.system-config-form .el-input{
|
||||||
width:512px;
|
width:512px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|||||||
Reference in New Issue
Block a user