记录基础信息

This commit is contained in:
wzy-warehouse
2026-04-27 21:57:12 +08:00
parent e47a660590
commit 8170b3f162
4 changed files with 22 additions and 16 deletions
+7 -6
View File
@@ -24,12 +24,13 @@
onMounted(() => { onMounted(() => {
// 加载点 // 加载点
const result: { ids: string[]; names: string[] } = pointsHandle.addPoints( const result: { ids: string[]; info: Record<string, unknown>[] } =
props.basePoints, pointsHandle.addPoints(
props.getDisasterIcon, props.basePoints,
props.prefix, props.getDisasterIcon,
props.isDefault props.prefix,
); props.isDefault
);
// 记录id // 记录id
useLoadingResourceStore().addLoadingResource( useLoadingResourceStore().addLoadingResource(
+1 -1
View File
@@ -47,7 +47,7 @@
// 记录行政区划id // 记录行政区划id
useLoadingResourceStore().addLoadingResource( useLoadingResourceStore().addLoadingResource(
LoadingResource.ADMINISTRATIVE_DIVISION, LoadingResource.ADMINISTRATIVE_DIVISION,
{ ids: areasId, names: [] } // 此处name不进行记录 { ids: areasId, info: [] } // 此处info不进行记录
); );
}); });
+5 -6
View File
@@ -26,13 +26,13 @@ export const usePointsHandle = () => {
getDisasterIcon: (disasterType?: string) => string, getDisasterIcon: (disasterType?: string) => string,
prefix: string, prefix: string,
isDefault: boolean = false isDefault: boolean = false
): { ids: string[]; names: string[] } { ): { ids: string[]; info: Record<string, unknown>[] } {
// 设置加载配置 // 设置加载配置
const options: PrimitiveOptions[] = []; const options: PrimitiveOptions[] = [];
// 存放id、name // 存放id、name、经纬度
const ids: string[] = []; const ids: string[] = [];
const names: string[] = []; const info: Record<string, unknown>[] = [];
points.forEach((point) => { points.forEach((point) => {
try { try {
@@ -43,9 +43,8 @@ export const usePointsHandle = () => {
const position = Cartesian3.fromDegrees(point.lon, point.lat, 10); const position = Cartesian3.fromDegrees(point.lon, point.lat, 10);
const id = `${prefix}${point.id}`; const id = `${prefix}${point.id}`;
const name = point.name!;
ids.push(id); ids.push(id);
names.push(name); info.push({ id, name: point.name!, lon: point.lon, lat: point.lat });
options.push({ options.push({
id: id, id: id,
@@ -69,7 +68,7 @@ export const usePointsHandle = () => {
// 批量创建图层 // 批量创建图层
CesiumUtilsSingleton.addPrimitivesBatch(options); CesiumUtilsSingleton.addPrimitivesBatch(options);
return { ids, names }; return { ids, info };
} }
return { addPoints }; return { addPoints };
+9 -3
View File
@@ -5,13 +5,18 @@ import { ref, type Ref } from 'vue';
// 存储按需加载的数据 // 存储按需加载的数据
export const useLoadingResourceStore = defineStore('loadingResource', () => { export const useLoadingResourceStore = defineStore('loadingResource', () => {
const loadingResource: Ref< const loadingResource: Ref<
Partial<Record<LoadingResource, { ids: string[]; names: string[] }>> Partial<
Record<
LoadingResource,
{ ids: string[]; info: Record<string, unknown>[] }
>
>
> = ref({}); > = ref({});
// 添加数据 // 添加数据
const addLoadingResource = ( const addLoadingResource = (
key: LoadingResource, key: LoadingResource,
value: { ids: string[]; names: string[] } value: { ids: string[]; info: Record<string, unknown>[] }
) => { ) => {
loadingResource.value[key] = value; loadingResource.value[key] = value;
}; };
@@ -27,10 +32,11 @@ export const useLoadingResourceStore = defineStore('loadingResource', () => {
* 获取数据 * 获取数据
*/ */
const getLoadingResource = (key: LoadingResource) => { const getLoadingResource = (key: LoadingResource) => {
return loadingResource.value[key] || { ids: [], names: [] }; return loadingResource.value[key] || { ids: [], info: [] };
}; };
return { return {
loadingResource,
getLoadingResource, getLoadingResource,
addLoadingResource, addLoadingResource,
removeLoadingResource, removeLoadingResource,