From ce115e4c67e98c143159039494f14c7bcda59415 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期三, 13 三月 2024 13:11:45 +0800
Subject: [PATCH] Default Changelist

---
 src/views/specialWorkSystem/specialIndex/index.vue |   52 ++++++++++++++++++++++------------------------------
 1 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/src/views/specialWorkSystem/specialIndex/index.vue b/src/views/specialWorkSystem/specialIndex/index.vue
index 9e3b2f9..dd9a486 100644
--- a/src/views/specialWorkSystem/specialIndex/index.vue
+++ b/src/views/specialWorkSystem/specialIndex/index.vue
@@ -416,7 +416,7 @@
       },
       chartSearch2: {
         depId: 1,
-        startTime: '',
+        // startTime: '',
         type: null
       },
       chartSearch3: {
@@ -523,9 +523,6 @@
       getTypePie()
       getWorkDep()
       getDepMonth()
-      initZyfb()
-      initSlfx()
-      initZyqs()
     });
     const initTime =()=>{
       state.chartSearch1.startTime = getPeriod(30)
@@ -575,10 +572,12 @@
       }else{
         state.themeColor = '#333'
       }
-      initZyfb()
-      initSlfx()
-      initZyqs()
+      initTime()
       getMydepList()
+      getAllDepartment();
+      getTypePie()
+      getWorkDep()
+      getDepMonth()
     }
     const getTypePie = async ()=>{
       const data = {
@@ -590,7 +589,7 @@
       if (res.data.code === '200') {
         // console.log('饼图数据>>>', res.data.data)
         state.pieData = JSON.parse(JSON.stringify(res.data.data))
-        // initZyfb()
+        initZyfb()
       } else {
         ElMessage({
           type: 'warning',
@@ -600,16 +599,17 @@
     }
     const getWorkDep = async ()=>{
       const data = {
-        startTime: state.chartSearch2.startTime,
-        endTime: state.endTime,
+        // startTime: state.chartSearch2.startTime,
+        // endTime: state.endTime,
         depId:state.chartSearch2.depId,
         type: state.chartSearch2.type
       }
       let res = await specialIndexApi().analyseAllWork(data);
       if (res.data.code === '200') {
-        // console.log('条形图数据>>>', res.data.data)
         state.squareData = JSON.parse(JSON.stringify(res.data.data))
-        // initSlfx()
+        let names = state.squareData.map(i=>i.name)
+        let vals = state.squareData.map(i=>i.value)
+        initSlfx(names,vals)
       } else {
         ElMessage({
           type: 'warning',
@@ -620,9 +620,10 @@
     const getDepMonth = async ()=>{
       let res = await specialIndexApi().analyseDepMonth(state.chartSearch3.depId);
       if (res.data.code === '200') {
-        // console.log('折线图数据>>>', res.data.data)
         state.squareData = JSON.parse(JSON.stringify(res.data.data))
-        // initSlfx()
+        let names = state.squareData.map(i=>i.name)
+        let vals = state.squareData.map(i=>i.value)
+        initZyqs(names,vals)
       } else {
         ElMessage({
           type: 'warning',
@@ -706,16 +707,7 @@
                 shadowColor: 'rgba(0, 0, 0, 0.5)'
               },
             },
-            data: [
-              { value: 0, name: '动火作业' },
-              { value: 0, name: '受限空间作业' },
-              { value: 0, name: '吊装作业' },
-              { value: 0, name: '动土作业' },
-              { value: 0, name: '断路作业' },
-              { value: 0, name: '高处作业' },
-              { value: 0, name: '临时用电作业' },
-              { value: 0, name: '盲板抽堵作业' }
-            ]
+            data: state.pieData
           }
         ]
       }
@@ -725,7 +717,7 @@
         myChart.resize();
       });
     }
-    const initSlfx =()=>{
+    const initSlfx =(names:Array<string>,vals:Array<any>)=>{
       let dom = document.getElementById(slfx.value);
       let myChart = echarts.init(dom);
       let option: EChartsOption;
@@ -745,7 +737,7 @@
         xAxis: [
           {
             type: 'category',
-            data: ['部门一','部门二','部门三'],
+            data: names,
             axisTick: {
               alignWithLabel: true
             },
@@ -764,7 +756,7 @@
             name: 'Direct',
             type: 'bar',
             barWidth: '60%',
-            data: [0,0,0],
+            data: vals,
           }
         ]
       }
@@ -774,14 +766,14 @@
         myChart.resize();
       });
     }
-    const initZyqs =()=>{
+    const initZyqs =(names:Array<string>,vals:Array<any>)=>{
       let dom = document.getElementById(zyqs.value);
       let myChart = echarts.init(dom);
       let option: EChartsOption;
       option = {
         xAxis: {
           type: 'category',
-          data: ['四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月', '一月', '二月', '三月'],
+          data: names,
           axisLabel: {
             color: state.themeColor
           }
@@ -805,7 +797,7 @@
         },
         series: [
           {
-            data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+            data: vals,
             type: 'line',
             label:{
               show: true

--
Gitblit v1.9.2