From 375b6acbd3a8f9cf51f967b09ecd09eccd1a12f3 Mon Sep 17 00:00:00 2001 From: zhaojiale <631455805@qq.com> Date: 星期四, 18 八月 2022 17:53:29 +0800 Subject: [PATCH] 统计 事故统计 --- src/views/accidentManagementSystem/accidentStatistics/index.vue | 182 +++++++++++++++++++++++++++++++++++++++++++++ src/api/goalManagement/index.ts | 8 ++ src/views/contingencyManagement/emergencyDrillStatistics/index.vue | 5 - 3 files changed, 190 insertions(+), 5 deletions(-) diff --git a/src/api/goalManagement/index.ts b/src/api/goalManagement/index.ts index 806f59e..3c20344 100644 --- a/src/api/goalManagement/index.ts +++ b/src/api/goalManagement/index.ts @@ -386,5 +386,13 @@ data:params }) }, + // 统计 事故快报 + accidentReportCount(params:any){ + return request({ + url:"/accidentCount/accidentReport/count", + method:"post", + data:params + }) + }, } } \ No newline at end of file diff --git a/src/views/accidentManagementSystem/accidentStatistics/index.vue b/src/views/accidentManagementSystem/accidentStatistics/index.vue new file mode 100644 index 0000000..1337225 --- /dev/null +++ b/src/views/accidentManagementSystem/accidentStatistics/index.vue @@ -0,0 +1,182 @@ +<template> + <div class="system-user-container"> + <el-card shadow="hover"> + <div class="system-user-search mb15"> + <el-form ref="ruleFormRef" size="default" label-width="80px" :inline="true"> + <el-row :gutter="35"> + <el-col :xs="24" :sm="4" :md="4" :lg="4" :xl="4" class="mb20"> + <el-form-item prop="telephone" label="选择年月"> + <el-radio-group v-model="params.type" class="w100"> + <el-radio :label="2">年</el-radio> + <el-radio :label="1">月</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="4" :md="4" :lg="4" :xl="4" class="mb20"> + <el-form-item v-if="params.type==2" prop="telephone" label="选择年"> + <el-date-picker + v-model="params.year" + :disabled="disabled" + type="year" + class="w100" + value-format="YYYY" + placeholder="选择日期时间" + /> + </el-form-item> + <el-form-item v-if="params.type==1" prop="telephone" label="选择月"> + <el-date-picker + v-model="params.realMonth" + :disabled="disabled" + type="month" + class="w100" + value-format="YYYY-MM" + placeholder="选择日期时间" + /> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8" class="mb20"> + <el-button size="default" type="primary" class="ml10" @click="emergencySuppliesCount"> 查询</el-button> + </el-col> + </el-row> + </el-form> + <div class="echarts" ref="echarts1"> + + </div> + </div> + + </el-card> + + </div> +</template> +<script lang="ts"> + import { defineComponent, onMounted, ref } from 'vue'; + import * as echarts from 'echarts'; + import { ElMessage } from 'element-plus'; + import { goalManagementApi } from '/@/api/goalManagement'; + import { toNamespacedPath } from 'path/posix'; + export default defineComponent({ + setup() { + const params = ref({ + level:'', + type:2, + year:'2022', + month:'', + realMonth:'' + }) + const list = ref([]) +//加载数据 + const emergencySuppliesCount = () => { + if(params.value.type==2){ + params.value.month='' + } + if(params.value.type==1){ + params.value.year=params.value.realMonth.split('-')[0] + params.value.month=params.value.realMonth.split('-')[1] + } + goalManagementApi() + .accidentReportCount(params.value) + .then((res) => { + if (res.data.code == 200) { + var newList = [] + for(var a = 0;a<res.data.data.length;a++){ + newList.push( + { + name:res.data.data[a].name+":"+res.data.data[a].num, + value:res.data.data[a].num, + deathNum: res.data.data[a].deathNum, + economicLoss: res.data.data[a].economicLoss, + minorInjuryNum: res.data.data[a].minorInjuryNum, + seriousInjuryNum: res.data.data[a].seriousInjuryNum + } + ) + } + list.value = newList; + initPies() + } else { + ElMessage.error(res.data.msg); + } + }); + }; + const echarts1 = ref() + const initPies = () => { + var myChart = echarts.init(echarts1.value); + myChart.clear() + var option = { + tooltip: { + trigger: 'item', + textStyle:{ + fontSize:18 + }, + formatter(params){ + for(var x in params){ + return params.data.name.split(':')[0] +":"+params.data.value+'<br />'+ + '死亡人数:'+params.data.deathNum+'<br />'+ + '轻伤人数:'+params.data.minorInjuryNum+'<br />'+ + '重伤人数:'+params.data.seriousInjuryNum+'<br />'+ + '经济损失:'+params.data.economicLoss+'<br />' + } + + } + }, + legend: { + top: '5%', + left: 'center', + icon: "circle", + formatter: function(param){ + param=param.split(":"); + return [param[0]+':'+param[1]].join(""); + }, + }, + series: [ + { + name: '事故等级分布', + type: 'pie', + radius: ['40%', '70%'], + avoidLabelOverlap: false, + itemStyle: { + borderRadius: 10, + borderColor: '#fff', + borderWidth: 2 + }, + label: { + show: false, + position: 'center' + }, + emphasis: { + label: { + show: false, + fontSize: '40', + fontWeight: 'bold' + } + }, + labelLine: { + show: false + }, + data: list.value + } + ] + }; + + myChart.setOption(option, true); + + }; + onMounted(() => { + emergencySuppliesCount() + }); + return { + params, + list, + emergencySuppliesCount, + initPies, + echarts1 + } + } + + }) +</script> +<style scoped> +.echarts{ + width: 500px; + height: 400px; +} +</style> \ No newline at end of file diff --git a/src/views/contingencyManagement/emergencyDrillStatistics/index.vue b/src/views/contingencyManagement/emergencyDrillStatistics/index.vue index d9134b7..fed25d7 100644 --- a/src/views/contingencyManagement/emergencyDrillStatistics/index.vue +++ b/src/views/contingencyManagement/emergencyDrillStatistics/index.vue @@ -4,11 +4,6 @@ <h2 class="title">距上次应急演练结束{{day}}天</h2> <el-form :model="form" label-width="20px"> <el-row> - <!-- <el-col :span="5" :offset="1"> - <el-form-item> - <el-date-picker v-model="form.date" format="YYYY-MM-DD" type="date" placeholder="应急演练时间" style="width: 100%" /> - </el-form-item> - </el-col> --> <el-col :span="4" :offset="15"> <el-form-item size="default"> <el-tree-select v-model="form.deptId" :data="data" @change="eaclick" placeholder="选择部门" :props="propse" style="width: 100%" /> -- Gitblit v1.9.2