Commit 7135bf24 authored by yanzhongrong's avatar yanzhongrong

changeTodfm

parent 15c176a3
...@@ -115,3 +115,34 @@ export function param2Obj(url) { ...@@ -115,3 +115,34 @@ export function param2Obj(url) {
}) })
return obj return obj
} }
export function changeToLngDFM(du) {
if(!du) return
const arr1 = du.split(".");
const d = arr1[0];
let tp = "0." + arr1[1]
tp = String(tp * 60); //进行强制类型转换
const arr2 = tp.split(".");
const f = arr2[0];
tp = "0." + arr2[1];
tp = tp * 60;
const m = tp.toFixed(2);//保留两位小数
const dfm = '东经E' + d + "°" + f + "'" + m + "\"";
return dfm;
}
export function changeToLatDFM(du) {
if(!du) return
const arr1 = du.split(".");
const d = arr1[0];
let tp = "0." + arr1[1]
tp = String(tp * 60); //进行强制类型转换
const arr2 = tp.split(".");
const f = arr2[0];
tp = "0." + arr2[1];
tp = tp * 60;
const m = tp.toFixed(2);//保留两位小数
const dfm = '北纬N' + d + "°" + f + "'" + m + "\"";
return dfm;
}
\ No newline at end of file
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
<div class="item_name">站点经度</div> <div class="item_name">站点经度</div>
</el-col> </el-col>
<el-col :span="colspan"> <el-col :span="colspan">
<div class="item_data">{{ form.baseInfo.siteLatitude }}</div> <div class="item_data">{{ changeToLngDFM(form.baseInfo.siteLatitude) }}</div>
</el-col> </el-col>
</el-row> </el-row>
<el-row class="text" :gutter="24"> <el-row class="text" :gutter="24">
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
<div class="item_name">站点纬度</div> <div class="item_name">站点纬度</div>
</el-col> </el-col>
<el-col :span="colspan"> <el-col :span="colspan">
<div class="item_data">{{ form.baseInfo.siteLongitude }}</div> <div class="item_data">{{ changeToLatDFM(form.baseInfo.siteLongitude) }}</div>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row class="text" :gutter="24"> <!-- <el-row class="text" :gutter="24">
...@@ -235,6 +235,9 @@ ...@@ -235,6 +235,9 @@
</template> </template>
<script> <script>
import { changeToLngDFM,
changeToLatDFM } from '@/utils/index'
import { DetailMixins } from "./mixins"; import { DetailMixins } from "./mixins";
import { siteOpen } from "../api"; import { siteOpen } from "../api";
export default { export default {
...@@ -276,6 +279,8 @@ export default { ...@@ -276,6 +279,8 @@ export default {
}, },
}, },
methods: { methods: {
changeToLngDFM,
changeToLatDFM,
savebtn() { savebtn() {
this.flag = true; this.flag = true;
siteOpen(this.info()).then((res) => { siteOpen(this.info()).then((res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment