Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mmc-stl-vue2
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
mmc-stl-vue2
Commits
8bdc61f3
提交
8bdc61f3
authored
8月 06, 2025
作者:
温凯
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'v4' 到 'v4_master'
V4 查看合并请求
!10
上级
cfb8b7d6
8d19e538
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
500 行增加
和
36 行删除
+500
-36
index.js
iframe/src/i18n/index.js
+1
-1
ru.js
iframe/src/i18n/locales/ru.js
+4
-4
index.vue
...ControlCenter/components/hangar/components/list/index.vue
+40
-1
index.vue
...ponents/uavList/components/list/components/item/index.vue
+3
-2
index.vue
...Applications/components/uavList/components/list/index.vue
+51
-1
index.vue
...r/components/uavApplications/components/uavList/index.vue
+315
-1
index.vue
src/components/MMCFlightControlCenter/index.vue
+86
-26
没有找到文件。
iframe/src/i18n/index.js
浏览文件 @
8bdc61f3
...
...
@@ -25,7 +25,7 @@ const mergedMessages = {
}
const
i18n
=
new
VueI18n
({
locale
:
localStorage
.
getItem
(
'language'
)
||
'
en
'
,
// 从localStorage获取语言设置,默认英文
locale
:
localStorage
.
getItem
(
'language'
)
||
'
zh
'
,
// 从localStorage获取语言设置,默认英文
fallbackLocale
:
'zh'
,
// 回退语言
messages
:
mergedMessages
})
...
...
iframe/src/i18n/locales/ru.js
浏览文件 @
8bdc61f3
...
...
@@ -292,10 +292,10 @@ export default {
// "定时飞行": "Запланированный ",
// "周期飞行": "Периодический ",
// "蛙跳飞行": "Прыжковый ",
常态飞行
:
"
Обычн.
"
,
定时飞行
:
"
Запл.
"
,
周期飞行
:
"
Период.
"
,
蛙跳飞行
:
"
Прыжк.
"
,
常态飞行
:
"
стандарт
"
,
定时飞行
:
"
регулярный
"
,
周期飞行
:
"
цикл
"
,
蛙跳飞行
:
"
чехарда
"
,
// airwayEdit组件
手动规划
:
"Ручное планирование"
,
...
...
src/components/MMCFlightControlCenter/components/hangar/components/list/index.vue
浏览文件 @
8bdc61f3
...
...
@@ -47,12 +47,12 @@
import
{
Control_API
}
from
"../../../../api"
;
import
Item
from
"./components/item"
;
import
{
mapState
}
from
"vuex"
;
import
mock
from
'./mock'
;
export
default
{
name
:
"List"
,
props
:
{},
components
:
{
Item
},
inject
:
[
"bus"
],
data
()
{
return
{
list
:
/* mock */
[],
...
...
@@ -102,6 +102,7 @@ export default {
mounted
()
{
this
.
getList
();
this
.
bus
.
$on
(
"uas-device-getTree-message"
,
this
.
initList
);
this
.
bus
.
$on
(
"update-hangar-list"
,
this
.
updateHangarList
);
// this.timeHandle = setInterval(() => {
// this.getList();
// }, 10000);
...
...
@@ -123,6 +124,44 @@ export default {
onUavSearch
()
{
this
.
getList
();
},
/**
* 更新机库列表数据
*/
updateHangarList
(
data
)
{
console
.
log
(
'接收到hangar列表更新数据:'
,
data
);
// 保留原有的isCheck和collapse状态
const
oldList
=
this
.
list
;
const
newList
=
JSON
.
parse
(
JSON
.
stringify
(
data
)).
map
(
newItem
=>
{
const
oldItem
=
oldList
.
find
(
old
=>
old
.
id
===
newItem
.
id
);
if
(
oldItem
)
{
if
(
oldItem
.
isCheck
!==
undefined
)
{
newItem
.
isCheck
=
oldItem
.
isCheck
;
}
if
(
oldItem
.
collapse
!==
undefined
)
{
newItem
.
collapse
=
oldItem
.
collapse
;
}
}
// 如果有子设备,也需要保留子设备的isCheck和collapse状态
if
(
newItem
.
children
&&
oldItem
&&
oldItem
.
children
)
{
newItem
.
children
=
newItem
.
children
.
map
(
newChild
=>
{
const
oldChild
=
oldItem
.
children
.
find
(
old
=>
old
.
id
===
newChild
.
id
);
if
(
oldChild
)
{
if
(
oldChild
.
isCheck
!==
undefined
)
{
newChild
.
isCheck
=
oldChild
.
isCheck
;
}
if
(
oldChild
.
collapse
!==
undefined
)
{
newChild
.
collapse
=
oldChild
.
collapse
;
}
}
return
newChild
;
});
}
return
newItem
;
});
this
.
list
=
newList
;
},
},
};
</
script
>
...
...
src/components/MMCFlightControlCenter/components/uavApplications/components/uavList/components/list/components/item/index.vue
浏览文件 @
8bdc61f3
...
...
@@ -3,7 +3,7 @@
<div
class=
"uav-item-box"
>
<div
class=
"uav-item-inner"
@
click=
"$set(data, 'collapse', !data.collapse)"
@
click=
"$set(data, 'collapse', !data.collapse)"
>
<div
class=
"title-box"
>
<span
...
...
@@ -91,7 +91,8 @@
</div>
</
template
>
-->
<
template
>
<div
class=
"uav_version status-icon cp"
>
<div
class=
"uav_versioncp"
>
<!-- status-icon -->
<!--
<img
src=
"./assets/images/I.svg"
/>
<img
src=
"./assets/images/I.svg"
/>
-->
{{
device
.
modelName
}}
...
...
src/components/MMCFlightControlCenter/components/uavApplications/components/uavList/components/list/index.vue
浏览文件 @
8bdc61f3
...
...
@@ -39,13 +39,63 @@ export default {
},
watch
:
{
list
:
{
immediate
:
true
,
deep
:
true
,
handler
(
val
)
{
if
(
!
val
||
!
Array
.
isArray
(
val
))
{
this
.
wsList
=
[];
return
;
}
// 保留原有的状态(collapse 和 isCheck)
if
(
this
.
wsList
&&
this
.
wsList
.
length
>
0
)
{
const
preserveStates
=
(
newItems
,
oldItems
)
=>
{
newItems
.
forEach
(
newItem
=>
{
const
oldItem
=
oldItems
.
find
(
old
=>
old
.
deptId
===
newItem
.
deptId
);
if
(
oldItem
)
{
// 保留 collapse 状态
if
(
oldItem
.
hasOwnProperty
(
'collapse'
))
{
this
.
$set
(
newItem
,
'collapse'
,
oldItem
.
collapse
);
}
else
{
// 如果旧数据没有 collapse 属性,设置默认值为 false(收起状态)
this
.
$set
(
newItem
,
'collapse'
,
false
);
}
// 保留 isCheck 状态
if
(
oldItem
.
hasOwnProperty
(
'isCheck'
))
{
this
.
$set
(
newItem
,
'isCheck'
,
oldItem
.
isCheck
);
}
}
else
{
// 如果是新项目,设置默认的 collapse 状态
this
.
$set
(
newItem
,
'collapse'
,
false
);
}
// 处理子项
if
(
newItem
.
child
&&
oldItem
&&
oldItem
.
child
)
{
preserveStates
(
newItem
.
child
,
oldItem
.
child
);
}
});
};
preserveStates
(
val
,
this
.
wsList
);
}
else
{
// 初始化时确保每个项目都有 collapse 状态
const
initializeStates
=
(
items
)
=>
{
items
.
forEach
(
item
=>
{
if
(
!
item
.
hasOwnProperty
(
'collapse'
))
{
this
.
$set
(
item
,
'collapse'
,
false
);
}
// 处理子项
if
(
item
.
child
&&
Array
.
isArray
(
item
.
child
))
{
initializeStates
(
item
.
child
);
}
});
};
initializeStates
(
val
);
}
this
.
wsList
=
val
;
},
},
},
mounted
()
{
this
.
wsList
=
this
.
list
;
// watcher with immediate: true will handle initialization
},
methods
:
{
},
...
...
src/components/MMCFlightControlCenter/components/uavApplications/components/uavList/index.vue
浏览文件 @
8bdc61f3
...
...
@@ -47,6 +47,7 @@ export default {
components
:
{
List
,
},
inject
:
[
"bus"
],
data
()
{
return
{
uavList
:
[],
// 无人机列表
...
...
@@ -79,13 +80,17 @@ export default {
},
mounted
()
{
this
.
initList
();
// 移除重复的事件监听,避免与 update-uav-list 冲突
this
.
bus
.
$on
(
"uas-device-getTree-message"
,
this
.
initList
);
this
.
bus
.
$on
(
"update-uav-list"
,
this
.
updateUavList
);
// this.timeHandle = setInterval(() => {
// this.initList();
// }, 10000);
},
beforeDestroy
()
{
// clearInterval(this.timeHandle);
// 清理事件监听
this
.
bus
.
$off
(
"update-uav-list"
,
this
.
updateUavList
);
},
methods
:
{
async
initList
()
{
...
...
@@ -93,7 +98,7 @@ export default {
serchKey
:
this
.
uavSearchContent
,
deviceType
:
this
.
deviceType
,
});
this
.
uavList
=
res
.
data
;
this
.
uavList
=
res
.
data
;
},
collapseFlagfn
()
{
this
.
listCollapse
=
!
this
.
listCollapse
;
...
...
@@ -104,6 +109,315 @@ export default {
onUavSearch
()
{
this
.
initList
();
},
/**
* 更新无人机列表数据
*/
updateUavList
(
data
)
{
console
.
log
(
'updateUavList 接收到数据:'
,
data
);
// 数据安全检查
if
(
!
data
||
!
Array
.
isArray
(
data
))
{
console
.
warn
(
'updateUavList: 接收到的数据无效'
,
data
);
return
;
}
if
(
!
this
.
uavList
||
!
Array
.
isArray
(
this
.
uavList
))
{
this
.
uavList
=
[];
}
this
.
uavList
=
data
},
/**
* 备用更新方法 - 简单的状态保留更新
* @param {Array} data 新数据
*/
fallbackUpdate
(
data
)
{
console
.
log
(
'执行备用更新方法'
);
const
oldUavList
=
this
.
uavList
||
[];
const
newUavList
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
// 保留状态
newUavList
.
forEach
((
newItem
)
=>
{
if
(
!
newItem
||
!
newItem
.
deptId
)
return
;
const
oldItem
=
oldUavList
.
find
((
old
)
=>
old
&&
old
.
deptId
===
newItem
.
deptId
);
if
(
oldItem
)
{
// 保留collapse和isCheck状态
if
(
oldItem
.
hasOwnProperty
(
'collapse'
))
{
this
.
$set
(
newItem
,
'collapse'
,
oldItem
.
collapse
);
}
else
{
this
.
$set
(
newItem
,
'collapse'
,
false
);
}
if
(
oldItem
.
hasOwnProperty
(
'isCheck'
))
{
this
.
$set
(
newItem
,
'isCheck'
,
oldItem
.
isCheck
);
}
}
else
{
this
.
$set
(
newItem
,
'collapse'
,
false
);
}
});
this
.
uavList
=
newUavList
;
console
.
log
(
'备用更新完成'
);
},
/**
* 更新子设备
* @param {Object} oldItem 旧项目
return;
}
if (!oldItem.child || !Array.isArray(oldItem.child)) {
this.$set(oldItem, 'child', []);
}
// 删除不存在的子设备
for (let i = oldItem.child.length - 1; i >= 0; i--) {
const oldChild = oldItem.child[i];
if (!oldChild || !oldChild.deptId) continue;
const newChild = newItem.child.find(child => child && child.deptId === oldChild.deptId);
if (!newChild) {
console.log('删除子设备:', oldChild.deptName);
this.$delete(oldItem.child, i);
}
}
// 新增和更新子设备
newItem.child.forEach((newChild) => {
if (!newChild || !newChild.deptId) return;
const oldChildIndex = oldItem.child.findIndex(child => child && child.deptId === newChild.deptId);
if (oldChildIndex === -1) {
// 新增子设备
console.log('新增子设备:', newChild.deptName);
const newChildCopy = JSON.parse(JSON.stringify(newChild));
// 保留旧的isCheck状态(如果存在)
if (newChild.hasOwnProperty('isCheck')) {
this.$set(newChildCopy, 'isCheck', newChild.isCheck);
}
this.$set(oldItem.child, oldItem.child.length, newChildCopy);
} else {
// 更新子设备字段
const oldChild = oldItem.child[oldChildIndex];
const childFields = ['deptName', 'deviceCount', 'onlineCount', 'offlineCount', 'takeStatus', 'takeOver', 'online', 'status'];
childFields.forEach(field => {
if (newChild.hasOwnProperty(field) && oldChild[field] !== newChild[field]) {
console.log(`更新子设备字段 [${oldChild.deptName}] ${field}:`, oldChild[field], '->', newChild[field]);
this.$set(oldChild, field, newChild[field]);
}
});
}
});
},
/**
* 更新设备列表
* @param {Object} oldItem 旧项目
* @param {Object} newItem 新项目
*/
updateDeviceList
(
oldItem
,
newItem
)
{
if
(
!
newItem
.
deviceDOList
||
!
Array
.
isArray
(
newItem
.
deviceDOList
))
{
if
(
oldItem
.
deviceDOList
&&
Array
.
isArray
(
oldItem
.
deviceDOList
))
{
this
.
$set
(
oldItem
,
'deviceDOList'
,
[]);
}
return
;
}
if
(
!
oldItem
.
deviceDOList
||
!
Array
.
isArray
(
oldItem
.
deviceDOList
))
{
this
.
$set
(
oldItem
,
'deviceDOList'
,
[]);
}
// 删除不存在的设备
for
(
let
i
=
oldItem
.
deviceDOList
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
oldDevice
=
oldItem
.
deviceDOList
[
i
];
if
(
!
oldDevice
||
!
oldDevice
.
deviceId
)
continue
;
const
newDevice
=
newItem
.
deviceDOList
.
find
(
device
=>
device
&&
device
.
deviceId
===
oldDevice
.
deviceId
);
if
(
!
newDevice
)
{
console
.
log
(
'删除设备:'
,
oldDevice
.
deviceName
||
oldDevice
.
deviceId
);
this
.
$delete
(
oldItem
.
deviceDOList
,
i
);
}
}
// 新增和更新设备
newItem
.
deviceDOList
.
forEach
((
newDevice
)
=>
{
if
(
!
newDevice
||
!
newDevice
.
deviceId
)
return
;
const
oldDeviceIndex
=
oldItem
.
deviceDOList
.
findIndex
(
device
=>
device
&&
device
.
deviceId
===
newDevice
.
deviceId
);
if
(
oldDeviceIndex
===
-
1
)
{
// 新增设备
console
.
log
(
'新增设备:'
,
newDevice
.
deviceName
||
newDevice
.
deviceId
);
const
newDeviceCopy
=
JSON
.
parse
(
JSON
.
stringify
(
newDevice
));
// 保留设备的状态属性(如果存在)
Object
.
keys
(
newDevice
).
forEach
(
key
=>
{
if
(
key
.
includes
(
'Check'
)
||
key
.
includes
(
'State'
)
||
key
.
includes
(
'Status'
))
{
if
(
newDevice
.
hasOwnProperty
(
key
))
{
this
.
$set
(
newDeviceCopy
,
key
,
newDevice
[
key
]);
}
}
});
this
.
$set
(
oldItem
.
deviceDOList
,
oldItem
.
deviceDOList
.
length
,
newDeviceCopy
);
}
else
{
// 更新设备字段
const
oldDevice
=
oldItem
.
deviceDOList
[
oldDeviceIndex
];
const
deviceFields
=
[
'deviceName'
,
'takeStatus'
,
'takeOver'
,
'online'
,
'status'
,
'connectionStatus'
,
'currentOperator'
];
deviceFields
.
forEach
(
field
=>
{
if
(
newDevice
.
hasOwnProperty
(
field
)
&&
oldDevice
[
field
]
!==
newDevice
[
field
])
{
console
.
log
(
`更新设备字段 [
${
oldDevice
.
deviceName
||
oldDevice
.
deviceId
}
]
${
field
}
:`
,
oldDevice
[
field
],
'->'
,
newDevice
[
field
]);
this
.
$set
(
oldDevice
,
field
,
newDevice
[
field
]);
}
});
}
});
},
/**
* 对比新旧UAV数据,检查是否有变化
* @param {Array} oldData 旧数据
* @param {Array} newData 新数据
* @returns {boolean} 是否有变化
*/
compareAndUpdateUavData
(
oldData
,
newData
)
{
// 如果数组长度不同,肯定有变化
if
(
oldData
.
length
!==
newData
.
length
)
{
console
.
log
(
'数据长度变化:'
,
oldData
.
length
,
'->'
,
newData
.
length
);
return
true
;
}
// 基于 deptId 进行匹配对比,而不是按索引位置
for
(
const
newItem
of
newData
)
{
if
(
!
newItem
||
!
newItem
.
deptId
)
{
console
.
log
(
'新数据项无效或缺少 deptId:'
,
newItem
);
return
true
;
}
const
oldItem
=
oldData
.
find
(
item
=>
item
&&
item
.
deptId
===
newItem
.
deptId
);
if
(
!
oldItem
)
{
console
.
log
(
'发现新增项目:'
,
newItem
.
deptId
,
newItem
.
deptName
);
return
true
;
}
// 对比关键字段 - 主要判断接管状态和设备在线离线状态
const
keyFields
=
[
'deptName'
,
'deviceCount'
,
'onlineCount'
,
'offlineCount'
,
'takeStatus'
,
'takeOver'
,
'online'
,
'status'
];
for
(
const
field
of
keyFields
)
{
if
(
oldItem
[
field
]
!==
newItem
[
field
])
{
console
.
log
(
`字段变化 [
${
newItem
.
deptName
}
]
${
field
}
:`
,
oldItem
[
field
],
'->'
,
newItem
[
field
]);
return
true
;
}
}
// 对比子设备数组
if
(
this
.
compareChildDevices
(
oldItem
.
child
||
[],
newItem
.
child
||
[]))
{
console
.
log
(
'子设备数据变化:'
,
newItem
.
deptName
);
return
true
;
}
// 对比设备列表
if
(
this
.
compareDeviceList
(
oldItem
.
deviceDOList
||
[],
newItem
.
deviceDOList
||
[]))
{
console
.
log
(
'设备列表数据变化:'
,
newItem
.
deptName
);
return
true
;
}
}
// 检查是否有项目被删除
for
(
const
oldItem
of
oldData
)
{
if
(
oldItem
&&
oldItem
.
deptId
)
{
const
newItem
=
newData
.
find
(
item
=>
item
&&
item
.
deptId
===
oldItem
.
deptId
);
if
(
!
newItem
)
{
console
.
log
(
'发现删除项目:'
,
oldItem
.
deptId
,
oldItem
.
deptName
);
return
true
;
}
}
}
return
false
;
},
/**
* 对比子设备数据
*/
compareChildDevices
(
oldChildren
,
newChildren
)
{
if
(
oldChildren
.
length
!==
newChildren
.
length
)
{
return
true
;
}
// 基于 deptId 进行匹配对比
for
(
const
newChild
of
newChildren
)
{
if
(
!
newChild
||
!
newChild
.
deptId
)
{
return
true
;
}
const
oldChild
=
oldChildren
.
find
(
item
=>
item
&&
item
.
deptId
===
newChild
.
deptId
);
if
(
!
oldChild
)
{
return
true
;
}
const
childFields
=
[
'deptName'
,
'deviceCount'
,
'onlineCount'
,
'offlineCount'
,
'takeStatus'
,
'takeOver'
,
'online'
,
'status'
];
for
(
const
field
of
childFields
)
{
if
(
oldChild
[
field
]
!==
newChild
[
field
])
{
return
true
;
}
}
}
// 检查是否有子设备被删除
for
(
const
oldChild
of
oldChildren
)
{
if
(
oldChild
&&
oldChild
.
deptId
)
{
const
newChild
=
newChildren
.
find
(
item
=>
item
&&
item
.
deptId
===
oldChild
.
deptId
);
if
(
!
newChild
)
{
return
true
;
}
}
}
return
false
;
},
/**
* 对比设备列表数据
*/
compareDeviceList
(
oldDevices
,
newDevices
)
{
if
(
oldDevices
.
length
!==
newDevices
.
length
)
{
return
true
;
}
// 基于 deviceId 进行匹配对比
for
(
const
newDevice
of
newDevices
)
{
if
(
!
newDevice
||
!
newDevice
.
deviceId
)
{
return
true
;
}
const
oldDevice
=
oldDevices
.
find
(
item
=>
item
&&
item
.
deviceId
===
newDevice
.
deviceId
);
if
(
!
oldDevice
)
{
return
true
;
}
const
deviceFields
=
[
'deviceName'
,
'status'
,
'online'
,
'takeStatus'
,
'takeOver'
,
'connectionStatus'
,
'currentOperator'
];
for
(
const
field
of
deviceFields
)
{
if
(
oldDevice
[
field
]
!==
newDevice
[
field
])
{
return
true
;
}
}
}
// 检查是否有设备被删除
for
(
const
oldDevice
of
oldDevices
)
{
if
(
oldDevice
&&
oldDevice
.
deviceId
)
{
const
newDevice
=
newDevices
.
find
(
item
=>
item
&&
item
.
deviceId
===
oldDevice
.
deviceId
);
if
(
!
newDevice
)
{
return
true
;
}
}
}
return
false
;
},
},
};
</
script
>
...
...
src/components/MMCFlightControlCenter/index.vue
浏览文件 @
8bdc61f3
...
...
@@ -91,9 +91,10 @@ export default {
},
data
()
{
return
{
time
:
null
,
bus
:
new
Vue
(),
ws
:
null
,
uavWs
:
null
uavWs
:
null
};
},
provide
()
{
...
...
@@ -103,14 +104,6 @@ export default {
};
},
watch
:
{
'scene'
:
{
handler
(
newVal
)
{
if
(
newVal
)
{
this
.
reset
()
}
},
},
userInfo
:
{
immediate
:
true
,
handler
()
{
...
...
@@ -200,6 +193,7 @@ export default {
},
beforeCreate
()
{
clearInterval
(
this
.
time
)
crashMonitor
({
alert
:
this
.
$alert
,
});
...
...
@@ -228,11 +222,12 @@ export default {
window
.
$mmc_stl
.
viewer
=
this
.
cesiumViewer
;
}
// 连接ws监听接管请求数据
let
url
=
this
.
url
.
wsUrl
let
token
=
this
.
$store
.
state
.
MMCFlightControlCenter
.
token
const
socket
=
new
WebSocket
(
`
${
url
}
/infra/ws?token=
${
token
}
`
);
const
uavSocket
=
new
WebSocket
(
`
${
url
}
/ua
v
/ws?token=
${
token
}
`
);
const
uavSocket
=
new
WebSocket
(
`
${
url
}
/ua
s
/ws?token=
${
token
}
`
);
this
.
ws
=
socket
;
this
.
uavWs
=
uavSocket
;
socket
.
onopen
=
function
()
{
...
...
@@ -286,11 +281,6 @@ export default {
// 接管申请同意
case
"uas-device-take-agree-message"
:
console
.
log
(
'同意接管'
)
this
.
bus
.
$emit
(
"uas-device-take-agree-message"
,
{
type
,
content
,
msg
,
});
break
;
// 接管申请拒绝
...
...
@@ -308,7 +298,7 @@ export default {
title
:
"接管消息"
,
message
:
msg
,
duration
:
30000
,
offset
:
40
offset
:
40
});
break
;
...
...
@@ -318,12 +308,34 @@ export default {
title
:
"接管消息"
,
message
:
msg
,
duration
:
30000
,
offset
:
40
offset
:
40
});
break
;
}
};
uavSocket
.
onopen
=
function
()
{
uavSocket
.
onopen
=
()
=>
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
'tmj'
))
let
{
projectId
}
=
this
.
$store
.
state
.
MMCFlightControlCenter
;
if
(
user
){
clearInterval
(
this
.
time
)
this
.
time
=
setInterval
(()
=>
{
const
scene
=
this
.
getQueryParam
(
'scene'
);
uavSocket
.
send
(
JSON
.
stringify
({
type
:
"uas-device-getTree-message"
,
content
:
JSON
.
stringify
(
{
text
:
JSON
.
stringify
({
deviceType
:
scene
,
projectId
:
projectId
,
serchKey
:
this
.
getCurrentSearchKey
(),
}),
toUserId
:
user
.
user
.
userId
,
},)
}));
},
6000
);
}
};
uavSocket
.
onmessage
=
(
event
)
=>
{
let
data
=
JSON
.
parse
(
event
.
data
||
"{}"
);
...
...
@@ -332,17 +344,22 @@ export default {
const
msg
=
content
.
message
;
switch
(
type
)
{
case
"uas-device-take-message"
:
console
.
log
(
msg
,
'msg'
);
break
;
break
;
// 刷新无人机列表
case
"uas-device-getTree-message"
:
this
.
bus
.
$emit
(
"uas-device-getTree-message"
,
{
type
,
content
,
msg
,
});
break
;
let
res
=
JSON
.
parse
(
data
.
content
)
const
scene
=
this
.
getQueryParam
(
'scene'
);
// 根据scene值决定更新哪个组件的数据
if
(
scene
==
1
)
{
// scene为1时,更新uavList组件的数据
this
.
bus
.
$emit
(
"update-uav-list"
,
res
.
text
);
}
else
if
(
scene
==
2
)
{
// scene为2时,更新hangar list组件的数据
this
.
bus
.
$emit
(
"update-hangar-list"
,
res
.
text
);
}
break
;
}
};
},
...
...
@@ -351,6 +368,49 @@ export default {
this
.
uavWs
.
close
();
},
methods
:
{
// 获取当前搜索关键字
getCurrentSearchKey
()
{
const
scene
=
this
.
getQueryParam
(
'scene'
);
if
(
scene
==
1
)
{
// 无人机场景,获取 uavList 组件的搜索内容
const
uavListComponent
=
this
.
$children
.
find
(
child
=>
child
.
$options
.
name
===
'UavApplications'
);
if
(
uavListComponent
)
{
const
uavList
=
uavListComponent
.
$children
.
find
(
child
=>
child
.
$options
.
name
===
'UavList'
||
child
.
uavSearchContent
!==
undefined
);
return
uavList
?
uavList
.
uavSearchContent
||
''
:
''
;
}
}
else
if
(
scene
==
2
)
{
// 机库场景,获取 hangar 组件的搜索内容
const
hangarComponent
=
this
.
$children
.
find
(
child
=>
child
.
$options
.
name
===
'Hangar'
);
if
(
hangarComponent
)
{
const
hangarList
=
hangarComponent
.
$children
.
find
(
child
=>
child
.
$options
.
name
===
'List'
||
child
.
searchContent
!==
undefined
);
return
hangarList
?
hangarList
.
searchContent
||
''
:
''
;
}
}
return
''
;
},
// 处理搜索变化事件
getQueryParam
(
paramName
)
{
// 获取当前页面的完整 URL
const
url
=
window
.
location
.
href
;
// 检查 URL 中是否包含 hash 部分
const
hashIndex
=
url
.
indexOf
(
'#'
);
if
(
hashIndex
!==
-
1
)
{
// 如果有 hash 部分,提取 hash 部分
const
hash
=
url
.
substring
(
hashIndex
+
1
);
// 去掉 '#' 符号
const
hashParams
=
new
URLSearchParams
(
hash
.
split
(
'?'
)[
1
]);
// 提取 hash 中的查询参数部分
const
value
=
hashParams
.
get
(
paramName
);
if
(
value
!==
null
)
{
return
value
;
// 如果在 hash 中找到参数,直接返回
}
}
// 如果在 hash 中没有找到,检查普通的查询参数
const
searchParams
=
new
URLSearchParams
(
window
.
location
.
search
);
return
searchParams
.
get
(
paramName
);
// 返回普通查询参数中的值
},
reset
()
{
let
cesiumEl
=
document
.
querySelector
(
".cesium-viewer"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论