物资储备点
This commit is contained in:
@@ -6,6 +6,7 @@ import { getBasePoins as getHospitalsBasePoints, getPointDetailById as getHospit
|
||||
import { getBasePoints as getDangerousSourceBasePoints, getPointDetailById as getDangerousSourcePointDetailById} from './dangerous-source'
|
||||
import { getBasePoints as getEmergencyShelterBasePoints, getPointDetailById as getEmergencyShelterPointDetailById} from './emergency-shelter'
|
||||
import { getBasePoints as getFirefighterBasePoints, getPointDetailById as getFirefighterPointDetailById} from './firefighter'
|
||||
import { getBasePoints as getStorePointsBasePoints, getPointDetailById as getStorePointsPointDetailById} from './store-points'
|
||||
import type { ApiResponse } from '@/types/ApiResponse'
|
||||
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'
|
||||
import type { XianRiskSpots } from '@/types/base/XianRiskSpots'
|
||||
@@ -13,6 +14,7 @@ import type { XianHospitals } from '@/types/base/XianHospitals'
|
||||
import type { XianDangerousSource } from '@/types/base/XianDangerousSource'
|
||||
import type { XianEmergencyShelter } from '@/types/base/XianEmergencyShelter'
|
||||
import type { XianFirefighter } from '@/types/base/XianFirefighter'
|
||||
import type { XianStorePoints } from '@/types/base/XianStorePoints'
|
||||
|
||||
/**
|
||||
* API接口统一导出对象
|
||||
@@ -124,4 +126,20 @@ export const $api = {
|
||||
*/
|
||||
getPointDetailById: (id: number): Promise<ApiResponse<XianFirefighter>> => getFirefighterPointDetailById(id),
|
||||
},
|
||||
|
||||
// 物资储备点信息
|
||||
storePoints: {
|
||||
/**
|
||||
* 获取所有基础物资储备点
|
||||
* @returns 物资储备点数据数组
|
||||
*/
|
||||
getBasePoints: (): Promise<ApiResponse<XianStorePoints[]>> => getStorePointsBasePoints(),
|
||||
|
||||
/**
|
||||
* 根据id获取物资储备点详情
|
||||
* @param id - 物资储备点id
|
||||
* @returns 物资储备点详情
|
||||
*/
|
||||
getPointDetailById: (id: number): Promise<ApiResponse<XianStorePoints>> => getStorePointsPointDetailById(id),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ApiResponse } from "@/types/ApiResponse"
|
||||
import type { XianStorePoints } from "@/types/base/XianStorePoints"
|
||||
import httpInstance from "@/utils/request/http"
|
||||
|
||||
/**
|
||||
* 获取物资储备点基础数据
|
||||
* @returns 物资储备点数据数组
|
||||
*/
|
||||
export const getBasePoints = (): Promise<ApiResponse<XianStorePoints[]>> => {
|
||||
return httpInstance.get('/store-points/base-points')
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取物资储备点详情
|
||||
* @param id - 物资储备点id
|
||||
* @returns 物资储备点详情
|
||||
*/
|
||||
export const getPointDetailById = (id: number): Promise<ApiResponse<XianStorePoints>> => {
|
||||
return httpInstance.get(`/store-points/point-detail/${id}`)
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@@ -30,6 +30,14 @@
|
||||
useStatusStore().poiLayers.showFireStation.loading
|
||||
"
|
||||
/>
|
||||
|
||||
<!-- 物资储备点 -->
|
||||
<StorePointsComponent
|
||||
v-if="
|
||||
useStatusStore().appLoadingCompleted &&
|
||||
useStatusStore().poiLayers.showReservePoint.loading
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -38,6 +46,7 @@
|
||||
import DangerousSourceComponent from './DangerousSourceComponent.vue';
|
||||
import EmergencyShelterComponent from './EmergencyShelterComponent.vue';
|
||||
import FireStationComponent from './FireStationComponent.vue';
|
||||
import StorePointsComponent from './StorePointsComponent.vue';
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<!-- 物资储备点组件 -->
|
||||
<template>
|
||||
<div>
|
||||
<!-- 加载物资储备点 -->
|
||||
<LoadingPoints
|
||||
v-if="
|
||||
useStatusStore().appLoadingCompleted && storePointsList.length > 0
|
||||
"
|
||||
:base-points="storePointsList"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.storePointsPointId"
|
||||
:is-default="false"
|
||||
:loading-resource-field="LoadingResource.STORE_POINTS"
|
||||
/>
|
||||
|
||||
<!-- 显示信息框 -->
|
||||
<InformationBox
|
||||
:data="storePointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().storePoints.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().storePoints.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';
|
||||
import LoadingPoints from '@/component/rain-earthquake/LoadingPoints.vue';
|
||||
import config from '@/config/config.json';
|
||||
import InformationBox from '@/component/common/InformationBox.vue';
|
||||
import { useStatusStore } from '@/stores/useStatusStore';
|
||||
import { useLoadingInformationStore } from '@/stores/useLoadingInformation';
|
||||
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
|
||||
import { LoadingResource } from '@/types/common/LoadingResourceType';
|
||||
import { useStorePointsPoint } from '@/hooks/rain-earthquake/useStorePointsPoint';
|
||||
import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore';
|
||||
|
||||
const storePointsList = ref<Point[]>([]);
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
const storePointDetail = ref<Point>();
|
||||
const informationBoxTitle = ref('');
|
||||
|
||||
// 获取钩子函数
|
||||
const { field, getDisasterIcon } = useStorePointsPoint();
|
||||
|
||||
$api.storePoints.getBasePoints().then((res) => {
|
||||
storePointsList.value = res.data;
|
||||
});
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().storePoints.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取物资储备点数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await $api.storePoints.getPointDetailById(
|
||||
useLoadingInformationStore().storePoints.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
storePointDetail.value = res.data;
|
||||
informationBoxTitle.value = res.data.name || '物资储备点信息';
|
||||
|
||||
try {
|
||||
// 将坐标转换为偏移量
|
||||
const screenPos = CesiumUtilsSingleton.convertScreenPosition(
|
||||
clickObject.primitive.position
|
||||
);
|
||||
offsetX.value = screenPos.x;
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().storePoints.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showReservePoint.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示物资储备点
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
LoadingResource.STORE_POINTS
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// 隐藏物资储备点
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
LoadingResource.STORE_POINTS
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -39,6 +39,7 @@
|
||||
"hospitalPointId": "hospital-point-",
|
||||
"dangerousSourcePointId": "dangerous-source-point-",
|
||||
"emergencyShelterPointId": "emergency-shelter-point-",
|
||||
"fireStationPointId": "fire-station-point-"
|
||||
"fireStationPointId": "fire-station-point-",
|
||||
"storePointsPointId": "store-points-point-"
|
||||
}
|
||||
}
|
||||
@@ -211,9 +211,7 @@ export const useEarthquakeDisasterChain = () => {
|
||||
name: '显示储备点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showReservePoint' as const,
|
||||
callback: (status: unknown) => {
|
||||
console.log('显示储备点', status);
|
||||
},
|
||||
callback: layerControl.clickStorePoints,
|
||||
},
|
||||
{
|
||||
name: '显示学校',
|
||||
|
||||
@@ -69,6 +69,11 @@ export const useMap = () => {
|
||||
useLoadingInformationStore().fireStation.id = id;
|
||||
}
|
||||
|
||||
// 物资储备点
|
||||
else if (pickedObject.id.startsWith(config.prefix.storePointsPointId)) {
|
||||
useLoadingInformationStore().storePoints.id = id;
|
||||
}
|
||||
|
||||
// 其他
|
||||
else {
|
||||
// 重置状态
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import storePointsIcon from '@/assets/images/icon/store-points.jpg';
|
||||
|
||||
/**
|
||||
* 物资储备点相关钩子函数
|
||||
* @returns
|
||||
*/
|
||||
export const useStorePointsPoint = () => {
|
||||
/**
|
||||
* 字段映射配置
|
||||
*/
|
||||
const field = {
|
||||
name: '储备站点名称',
|
||||
level: '级别',
|
||||
type: '储备站类型',
|
||||
address: '地理位置',
|
||||
lon: '经度',
|
||||
lat: '纬度',
|
||||
volume: '储备站有效库容',
|
||||
tent: '救援帐篷数',
|
||||
generator: '发电机数',
|
||||
unitHead: '负责人',
|
||||
telephone: '手机号',
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取物资储备点图标
|
||||
* @returns 图标路径
|
||||
*/
|
||||
function getDisasterIcon(): string {
|
||||
return storePointsIcon;
|
||||
}
|
||||
|
||||
return { field, getDisasterIcon };
|
||||
};
|
||||
@@ -241,9 +241,7 @@ export const useRainDisasterChain = () => {
|
||||
name: '显示储备点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showReservePoint' as const,
|
||||
callback: (status: unknown) => {
|
||||
console.log('显示储备点', status);
|
||||
},
|
||||
callback: layerControl.clickStorePoints,
|
||||
},
|
||||
{
|
||||
name: '显示学校',
|
||||
|
||||
@@ -45,11 +45,20 @@ export const useLayerControl = () => {
|
||||
useStatusStore().poiLayers.showFireStation.loading = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 点击显示物资储备点
|
||||
*/
|
||||
const clickStorePoints = () => {
|
||||
// 加载状态为true
|
||||
useStatusStore().poiLayers.showReservePoint.loading = true;
|
||||
};
|
||||
|
||||
return {
|
||||
clickHiddenDangerPoint,
|
||||
clickHospital,
|
||||
clickDangerousSource,
|
||||
clickEmergencyShelter,
|
||||
clickFireStation,
|
||||
clickStorePoints,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -76,6 +76,14 @@ export const useLoadingInformationStore = defineStore(
|
||||
id: -1,
|
||||
});
|
||||
|
||||
// ============================== 物资储备点状态 ================================
|
||||
const storePoints = reactive({
|
||||
/** 加载状态 */
|
||||
loading: false,
|
||||
/** 物资储备点ID */
|
||||
id: -1,
|
||||
});
|
||||
|
||||
/**
|
||||
* 重置所有状态
|
||||
*/
|
||||
@@ -107,6 +115,10 @@ export const useLoadingInformationStore = defineStore(
|
||||
// 消防站状态重置
|
||||
fireStation.loading = false;
|
||||
fireStation.id = -1;
|
||||
|
||||
// 物资储备点状态重置
|
||||
storePoints.loading = false;
|
||||
storePoints.id = -1;
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -117,6 +129,7 @@ export const useLoadingInformationStore = defineStore(
|
||||
dangerousSource,
|
||||
emergencyShelter,
|
||||
fireStation,
|
||||
storePoints,
|
||||
resetStatue,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import type { Point } from './Point';
|
||||
|
||||
/**
|
||||
* 西安市物资储备点数据接口
|
||||
*/
|
||||
export interface XianStorePoints extends Point {
|
||||
/** 储备库名称 */
|
||||
name?: string;
|
||||
/** 详细地址 */
|
||||
address?: string;
|
||||
/** 所属部门 */
|
||||
department?: string;
|
||||
/** 分级 */
|
||||
level?: string;
|
||||
/** 类型 */
|
||||
type?: string;
|
||||
/** 建立时间 */
|
||||
standTime?: string;
|
||||
/** 有效库容 */
|
||||
volume?: string;
|
||||
/** 维护人员 */
|
||||
maintenance?: string;
|
||||
/** 救灾帐篷 */
|
||||
tent?: number;
|
||||
/** 棉被 */
|
||||
quilt?: number;
|
||||
/** 棉衣 */
|
||||
clothes?: number;
|
||||
/** 毛巾被 */
|
||||
towelBlanket?: number;
|
||||
/** 毛毯 */
|
||||
blanket?: number;
|
||||
/** 睡袋 */
|
||||
sleepingBed?: number;
|
||||
/** 折叠床 */
|
||||
foldingBed?: number;
|
||||
/** 简易厕所 */
|
||||
wc?: number;
|
||||
/** 生活类物资折合金额 */
|
||||
shlwzzhje?: number;
|
||||
/** 橡皮船 */
|
||||
rubberBoat?: number;
|
||||
/** 冲锋舟 */
|
||||
rescueBoat?: number;
|
||||
/** 救生船 */
|
||||
saveBoat?: number;
|
||||
/** 救生衣 */
|
||||
saveClothes?: number;
|
||||
/** 救生圈 */
|
||||
jsq?: number;
|
||||
/** 编织袋 */
|
||||
bzd?: number;
|
||||
/** 麻袋 */
|
||||
md?: number;
|
||||
/** 抽水泵 */
|
||||
waterPump?: number;
|
||||
/** 救援类物资折和金额 */
|
||||
jylwzzhje?: number;
|
||||
/** 发电机 */
|
||||
generator?: number;
|
||||
/** 应急灯 */
|
||||
emergencyLight?: number;
|
||||
/** 其他物资折合金额 */
|
||||
qtwzzhje?: number;
|
||||
/** 救灾衣被 */
|
||||
saveClo?: number;
|
||||
/** 救援工具 */
|
||||
saveTool?: number;
|
||||
/** 折合金额 */
|
||||
zhje?: string;
|
||||
/** 市 */
|
||||
city?: string;
|
||||
/** 省 */
|
||||
province?: string;
|
||||
/** 村 */
|
||||
village?: string;
|
||||
/** 上报日期 */
|
||||
reportTime?: string;
|
||||
/** 乡 */
|
||||
country?: string;
|
||||
/** 创建人名称 */
|
||||
creatName?: string;
|
||||
/** 县 */
|
||||
county?: string;
|
||||
/** 单位负责人 */
|
||||
unitHead?: string;
|
||||
/** 填表人 */
|
||||
fillName?: string;
|
||||
/** 联系电话 */
|
||||
telephone?: string;
|
||||
/** 创建时间 */
|
||||
createTime?: string;
|
||||
/** 更新时间 */
|
||||
updateTime?: string;
|
||||
/** 写入时间 */
|
||||
overwriteTime?: string;
|
||||
/** 经度 */
|
||||
lon?: number;
|
||||
/** 纬度 */
|
||||
lat?: number;
|
||||
/** 逻辑删除标识,0未删除,1已删除 */
|
||||
isDelete?: number;
|
||||
}
|
||||
@@ -25,4 +25,7 @@ export enum LoadingResource {
|
||||
|
||||
/** 消防站 */
|
||||
FIRE_STATION = 'FIRE_STATION',
|
||||
|
||||
/** 物资储备点 */
|
||||
STORE_POINTS = 'STORE_POINTS',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user