显示学校
This commit is contained in:
@@ -7,6 +7,7 @@ import { getBasePoints as getDangerousSourceBasePoints, getPointDetailById as ge
|
|||||||
import { getBasePoints as getEmergencyShelterBasePoints, getPointDetailById as getEmergencyShelterPointDetailById} from './emergency-shelter'
|
import { getBasePoints as getEmergencyShelterBasePoints, getPointDetailById as getEmergencyShelterPointDetailById} from './emergency-shelter'
|
||||||
import { getBasePoints as getFirefighterBasePoints, getPointDetailById as getFirefighterPointDetailById} from './firefighter'
|
import { getBasePoints as getFirefighterBasePoints, getPointDetailById as getFirefighterPointDetailById} from './firefighter'
|
||||||
import { getBasePoints as getStorePointsBasePoints, getPointDetailById as getStorePointsPointDetailById} from './store-points'
|
import { getBasePoints as getStorePointsBasePoints, getPointDetailById as getStorePointsPointDetailById} from './store-points'
|
||||||
|
import { getBasePoints as getSchoolsBasePoints, getPointDetailById as getSchoolsPointDetailById} from './schools'
|
||||||
import type { ApiResponse } from '@/types/ApiResponse'
|
import type { ApiResponse } from '@/types/ApiResponse'
|
||||||
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'
|
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'
|
||||||
import type { XianRiskSpots } from '@/types/base/XianRiskSpots'
|
import type { XianRiskSpots } from '@/types/base/XianRiskSpots'
|
||||||
@@ -15,6 +16,7 @@ import type { XianDangerousSource } from '@/types/base/XianDangerousSource'
|
|||||||
import type { XianEmergencyShelter } from '@/types/base/XianEmergencyShelter'
|
import type { XianEmergencyShelter } from '@/types/base/XianEmergencyShelter'
|
||||||
import type { XianFirefighter } from '@/types/base/XianFirefighter'
|
import type { XianFirefighter } from '@/types/base/XianFirefighter'
|
||||||
import type { XianStorePoints } from '@/types/base/XianStorePoints'
|
import type { XianStorePoints } from '@/types/base/XianStorePoints'
|
||||||
|
import type { XianSchool } from '@/types/base/XianSchool'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API接口统一导出对象
|
* API接口统一导出对象
|
||||||
@@ -142,4 +144,20 @@ export const $api = {
|
|||||||
*/
|
*/
|
||||||
getPointDetailById: (id: number): Promise<ApiResponse<XianStorePoints>> => getStorePointsPointDetailById(id),
|
getPointDetailById: (id: number): Promise<ApiResponse<XianStorePoints>> => getStorePointsPointDetailById(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 学校信息
|
||||||
|
schools: {
|
||||||
|
/**
|
||||||
|
* 获取所有基础学校
|
||||||
|
* @returns 学校数据数组
|
||||||
|
*/
|
||||||
|
getBasePoints: (): Promise<ApiResponse<XianSchool[]>> => getSchoolsBasePoints(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取学校详情
|
||||||
|
* @param id - 学校id
|
||||||
|
* @returns 学校详情
|
||||||
|
*/
|
||||||
|
getPointDetailById: (id: number): Promise<ApiResponse<XianSchool>> => getSchoolsPointDetailById(id),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import type { ApiResponse } from "@/types/ApiResponse"
|
||||||
|
import type { XianSchool } from "@/types/base/XianSchool"
|
||||||
|
import httpInstance from "@/utils/request/http"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取学校基础数据
|
||||||
|
* @returns 学校数据数组
|
||||||
|
*/
|
||||||
|
export const getBasePoints = (): Promise<ApiResponse<XianSchool[]>> => {
|
||||||
|
return httpInstance.get('/school/base-points')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取学校详情
|
||||||
|
* @param id - 学校id
|
||||||
|
* @returns 学校详情
|
||||||
|
*/
|
||||||
|
export const getPointDetailById = (id: number): Promise<ApiResponse<XianSchool>> => {
|
||||||
|
return httpInstance.get(`/school/point-detail/${id}`)
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -10,6 +10,8 @@ export { default as hospitalIcon } from '@/assets/images/icon/hospital.png';
|
|||||||
export { default as dangerousSourceIcon } from '@/assets/images/icon/dangerous-source.png';
|
export { default as dangerousSourceIcon } from '@/assets/images/icon/dangerous-source.png';
|
||||||
export { default as emergencyShelterIcon } from '@/assets/images/icon/emergency-shelter.png';
|
export { default as emergencyShelterIcon } from '@/assets/images/icon/emergency-shelter.png';
|
||||||
export { default as firefighterIcon } from '@/assets/images/icon/firefighter.png';
|
export { default as firefighterIcon } from '@/assets/images/icon/firefighter.png';
|
||||||
|
export { default as storePointsIcon } from '@/assets/images/icon/store-points.jpg';
|
||||||
|
export { default as schoolIcon } from '@/assets/images/icon/school.png';
|
||||||
|
|
||||||
// 图片
|
// 图片
|
||||||
export { default as backgroundImage } from '@/assets/images/background-image.png';
|
export { default as backgroundImage } from '@/assets/images/background-image.png';
|
||||||
|
|||||||
@@ -39,6 +39,14 @@
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 学校 -->
|
||||||
|
<SchoolComponent
|
||||||
|
v-if="
|
||||||
|
useStatusStore().appLoadingCompleted &&
|
||||||
|
useStatusStore().poiLayers.showSchool.loading
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 人口网格 -->
|
<!-- 人口网格 -->
|
||||||
<PopulationGridComponent
|
<PopulationGridComponent
|
||||||
v-if="
|
v-if="
|
||||||
@@ -65,6 +73,7 @@
|
|||||||
import StorePointsComponent from './detail-panels/StorePointsComponent.vue';
|
import StorePointsComponent from './detail-panels/StorePointsComponent.vue';
|
||||||
import PopulationGridComponent from './detail-panels/PopulationGridComponent.vue';
|
import PopulationGridComponent from './detail-panels/PopulationGridComponent.vue';
|
||||||
import WaterPipeComponent from './detail-panels/WaterPipeComponent.vue';
|
import WaterPipeComponent from './detail-panels/WaterPipeComponent.vue';
|
||||||
|
import SchoolComponent from './detail-panels/SchoolComponent.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less"></style>
|
<style scoped lang="less"></style>
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<!-- 学校组件 -->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!-- 加载学校点位 -->
|
||||||
|
<LoadingPoints
|
||||||
|
v-if="useStatusStore().appLoadingCompleted && schoolList.length > 0"
|
||||||
|
:base-points="schoolList"
|
||||||
|
:get-disaster-icon="getDisasterIcon"
|
||||||
|
:prefix="config.prefix.schoolPointId"
|
||||||
|
:is-default="false"
|
||||||
|
:loading-resource-field="LoadingResource.SCHOOL"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 显示信息框 -->
|
||||||
|
<InformationBox
|
||||||
|
:data="schoolDetail as Record<string, any>"
|
||||||
|
:field="field"
|
||||||
|
v-if="useLoadingInformationStore().school.loading"
|
||||||
|
:title="informationBoxTitle"
|
||||||
|
:offset-x="offsetX"
|
||||||
|
:offset-y="offsetY"
|
||||||
|
:key="useLoadingInformationStore().school.id"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import { $api } from '@/api/api.ts';
|
||||||
|
import type { Point } from '@/types/base/Point.ts';
|
||||||
|
import LoadingPoints from '@/component/common/LoadingPoints.vue';
|
||||||
|
import config from '@/config/config.json';
|
||||||
|
import InformationBox from '@/component/common/InformationBox.vue';
|
||||||
|
import { useStatusStore } from '@/stores/useStatusStore.ts';
|
||||||
|
import { useLoadingInformationStore } from '@/stores/useLoadingInformation.ts';
|
||||||
|
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts';
|
||||||
|
import { LoadingResource } from '@/types/common/LoadingResourceType.ts';
|
||||||
|
import { useSchoolPoint } from '@/hooks/rain-earthquake/useSchoolPoint.ts';
|
||||||
|
import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore.ts';
|
||||||
|
|
||||||
|
const schoolList = ref<Point[]>([]);
|
||||||
|
|
||||||
|
// 信息框相关配置
|
||||||
|
const offsetX = ref(0);
|
||||||
|
const offsetY = ref(0);
|
||||||
|
const schoolDetail = ref<Point>();
|
||||||
|
const informationBoxTitle = ref('');
|
||||||
|
|
||||||
|
// 获取钩子函数
|
||||||
|
const { field, getDisasterIcon } = useSchoolPoint();
|
||||||
|
|
||||||
|
$api.schools.getBasePoints().then((res) => {
|
||||||
|
schoolList.value = res.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听id变化
|
||||||
|
watch(
|
||||||
|
() => useLoadingInformationStore().school.id,
|
||||||
|
async (newId: number) => {
|
||||||
|
if (newId === -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取学校数据
|
||||||
|
const clickObject = useLoadingInformationStore().clickObject;
|
||||||
|
|
||||||
|
if (!clickObject || !clickObject.primitive) {
|
||||||
|
console.warn('点击对象或图元不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await $api.schools.getPointDetailById(
|
||||||
|
useLoadingInformationStore().school.id
|
||||||
|
);
|
||||||
|
|
||||||
|
// 更新数据
|
||||||
|
schoolDetail.value = res.data;
|
||||||
|
informationBoxTitle.value = res.data.schoolName || '学校信息';
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 将坐标转换为偏移量
|
||||||
|
const screenPos = CesiumUtilsSingleton.convertScreenPosition(
|
||||||
|
clickObject.primitive.position
|
||||||
|
);
|
||||||
|
offsetX.value = screenPos.x;
|
||||||
|
offsetY.value = screenPos.y;
|
||||||
|
|
||||||
|
// 显示新的信息框
|
||||||
|
useLoadingInformationStore().school.loading = true;
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`坐标转换失败:${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 监听显示隐藏
|
||||||
|
watch(
|
||||||
|
() => useStatusStore().poiLayers.showSchool?.show,
|
||||||
|
(newValue: boolean) => {
|
||||||
|
if (newValue) {
|
||||||
|
// 显示学校
|
||||||
|
CesiumUtilsSingleton.batchShowPrimitives(
|
||||||
|
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 隐藏学校
|
||||||
|
CesiumUtilsSingleton.batchHidePrimitives(
|
||||||
|
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
"dangerousSourcePointId": "dangerous-source-point-",
|
"dangerousSourcePointId": "dangerous-source-point-",
|
||||||
"emergencyShelterPointId": "emergency-shelter-point-",
|
"emergencyShelterPointId": "emergency-shelter-point-",
|
||||||
"fireStationPointId": "fire-station-point-",
|
"fireStationPointId": "fire-station-point-",
|
||||||
"storePointsPointId": "store-points-point-"
|
"storePointsPointId": "store-points-point-",
|
||||||
|
"schoolPointId": "school-point-"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,9 +217,7 @@ export const useEarthquakeDisasterChain = () => {
|
|||||||
name: '显示学校',
|
name: '显示学校',
|
||||||
statusStore: statusStore.poiLayers,
|
statusStore: statusStore.poiLayers,
|
||||||
statusKey: 'showSchool' as const,
|
statusKey: 'showSchool' as const,
|
||||||
callback: (status: unknown) => {
|
callback: layerControl.clickSchool,
|
||||||
console.log('显示学校', status);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '显示人口网格',
|
name: '显示人口网格',
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ export const useMap = () => {
|
|||||||
useLoadingInformationStore().storePoints.id = id;
|
useLoadingInformationStore().storePoints.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 学校
|
||||||
|
else if (pickedObject.id.startsWith(config.prefix.schoolPointId)) {
|
||||||
|
useLoadingInformationStore().school.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
// 其他
|
// 其他
|
||||||
else {
|
else {
|
||||||
// 重置状态
|
// 重置状态
|
||||||
|
|||||||
@@ -53,6 +53,14 @@ export const useLayerControl = () => {
|
|||||||
useStatusStore().poiLayers.showReservePoint.loading = true;
|
useStatusStore().poiLayers.showReservePoint.loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击显示学校
|
||||||
|
*/
|
||||||
|
const clickSchool = () => {
|
||||||
|
// 加载状态为true
|
||||||
|
useStatusStore().poiLayers.showSchool.loading = true;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击显示人口网格
|
* 点击显示人口网格
|
||||||
*/
|
*/
|
||||||
@@ -75,6 +83,7 @@ export const useLayerControl = () => {
|
|||||||
clickEmergencyShelter,
|
clickEmergencyShelter,
|
||||||
clickFireStation,
|
clickFireStation,
|
||||||
clickStorePoints,
|
clickStorePoints,
|
||||||
|
clickSchool,
|
||||||
clickPopulationGrid,
|
clickPopulationGrid,
|
||||||
clickWaterPipe,
|
clickWaterPipe,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { schoolIcon } from '@/assets';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学校相关钩子函数
|
||||||
|
* @returns 字段映射和获取图标方法
|
||||||
|
*/
|
||||||
|
export const useSchoolPoint = () => {
|
||||||
|
/**
|
||||||
|
* 字段映射配置
|
||||||
|
*/
|
||||||
|
const field = {
|
||||||
|
schoolName: '学校名称',
|
||||||
|
schoolType: '学校类型',
|
||||||
|
lon: '经度',
|
||||||
|
lat: '纬度',
|
||||||
|
students: '在校学生数',
|
||||||
|
isImportant: '是否有重点保护目标',
|
||||||
|
unitHead: '负责人',
|
||||||
|
telephone: '联系电话',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取学校图标
|
||||||
|
* @returns 图标路径
|
||||||
|
*/
|
||||||
|
function getDisasterIcon(): string {
|
||||||
|
return schoolIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { field, getDisasterIcon };
|
||||||
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import storePointsIcon from '@/assets/images/icon/store-points.jpg';
|
import { storePointsIcon } from '@/assets';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资储备点相关钩子函数
|
* 物资储备点相关钩子函数
|
||||||
|
|||||||
@@ -240,9 +240,7 @@ export const useRainDisasterChain = () => {
|
|||||||
name: '显示学校',
|
name: '显示学校',
|
||||||
statusStore: statusStore.poiLayers,
|
statusStore: statusStore.poiLayers,
|
||||||
statusKey: 'showSchool' as const,
|
statusKey: 'showSchool' as const,
|
||||||
callback: (status: unknown) => {
|
callback: layerControl.clickSchool,
|
||||||
console.log('显示学校', status);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '显示人口网格',
|
name: '显示人口网格',
|
||||||
|
|||||||
@@ -84,6 +84,14 @@ export const useLoadingInformationStore = defineStore(
|
|||||||
id: -1,
|
id: -1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ============================== 学校状态 ================================
|
||||||
|
const school = reactive({
|
||||||
|
/** 加载状态 */
|
||||||
|
loading: false,
|
||||||
|
/** 学校ID */
|
||||||
|
id: -1,
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置所有状态
|
* 重置所有状态
|
||||||
*/
|
*/
|
||||||
@@ -119,6 +127,10 @@ export const useLoadingInformationStore = defineStore(
|
|||||||
// 物资储备点状态重置
|
// 物资储备点状态重置
|
||||||
storePoints.loading = false;
|
storePoints.loading = false;
|
||||||
storePoints.id = -1;
|
storePoints.id = -1;
|
||||||
|
|
||||||
|
// 学校状态重置
|
||||||
|
school.loading = false;
|
||||||
|
school.id = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -130,6 +142,7 @@ export const useLoadingInformationStore = defineStore(
|
|||||||
emergencyShelter,
|
emergencyShelter,
|
||||||
fireStation,
|
fireStation,
|
||||||
storePoints,
|
storePoints,
|
||||||
|
school,
|
||||||
resetStatue,
|
resetStatue,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import type { Point } from './Point';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 西安市学校数据接口
|
||||||
|
*/
|
||||||
|
export interface XianSchool extends Point {
|
||||||
|
/** 学校名称 */
|
||||||
|
schoolName?: string;
|
||||||
|
/** 学校地址 */
|
||||||
|
schoolAddress?: string;
|
||||||
|
/** 学校编码 */
|
||||||
|
schoolCode?: string;
|
||||||
|
/** 学校类型 */
|
||||||
|
schoolType?: string;
|
||||||
|
/** 所属部门 */
|
||||||
|
schoolCreater?: string;
|
||||||
|
/** 学校面积 */
|
||||||
|
area?: number;
|
||||||
|
/** 建筑物面积 */
|
||||||
|
constructionArea?: number;
|
||||||
|
/** 设施 */
|
||||||
|
devices?: number;
|
||||||
|
/** 是否重点保护目标 */
|
||||||
|
isImportant?: string;
|
||||||
|
/** 工作人员 */
|
||||||
|
staff?: number;
|
||||||
|
/** 学生数 */
|
||||||
|
students?: number;
|
||||||
|
/** 留校生 */
|
||||||
|
boarder?: number;
|
||||||
|
/** 留学生 */
|
||||||
|
foreignStudents?: number;
|
||||||
|
/** 教室数量 */
|
||||||
|
classrooms?: number;
|
||||||
|
/** 避难所面积 */
|
||||||
|
shelterArea?: number;
|
||||||
|
/** 是否有医院 */
|
||||||
|
isHaveHospital?: string;
|
||||||
|
/** 医生数量 */
|
||||||
|
doctorNum?: number;
|
||||||
|
/** 安全员数量 */
|
||||||
|
securityStaffNum?: number;
|
||||||
|
/** 应急电力 */
|
||||||
|
emergencyElectric?: string;
|
||||||
|
/** 供水 */
|
||||||
|
waterMethod?: string;
|
||||||
|
/** 供暖 */
|
||||||
|
heatingMethod?: string;
|
||||||
|
/** 应急通信 */
|
||||||
|
emergencyConnectionMethod?: string;
|
||||||
|
/** 灾害记录 */
|
||||||
|
isDisasterType?: string;
|
||||||
|
/** 灾害预案 */
|
||||||
|
haveEmergencyPlanType?: string;
|
||||||
|
/** 设施编码 */
|
||||||
|
institutionCode?: string;
|
||||||
|
/** 创造时间 */
|
||||||
|
createTime?: string;
|
||||||
|
/** 市 */
|
||||||
|
city?: string;
|
||||||
|
/** 区县 */
|
||||||
|
county?: string;
|
||||||
|
/** 联系电话 */
|
||||||
|
telephone?: string;
|
||||||
|
/** 区县编码 */
|
||||||
|
code?: string;
|
||||||
|
/** 单位负责人 */
|
||||||
|
unitHead?: string;
|
||||||
|
/** 街道/乡镇 */
|
||||||
|
country?: string;
|
||||||
|
/** 负责人 */
|
||||||
|
fillName?: string;
|
||||||
|
/** 承建单位 */
|
||||||
|
createName?: string;
|
||||||
|
/** 省 */
|
||||||
|
province?: string;
|
||||||
|
/** 记录人 */
|
||||||
|
statisticsHead?: string;
|
||||||
|
/** 报告时间 */
|
||||||
|
reportTime?: string;
|
||||||
|
/** 物理主键 */
|
||||||
|
physicalKey?: string;
|
||||||
|
/** 省编码 */
|
||||||
|
provinceCode?: number;
|
||||||
|
/** 市编码 */
|
||||||
|
cityCode?: number;
|
||||||
|
/** 区县编码 */
|
||||||
|
countyCode?: number;
|
||||||
|
/** 更新时间 */
|
||||||
|
updateTime?: string;
|
||||||
|
/** 经度 */
|
||||||
|
lon?: number;
|
||||||
|
/** 纬度 */
|
||||||
|
lat?: number;
|
||||||
|
/** 逻辑删除标识,0未删除,1已删除 */
|
||||||
|
isDelete?: number;
|
||||||
|
}
|
||||||
@@ -28,4 +28,7 @@ export enum LoadingResource {
|
|||||||
|
|
||||||
/** 物资储备点 */
|
/** 物资储备点 */
|
||||||
STORE_POINTS = 'STORE_POINTS',
|
STORE_POINTS = 'STORE_POINTS',
|
||||||
|
|
||||||
|
/** 学校 */
|
||||||
|
SCHOOL = 'SCHOOL',
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user