From 1903cb0124468a3b8ce085f7c1297f360808e501 Mon Sep 17 00:00:00 2001 From: liaoboping <344114999@qq.com> Date: Sat, 20 Sep 2025 22:24:04 +0800 Subject: [PATCH] coding --- src/components/Common/Cesium/index.js | 1 + src/views/simulationScene/database/fdsjk.vue | 21 +++++ src/views/subsystem/display/index.vue | 41 ++++++--- src/views/subsystem/model/index.vue | 72 ++++++++++++---- src/views/subsystem/scene/entry.vue | 12 ++- src/views/subsystem/scene/index.vue | 87 ++++++++++++++------ src/views/subsystem/scene/presetting.vue | 12 +-- 7 files changed, 184 insertions(+), 62 deletions(-) diff --git a/src/components/Common/Cesium/index.js b/src/components/Common/Cesium/index.js index dc2a8c0..de70166 100644 --- a/src/components/Common/Cesium/index.js +++ b/src/components/Common/Cesium/index.js @@ -325,6 +325,7 @@ export default class MyCesium { movePlotByCoordinates(plotId, coordinates) { // 实体 const targetPlot = this.viewer.entities.getById(plotId) + if (!targetPlot) return if (targetPlot._isMoving === true) { // 1. 获取新的路线坐标点(假设是同步获取的,或者是在回调中) const positions = Cesium.Cartesian3.fromDegreesArray(coordinates.flat()) // 你的坐标路线 diff --git a/src/views/simulationScene/database/fdsjk.vue b/src/views/simulationScene/database/fdsjk.vue index d02716d..5f2f6a7 100644 --- a/src/views/simulationScene/database/fdsjk.vue +++ b/src/views/simulationScene/database/fdsjk.vue @@ -47,6 +47,14 @@ export default { columns: [ { dataIndex: 'serial' }, { dataIndex: 'name', title: '分队名称', width: 'auto', minWidth: 160 }, + { + dataIndex: 'teamType', + title: '推演方', + width: 'auto', + minWidth: 160, + align: 'center', + customRender: (text) => ['红方', '蓝方'][text], + }, { dataIndex: 'type', title: '分队类型', @@ -66,6 +74,19 @@ export default { title: '', formItems: [ { label: '分队名称', prop: 'name' }, + { + label: '推演方', + prop: 'teamType', + component: 'AntOriginSelect', + options: { + dataSource: () => ({ + data: [ + { title: '红方', id: 0 }, + { title: '蓝方', id: 1 }, + ], + }), + }, + }, { label: '分队类型', prop: 'type', diff --git a/src/views/subsystem/display/index.vue b/src/views/subsystem/display/index.vue index 980af89..8506c53 100644 --- a/src/views/subsystem/display/index.vue +++ b/src/views/subsystem/display/index.vue @@ -5,12 +5,17 @@ 推演想定【{{ roomName }}-{{ scenarioName }}】 剩余 {{ roomInfo.remainTimeStr }} - + +
+ + 统计分析 + +
@@ -21,6 +26,7 @@ export default { name: 'SubsystemDisplay', data() { return { + initial: false, ws: null, roomInfo: { remainTimeStr: '', @@ -65,26 +71,36 @@ export default { case 'path_update': this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points) break - case 'scenarioInfo': - this.roomInfo.roomData = response.data - // this.initPlots() + case 'editScenarioInfo': + if (this.initial === false) { + this.roomInfo.roomData = JSON.parse(response.data) + this.initPlots() + this.initial = true + } + break + case 'updScenarioInfo': + { + const data = JSON.parse(response.data) + const targetIndex = this.roomInfo.roomData.findIndex((item) => item.sdzy.id === data.sdzy.id) + this.$set(this.roomInfo.roomData, targetIndex, data) + } break default: - console.log(response.cmdType, JSON.parse(response.data)) + console.log(response.cmdType, response.data) break } }) - this.ws.send({ cmdType: 'scenarioInfo' }) + this.ws.send({ cmdType: 'editScenarioInfo' }) }, closeWebsocket() { this.ws && this.ws.close() this.ws = null }, - initPlots(plots) { - plots.forEach((item) => { - if (item.lng && item.lat) { - this.cesium.addPlotByLonLat(item.imgBase64, { lon: +item.lng, lat: +item.lat }, item.id) + initPlots() { + this.roomInfo.roomData.forEach((item) => { + if (item.sdzy.lng && item.sdzy.lat) { + this.cesium.addPlotByLonLat(item.imgBase64, { lon: +item.sdzy.lng, lat: +item.sdzy.lat }, item.sdzy.id) } }) }, @@ -111,6 +127,9 @@ export default { background-color: #022234; } } +.ant-menu-horizontal { + line-height: 30px; +} .display-cesium-container { width: 100%; height: 100%; diff --git a/src/views/subsystem/model/index.vue b/src/views/subsystem/model/index.vue index 53ff143..3a04dd1 100644 --- a/src/views/subsystem/model/index.vue +++ b/src/views/subsystem/model/index.vue @@ -6,7 +6,11 @@ 剩余 {{ roomInfo.remainTimeStr }} -
+
+ + 统计分析 + +
@@ -114,6 +118,7 @@ export default { }, data() { return { + initial: false, ws: null, roomInfo: { remainTimeStr: '', @@ -164,13 +169,30 @@ export default { }, computed: { zzbzllTreeData() { - return [] + const zzbzllTreeData = [ + { + id: '0', + resourceName: '红方', + selectable: false, + children: [], + }, + { + id: '1', + resourceName: '蓝方', + selectable: false, + children: [], + }, + ] + this.roomInfo.roomData.forEach((item) => { + zzbzllTreeData[item.sdzy.type].children.push(item.sdzy) + }) + return zzbzllTreeData }, zzbzllSelectedFd() { if (this.zzbzll.selectedKeys.length === 0) { return null } - return null + return this.roomInfo.roomData.find((item) => item.sdzy.id === this.zzbzll.selectedKeys[0]) }, rightRows() { switch (this.rightViewer) { @@ -185,7 +207,7 @@ export default { } }, blbzShowKeys() { - return [] + return this.zzbzllSelectedFd?.orgPostList.map((item) => item.orgId) || [] }, showBlbzCheckedTreeData() { const target = [] @@ -193,10 +215,10 @@ export default { return target }, jcsxModelData() { - return {} + return this.zzbzllSelectedFd?.jbxx || {} }, xdrwActionList() { - return [] + return this.zzbzllSelectedFd?.scenarioTasks || [] }, }, created() { @@ -242,16 +264,26 @@ export default { case 'path_update': this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points) break - case 'scenarioInfo': - this.roomInfo.roomData = response.data - // this.initPlots() + case 'editScenarioInfo': + if (this.initial === false) { + this.roomInfo.roomData = JSON.parse(response.data) + this.initPlots() + this.initial = true + } + break + case 'updScenarioInfo': + { + const data = JSON.parse(response.data) + const targetIndex = this.roomInfo.roomData.findIndex((item) => item.sdzy.id === data.sdzy.id) + this.$set(this.roomInfo.roomData, targetIndex, data) + } break default: - console.log(response.cmdType, JSON.parse(response.data)) + console.log(response.cmdType, response.data) break } }) - this.ws.send({ cmdType: 'scenarioInfo' }) + this.ws.send({ cmdType: 'editScenarioInfo' }) }, closeWebsocket() { this.ws && this.ws.close() @@ -267,16 +299,19 @@ export default { } }, - initPlots(plots) { - plots.forEach((item) => { - if (item.lng && item.lat) { - this.cesium.addPlotByLonLat(item.imgBase64, { lon: +item.lng, lat: +item.lat }, item.id) + initPlots() { + this.roomInfo.roomData.forEach((item) => { + if (item.sdzy.lng && item.sdzy.lat) { + this.cesium.addPlotByLonLat(item.imgBase64, { lon: +item.sdzy.lng, lat: +item.sdzy.lat }, item.sdzy.id) } }) }, handleSelectZzbzll(selectedKeys, { node }) { - this.cesium.setClientByCenter({ longitude: +node.dataRef.lng, latitude: +node.dataRef.lat }) + this.cesium.setClientByCenter({ + longitude: +this.zzbzllSelectedFd.sdzy.lng, + latitude: +this.zzbzllSelectedFd.sdzy.lat, + }) }, }, } @@ -301,6 +336,9 @@ export default { background-color: #022234; } } +.ant-menu-horizontal { + line-height: 30px; +} .model-cesium-container { width: 100%; height: 100%; diff --git a/src/views/subsystem/scene/entry.vue b/src/views/subsystem/scene/entry.vue index dcee9e4..96dad1e 100644 --- a/src/views/subsystem/scene/entry.vue +++ b/src/views/subsystem/scene/entry.vue @@ -12,6 +12,7 @@ 剩余 {{ roomInfo.remainTimeStr }} -
+
+ + 统计分析 + +
@@ -54,16 +58,16 @@ ref="jcsx" v-if="zzbzllSelectedFd" :scenarioId="scenarioId" - :resourceId="zzbzllSelectedFd.id" - :resourceName="zzbzllSelectedFd.title" - :resourceType="zzbzllSelectedFd.resourceType" - :type="zzbzllSelectedFd.type" + :resourceId="zzbzllSelectedFd.sdzy.id" + :resourceName="zzbzllSelectedFd.sdzy.resourceName" + :resourceType="zzbzllSelectedFd.sdzy.resourceType" + :type="zzbzllSelectedFd.sdzy.type" :modelData="jcsxModelData" :readonly="true" />
- + @@ -72,8 +76,8 @@ ref="xdrw" v-if="zzbzllSelectedFd" :scenarioId="scenarioId" - :resourceId="zzbzllSelectedFd.id" - :resourceType="zzbzllSelectedFd.resourceType" + :resourceId="zzbzllSelectedFd.sdzy.id" + :resourceType="zzbzllSelectedFd.sdzy.resourceType" :actionList="xdrwActionList" :readonly="true" /> @@ -99,6 +103,7 @@ export default { }, data() { return { + initial: false, ws: null, roomInfo: { remainTimeStr: '', @@ -128,13 +133,30 @@ export default { }, computed: { zzbzllTreeData() { - return [] + const zzbzllTreeData = [ + { + id: '0', + resourceName: '红方', + selectable: false, + children: [], + }, + { + id: '1', + resourceName: '蓝方', + selectable: false, + children: [], + }, + ] + this.roomInfo.roomData.forEach((item) => { + zzbzllTreeData[item.sdzy.type].children.push(item.sdzy) + }) + return zzbzllTreeData }, zzbzllSelectedFd() { if (this.zzbzll.selectedKeys.length === 0) { return null } - return null + return this.roomInfo.roomData.find((item) => item.sdzy.id === this.zzbzll.selectedKeys[0]) }, rightRows() { switch (this.rightViewer) { @@ -149,7 +171,7 @@ export default { } }, blbzShowKeys() { - return [] + return this.zzbzllSelectedFd?.orgPostList.map((item) => item.orgId) || [] }, showBlbzCheckedTreeData() { const target = [] @@ -157,10 +179,10 @@ export default { return target }, jcsxModelData() { - return {} + return this.zzbzllSelectedFd?.jbxx || {} }, xdrwActionList() { - return [] + return this.zzbzllSelectedFd?.scenarioTasks || [] }, }, created() { @@ -206,16 +228,27 @@ export default { case 'path_update': this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points) break - case 'scenarioInfo': - this.roomInfo.roomData = response.data - // this.initPlots() + case 'editScenarioInfo': + if (this.initial === false) { + this.roomInfo.roomData = JSON.parse(response.data) + this.initPlots() + this.initial = true + } + break + case 'updScenarioInfo': + { + console.log(response.cmdType, response.data, typeof response.data) + const data = JSON.parse(response.data) + const targetIndex = this.roomInfo.roomData.findIndex((item) => item.sdzy.id === data.sdzy.id) + this.$set(this.roomInfo.roomData, targetIndex, data) + } break default: - console.log(response.cmdType, JSON.parse(response.data)) + // console.log(response.cmdType, response.data) break } }) - this.ws.send({ cmdType: 'scenarioInfo' }) + this.ws.send({ cmdType: 'editScenarioInfo' }) }, closeWebsocket() { this.ws && this.ws.close() @@ -231,16 +264,19 @@ export default { } }, - initPlots(plots) { - plots.forEach((item) => { - if (item.lng && item.lat) { - this.cesium.addPlotByLonLat(item.imgBase64, { lon: +item.lng, lat: +item.lat }, item.id) + initPlots() { + this.roomInfo.roomData.forEach((item) => { + if (item.sdzy.lng && item.sdzy.lat) { + this.cesium.addPlotByLonLat(item.sdzy.imgBase64, { lon: +item.sdzy.lng, lat: +item.sdzy.lat }, item.sdzy.id) } }) }, handleSelectZzbzll(selectedKeys, { node }) { - this.cesium.setClientByCenter({ longitude: +node.dataRef.lng, latitude: +node.dataRef.lat }) + this.cesium.setClientByCenter({ + longitude: +this.zzbzllSelectedFd.sdzy.lng, + latitude: +this.zzbzllSelectedFd.sdzy.lat, + }) }, }, } @@ -265,6 +301,9 @@ export default { background-color: #022234; } } +.ant-menu-horizontal { + line-height: 30px; +} .scene-cesium-container { width: 100%; height: 100%; diff --git a/src/views/subsystem/scene/presetting.vue b/src/views/subsystem/scene/presetting.vue index a298e1e..f8a16c6 100644 --- a/src/views/subsystem/scene/presetting.vue +++ b/src/views/subsystem/scene/presetting.vue @@ -71,7 +71,7 @@ @@ -195,7 +195,7 @@ export default { formData: {}, }, fd: { - force: 0, + teamType: 0, type: 5, loading: false, listData: [], @@ -329,7 +329,7 @@ export default { async getFdListData() { try { this.fd.loading = true - const res = await getAction(`/baseData/scenario/resources/${this.fd.type}`) + const res = await getAction(`/baseData/scenario/resources/${this.fd.type}/${this.fd.teamType}`) this.fd.listData = res.data } catch (error) { console.log(error) @@ -359,14 +359,14 @@ export default { const x = e.x - this.$refs['scene-presetting-cesium-container'].offsetLeft const y = e.y - this.$refs['scene-presetting-cesium-container'].offsetTop const { plotId, longitude, latitude } = this.cesium.addPlotByOffset(item.imgBase64, { x, y }) - this.savePlot(this.fd.force, item, { plotId, longitude, latitude }) + this.savePlot(this.fd.teamType, item, { plotId, longitude, latitude }) }, - async savePlot(force, item, { plotId, longitude, latitude }) { + async savePlot(teamType, item, { plotId, longitude, latitude }) { try { await postAction('/scenario/resource/save', { id: plotId, scenarioId: this.scenarioId, - type: force, + type: teamType, resourceType: item.type, resourceId: item.id, lng: longitude,