Browse Source

尝试更换组件EarthMapModal -》<EarthComp />

master
DIAMOND 9 months ago
parent
commit
e660abd872
  1. 233
      src/views/military/modules/earthMap/scene/model/sceneInfo/SenceInfo.vue

233
src/views/military/modules/earthMap/scene/model/sceneInfo/SenceInfo.vue

@ -10,11 +10,13 @@
</a-col> </a-col>
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div>区域名称:</div> <div>区域名称:</div>
<a-input class="inputWidthCss1" v-model:value="subObject.sceneName" placeholder="请输入区域编号名称" :disabled="disable"></a-input> <a-input class="inputWidthCss1" v-model:value="subObject.sceneName" placeholder="请输入区域编号名称"
:disabled="disable"></a-input>
</a-col> </a-col>
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div>区域视距:</div> <div>区域视距:</div>
<a-input-number class="inputWidthCss1" v-model:value="subObject.viewDistance" :disabled="disable" :min="0.5" :step="0.0001"></a-input-number> <a-input-number class="inputWidthCss1" v-model:value="subObject.viewDistance" :disabled="disable" :min="0.5"
:step="0.0001"></a-input-number>
</a-col> </a-col>
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div>区域类型:</div> <div>区域类型:</div>
@ -48,41 +50,59 @@
<div class="centerText">旋转<img :src="locationPng" class="dwImg" @click="mapShow" /></div> <div class="centerText">旋转<img :src="locationPng" class="dwImg" @click="mapShow" /></div>
</a-col> --> </a-col> -->
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div> <div>中心经度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.lon" :disabled="disable" /> </div> <div>
<div> <div>中心纬度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.lat" :disabled="disable" /> </div> <div>中心经度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.lon" :disabled="disable" />
<div> <div>中心高度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.altitude" :disabled="disable" /> </div> </div>
<div>
<div>中心纬度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.lat" :disabled="disable" />
</div>
<div>
<div>中心高度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.altitude" :disabled="disable" />
</div>
</a-col> </a-col>
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div> <div>相机经度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.cameraLon" :disabled="disable" /> </div> <div>
<div> <div>相机纬度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.cameraLat" :disabled="disable" /> </div> <div>相机经度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.cameraLon"
<div> <div>相机高度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.cameraAltitude" :disabled="disable" /> </div> :disabled="disable" />
</div>
<div>
<div>相机纬度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.cameraLat"
:disabled="disable" />
</div>
<div>
<div>相机高度:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.cameraAltitude"
:disabled="disable" />
</div>
</a-col> </a-col>
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div>区域图标:</div> <div>区域图标:</div>
<a-upload <a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
name="avatar" :customRequest="preViewOk" :before-upload="preBeforeUpload" :accept="previewType.toString()"
list-type="picture-card" :disabled="disable">
class="avatar-uploader" <img v-if="preViewUrl" :src="subObject.icon" alt="avatar" class="preViewImg"
:show-upload-list="false" style="width: 102px; height: 102px; object-fit: contain" />
:customRequest="preViewOk"
:before-upload="preBeforeUpload"
:accept="previewType.toString()"
:disabled="disable"
>
<img v-if="preViewUrl" :src="subObject.icon" alt="avatar" class="preViewImg" style="width: 102px; height: 102px; object-fit: contain" />
<div v-else> <div v-else>
<div class="ant-upload-text">上传图标</div> <div class="ant-upload-text">上传图标</div>
</div> </div>
</a-upload> </a-upload>
</a-col> </a-col>
<a-col :span="11" :offset="1"> <a-col :span="11" :offset="1">
<div> <div>相机偏航角:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.rotationX" :disabled="disable" /> </div> <div>
<div> <div>相机俯仰角:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.rotationY" :disabled="disable" /> </div> <div>相机偏航角:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.rotationX"
<div> <div>相机翻转角:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.rotationZ" :disabled="disable" /> </div> :disabled="disable" />
</div>
<div>
<div>相机俯仰角:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.rotationY"
:disabled="disable" />
</div>
<div>
<div>相机翻转角:</div><a-input-number class="inputWidthCss1" v-model:value="subObject.rotationZ"
:disabled="disable" />
</div>
</a-col> </a-col>
</a-row> </a-row>
<EarthMapModal <!-- <EarthMapModal
:visible="mapVisible" :visible="mapVisible"
:enableTile="false" :enableTile="false"
:enablePointer="true" :enablePointer="true"
@ -94,41 +114,59 @@
@checkPosition="checkPosition" @checkPosition="checkPosition"
:hasMoveMethod="subObject && subObject.id ? true : false" :hasMoveMethod="subObject && subObject.id ? true : false"
@moveChinaPosition="moveChinaPosition" @moveChinaPosition="moveChinaPosition"
></EarthMapModal> ></EarthMapModal> -->
<a-modal
title="拾取中心坐标和相机数据"
:visible="mapVisible"
@ok="handleOk"
@cancel="()=> mapVisible = false"
width="60vw"
:destroyOnClose="true"
wrapClassName="EarthMap">
<a-row>
<a-col :span="24">
<EarthComp />
</a-col>
</a-row>
</a-modal>
</div> </div>
</template> </template>
<script setup> <script setup>
import { toRefs, ref, watch, computed, onMounted } from 'vue'; import { toRefs, ref, watch, computed, onMounted } from 'vue';
import locationPng from '@/assets/images/getLocation.png'; import locationPng from '@/assets/images/getLocation.png';
import EarthMapModal from '../MapModel/EarthMapModal.vue'; import EarthMapModal from '../MapModel/EarthMapModal.vue';
import { defHttp } from '@/utils/http/axios'; import { defHttp } from '@/utils/http/axios';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { EditOutlined } from '@ant-design/icons-vue'; import { EditOutlined } from '@ant-design/icons-vue';
import EarthComp from '@/views/earthMap/edit/EarthComp.vue';
// //
const addScene = (params) => { const addScene = (params) => {
return defHttp.post({ url: '/military/msMapScene/add', params: params }, { isTransformResponse: false }); return defHttp.post({ url: '/military/msMapScene/add', params: params }, { isTransformResponse: false });
}; };
// //
const editScene = (params) => { const editScene = (params) => {
return defHttp.put({ url: '/military/msMapScene/edit', params: params }, { isTransformResponse: false }); return defHttp.put({ url: '/military/msMapScene/edit', params: params }, { isTransformResponse: false });
}; };
// //
const getSceneType = () => { const getSceneType = () => {
return defHttp.get({ url: '/sys/dict/getDictItems/SceneType' }, { isTransformResponse: false }); return defHttp.get({ url: '/sys/dict/getDictItems/SceneType' }, { isTransformResponse: false });
}; };
// //
const fileUpload = (file) => { const fileUpload = (file) => {
return defHttp.post({ url: '/sys/common/upload', params: file }, { isTransformResponse: false }); return defHttp.post({ url: '/sys/common/upload', params: file }, { isTransformResponse: false });
}; };
// //
const props = defineProps(['subObject', 'parentCodeArr', 'nextNodeIndex', 'parentNodeCode', 'disable']); const props = defineProps(['subObject', 'parentCodeArr', 'nextNodeIndex', 'parentNodeCode', 'disable']);
// ref // ref
const { parentCodeArr, nextNodeIndex, parentNodeCode, subObject, disable } = toRefs(props); const { parentCodeArr, nextNodeIndex, parentNodeCode, subObject, disable } = toRefs(props);
const emit = defineEmits(['closeWin', 'updateDataSource']); const emit = defineEmits(['closeWin', 'updateDataSource']);
const sceneTypes = ref([]); const sceneTypes = ref([]);
// //
const createCode = function () { const createCode = function () {
if (!nextNodeIndex.value) { if (!nextNodeIndex.value) {
return; return;
} }
@ -146,9 +184,9 @@
sceneId = currentCode; sceneId = currentCode;
} }
return sceneId; return sceneId;
}; };
// //
const handleOk = function () { const handleOk = function () {
if (!subObject.value.sceneName || subObject.value.sceneName.length <= 0) { if (!subObject.value.sceneName || subObject.value.sceneName.length <= 0) {
message.warn('区域名称不能为空!'); message.warn('区域名称不能为空!');
return; return;
@ -170,41 +208,41 @@
} }
}); });
} }
}; };
// //
onMounted(async () => { onMounted(async () => {
sceneTypes.value = await getSceneType().then((response) => { sceneTypes.value = await getSceneType().then((response) => {
if (response.success) { if (response.success) {
return response.result; return response.result;
} }
}); });
}); });
// //
const moveChinaPosition = function () { const moveChinaPosition = function () {
// console.log('moveChinaPosition',subObject.value); // console.log('moveChinaPosition',subObject.value);
window.earth.camera.fov = subObject.value.viewDistance; window.earth.camera.fov = subObject.value.viewDistance;
// window.earth.camera.position = [subObject.value.lon, subObject.value.lat, subObject.value.altitude]; // window.earth.camera.position = [subObject.value.lon, subObject.value.lat, subObject.value.altitude];
// //
window.earth.camera.position = [subObject.value.cameraLon, subObject.value.cameraLat, subObject.value.cameraAltitude]; window.earth.camera.position = [subObject.value.cameraLon, subObject.value.cameraLat, subObject.value.cameraAltitude];
window.earth.camera.rotation = [subObject.value.rotationX, subObject.value.rotationY, subObject.value.rotationZ]; window.earth.camera.rotation = [subObject.value.rotationX, subObject.value.rotationY, subObject.value.rotationZ];
}; };
// const stop = watch( // const stop = watch(
// visible, (value, oldValue) => { // visible, (value, oldValue) => {
// if (value) { // if (value) {
// initMap() // initMap()
// stop(); // stop();
// } // }
// } // }
// ) // )
// //
const mapVisible = ref(false); const mapVisible = ref(false);
const mapShow = function () { const mapShow = function () {
mapVisible.value = true; mapVisible.value = true;
}; };
// //
const checkPosition = function (position, cameraPosition, rotation, fov) { const checkPosition = function (position, cameraPosition, rotation, fov) {
subObject.value.lon = position[0]; subObject.value.lon = position[0];
subObject.value.lat = position[1]; subObject.value.lat = position[1];
subObject.value.altitude = position[2]; subObject.value.altitude = position[2];
@ -218,9 +256,9 @@
subObject.value.rotationZ = rotation[2]; subObject.value.rotationZ = rotation[2];
subObject.value.viewDistance = fov; subObject.value.viewDistance = fov;
}; };
// //
const preViewUrl = computed({ const preViewUrl = computed({
get: () => { get: () => {
return subObject.value.icon; return subObject.value.icon;
}, },
@ -235,9 +273,9 @@
subObject.value.icon = null; subObject.value.icon = null;
} }
}, },
}); });
// //
const preViewOk = function (fileInfo) { const preViewOk = function (fileInfo) {
const file = fileInfo.file; const file = fileInfo.file;
let formData = new FormData(); let formData = new FormData();
formData.append('file', file); formData.append('file', file);
@ -260,11 +298,11 @@
.catch(() => { .catch(() => {
message.error('上传失败!'); message.error('上传失败!');
}); });
}; };
// //
const previewType = ref(['.jpg', '.png', '.icon']); const previewType = ref(['.jpg', '.png', '.icon']);
// //
const preBeforeUpload = function (file) { const preBeforeUpload = function (file) {
const fileName = file.name; const fileName = file.name;
const fileType = fileName.substring(fileName.lastIndexOf('.'), fileName.length).toLowerCase(); const fileType = fileName.substring(fileName.lastIndexOf('.'), fileName.length).toLowerCase();
let isFileType = false; let isFileType = false;
@ -278,36 +316,35 @@
message.error('上传文件类型异常'); message.error('上传文件类型异常');
} }
return isFileType; return isFileType;
}; };
// //
defineExpose({ defineExpose({
preViewUrl, preViewUrl,
handleOk, handleOk,
createCode, createCode,
}); });
</script> </script>
<style scoped> <style scoped>
.inputWidthCss1 { .inputWidthCss1 {
width: 90%; width: 90%;
} }
.centerText { .centerText {
width: 100%; width: 100%;
font-weight: bold; font-weight: bold;
line-height: 1.8rem; line-height: 1.8rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.dwImg { .dwImg {
width: 10%; width: 10%;
height: 10%; height: 10%;
margin-left: 3%; margin-left: 3%;
cursor: pointer !important; cursor: pointer !important;
} }
:deep(.ant-select) { :deep(.ant-select) {
width: 90%; width: 90%;
} }</style>
</style>

Loading…
Cancel
Save