From 20b0ce2db27b64a60de60aee05dedd448099e330 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期一, 08 七月 2024 10:12:16 +0800
Subject: [PATCH] xiugai

---
 src/views/riskWarningSys/warningBigScreen/components/accident.vue |   41 +++++++++++++++--------------------------
 1 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/src/views/riskWarningSys/warningBigScreen/components/accident.vue b/src/views/riskWarningSys/warningBigScreen/components/accident.vue
index 30f8621..ce83fb9 100644
--- a/src/views/riskWarningSys/warningBigScreen/components/accident.vue
+++ b/src/views/riskWarningSys/warningBigScreen/components/accident.vue
@@ -44,7 +44,7 @@
 			size: Number,
 			theme: Boolean
 		},
-		setup(props) {
+		setup(props,context) {
 			const userInfo = useUserInfo()
 			const { userInfos } = storeToRefs(userInfo);
 			const screenThemes = useScreenTheme()
@@ -139,27 +139,18 @@
         state.timeValue[1] = Number(temp[1])
       }
       const getDataByYearId = async () => {
-        getTime()
         const data = {
-          depId: screenTheme.value.depId || 1,
-          beginYear: state.timeValue[0],
-          beginMonth: state.timeValue[1],
-          endYear: state.timeValue[0],
-          endMonth: state.timeValue[1]
+          year: state.timeValue[0],
+          month: state.timeValue[1],
         }
         if(state.timeValue[1] == 0){
-          data.beginMonth = 1
-          data.endMonth = 12
+          data.month = ''
         }
         let res = await riskWarningApi().getRiskByTimeDep(data);
         if (res.data.code === '200') {
-          state.accData = res.data.data[0].detail
-          const oneList = res.data.data[0].detail[0].count
-          const twoList = res.data.data[0].detail[1].count
-          const threeList = res.data.data[0].detail[2].count
-          const fourList = res.data.data[0].detail[3].count
-          const fiveList = res.data.data[0].detail[4].count
-          initAccidentByMonth(oneList,twoList,threeList,fourList,fiveList)
+          state.accData = res.data.data
+          initAccidentByMonth(state.accData)
+          context.emit('getData',state.accData)
         } else {
           ElMessage({
             type: 'warning',
@@ -170,7 +161,7 @@
 
 			type EChartsOption = echarts.EChartsOption
 			// 隐患整改情况
-			const initAccidentByMonth =(one:number,two:number,three:number,four:number,five:number)=>{
+			const initAccidentByMonth =(data)=>{
 				let dom = document.getElementById(accidentMonth.value);
 				let myChart = echarts.init(dom);
 
@@ -219,13 +210,12 @@
 									fontWeight: 'bold'
 								}
 							},
-							data: [
-								{ value: one, name: '特别重大事故' },
-								{ value: two, name: '重大事故' },
-								{ value: three, name: '较大事故' },
-								{ value: four, name: '一般事故' },
-								{ value: five, name: '未遂事故' }
-							],
+							data: data.map(i=>{
+                return {
+                  name: i.accidentGrade,
+                  value: i.count
+                }
+              }),
 							center: ['50%','60%']
 						}
 					]
@@ -257,7 +247,7 @@
 				}else{
 					state.selector =  'select-light'
 				}
-        getDataByYearId()
+        // getDataByYearId()
 			})
 
       const changeTime = (value)=>{
@@ -272,7 +262,6 @@
         getTime();
         makeList();
         getDataByYearId();
-				// initAccidentByYear();
 			});
 
 			onUnmounted(() =>{

--
Gitblit v1.9.2