fix:修改dc经纬度未保存的 问题 以及添加经纬度的校验
This commit is contained in:
@@ -556,7 +556,8 @@ const cn = {
|
|||||||
noAccess: '无访问权限',
|
noAccess: '无访问权限',
|
||||||
confirmDuplicate: '确认复制吗?',
|
confirmDuplicate: '确认复制吗?',
|
||||||
confirmCancel: '您所做的修改将不会被保存?',
|
confirmCancel: '您所做的修改将不会被保存?',
|
||||||
copySuccess: '复制成功'
|
copySuccess: '复制成功',
|
||||||
|
lnglatError: '经纬度格式错误'
|
||||||
},
|
},
|
||||||
asset: {
|
asset: {
|
||||||
asset: '资产',
|
asset: '资产',
|
||||||
|
|||||||
@@ -563,7 +563,8 @@ const en = {
|
|||||||
noAccess: 'No access',
|
noAccess: 'No access',
|
||||||
confirmDuplicate: 'Are you sure to duplicate this chart?',
|
confirmDuplicate: 'Are you sure to duplicate this chart?',
|
||||||
confirmCancel: 'Changes you made are not saved?',
|
confirmCancel: 'Changes you made are not saved?',
|
||||||
copySuccess: 'Copy success'
|
copySuccess: 'Copy success',
|
||||||
|
lnglatError: 'Wrong format of latitude and longitude'
|
||||||
},
|
},
|
||||||
asset: {
|
asset: {
|
||||||
asset: 'Asset ',
|
asset: 'Asset ',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="latlng">
|
<div class="latlng">
|
||||||
<div class="input-box">
|
<div class="input-box">
|
||||||
<div class="input-box-item">
|
<div class="input-box-item">
|
||||||
<el-input v-model="lnglat" >
|
<el-input v-model="lnglat" @change="setLatlng" @focus="oldlnglat = lnglat" @blur="changeLnglat">
|
||||||
<template slot="prepend" v-if="showZoom">{{$t('config.system.basic.lnglat')}}</template>
|
<template slot="prepend" v-if="showZoom">{{$t('config.system.basic.lnglat')}}</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,6 +35,7 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
lnglat: '',
|
lnglat: '',
|
||||||
|
oldlnglat: '',
|
||||||
mapParam: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 },
|
mapParam: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 },
|
||||||
map: null,
|
map: null,
|
||||||
marker: null,
|
marker: null,
|
||||||
@@ -49,6 +50,18 @@ export default {
|
|||||||
}
|
}
|
||||||
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
|
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
initData: {
|
||||||
|
handler () {
|
||||||
|
if (this.initData) {
|
||||||
|
this.mapParam = JSON.parse(JSON.stringify(this.initData))
|
||||||
|
} else {
|
||||||
|
this.queryDefaultMapConfig()
|
||||||
|
}
|
||||||
|
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -123,6 +136,21 @@ export default {
|
|||||||
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
|
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
changeLnglat () {
|
||||||
|
const lnglat = this.lnglat.split(',')
|
||||||
|
if (lnglat.length !== 2) {
|
||||||
|
this.lnglat = this.oldlnglat
|
||||||
|
this.$message.error(this.$t('tip.lnglatError'))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const lngReg = /^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$/
|
||||||
|
const latReg = /^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$/
|
||||||
|
if (!lngReg.test(lnglat[0]) || !latReg.test(lnglat[1])) {
|
||||||
|
this.lnglat = this.oldlnglat
|
||||||
|
this.$message.error(this.$t('tip.lnglatError'))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
queryDefaultMapConfig: function () {
|
queryDefaultMapConfig: function () {
|
||||||
this.$get('/sysConfig?paramKey=map_center_config').then(response => {
|
this.$get('/sysConfig?paramKey=map_center_config').then(response => {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
|
|||||||
@@ -446,7 +446,6 @@ export default {
|
|||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const param = Object.assign({}, this[type])
|
const param = Object.assign({}, this[type])
|
||||||
|
|
||||||
if (type == 'basic') {
|
if (type == 'basic') {
|
||||||
const mapConfig = this.$refs.latlngPicker.getAttribute()
|
const mapConfig = this.$refs.latlngPicker.getAttribute()
|
||||||
param.map_center_config = JSON.stringify(mapConfig)
|
param.map_center_config = JSON.stringify(mapConfig)
|
||||||
|
|||||||
Reference in New Issue
Block a user