From 54f044c68c4f6279c2fab0d0b6c5ca13bbd9f4c4 Mon Sep 17 00:00:00 2001
From: liaoboping <344114999@qq.com>
Date: Sun, 21 Sep 2025 04:34:46 +0800
Subject: [PATCH] coding
---
src/components/Common/Cesium/index.js | 19 +++++++++++-----
src/views/subsystem/control/index.vue | 2 +-
src/views/subsystem/display/index.vue | 11 ++++++++--
src/views/subsystem/model/index.vue | 8 +++++--
src/views/subsystem/scene/components/Jcsx.vue | 22 ++++++++++++++-----
src/views/subsystem/scene/index.vue | 9 +++++---
src/views/subsystem/scene/presetting.vue | 5 ++++-
7 files changed, 55 insertions(+), 21 deletions(-)
diff --git a/src/components/Common/Cesium/index.js b/src/components/Common/Cesium/index.js
index 186ab32..6c52318 100644
--- a/src/components/Common/Cesium/index.js
+++ b/src/components/Common/Cesium/index.js
@@ -49,7 +49,7 @@ export default class MyCesium {
plots = []
// 已添加的路线
routes = []
-
+
constructor(dom, options = {}) {
const imageryProvider = new Cesium.UrlTemplateImageryProvider({
url: window._CONFIG.ImageryProviderUrl || MyCesium.ImageryProviderUrl,
@@ -210,7 +210,7 @@ export default class MyCesium {
image: base64,
width: 50,
height: 50,
- scaleByDistance: new Cesium.NearFarScalar(1000.0, 0.8, 10000000.0, 0.2), // 重点:设置随距离缩放
+ scaleByDistance: new Cesium.NearFarScalar(1000.0, 0.6, 10000000.0, 0.2), // 重点:设置随距离缩放
},
properties: {
type: MyCesium.ENTITY_TYPES.IMAGE,
@@ -258,7 +258,7 @@ export default class MyCesium {
image: base64,
width: 50,
height: 50,
- scaleByDistance: new Cesium.NearFarScalar(1000.0, 0.8, 10000000.0, 0.2), // 重点:设置随距离缩放
+ scaleByDistance: new Cesium.NearFarScalar(1000.0, 0.6, 10000000.0, 0.2), // 重点:设置随距离缩放
},
properties: {
type: MyCesium.ENTITY_TYPES.IMAGE,
@@ -276,17 +276,24 @@ export default class MyCesium {
* 连续坐标绘制路线
* @param coordinates [[longitude, latitude], ...]
*/
- drawRouteByCoordinates(coordinates) {
+ drawRouteByCoordinates(coordinates, customId, color) {
+ const hasIndex = this.routes.findIndex((item) => item.properties.customId === customId)
+ if (hasIndex !== -1) {
+ this.viewer.entities.remove(this.routes[hasIndex])
+ this.routes.splice(hasIndex, 1)
+ }
const route = {
id: Cesium.createGuid(),
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray(coordinates.flat()),
width: 2,
- material: Cesium.Color.fromCssColorString('red'),
+ material: Cesium.Color.fromCssColorString(color || 'red'),
show: true,
clampToGround: true,
},
- properties: {},
+ properties: {
+ customId,
+ },
}
this.viewer.entities.add(route)
this.routes.push(route)
diff --git a/src/views/subsystem/control/index.vue b/src/views/subsystem/control/index.vue
index 319cd8e..f11dd34 100644
--- a/src/views/subsystem/control/index.vue
+++ b/src/views/subsystem/control/index.vue
@@ -335,7 +335,7 @@ export default {
try {
await postAction('/scenario/room/mag', {
id: this.detail.roomId,
- scenarioId: 2746,
+ scenarioId: this.detail.scenarioId,
mag: this.detail.data.mag * 2,
})
this.getRoomList()
diff --git a/src/views/subsystem/display/index.vue b/src/views/subsystem/display/index.vue
index e7610b1..448ad31 100644
--- a/src/views/subsystem/display/index.vue
+++ b/src/views/subsystem/display/index.vue
@@ -91,7 +91,11 @@ export default {
this.roomInfo.duringTime = response.data.during_time
break
case 'path_init':
- this.cesium.drawRouteByCoordinates(response.data.points)
+ this.cesium.drawRouteByCoordinates(
+ response.data.points,
+ response.data.resourceId,
+ ['red', 'blue'][response.data.teamType]
+ )
break
case 'path_update':
this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points)
@@ -111,11 +115,14 @@ export default {
}
break
default:
- console.log(response.cmdType, response.data)
+ // console.log(response.cmdType, response.data)
break
}
})
+ // 初始化数据
this.ws.send({ cmdType: 'editScenarioInfo' })
+ // 初始化路径
+ this.ws.send({ cmdType: 'get_init_path' })
},
closeWebsocket() {
this.ws && this.ws.close()
diff --git a/src/views/subsystem/model/index.vue b/src/views/subsystem/model/index.vue
index 4b02869..588d00a 100644
--- a/src/views/subsystem/model/index.vue
+++ b/src/views/subsystem/model/index.vue
@@ -74,6 +74,7 @@
v-if="zzbzllSelectedFd"
:scenarioId="scenarioId"
:resourceId="zzbzllSelectedFd.id"
+ :originResourceId="zzbzllSelectedFd.resourceId"
:resourceName="zzbzllSelectedFd.title"
:resourceType="zzbzllSelectedFd.resourceType"
:type="zzbzllSelectedFd.type"
@@ -284,7 +285,7 @@ export default {
this.roomInfo.duringTime = response.data.during_time
break
case 'path_init':
- this.cesium.drawRouteByCoordinates(response.data.points)
+ this.cesium.drawRouteByCoordinates(response.data.points, response.data.resourceId, ['red', 'blue'][response.data.teamType])
break
case 'path_update':
this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points)
@@ -304,11 +305,14 @@ export default {
}
break
default:
- console.log(response.cmdType, response.data)
+ // console.log(response.cmdType, response.data)
break
}
})
+ // 初始化数据
this.ws.send({ cmdType: 'editScenarioInfo' })
+ // 初始化路径
+ this.ws.send({ cmdType: 'get_init_path' })
},
closeWebsocket() {
this.ws && this.ws.close()
diff --git a/src/views/subsystem/scene/components/Jcsx.vue b/src/views/subsystem/scene/components/Jcsx.vue
index 7ae783f..7ca6187 100644
--- a/src/views/subsystem/scene/components/Jcsx.vue
+++ b/src/views/subsystem/scene/components/Jcsx.vue
@@ -24,7 +24,12 @@
{{ modelData.team?.lat | latFormat }}
-
+
postAction('/scenario/resource/', { scenarioId: this.scenarioId }).then((res) => ({
- data: res.data.filter(
- (item) =>
- item.resourceType === 5 &&
- (this.modelData.battleSuppliers || []).findIndex((i) => i.battleResourceId === item.id) === -1
- ),
+ data: res.data
+ .filter(
+ (item) =>
+ item.resourceType === 5 &&
+ item.type === this.type &&
+ (this.modelData.battleSuppliers || []).findIndex((i) => i.battleResourceId === item.id) === -1
+ )
+ .map((item) => ({ ...item, _title: item.resourceName || item.title })),
})),
+ labelKey: '_title',
},
},
{
diff --git a/src/views/subsystem/scene/index.vue b/src/views/subsystem/scene/index.vue
index db73088..259b4fe 100644
--- a/src/views/subsystem/scene/index.vue
+++ b/src/views/subsystem/scene/index.vue
@@ -59,6 +59,7 @@
v-if="zzbzllSelectedFd"
:scenarioId="scenarioId"
:resourceId="zzbzllSelectedFd.sdzy.id"
+ :originResourceId="zzbzllSelectedFd.sdzy.resourceId"
:resourceName="zzbzllSelectedFd.sdzy.resourceName"
:resourceType="zzbzllSelectedFd.sdzy.resourceType"
:type="zzbzllSelectedFd.sdzy.type"
@@ -209,7 +210,7 @@ export default {
if (item.children && item.children.length > 0) {
this.getTree(newChildren, item.children, showKeys)
}
- if (newChildren.length > 0 || showKeys.includes(item.key)) {
+ if (newChildren.length > 0 || showKeys.includes(+item.key)) {
target.push({ ...item, children: newChildren })
}
})
@@ -248,7 +249,7 @@ export default {
this.roomInfo.duringTime = response.data.during_time
break
case 'path_init':
- this.cesium.drawRouteByCoordinates(response.data.points)
+ this.cesium.drawRouteByCoordinates(response.data.points, response.data.resourceId, ['red', 'blue'][response.data.teamType])
break
case 'path_update':
this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points)
@@ -262,7 +263,6 @@ export default {
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)
@@ -273,7 +273,10 @@ export default {
break
}
})
+ // 初始化数据
this.ws.send({ cmdType: 'editScenarioInfo' })
+ // 初始化路径
+ this.ws.send({ cmdType: 'get_init_path' })
},
closeWebsocket() {
this.ws && this.ws.close()
diff --git a/src/views/subsystem/scene/presetting.vue b/src/views/subsystem/scene/presetting.vue
index 0d9910e..ea2a652 100644
--- a/src/views/subsystem/scene/presetting.vue
+++ b/src/views/subsystem/scene/presetting.vue
@@ -88,6 +88,7 @@