|
@@ -16,6 +16,17 @@
|
|
<button @click="zoomOut">{{t('map.reduce')}}</button>
|
|
<button @click="zoomOut">{{t('map.reduce')}}</button>
|
|
<button @click="toggleMapType"
|
|
<button @click="toggleMapType"
|
|
>{{t('map.SwitchMapType')}}({{ mapType === 'BMAP_NORMAL_MAP' ? '地图' : '卫星' }})</button>
|
|
>{{t('map.SwitchMapType')}}({{ mapType === 'BMAP_NORMAL_MAP' ? '地图' : '卫星' }})</button>
|
|
|
|
+ <el-tree-select
|
|
|
|
+ class="my-el-select"
|
|
|
|
+ v-model="queryParams.deptId"
|
|
|
|
+ :data="treeList"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ check-strictly
|
|
|
|
+ node-key="id"
|
|
|
|
+ :placeholder="t('deviceForm.deptHolder')"
|
|
|
|
+ filterable
|
|
|
|
+ @change="getData"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<DeviceMonitorDrawer :model-value="drawerVisible" @update:model-value="(val) => (drawerVisible = val)" :id="deviceId" :deviceName="deviceName" :lastLineTime="lastLineTime"
|
|
<DeviceMonitorDrawer :model-value="drawerVisible" @update:model-value="(val) => (drawerVisible = val)" :id="deviceId" :deviceName="deviceName" :lastLineTime="lastLineTime"
|
|
@@ -29,6 +40,7 @@ import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import DeviceMonitorDrawer from '@/views/pms/map/DeviceMonitorDrawer.vue'
|
|
import DeviceMonitorDrawer from '@/views/pms/map/DeviceMonitorDrawer.vue'
|
|
import * as DeptApi from '@/api/system/dept'
|
|
import * as DeptApi from '@/api/system/dept'
|
|
|
|
+import {defaultProps, handleTree} from "@/utils/tree";
|
|
|
|
|
|
interface Cluster {
|
|
interface Cluster {
|
|
lng: number
|
|
lng: number
|
|
@@ -54,7 +66,7 @@ const inlineCount = ref(0)
|
|
const outlineCount = ref(0)
|
|
const outlineCount = ref(0)
|
|
// 设备数据示例
|
|
// 设备数据示例
|
|
const devices = ref<IotDeviceVO[]>()
|
|
const devices = ref<IotDeviceVO[]>()
|
|
-
|
|
|
|
|
|
+const treeList = ref<Tree[]>([]) // 树形结构
|
|
// 初始化地图
|
|
// 初始化地图
|
|
const initMap = () => {
|
|
const initMap = () => {
|
|
if (!mapContainer.value) return
|
|
if (!mapContainer.value) return
|
|
@@ -322,9 +334,12 @@ const toggleMapType = () => {
|
|
mapType.value = mapType.value === 'BMAP_NORMAL_MAP' ? 'BMAP_SATELLITE_MAP' : 'BMAP_NORMAL_MAP'
|
|
mapType.value = mapType.value === 'BMAP_NORMAL_MAP' ? 'BMAP_SATELLITE_MAP' : 'BMAP_NORMAL_MAP'
|
|
map.value.setMapType((window as any)[mapType.value])
|
|
map.value.setMapType((window as any)[mapType.value])
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+const queryParams = reactive({
|
|
|
|
+ deptId: undefined
|
|
|
|
+})
|
|
const getData = async () => {
|
|
const getData = async () => {
|
|
- await IotDeviceApi.getMapDevice().then((res) => {
|
|
|
|
|
|
+ debugger
|
|
|
|
+ await IotDeviceApi.getMapDevice(queryParams).then((res) => {
|
|
devices.value = res.filter((item)=> item.lat!=0&&item.lng!=0)
|
|
devices.value = res.filter((item)=> item.lat!=0&&item.lng!=0)
|
|
outlineCount.value = devices.value.filter((item)=> item.ifInline===4).length
|
|
outlineCount.value = devices.value.filter((item)=> item.ifInline===4).length
|
|
inlineCount.value = devices.value.filter((item)=> item.ifInline===3).length
|
|
inlineCount.value = devices.value.filter((item)=> item.ifInline===3).length
|
|
@@ -333,6 +348,10 @@ const getData = async () => {
|
|
}
|
|
}
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
await getData()
|
|
await getData()
|
|
|
|
+ const res = await DeptApi.getSimpleDeptList()
|
|
|
|
+ treeList.value = []
|
|
|
|
+ treeList.value.push(...handleTree(res))
|
|
|
|
+ debugger
|
|
})
|
|
})
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
@@ -429,4 +448,12 @@ onBeforeUnmount(() => {
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-position: center;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+:deep(.el-select__selection) {
|
|
|
|
+ height: 35px; /* 自定义高度 */
|
|
|
|
+}
|
|
|
|
+:deep(.el-select__placeholder.is-transparent){
|
|
|
|
+ color: orangered;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|