coding
This commit is contained in:
parent
840f27a93b
commit
54f044c68c
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -24,7 +24,12 @@
|
|||
<span class="flex-1">{{ modelData.team?.lat | latFormat }}</span>
|
||||
</Flex>
|
||||
</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>
|
||||
<a-button type="text-primary" icon="plus" @click.stop="handleOpenResourceModal"> </a-button>
|
||||
<AntFormModal
|
||||
|
@ -59,6 +64,7 @@ export default {
|
|||
props: {
|
||||
scenarioId: { type: [Number, String], required: true },
|
||||
resourceId: { type: [Number, String], required: true },
|
||||
originResourceId: { type: [Number, String], required: true },
|
||||
resourceName: { type: String, required: true },
|
||||
resourceType: { type: Number, required: true },
|
||||
type: { type: [Number, String], required: true },
|
||||
|
@ -82,12 +88,16 @@ export default {
|
|||
options: {
|
||||
dataSource: () =>
|
||||
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',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
<template #extra>
|
||||
<template v-if="zzbzll.selectedFd">
|
||||
<a-button
|
||||
v-if="![13, 14, 16].includes(zzbzll.selectedFd.resourceId)"
|
||||
type="text-primary"
|
||||
icon="setting"
|
||||
style="font-size: 20px"
|
||||
|
@ -126,7 +127,8 @@
|
|||
v-if="zzbzll.selectedFd"
|
||||
:scenarioId="scenarioId"
|
||||
:resourceId="zzbzll.selectedFd.id"
|
||||
:resourceName="zzbzll.selectedFd.title"
|
||||
:originResourceId="zzbzll.selectedFd.resourceId"
|
||||
:resourceName="zzbzll.selectedFd.resourceName || zzbzll.selectedFd.title"
|
||||
:resourceType="zzbzll.selectedFd.resourceType"
|
||||
:type="zzbzll.selectedFd.type"
|
||||
:modelData="jcsx.modelData"
|
||||
|
@ -149,6 +151,7 @@
|
|||
:resourceId="zzbzll.selectedFd.id"
|
||||
:resourceType="zzbzll.selectedFd.resourceType"
|
||||
:actionList="xdrw.actionList"
|
||||
:readonly="[13, 14, 16].includes(zzbzll.selectedFd.resourceId)"
|
||||
@request="getXdrwActionList()"
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user