瀏覽代碼

统计分析

Hwf 3 周之前
父節點
當前提交
9fef29600a

+ 1 - 1
src/views/dataManagement/AddDataManagement.vue

@@ -18,7 +18,7 @@
             <el-input
               v-else
               v-model="formData[item.column_name]"
-              :type="['double', 'float'].includes(item.data_type) ? 'number' : 'textarea'"
+              :type="['double', 'float', 'decimal', 'int'].includes(item.data_type) ? 'number' : 'textarea'"
               :placeholder="'请输入' + item.column_comment"
               :autosize="{ minRows: 1, maxRows: 6 }"
               style="width: 468px !important"

+ 98 - 0
src/views/duty/eventing/StatisticalAnalysis.vue

@@ -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>

+ 13 - 4
src/views/duty/eventing/eventDetails.vue

@@ -18,6 +18,10 @@
           <i class="command-icon" />
           开始指挥
         </el-button>
+        <el-button type="primary" @click="handleShowAnalysis">
+          <el-icon style="margin-right: 6px"><Help /></el-icon>
+          统计分析
+        </el-button>
         <el-button v-if="['0', '1'].includes(detailData.event_status)" type="danger" plain @click="handleCloseEvent">
           <i class="close-icon" />
           关闭事件
@@ -105,7 +109,7 @@
     <div class="common-info-box">
       <div class="common-info-header">
         <i class="line-icon" />
-        <div class="common-info-title">匹配预案1</div>
+        <div class="common-info-title">匹配预案</div>
       </div>
       <div v-if="!!planFiles && planFiles.length > 0" class="common-info-content">
         <div class="list2">
@@ -177,6 +181,7 @@
       :event-id="eventId"
       @update:model-value="fetchEventDetail"
     />
+    <StatisticalAnalysis v-if="showAnalysis" v-model="showAnalysis" :event-id="eventId" />
   </div>
 </template>
 
@@ -188,8 +193,8 @@ import EventEditDialog from './EventEditDialog.vue';
 import EditCasualtiesDialog from './EditCasualtiesDialog.vue';
 import { download2 } from '@/utils/request';
 import PdfViewer from '@/views/knowledge/HiddenStandards/PdfViewer.vue';
-import { ref } from 'vue';
 import BigNumber from 'bignumber.js';
+import StatisticalAnalysis from './StatisticalAnalysis.vue';
 
 const props = defineProps({
   eventId: String
@@ -378,7 +383,7 @@ const fetchEventDetail = () => {
     planFiles.value = res.data.plan_files;
 
     fetchEventCasualties();
-  });  
+  });
 };
 
 const fetchEventCasualties = () => {
@@ -402,7 +407,11 @@ const previewSummaryFile = (filename, url) => {
   }
 };
 
-
+let showAnalysis = ref(false);
+// 显示统计分析
+const handleShowAnalysis = () => {
+  showAnalysis.value = true;
+};
 
 onMounted(() => {
   fetchEventDetail();