第三步:风险点分类显示
This commit is contained in:
@@ -29,29 +29,36 @@
|
|||||||
/>
|
/>
|
||||||
<el-select v-model="conditions.hiddenPoint" class="search-hidden-point">
|
<el-select v-model="conditions.hiddenPoint" class="search-hidden-point">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(opt, index) in selectOptions"
|
v-for="(opt, index) in selectOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="`${opt.label}预警点`"
|
:label="opt.value === PointType.RISK_AREA ? opt.label : `${opt.label}预警点`"
|
||||||
:value="opt.value"
|
:value="opt.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<div class="table-box">
|
<div class="table-box">
|
||||||
<el-table
|
<el-table
|
||||||
:data="paginatedData"
|
:data="paginatedData"
|
||||||
border
|
border
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
empty-text="暂无数据"
|
empty-text="暂无数据"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="(row, index) in tableColumns"
|
v-for="(row, index) in tableColumns"
|
||||||
:key="index"
|
:key="index"
|
||||||
:prop="row.key"
|
:prop="row.key"
|
||||||
:label="
|
:label="
|
||||||
index == 0 ? `${conditions.hiddenPoint}${row.title}` : row.title
|
index == 0 ? `${conditions.hiddenPoint}${row.title}` : row.title
|
||||||
"
|
"
|
||||||
/>
|
>
|
||||||
|
<template #default="scope" v-if="row.key === 'position'">
|
||||||
|
<div class="position-cell">
|
||||||
|
<div>{{ scope.row.lon?.toFixed(4) }},</div>
|
||||||
|
<div>{{ scope.row.lat?.toFixed(4) }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -293,4 +300,12 @@
|
|||||||
text-overflow: unset;
|
text-overflow: unset;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 位置列样式:经纬度两行显示 */
|
||||||
|
.position-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots';
|
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots';
|
||||||
|
import type { XianRiskSpots } from '@/types/base/XianRiskSpots';
|
||||||
import type { PaginationType } from '@/types/common/PaginationType';
|
import type { PaginationType } from '@/types/common/PaginationType';
|
||||||
import { PointType } from '@/types/common/DisasterType';
|
import { PointType } from '@/types/common/DisasterType';
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ export const useDisasterChainTable = () => {
|
|||||||
/**
|
/**
|
||||||
* 表格数据
|
* 表格数据
|
||||||
*/
|
*/
|
||||||
const tableDatas = ref<XianHiddenDangerSpots[]>([]);
|
const tableDatas = ref<(XianHiddenDangerSpots | XianRiskSpots)[]>([]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页配置
|
* 分页配置
|
||||||
@@ -123,7 +124,7 @@ export const useDisasterChainTable = () => {
|
|||||||
* 设置表格数据
|
* 设置表格数据
|
||||||
* @param datas - 表格数据数组
|
* @param datas - 表格数据数组
|
||||||
*/
|
*/
|
||||||
const setTableDatas = (datas: XianHiddenDangerSpots[]) => {
|
const setTableDatas = (datas: (XianHiddenDangerSpots | XianRiskSpots)[]) => {
|
||||||
tableDatas.value = datas;
|
tableDatas.value = datas;
|
||||||
paginationConfig.value.total = datas.length;
|
paginationConfig.value.total = datas.length;
|
||||||
paginationConfig.value.totalPage = Math.ceil(datas.length / paginationConfig.value.pageSize);
|
paginationConfig.value.totalPage = Math.ceil(datas.length / paginationConfig.value.pageSize);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const usePointsHandle = () => {
|
|||||||
|
|
||||||
const id = `${prefix}${point.id}`;
|
const id = `${prefix}${point.id}`;
|
||||||
ids.push(id);
|
ids.push(id);
|
||||||
info.push({ id, name: point.name!, lon: point.lon, lat: point.lat, scale_grade: point.scale_grade, risk_grade: point.risk_grade });
|
info.push({ id, name: point.name!, lon: point.lon, lat: point.lat, scale_grade: point.scale_grade, risk_grade: point.risk_grade, risk_level: point.risk_level });
|
||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
id: id,
|
id: id,
|
||||||
|
|||||||
@@ -20,4 +20,6 @@ export interface Point {
|
|||||||
scale_grade?: string;
|
scale_grade?: string;
|
||||||
/** 险情等级(隐患点专用) */
|
/** 险情等级(隐患点专用) */
|
||||||
risk_grade?: string;
|
risk_grade?: string;
|
||||||
|
/** 风险区等级(风险点专用) */
|
||||||
|
risk_level?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
import type { AroundAnalysisState } from '@/types/common/useAroundAnalysisType';
|
import type { AroundAnalysisState } from '@/types/common/useAroundAnalysisType';
|
||||||
import type { PointResource } from '@/types/common/useAroundAnalysisType';
|
import type { PointResource } from '@/types/common/useAroundAnalysisType';
|
||||||
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots';
|
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots';
|
||||||
|
import type { XianRiskSpots } from '@/types/base/XianRiskSpots';
|
||||||
import {
|
import {
|
||||||
useDisasterChainTable,
|
useDisasterChainTable,
|
||||||
type SearchConditions,
|
type SearchConditions,
|
||||||
@@ -127,9 +128,10 @@
|
|||||||
{ value: PointType.WATER_LOGGING, label: '内涝' },
|
{ value: PointType.WATER_LOGGING, label: '内涝' },
|
||||||
{ value: PointType.FLASH_FLOOD, label: '山洪' },
|
{ value: PointType.FLASH_FLOOD, label: '山洪' },
|
||||||
{ value: PointType.COLLAPSE, label: '崩塌' },
|
{ value: PointType.COLLAPSE, label: '崩塌' },
|
||||||
|
{ value: PointType.RISK_AREA, label: '风险区' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 设置表格列配置
|
// 设置表格列配置(默认显示隐患点的列)
|
||||||
setTableColumns([
|
setTableColumns([
|
||||||
{ title: '名称', key: 'disasterName' },
|
{ title: '名称', key: 'disasterName' },
|
||||||
{ title: '位置', key: 'position' },
|
{ title: '位置', key: 'position' },
|
||||||
@@ -143,6 +145,24 @@
|
|||||||
*/
|
*/
|
||||||
changeConditions.value = (value: SearchConditions) => {
|
changeConditions.value = (value: SearchConditions) => {
|
||||||
setConditions(value);
|
setConditions(value);
|
||||||
|
|
||||||
|
// 根据选择的类型动态改变表格列
|
||||||
|
if (value.hiddenPoint === PointType.RISK_AREA) {
|
||||||
|
// 风险区:只显示风险区等级
|
||||||
|
setTableColumns([
|
||||||
|
{ title: '名称', key: 'disasterName' },
|
||||||
|
{ title: '位置', key: 'position' },
|
||||||
|
{ title: '风险区等级', key: 'riskLevel' },
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
// 隐患点:显示规模等级和险情等级
|
||||||
|
setTableColumns([
|
||||||
|
{ title: '名称', key: 'disasterName' },
|
||||||
|
{ title: '位置', key: 'position' },
|
||||||
|
{ title: '规模等级', key: 'scaleGrade' },
|
||||||
|
{ title: '险情等级', key: 'riskGrade' },
|
||||||
|
]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -174,31 +194,51 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 将 PointResource 转换为 XianHiddenDangerSpots 格式
|
// 根据类型转换数据
|
||||||
const convertedData: XianHiddenDangerSpots[] = filteredPoints.map(
|
const convertedData = filteredPoints.map(point => {
|
||||||
point => ({
|
if (point.category === 'risk-point') {
|
||||||
id:
|
// 风险点数据
|
||||||
typeof point.id === 'number'
|
return {
|
||||||
? point.id
|
id:
|
||||||
: parseInt(String(point.id), 10),
|
typeof point.id === 'number'
|
||||||
name: point.value,
|
? point.id
|
||||||
disasterName: point.value,
|
: parseInt(String(point.id), 10),
|
||||||
position:
|
name: point.value,
|
||||||
point.lon !== undefined && point.lat !== undefined
|
disasterName: point.value,
|
||||||
? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}`
|
position:
|
||||||
: '未知位置',
|
point.lon !== undefined && point.lat !== undefined
|
||||||
scaleGrade: String(point.scale_grade || '未知'),
|
? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}`
|
||||||
riskGrade: String(point.risk_grade || '一般'),
|
: '未知位置',
|
||||||
lon: point.lon,
|
riskLevel: String(point.risk_level || '一般'),
|
||||||
lat: point.lat,
|
lon: point.lon,
|
||||||
fieldCode: String(point.id),
|
lat: point.lat,
|
||||||
province: '陕西省',
|
} as XianRiskSpots;
|
||||||
city: '西安市',
|
} else {
|
||||||
county: '',
|
// 隐患点数据
|
||||||
village: '',
|
return {
|
||||||
isDelete: 0,
|
id:
|
||||||
})
|
typeof point.id === 'number'
|
||||||
);
|
? point.id
|
||||||
|
: parseInt(String(point.id), 10),
|
||||||
|
name: point.value,
|
||||||
|
disasterName: point.value,
|
||||||
|
position:
|
||||||
|
point.lon !== undefined && point.lat !== undefined
|
||||||
|
? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}`
|
||||||
|
: '未知位置',
|
||||||
|
scaleGrade: String(point.scale_grade || '未知'),
|
||||||
|
riskGrade: String(point.risk_grade || '一般'),
|
||||||
|
lon: point.lon,
|
||||||
|
lat: point.lat,
|
||||||
|
fieldCode: String(point.id),
|
||||||
|
province: '陕西省',
|
||||||
|
city: '西安市',
|
||||||
|
county: '',
|
||||||
|
village: '',
|
||||||
|
isDelete: 0,
|
||||||
|
} as XianHiddenDangerSpots;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
console.log('convertedData:', convertedData);
|
console.log('convertedData:', convertedData);
|
||||||
setTableDatas(convertedData);
|
setTableDatas(convertedData);
|
||||||
|
|||||||
Reference in New Issue
Block a user