feat:系统配置添加地图选点
This commit is contained in:
@@ -128,7 +128,7 @@ const cn = {
|
|||||||
name:"数据库名称",
|
name:"数据库名称",
|
||||||
username:"用户名",
|
username:"用户名",
|
||||||
password:"密码",
|
password:"密码",
|
||||||
alertPath:'Alert API',
|
alertPath:'网站URL',
|
||||||
alertPrefix:'Alert prefix',
|
alertPrefix:'Alert prefix',
|
||||||
haMode:'HA mode',
|
haMode:'HA mode',
|
||||||
haVip:'Virtual IP',
|
haVip:'Virtual IP',
|
||||||
@@ -837,7 +837,12 @@ const cn = {
|
|||||||
second:'秒',
|
second:'秒',
|
||||||
day:'天',
|
day:'天',
|
||||||
maxSeries:'Query max series',
|
maxSeries:'Query max series',
|
||||||
unsaved:'未保存提示'
|
unsaved:'未保存提示',
|
||||||
|
mapConfig:"地图属性",
|
||||||
|
mapTitle:"配置地图",
|
||||||
|
lat:"纬度",
|
||||||
|
lng:"经度",
|
||||||
|
zoom:"缩放"
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
email: "邮件",
|
email: "邮件",
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ const en = {
|
|||||||
name:"Database name",
|
name:"Database name",
|
||||||
username:"Username",
|
username:"Username",
|
||||||
password:"Password",
|
password:"Password",
|
||||||
alertPath:'Alert API',
|
alertPath:'Site URL',
|
||||||
alertPrefix:'Alert prefix',
|
alertPrefix:'Alert prefix',
|
||||||
haMode:'HA mode',
|
haMode:'HA mode',
|
||||||
haVip:'Virtual IP',
|
haVip:'Virtual IP',
|
||||||
@@ -840,7 +840,12 @@ const en = {
|
|||||||
second:'second',
|
second:'second',
|
||||||
day:'day',
|
day:'day',
|
||||||
maxSeries:'Query max series',
|
maxSeries:'Query max series',
|
||||||
unsaved:'Unsaved tip'
|
unsaved:'Unsaved tip',
|
||||||
|
mapConfig:"Map attribute",
|
||||||
|
mapTitle:"Configurate map",
|
||||||
|
lat:"latitude",
|
||||||
|
lng:"longitude",
|
||||||
|
zoom:"zoom"
|
||||||
},
|
},
|
||||||
email:{
|
email:{
|
||||||
email:'Email',
|
email:'Email',
|
||||||
|
|||||||
@@ -42,6 +42,14 @@
|
|||||||
<el-option v-for="(item,index) in timezoneOption" :key="index" :label="item.label" :value="item.value" ></el-option>
|
<el-option v-for="(item,index) in timezoneOption" :key="index" :label="item.label" :value="item.value" ></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('config.system.basic.mapConfig')" >
|
||||||
|
<div class="system-map">
|
||||||
|
<div class="system-map-item"><span class="label">{{$t('config.system.basic.lat')}}</span><span><el-input width="20px" v-model="basic.map_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_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_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 :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">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
@@ -54,6 +62,9 @@
|
|||||||
<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.setup.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" >
|
||||||
@@ -359,7 +370,11 @@
|
|||||||
import {uSize} from '../../common/js/validate'
|
import {uSize} from '../../common/js/validate'
|
||||||
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},
|
||||||
@@ -378,7 +393,11 @@
|
|||||||
default_cabinet_usize:'',
|
default_cabinet_usize:'',
|
||||||
query_max_series:'',
|
query_max_series:'',
|
||||||
unsaved_change:'on',
|
unsaved_change:'on',
|
||||||
|
map_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'},],
|
||||||
@@ -538,6 +557,59 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
initMap:function(){
|
||||||
|
if(this.map){
|
||||||
|
this.map.remove();
|
||||||
|
this.map=null;
|
||||||
|
}
|
||||||
|
let DefaultIcon = L.icon({
|
||||||
|
iconUrl: icon,
|
||||||
|
iconSize: [26, 40],
|
||||||
|
iconAnchor: [13, 40],
|
||||||
|
shadowUrl: iconShadow
|
||||||
|
});
|
||||||
|
L.Marker.prototype.options.icon = DefaultIcon;
|
||||||
|
let map = L.map("map",{
|
||||||
|
minZoom:this.basic.map_config.minZoom,
|
||||||
|
maxZoom:this.basic.map_config.maxZoom,
|
||||||
|
attributionControl:false,
|
||||||
|
zoomControl:false,
|
||||||
|
maxBounds:L.latLngBounds(L.latLng(-90,-180),L.latLng(90,180))
|
||||||
|
}).setView([this.basic.map_config.latitude,this.basic.map_config.longitude],this.basic.map_config.zoom);
|
||||||
|
|
||||||
|
L.tileLayer(
|
||||||
|
"/static/Tiles/{z}/{x}/{y}.png",
|
||||||
|
{noWrap:true}
|
||||||
|
).addTo(map);
|
||||||
|
|
||||||
|
let 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)
|
||||||
|
|
||||||
|
let marker = L.marker([this.basic.map_config.latitude,this.basic.map_config.longitude]).addTo(map);
|
||||||
|
map.on("click", function(e) {
|
||||||
|
var lat = e.latlng.lat;
|
||||||
|
var lng = e.latlng.lng;
|
||||||
|
marker.setLatLng([lat,lng]);
|
||||||
|
});
|
||||||
|
this.map = map;
|
||||||
|
this.marker = marker;
|
||||||
|
},
|
||||||
|
mapClose:function(){
|
||||||
|
this.mapConfigVisible=false
|
||||||
|
let latlng = this.marker.getLatLng();
|
||||||
|
this.basic.map_config.latitude = latlng.lat;
|
||||||
|
this.basic.map_config.longitude = latlng.lng;
|
||||||
|
this.basic.map_config.zoom = this.map.getZoom();
|
||||||
|
},
|
||||||
selectTab:function(tab){
|
selectTab:function(tab){
|
||||||
this.querySetInfo(tab.name)
|
this.querySetInfo(tab.name)
|
||||||
},
|
},
|
||||||
@@ -937,10 +1009,19 @@
|
|||||||
//openUrl 跳转页面
|
//openUrl 跳转页面
|
||||||
openUrl(item){
|
openUrl(item){
|
||||||
// window.open(item.url)
|
// window.open(item.url)
|
||||||
|
},
|
||||||
|
queryDefaultMapConfig:function(){
|
||||||
|
this.$get("/sysConfig?paramKey=map_center_config").then(response=>{
|
||||||
|
if(response.code == 200){
|
||||||
|
console.log(response.data)
|
||||||
|
this.basic.map_config = JSON.parse(response.data.paramKey.map_center_config);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.querySetInfo('basic');
|
this.querySetInfo('basic');
|
||||||
|
this.queryDefaultMapConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -955,6 +1036,20 @@
|
|||||||
width: 61.8% !important;
|
width: 61.8% !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
.system .system-map{
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom:18px
|
||||||
|
}
|
||||||
|
.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: 95px !important;
|
||||||
|
}
|
||||||
.linkBox{
|
.linkBox{
|
||||||
max-height: 800px;
|
max-height: 800px;
|
||||||
width: 800px;
|
width: 800px;
|
||||||
@@ -1121,6 +1216,13 @@
|
|||||||
.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