吉安感知网项目-前端
罗广辉
2026-01-12 8dd129b08999cb33aab88f02d0434fb3df1f75c5
feat: 选择位置
2 files modified
38 ■■■■■ changed files
applications/drone-command/src/main.js 4 ●●● patch | view | raw | blame | history
applications/drone-command/src/views/areaManage/precinctInfo/FormDiaLog.vue 34 ●●●●● patch | view | raw | blame | history
applications/drone-command/src/main.js
@@ -41,6 +41,7 @@
import dayjs from 'dayjs'
import 'styles/common.scss'
import * as Cesium from 'cesium'
import _ from 'lodash'
// 视频回放
import 'video.js/dist/video-js.css'
@@ -81,13 +82,14 @@
    location.reload()
} else {
    if (localStorage.getItem("isReload")) {
        localStorage.removeItem("isReload")
        localStorage.removeItem('isReload')
    }
}
window.$crudCommon = crudCommon
window.axios = axios
window._ = _
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
applications/drone-command/src/views/areaManage/precinctInfo/FormDiaLog.vue
@@ -29,18 +29,15 @@
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="位置" prop="longitude">
                        <el-button @click="selectLocation">{{ formData.longitude }},{{ formData.longitude }}</el-button>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="位置" prop="address">
                        <el-input v-model="formData.address" maxlength="50" placeholder="请输入" clearable />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="联系方式" prop="contactPhone">
                        <el-input v-model="formData.contactPhone" maxlength="50" placeholder="请输入" clearable />
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="位置" prop="longitude">
                        <el-button @click="selectLocation" style="width: 100%">
                            {{ formData.longitude }}, {{ formData.longitude }}, {{ formData.address }}
                        </el-button>
                    </el-form-item>
                </el-col>
            </el-row>
@@ -69,6 +66,7 @@
import { fieldRules } from '@ztzf/utils'
import { PublicCesium } from '@/utils/cesium/publicCesium'
import * as Cesium from 'cesium'
import axios from 'axios'
const initForm = () => ({
    address: '', // 位置
@@ -185,10 +183,22 @@
    visible1.value = false
}
async function getLocationName() {
    const tk = import.meta.env.VITE_APP_TDT_TOKEN
    const { latitude, longitude } = tempLocation.value
    const http = axios.create({ withCredentials: false })
    const res = await http({
        url: `https://api.tianditu.gov.cn/geocoder?postStr={'lon':${longitude},'lat':${latitude},'ver':1}&tk=${tk}`,
        method: 'get',
    })
    formData.value.address = res.data.result.formatted_address
}
function handleMapConfirm() {
    if (tempLocation.value.longitude != null && tempLocation.value.latitude != null) {
        formData.value.longitude = tempLocation.value.longitude
        formData.value.latitude = tempLocation.value.latitude
        formData.value.longitude = _.round(tempLocation.value.longitude, 6)
        formData.value.latitude = _.round(tempLocation.value.latitude, 6)
        getLocationName()
    }
    visible1.value = false
}