Commit 3e884b08 authored by 郭铭瑶's avatar 郭铭瑶 🤘

添加gis图层展示

parent 70ae8115
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<link rel="icon" href="./favicon.ico" /> <link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>静安智慧房管</title> <title>静安智慧房管</title>
<script type="module" crossorigin src="./assets/index.203cae49.js"></script> <script type="module" crossorigin src="./assets/index.b412d033.js"></script>
<link rel="modulepreload" href="./assets/vendor.d8be57b6.js"> <link rel="modulepreload" href="./assets/vendor.d8be57b6.js">
<link rel="stylesheet" href="./assets/vendor.db35e2cd.css"> <link rel="stylesheet" href="./assets/vendor.db35e2cd.css">
<link rel="stylesheet" href="./assets/index.00cfd82e.css"> <link rel="stylesheet" href="./assets/index.654526b7.css">
</head> </head>
<body> <body>
......
...@@ -24,4 +24,5 @@ export default { ...@@ -24,4 +24,5 @@ export default {
EXPAND_INFO: EXPAND_INFO:
'/service-basicdatasync-ddd/public/tbl_community/entity/{id}/ext', // 小区拓展信息 '/service-basicdatasync-ddd/public/tbl_community/entity/{id}/ext', // 小区拓展信息
ELEVATOR: '/service-special-ja-ddd/public/elevatorInstallationInfos', // 电梯 ELEVATOR: '/service-special-ja-ddd/public/elevatorInstallationInfos', // 电梯
GIS: '/service-special-ja-ddd/public/giss', // gis点位
} }
...@@ -61,7 +61,7 @@ const btns = computed(() => [ ...@@ -61,7 +61,7 @@ const btns = computed(() => [
hidden: props.onlyOneView, hidden: props.onlyOneView,
tip: '展示屏配置', tip: '展示屏配置',
}, },
// { key: 'btn6', icon: btn6 }, { key: 'gis', icon: btn6, tip: 'gis展示' },
{ key: 'reset', icon: btn8, tip: '重置' }, { key: 'reset', icon: btn8, tip: '重置' },
]) ])
const onClick = (key: string) => { const onClick = (key: string) => {
......
...@@ -17,6 +17,7 @@ defineExpose({ ...@@ -17,6 +17,7 @@ defineExpose({
zoomTo, zoomTo,
focus, focus,
addPoints, addPoints,
addPolygon,
remove, remove,
setCommunityPoints, setCommunityPoints,
}) })
...@@ -47,7 +48,7 @@ onMounted(async () => { ...@@ -47,7 +48,7 @@ onMounted(async () => {
}) })
function onComplete() { function onComplete() {
polygonLayer = map.add('polygon', { polygonLayer = addPolygon({
data: { data: {
path: jinganPath as [number, number][], path: jinganPath as [number, number][],
}, },
...@@ -101,6 +102,10 @@ function addPoints(options) { ...@@ -101,6 +102,10 @@ function addPoints(options) {
// }) // })
} }
function addPolygon(options) {
return map.add('polygon', options)
}
function remove(layer) { function remove(layer) {
layer && map.remove(layer) layer && map.remove(layer)
} }
......
...@@ -22,23 +22,6 @@ ...@@ -22,23 +22,6 @@
</m-animate> </m-animate>
</div> </div>
</m-grid> </m-grid>
<m-modal v-model="showModal" title="选择展示屏">
<div class="list-content">
<div v-for="item in list" :key="item.id" class="item">
<p :title="item.configName">{{ item.configName }}</p>
<p>{{ item.updateTime }}</p>
<n-button
size="tiny"
type="info"
ghost
dashed
@click="switchDataView(item)"
>
查看
</n-button>
</div>
</div>
</m-modal>
</div> </div>
<MapBtns <MapBtns
:full-screen="fullScreen" :full-screen="fullScreen"
...@@ -46,6 +29,39 @@ ...@@ -46,6 +29,39 @@
:only-one-view="onlyOneView" :only-one-view="onlyOneView"
@touch="handleMapBtnsEvents" @touch="handleMapBtnsEvents"
/> />
<m-modal v-model="showModal" title="选择展示屏配置">
<div class="list-content">
<div v-for="item in list" :key="item.id" class="item">
<p :title="item.configName">{{ item.configName }}</p>
<p>{{ item.updateTime }}</p>
<n-button
size="tiny"
type="info"
ghost
dashed
@click="switchDataView(item)"
>
查看
</n-button>
</div>
</div>
</m-modal>
<m-modal v-model="showGisModal" title="选择GIS图层">
<div class="list-content">
<div v-for="item in gisTypes" :key="item.value" class="item">
<p :title="item.name">{{ item.name }}</p>
<n-button
size="tiny"
type="info"
ghost
dashed
@click="switchGisView(item.value)"
>
查看
</n-button>
</div>
</div>
</m-modal>
<m-modal v-model="showCommunityDrawer" title="小区档案" width="80%"> <m-modal v-model="showCommunityDrawer" title="小区档案" width="80%">
<CommunityInfo :info="communityDetail" /> <CommunityInfo :info="communityDetail" />
</m-modal> </m-modal>
...@@ -82,6 +98,7 @@ import c4 from '@/assets/images/c4.png' ...@@ -82,6 +98,7 @@ import c4 from '@/assets/images/c4.png'
import c5 from '@/assets/images/c5.png' import c5 from '@/assets/images/c5.png'
import c6 from '@/assets/images/c6.png' import c6 from '@/assets/images/c6.png'
import CommunityIcon from '@/assets/images/init-point.png' import CommunityIcon from '@/assets/images/init-point.png'
import GisIcon from '@/assets/images/gis-icon.png'
const mapRef = shallowRef<any>(null) const mapRef = shallowRef<any>(null)
const { layout } = useLayout() const { layout } = useLayout()
...@@ -138,6 +155,63 @@ function switchDataView({ id, configJson }) { ...@@ -138,6 +155,63 @@ function switchDataView({ id, configJson }) {
const fullScreen = ref(false) const fullScreen = ref(false)
const showSearchModal = ref(false) const showSearchModal = ref(false)
const gisTypes = ref([
{ name: '房屋安全排查结果', value: 'houseSecurity' },
{ name: '多层住宅电梯加装', value: 'multiHouseElevetor' },
{ name: '新盘清单', value: 'newHouse' },
{ name: '市政道路', value: 'cityRoad' },
{ name: '公益性设施', value: 'commonWealth' },
{ name: '公租房', value: 'publicRentalHouse' },
])
const showGisModal = ref(false)
let polygonLayers: any[] = []
const switchGisView = (gisType: string) => {
ajax
.get({
url: api.GIS,
params: {
gisType,
pageSize: 9000,
},
})
.then((res) => {
const { content = [] } = res?.data || {}
if (gisType === 'cityRoad') {
addPoints(null) // 清理之前点位
polygonLayers = content.map((item) =>
mapRef.value?.addPolygon({
data: {
path:
(item.gisPoint && JSON.parse(item.gisPoint))?.map((p) => [
p.x,
p.y,
]) || [],
},
fillColor: 'transparent',
color: '#F7933E',
lineWidth: 1,
}),
)
} else {
addPoints({
data: content.map((item) => {
const { x, y } =
(item.gisPointSingle && JSON.parse(item.gisPointSingle)) || {}
return {
id: item.id,
gisType: item.gisType,
x,
y,
}
}),
icon: GisIcon,
size: 16,
})
}
showGisModal.value = false
})
}
function handleMapBtnsEvents(key: string) { function handleMapBtnsEvents(key: string) {
switch (key) { switch (key) {
case 'list': case 'list':
...@@ -175,6 +249,9 @@ function handleMapBtnsEvents(key: string) { ...@@ -175,6 +249,9 @@ function handleMapBtnsEvents(key: string) {
onMapComplete() onMapComplete()
mapRef.value?.setCommunityPoints() mapRef.value?.setCommunityPoints()
break break
case 'gis':
showGisModal.value = true
break
default: default:
break break
} }
...@@ -196,8 +273,12 @@ function onMapComplete() { ...@@ -196,8 +273,12 @@ function onMapComplete() {
} }
function addPoints(data) { function addPoints(data) {
mapRef.value?.remove(pointsLayer) pointsLayer && mapRef.value?.remove(pointsLayer)
pointsLayer = mapRef.value?.addPoints(data) if (polygonLayers.length > 0) {
polygonLayers.forEach((layer) => mapRef.value?.remove(layer))
polygonLayers = []
}
pointsLayer = data && mapRef.value?.addPoints(data)
mapRef.value?.focus([-1931.2637583608503, 4334.0159596985895], { zoom: 4 }) mapRef.value?.focus([-1931.2637583608503, 4334.0159596985895], { zoom: 4 })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment