From ec88d953dcf33ec0f3f5bf8facbb05878cea5acb Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期二, 06 五月 2025 21:33:51 +0800 Subject: [PATCH] 修改了代码 --- ruoyi-ui/src/views/meeting/statistics.vue | 205 +++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 174 insertions(+), 31 deletions(-) diff --git a/ruoyi-ui/src/views/meeting/statistics.vue b/ruoyi-ui/src/views/meeting/statistics.vue index 91492da..e619cdf 100644 --- a/ruoyi-ui/src/views/meeting/statistics.vue +++ b/ruoyi-ui/src/views/meeting/statistics.vue @@ -62,9 +62,9 @@ </el-table-column> <el-table-column label="鐘舵��" prop="status" sortable align="center"> - <template slot-scope="scope">{{ scope.row.status - ? scope.row.status : '鈥斺�斺�斺��' }}</template> + <template slot-scope="scope">{{scope.row.status===1? '缁撴': '鏈粨妗�'}}</template> </el-table-column> + <el-table-column label="鎿嶄綔" align="center" width="200" class-name="small-padding fixed-width"> <template slot-scope="scope" v-if="scope.row.roleId !== 1"> @@ -88,12 +88,22 @@ <!-- 鍥捐〃缁熻 --> <el-dialog :title="title2" :visible.sync="open2" width="1500px" @open="openGraph()" append-to-body> - <!-- class="p1" --> + <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> <div class="p1" id="main1"> - <!-- <h1 style="font-size:21px">姣忔湀浼氳娆℃暟缁熻</h1> --> </div> <div class="p1" id="main2"> - <!-- <h1 style="font-size:21px">浼氳瀹跺涵鍗犳瘮缁熻</h1> --> </div> </el-dialog> <!-- 鏂板鏁版嵁妗� --> @@ -167,6 +177,7 @@ //鍦╯ystem/note/index.js涓鍏ユ帴鍙e嚱鏁� --鎺ュソ浜� import {listMeeting3,listGraph} from "@/api/meeting/index"; + export default { created() { this.getList(); @@ -181,8 +192,12 @@ title: "", meetingList: [], dataList:[], + // 楗煎浘鏁版嵁 graphID: [], + // 鏌辩姸鍥炬暟鎹� graphDate: [], + years:undefined, + yearOptions:[], formDat:{ "title":undefined, "familyId":undefined, @@ -222,29 +237,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 +254,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 +422,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 +450,6 @@ fontSize:15 } }, - series: [{ name: '瀹跺涵鍙�', type: 'pie', -- Gitblit v1.9.1