From 0d1a0cfad99bce85d7ae376351afa995d1471b43 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Sun, 28 Jun 2026 13:32:28 +0800
Subject: [PATCH] feat(map): 添加派出所区域图层显示功能
---
src/views/rentalInfo/index.vue | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/src/views/rentalInfo/index.vue b/src/views/rentalInfo/index.vue
index f877290..a27f589 100644
--- a/src/views/rentalInfo/index.vue
+++ b/src/views/rentalInfo/index.vue
@@ -101,8 +101,41 @@
</template>
<script>
+let cylinderLayer = null
+let DataSourcesArray = []
+
+let positionColor = [
+ global.DC.Namespace.Cesium.Color.fromBytes(255, 97, 97, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(255, 142, 97, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(255, 192, 97, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(252, 58, 242, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(0, 185, 209, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(250, 84, 28, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(221, 255, 97, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(51, 255, 0, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(255, 97, 255, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(97, 255, 181, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(58, 181, 252, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(252, 129, 58, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(58, 252, 236, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(97, 184, 255, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(252, 58, 58, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(97, 113, 255, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(81, 252, 58, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(126, 97, 255, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(168, 252, 58, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(171, 97, 255, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(252, 249, 58, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(210, 97, 255, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(252, 174, 58, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(255, 226, 97, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(255, 97, 176, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(58, 252, 155, 20),
+ global.DC.Namespace.Cesium.Color.fromBytes(252, 58, 155, 20),
+]
import { initMapPosition } from '@/utils/mapPositionInit'
import { getTaskResidencePermitApplyList, getHouseRentalList, getHouseholdSelectTenantList, getDictionaryListByCode, selectTenantStatistic, selectTenantPage } from "@/api/rentalInfo/index.js"
+import { getPoliceStationTree } from "@/api/home/index.js"
import detailDialog from './components/detailDialog.vue'
let loading = null
@@ -150,6 +183,7 @@
nationTypeList: [],
keyManFlag: '',
keyword: '',
+ policeStationOptions: []
}
},
@@ -161,6 +195,7 @@
this.initTableList()
this.getDictionaryListByCode()
})
+ this.getPoliceStationTree(1)
},
mounted () {
@@ -194,6 +229,67 @@
},
methods: {
+ // 加载首页下拉列表数据
+ getPoliceStationTree (type, id = '') {
+ var that = this
+ getPoliceStationTree(type, id).then(res => {
+ if (type == 1) {
+
+ this.policeStationOptions = res.data.data
+
+ this.policeStationOptions.unshift({
+ name: '全部',
+ id: 1
+ })
+
+ this.initPoliceStationLayer()
+ }
+ })
+ },
+
+ // 加载面数据的方法
+ initPoliceStationLayer () {
+ const that = this
+ cylinderLayer = new global.DC.PrimitiveLayer('cylinderLayer')
+ global.viewer.addLayer(cylinderLayer)
+
+ DataSourcesArray.forEach(item => {
+ global.viewer.dataSources.remove(item, true)
+ })
+
+ this.policeStationOptions.forEach((item, index) => {
+ if (item.position && item.position.length > 0) {
+ item.position.forEach((sourceItem, sourceIndex) => {
+
+ const Json = { ...JSON.parse(sourceItem) }
+
+ global.DC.Namespace.Cesium.GeoJsonDataSource.load(Json, {
+ stroke: positionColor[index],
+ fill: positionColor[index], //注意:颜色必须大写,即不能为blue
+ strokeWidth: 0,
+ clampToGround: false
+ }).then(function (dataSource) {
+ let entities = dataSource.entities.values
+ //修改entity样式
+ for (let i = 0; i < entities.length; i++) {
+ let entity = entities[i]
+ entity.polyline = {
+ positions: entity.polygon.hierarchy._value.positions,
+ width: 4,
+ material: global.DC.Namespace.Cesium.Color.fromCssColorString('#19298d'),
+ clampToGround: true
+ }
+ }
+
+ DataSourcesArray.push(dataSource)
+ dataSource.show = true
+ global.viewer.dataSources.add(dataSource)
+ })
+
+ })
+ }
+ })
+ },
selectTenantStatistic () {
var that = this
selectTenantStatistic({
@@ -485,6 +581,17 @@
},
destroyed () {
+ DataSourcesArray.forEach(item => {
+ global.viewer.dataSources.remove(item, true)
+ })
+
+ DataSourcesArray = []
+
+ if (cylinderLayer != null) {
+ cylinderLayer.remove()
+ cylinderLayer = null
+ }
+
loading && loading.close()
this.$parent.$parent.resize('0px')
--
Gitblit v1.9.3