Files
td_official/src/views/gisHome/component/map.vue
2025-06-19 19:58:33 +08:00

69 lines
1.2 KiB
Vue

<template>
<div class="ol-map" id="olMap"></div>
</template>
<script setup>
import { workScheduleDel } from '@/api/progress/plan';
import { renderFacilitiesToCesium } from '@/views/gisHome/js/renderFacilities';
let sdk = null;
const initFacilities = async () => {
const res = await workScheduleDel('1933358821565095951');
console.log(res);
renderFacilitiesToCesium(sdk.viewer, res.data);
};
// 初始化 Cesium 地球
const createEarth = () => {
sdk = new YJ.YJEarth('olMap');
YJ.Global.setDefaultView(sdk, {
destination: { lng: 100, lat: 30, alt: 22099000 },
orientation: {
heading: 0.0,
pitch: -90.0,
roll: 0.0
}
});
new YJ.Obj.ArcgisWXImagery(sdk, {
show: true,
layer_index: 1
});
YJ.Global.CesiumContainer(sdk, {
compass: false
});
new YJ.Tools(sdk).flyHome(0);
};
onMounted(async () => {
// 最早执行
window.CESIUM_BASE_URL = '/Cesium/';
await YJ.on();
createEarth();
await initFacilities();
console.log(YJ);
});
</script>
<style lang="scss" scoped>
@import '../css/gis.scss';
.ol-map {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: calc(100vh);
}
.btn {
position: absolute;
top: 20px;
left: 20px;
z-index: 10;
}
</style>