Files
xian_vue_new/src/hooks/rainstorm/useRainDisasterChain.ts
T

200 lines
4.2 KiB
TypeScript
Raw Normal View History

2026-04-14 08:08:01 +08:00
import { ref } from 'vue';
2026-04-13 20:55:32 +08:00
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots';
import type { PaginationType } from '@/types/common/PaginationType';
2026-04-14 08:08:01 +08:00
import { PointType } from '@/types/common/DisasterType';
2026-04-14 16:33:23 +08:00
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
import config from '@/config/config.json';
2026-04-13 20:55:32 +08:00
/**
* 暴雨灾害链影响点列表钩子函数
* @returns 搜索条件、表格数据、分页配置及相关方法
*/
export const useRainDisasterChain = () => {
/**
* 搜索条件
*/
2026-04-13 20:55:32 +08:00
const conditions = ref({
tableData: '',
2026-04-14 08:08:01 +08:00
hiddenPoint: PointType.LANDSLIDE,
2026-04-13 20:55:32 +08:00
});
/**
* 下拉选项
*/
2026-04-13 20:55:32 +08:00
const selectOptions = [
2026-04-14 08:08:01 +08:00
{ value: PointType.LANDSLIDE, label: '滑坡' },
{ value: PointType.DEBRIS_FLOW, label: '泥石流' },
{ value: PointType.FLASH_FLOOD, label: '山洪' },
{ value: PointType.WATER_LOGGING, label: '内涝' },
2026-04-13 20:55:32 +08:00
];
/**
* 表格数据
*/
2026-04-13 20:55:32 +08:00
const tableDatas = ref<XianHiddenDangerSpots[]>([]);
/**
* 表头配置
*/
2026-04-13 20:55:32 +08:00
const tableColumns = [
{ title: '名称', key: 'disasterName' },
{ title: '位置', key: 'position' },
{ title: '规模等级', key: 'scaleGrade' },
{ title: '险情等级', key: 'riskGrade' },
];
/**
* 分页配置
*/
2026-04-13 20:55:32 +08:00
const paginationConfig = ref<PaginationType>({
currentPage: 1,
pageSize: 10,
total: 10,
totalPage: 1,
});
/**
* 修改搜索条件
* @param value - 新的搜索条件
*/
2026-04-14 16:00:39 +08:00
const changeConditions = (value: {
2026-04-13 20:55:32 +08:00
tableData: string;
2026-04-14 08:08:01 +08:00
hiddenPoint: PointType;
2026-04-14 16:00:39 +08:00
}): void => {
2026-04-13 20:55:32 +08:00
conditions.value = value;
2026-04-14 16:00:39 +08:00
};
2026-04-13 20:55:32 +08:00
/**
* 修改页码
* @param value - 新的页码
*/
2026-04-14 16:00:39 +08:00
const changeCurrentPage = (value: number) => {
2026-04-13 20:55:32 +08:00
paginationConfig.value.currentPage = value;
2026-04-14 16:00:39 +08:00
};
/**
* 左侧按钮信息
*/
const leftButtonInfo = [
{
name: '周边分析',
callback: () => {
console.log('周边分析');
},
},
{
name: '关联分析',
callback: () => {
console.log('关联分析');
},
},
{
name: '次生衍生灾害链分析',
callback: () => {
console.log('次生衍生灾害链分析');
},
},
{
name: '历史相似性分析',
callback: () => {
console.log('历史相似性分析');
},
},
{
name: '灾害链模型库测试',
callback: () => {
console.log('灾害链模型库测试');
},
},
{
name: '承灾体信息提取',
callback: () => {
console.log('承灾体信息提取');
},
},
{
name: '暴雨内涝灾害链(50mm)',
callback: () => {
console.log('暴雨内涝灾害链(50mm)');
},
},
{
name: '暴雨滑坡灾害链(80mm)',
callback: () => {
console.log('暴雨滑坡灾害链(80mm)');
},
},
{
name: '暴雨洪涝灾害链(100mm)',
callback: () => {
console.log('暴雨洪涝灾害链(100mm)');
},
},
{
name: '暴雨山洪灾害链(110mm)',
callback: () => {
console.log('暴雨山洪灾害链(110mm)');
},
},
];
2026-04-13 20:55:32 +08:00
2026-04-14 16:33:23 +08:00
/**
* 右侧按钮信息
*/
const rightButtonInfo = [
{
name: '暴雨下载',
callback: () => {
console.log('暴雨下载');
},
},
{
name: '图件下载',
callback: () => {
console.log('图件下载');
},
},
{
name: '雷达云图',
callback: () => {
console.log('雷达云图');
},
},
{
name: '信息表格',
callback: () => {
console.log('信息表格');
},
},
{
name: '场景重置',
callback: () => {
CesiumUtilsSingleton.clearAllResources('custom');
},
executeOnce: true,
},
{
name: '视角重置',
callback: () => {
CesiumUtilsSingleton.flyToTarget(
config.defaultPosition as [number, number, number]
);
},
executeOnce: true,
},
];
2026-04-13 20:55:32 +08:00
// 把所有需要用到的数据/方法 return 出去
return {
conditions,
selectOptions,
tableDatas,
tableColumns,
paginationConfig,
2026-04-14 16:00:39 +08:00
leftButtonInfo,
2026-04-14 16:33:23 +08:00
rightButtonInfo,
2026-04-13 20:55:32 +08:00
changeConditions,
changeCurrentPage,
};
};