This commit is contained in:
liaoboping 2025-09-21 04:34:46 +08:00
parent 840f27a93b
commit 54f044c68c
7 changed files with 55 additions and 21 deletions

View File

@ -210,7 +210,7 @@ export default class MyCesium {
image: base64, image: base64,
width: 50, width: 50,
height: 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: { properties: {
type: MyCesium.ENTITY_TYPES.IMAGE, type: MyCesium.ENTITY_TYPES.IMAGE,
@ -258,7 +258,7 @@ export default class MyCesium {
image: base64, image: base64,
width: 50, width: 50,
height: 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: { properties: {
type: MyCesium.ENTITY_TYPES.IMAGE, type: MyCesium.ENTITY_TYPES.IMAGE,
@ -276,17 +276,24 @@ export default class MyCesium {
* 连续坐标绘制路线 * 连续坐标绘制路线
* @param coordinates [[longitude, latitude], ...] * @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 = { const route = {
id: Cesium.createGuid(), id: Cesium.createGuid(),
polyline: { polyline: {
positions: Cesium.Cartesian3.fromDegreesArray(coordinates.flat()), positions: Cesium.Cartesian3.fromDegreesArray(coordinates.flat()),
width: 2, width: 2,
material: Cesium.Color.fromCssColorString('red'), material: Cesium.Color.fromCssColorString(color || 'red'),
show: true, show: true,
clampToGround: true, clampToGround: true,
}, },
properties: {}, properties: {
customId,
},
} }
this.viewer.entities.add(route) this.viewer.entities.add(route)
this.routes.push(route) this.routes.push(route)

View File

@ -335,7 +335,7 @@ export default {
try { try {
await postAction('/scenario/room/mag', { await postAction('/scenario/room/mag', {
id: this.detail.roomId, id: this.detail.roomId,
scenarioId: 2746, scenarioId: this.detail.scenarioId,
mag: this.detail.data.mag * 2, mag: this.detail.data.mag * 2,
}) })
this.getRoomList() this.getRoomList()

View File

@ -91,7 +91,11 @@ export default {
this.roomInfo.duringTime = response.data.during_time this.roomInfo.duringTime = response.data.during_time
break break
case 'path_init': case 'path_init':
this.cesium.drawRouteByCoordinates(response.data.points) this.cesium.drawRouteByCoordinates(
response.data.points,
response.data.resourceId,
['red', 'blue'][response.data.teamType]
)
break break
case 'path_update': case 'path_update':
this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points) this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points)
@ -111,11 +115,14 @@ export default {
} }
break break
default: default:
console.log(response.cmdType, response.data) // console.log(response.cmdType, response.data)
break break
} }
}) })
//
this.ws.send({ cmdType: 'editScenarioInfo' }) this.ws.send({ cmdType: 'editScenarioInfo' })
//
this.ws.send({ cmdType: 'get_init_path' })
}, },
closeWebsocket() { closeWebsocket() {
this.ws && this.ws.close() this.ws && this.ws.close()

View File

@ -74,6 +74,7 @@
v-if="zzbzllSelectedFd" v-if="zzbzllSelectedFd"
:scenarioId="scenarioId" :scenarioId="scenarioId"
:resourceId="zzbzllSelectedFd.id" :resourceId="zzbzllSelectedFd.id"
:originResourceId="zzbzllSelectedFd.resourceId"
:resourceName="zzbzllSelectedFd.title" :resourceName="zzbzllSelectedFd.title"
:resourceType="zzbzllSelectedFd.resourceType" :resourceType="zzbzllSelectedFd.resourceType"
:type="zzbzllSelectedFd.type" :type="zzbzllSelectedFd.type"
@ -284,7 +285,7 @@ export default {
this.roomInfo.duringTime = response.data.during_time this.roomInfo.duringTime = response.data.during_time
break break
case 'path_init': case 'path_init':
this.cesium.drawRouteByCoordinates(response.data.points) this.cesium.drawRouteByCoordinates(response.data.points, response.data.resourceId, ['red', 'blue'][response.data.teamType])
break break
case 'path_update': case 'path_update':
this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points) this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points)
@ -304,11 +305,14 @@ export default {
} }
break break
default: default:
console.log(response.cmdType, response.data) // console.log(response.cmdType, response.data)
break break
} }
}) })
//
this.ws.send({ cmdType: 'editScenarioInfo' }) this.ws.send({ cmdType: 'editScenarioInfo' })
//
this.ws.send({ cmdType: 'get_init_path' })
}, },
closeWebsocket() { closeWebsocket() {
this.ws && this.ws.close() this.ws && this.ws.close()

View File

@ -24,7 +24,12 @@
<span class="flex-1">{{ modelData.team?.lat | latFormat }}</span> <span class="flex-1">{{ modelData.team?.lat | latFormat }}</span>
</Flex> </Flex>
</div> </div>
<a-collapse-panel v-if="resourceType === 6" key="1" header="可保障的作战分队" class="simulation-collapse-item"> <a-collapse-panel
v-if="resourceType === 6 && ![13, 14, 16].includes(originResourceId)"
key="1"
header="可保障的作战分队"
class="simulation-collapse-item"
>
<template v-if="!readonly" #extra> <template v-if="!readonly" #extra>
<a-button type="text-primary" icon="plus" @click.stop="handleOpenResourceModal"> </a-button> <a-button type="text-primary" icon="plus" @click.stop="handleOpenResourceModal"> </a-button>
<AntFormModal <AntFormModal
@ -59,6 +64,7 @@ export default {
props: { props: {
scenarioId: { type: [Number, String], required: true }, scenarioId: { type: [Number, String], required: true },
resourceId: { type: [Number, String], required: true }, resourceId: { type: [Number, String], required: true },
originResourceId: { type: [Number, String], required: true },
resourceName: { type: String, required: true }, resourceName: { type: String, required: true },
resourceType: { type: Number, required: true }, resourceType: { type: Number, required: true },
type: { type: [Number, String], required: true }, type: { type: [Number, String], required: true },
@ -82,12 +88,16 @@ export default {
options: { options: {
dataSource: () => dataSource: () =>
postAction('/scenario/resource/', { scenarioId: this.scenarioId }).then((res) => ({ postAction('/scenario/resource/', { scenarioId: this.scenarioId }).then((res) => ({
data: res.data.filter( data: res.data
.filter(
(item) => (item) =>
item.resourceType === 5 && item.resourceType === 5 &&
item.type === this.type &&
(this.modelData.battleSuppliers || []).findIndex((i) => i.battleResourceId === item.id) === -1 (this.modelData.battleSuppliers || []).findIndex((i) => i.battleResourceId === item.id) === -1
), )
.map((item) => ({ ...item, _title: item.resourceName || item.title })),
})), })),
labelKey: '_title',
}, },
}, },
{ {

View File

@ -59,6 +59,7 @@
v-if="zzbzllSelectedFd" v-if="zzbzllSelectedFd"
:scenarioId="scenarioId" :scenarioId="scenarioId"
:resourceId="zzbzllSelectedFd.sdzy.id" :resourceId="zzbzllSelectedFd.sdzy.id"
:originResourceId="zzbzllSelectedFd.sdzy.resourceId"
:resourceName="zzbzllSelectedFd.sdzy.resourceName" :resourceName="zzbzllSelectedFd.sdzy.resourceName"
:resourceType="zzbzllSelectedFd.sdzy.resourceType" :resourceType="zzbzllSelectedFd.sdzy.resourceType"
:type="zzbzllSelectedFd.sdzy.type" :type="zzbzllSelectedFd.sdzy.type"
@ -209,7 +210,7 @@ export default {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
this.getTree(newChildren, item.children, showKeys) 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 }) target.push({ ...item, children: newChildren })
} }
}) })
@ -248,7 +249,7 @@ export default {
this.roomInfo.duringTime = response.data.during_time this.roomInfo.duringTime = response.data.during_time
break break
case 'path_init': case 'path_init':
this.cesium.drawRouteByCoordinates(response.data.points) this.cesium.drawRouteByCoordinates(response.data.points, response.data.resourceId, ['red', 'blue'][response.data.teamType])
break break
case 'path_update': case 'path_update':
this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points) this.cesium.movePlotByCoordinates(response.data.resourceId, response.data.points)
@ -262,7 +263,6 @@ export default {
break break
case 'updScenarioInfo': case 'updScenarioInfo':
{ {
console.log(response.cmdType, response.data, typeof response.data)
const data = JSON.parse(response.data) const data = JSON.parse(response.data)
const targetIndex = this.roomInfo.roomData.findIndex((item) => item.sdzy.id === data.sdzy.id) const targetIndex = this.roomInfo.roomData.findIndex((item) => item.sdzy.id === data.sdzy.id)
this.$set(this.roomInfo.roomData, targetIndex, data) this.$set(this.roomInfo.roomData, targetIndex, data)
@ -273,7 +273,10 @@ export default {
break break
} }
}) })
//
this.ws.send({ cmdType: 'editScenarioInfo' }) this.ws.send({ cmdType: 'editScenarioInfo' })
//
this.ws.send({ cmdType: 'get_init_path' })
}, },
closeWebsocket() { closeWebsocket() {
this.ws && this.ws.close() this.ws && this.ws.close()

View File

@ -88,6 +88,7 @@
<template #extra> <template #extra>
<template v-if="zzbzll.selectedFd"> <template v-if="zzbzll.selectedFd">
<a-button <a-button
v-if="![13, 14, 16].includes(zzbzll.selectedFd.resourceId)"
type="text-primary" type="text-primary"
icon="setting" icon="setting"
style="font-size: 20px" style="font-size: 20px"
@ -126,7 +127,8 @@
v-if="zzbzll.selectedFd" v-if="zzbzll.selectedFd"
:scenarioId="scenarioId" :scenarioId="scenarioId"
:resourceId="zzbzll.selectedFd.id" :resourceId="zzbzll.selectedFd.id"
:resourceName="zzbzll.selectedFd.title" :originResourceId="zzbzll.selectedFd.resourceId"
:resourceName="zzbzll.selectedFd.resourceName || zzbzll.selectedFd.title"
:resourceType="zzbzll.selectedFd.resourceType" :resourceType="zzbzll.selectedFd.resourceType"
:type="zzbzll.selectedFd.type" :type="zzbzll.selectedFd.type"
:modelData="jcsx.modelData" :modelData="jcsx.modelData"
@ -149,6 +151,7 @@
:resourceId="zzbzll.selectedFd.id" :resourceId="zzbzll.selectedFd.id"
:resourceType="zzbzll.selectedFd.resourceType" :resourceType="zzbzll.selectedFd.resourceType"
:actionList="xdrw.actionList" :actionList="xdrw.actionList"
:readonly="[13, 14, 16].includes(zzbzll.selectedFd.resourceId)"
@request="getXdrwActionList()" @request="getXdrwActionList()"
/> />
</div> </div>