Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mmc-stl-vue2
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
mmc-stl-vue2
Commits
d201344e
提交
d201344e
authored
5月 24, 2024
作者:
翁进城
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 地图搜索
上级
3d7f75ad
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
369 行增加
和
14 行删除
+369
-14
index.js
src/components/MMCFlightControlCenter/api/index.js
+3
-2
map.js
src/components/MMCFlightControlCenter/api/modules/map.js
+93
-0
location.png
...rolCenter/components/mapSearch/assets/images/location.png
+0
-0
index.vue
...nts/MMCFlightControlCenter/components/mapSearch/index.vue
+252
-0
index.vue
src/components/MMCFlightControlCenter/index.vue
+21
-12
没有找到文件。
src/components/MMCFlightControlCenter/api/index.js
浏览文件 @
d201344e
export
{
default
as
Control_API
}
from
'./modules/uav_control'
;
export
{
default
as
Control_API
}
from
'./modules/uav_control'
;
export
{
default
as
flightTaskAPI
}
from
'./modules/flightTask'
;
export
{
default
as
flightTaskAPI
}
from
'./modules/flightTask'
;
export
{
default
as
AirLine
}
from
'./modules/air-line'
;
export
{
default
as
AirLine
}
from
'./modules/air-line'
;
\ No newline at end of file
export
{
default
as
Map
}
from
'./modules/map'
;
\ No newline at end of file
src/components/MMCFlightControlCenter/api/modules/map.js
0 → 100644
浏览文件 @
d201344e
import
axios
from
"axios"
;
const
key
=
"ced06243e56f41f5b7180f08731026da"
;
const
appKey
=
"30c6030f6e144f08b51f7781699276c3"
;
export
default
class
Map
{
static
Regeo
(
params
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 开发者模式
axios
.
get
(
"https://api.tianditu.gov.cn/geocoder"
,
{
params
:
{
tk
:
key
,
postStr
:
JSON
.
stringify
(
params
),
type
:
"geocode"
,
},
})
.
then
((
res
)
=>
{
if
(
res
.
data
&&
res
.
data
.
result
&&
res
.
data
.
result
.
formatted_address
)
{
resolve
(
res
.
data
.
result
.
formatted_address
);
}
else
{
reject
(
null
);
}
})
.
catch
((
e
)
=>
reject
(
e
));
});
}
static
AiRegeo
(
params
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 开发者模式
axios
.
get
(
"https://api.tianditu.gov.cn/geocoder"
,
{
params
:
{
tk
:
key
,
postStr
:
JSON
.
stringify
(
params
),
type
:
"geocode"
,
},
})
.
then
((
res
)
=>
{
if
(
res
.
data
&&
res
.
data
.
result
)
{
resolve
(
res
.
data
.
result
);
}
else
{
reject
(
null
);
}
})
.
catch
((
e
)
=>
reject
(
e
));
});
}
//天地图编码查询
static
Geo
(
params
)
{
let
promise
=
axios
.
get
(
"https://api.tianditu.gov.cn/v2/search"
,
{
params
:
{
tk
:
key
,
postStr
:
JSON
.
stringify
(
params
),
type
:
"query"
,
},
})
.
then
((
res
)
=>
{
res
.
data
.
data
=
{
rows
:
[],
};
if
(
res
.
data
.
count
>
0
)
{
res
.
data
.
data
.
rows
=
res
.
data
.
pois
;
}
else
{
res
.
data
.
data
.
rows
=
[];
}
return
res
;
});
return
promise
;
}
static
Driv
(
params
)
{
let
promise
=
axios
.
get
(
"http://32.128.12.138:21009/service/lbs/coder/geocoding2"
,
{
params
:
{
appKey
,
city
:
"全国"
,
page_size
:
20
,
...
params
,
},
}
);
return
promise
;
}
}
src/components/MMCFlightControlCenter/components/mapSearch/assets/images/location.png
0 → 100644
浏览文件 @
d201344e
5.8 KB
src/components/MMCFlightControlCenter/components/mapSearch/index.vue
0 → 100644
浏览文件 @
d201344e
<
template
>
<div
class=
"cpt-select"
>
<div
class=
"select_box"
:class=
"isFind ? 'active' : ''"
>
<el-tooltip
class=
"item"
effect=
"light"
content=
"搜索"
placement=
"top-start"
>
<span
class=
"iconfont icon-sousuo cf"
@
click
.
stop=
"isFind = !isFind"
></span>
</el-tooltip>
<el-autocomplete
v-if=
"isFind"
popper-class=
"search"
:popper-append-to-body=
"false"
class=
"autocomplete"
v-model=
"destination.name"
:fetch-suggestions=
"handle_query_address_async"
placeholder=
"请输入目标位置"
:trigger-on-focus=
"false"
@
select=
"handle_select_address"
clearable
>
<template
slot-scope=
"
{ item }">
<div>
<span
style=
"font-size: 14px; color: #fff"
>
{{
item
.
name
}}
</span>
<span
style=
"font-size: 12px; color: #999; margin-left: 12px"
>
{{
item
.
address
}}
</span>
</div>
</
template
>
</el-autocomplete>
</div>
</div>
</template>
<
script
>
import
{
Map
}
from
"../../api"
;
import
{
Utils
}
from
"../../lib/cesium"
;
import
{
mapState
}
from
"vuex"
;
import
pngLocation
from
"./assets/images/location.png"
;
let
handler
=
null
;
let
data_srouce
=
null
;
let
location_icon
=
null
;
export
default
{
components
:
{},
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
({}),
},
},
data
()
{
return
{
isFind
:
false
,
input
:
""
,
destination
:
{
name
:
""
,
lng
:
0
,
lat
:
0
,
},
};
},
computed
:
{
...
mapState
(
"MMCFlightControlCenter"
,
[
"cesiumViewer"
]),
},
mounted
()
{
// 控制重要元素下拉菜单隐藏
document
.
addEventListener
(
"click"
,
(
e
)
=>
{
const
iconEl
=
document
.
querySelector
(
".cpt-select"
);
// 这里是要隐藏的弹窗 类名
if
(
iconEl
&&
!
iconEl
.
contains
(
e
.
target
))
{
// contains 方法 就是查看包含关系
// contains 方法 本身含义:用于判断字符串中是否包含指定的字符或字符串
// 返回值 :如果包含指定的字符或字符串返回 true,否则返回 false。
this
.
isFind
=
false
;
}
});
},
destroyed
()
{
},
methods
:
{
handle_query_address_async
(
address
,
cb
)
{
Map
.
Geo
({
keyWord
:
address
,
level
:
12
,
// specify: "156320900",
mapBound
:
"-180,-90,180,90"
,
queryType
:
1
,
start
:
0
,
count
:
10
,
})
.
then
((
res
)
=>
{
cb
(
res
.
data
.
data
.
rows
);
})
.
catch
((
e
)
=>
cb
([]));
},
handle_select_address
(
item
)
{
if
(
item
)
{
let
location
=
item
.
lonlat
.
split
(
","
);
this
.
destination
.
name
=
item
.
name
;
this
.
destination
.
lng
=
Number
(
location
[
0
]);
this
.
destination
.
lat
=
Number
(
location
[
1
]);
let
viewer
=
this
.
cesiumViewer
;
let
potiion
=
Utils
.
transformWGS842Cartesian
({
lng
:
this
.
destination
.
lng
,
lat
:
this
.
destination
.
lat
,
alt
:
1000
,
});
viewer
.
camera
.
flyTo
({
destination
:
potiion
,
});
this
.
init_location_icon
(
potiion
);
}
},
init_location_icon
(
position
)
{
let
viewer
=
this
.
cesiumViewer
;
if
(
location_icon
)
{
// location_icon.position = position;
viewer
.
entities
.
remove
(
location_icon
);
location_icon
=
null
;
}
// else {
location_icon
=
viewer
.
entities
.
add
({
position
:
Cesium
.
Cartesian3
.
fromDegrees
(
Number
(
this
.
destination
.
lng
),
Number
(
this
.
destination
.
lat
)
),
billboard
:
{
width
:
36
,
height
:
36
,
image
:
pngLocation
,
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
// verticalOrigin: Cesium.VerticalOrigin.Bottom,
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0
),
disableDepthTestDistance
:
Number
.
POSITIVE_INFINITY
,
},
});
viewer
.
camera
.
moveEnd
.
addEventListener
(()
=>
{
console
.
log
(
this
.
destination
.
lng
);
location_icon
.
potiion
=
Cesium
.
Cartesian3
.
fromDegrees
(
Number
(
this
.
destination
.
lng
),
Number
(
this
.
destination
.
lat
)
);
});
// }
},
destroy_location_icon
()
{
if
(
!
location_icon
)
{
return
location_icon
;
}
let
viewer
=
this
.
cesiumViewer
;
viewer
.
entities
.
remove
(
location_icon
);
location_icon
=
null
;
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.cpt-select
::v-deep
{
text-align
:
right
;
.el-autocomplete-suggestion
li
:
hover
{
background-color
:
#a1b9ee
;
}
color
:
#fff
;
.select_box
{
display
:
flex
;
align-content
:
center
;
position
:
relative
;
width
:
48px
;
height
:
48px
;
color
:
#fff
;
border-radius
:
2px
;
text-align
:
center
;
line-height
:
48px
;
cursor
:
pointer
;
&.active
{
width
:
412px
;
text-align
:
left
;
box-sizing
:
border-box
;
color
:
#5baad4
;
padding-left
:
10px
;
padding-right
:
10px
;
height
:
50.4px
;
background
:
rgba
(
22
,
29
,
45
,
0.58
);
border
:
1px
solid
#70daf9
;
}
.autocomplete
{
flex
:
1
;
}
}
}
.icon-sousuo
{
display
:
inline-block
;
width
:
48px
;
height
:
48px
;
cursor
:
pointer
;
&::before
{
font-size
:
24px
;
content
:
"\e6d5"
;
color
:
#fff
;
}
}
.el-input__inner
::v-deep
{
padding-right
:
30px
;
width
:
359px
!important
;
font-family
:
MicrosoftYaHei
;
font-size
:
16px
;
color
:
#5baad4
;
letter-spacing
:
0
;
text-align
:
left
;
font-weight
:
400
;
background
:
transparent
!important
;
border
:
0
;
}
.el-form-item
::v-deep
{
}
input
::v-deep
{
font-family
:
MicrosoftYaHei
;
font-size
:
16px
;
color
:
#5baad4
!important
;
letter-spacing
:
0
;
text-align
:
center
;
font-weight
:
400
;
}
::v-deep
{
.el-scrollbar
{
.el-autocomplete-suggestion
li
:
hover
{
background-color
:
#34466e
!important
;
}
}
}
.search
{
.el-scrollbar
{
.el-autocomplete-suggestion
li
:
hover
{
background-color
:
#34466e
!important
;
}
}
}
</
style
>
\ No newline at end of file
src/components/MMCFlightControlCenter/index.vue
浏览文件 @
d201344e
<
template
>
<
template
>
<div
class=
"mmc-filght-control-center mmc"
>
<div
class=
"mmc-filght-control-center mmc"
>
<!-- cesium地图层 -->
<!-- cesium地图层 -->
<
cesiumLayout
v-if=
"!cesiumViewer"
></c
esiumLayout>
<
CesiumLayout
v-if=
"!cesiumViewer"
></C
esiumLayout>
<!-- 地图切换组件 -->
<!-- 地图切换组件 -->
<mapImageSwitch></mapImageSwitch>
<MapImageSwitch></MapImageSwitch>
<MapSearch
class=
"map-search"
></MapSearch>
<!-- 无人机应用 -->
<!-- 无人机应用 -->
<
uavApplications
v-if=
"scene === 0"
></u
avApplications>
<
UavApplications
v-if=
"scene === 0"
></U
avApplications>
<!-- 机库 -->
<!-- 机库 -->
<
hangar
v-else
></h
angar>
<
Hangar
v-else
></H
angar>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
c
esiumLayout
from
"./components/cesiumLayer"
;
import
C
esiumLayout
from
"./components/cesiumLayer"
;
import
m
apImageSwitch
from
"./components/mapImageSwitch"
;
import
M
apImageSwitch
from
"./components/mapImageSwitch"
;
import
u
avApplications
from
"./components/uavApplications"
;
import
U
avApplications
from
"./components/uavApplications"
;
import
h
angar
from
"./components/hangar"
;
import
H
angar
from
"./components/hangar"
;
import
Vue
from
"vue"
;
import
Vue
from
"vue"
;
import
SymbolIcon
from
"../symbol-icon"
;
import
SymbolIcon
from
"../symbol-icon"
;
import
MapSearch
from
'./components/mapSearch'
;
export
default
{
export
default
{
name
:
"MMCFlightControlCenter"
,
name
:
"MMCFlightControlCenter"
,
components
:
{
components
:
{
cesiumLayout
,
CesiumLayout
,
mapImageSwitch
,
MapImageSwitch
,
uavApplications
,
UavApplications
,
hangar
,
Hangar
,
MapSearch
},
},
props
:
{
props
:
{
devMode
:
{
devMode
:
{
...
@@ -187,6 +190,12 @@ export default {
...
@@ -187,6 +190,12 @@ export default {
height
:
100%
;
height
:
100%
;
width
:
100%
;
width
:
100%
;
}
}
.map-search
{
position
:
absolute
;
top
:
10px
;
right
:
20px
;
}
</
style
>
</
style
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论