From 6a33216302b27ecd657e8e53b12286518a56d1a8 Mon Sep 17 00:00:00 2001
From: yz3456 <2753272399@qq.com>
Date: 星期一, 13 五月 2024 17:28:51 +0800
Subject: [PATCH] 会议统计图形统计

---
 ruoyi-ui/src/views/meeting/statistics.vue |  199 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 173 insertions(+), 26 deletions(-)

diff --git a/ruoyi-ui/src/views/meeting/statistics.vue b/ruoyi-ui/src/views/meeting/statistics.vue
index 91492da..62f6959 100644
--- a/ruoyi-ui/src/views/meeting/statistics.vue
+++ b/ruoyi-ui/src/views/meeting/statistics.vue
@@ -88,6 +88,20 @@
 
       <!-- 鍥捐〃缁熻 -->
       <el-dialog :title="title2" :visible.sync="open2" width="1500px" @open="openGraph()" append-to-body>
+            <div>
+                骞翠唤
+        <el-select v-model="years" id="yearSelect"
+                  placeholder="璇烽�夋嫨骞翠唤" clearable
+                   style="width: 240px;
+                   height: 35px;
+                   border-radius: 16px 16px 16px 16px;
+                   opacity: 0.5;" filterable allow-create
+                   @change="selectValue">
+          <el-option v-for="item in yearOptions"
+            :key="item.value" :label="item.label" :value="item.value"/>
+        </el-select>
+
+              </div>
         <!-- class="p1" -->
         <div class="p1" id="main1">
           <!-- <h1 style="font-size:21px">姣忔湀浼氳娆℃暟缁熻</h1> -->
@@ -167,6 +181,7 @@
 
   //鍦╯ystem/note/index.js涓鍏ユ帴鍙e嚱鏁�  --鎺ュソ浜�
   import {listMeeting3,listGraph} from "@/api/meeting/index";
+
  export default {
   created() {
     this.getList();
@@ -181,8 +196,12 @@
        title: "",
        meetingList: [],
        dataList:[],
+       // 楗煎浘鏁版嵁
        graphID: [],
+       // 鏌辩姸鍥炬暟鎹�
        graphDate: [],
+       years:undefined,
+       yearOptions:[],
        formDat:{
            "title":undefined,
            "familyId":undefined,
@@ -222,29 +241,6 @@
      }
    },
    methods: {
-     graphData(){
-       this.loading = true;
-       listGraph().then(response => {
-           this.dataList = response.data
-           // console.log(this.graphList,'11111111111')
-           let a = {}
-           this.dataList.forEach(element=>{
-             if(a[element['familyId']]){
-               a[element['familyId']] += 1
-             }else{
-               a[element['familyId']] = 1
-             }
-           })
-           for(let i in a){
-             this.graphID.push({'name': i , 'value': a[i]})
-           }
-           // console.log(this.graphID,'graphIDgraphIDgraphID')
-
-
-           this.loading = false;
-         }
-         );
-     },
      getList() {
        this.loading = true;
        // console.log(this.queryParams)
@@ -262,6 +258,158 @@
 
        );
      },
+     getTypeOptions(list){
+       let years = ['鍏ㄩ儴']
+        let a = {}
+       list.forEach(element=>{
+         let year = element.createTime.split("-")[0]
+         if(a[year]){
+         }else{
+           a[year] = 1
+           years.push(year)
+         }
+       })
+      let yearOptions = []
+      for(let i=0;i<years.length;i++){
+        yearOptions.push({label: years[i],value: i})
+      }
+      return yearOptions;
+     },
+     graphData(){
+       this.loading = true;
+       listGraph().then(response => {
+           this.dataList = response.data
+           console.log(this.dataList,'11111111111')
+           this.yearOptions = this.getTypeOptions(this.dataList)
+           console.log(this.yearOptions,'yearsyearsyearsyears')
+
+           // 瀹跺涵鍙�
+           let a = {}
+           this.dataList.forEach(element=>{
+             if(a[element['familyId']]){
+               a[element['familyId']] += 1
+             }else{
+               a[element['familyId']] = 1
+             }
+           })
+           for(let i in a){
+            this.graphID.push({'name': i , 'value': a[i]})
+           }
+           // 姣忔湀娆℃暟
+           let b = {'01': 0,'02': 0,'03': 0,'04': 0,'05': 0,'06': 0,'07': 0,'08': 0,'09': 0,'10': 0,'11': 0,'12': 0}
+           this.dataList.forEach(element=>{
+             let month = element.createTime.split("-")[1]
+             if(b[month]){
+               b[month] += 1
+             }else{
+               b[month] = 1
+             }
+           })
+
+           let kon =[]
+           for(let i in b){
+             kon.push({'name': Number(i) , 'value': b[i]})
+           }
+           this.graphDate = kon.sort((a,b) => a.name - b.name)
+
+           this.loading = false;
+         }
+         );
+     },
+
+    b(list,selectedValue){
+      let list2 = []
+      let newGraphID = []
+      let newGraphDate = []
+      list.forEach(element=>{
+        let year = element.createTime.split("-")[0]
+        if(selectedValue == year){
+          list2.push(element)
+        }
+      })
+
+      if(list2.length !=  0){
+        // 瀹跺涵鍙�
+        let a = {}
+        list2.forEach(element=>{
+          if(a[element['familyId']]){
+            a[element['familyId']] += 1
+          }else{
+            a[element['familyId']] = 1
+          }
+        })
+        for(let i in a){
+          newGraphID.push({'name': i , 'value': a[i]})
+        }
+        // 姣忔湀娆℃暟
+        let b = {'01': 0,'02': 0,'03': 0,'04': 0,'05': 0,'06': 0,'07': 0,'08': 0,'09': 0,'10': 0,'11': 0,'12': 0}
+        list2.forEach(element=>{
+          let month = element.createTime.split("-")[1]
+          if(b[month]){
+            b[month] += 1
+          }else{
+            b[month] = 1
+          }
+        })
+
+        let kon =[]
+        for(let i in b){
+          kon.push({'name': Number(i) , 'value': b[i]})
+        }
+        newGraphDate = kon.sort((a,b) => a.name - b.name)
+      }else{
+        list2 = list
+        // 瀹跺涵鍙�
+        let a = {}
+        list2.forEach(element=>{
+          if(a[element['familyId']]){
+            a[element['familyId']] += 1
+          }else{
+            a[element['familyId']] = 1
+          }
+        })
+        for(let i in a){
+          newGraphID.push({'name': i , 'value': a[i]})
+        }
+        // 姣忔湀娆℃暟
+        let b = {'01': 0,'02': 0,'03': 0,'04': 0,'05': 0,'06': 0,'07': 0,'08': 0,'09': 0,'10': 0,'11': 0,'12': 0}
+        list2.forEach(element=>{
+          let month = element.createTime.split("-")[1]
+          if(b[month]){
+            b[month] += 1
+          }else{
+            b[month] = 1
+          }
+        })
+
+        let kon =[]
+        for(let i in b){
+          kon.push({'name': Number(i) , 'value': b[i]})
+        }
+        newGraphDate = kon.sort((a,b) => a.name - b.name)
+      }
+
+      return [newGraphID,newGraphDate];
+    },
+
+    selectValue(value){
+      let obj = {}
+      let year = undefined
+      obj= this.yearOptions.find(function(i){
+              return i.value ===value
+        });
+      year = obj.label
+
+      let result = undefined
+      result = this.b(this.dataList,year)
+      this.graphID = result[0]
+      this.graphDate = result[1]
+      // console.log(this.graphID)
+      // console.log(this.graphDate)
+      echarts.dispose(document.getElementById('main1'))
+      echarts.dispose(document.getElementById('main2'))
+      this.initEcharts()
+    },
 
      openGraph(){
        this.$nextTick(() => {
@@ -278,13 +426,13 @@
                 },
                 tooltip: {},
                 xAxis: {
-                    data: ['琛~', '缇婃瘺琛�', '闆汉琛�', '瑁ゅ瓙', '楂樿窡闉�', '琚滃瓙']
+                    data: ['1鏈�','2鏈�','3鏈�','4鏈�','5鏈�','6鏈�','7鏈�','8鏈�','9鏈�','10鏈�','11鏈�','12鏈�']
                 },
                 yAxis: {},
                 legend:{},
                 series: [{
                     type: 'bar',
-                    data: [5, 20, 36, 10, 10, 20]
+                    data: this.graphDate.map(x => x.value)
                 }]
             };
             myChart1.setOption(option1)
@@ -306,7 +454,6 @@
                     fontSize:15
                   }
                 },
-
                 series: [{
                     name: '瀹跺涵鍙�',
                     type: 'pie',

--
Gitblit v1.9.1