|
@@ -0,0 +1,98 @@
|
|
|
+<template>
|
|
|
+ <el-dialog title="统计分析" ref="formDialogRef" :model-value="visible" width="750px" append-to-body>
|
|
|
+ <div style="font-size: 16px; font-weight: bold; margin: 10px 0">事件统计报表</div>
|
|
|
+ <el-table :data="eventCasualtiesList">
|
|
|
+ <el-table-column label="行政区划" align="center" prop="area_name" />
|
|
|
+ <el-table-column label="受灾人数(人)" align="center" prop="injuries" />
|
|
|
+ <el-table-column label="失踪人数(人)" align="center" prop="missing" />
|
|
|
+ <el-table-column label="死亡人数(人)" align="center" prop="deaths" />
|
|
|
+ <el-table-column label="紧急转移(人)" align="center" prop="transfer" />
|
|
|
+ <el-table-column label="直接经济损失(万元)" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ new BigNumber(row.economic_loss || 0).toFormat() }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <template #append>
|
|
|
+ <tr class="summary-row">
|
|
|
+ <td>合计</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('injuries')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('missing')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('deaths')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('transfer')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('economic_loss')).toFormat() }}</td>
|
|
|
+ </tr>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ <div style="font-size: 16px; font-weight: bold; margin: 10px 0">事件处置任务执行情况</div>
|
|
|
+ <el-table :data="dataList">
|
|
|
+ <el-table-column label="任务类型" align="center" prop="" />
|
|
|
+ <el-table-column label="任务发布数量" align="center" prop="" />
|
|
|
+ <el-table-column label="处理中" align="center" prop="" />
|
|
|
+ <el-table-column label="已完成" align="center" prop="" />
|
|
|
+ <el-table-column label="任务完成率" align="center" prop="" />
|
|
|
+ <template #append>
|
|
|
+ <tr class="summary-row">
|
|
|
+ <td>合计</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('injuries')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('missing')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('deaths')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('transfer')).toFormat() }}</td>
|
|
|
+ <td>{{ new BigNumber(calculateTotal('economic_loss')).toFormat() }}</td>
|
|
|
+ </tr>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="StatisticalAnalysis">
|
|
|
+import BigNumber from 'bignumber.js';
|
|
|
+import { getEventCasualties } from '@/api/duty/eventing';
|
|
|
+
|
|
|
+interface Props {
|
|
|
+ modelValue: boolean;
|
|
|
+ eventId: string;
|
|
|
+}
|
|
|
+const props = withDefaults(defineProps<Props>(), {
|
|
|
+ modelValue: false
|
|
|
+});
|
|
|
+const emits = defineEmits(['update:modelValue']);
|
|
|
+const visible = computed({
|
|
|
+ get() {
|
|
|
+ return props.modelValue;
|
|
|
+ },
|
|
|
+ set(newValue) {
|
|
|
+ emits('update:modelValue', newValue);
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+const eventCasualtiesList = ref([]);
|
|
|
+const dataList = ref([]);
|
|
|
+// 计算合计的方法
|
|
|
+const calculateTotal = (prop: string) => {
|
|
|
+ return eventCasualtiesList.value
|
|
|
+ .reduce((sum, item) => {
|
|
|
+ const currentValue = new BigNumber(item[prop] || 0);
|
|
|
+ return sum.plus(currentValue);
|
|
|
+ }, new BigNumber(0))
|
|
|
+ .toFormat();
|
|
|
+};
|
|
|
+onMounted(() => {
|
|
|
+ getEventCasualties({ event_id: props.eventId }).then((res) => {
|
|
|
+ eventCasualtiesList.value = res.data;
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.summary-row {
|
|
|
+ font-weight: bold;
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ td {
|
|
|
+ text-align: center;
|
|
|
+ padding: 18px 10px;
|
|
|
+ word-break: break-all;
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|