From 23d464d4e6469a3628572026d5fda7fc56946b4e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 01 Apr 2023 11:28:58 +0800
Subject: [PATCH] 首页业务图层加载,及定位
---
src/utils/mapPositionInit.js | 21 +++++++
src/views/home/index.vue | 130 ++++++++++++++++---------------------------
vue.config.js | 6 +-
src/components/map/index.vue | 4
4 files changed, 74 insertions(+), 87 deletions(-)
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 596f31b..046f88a 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -873,8 +873,8 @@
if (type == "billboard") {
// pointElement = new global.DC.Billboard(new global.DC.Position(Number(params.lng), Number(params.lat), Number(alt)), params.url)
pointElement = new global.DC.Billboard(new global.DC.Position(Number(params.lng), Number(params.lat), 4), params.url)
- pointElement.setStyle({
- disableDepthTestDistance: Number.POSITIVE_INFINITY
+ params.disableDepthTestDistance && pointElement.setStyle({
+ disableDepthTestDistance: params.disableDepthTestDistance
})
pointElement.size = [32, 32]
pointElement.attrParams = params
diff --git a/src/utils/mapPositionInit.js b/src/utils/mapPositionInit.js
new file mode 100644
index 0000000..9b073f4
--- /dev/null
+++ b/src/utils/mapPositionInit.js
@@ -0,0 +1,21 @@
+export const initMapPosition = () => {
+ // 需要做判断
+
+ // 分局的
+ const homeCenter = [117.99311892441567, 28.46938164123123]
+
+ global.viewer.flyToPosition(
+ new global.DC.Position(
+ Number(homeCenter[0] + 0.046),
+ Number(homeCenter[1] - 0.36),
+ Number(36000),
+ Number(-3),
+ Number(-45),
+ Number(0)
+ ),
+ function () { },
+ 3
+ )
+
+ // 加派出所的
+}
\ No newline at end of file
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 4a089e7..8141a05 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2022-08-18 16:18:17
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-04-01 10:58:03
+ * @LastEditTime: 2023-04-01 11:24:57
* @FilePath: \srs-police-affairs\src\views\home\index.vue
* @Description: 小区-栋-层-房屋
*
@@ -131,17 +131,17 @@
<el-dialog :title="keyPersonTitle" :modal="true" :visible.sync="keyPersonVisible" :before-close="personInfoClose"
:close-on-click-modal="true" class="keyPerson-details-box">
<!-- <div class="header" v-show="!isMaoJiaLin">
- <div>
- 人员名称:
- <input type="text" v-model="peoplePoliceName" placeholder="请输入人员名称" />
- </div>
- <div>
- 联系电话:
- <input type="text" v-model="peopleCallPhone" placeholder="请输入联系电话" />
- </div>
- <el-button type="primary" icon="el-icon-search" @click="searchPeopleDetail">搜索</el-button>
- <el-button type="primary" icon="el-icon-delete" @click="clearPeopleDetailSearchValue">清空</el-button>
- </div> -->
+ <div>
+ 人员名称:
+ <input type="text" v-model="peoplePoliceName" placeholder="请输入人员名称" />
+ </div>
+ <div>
+ 联系电话:
+ <input type="text" v-model="peopleCallPhone" placeholder="请输入联系电话" />
+ </div>
+ <el-button type="primary" icon="el-icon-search" @click="searchPeopleDetail">搜索</el-button>
+ <el-button type="primary" icon="el-icon-delete" @click="clearPeopleDetailSearchValue">清空</el-button>
+ </div> -->
<el-table :data="keyPersonDetailArr" style="width: 100%"
:header-cell-style="{ 'text-align': 'center', 'background-color': '#203c60', 'borderColor': '#324e75' }"
@@ -169,10 +169,10 @@
</el-table>
<!-- <div class="pages all-pagination-sty" ref="tablePagination" v-show="!isMaoJiaLin">
- <el-pagination background layout="prev, pager, next, total" :page-size="peoplePage.pageSize"
- :total="peoplePage.total" :current-page="peoplePage.currentPage"
- @current-change="handlePersonPageChange"></el-pagination>
- </div> -->
+ <el-pagination background layout="prev, pager, next, total" :page-size="peoplePage.pageSize"
+ :total="peoplePage.total" :current-page="peoplePage.currentPage"
+ @current-change="handlePersonPageChange"></el-pagination>
+ </div> -->
</el-dialog>
<el-dialog :title="equimentTitle" :modal="true" :visible.sync="equimentVisible" :before-close="equimentBeforeClose"
@@ -515,6 +515,8 @@
import landDetailsBox from './components/dialog/landDetailsBox.vue'
+import { initMapPosition } from '@/utils/mapPositionInit'
+
export default {
inject: ['userInfo'],
@@ -564,8 +566,6 @@
phone: "",
},
houseList: [],
- carList: [],
- cameraList: [],
monitoringList: [],
panoramaList: [],
@@ -774,9 +774,6 @@
id: 1
})
- this.getEquipmentAll({ type: 0, deptId: this.userInfo.dept_id })
- this.getEquipmentAll({ type: 1, deptId: this.userInfo.dept_id })
-
if (this.userInfo.dept_id != '1123598813738675201') {
let currentItem
@@ -831,22 +828,12 @@
},
getEquipmentAll (params) {
- this.$EventBus.$emit('mapClearLayer', {
- layerName: 'carLayers',
- type: 'VectorLayer'
- })
-
- this.$EventBus.$emit('mapClearLayer', {
- layerName: 'cameraLayers',
- type: 'VectorLayer'
- })
+ this.loading()
getEquipmentAll({ ...params }).then(res => {
if (params.type == 0) {
- this.carList = res.data.data
-
- if (this.carList.length > 0) {
- this.carList.forEach(item => {
+ if (res.data.data.length > 0) {
+ res.data.data.forEach(item => {
if (item.longitude && item.latitude) {
this.$EventBus.$emit('layerPointAdd', {
layerName: 'carLayers',
@@ -856,34 +843,18 @@
...item,
lng: item.longitude,
lat: item.latitude,
- url: '/img/icon/car.png'
+ url: '/img/icon/car.png',
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
},
incident: this.phoneSiteClick
})
}
})
-
- this.carChange(this.carLayerShow)
}
} else {
- this.cameraList = res.data.data
-
- if (this.cameraList.length > 0) {
- this.cameraList.forEach(item => {
+ if (res.data.data.length > 0) {
+ res.data.data.forEach(item => {
if (item.longitude && item.latitude) {
- this.$EventBus.$emit('layerPointAdd', {
- layerName: 'cameraLayers',
- type: 'label',
- layerType: 'ClusterLayer',
- params: {
- lng: item.longitude,
- lat: item.latitude,
- alt: 1,
- text: item.name
- },
- distanceDisplayCondition: { "near": 0, "far": 200000 }
- })
-
this.$EventBus.$emit('layerPointAdd', {
layerName: 'cameraLayers',
type: "billboard",
@@ -892,16 +863,18 @@
...item,
lng: item.longitude,
lat: item.latitude,
- url: '/img/icon/camera.png'
+ url: '/img/icon/camera.png',
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
},
incident: this.siteClick
})
}
})
- this.cameraChange(this.cameraLayerShow)
}
}
+
+ this.closeLoading()
})
},
@@ -974,8 +947,6 @@
this.policeStaionID = ''
- this.getEquipmentAll({ type: 0, deptId: this.userInfo.dept_id })
- this.getEquipmentAll({ type: 1, deptId: this.userInfo.dept_id })
} else {
cylinderLayer.clear()
this.getPoliceStationTree(2, item.id)
@@ -983,9 +954,6 @@
this.housingCheckValue = '请选择小区'
this.policeStaionID = item.id
-
- this.getEquipmentAll({ type: 0, deptId: this.policeStaionID })
- this.getEquipmentAll({ type: 1, deptId: this.policeStaionID })
}
this.$refs.leftContainer.getHomeAllData(this.policeStaionID)
@@ -1090,31 +1058,28 @@
},
carChange (e) {
+ this.$EventBus.$emit('mapClearLayer', {
+ layerName: 'carLayers',
+ type: 'VectorLayer'
+ })
+
if (e == true) {
- this.$EventBus.$emit('layerShow', {
- layerName: 'carLayers',
- flag: true
- })
- } else {
- this.$EventBus.$emit('layerShow', {
- layerName: 'carLayers',
- flag: false
- })
+ initMapPosition()
+
+ this.getEquipmentAll({ type: 0, deptid: this.policeStaionID == '' ? this.userInfo.dept_id : this.policeStaionID })
}
},
cameraChange (e) {
+ this.$EventBus.$emit('mapClearLayer', {
+ layerName: 'cameraLayers',
+ type: 'VectorLayer'
+ })
+
if (e == true) {
- this.loading()
- this.$EventBus.$emit('layerShow', {
- layerName: 'cameraLayers',
- flag: true
- })
- } else {
- this.$EventBus.$emit('layerShow', {
- layerName: 'cameraLayers',
- flag: false
- })
+ initMapPosition()
+
+ this.getEquipmentAll({ type: 1, deptid: this.policeStaionID == '' ? this.userInfo.dept_id : this.policeStaionID })
}
},
@@ -1125,13 +1090,14 @@
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.2)'
})
- setTimeout(() => { loading.close() }, 1000)
},
closeLoading () {
console.log('closeLoading---------')
if (loading != null) {
- loading.close()
+ setTimeout(() => {
+ loading.close()
+ }, 1000)
}
},
diff --git a/vue.config.js b/vue.config.js
index 3e50115..ec9184f 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2022-09-07 09:37:07
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-03-30 15:49:22
+ * @LastEditTime: 2023-04-01 11:02:13
* @FilePath: \srs-police-affairs\vue.config.js
* @Description:
*
@@ -161,8 +161,8 @@
proxy: {
"/api": {
// target用于配置你允许访问数据的计算机名称,即是你的api接口的服务器地址
- // target: "http://localhost:82",
- target: "http://192.168.0.100:82",
+ target: "http://localhost:82",
+ // target: "http://192.168.0.100:82",
// target: "http://17.20.10.3:82",
// target: "http://10.141.11.11:8081/api",
// ws: true, //启用webSocket6566
--
Gitblit v1.9.3