fix: 修改 dc新增坐标默认为system设置的地图中心坐标

This commit is contained in:
zhangyu
2021-08-23 15:21:46 +08:00
parent 9ebcdf20a8
commit 9c134cc392
2 changed files with 15 additions and 15 deletions

View File

@@ -42,23 +42,19 @@ export default {
mapConfigVisible: false 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
},
watch: { watch: {
initData: { initData: {
immediate: true,
handler () { handler () {
console.log(this.initData)
if (this.initData) { if (this.initData) {
this.mapParam = JSON.parse(JSON.stringify(this.initData)) this.mapParam = JSON.parse(JSON.stringify(this.initData))
} else {
this.queryDefaultMapConfig()
}
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
} else {
this.queryDefaultMapConfig().then(() => {
this.lnglat = this.mapParam.longitude + ',' + this.mapParam.latitude
})
}
} }
} }
}, },
@@ -152,11 +148,15 @@ export default {
} }
}, },
queryDefaultMapConfig: function () { queryDefaultMapConfig: function () {
return new Promise(resolve => {
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) {
console.log(response)
this.mapParam = JSON.parse(response.data.paramKey.map_center_config) this.mapParam = JSON.parse(response.data.paramKey.map_center_config)
resolve()
} }
}) })
})
} }
} }
} }

View File

@@ -34,7 +34,7 @@
<!--</select-area>--> <!--</select-area>-->
<!--</el-form-item>--> <!--</el-form-item>-->
<el-form-item :label="$t('config.dc.lnglat')" prop="state"> <el-form-item :label="$t('config.dc.lnglat')" prop="state">
<latlng-picker ref="latlngPicker" :append-to-body="false" :show-zoom="false"></latlng-picker> <latlng-picker ref="latlngPicker" :append-to-body="false" :show-zoom="false" :init-data= ' editDc.latitude? {latitude:editDc.latitude,longitude:editDc.longitude} : "" '></latlng-picker>
</el-form-item> </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