Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mmc-stl-vue2
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
mmc-stl-vue2
Commits
489032ec
提交
489032ec
authored
11月 01, 2026
作者:
“kai”
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:第一套
上级
cb781c19
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
655 行增加
和
53 行删除
+655
-53
.DS_Store
.DS_Store
+0
-0
.DS_Store
src/components/MMCFlightControlCenter/api/.DS_Store
+0
-0
index.js
src/components/MMCFlightControlCenter/api/index.js
+3
-2
dataOutputs.js
...ponents/MMCFlightControlCenter/api/modules/dataOutputs.js
+21
-0
index.vue
...nts/MMCFlightControlCenter/components/menuIcons/index.vue
+82
-44
index.vue
.../MMCFlightControlCenter/components/regionReport/index.vue
+529
-0
index.vue
...pplications/components/player/components/aiList/index.vue
+20
-7
没有找到文件。
.DS_Store
0 → 100644
浏览文件 @
489032ec
File added
src/components/MMCFlightControlCenter/api/.DS_Store
0 → 100644
浏览文件 @
489032ec
File added
src/components/MMCFlightControlCenter/api/index.js
浏览文件 @
489032ec
...
...
@@ -5,4 +5,5 @@ export { default as AI_API} from './modules/ai';
export
{
default
as
ViewLibrary
}
from
'./modules/viewLibrary'
;
export
{
default
as
TaskInfo
}
from
'./modules/taskInfo'
;
export
{
default
as
System
}
from
'./modules/system'
;
export
{
default
as
Resource_API
}
from
'./modules/resource'
;
\ No newline at end of file
export
{
default
as
Resource_API
}
from
'./modules/resource'
;
export
{
default
as
DataOutputs
}
from
'./modules/dataOutputs'
;
\ No newline at end of file
src/components/MMCFlightControlCenter/api/modules/dataOutputs.js
0 → 100644
浏览文件 @
489032ec
import
request
from
"../request"
;
/**
* 数据输出接口(成果中心)
* 移植自 mmc-tmjv4-vue 成果中心(/MonitoringCenter/dataOutputs)的导出报告
*/
export
default
{
/**
* 导出 AI 分析报告(docx)
* params: { folderId, fileType } TMJ 按文件夹导出
* { deviceId, fileType } FKZX 图库按设备组织(无 folderId)
*/
exporAnalysis
(
params
)
{
return
request
({
url
:
"/admin-api/data/video-image/export-analysis"
,
method
:
"get"
,
responseType
:
"blob"
,
params
,
});
},
};
src/components/MMCFlightControlCenter/components/menuIcons/index.vue
浏览文件 @
489032ec
<
template
>
<!--
FKZX 左侧
菜单图标的微应用内副本(违法取证/日常巡检/火情识别
)
- 显示时机:
与右侧工具栏/资源按钮一致——**选中(接管)无人机后才出现**(v-show 保位置不重置
)
- 位置:视频播放器右侧(默认 top:20%; left:calc(35%+730px)
,随 .player 尺寸走
)
FKZX 左侧
功能按钮(烟火识别 / 导出报告
)
- 显示时机:
选中(接管)无人机后才出现(v-show="visible"
)
- 位置:视频播放器右侧(默认 top:20%; left:calc(35%+730px))
- 可整条鼠标拖动(transform 位移,不回弹)
-
高亮当前菜单(rootNode.menuName
)
-
点击(非拖动)→ postMessage 通知主项目切换菜单(event: menuChange)
-
烟火识别:复用播放器 aiList 的 kbtAi 识别(截图当前视频→AI接口→结果弹窗
)
-
导出报告:调用成果中心接口导出 AI 分析报告 docx
-->
<div
class=
"fk-menu-icons"
...
...
@@ -18,7 +18,6 @@
class=
"fmi-item"
v-for=
"item in menus"
:key=
"item.name"
:class=
"
{ active: item.name === menuName }"
:style=
"
{ '--mc': item.color, '--icon': `url(${item.icon})` }"
@click="onItemClick(item)"
>
...
...
@@ -32,6 +31,7 @@
import
uavIcon
from
"./assets/uav.svg"
;
import
uavVideoIcon
from
"./assets/uavVideo.svg"
;
import
{
mapState
}
from
"vuex"
;
import
{
DataOutputs
}
from
"../../api"
;
export
default
{
name
:
"FkMenuIcons"
,
...
...
@@ -40,22 +40,18 @@ export default {
return
{
menus
:
[
{
name
:
"
违法取证
"
,
label
:
this
.
tf
(
"
dataCenter.违法取证"
,
"违法取证
"
),
color
:
"#
E9B949
"
,
name
:
"
烟火识别
"
,
label
:
this
.
tf
(
"
common.烟火识别"
,
"烟火识别
"
),
color
:
"#
FF7A45
"
,
icon
:
uavIcon
,
action
:
"fire"
,
},
{
name
:
"日常巡检"
,
label
:
this
.
tf
(
"common.日常巡检"
,
"日常巡检"
),
color
:
"#4AA3EF"
,
icon
:
uavIcon
,
},
{
name
:
"火情识别"
,
label
:
this
.
tf
(
"common.火情识别"
,
"火情识别"
),
color
:
"#63D18C"
,
name
:
"导出报告"
,
label
:
this
.
tf
(
"common.导出报告"
,
"导出报告"
),
color
:
"#43DEFF"
,
icon
:
uavVideoIcon
,
action
:
"report"
,
},
],
tx
:
0
,
// 拖动位移 X
...
...
@@ -68,17 +64,23 @@ export default {
menuName
()
{
return
(
this
.
rootNode
&&
this
.
rootNode
.
menuName
)
||
""
;
},
//
与右侧工具栏(ControlPanel v-if="uav && showPanel")保持一致:
//
未选中/未接管无人机时不显示,选中设备后才浮现
//
仅在选中「火情/烟火识别」菜单且已接管无人机时展示
//
menuName 由主框架下发(无 code),用关键词兼容中/英/俄多语言菜单名
visible
()
{
return
!!
this
.
uav
;
if
(
!
this
.
uav
)
return
false
;
const
name
=
(
this
.
menuName
||
""
).
trim
().
toLowerCase
();
return
(
name
.
includes
(
"火情"
)
||
name
.
includes
(
"烟火"
)
||
name
.
includes
(
"fire"
)
||
name
.
includes
(
"пожар"
)
);
},
dragStyle
()
{
return
{
transform
:
`translate(
${
this
.
tx
}
px,
${
this
.
ty
}
px)`
};
},
},
methods
:
{
// i18n 兜底:key 不存在时退回中文(避免 micro 端缺命名空间显示 key 本身)
tf
(
key
,
fallback
)
{
try
{
const
v
=
this
.
$t
(
key
);
...
...
@@ -87,10 +89,9 @@ export default {
return
fallback
;
}
},
// 按下开始拖动:document 级 mousemove/mouseup,位移超 3px 视为拖动
onDragStart
(
e
)
{
if
(
e
.
button
!==
0
)
return
;
e
.
preventDefault
();
// 阻止选中文字/图片原生拖拽
e
.
preventDefault
();
const
state
=
{
startX
:
e
.
clientX
,
startY
:
e
.
clientY
,
...
...
@@ -98,7 +99,7 @@ export default {
startTy
:
this
.
ty
,
moved
:
false
,
};
this
.
_dragState
=
state
;
// 非响应式,仅内部用
this
.
_dragState
=
state
;
const
move
=
(
ev
)
=>
{
const
dx
=
ev
.
clientX
-
state
.
startX
;
const
dy
=
ev
.
clientY
-
state
.
startY
;
...
...
@@ -115,19 +116,63 @@ export default {
document
.
addEventListener
(
"mousemove"
,
move
);
document
.
addEventListener
(
"mouseup"
,
up
);
},
// 点击切换菜单:拖动结束的那次 click 不触发(moved 标记在下一次 mousedown 才复位)
onItemClick
(
item
)
{
// 拖动结束的那次 click 不触发
if
(
this
.
_dragState
&&
this
.
_dragState
.
moved
)
return
;
if
(
item
.
name
===
this
.
menuName
)
return
;
// 已是当前菜单
window
.
parent
.
postMessage
(
{
module
:
"MMCFlightControlCenter"
,
type
:
"event"
,
event
:
"menuChange"
,
data
:
{
name
:
item
.
name
},
},
"*"
);
if
(
item
.
action
===
"fire"
)
{
this
.
onFireIdentify
();
}
else
if
(
item
.
action
===
"report"
)
{
this
.
onExportReport
();
}
},
// 烟火识别:复用播放器 aiList 的 kbtAi 识别(截图当前画面)
onFireIdentify
()
{
const
player
=
window
.
$uavPlayer
;
if
(
!
player
)
{
this
.
$message
&&
this
.
$message
.
warning
(
"播放器未就绪,请先接管无人机"
);
return
;
}
const
aiList
=
player
.
$refs
&&
player
.
$refs
.
aiList
;
if
(
!
aiList
)
{
this
.
$message
&&
this
.
$message
.
warning
(
"AI 识别组件未加载,请重新进入无人机应用"
);
return
;
}
// 2 = 烟火识别 typeId(识别结果存成果中心 detectorType=2)
aiList
.
onAiIdentify
(
2
);
},
// 导出报告:成果中心 AI 分析报告(docx)
async
onExportReport
()
{
const
uav
=
this
.
uav
||
{};
try
{
if
(
this
.
$message
)
{
this
.
$message
({
message
:
"报告生成中..."
,
type
:
"success"
});
}
// 只导烟火识别报告:detectorType=2
const
params
=
{
fileType
:
0
,
detectorType
:
2
};
// FKZX 图库按设备组织;若后端要求 folderId 需另行确认
if
(
uav
.
deviceId
)
{
params
.
deviceId
=
uav
.
deviceId
;
}
const
res
=
await
DataOutputs
.
exporAnalysis
(
params
);
const
blob
=
res
instanceof
Blob
?
res
:
new
Blob
([
res
]);
this
.
downloadBlob
(
blob
,
"AI分析报告.docx"
);
}
catch
(
e
)
{
console
.
warn
(
"[fk-menu-icons] 导出报告失败"
,
e
);
if
(
this
.
$message
)
{
this
.
$message
.
error
(
"导出报告失败"
);
}
}
},
downloadBlob
(
blob
,
filename
)
{
const
url
=
window
.
URL
.
createObjectURL
(
blob
);
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
filename
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
},
};
...
...
@@ -136,7 +181,6 @@ export default {
<
style
lang=
"scss"
scoped
>
.fk-menu-icons
{
position
:
absolute
;
//
视频播放器(.player)为
left
:
35%
+
宽
718px
,图标条默认贴其右侧(+
12px
间隙),同
top
起点
top
:
20%
;
left
:
calc
(
35%
+
730px
);
z-index
:
20
;
...
...
@@ -159,7 +203,6 @@ export default {
background
:
rgba
(
8
,
34
,
30
,
0.6
);
transition
:
background
0.2s
,
box-shadow
0.2s
,
border-color
0.2s
;
//
图标
mask
染色(与主项目左侧菜单同款做法)
.fmi-icon
{
display
:
block
;
width
:
24px
;
...
...
@@ -184,12 +227,7 @@ export default {
&
:hover
{
border-color
:
var
(
--mc
);
}
&
.active
{
background
:
rgba
(
8
,
34
,
30
,
0.92
);
border-color
:
var
(
--mc
);
box-shadow
:
inset
0
0
12px
-4px
var
(
--mc
),
0
0
10px
-5px
var
(
--mc
);
background
:
rgba
(
8
,
34
,
30
,
0.9
);
}
}
}
...
...
src/components/MMCFlightControlCenter/components/regionReport/index.vue
0 → 100644
浏览文件 @
489032ec
<
template
>
<div
class=
"region-report"
>
<!-- 绘制面板 -->
<div
class=
"rr-panel"
v-show=
"visible"
>
<div
class=
"rr-head"
>
<span
class=
"rr-title"
>
区域分析
</span>
<span
class=
"rr-close"
@
click=
"onClose"
>
×
</span>
</div>
<div
class=
"rr-body"
>
<div
class=
"rr-row"
>
<span
class=
"rr-label"
>
绘制工具:
</span>
<span
class=
"rr-tool"
:class=
"
{ active: markType === 'POLYGON' }"
@click="drawClick('POLYGON')"
>多边形
</span
>
<span
class=
"rr-tool"
:class=
"
{ active: markType === 'CIRCLE' }"
@click="drawClick('CIRCLE')"
>圆形
</span
>
</div>
<div
class=
"rr-tip"
>
{{
tip
}}
</div>
</div>
<div
class=
"rr-foot"
>
<span
class=
"rr-btn"
@
click=
"onClose"
>
取消
</span>
<span
class=
"rr-btn primary"
@
click=
"onSubmit"
>
确定
</span>
</div>
</div>
<!-- 统计结果 + 导出 -->
<div
class=
"rr-result"
v-show=
"showResult"
>
<div
class=
"rr-head"
>
<span
class=
"rr-title"
>
分析结果
</span>
<span
class=
"rr-close"
@
click=
"showResult = false"
>
×
</span>
</div>
<div
class=
"rr-chart"
ref=
"chartRef"
></div>
<div
class=
"rr-export"
@
click=
"onExport"
>
生成并导出报告
</div>
</div>
</div>
</
template
>
<
script
>
import
{
mapState
}
from
"vuex"
;
import
echarts
from
"echarts"
;
import
{
DataOutputs
}
from
"../../api"
;
// 模块级绘制缓存(与 TMJ Regional 一致的实现方式)
let
entities
=
[];
let
positions
=
[];
let
radiusDistance
=
null
;
let
circleEntity
=
null
;
export
default
{
name
:
"RegionReport"
,
props
:
{
visible
:
{
type
:
Boolean
,
default
:
false
},
},
data
()
{
return
{
markType
:
""
,
tip
:
"请选择绘制工具,在地图上绘制区域"
,
showResult
:
false
,
chartInstance
:
null
,
currentData
:
[],
// 统计结果缓存,导出用
};
},
computed
:
{
...
mapState
(
"MMCFlightControlCenter"
,
[
"cesiumViewer"
]),
},
beforeDestroy
()
{
this
.
clearMarker
();
this
.
removeInputAction
();
if
(
this
.
chartInstance
)
{
this
.
chartInstance
.
dispose
();
this
.
chartInstance
=
null
;
}
},
methods
:
{
// Cartesian3 -> WGS84 经纬度(Cesium 原生实现,替代 mmc/utils/cesium 的 Utils)
transformCartesian2WGS84
(
cartesian
)
{
const
Cesium
=
window
.
Cesium
;
const
carto
=
Cesium
.
Cartographic
.
fromCartesian
(
cartesian
);
return
{
lng
:
Cesium
.
Math
.
toDegrees
(
carto
.
longitude
),
lat
:
Cesium
.
Math
.
toDegrees
(
carto
.
latitude
),
alt
:
carto
.
height
,
};
},
getViewer
()
{
return
(
this
.
cesiumViewer
||
(
window
.
$mmc_stl
&&
window
.
$mmc_stl
.
viewer
)
||
window
.
viewer
);
},
// 屏幕坐标 -> 世界坐标(pickPosition 失败时回退椭球拾取)
pickWorld
(
viewer
,
clientPos
)
{
const
Cesium
=
window
.
Cesium
;
let
pos
=
null
;
try
{
pos
=
viewer
.
scene
.
pickPosition
(
clientPos
);
}
catch
(
e
)
{
pos
=
null
;
}
if
(
!
pos
)
{
try
{
pos
=
viewer
.
camera
.
pickEllipsoid
(
clientPos
,
viewer
.
scene
.
globe
.
ellipsoid
);
}
catch
(
e
)
{
pos
=
null
;
}
}
return
pos
;
},
onClose
()
{
this
.
clearMarker
();
this
.
removeInputAction
();
this
.
markType
=
""
;
this
.
showResult
=
false
;
this
.
$emit
(
"close"
);
},
removeInputAction
()
{
const
viewer
=
this
.
getViewer
();
const
Cesium
=
window
.
Cesium
;
if
(
!
viewer
||
!
Cesium
||
!
viewer
.
screenSpaceEventHandler
)
return
;
if
(
this
.
leftClickHandler
)
{
viewer
.
screenSpaceEventHandler
.
removeInputAction
(
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
,
this
.
leftClickHandler
);
this
.
leftClickHandler
=
null
;
}
if
(
this
.
rightClickHandler
)
{
viewer
.
screenSpaceEventHandler
.
removeInputAction
(
Cesium
.
ScreenSpaceEventType
.
RIGHT_CLICK
,
this
.
rightClickHandler
);
this
.
rightClickHandler
=
null
;
}
},
clearMarker
()
{
const
viewer
=
this
.
getViewer
();
if
(
viewer
&&
entities
.
length
)
{
entities
.
forEach
((
e
)
=>
viewer
.
entities
.
remove
(
e
));
}
entities
=
[];
positions
=
[];
circleEntity
=
null
;
radiusDistance
=
null
;
},
// 添加点
createPoint
(
viewer
,
Cesium
,
position
)
{
const
pointEntity
=
viewer
.
entities
.
add
({
position
,
point
:
{
pixelSize
:
20
,
color
:
Cesium
.
Color
.
RED
,
outlineColor
:
Cesium
.
Color
.
WHITE
,
outlineWidth
:
2
,
},
});
entities
.
push
(
pointEntity
);
positions
.
push
(
position
);
},
// 添加两点之间的线 + 距离标注
createPolyline
(
viewer
,
Cesium
,
position
)
{
if
(
positions
.
length
>
1
)
{
const
lineEntity
=
viewer
.
entities
.
add
({
polyline
:
{
positions
:
[
positions
[
positions
.
length
-
2
],
position
],
width
:
2
,
material
:
Cesium
.
Color
.
RED
,
},
});
entities
.
push
(
lineEntity
);
radiusDistance
=
Cesium
.
Cartesian3
.
distance
(
position
,
positions
[
positions
.
length
-
2
]
);
}
},
// 绘制圆形
createCircle
(
viewer
,
Cesium
)
{
if
(
positions
.
length
<
2
)
return
;
const
radius
=
Cesium
.
Cartesian3
.
distance
(
positions
[
0
],
positions
[
1
]);
circleEntity
=
viewer
.
entities
.
add
({
position
:
positions
[
0
],
ellipse
:
{
semiMinorAxis
:
radius
,
semiMajorAxis
:
radius
,
material
:
Cesium
.
Color
.
RED
.
withAlpha
(
0.5
),
outline
:
true
,
outlineColor
:
Cesium
.
Color
.
WHITE
,
},
});
entities
.
push
(
circleEntity
);
},
// 选择绘制工具
drawClick
(
type
)
{
const
viewer
=
this
.
getViewer
();
const
Cesium
=
window
.
Cesium
;
if
(
!
viewer
||
!
Cesium
)
{
this
.
$message
&&
this
.
$message
.
warning
(
"地图未就绪"
);
return
;
}
this
.
removeInputAction
();
this
.
clearMarker
();
this
.
markType
=
type
;
if
(
type
===
"CIRCLE"
)
{
this
.
tip
=
"圆形:点击选择圆心,再点击确定半径"
;
this
.
leftClickHandler
=
viewer
.
screenSpaceEventHandler
.
setInputAction
(
(
event
)
=>
{
const
pos
=
this
.
pickWorld
(
viewer
,
event
.
position
);
if
(
!
pos
)
return
;
this
.
createPoint
(
viewer
,
Cesium
,
pos
);
if
(
positions
.
length
===
2
)
{
this
.
createCircle
(
viewer
,
Cesium
);
this
.
removeInputAction
();
this
.
tip
=
"圆形绘制完成,可点击「确定」统计"
;
}
else
{
this
.
tip
=
"请点击第二点确定半径"
;
}
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
}
else
{
this
.
tip
=
"多边形:左键逐点绘制,右键双击闭合"
;
this
.
leftClickHandler
=
viewer
.
screenSpaceEventHandler
.
setInputAction
(
(
e
)
=>
{
const
pos
=
this
.
pickWorld
(
viewer
,
e
.
position
);
if
(
!
pos
)
return
;
this
.
createPoint
(
viewer
,
Cesium
,
pos
);
this
.
createPolyline
(
viewer
,
Cesium
,
pos
);
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
let
rightClickTimer
=
null
;
let
isRightDoubleClick
=
false
;
this
.
rightClickHandler
=
viewer
.
screenSpaceEventHandler
.
setInputAction
(
()
=>
{
if
(
rightClickTimer
)
{
clearTimeout
(
rightClickTimer
);
isRightDoubleClick
=
true
;
this
.
finishPolygon
(
viewer
,
Cesium
);
}
else
{
rightClickTimer
=
setTimeout
(()
=>
{
if
(
!
isRightDoubleClick
)
return
;
rightClickTimer
=
undefined
;
isRightDoubleClick
=
false
;
},
300
);
}
},
Cesium
.
ScreenSpaceEventType
.
RIGHT_CLICK
);
}
},
// 闭合多边形
finishPolygon
(
viewer
,
Cesium
)
{
if
(
positions
.
length
<
3
)
{
this
.
$message
&&
this
.
$message
.
warning
(
"请最少选择三个点"
);
return
;
}
this
.
removeInputAction
();
const
polygonEntity
=
viewer
.
entities
.
add
({
polygon
:
{
hierarchy
:
positions
,
material
:
Cesium
.
Color
.
RED
.
withAlpha
(
0.5
),
},
});
entities
.
push
(
polygonEntity
);
// 补最后一条闭合边
const
lineEntity
=
viewer
.
entities
.
add
({
polyline
:
{
positions
:
[
positions
[
0
],
positions
[
positions
.
length
-
1
]],
width
:
2
,
material
:
Cesium
.
Color
.
RED
,
},
});
entities
.
push
(
lineEntity
);
this
.
tip
=
"多边形绘制完成,可点击「确定」统计"
;
},
// 确定 -> 统计
async
onSubmit
()
{
if
(
!
entities
.
length
||
!
positions
.
length
||
!
this
.
markType
)
{
this
.
$message
&&
this
.
$message
.
warning
(
"请先绘制区域"
);
return
;
}
let
points
=
[];
let
radius
=
0
;
if
(
this
.
markType
===
"POLYGON"
)
{
const
closed
=
[...
positions
,
positions
[
0
]];
closed
.
forEach
((
item
)
=>
{
const
{
lng
,
lat
}
=
this
.
transformCartesian2WGS84
(
item
);
points
.
push
({
latitude
:
lat
,
longitude
:
lng
,
height
:
0
});
});
points
=
JSON
.
stringify
(
points
);
}
else
{
const
{
lng
,
lat
}
=
this
.
transformCartesian2WGS84
(
positions
[
0
]);
points
=
JSON
.
stringify
([{
latitude
:
lat
,
longitude
:
lng
,
height
:
0
}]);
radius
=
(
radiusDistance
||
0
)
/
100000
;
}
const
data
=
{
areaData
:
points
,
areaType
:
this
.
markType
===
"CIRCLE"
?
4
:
3
,
radius
:
this
.
markType
===
"CIRCLE"
?
radius
:
0
,
};
try
{
const
res
=
await
DataOutputs
.
areaAnalysis
(
data
);
const
list
=
(
res
&&
res
.
data
)
||
(
Array
.
isArray
(
res
)
?
res
:
[])
||
[];
if
(
!
list
.
length
)
{
this
.
$message
&&
this
.
$message
.
warning
(
"此地区无带有标签的标注"
);
return
;
}
this
.
currentData
=
list
;
this
.
showResult
=
true
;
this
.
$nextTick
(()
=>
this
.
renderChart
(
list
));
}
catch
(
e
)
{
console
.
warn
(
"[regionReport] areaAnalysis 失败"
,
e
);
}
},
// 渲染饼图
renderChart
(
list
)
{
const
dom
=
this
.
$refs
.
chartRef
;
if
(
!
dom
)
return
;
if
(
!
this
.
chartInstance
)
{
this
.
chartInstance
=
echarts
.
init
(
dom
);
}
this
.
chartInstance
.
clear
();
const
pieData
=
list
.
map
((
item
)
=>
({
name
:
item
.
name
,
value
:
item
.
count
,
}));
this
.
chartInstance
.
setOption
({
tooltip
:
{
trigger
:
"item"
},
legend
:
{
type
:
"scroll"
,
orient
:
"horizontal"
,
bottom
:
0
,
textStyle
:
{
color
:
"#cbd0eb"
,
fontSize
:
10
},
},
series
:
[
{
name
:
"标注统计"
,
type
:
"pie"
,
radius
:
[
"30%"
,
"62%"
],
center
:
[
"50%"
,
"45%"
],
data
:
pieData
,
label
:
{
color
:
"#cbd0eb"
,
fontSize
:
10
},
},
],
});
},
// 导出报告
async
onExport
()
{
const
dom
=
this
.
$refs
.
chartRef
;
if
(
!
dom
)
return
;
try
{
const
canvas
=
dom
.
querySelector
(
"canvas"
);
let
blob
=
null
;
if
(
canvas
)
{
blob
=
await
new
Promise
((
resolve
)
=>
canvas
.
toBlob
((
b
)
=>
resolve
(
b
))
);
}
const
data
=
new
FormData
();
data
.
append
(
"file"
,
blob
);
data
.
append
(
"areaType"
,
this
.
markType
===
"CIRCLE"
?
4
:
3
);
if
(
this
.
markType
===
"CIRCLE"
)
{
data
.
append
(
"radius"
,
(
radiusDistance
||
0
)
/
100000
);
}
// areaData 复用绘制时数据:重新组装
let
points
=
[];
if
(
this
.
markType
===
"POLYGON"
)
{
[...
positions
,
positions
[
0
]].
forEach
((
item
)
=>
{
const
{
lng
,
lat
}
=
this
.
transformCartesian2WGS84
(
item
);
points
.
push
({
latitude
:
lat
,
longitude
:
lng
,
height
:
0
});
});
}
else
{
const
{
lng
,
lat
}
=
this
.
transformCartesian2WGS84
(
positions
[
0
]);
points
.
push
({
latitude
:
lat
,
longitude
:
lng
,
height
:
0
});
}
data
.
append
(
"areaData"
,
JSON
.
stringify
(
points
));
const
res
=
await
DataOutputs
.
analysisDocx
(
data
);
const
blobData
=
res
&&
res
.
data
?
res
.
data
:
res
;
let
filename
=
"区域分析报告.docx"
;
const
headers
=
(
res
&&
res
.
headers
)
||
{};
const
cd
=
headers
[
"content-disposition"
]
||
headers
[
"Content-Disposition"
]
||
headers
[
"Content-disposition"
];
if
(
cd
)
{
const
m
=
cd
.
match
(
/filename
[
*
]?\s
*=
\s
*
(?:
"
([^
"
]
+
)
"|'
([^
'
]
+
)
'|
([^
;
\s]
+
))
/i
);
if
(
m
)
{
const
raw
=
m
[
1
]
||
m
[
2
]
||
m
[
3
];
try
{
filename
=
decodeURIComponent
(
raw
);
}
catch
(
e
)
{
filename
=
raw
;
}
}
}
this
.
downloadBlob
(
blobData
,
filename
);
}
catch
(
e
)
{
console
.
warn
(
"[regionReport] 导出失败"
,
e
);
this
.
$message
&&
this
.
$message
.
error
(
"导出失败"
);
}
},
downloadBlob
(
blob
,
filename
)
{
const
url
=
window
.
URL
.
createObjectURL
(
blob
);
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
filename
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
window
.
URL
.
revokeObjectURL
(
url
);
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.region-report
{
.rr-panel,
.rr-result
{
position
:
fixed
;
right
:
80px
;
top
:
106px
;
width
:
320px
;
background
:
rgba
(
10
,
22
,
38
,
0.92
);
border
:
1px
solid
var
(
--border-light
,
#43deff
);
border-radius
:
4px
;
color
:
#cbd0eb
;
z-index
:
30
;
backdrop-filter
:
blur
(
4px
);
}
.rr-result
{
top
:
106px
;
right
:
410px
;
width
:
360px
;
}
.rr-head
{
height
:
32px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
padding
:
0
10px
;
border-bottom
:
1px
solid
rgba
(
67
,
222
,
255
,
0.25
);
.rr-title
{
font-size
:
14px
;
color
:
#ebf5ff
;
}
.rr-close
{
cursor
:
pointer
;
color
:
#9bacbe
;
}
}
.rr-body
{
padding
:
10px
;
.rr-row
{
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
}
.rr-label
{
font-size
:
13px
;
color
:
#9bacbe
;
}
.rr-tool
{
cursor
:
pointer
;
padding
:
4px
10px
;
border
:
1px
solid
rgba
(
67
,
222
,
255
,
0.4
);
border-radius
:
3px
;
font-size
:
12px
;
color
:
#cbd0eb
;
&.active
{
background
:
rgba
(
0
,
79
,
255
,
0.3
);
border-color
:
#43deff
;
color
:
#fff
;
}
}
.rr-tip
{
margin-top
:
8px
;
font-size
:
12px
;
color
:
#9bacbe
;
line-height
:
18px
;
}
}
.rr-foot
{
display
:
flex
;
justify-content
:
center
;
gap
:
10px
;
padding
:
0
0
10px
;
.rr-btn
{
cursor
:
pointer
;
width
:
90px
;
height
:
30px
;
line-height
:
30px
;
text-align
:
center
;
background
:
rgba
(
0
,
79
,
255
,
0.5
);
border-radius
:
3px
;
font-size
:
13px
;
color
:
#ebf5ff
;
&.primary
{
background
:
#004fff
;
}
}
}
.rr-chart
{
width
:
100%
;
height
:
240px
;
}
.rr-export
{
cursor
:
pointer
;
margin
:
0
10px
10px
;
height
:
32px
;
line-height
:
32px
;
text-align
:
center
;
background
:
#004fff
;
border-radius
:
3px
;
color
:
#fff
;
font-size
:
13px
;
}
}
</
style
>
src/components/MMCFlightControlCenter/components/uavApplications/components/player/components/aiList/index.vue
浏览文件 @
489032ec
...
...
@@ -340,7 +340,20 @@ return [
* ai处理, 父组件也调用
*/
aiIdentify
(
type
,
callback
)
{
let
find
=
this
.
aiIdentifyList
.
find
((
item
)
=>
item
.
type
===
type
);
// type 支持字符串标识(type)或数字(typeId),便于精确指定识别类型(如烟火 typeId=2)
// 优先用接口配置的可用列表;未加载/为空时回退到前端完整列表(deAiIdentifyList)
const
list
=
this
.
aiIdentifyList
&&
this
.
aiIdentifyList
.
length
?
this
.
aiIdentifyList
:
this
.
deAiIdentifyList
;
let
find
=
typeof
type
===
"number"
?
list
.
find
((
item
)
=>
item
.
typeId
===
type
)
:
list
.
find
((
item
)
=>
item
.
type
===
type
);
if
(
!
find
)
{
callback
&&
callback
(
false
);
return
;
}
this
.
aiTitle
=
find
.
title
;
let
isSuccess
=
false
;
// 截图做ai识别
...
...
@@ -357,13 +370,13 @@ return [
prob: 1,
}, */
];
switch
(
type
)
{
switch
(
find
.
type
)
{
// 车牌识别 自研
/* case "plate": {
let formData = new FormData();
formData.append("image", blob, `下载.jpeg`);
formData.append("iscount", 1);
let res = await AI_API[type](formData);
let res = await AI_API[
find.
type](formData);
results =
res?.data?.data?.map((item) => {
...
...
@@ -387,7 +400,7 @@ return [
// 用的百度
let formData = new FormData();
formData.append("image", blob, `下载.jpeg`);
let res = await AI_API[type](formData);
let res = await AI_API[
find.
type](formData);
results = res?.data?.data?.map((item) => {
return {
x: item.left,
...
...
@@ -410,7 +423,7 @@ return [
let
formData
=
new
FormData
();
formData
.
append
(
"image"
,
blob
,
`下载.jpeg`
);
formData
.
append
(
"iscount"
,
1
);
let
res
=
await
AI_API
[
type
](
formData
);
let
res
=
await
AI_API
[
find
.
type
](
formData
);
results
=
res
?.
data
?.
data
?.
data
?.
map
((
item
)
=>
{
return
{
...
...
@@ -432,7 +445,7 @@ return [
let
formData
=
new
FormData
();
formData
.
append
(
"image"
,
blob
,
`下载.jpeg`
);
formData
.
append
(
"iscount"
,
1
);
let
res
=
await
AI_API
[
type
](
formData
);
let
res
=
await
AI_API
[
find
.
type
](
formData
);
results
=
res
?.
data
?.
data
?.
data
?.
map
((
item
)
=>
{
return
{
...
...
@@ -452,7 +465,7 @@ return [
// 共达地通用数据结构
default
:
{
let
res
=
await
AI_API
[
type
]({
let
res
=
await
AI_API
[
find
.
type
]({
image
:
base64
,
});
/* let targets = [
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论