| | |
| | | <script setup> |
| | | import { ElMessage } from 'element-plus'; |
| | | import { ref, onMounted, defineExpose } from "vue"; |
| | | |
| | | import { getCrossSection } from '@/api/trApi.js'; // 假设你有真实接口 |
| | | import { useSimStore } from '@/store/simulation'; |
| | | import { storeToRefs } from 'pinia'; |
| | | const simStore = useSimStore(); |
| | | const { selectedScheme } = storeToRefs(simStore); |
| | | const viewer = window.viewer; |
| | | let selectedSchemeId = selectedScheme.value.id |
| | | |
| | | let pickedPointsCross = ref([]); |
| | | let pickHandlerCross = null; |
| | |
| | | pickHandlerCross = null; |
| | | } |
| | | isPicking.value = false; |
| | | console.log('这里发送请求,清空郭楠的echarts2'); |
| | | |
| | | } |
| | | function initPickHandler() { |
| | | if (isPicking.value) { |
| | |
| | | |
| | | pickHandlerCross.setInputAction(clickAction, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | } |
| | | function confirmPoints() { |
| | | async function confirmPoints() { |
| | | console.log(selectedSchemeId,'这里拿的是方案的数据'); |
| | | |
| | | if (pickedPointsCross.value.length < 2) { |
| | | ElMessage.warning('请先选择两个点后再进行确认!'); |
| | | return; |
| | |
| | | |
| | | const point1 = pickedPointsCross.value[0]; |
| | | const point2 = pickedPointsCross.value[1]; |
| | | console.log(point1,point2); |
| | | |
| | | console.log('第一个点信息:', { |
| | | longitude: point1.longitude, |
| | |
| | | latitude: point2.latitude, |
| | | cartesian: point2.cartesian |
| | | }); |
| | | |
| | | const startPoint = `${point1.longitude},${point1.latitude}`; |
| | | const endPoint = `${point2.longitude},${point2.latitude}`; |
| | | const result = await getCrossSectionInfo(startPoint, endPoint); |
| | | console.log(result,'这里是郭楠需要的断面数据'); |
| | | |
| | | isUploaded.value = true; |
| | | ElMessage.success('正在进行--断面截面--数据分析上传,请稍等...'); |
| | | |
| | | } |
| | | |
| | | // 获取真实数据 |
| | | function getCrossSectionInfo(a, b) { |
| | | const params = { |
| | | startPoint: a, |
| | | endPoint: b, |
| | | id: selectedSchemeId |
| | | }; |
| | | return getCrossSection(params).then(data => { |
| | | if (data && data.code === 200) { |
| | | return data.data; // 返回原始数据数组 |
| | | } else { |
| | | return []; |
| | | } |
| | | }).catch(error => { |
| | | console.error('获取数据时发生错误:', error); |
| | | ElMessage.warning('数据有误,请联系管理员或重新进行模拟!'); |
| | | return []; |
| | | }); |
| | | } |
| | | defineExpose({ |
| | | clearPoints |
| | | }); |