| | |
| | | * @Author: 胡思旗 931347610@qq.com |
| | | * @Date: 2023-08-22 17:50:30 |
| | | * @LastEditors: husq 931347610@qq.com |
| | | * @LastEditTime: 2023-09-05 17:28:28 |
| | | * @LastEditTime: 2023-09-07 16:45:18 |
| | | * @FilePath: \Cloud-API-Demo-Web\src\components\cesiumMap\cesium.vue |
| | | * @Description: |
| | | * |
| | | * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. |
| | | --> |
| | | <template> |
| | | <div class="height-100 width-100 cesium" id="cesiumContainer" @click="getCoordinate"></div> |
| | | <div class="height-100 width-100 cesium" id="cesiumContainer"></div> |
| | | <div v-if="centerConfig.type && !centerConfig.latitude" class="pointLongitude">在地图上点击绘制项目中心点</div> |
| | | </template> |
| | | |
| | |
| | | }) |
| | | viewer.value?.imageryLayers.addImageryProvider(annotation) |
| | | } |
| | | // 获取地图点击坐标 |
| | | const getCoordinate = () => { |
| | | if (!centerConfig.value.type) return |
| | | let longitude: number, latitude: number |
| | | viewer.value?.screenSpaceEventHandler.setInputAction((e: any) => { |
| | | const cartesian = viewer.value?.camera.pickEllipsoid(e.position, viewer.value?.scene.globe.ellipsoid) |
| | | if (cartesian) { |
| | | const cartographic = Cesium.Cartographic.fromCartesian(cartesian) |
| | | longitude = Cesium.Math.toDegrees(cartographic.longitude) |
| | | latitude = Cesium.Math.toDegrees(cartographic.latitude) |
| | | const data = { |
| | | longitude, |
| | | latitude, |
| | | } |
| | | store.commit('SET_CENTER_CONFIG_LATITUDE', data) |
| | | } |
| | | Point(longitude, latitude) |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK) |
| | | } |
| | | const Point = (longitude: number, latitude: number) => { |
| | | // 移除地图所有点 重新绘制 |
| | | viewer.value?.entities.removeAll() |
| | | const entity = viewer.value?.entities.add({ |
| | | position: Cesium.Cartesian3.fromDegrees(longitude, latitude), |
| | | point: { |
| | | pixelSize: 10, |
| | | color: Cesium.Color.YELLOW |
| | | pixelSize: 24, |
| | | color: Cesium.Color.GREEN, |
| | | outlineColor: Cesium.Color.WHITE, |
| | | outlineWidth: 2, |
| | | } |
| | | }) |
| | | // // 将相机定位到标记点的位置 |
| | |
| | | } |
| | | // 设置项目中所有的项目中心坐标 |
| | | watch(() => store.state.map.pointList, (newVal, oldVal) => { |
| | | if (newVal && newVal.length > 0) { |
| | | if (newVal) { |
| | | pointCenter(viewer.value, newVal) |
| | | clickPoint(viewer.value, newVal) |
| | | } |
| | | }, { |
| | | deep: true |
| | | }) |
| | | // 点击地图生成项目中心点 |
| | | watch(() => store.state.map.centerConfig.type, (newVal) => { |
| | | const handler = new Cesium.ScreenSpaceEventHandler(viewer.value?.scene.canvas) |
| | | console.log(newVal, 'newVal') |
| | | if (newVal === false) { |
| | | viewer.value?.entities.removeAll() |
| | | console.log('===false===') |
| | | handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK) |
| | | } else { |
| | | console.log('===true===') |
| | | handler.setInputAction(function (e: any) { |
| | | const cartesian = viewer.value?.camera.pickEllipsoid(e.position, viewer.value?.scene.globe.ellipsoid) |
| | | if (cartesian) { |
| | | const cartographic = Cesium.Cartographic.fromCartesian(cartesian) |
| | | const longitude = Cesium.Math.toDegrees(cartographic.longitude) |
| | | const latitude = Cesium.Math.toDegrees(cartographic.latitude) |
| | | const data = { |
| | | longitude, |
| | | latitude, |
| | | } |
| | | store.commit('SET_CENTER_CONFIG_LATITUDE', data) |
| | | console.log(data, 'data') |
| | | Point(longitude, latitude) |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK |
| | | ) |
| | | } |
| | | }, { |
| | | deep: true |
| | | }) |
| | | onMounted(() => { |
| | | init() |
| | | }) |
| | |
| | | import * as Cesium from 'cesium' |
| | | // 绘制项目所有中心点 |
| | | export function pointCenter (viewer: any, longitudeList: any) { |
| | | // 删除地图中所有标识点 |
| | | viewer.entities.removeAll() |
| | | if (longitudeList.length === 0) return |
| | | longitudeList.forEach((item: { id:string, longitude: number; latitude: number, label: string }) => { |
| | | addPoint(viewer, item.id, item.longitude, item.latitude, item.label) |
| | | }) |
| | |
| | | } |
| | | } |
| | | , Cesium.ScreenSpaceEventType.LEFT_CLICK) |
| | | handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK) |
| | | } |
| | |
| | | |
| | | const onSubmit = async (e: any) => { |
| | | const password = encrypt(formState.password) |
| | | root.$router.push(ERouterName.PROJECT_LIST) |
| | | // const result = await login({ ...formState, password }) |
| | | // if (result.success) { |
| | | // localStorage.setItem(ELocalStorageKey.Token, result.data.token) |
| | | // localStorage.setItem(ELocalStorageKey.Username, result.data.user.username) |
| | | // localStorage.setItem(ELocalStorageKey.UserInfo, JSON.stringify(result.data.user)) |
| | | // } |
| | | const result = await login({ ...formState, password }) |
| | | if (result.success) { |
| | | localStorage.setItem(ELocalStorageKey.Token, result.data.token) |
| | | localStorage.setItem(ELocalStorageKey.Username, result.data.user.username) |
| | | localStorage.setItem(ELocalStorageKey.UserInfo, JSON.stringify(result.data.user)) |
| | | root.$router.push(ERouterName.PROJECT_LIST) |
| | | } |
| | | } |
| | | |
| | | </script> |
| | |
| | | * @Author: 胡思旗 931347610@qq.com |
| | | * @Date: 2023-08-28 15:23:47 |
| | | * @LastEditors: husq 931347610@qq.com |
| | | * @LastEditTime: 2023-09-05 10:17:17 |
| | | * @LastEditTime: 2023-09-08 09:14:02 |
| | | * @FilePath: \Cloud-API-Demo-Web\src\pages\page-web\projects\project_list\list_page\components\ProjectList.vue |
| | | * @Description:项目列表组件 |
| | | * |
| | |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <div class="enter"> |
| | | <div class="enter" @click="goDetail(item)"> |
| | | <export-outlined /> |
| | | </div> |
| | | </div> |
| | |
| | | }) |
| | | } |
| | | |
| | | const goDetail = (item: any) => { |
| | | console.log(11) |
| | | router.push({ |
| | | name: ERouterName.WORKSPACE, |
| | | query: { id: item.id } |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | |
| | | id: item.id |
| | | } |
| | | }) |
| | | console.log(longitudeList, 'longitudeList') |
| | | store.commit('SET_POINT_LIST', longitudeList) |
| | | console.log(store.state.map.pointList, '=============') |
| | | spinning.value = false |
| | | } |
| | | onMounted(() => { |
| | |
| | | <div> |
| | | <a-row> |
| | | <a-col :span="1"></a-col> |
| | | <a-col :span="11">My Username</a-col> |
| | | <a-col :span="11">我的项目呼号</a-col> |
| | | <a-col :span="11" align="right" style="font-weight: 700">{{ username }}</a-col> |
| | | <a-col :span="1"></a-col> |
| | | </a-row> |
| | | </div> |
| | | <div class="scrollbar" :style="{ height: scorllHeight + 'px'}"> |
| | | <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;"> |
| | | <a-collapse-panel :key="EDeviceTypeName.Dock" header="Dock" style="border-bottom: 1px solid #4f4f4f;"> |
| | | <a-collapse-panel :key="EDeviceTypeName.Dock" header="机场" style="border-bottom: 1px solid #4f4f4f;"> |
| | | <div v-if="onlineDocks.data.length === 0" style="height: 150px; color: white;"> |
| | | <a-empty :image="noData" :image-style="{ height: '60px' }" /> |
| | | <a-empty style="color: #fff;" :image="simpleImage" description="暂无数据" :image-style="{ height: '60px' }" /> |
| | | </div> |
| | | <div v-else class="fz12" style="color: white;"> |
| | | <div v-for="dock in onlineDocks.data" :key="dock.sn" style="background: #3c3c3c; height: 90px; width: 250px; margin-bottom: 10px;"> |
| | |
| | | </a-collapse-panel> |
| | | </a-collapse> |
| | | <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;"> |
| | | <a-collapse-panel :key="EDeviceTypeName.Aircraft" header="Online Devices" style="border-bottom: 1px solid #4f4f4f;"> |
| | | <a-collapse-panel :key="EDeviceTypeName.Aircraft" header="在线设备" style="border-bottom: 1px solid #4f4f4f;"> |
| | | <div v-if="onlineDevices.data.length === 0" style="height: 150px; color: white;"> |
| | | <a-empty :image="noData" :image-style="{ height: '60px' }" /> |
| | | <a-empty :image="simpleImage" style="color: #fff;" description="暂无数据" :image-style="{ height: '60px' }" /> |
| | | </div> |
| | | <div v-else class="fz12" style="color: white;"> |
| | | <div v-for="device in onlineDevices.data" :key="device.sn" style="background: #3c3c3c; height: 90px; width: 250px; margin-bottom: 10px;"> |
| | |
| | | import { computed, onMounted, reactive, ref, watch, WritableComputedRef } from 'vue' |
| | | import { EDeviceTypeName, ELocalStorageKey } from '/@/types' |
| | | import noData from '/@/assets/icons/no-data.png' |
| | | import { Empty } from 'ant-design-vue' |
| | | import rc from '/@/assets/icons/rc.png' |
| | | import { OnlineDevice, EModeCode, OSDVisible, EDockModeCode, DeviceOsd } from '/@/types/device' |
| | | import { useMyStore } from '/@/store' |
| | | import { getDeviceTopo, getUnreadDeviceHms, updateDeviceHms } from '/@/api/manage' |
| | | import { RocketOutlined, EyeInvisibleOutlined, EyeOutlined, RobotOutlined, DoubleRightOutlined } from '@ant-design/icons-vue' |
| | | import { EHmsLevel } from '/@/types/enums' |
| | | |
| | | const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE |
| | | const store = useMyStore() |
| | | const username = ref(localStorage.getItem(ELocalStorageKey.Username)) |
| | | const workspaceId = ref(localStorage.getItem(ELocalStorageKey.WorkspaceId)!) |
| | |
| | | }) |
| | | |
| | | const onlineDocks = reactive({ |
| | | data: [] as OnlineDevice[] |
| | | data: [ |
| | | { |
| | | model: '我是model字段', |
| | | callsign: '我是callsign字段', |
| | | sn: '我是sn字段', |
| | | mode: '我是mode字段', |
| | | gateway: { |
| | | model: '我是gateway.model字段', |
| | | callsign: '我是gateway.callsign字段', |
| | | sn: '我是gateway.sn字段', |
| | | mode: '我是gateway.mode字段', |
| | | }, |
| | | payload: [ |
| | | { |
| | | index: 1, |
| | | model: '2', |
| | | control_source: 'A', |
| | | payload_sn: 'payload_sn', |
| | | payload_index: 'payload_index', |
| | | payload_name: 'payload_name', |
| | | }, |
| | | ] |
| | | }, |
| | | ] as unknown as OnlineDevice[] |
| | | }) |
| | | |
| | | const deviceInfo = computed(() => store.state.deviceState.deviceInfo) |