添加文档注释,方便生成技术文档

This commit is contained in:
wzy-warehouse
2026-04-13 22:28:56 +08:00
parent 8ef7d36d26
commit 27fba7ce12
34 changed files with 520 additions and 160 deletions
@@ -15,7 +15,14 @@ import {
} from '@/assets';
import { Color } from 'cesium';
/**
* 行政区划分相关钩子函数
* @returns 行政区数据、ID、颜色及透明度配置
*/
export const useAdministrativeDivision = () => {
/**
* 行政区GeoJSON数据数组
*/
const areas = [
baQiao,
beiLin,
@@ -31,6 +38,9 @@ export const useAdministrativeDivision = () => {
yanTa,
zhouZhi,
];
/**
* 行政区ID数组
*/
const areasId = [
'baqiao',
'beilin',
@@ -46,6 +56,9 @@ export const useAdministrativeDivision = () => {
'yanta',
'zhouzhi',
];
/**
* 行政区颜色数组
*/
const areasColor = [
new Color(255 / 255, 153 / 255, 0 / 255),
new Color(255 / 255, 51 / 255, 102 / 255),
@@ -61,7 +74,13 @@ export const useAdministrativeDivision = () => {
new Color(255 / 255, 153 / 255, 204 / 255),
new Color(190 / 255, 255 / 255, 232 / 255),
];
/**
* 区域透明度
*/
const areaTransparency = 0.3;
/**
* 标签透明度
*/
const labelTransparency = 1;
return { areas, areasId, areasColor, areaTransparency, labelTransparency };
+16 -4
View File
@@ -3,8 +3,14 @@ import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
import { ScreenSpaceEventType } from 'cesium';
import type { ClickObject } from '@/types/cesium/ClickObject';
import { useLoadingInformationStore } from '@/stores/useLoadingInformation';
/**
* 地图交互相关钩子函数
* @returns 注册监听器和视角控制方法
*/
export const useMap = () => {
// 注册全局点击监听器
/**
* 注册全局点击监听器
*/
const registerAndClickOnTheListener = () => {
CesiumUtilsSingleton.clickLayer((pickedObject: ClickObject) => {
if (
@@ -45,7 +51,9 @@ export const useMap = () => {
});
};
// 注册全局滚轮监听器
/**
* 注册全局滚轮监听器
*/
const registerAScrollListener = () => {
CesiumUtilsSingleton.getViewer()!.scene.canvas.addEventListener(
'wheel',
@@ -56,12 +64,16 @@ export const useMap = () => {
);
};
// 当行政区超出页面时,自动拉回视角
/**
* 当行政区超出页面时,自动拉回视角
*/
const automaticallyAdjustThePerspective = () => {
CesiumUtilsSingleton.outOverView();
};
// 禁止事件
/**
* 禁止默认事件
*/
const prohibitedEvents = () => {
// 禁止全局默认双击事件
CesiumUtilsSingleton.getViewer()?.cesiumWidget.screenSpaceEventHandler.removeInputAction(
@@ -5,7 +5,14 @@ import {
waterLoggingIcon,
} from '@/assets';
/**
* 隐患点相关钩子函数
* @returns 字段映射和获取灾害图标方法
*/
export const useHiddenPoint = () => {
/**
* 字段映射配置
*/
const field = {
fieldCode: '野外编号',
disasterName: '灾害点名称',
@@ -15,6 +22,11 @@ export const useHiddenPoint = () => {
riskGrade: '风险等级',
};
/**
* 根据灾害类型获取对应图标
* @param disasterType - 灾害类型
* @returns 图标路径
*/
function getDisasterIcon(disasterType?: string): string {
switch (disasterType) {
case '滑坡':
+14 -1
View File
@@ -1,9 +1,18 @@
import { riskAreaIcon } from '@/assets';
/**
* 风险点相关钩子函数
* @returns 信息框标题、字段映射和获取图标方法
*/
export const useRiskPoint = () => {
// 信息框标题
/**
* 信息框标题
*/
const informationBoxTitle = '风险区域';
/**
* 字段映射配置
*/
const field = {
riskName: '风险区名称',
unitCode: '统一编号',
@@ -18,6 +27,10 @@ export const useRiskPoint = () => {
lat: '纬度',
};
/**
* 获取风险点图标
* @returns 图标路径
*/
function getDisasterIcon(): string {
return riskAreaIcon;
}
+27 -8
View File
@@ -3,15 +3,22 @@ import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots';
import { HiddenPointType } from '@/types/common/DisasterType';
import type { PaginationType } from '@/types/common/PaginationType';
// 灾害链影响点列表钩子函数
/**
* 暴雨灾害链影响点列表钩子函数
* @returns 搜索条件、表格数据、分页配置及相关方法
*/
export const useRainDisasterChain = () => {
// 搜索条件
/**
* 搜索条件
*/
const conditions = ref({
tableData: '',
hiddenPoint: HiddenPointType.LANDSLIDE,
});
// 下拉选项
/**
* 下拉选项
*/
const selectOptions = [
{ value: HiddenPointType.LANDSLIDE, label: '滑坡' },
{ value: HiddenPointType.DEBRIS_FLOW, label: '泥石流' },
@@ -19,10 +26,14 @@ export const useRainDisasterChain = () => {
{ value: HiddenPointType.WATERLOGGING, label: '内涝' },
];
// 表格数据
/**
* 表格数据
*/
const tableDatas = ref<XianHiddenDangerSpots[]>([]);
// 表头
/**
* 表头配置
*/
const tableColumns = [
{ title: '名称', key: 'disasterName' },
{ title: '位置', key: 'position' },
@@ -30,7 +41,9 @@ export const useRainDisasterChain = () => {
{ title: '险情等级', key: 'riskGrade' },
];
// 分页配置
/**
* 分页配置
*/
const paginationConfig = ref<PaginationType>({
currentPage: 1,
pageSize: 10,
@@ -38,7 +51,10 @@ export const useRainDisasterChain = () => {
totalPage: 1,
});
// 修改条件
/**
* 修改搜索条件
* @param value - 新的搜索条件
*/
function changeConditions(value: {
tableData: string;
hiddenPoint: HiddenPointType;
@@ -46,7 +62,10 @@ export const useRainDisasterChain = () => {
conditions.value = value;
}
// 修改页码
/**
* 修改页码
* @param value - 新的页码
*/
function changeCurrentPage(value: number) {
paginationConfig.value.currentPage = value;
}
+7 -2
View File
@@ -6,9 +6,14 @@ import {
waterLoggingIcon,
} from '@/assets';
// 引入图例钩子函数
/**
* 暴雨图例钩子函数
* @returns 图例数据列表
*/
export const useRainLegend = () => {
// 图例数据
/**
* 图例数据
*/
const legendList = [
{ name: '滑坡隐患点', link: landslideIcon },
{ name: '泥石流隐患点', link: debrisFlowIcon },
+12 -1
View File
@@ -1,8 +1,15 @@
import { useRoute } from 'vue-router';
/**
* 首页导航相关钩子函数
* @returns 顶部导航映射和激活状态判断函数
*/
export const useIndex = () => {
const route = useRoute();
/**
* 顶部导航映射配置
*/
const topNavMap = [
{ title: '暴雨灾害链', name: 'rainstorm', query: { identification: 1 } },
{ title: '地震灾害链', name: 'earthquake', query: { identification: 2 } },
@@ -12,7 +19,11 @@ export const useIndex = () => {
{ title: '文件管理', name: 'index', query: { identification: 6 } },
];
// 判断当前导航项是否激活
/**
* 判断当前导航项是否激活
* @param identification - 导航项标识
* @returns 是否为激活状态
*/
const isActive = (identification: number) => {
const targetId = identification.toString();
let currentId = route.query.identification;
+3 -2
View File
@@ -10,11 +10,12 @@ import {
/**
* 公共批量处理点钩子函数
* @returns 添加点的方法
*/
export const usePointsHandle = () => {
/**
* 添加点
* @param points - 点数据
* 批量添加点
* @param points - 点数据数组
* @param getDisasterIcon - 获取灾害图标的函数
* @param prefix - 前缀
* @returns 点的ID列表