diff --git a/package-lock.json b/package-lock.json index 5b9135d15..b5c2eb5cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "pinia": "^2.0.28", "satellite.js": "^5.0.0", "seemly": "^0.3.9", + "store2": "^2.14.4", "v-viewer": "^3.0.21", "vanilla-js-wheel-zoom": "^9.0.4", "viewerjs": "^1.11.7", @@ -14465,6 +14466,12 @@ "integrity": "sha512-0kGecIZNIReCSiznK3uheYB8sbstLjCZLiwcQwbmLhgHJj2gz6OnSPkVzJQCMnmEz1BQ4gPK59ylhBoEWOhGNA==", "license": "BDS-3-Clause" }, + "node_modules/store2": { + "version": "2.14.4", + "resolved": "https://registry.npmmirror.com/store2/-/store2-2.14.4.tgz", + "integrity": "sha512-srTItn1GOvyvOycgxjAnPA63FZNwy0PTyUBFMHRM+hVFltAeoh0LmNBz9SZqUS9mMqGk8rfyWyXn3GH5ReJ8Zw==", + "license": "MIT" + }, "node_modules/stream-source": { "version": "0.3.5", "resolved": "https://registry.npmmirror.com/stream-source/-/stream-source-0.3.5.tgz", diff --git a/package.json b/package.json index 9466a88c9..ce79c347f 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "pinia": "^2.0.28", "satellite.js": "^5.0.0", "seemly": "^0.3.9", + "store2": "^2.14.4", "v-viewer": "^3.0.21", "vanilla-js-wheel-zoom": "^9.0.4", "viewerjs": "^1.11.7", diff --git a/public/images/影像.jpg b/public/images/影像.jpg new file mode 100644 index 000000000..826894c96 Binary files /dev/null and b/public/images/影像.jpg differ diff --git a/src/api/Gantt/index.js b/src/api/Gantt/index.js index e16a546ce..6ef4b5807 100644 --- a/src/api/Gantt/index.js +++ b/src/api/Gantt/index.js @@ -1,44 +1,162 @@ +const sub = [ + { + id: 0, + name: 'DD', + // start: '2024-11-15', + // end: '2024-11-21', + type: 'eventType', + children: [ + { + id: 1, + name: '发射事件', + start: '2024-11-15', + end: '2024-11-17', + type: 'subEvent', + trajData: {}, + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', + }, + ], + }, + { + id: 300, + name: '飞机', + type: 'eventType', + children: [ + { + id: 5, + name: '起飞', + start: '2024-11-18', + end: '2024-11-21', + type: 'subEvent', + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/rabbit.jpg', + }, + ], + }, + { + name: '舰船', + type: 'eventType', + children: [ + { + id: 6, + name: '停留', + start: '2024-11-20', + end: '2024-11-22', + type: 'subEvent', + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/cat.jpg', + }, + { + id: 7, + name: '扫描', + start: '2024-11-18', + end: '2024-11-19', + type: 'subEvent', + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/flower.jpg', + }, + ], + }, + + { + name: '航J', + type: 'eventType', + children: [ + { + id: 8, + name: '航J事件', + start: '2024-11-20', + end: '2024-11-21', + type: 'subEvent', + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bear.jpg', + }, + { + id: 9, + name: '航J事件-2', + start: '2024-11-22', + end: '2024-11-26', + type: 'subEvent', + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', + }, + ], + }, + { + name: 'xx', + type: 'eventType', + children: [ + { + id: 13, + name: 'xx-事件-1', + start: '2024-11-22', + end: '2024-11-25', + type: 'subEvent', + + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/rabbit.jpg', + }, + { + id: 14, + name: 'xx-事件-2', + start: '2024-11-27', + end: '2024-11-30', + type: 'subEvent', + avatar: + 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/cat.jpg', + }, + ], + }, +] + const main = [ { id: 0, name: 'DD-1', start: '2024-11-15', end: '2024-11-21', + type: 'dd', children: [ { id: 1, - name: 'DD', + name: '事件1-1', start: '2024-11-15', end: '2024-11-17', - children: [ - { - id: 122, - name: '发射', - start: '2024-11-15', - end: '2024-11-17', - type: 'DD', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', - }, - ], + type: 'mainEvent', + // children: [ + // { + // id: 122, + // name: '发射', + // start: '2024-11-15', + // end: '2024-11-17', + // type: 'DD', + // avatar: + // 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', + // }, + // ], + children: sub, }, { id: 2, - name: '飞机', + name: '事件1-2', start: '2024-11-17', end: '2024-11-18', + type: 'mainEvent', }, { id: 3, - name: '船', + name: '事件1-3', start: '2024-11-19', end: '2024-11-20', + type: 'mainEvent', }, { id: 4, - name: 'H景', + name: '事件1-4', start: '2024-11-18', end: '2024-11-19', + type: 'mainEvent', }, ], }, @@ -51,6 +169,7 @@ const main = [ name: '事件-2-1', start: '2024-11-18', end: '2024-11-21', + type: 'mainEvent', }, ], }, @@ -62,12 +181,14 @@ const main = [ name: '事件-3-1', start: '2024-11-21', end: '2024-11-22', + type: 'mainEvent', }, { id: 7, name: '事件-3-2', start: '2024-11-18', end: '2024-11-19', + type: 'mainEvent', }, ], }, @@ -80,30 +201,35 @@ const main = [ name: '事件-4-1', start: '2024-11-20', end: '2024-11-21', + type: 'mainEvent', }, { id: 9, name: '事件-4-2', start: '2024-11-25', end: '2024-11-26', + type: 'mainEvent', }, { id: 10, name: '事件-4-3', start: '2024-11-17', end: '2024-11-18', + type: 'mainEvent', }, { id: 11, name: '事件-4-4', start: '2024-11-22', end: '2024-11-25', + type: 'mainEvent', }, { id: 12, name: '事件-4-5', start: '2024-11-23', end: '2024-11-24', + type: 'mainEvent', }, ], }, @@ -115,18 +241,21 @@ const main = [ name: '事件-5-1', start: '2024-11-22', end: '2024-11-25', + type: 'mainEvent', }, { id: 14, name: '事件-5-2', start: '2024-11-27', end: '2024-11-30', + type: 'mainEvent', }, { id: 15, name: '事件-5-3', start: '2024-12-10', end: '2024-12-18', + type: 'mainEvent', }, ], }, @@ -138,12 +267,14 @@ const main = [ name: '事件-6-1', start: '2024-11-20', end: '2024-11-30', + type: 'mainEvent', }, { id: 17, name: '事件-6-2', start: '2024-12-02', end: '2024-12-18', + type: 'mainEvent', }, ], }, @@ -155,6 +286,7 @@ const main = [ name: '事件-7-1', start: '2024-12-22', end: '2024-12-28', + type: 'mainEvent', }, ], }, @@ -166,134 +298,14 @@ const main = [ name: '事件-8-1', start: '2024-11-25', end: '2024-11-30', + type: 'mainEvent', }, { id: 20, name: '事件-8-2', start: '2024-12-01', end: '2024-12-18', - }, - ], - }, -] - -const sub = [ - { - id: 0, - name: 'DD', - start: '2024-11-15', - end: '2024-11-21', - children: [ - { - id: 1, - name: '发射', - start: '2024-11-15', - end: '2024-11-17', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', - }, - { - id: 2, - name: '脱离-1', - start: '2024-11-17', - end: '2024-11-18', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bear.jpg', - }, - { - id: 3, - name: '脱离-2', - start: '2024-11-19', - end: '2024-11-20', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bear.jpg', - }, - { - id: 4, - name: '落地', - start: '2024-11-21', - end: '2024-11-21', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', - }, - ], - }, - { - id: 300, - name: '飞机', - children: [ - { - id: 5, - name: '起飞', - start: '2024-11-18', - end: '2024-11-21', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/rabbit.jpg', - }, - ], - }, - { - name: '舰船', - children: [ - { - id: 6, - name: '停留', - start: '2024-11-21', - end: '2024-11-22', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/cat.jpg', - }, - { - id: 7, - name: '扫描', - start: '2024-11-18', - end: '2024-11-19', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/flower.jpg', - }, - ], - }, - - { - name: '航J', - children: [ - { - id: 8, - name: '航J事件', - start: '2024-11-20', - end: '2024-11-21', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/bear.jpg', - }, - { - id: 9, - name: '航J事件-2', - start: '2024-11-25', - end: '2024-11-26', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/wolf.jpg', - }, - ], - }, - { - name: 'xx', - children: [ - { - id: 13, - name: 'xx-事件-1', - start: '2024-11-22', - end: '2024-11-25', - - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/rabbit.jpg', - }, - { - id: 14, - name: 'xx-事件-2', - start: '2024-11-27', - end: '2024-11-30', - avatar: - 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/cat.jpg', + type: 'mainEvent', }, ], }, @@ -312,7 +324,15 @@ export function getMainGantt(data = {}) { return new Promise((resolve, reject) => { setTimeout(() => { resolve(main) - }, 1000) + }, 200) + }) +} + +export function getEventListByDDType(ddType) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(main.find(item => item.name === ddType)) + }, 200) }) } @@ -320,7 +340,7 @@ export function getSubGantt(subId) { return new Promise((resolve, reject) => { setTimeout(() => { resolve(sub) - }, 1000) + }, 200) }) } @@ -328,6 +348,6 @@ export function getTask() { return new Promise((resolve, reject) => { setTimeout(() => { resolve(task) - }, 1000) + }, 200) }) } diff --git a/src/assets/naiveui.css b/src/assets/naiveui.css index 82b997e57..ad15f8a49 100644 --- a/src/assets/naiveui.css +++ b/src/assets/naiveui.css @@ -100,4 +100,11 @@ #textMsgContainer .n-alert { height: 100%; + .n-base-close.n-alert__close { + z-index: inherit; + } +} + +.n-dialog { + @apply bg-[#1c202cee]; } diff --git a/src/hooks/entity.ts b/src/hooks/entity.ts index 78b2f8cad..b41eccf9c 100644 --- a/src/hooks/entity.ts +++ b/src/hooks/entity.ts @@ -13,6 +13,8 @@ export const useEntity = () => { getMBEntityOpt, iconOrModel, changeIconOrModel, + showOrHideLoad, + changeShowOrHideLoad, } } @@ -104,7 +106,7 @@ function getMBEntityOpt({ minimumPixelSize: 50, }, ellipsoid: { - show: true, + show: showOrHideLoad.value, radii: new Cesium.Cartesian3(100000, 100000, 100000), innerRadii: new Cesium.Cartesian3(1.0, 1.0, 1.0), maximumCone: Cesium.Math.toRadians(90), @@ -133,3 +135,16 @@ function changeIconOrModel() { entity.billboard.show = !entity.billboard.show._value }) } + +const showOrHideLoad = ref(true) + +function changeShowOrHideLoad() { + showOrHideLoad.value = !showOrHideLoad.value + ;[...mubiaoMap.values()].forEach(entity => { + entity.ellipsoid.show = !entity.ellipsoid.show._value + }) + ;[...satelliteMap.values()].forEach(satellite => { + satellite.sensor = showOrHideLoad.value + console.log(satellite) + }) +} diff --git a/src/hooks/measure.ts b/src/hooks/measure.ts index 0a492777f..ef10c2cde 100644 --- a/src/hooks/measure.ts +++ b/src/hooks/measure.ts @@ -14,7 +14,7 @@ function distanceMeasure() { //贴地测量距离函数 // var terrainProvider = this.terrainProvider - // viewer.scene.globe.depthTestAgainstTerrain = true + viewer.scene.globe.depthTestAgainstTerrain = true handler = new Cesium.ScreenSpaceEventHandler( viewer.scene._imageryLayerCollection @@ -78,6 +78,7 @@ function distanceMeasure() { // tooltip.style.display = "none"; bMeasuring = false viewer._container.style.cursor = '' + viewer.scene.globe.depthTestAgainstTerrain = false }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) const PolyLinePrimitive = (function () { @@ -180,7 +181,7 @@ function distanceMeasure() { }, label: { text: textDistance, - font: '18px sans-serif', + font: '14px sans-serif', fillColor: Cesium.Color.GOLD, style: Cesium.LabelStyle.FILL_AND_OUTLINE, outlineWidth: 2, @@ -205,11 +206,11 @@ function angleMeasure() { let floatingPoint //浮动点 handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas) handler.setInputAction(function (movement) { - let cartesian = viewer.scene.pickPosition(movement.endPosition) - if (!Cesium.defined(cartesian)) { - const ray = viewer.camera.getPickRay(movement.endPosition) - cartesian = viewer.scene.globe.pick(ray, viewer.scene) - } + // let cartesian = viewer.scene.pickPosition(movement.endPosition) + // if (!Cesium.defined(cartesian)) { + const ray = viewer.camera.getPickRay(movement.endPosition) + let cartesian = viewer.scene.globe.pick(ray, viewer.scene) + // } //cartesian = viewer.scene.camera.pickEllipsoid(movement.endPosition, viewer.scene.globe.ellipsoid); if (distanceLineNum === 1) { pArr.length = 1 @@ -219,13 +220,13 @@ function angleMeasure() { } }, Cesium.ScreenSpaceEventType.MOUSE_MOVE) handler.setInputAction(function (movement) { - let cartesian = viewer.scene.pickPosition(movement.position) + // let cartesian = viewer.scene.pickPosition(movement.position) // console.log('cartesian', cartesian32LonLat(cartesian)) - if (!Cesium.defined(cartesian)) { - // console.log('false') - const ray = viewer.camera.getPickRay(movement.position) - cartesian = viewer.scene.globe.pick(ray, viewer.scene) - } + // if (!Cesium.defined(cartesian)) { + // console.log('false') + const ray = viewer.camera.getPickRay(movement.position) + let cartesian = viewer.scene.globe.pick(ray, viewer.scene) + // } // var cartesian = viewer.scene.pickPosition(movement.position); distanceLineNum++ @@ -351,12 +352,10 @@ function angleMeasure() { text: '角度:' + angle + '°\n距离:' + textDistance, // scaleByDistance: new Cesium.NearFarScalar(7000000, 1.0, 18000000, 0.4), // translucencyByDistance: new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e5, 0), - font: '24px 楷体', - fillColor: Cesium.Color.WHITE, - outlineColor: Cesium.Color.BLACK, + font: '14px sans-serif', + fillColor: Cesium.Color.GOLD, style: Cesium.LabelStyle.FILL_AND_OUTLINE, outlineWidth: 2, - scale: 0.5, pixelOffset: new Cesium.Cartesian2(0, -20), disableDepthTestDistance: Number.POSITIVE_INFINITY, backgroundColor: new Cesium.Color.fromCssColorString( diff --git a/src/js/satelliteEntity.js b/src/js/satelliteEntity.js index ec3074bd9..1d1b9a298 100644 --- a/src/js/satelliteEntity.js +++ b/src/js/satelliteEntity.js @@ -43,6 +43,10 @@ class SatelliteEntity { } else if (this._sensorType === 'rectangle') { this.createRectangleSensor(this.entity) } + } else { + // if(this.sensorEntity) { + this.removeSensor() + // } } } @@ -356,6 +360,9 @@ class SatelliteEntity { }) this._listener = (scene, time) => { + if (!this.sensorEntity) { + return + } conicSensor.show = false let position = Cesium.Property.getValueOrUndefined( satellite.position, @@ -485,6 +492,8 @@ class SatelliteEntity { viewer.scene.primitives.remove(this.sensorEntity) } this.sensorEntity = null + viewer.scene.preRender.addEventListener(this._listener) + this._listener = null } } destroy() { diff --git a/src/utils/tree.js b/src/utils/tree.js index 3be75fa16..54a08bf86 100644 --- a/src/utils/tree.js +++ b/src/utils/tree.js @@ -1,6 +1,7 @@ export const useTree = () => { return { filterTreeNodeByField, + getAllKeys, } } @@ -22,3 +23,16 @@ function filterTreeNodeByField({ treeData, params, paramName, icon = '' }) { return acc }, []) } + +function getAllKeys(treeData, key) { + const data = 'value' in treeData ? treeData.value : treeData + + return data.reduce((acc, node) => { + // console.log(node, '---') + acc.push(node[key]) + if (node.children) { + acc = acc.concat(getAllKeys(node.children, key)) + } + return acc + }, []) +} diff --git a/src/views/BaseMB/components/HisImages/components/LImage.jsx b/src/views/BaseMB/components/HisImages/components/LImage.jsx index 77eac536e..4e2f1272a 100644 --- a/src/views/BaseMB/components/HisImages/components/LImage.jsx +++ b/src/views/BaseMB/components/HisImages/components/LImage.jsx @@ -24,7 +24,7 @@ export default defineComponent({ const wz = WZoom.create(`#image-${image.id}`, { type: 'html', maxScale: 3, - minScale: 0.2, + minScale: 1, // zoomOnDoubleClick: true, width: imageElement.naturalWidth, height: imageElement.naturalHeight, diff --git a/src/views/BaseMB/components/HisImages/index.vue b/src/views/BaseMB/components/HisImages/index.vue index 15901ca0b..ae15bb791 100644 --- a/src/views/BaseMB/components/HisImages/index.vue +++ b/src/views/BaseMB/components/HisImages/index.vue @@ -63,7 +63,7 @@ const getImage = async () => { imageList.value = new Array(10).fill(1).map((item, index) => { return { id: index, - imgPath: `https://picsum.photos/300/200?random=${index}`, + imgPath: `/images/影像.jpg`, imgId: index, } }) diff --git a/src/views/BaseMB/hooks/base.ts b/src/views/BaseMB/hooks/base.ts index e1faf9ff4..97b92b41e 100644 --- a/src/views/BaseMB/hooks/base.ts +++ b/src/views/BaseMB/hooks/base.ts @@ -6,6 +6,7 @@ import { useTree } from '@/utils/tree' import { parseWKT } from '@/utils/parseWKT' import { useBasePopup } from './basePopup' import { useEntity } from '@/hooks/entity' + // import { storeToRefs } from 'pinia' const treeData = ref([]) @@ -18,7 +19,7 @@ const allKeys = ref([]) let subscriber: Subscriber | null = null -const { filterTreeNodeByField } = useTree() +const { filterTreeNodeByField, getAllKeys } = useTree() const { popupMap, createPopup } = useBasePopup() @@ -26,7 +27,7 @@ const isLoading = ref(false) export const useBase = () => { onMounted(async () => { await getSheshiData() - allKeys.value = getAllKeys(treeData.value) + allKeys.value = getAllKeys(treeData.value, 'dataId') }) const addBaseFacilities = (ids: Array) => { subscriber = new Subscriber(viewer, { @@ -221,18 +222,18 @@ function addEventSub( // console.log(subscriber, '-------') } -function getAllKeys(treeData: any) { - const data = 'value' in treeData ? treeData.value : treeData +// function getAllKeys(treeData: any) { +// const data = 'value' in treeData ? treeData.value : treeData - return data.reduce((acc, node) => { - // console.log(node, '---') - acc.push(node.dataId) - if (node.children) { - acc = acc.concat(getAllKeys(node.children)) - } - return acc - }, []) -} +// return data.reduce((acc, node) => { +// // console.log(node, '---') +// acc.push(node.dataId) +// if (node.children) { +// acc = acc.concat(getAllKeys(node.children)) +// } +// return acc +// }, []) +// } function addEntity(data: TBaseNode) { const { id, sheShiName, sheShiType, geom } = data @@ -257,9 +258,11 @@ function addEntity(data: TBaseNode) { 18000000, 0.4 ), + // eyeOffset: new Cesium.Cartesian3(0.0, 20000.0, 0.0), scaleByDistance: new Cesium.NearFarScalar(7000000, 1.0, 18000000, 0.4), - disableDepthTestDistance: 1000000000, + // disableDepthTestDistance: 30000000, + // disableDepthTestDistance: Number.POSITIVE_INFINITY, }, billboard: { show: !iconOrModel.value, @@ -271,7 +274,7 @@ function addEntity(data: TBaseNode) { scaleByDistance: new Cesium.NearFarScalar(7000000, 1.0, 18000000, 0.4), heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // verticalOrigin: Cesium.VerticalOrigin.BOTTOM, - disableDepthTestDistance: 1000000000, + // disableDepthTestDistance: Number.POSITIVE_INFINITY, }, model: { show: iconOrModel.value, diff --git a/src/views/Content/components/WidgetNav/components/LoadShow.jsx b/src/views/Content/components/WidgetNav/components/LoadShow.jsx index 2e0fb93ef..796564206 100644 --- a/src/views/Content/components/WidgetNav/components/LoadShow.jsx +++ b/src/views/Content/components/WidgetNav/components/LoadShow.jsx @@ -2,7 +2,7 @@ import { NIcon, NPopover } from 'naive-ui' import { useEntity } from '@/hooks/entity' export default defineComponent({ setup() { - const { changeIconOrModel } = useEntity() + const { showOrHideLoad, changeShowOrHideLoad } = useEntity() return () => ( <> ( -
+
{ // console.log(value, 'showOrHideTraj') - // if (show) { - // showTrajHour.value > 0 && getCurTraj() - // } else { - // removeAllCurTraj() - // } + if (show) { + showTrajHour.value > 0 && getCurTraj() + } else { + removeAllCurTraj() + } } return () => ( @@ -53,7 +53,7 @@ export default defineComponent({ 航迹配置 {showTrajSet.value ? ( -
+
轨迹时长
showOrHideTraj(true)} > - 确定 + 显示所有航迹 - - 关闭航迹 + showOrHideTraj(false)}> + 关闭所有航迹 {/* {
- + ( +
+ +
+ +
+
+
+ ) + }, +}) diff --git a/src/views/Daodan/components/TestConfig.jsx b/src/views/Daodan/components/TestConfig.jsx index a4c65ca5a..416734a20 100644 --- a/src/views/Daodan/components/TestConfig.jsx +++ b/src/views/Daodan/components/TestConfig.jsx @@ -9,15 +9,20 @@ const panels = ['手动配置', 'STK轨迹文件配置'] export default defineComponent({ setup() { const { daodanData, showOrHideDdConfig } = useDaodan() - const { trajData, interceptData, addIntercept, initDaodan } = + const { trajData, interceptData, loadStoreData, addIntercept, initDaodan } = useTestConfig() + watch(daodanData, newval => { + loadStoreData() + // console.log(newval, '-=----') + }) + const name = ref('手动配置') - const handleClose = () => {} + // const handleClose = () => {} const confirm = () => { - showOrHideDdConfig({}) initDaodan() + showOrHideDdConfig({}) } const removeIntercept = id => { @@ -27,67 +32,67 @@ export default defineComponent({ ) } return () => ( -
- -
- + // +
+ + {panels.map(panel => ( + - {panels.map(panel => ( - - -
-
- {panel === '手动配置' ? ( - <> -
- -
-
- {interceptData.value.map(data => ( - - ))} -
- - 添加拦截 - -
-
- - ) : ( - <> - - - - )} -
-
-
-
- ))} -
-
- - 确认 - - showOrHideDdConfig({})}>取消 -
-
-
+ +
+
+ {panel === '手动配置' ? ( + <> +
+ +
+
+ {interceptData.value.map(data => ( + + ))} +
+ + 添加拦截 + +
+
+ + ) : ( + <> + + + + )} +
+
+
+ + ))} +
+
+ + 确认 + + showOrHideDdConfig({})}>取消 +
+ //
+ //
) }, }) diff --git a/src/views/Daodan/components/TrajTable.jsx b/src/views/Daodan/components/TrajTable.jsx index ce6cf7405..21b293b3e 100644 --- a/src/views/Daodan/components/TrajTable.jsx +++ b/src/views/Daodan/components/TrajTable.jsx @@ -21,6 +21,10 @@ export default defineComponent({ type: Object, default: () => ({}), }, + showPosIcon: { + type: Boolean, + default: true, + }, }, setup(props, { emit }) { const { handleClickPoint } = useTestConfig() @@ -35,35 +39,37 @@ export default defineComponent({ return (
{row.name}
- ( - - - - - - ), - }} - onClick={() => { - handleClickPoint(row) - }} - /> + {props.showPosIcon && ( + ( + + + + + + ), + }} + onClick={() => { + handleClickPoint(row) + }} + /> + )}
) }, diff --git a/src/views/Daodan/components/hooks/testHooks.jsx b/src/views/Daodan/components/hooks/testHooks.jsx index 1c6d9ffa6..e3e7281c1 100644 --- a/src/views/Daodan/components/hooks/testHooks.jsx +++ b/src/views/Daodan/components/hooks/testHooks.jsx @@ -3,6 +3,8 @@ import { useDaodan } from '../../ddHooks' import { cartesian32LonLat } from '@/utils/pos' import ExplosionEffect from '@/js/Explosion' import { generateId } from '@/utils/id' +import store from 'store2' +// import { useDaodan } from '../../ddHooks' const trajData = ref({ id: 'dd', @@ -36,7 +38,7 @@ const trajData = ref({ lat: 21, alt: 2000000, time: 1183135280000, - detached: false, + detached: true, }, { name: '落点', @@ -76,17 +78,45 @@ const interceptData = ref([ ], }, ]) + +const { daodanData, showDdConfigCom } = useDaodan() + export function useTestConfig() { return { trajData, interceptData, + loadStoreData, addIntercept, - addFeaturePoint, handleClickPoint, initDaodan, } } +function saveDataToStore() { + const daodanDataRaw = toRaw(daodanData.value) + const storeData = store.get('daodanData') + store.set('daodanData', { + ...storeData, + [daodanDataRaw.id]: { + ...daodanDataRaw, + trajData: trajData.value, + interceptData: interceptData.value, + }, + }) +} + +function loadStoreData() { + const storeData = store.get('daodanData') + if (storeData) { + const daodanDataRaw = toRaw(daodanData.value) + const data = storeData[daodanDataRaw.id] + if (data) { + trajData.value = data.trajData + interceptData.value = data.interceptData + } + } +} + function addIntercept() { // 添加拦截d interceptData.value.push({ @@ -107,31 +137,22 @@ function addIntercept() { time: 1183135260000, detached: false, }, - { - name: '落点', - lon: 120, - lat: 21, - alt: 0, - time: 1183135260000, - }, + trajData.value.data.at(-1), ], }) } -function addFeaturePoint() { - // 添加特征点 -} - let handler = null function handleClickPoint(rowData) { - const { showDdConfigCom } = useDaodan() // 点击点 // console.log(rowData) showDdConfigCom.value = false viewer._container.style.cursor = 'crosshair' handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas) handler.setInputAction(movement => { - const cartesian = viewer.scene.pickPosition(movement.position) + // const cartesian = viewer.scene.pickPosition(movement.position) + const ray = viewer.camera.getPickRay(movement.position) + const cartesian = viewer.scene.globe.pick(ray, viewer.scene) const position = cartesian32LonLat(cartesian) // console.log(position) viewer._container.style.cursor = '' @@ -144,7 +165,8 @@ function handleClickPoint(rowData) { let nodes = [] let ddMap = new Map() -function addDaodan(id, ddTrajData, type = 0) { +function addDaodan(trajData, type = 0) { + const { id, data: ddTrajData } = trajData const position = Cesium.Cartesian3.fromDegrees( ddTrajData[0].lon, ddTrajData[0].lat, @@ -194,26 +216,28 @@ function addDaodan(id, ddTrajData, type = 0) { model.getNode(i._name).show = false } }) - computePath(ddPrimitive, ddTrajData, type) + computePath(ddPrimitive, trajData, type) // setTimeout(() => { - playDaodan(ddPrimitive, nodes) + // playDaodan(ddPrimitive, nodes) // }, 3000) }) } let minTime = 0 function initDaodan() { - minTime = getMinTime([ - ...toRaw(trajData.value.data), - ...toRaw(interceptData.value.map(item => toRaw(item.data))).flat(Infinity), - ]) - - // console.log(minTime) - addDaodan(trajData.value.id, trajData.value.data) - interceptData.value.forEach(item => { - const { id, data } = item - addDaodan(id, data, 1) - }) + saveDataToStore() + // minTime = getMinTime([ + // ...toRaw(trajData.value.data), + // ...toRaw(interceptData.value.map(item => toRaw(item.data))).flat(Infinity), + // ]) + // // console.log(minTime) + // addDaodan(trajData.value) + // aniIndexMap.set(trajData.value.id, 0) + // interceptData.value.forEach(item => { + // const { id, data } = item + // addDaodan(item, 1) + // aniIndexMap.set(id, 0) + // }) } function getMinTime(data) { @@ -224,106 +248,14 @@ function getMinTime(data) { return minTime } -function playDaodan(daodan, nodes) { - modelAnimationController({ - primitive: daodan, - type: 'BoosterFlames Size', - initVal: 0, - maxVal: 1, - step: 0.1, - fn: () => { - console.log('1------BoosterFlames Size') - }, - }) - - setTimeout(() => { - modelAnimationController({ - primitive: daodan, - type: 'BoosterFlames Size', - initVal: 1, - minVal: 0, - step: -0.05, - fn: () => { - console.log('2------BoosterFlames Size') - }, - }) - modelAnimationController({ - primitive: daodan, - type: 'Booster MoveZ', - initVal: 0, - minVal: -150, - step: -1, - fn: () => { - console.log(nodes, '=======') - console.log('3------Booster MoveZ') - nodes.forEach(i => { - const nodeName = i._name - // new RegExp(/Fairing\d/).test(nodeName) || - if (new RegExp(/Booster/).test(nodeName)) { - daodan.getNode(nodeName).show = false - } - }) - }, - }) - modelAnimationController({ - primitive: daodan, - type: 'UpperStageFlames Size', - initVal: 0, - maxVal: 1, - step: 0.05, - fn: () => { - console.log('4------UpperStageFlames Size') - }, - }) - }, 2000) - - setTimeout(() => { - modelAnimationController({ - primitive: daodan, - type: 'InterstageAdapter MoveZ', - initVal: 0, - minVal: -150, - step: -1, - fn: () => { - console.log('5------InterstageAdapter MoveZ') - nodes.forEach(i => { - const nodeName = i._name - if (new RegExp(/InterstageAdapter/).test(nodeName)) { - console.log(daodan.getNode(nodeName)) - daodan.getNode(nodeName).show = false - } - }) - }, - }) - }, 4000) - - setTimeout(() => { - modelAnimationController({ - primitive: daodan, - type: 'UpperStageFlames Size', - initVal: 1, - maxVal: 0, - step: -0.05, - fn: () => { - console.log('6------UpperStageFlames Size') - modelAnimationController({ - primitive: daodan, - type: 'UpperStage MoveZ', - initVal: 0, - minVal: -150, - step: -1, - }) - }, - }) - }, 6000) -} - -function computePath(daodan, ddTrajData, type) { +function computePath(daodan, trajData, type) { + const { data: ddTrajData } = trajData const points = ddTrajData.map(item => { - const { time, lon, lat, alt } = item + const { time, lon, lat, alt, detached } = item return { position: Cesium.Cartesian3.fromDegrees(lon, lat, alt), time: time - minTime, + detached, } }) const totalAnimationTime = points.at(-1).time @@ -347,21 +279,32 @@ function computePath(daodan, ddTrajData, type) { positionProperty.addSample(time, point.position) }) positionProperty.setInterpolationOptions({ - interpolationDegree: 5, + interpolationDegree: 2, interpolationAlgorithm: Cesium.HermitePolynomialApproximation, // interpolationDegree: 5, // interpolationAlgorithm: Cesium.LagrangePolynomialApproximation, }) createLine({ totalAnimationTime, startTime, positionProperty, type }) - daodanAnimation({ totalAnimationTime, startTime, positionProperty, daodan }) + daodanAnimation({ + totalAnimationTime, + startTime, + positionProperty, + daodan, + trajData, + }) } function daodanAnimation(params) { - const { totalAnimationTime, startTime, positionProperty, daodan } = params + const { totalAnimationTime, startTime, positionProperty, daodan, trajData } = + params + // const { data: ddTrajData } = trajData + dianhuo(daodan) + let lastFrameTime = performance.now() let customElapsedTime = 0 let isAnimationRunning = true let explosion = null + viewer.scene.preRender.addEventListener(() => { if (!isAnimationRunning) { return @@ -374,6 +317,11 @@ function daodanAnimation(params) { customElapsedTime = totalAnimationTime // 限制时间为总时长 isAnimationRunning = false // 停止动画 } + ddNodesAnimationController({ + ddPrimitive: daodan, + curTime: minTime + customElapsedTime * 1000, + trajData, + }) // 计算自定义时间下的位置 const customTime = Cesium.JulianDate.addSeconds( @@ -424,6 +372,197 @@ function daodanAnimation(params) { } }) } +function dianhuo(ddPrimitive) { + modelAnimationController({ + primitive: ddPrimitive, + type: 'BoosterFlames Size', + initVal: 0, + maxVal: 1, + step: 0.1, + fn: () => { + console.log('%c点火', 'color: red;font-size: 20px;border: 1px solid red') + }, + }) +} + +const aniIndexMap = new Map() +function ddNodesAnimationController(params) { + const { ddPrimitive, curTime, trajData } = params + const { id: ddId, data: ddTrajData } = trajData + const nodeAniList = ddTrajData.filter(item => item.detached) + + // console.log( + // curTime, + // aniIndex, + // nodeAniList[aniIndex].time, + // curTime >= nodeAniList[aniIndex].time, + // 'curTime' + // ) + + if (!ddPrimitive || !aniIndexMap.has(ddId)) return + + const aniIndex = aniIndexMap.get(ddId) + const aniTime = nodeAniList[aniIndex]?.time || Infinity + if (curTime >= aniTime) { + if (aniIndex === 0) { + aniIndexMap.set(ddId, aniIndexMap.get(ddId) + 1) + + modelAnimationController({ + primitive: ddPrimitive, + type: 'BoosterFlames Size', + initVal: 1, + minVal: 0, + step: -0.05, + fn: function () { + console.log( + `%c${ddId}--熄火`, + 'color: red;font-size: 20px;border: 1px solid red' + ) + + modelAnimationController({ + primitive: ddPrimitive, + type: 'UpperStageFlames Size', + initVal: 0, + maxVal: 1, + step: 0.05, + fn: () => { + console.log( + `%c${ddId}--二级点火`, + 'color: red;font-size: 20px;border: 1px solid red' + ) + }, + }) + + modelAnimationController({ + primitive: ddPrimitive, + type: 'Booster MoveZ', + initVal: 0, + minVal: -450, + step: -3, + fn: () => { + console.log( + `%c${ddId}--一级脱离`, + 'color: red;font-size: 20px;border: 1px solid red' + ) + nodes.forEach(i => { + const nodeName = i._name + if (new RegExp(/Booster/).test(nodeName)) { + ddPrimitive.getNode(nodeName).show = false + } + }) + }, + }) + modelAnimationController({ + primitive: ddPrimitive, + type: 'Booster MoveY', + initVal: 0, + minVal: -15, + step: -0.1, + }) + }, + }) + } else if (aniIndex === 1) { + aniIndexMap.set(ddId, aniIndexMap.get(ddId) + 1) + + modelAnimationController({ + primitive: ddPrimitive, + type: 'Fairing Open', + initVal: 0, + maxVal: 45, + step: 0.5, + }) + modelAnimationController({ + primitive: ddPrimitive, + type: 'Fairing Separate', + initVal: 0, + minVal: -10, + step: -0.1, + }) + modelAnimationController({ + primitive: ddPrimitive, + type: 'Fairing Drop', + initVal: 0, + minVal: -450, + step: -3, + fn: () => { + console.log( + `%c${ddId}--二级脱离`, + 'color: red;font-size: 20px;border: 1px solid red' + ) + nodes.forEach(i => { + const nodeName = i._name + if (new RegExp(/Fairing\d/).test(nodeName)) { + ddPrimitive.getNode(nodeName).show = false + } + }) + }, + }) + modelAnimationController({ + primitive: ddPrimitive, + type: 'Fairing MoveY', + initVal: 0, + minVal: -150, + step: -3, + }) + } else if (aniIndex === 2) { + aniIndexMap.set(ddId, aniIndexMap.get(ddId) + 1) + + modelAnimationController({ + primitive: ddPrimitive, + type: 'InterstageAdapter MoveZ', + initVal: 0, + minVal: -200, + step: -2, + fn: () => { + console.log( + `%c${ddId}--三级脱离`, + 'color: red;font-size: 20px;border: 1px solid red' + ) + nodes.forEach(i => { + const nodeName = i._name + if (new RegExp(/InterstageAdapter/).test(nodeName)) { + ddPrimitive.getNode(nodeName).show = false + } + }) + }, + }) + modelAnimationController({ + primitive: ddPrimitive, + type: 'InterstageAdapter MoveY', + initVal: 0, + minVal: -300, + step: -2, + }) + + modelAnimationController({ + primitive: ddPrimitive, + type: 'UpperStageFlames Size', + initVal: 1, + minVal: 0, + step: -0.05, + fn: () => { + console.log( + `%c${ddId}--二级熄火`, + 'color: red;font-size: 20px;border: 1px solid red' + ) + // modelAnimationController({ + // primitive: ddPrimitive, + // type: 'Booster MoveZ', + // initVal: 0, + // minVal: -150, + // step: -1, + // fn: () => { + // console.log( + // `%c${ddId}--三级掉落`, + // 'color: red;font-size: 20px;border: 1px solid red' + // ) + // }, + // }) + }, + }) + } + } +} function getHeadingPitchRoll(curPos, nextPos) { if (!curPos || !nextPos || Cesium.Cartesian3.equals(curPos, nextPos)) { @@ -492,14 +631,15 @@ function modelAnimationController(controller) { const { type, initVal, maxVal, fn, step, minVal, primitive } = controller let num = initVal let stopFrame - const max = maxVal || 1 - const min = minVal || -99999 - const duration = step || 0.1 + const max = maxVal ?? 1 + const min = minVal ?? -99999 + const duration = step ?? 0.1 const render = () => { num += duration primitive.setArticulationStage(type, num) primitive.applyArticulations() stopFrame = requestAnimationFrame(render) + // console.log(num >= max || num <= min, type, num, min) if (num > max || num <= min) { window.cancelAnimationFrame(stopFrame) fn && fn() diff --git a/src/views/Daodan/ddHooks.jsx b/src/views/Daodan/ddHooks.jsx index cebcdae29..9282fafbe 100644 --- a/src/views/Daodan/ddHooks.jsx +++ b/src/views/Daodan/ddHooks.jsx @@ -1,4 +1,4 @@ -import { onMounted, ref } from 'vue' +import { onMounted, ref, watch } from 'vue' import { getDaodanTree } from '@/api/Daodan' const isLoading = ref(false) diff --git a/src/views/Daodan/index.jsx b/src/views/Daodan/index.jsx index a8c9c9198..d71435e1e 100644 --- a/src/views/Daodan/index.jsx +++ b/src/views/Daodan/index.jsx @@ -1,6 +1,7 @@ import Tree from '@/components/Tree/index.vue' import { useDaodan } from './ddHooks' import { NButton } from 'naive-ui' +import { useTestConfig } from './components/hooks/testHooks' export default defineComponent({ setup() { @@ -25,6 +26,10 @@ export default defineComponent({ } return () => (
+ {/* + aaaaa + */} + { }, }) - viewer.terrainProvider = new Cesium.CesiumTerrainProvider({ - url: 'http://192.168.10.201:2022/api/maptilecache/service/terrain/taiwan-HeightMap-4326', - // url: Cesium.IonResource.fromAssetId(3956), - // url: 'http://data.marsgis.cn/terrain', - requestVertexNormals: true, - requestWaterMask: true, - }) + // viewer.terrainProvider = new Cesium.CesiumTerrainProvider({ + // url: 'http://192.168.10.201:2022/api/maptilecache/service/terrain/taiwan-HeightMap-4326', + // // url: Cesium.IonResource.fromAssetId(3956), + // // url: 'http://data.marsgis.cn/terrain', + // requestVertexNormals: true, + // requestWaterMask: true, + // }) // viewer.terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl( // 'http://192.168.10.201:2022/api/maptilecache/service/terrain/taiwan-HeightMap-4326', @@ -82,7 +82,7 @@ onMounted(async () => { // requestWaterMask: true, // } // ) - viewer.scene.globe.depthTestAgainstTerrain = true + // viewer.scene.globe.depthTestAgainstTerrain = true // setTimeout(() => { // const tooltip = new MouseTooltip(window.viewer, { // offset: [10, -10], diff --git a/src/views/Gantt/components/EventList/components/EventDdConfig.jsx b/src/views/Gantt/components/EventList/components/EventDdConfig.jsx new file mode 100644 index 000000000..6c6d5514d --- /dev/null +++ b/src/views/Gantt/components/EventList/components/EventDdConfig.jsx @@ -0,0 +1,94 @@ +import { NTabs, NTabPane, NButton, NScrollbar } from 'naive-ui' +import TrajTable from '@/views/Daodan/components/TrajTable' + +import TrajUpload from '@/views/Daodan/components/TrajUpload' + +import { useEventDdConfig } from './useEventDdConfig' + +const panels = ['手动配置', 'STK轨迹文件配置'] +export default defineComponent({ + name: 'EventDaodan', + props: { + data: { + type: Object, + default: () => ({}), + }, + }, + setup() { + const name = ref('手动配置') + + const { trajData, interceptData, addIntercept } = useEventDdConfig() + + // const { trajData, interceptData, updateInterceptData } = useEvent() + const removeIntercept = id => { + interceptData.value.splice( + interceptData.value.findIndex(item => item.id === id), + 1 + ) + } + const showOrHideDdConfig = () => {} + return () => ( +
+ + {panels.map(panel => ( + + +
+
+ {panel === '手动配置' ? ( + <> +
+ +
+
+ {interceptData.value.map(data => ( + + ))} +
+ + 添加拦截 + +
+
+ + ) : ( + <> + + + + )} +
+
+
+
+ ))} +
+
+ + 确认 + + showOrHideDdConfig({})}>取消 +
+
+ ) + }, +}) diff --git a/src/views/Gantt/components/EventList/components/MainEventEdit.jsx b/src/views/Gantt/components/EventList/components/MainEventEdit.jsx new file mode 100644 index 000000000..4e9f92647 --- /dev/null +++ b/src/views/Gantt/components/EventList/components/MainEventEdit.jsx @@ -0,0 +1,60 @@ +import { + NForm, + NFormItem, + NInput, + NButton, + NDatePicker, + NUpload, +} from 'naive-ui' +import ModalCom from '@/components/Modal/index.vue' +import { useEvent } from '../hooks' +export default defineComponent({ + // props: { + // show: { + // type: Boolean, + // default: false, + // }, + // }, + setup() { + const { showMainEvent, mainEventData } = useEvent() + + const close = () => { + showNewEvent.value = false + } + + watch( + [() => mainEventData.value.start, () => mainEventData.value.end], + ([start, end]) => { + timeRange.value = start ? [start, end] : null + } + ) + + const timeRange = ref(null) + + return () => ( + + + + + + + + + +
+ 取消 + 确认 +
+
+ ) + }, +}) diff --git a/src/views/Gantt/components/EventList/components/SubEventEdit.jsx b/src/views/Gantt/components/EventList/components/SubEventEdit.jsx new file mode 100644 index 000000000..3b2759a55 --- /dev/null +++ b/src/views/Gantt/components/EventList/components/SubEventEdit.jsx @@ -0,0 +1,81 @@ +import { + NForm, + NFormItem, + NInput, + NButton, + NDatePicker, + NUpload, +} from 'naive-ui' +import ModalCom from '@/components/Modal/index.vue' +import { useEvent } from '../hooks' +export default defineComponent({ + // props: { + // show: { + // type: Boolean, + // default: false, + // }, + // }, + setup() { + const { showNewEvent, eventData } = useEvent() + + const close = () => { + showNewEvent.value = false + } + + watch( + [ + () => eventData.value.start, + () => eventData.value.end, + () => eventData.value.avatar, + ], + ([start, end, avatar]) => { + timeRange.value = start ? [start, end] : null + uploadImg.value = [ + { + url: avatar, + status: 'finished', + }, + ] + } + ) + + const timeRange = ref(null) + const uploadImg = ref([]) + + return () => ( + + + + + + + + + + + + +
+ 取消 + 确认 +
+
+ ) + }, +}) diff --git a/src/views/Gantt/components/EventList/components/useEventDdConfig.jsx b/src/views/Gantt/components/EventList/components/useEventDdConfig.jsx new file mode 100644 index 000000000..a3c5f65a4 --- /dev/null +++ b/src/views/Gantt/components/EventList/components/useEventDdConfig.jsx @@ -0,0 +1,103 @@ +export const useEventDdConfig = () => { + const trajData = ref({ + id: 'dd', + data: [ + { + name: '起始点', + lon: 120, + lat: 21, + alt: 0, + time: 1183135260000, + }, + { + name: '中间特征点', + lon: 122, + lat: 21, + alt: 1000000, + time: 1183135265000, + detached: true, + }, + { + name: '中间特征点', + lon: 124, + lat: 21, + alt: 1500000, + time: 1183135270000, + detached: true, + }, + { + name: '中间特征点', + lon: 128, + lat: 21, + alt: 2000000, + time: 1183135280000, + detached: true, + }, + { + name: '落点', + lon: 135, + lat: 21, + alt: 1500000, + time: 1183135290000, + }, + ], + }) + const interceptData = ref([ + { + id: 'dd1', + data: [ + { + name: '起始点', + lon: 137, + lat: 25, + alt: 0, + time: 1183135270000, + }, + { + name: '中间特征点', + lon: 138, + lat: 24, + alt: 1000000, + time: 1183135280000, + detached: true, + }, + { + name: '落点', + lon: 135, + lat: 21, + alt: 1500000, + time: 1183135290000, + }, + ], + }, + ]) + + function addIntercept() { + // 添加拦截d + interceptData.value.push({ + data: [ + { + name: '起始点', + lon: 120, + lat: 21, + alt: 0, + time: 1183135260000, + }, + { + name: '中间特征点', + lon: 120, + lat: 21, + alt: 0, + time: 1183135260000, + detached: false, + }, + trajData.value.data.at(-1), + ], + }) + } + return { + trajData, + interceptData, + addIntercept, + } +} diff --git a/src/views/Gantt/components/EventList/hooks.jsx b/src/views/Gantt/components/EventList/hooks.jsx new file mode 100644 index 000000000..fc10717a2 --- /dev/null +++ b/src/views/Gantt/components/EventList/hooks.jsx @@ -0,0 +1,29 @@ +import { generateId } from '@/utils/id' + +const showMainEvent = ref(false) + +const mainEventData = ref({ + name: '', + start: '', + end: '', + type: 'mainEvent', +}) + +const showNewEvent = ref(false) + +const eventData = ref({ + name: '', + start: '', + end: '', + avatar: '', + type: 'subEvent', +}) + +export const useEvent = () => { + return { + showMainEvent, + mainEventData, + showNewEvent, + eventData, + } +} diff --git a/src/views/Gantt/components/EventList/index.jsx b/src/views/Gantt/components/EventList/index.jsx index cb9a90d9a..5b6765516 100644 --- a/src/views/Gantt/components/EventList/index.jsx +++ b/src/views/Gantt/components/EventList/index.jsx @@ -1,5 +1,6 @@ -import { NDataTable, NIcon, NButton } from 'naive-ui' -import { getMainGantt } from '@/api/gantt' +import { NDataTable, NIcon, NButton, useDialog, NTag } from 'naive-ui' +import { getEventListByDDType } from '@/api/gantt' +import { useTree } from '@/utils/tree' import { HelpCircleOutline, CreateOutline, @@ -8,19 +9,47 @@ import { EnterOutline, } from '@vicons/ionicons5' +import MainEventEdit from './components/MainEventEdit' +import SubEventEdit from './components/SubEventEdit' + +import EventDdConfig from './components/EventDdConfig' + +import { useEvent } from './hooks' + export default defineComponent({ - setup() { + props: { + dd: { + type: String, + require: true, + }, + }, + setup(props) { + const { showMainEvent, mainEventData, showNewEvent, eventData } = useEvent() + const dict = { + mainEvent: { label: '主事件', color: 'success' }, + eventType: { label: '事件分类', color: 'info' }, + + subEvent: { label: '子事件', color: 'warning' }, + } const columns = [ { - title: '导弹类型/事件名称', + title: '事件名称', key: 'name', - width: 220, + width: 'auto', render: row => { return (
- + {/* - + */} + + {dict[row.type].label} + {row.name}
) @@ -34,10 +63,22 @@ export default defineComponent({ title: '结束时间', key: 'end', }, - { - title: '类型', - key: 'type', - }, + // { + // title: '类型', + // key: 'type', + // render(row) { + // return ( + // + // {dict[row.type].label} + // + // ) + // }, + // }, { title: '图片', key: 'avatar', @@ -52,37 +93,81 @@ export default defineComponent({ { title: '操作', key: 'action', - render(row) { + render(row, rowIndex) { + // console.log(row, rowIndex) return (
- {!row.avatar ? ( + {row.type === 'mainEvent' && ( + editMainEvent(row)} + > + + + + 编辑事件 + + )} + {row.type === 'eventType' ? ( handleEdit(row)} + onClick={() => addSubEvent(row)} > + 添加子事件 ) : null} - handleEdit(row)} - > - - - - - {row.name.indexOf('DD') === -1 ? ( + {row.type === 'isDD' && ( + editSubEvent(row)} + > + + + + 编辑子事件 + + )} + {Reflect.has(row, 'trajData') && ( + ddConfig(row)} + > + + + + 编辑DD轨迹 + + )} + {row.type === 'subEvent' && ( + editSubEvent(row)} + > + + + + 编辑子事件 + + )} + {row.type !== 'eventType' ? ( handleEdit(row)} + onClick={() => deleteEvent(row)} > @@ -96,20 +181,85 @@ export default defineComponent({ }, }, ] + + function editMainEvent(row) { + showMainEvent.value = true + mainEventData.value = row + } + + function addSubEvent(row) { + showNewEvent.value = true + } + + function editSubEvent(row) { + showNewEvent.value = true + eventData.value = row + } + + const dialog = useDialog() + function deleteEvent(row) { + dialog.warning({ + title: '删除事件', + content: `确定删除事件 ${row.name} 吗?`, + positiveText: '确定', + negativeText: '取消', + onPositiveClick: async () => { + // await deleteEventById(row.id) + // getEventList() + }, + }) + } + + function ddConfig(row) { + console.log(row) + dialog.create({ + style: 'width:auto;height:90vh', + maskClosable: false, + class: 'flex flex-col', + title: 'DD轨迹', + contentClass: 'flex-1 h-0', + content: () => , + // positiveText: '确定', + // negativeText: '取消', + // onPositiveClick: () => {}, + }) + } + const tableData = ref([]) onMounted(async () => { - const res = await getMainGantt() - tableData.value = res + await getEventList() }) + const { getAllKeys } = useTree() + const expandedRowKeys = ref([]) + async function getEventList() { + const res = await getEventListByDDType(props.dd) + tableData.value = res.children + expandedRowKeys.value = getAllKeys(tableData.value, 'name') + } + + watch( + () => props.dd, + async () => { + getEventList() + } + ) + return () => ( - row.name} - /> + <> + row.name} + /> + + + + ) }, }) diff --git a/src/views/Gantt/components/MainGantt/index.jsx b/src/views/Gantt/components/MainGantt/index.jsx index 150ce5360..0a9b0f824 100644 --- a/src/views/Gantt/components/MainGantt/index.jsx +++ b/src/views/Gantt/components/MainGantt/index.jsx @@ -20,9 +20,9 @@ export default defineComponent({ - + {/* 编辑事件 - + */}
diff --git a/src/views/Gantt/components/TaskList/index.jsx b/src/views/Gantt/components/TaskList/index.jsx index 8fa19ae2e..e8dbd871b 100644 --- a/src/views/Gantt/components/TaskList/index.jsx +++ b/src/views/Gantt/components/TaskList/index.jsx @@ -1,4 +1,5 @@ -import { NDataTable, NIcon, NButton } from 'naive-ui' +import { NDataTable, NIcon, NButton, NTag } from 'naive-ui' +import { useTree } from '@/utils/tree' import { getTask } from '@/api/gantt' import { HelpCircleOutline, @@ -10,17 +11,34 @@ import { export default defineComponent({ setup() { + const dict = { + task: { label: '任务', color: 'error' }, + + dd: { label: '主体' }, + + mainEvent: { label: '主事件', color: 'success' }, + eventType: { label: '事件分类', color: 'info' }, + + subEvent: { label: '子事件', color: 'warning' }, + } const columns = [ { title: '任务名称/事件名称', key: 'name', - width: 220, + width: 'auto', render: row => { return (
- - - + {row.type && ( + + {dict[row.type].label} + + )} {row.name}
) @@ -34,10 +52,24 @@ export default defineComponent({ title: '结束时间', key: 'end', }, - { - title: '类型', - key: 'type', - }, + // { + // title: '类型', + // key: 'type', + // render(row) { + // return ( + // row.type && ( + // + // {dict[row.type].label} + // + // ) + // ) + // }, + // }, { title: '图片', key: 'avatar', @@ -110,15 +142,24 @@ export default defineComponent({ }, ] const tableData = ref([]) + const { getAllKeys } = useTree() + const expandedRowKeys = ref([]) onMounted(async () => { + await getTaskList() + }) + + async function getTaskList() { const res = await getTask() tableData.value = res - }) + expandedRowKeys.value = getAllKeys(tableData.value, 'name') + } return () => ( row.name} diff --git a/src/views/Gantt/index.jsx b/src/views/Gantt/index.jsx index d95facd01..3f55138d6 100644 --- a/src/views/Gantt/index.jsx +++ b/src/views/Gantt/index.jsx @@ -8,12 +8,14 @@ import { NDrawerContent, NTabs, NTabPane, + NSelect, } from 'naive-ui' import { ArrowForward } from '@vicons/ionicons5' import HeaderCom from '../Content/components/Header/index.vue' import TaskList from './components/TaskList' import EventList from './components/EventList' import NewTask from './components/TaskList/components/NewTask' + import useTask from './components/TaskList/components/NewTask/hooks' export default defineComponent({ setup() { @@ -26,6 +28,13 @@ export default defineComponent({ showNewTask.value = true } + const ddList = Array.from({ length: 8 }, (_, i) => ({ + label: `DD-${i + 1}`, + value: `DD-${i + 1}`, + })) + + const dd = ref(`DD-1`) + const paneClass = `border-1 h-full border-l-0 border-[var(--n-tab-border-color)] !p-2` return () => (
@@ -51,7 +60,7 @@ export default defineComponent({ @@ -95,6 +104,11 @@ export default defineComponent({ >
+ */}
- +
diff --git a/src/views/Mubiao/components/CurTrajectory/mbCurTraj.ts b/src/views/Mubiao/components/CurTrajectory/mbCurTraj.ts index 5190425b1..0d6827d76 100644 --- a/src/views/Mubiao/components/CurTrajectory/mbCurTraj.ts +++ b/src/views/Mubiao/components/CurTrajectory/mbCurTraj.ts @@ -3,7 +3,7 @@ import { time2Format } from '@/utils/date' const { mubiaoMap, getHisTraj } = useEntity() -const showTrajHour = ref(0) +const showTrajHour = ref(5) const allEntity = ref([]) @@ -34,35 +34,36 @@ async function getCurTraj(mbId: string) { const startTime = time2Format(nowDate - showTrajHour.value * 60 * 60 * 1000) // console.log(object); + if (mbId) { + initTraj(mbId) + } else { + ;[...mubiaoMap.keys()].forEach(async id => { + initTraj(id) + }) + } + async function initTraj(id: string) { + if (entityMap.value.has(id)) { + entityMap.value.get(id)?.forEach(entity => { + viewer.entities.remove(entity) + }) + entityMap.value.delete(id) + } const { points, posArray } = await getHisTraj({ - id: mbId, + id, timeRange: [startTime, endDate], }) - // console.log(points, posArray, 'pos') const color = Cesium.Color.fromRandom({ alpha: 1 }) + + const linePoints = Cesium.Cartesian3.fromDegreesArrayHeights(posArray) + drawLine(id, linePoints, color) drawPoints( - mbId, + id, points.map(point => point.position), color ) - - const linePoints = Cesium.Cartesian3.fromDegreesArrayHeights(posArray) - drawLine(mbId, linePoints, color) } - // ;[...mubiaoMap.keys()].forEach(async id => { - // const { points, posArray } = await getHisTraj({ - // id, - // timeRange: [startTime, nowDate], - // }) - - // const color = Cesium.Color.fromRandom({ alpha: 1 }) - // drawPoints(points, color) - - // const linePoints = Cesium.Cartesian3.fromDegreesArrayHeights(posArray) - // drawLine(linePoints, color) - // }) } function drawLine( @@ -111,6 +112,7 @@ function removeAllCurTraj() { entityMap.value.get(id)?.forEach(entity => { viewer.entities.remove(entity) }) + entityMap.value.delete(id) }) // allEntity.value.forEach(entity => { // viewer.entities.remove(entity) diff --git a/src/views/Mubiao/hooks/mubiao.ts b/src/views/Mubiao/hooks/mubiao.ts index 56c5bb7b8..8b9a6d972 100644 --- a/src/views/Mubiao/hooks/mubiao.ts +++ b/src/views/Mubiao/hooks/mubiao.ts @@ -164,7 +164,10 @@ export const useMubiao = () => { const entity = mubiaoMap.get(id) const position = Cesium.Cartesian3.fromDegrees(lon, lat) entity.position = position - + // console.log(target_direction) + entity.billboard.rotation = Cesium.Math.toRadians( + 360 - target_direction + 90 + ) entity.orientation = getOrientation({ position, heading: target_direction as number, diff --git a/src/views/Satellite/hooks/satellite.ts b/src/views/Satellite/hooks/satellite.ts index 4704be407..d8ec4d8c9 100644 --- a/src/views/Satellite/hooks/satellite.ts +++ b/src/views/Satellite/hooks/satellite.ts @@ -16,7 +16,7 @@ interface IBaseFilterParam { } const satelliteList = ref([]) -const { satelliteMap } = useEntity() +const { satelliteMap, showOrHideLoad } = useEntity() const showPoint = ref(true) function showPointUnderSat(id?: string) { @@ -61,7 +61,7 @@ export function useSatellite() { setTimeout(() => { // satellite.sensorType = Math.random() > 0.5 ? 'conic' : 'rectangle' - satellite.sensor = true + satellite.sensor = showOrHideLoad.value }, 1000) // viewer.clock.multiplier = 100 diff --git a/src/views/TextReport/components/Message/components/Card.jsx b/src/views/TextReport/components/Message/components/Card.jsx index 593477405..6864c4b55 100644 --- a/src/views/TextReport/components/Message/components/Card.jsx +++ b/src/views/TextReport/components/Message/components/Card.jsx @@ -11,8 +11,19 @@ export default defineComponent({ type: String, default: '内容', }, + app: { + type: Object, + }, + div: { + type: HTMLDivElement, + }, }, setup(props, { slots }) { + const onClose = () => { + event.stopPropagation() + props.app.mount() + props.div.remove() + } return () => (
slots.icon(), }} + onClose={onClose} > {props.content} diff --git a/src/views/TextReport/hooks/text.ts b/src/views/TextReport/hooks/text.ts index de7789193..ad1bed128 100644 --- a/src/views/TextReport/hooks/text.ts +++ b/src/views/TextReport/hooks/text.ts @@ -113,6 +113,8 @@ export const useTextReport = () => { { title: data.title, content: data.detailContent, + app: app, + div: div, }, { icon: () => @@ -133,6 +135,7 @@ export const useTextReport = () => { app.unmount() div.remove() }, toastMsgTimeSec * 1000 || 10000) + // }, 100000) } } diff --git a/src/views/Weather/hooks/weather.ts b/src/views/Weather/hooks/weather.ts index 0a82fd333..1cd6d8670 100644 --- a/src/views/Weather/hooks/weather.ts +++ b/src/views/Weather/hooks/weather.ts @@ -72,7 +72,7 @@ function createWeatherPoint(data) { height: 30, scaleByDistance: new Cesium.NearFarScalar(7000000, 1.0, 18000000, 0.4), - disableDepthTestDistance: 1000000000, + // disableDepthTestDistance: 1000000000, }, }) return entity