Explorar el Código

Merge branch 'message' of licailing/wenlvju into master

licailing hace 4 años
padre
commit
d450d8eace

+ 2 - 0
src/main/java/com/izouma/wenlvju/domain/ArtType.java

@@ -32,6 +32,8 @@ public class ArtType extends BaseEntity {
 
     private Long parent1;
 
+    private boolean extra;
+
     @Transient
     private List<ArtType> children = new ArrayList<>();
 }

+ 4 - 0
src/main/java/com/izouma/wenlvju/repo/ArtTypeRepo.java

@@ -15,8 +15,12 @@ public interface ArtTypeRepo extends JpaRepository<ArtType, Long>, JpaSpecificat
     @Transactional
     void softDelete(Long id);
 
+    List<ArtType> findAllByExtraFalse();
+
     List<ArtType> findAllByParentIsNull();
 
+    List<ArtType> findAllByParentIsNullAndExtraFalse();
+
     List<ArtType> findAllByParentIn(Iterable<Long> parent);
 
     ArtType findByCode(String code);

+ 2 - 0
src/main/java/com/izouma/wenlvju/repo/RateRepo.java

@@ -33,6 +33,8 @@ public interface RateRepo extends JpaRepository<Rate, Long>, JpaSpecificationExe
 
     List<Rate> findAllByStatusAndYearOrderByScoreDesc(RateStatus status, String year);
 
+    List<Rate> findAllByYear(String year);
+
     Long countAllByYearAndRejectedAtIsNull(String year);
 
 }

+ 8 - 5
src/main/java/com/izouma/wenlvju/service/regulation/ReportService.java

@@ -64,7 +64,6 @@ public class ReportService {
     private RecordSpecialtyRepo     recordSpecialtyRepo;
     private StorageService          storageService;
     private ReportStatisticRepo     reportStatisticRepo;
-    private RateRepo                rateRepo;
     private PerformanceRepo         performanceRepo;
     private ProgrammeRepo           programmeRepo;
     private ParticipantRepo         participantRepo;
@@ -919,9 +918,6 @@ public class ReportService {
         return url;
     }
 
-    public void rate(int year) {
-        rateRepo.countAllByYearAndRejectedAtIsNull(String.valueOf(year));
-    }
 
     /*
     展演
@@ -934,7 +930,7 @@ public class ReportService {
         Map<Long, Long> participantMap = participantRepo.findAll()
                 .stream()
                 .collect(Collectors.groupingBy(Participant::getProgrammeId, Collectors.counting()));
-        Map<Long, String> artMap = artTypeRepo.findAllByParentIsNull()
+        Map<Long, String> artMap = artTypeRepo.findAllByParentIsNullAndExtraFalse()
                 .stream()
                 .collect(Collectors.toMap(ArtType::getId, ArtType::getName));
 
@@ -948,13 +944,20 @@ public class ReportService {
             List<Programme> programmeList = programmeMap.get(performance.getId());
             Map<Long, List<Programme>> specialty = programmeList.stream()
                     .collect(Collectors.groupingBy(Programme::getParentSpecialtyId));
+            Set<Long> artSet = new HashSet<>(artMap.keySet());
             specialty.forEach((key, value) -> {
+                artSet.remove(key);
                 String name = artMap.get(key);
                 programmeNum.add(new NumOfReport(name, value.size()));
                 long sum = value.stream()
                         .mapToLong(programme -> ObjectUtil.isNull(participantMap.get(programme.getId())) ? 0L : participantMap.get(programme.getId()))
                         .sum();
                 participantNum.add(new NumOfReport(name, (int) sum));
+
+            });
+            artSet.forEach(artId -> {
+                programmeNum.add(new NumOfReport(artMap.get(artId), 0));
+                participantNum.add(new NumOfReport(artMap.get(artId), 0));
             });
             performanceStatistic.setParticipantNum(participantNum);
             performanceStatistic.setProgrammeNum(programmeNum);

+ 10 - 0
src/main/java/com/izouma/wenlvju/web/ArtTypeController.java

@@ -46,6 +46,11 @@ public class ArtTypeController extends BaseController {
         return artTypeService.getTree(artTypeRepo.findAll());
     }
 
+    @PostMapping("/allNotExtra")
+    public List<ArtType> allNotExtra() {
+        return artTypeService.getTree(artTypeRepo.findAllByExtraFalse());
+    }
+
     @GetMapping("/get/{id}")
     public ArtType get(@PathVariable Long id) {
         return artTypeRepo.findById(id).orElseThrow(new BusinessException("无记录"));
@@ -68,5 +73,10 @@ public class ArtTypeController extends BaseController {
     public List<ArtType> parent() {
         return artTypeRepo.findAllByParentIsNull();
     }
+
+    @PostMapping("/parentNotExtra")
+    public List<ArtType> parentNotExtra() {
+        return artTypeRepo.findAllByParentIsNullAndExtraFalse();
+    }
 }
 

+ 31 - 0
src/main/java/com/izouma/wenlvju/web/regulation/ReportController.java

@@ -1,6 +1,11 @@
 package com.izouma.wenlvju.web.regulation;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.izouma.wenlvju.domain.Rate;
 import com.izouma.wenlvju.dto.PerformanceStatistic;
+import com.izouma.wenlvju.enums.OrganizationGrade;
+import com.izouma.wenlvju.enums.RateStatus;
+import com.izouma.wenlvju.repo.RateRepo;
 import com.izouma.wenlvju.web.BaseController;
 import com.izouma.wenlvju.domain.regulation.Report;
 import com.izouma.wenlvju.service.regulation.ReportService;
@@ -19,7 +24,10 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/report")
@@ -27,6 +35,7 @@ import java.util.List;
 public class ReportController extends BaseController {
     private ReportService reportService;
     private ReportRepo    reportRepo;
+    private RateRepo      rateRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -88,5 +97,27 @@ public class ReportController extends BaseController {
     public List<PerformanceStatistic> performanceStatistics() {
         return reportService.performanceStatistics();
     }
+
+    @PostMapping("/attendRate")
+    public long attendRate(@RequestParam String year) {
+        return rateRepo.countAllByYearAndRejectedAtIsNull(year);
+    }
+
+    @PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/rateResult")
+    public Map<String, Long> rateResult(@RequestParam String year) {
+        List<Rate> rates = rateRepo.findAllByYear(year);
+        Map<OrganizationGrade, Long> gradeMap = rates.stream()
+                .filter(rate -> ObjectUtil.isNotNull(rate.getGrade()))
+                .collect(Collectors.groupingBy(Rate::getGrade, Collectors.counting()));
+
+        long count = rates.stream()
+                .filter(rate -> ObjectUtil.isNull(rate.getGrade()) && !rate.isRejected()).count();
+
+        Map<String, Long> map = new HashMap<>();
+        gradeMap.forEach((key, value) -> map.put(key.name(),value));
+        map.put("CANCEL",count);
+        return map;
+    }
 }
 

+ 67 - 0
src/main/vue/src/components/select/SpecialtyCascader.vue

@@ -0,0 +1,67 @@
+<template>
+    <el-cascader
+        :props="props"
+        filterable
+        v-model="chooseValue"
+        @change="changeSelect"
+        ref="cascader"
+        placeholder="请选择专业"
+        :options="options"
+    ></el-cascader>
+</template>
+
+<script>
+import delChild from '@/mixins/delChild';
+export default {
+    mixins: [delChild],
+    props: {
+        code: {
+            type: String,
+            default: '01'
+        }
+        // value: {
+        //     type: [Number, String],
+        //     default: ''
+        // }
+    },
+    data() {
+        return {
+            options: [],
+            props: {
+                value: 'id',
+                label: 'name',
+                children: 'children',
+                multiple: false,
+                emitPath: false,
+                checkStrictly: true,
+                expandTrigger: 'hover'
+            },
+            chooseValue: [],
+            emiting: false
+        };
+    },
+    mounted() {
+        this.$nextTick(() => {
+            this.getList();
+        });
+    },
+    methods: {
+        getList() {
+            this.$http
+                .post('/artType/allNotExtra')
+                .then(res => {
+                    this.options = this.delChild(res);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        },
+        changeSelect(val) {
+            this.$emit('input', val);
+        }
+    }
+};
+</script>
+
+<style lang="less" scoped></style>

+ 10 - 10
src/main/vue/src/router.js

@@ -881,7 +881,7 @@ const router = new Router({
             meta: {
                 title: '登录'
             }
-        },
+        }
         /**初审 */
         // {
         //     path: '/programmeGOList',
@@ -892,15 +892,15 @@ const router = new Router({
         //     }
         // },
         /**节目评审 */
-        {
-            path: '/programmeScoreList',
-            name: 'ProgrammeScoreList',
-            component: () =>
-                import(/* webpackChunkName: "programmeScoreList" */ '@/views/performance/ProgrammeScoreList.vue'),
-            meta: {
-                title: '节目评审'
-            }
-        }
+        // {
+        //     path: '/programmeScoreList',
+        //     name: 'ProgrammeScoreList',
+        //     component: () =>
+        //         import(/* webpackChunkName: "programmeScoreList" */ '@/views/performance/ProgrammeScoreList.vue'),
+        //     meta: {
+        //         title: '节目评审'
+        //     }
+        // }
     ]
 });
 router.beforeEach((to, from, next) => {

+ 1 - 1
src/main/vue/src/views/Admin.vue

@@ -104,7 +104,7 @@ import { mapState } from 'vuex';
 export default {
     name: 'admin',
     created() {
-        console.log(this.paths);
+        // console.log(this.paths);
         this.getMenus();
         let fn = () => {
             this.isFullscreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;

+ 1 - 1
src/main/vue/src/views/AwardList.vue

@@ -25,7 +25,7 @@
         >
             <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
             <!-- <el-table-column prop="id" label="ID" width="100"> </el-table-column> -->
-            <el-table-column prop="performance" label="活动名称"></el-table-column>
+            <el-table-column prop="performance" label="活动名称" min-width="160"></el-table-column>
             <el-table-column prop="name" label="奖项名称"> </el-table-column>
             <el-table-column prop="description" label="奖项描述"> </el-table-column>
             <el-table-column prop="level" label="级别" :formatter="levelFormatter"> </el-table-column>

+ 1 - 1
src/main/vue/src/views/performance/ProgrammeEdit.vue

@@ -447,7 +447,7 @@ export default {
                 this.$message.error(e.error);
             });
         this.$http
-            .post('/artType/allList')
+            .post('/artType/allNotExtra')
             .then(res => {
                 this.artTypes = this.delChild(res);
             })

+ 4 - 79
src/main/vue/src/views/performance/ProgrammeList.vue

@@ -280,40 +280,6 @@
             <el-table-column label="操作" align="left" fixed="right" min-width="260">
                 <template slot-scope="{ row, $index }">
                     <el-button @click="showRow(row)" size="mini" plain>查看</el-button>
-                    <!-- <el-button
-                        type="warning"
-                        @click="playImg(row)"
-                        v-if="
-                            row.specialty == '中国画' ||
-                                row.specialty == '美术' ||
-                                row.specialty == '西画' ||
-                                row.specialty == '书法' ||
-                                row.specialty == '漫画' ||
-                                row.specialty == '手工技艺' ||
-                                row.specialty == '摄影' ||
-                                row.specialty == '篆刻' ||
-                                row.specialty == '人物' ||
-                                row.specialty == '山水' ||
-                                row.specialty == '花鸟' ||
-                                row.specialty == '素描' ||
-                                row.specialty == '速写' ||
-                                row.specialty == '水粉画' ||
-                                row.specialty == '水彩画' ||
-                                row.specialty == '油画' ||
-                                row.specialty == '软笔书法' ||
-                                row.specialty == '硬笔书法' ||
-                                row.specialty == '剪纸' ||
-                                row.specialty == '泥塑' ||
-                                row.specialty == '年画' ||
-                                row.specialty == '皮影制作' ||
-                                row.specialty == '陶艺' ||
-                                row.specialty == '染织' ||
-                                row.specialty == '版画'
-                        "
-                        size="mini"
-                        plain
-                        >浏览图片</el-button
-                    > -->
                     <el-button type="warning" @click="playVideo(row, $index)" size="mini" plain>查看作品</el-button>
                     <el-button
                         @click="audit(row, 'AUDIT_FAILED')"
@@ -422,7 +388,6 @@
 </template>
 <script>
 import delChild from '@/mixins/delChild';
-import { mapState } from 'vuex';
 import pageableTable from '@/mixins/pageableTable';
 import QrcodeVue from 'qrcode.vue';
 import ProgrammeLog from '@/components/ProgrammeLog.vue';
@@ -689,6 +654,9 @@ export default {
             if (this.form.name) {
                 data.query.name = this.form.name;
             }
+            if (this.form.id) {
+                data.query.id = this.form.id;
+            }
             if (this.form.programmeStatus) {
                 data.query.programmeStatus = this.form.programmeStatus;
             }
@@ -696,39 +664,7 @@ export default {
         },
         download() {
             this.downloading = true;
-
-            let data = {
-                sort: 'programmeStatus,desc',
-                size: 10000,
-                query: {}
-            };
-            if (this.form.competitionGroup) {
-                data.query.competitionGroup = this.form.competitionGroup;
-            }
-            if (this.form.levelSettingId) {
-                data.query.levelSettingId = this.form.levelSettingId;
-            }
-            if (this.form.gradingOrganizationId) {
-                data.query.gradingOrganizationId = this.form.gradingOrganizationId;
-            }
-            if (this.organizationId) {
-                data.query.form.organizationId = this.form.organizationId;
-            }
-            if (this.form.specialtyId) {
-                data.query.code = this.getCode(this.form.specialtyId);
-            }
-            if (this.performanceId) {
-                data.query.performanceId = this.performanceId;
-            }
-            if (this.form.name) {
-                data.query.name = this.form.name;
-            }
-            if (this.form.id) {
-                data.query.id = this.form.id;
-            }
-            if (this.form.programmeStatus) {
-                data.query.programmeStatus = this.form.programmeStatus;
-            }
+            let data = this.getParmers();
 
             this.$axios
                 .get('/programme/excel', {
@@ -832,17 +768,6 @@ export default {
             }
             return result;
         },
-        // closeEvent() {
-        //     document.exitPictureInPicture();
-        // },
-        // playVideo(row) {
-        //     if (row.video) {
-        //         this.showViedo = true;
-        //         this.videoUrl = row.video;
-        //     } else {
-        //         this.$message.success('暂无视频');
-        //     }
-        // },
         playImg(row) {
             if (row.annex) {
                 this.showImg = true;

+ 1 - 1
src/main/vue/src/views/performance/ProgrammeOrgList.vue

@@ -491,7 +491,7 @@ export default {
                 this.$message.error(e.error);
             });
         this.$http
-            .post('/artType/allList')
+            .post('/artType/allNotExtra')
             .then(res => {
                 this.artTypes = this.delChild(res);
             })

+ 8 - 8
src/main/vue/src/views/performance/ProgrammeScoreList.vue

@@ -106,8 +106,8 @@
             <el-table-column prop="myScore" label="评分" align="center" min-width="80">
                 <template slot-scope="{ row }">
                     <span v-if="row.myScore">{{ row.myScore }}</span>
-                    <!-- <span v-else>{{ row.myScore }}</span> -->
-                    <el-input-number
+                    <span v-else>暂无</span>
+                    <!-- <el-input-number
                         v-else
                         v-model="row.myScore"
                         size="mini"
@@ -119,28 +119,28 @@
                         controls-position="both"
                         @change="saveScore(row)"
                     >
-                    </el-input-number>
+                    </el-input-number> -->
                 </template>
             </el-table-column>
             <el-table-column prop="remark" label="备注" align="center" min-width="80">
                 <template slot-scope="{ row }">
                     <span v-if="row.remark">{{ row.remark }}</span>
-                    <!-- <span v-else>{{ row.remark }}</span> -->
-                    <el-input
+                    <span v-else>暂无</span>
+                    <!-- <el-input
                         v-else
                         size="mini"
                         @change="saveScore(row)"
                         v-model="row.remark"
                         placeholder="请输入备注"
                         clearable
-                    ></el-input>
+                    ></el-input> -->
                 </template>
             </el-table-column>
-            <!-- <el-table-column label="操作" align="left" fixed="right" min-width="100">
+            <el-table-column label="操作" align="left" fixed="right" min-width="100">
                 <template slot-scope="{ row, $index }">
                     <el-button @click="playVideo(row, $index)" size="mini" plain type="primary">查看作品</el-button>
                 </template>
-            </el-table-column> -->
+            </el-table-column>
         </el-table>
         <div class="pagination-wrapper">
             <!-- <div class="multiple-mode-wrapper">

+ 16 - 23
src/main/vue/src/views/showStatistic/RatePieWidget.vue → src/main/vue/src/views/showStatistic/AttendRateWidget.vue

@@ -2,7 +2,7 @@
     <widget-card :bodyStyle="bodyStyle" ref="container">
         <template #header>
             <span>等级评定</span>
-            <el-select @change="setChart" style="float:right" v-model="chooseYear" size="mini" placeholder="请选择">
+            <el-select @change="getData" style="float:right" v-model="chooseYear" size="mini" placeholder="请选择">
                 <el-option v-for="item in years" :key="item" :label="item" :value="item"> </el-option>
             </el-select>
         </template>
@@ -12,7 +12,6 @@
 <script>
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
-import widget from '@/mixins/widget';
 
 export default {
     data() {
@@ -21,21 +20,23 @@ export default {
             bodyStyle: {
                 display: 'flex'
             },
-            chooseYear: '2021'
+            chooseYear: '2021',
+            years: ['2021', '2022', '2023', '2024'],
+            attend: 0
         };
     },
-    computed: {
-        years() {
-            return Object.keys({ ...this.allData });
-        }
-    },
+    computed: {},
     mounted() {
-        setTimeout(() => {
-            this.myChart = echarts.init(this.$refs.chart);
-            this.setChart();
-        });
+        this.getData();
     },
     methods: {
+        getData() {
+            this.$http.post('/report/attendRate', { year: this.chooseYear }).then(res => {
+                this.attend = res;
+                this.myChart = echarts.init(this.$refs.chart);
+                this.setChart();
+            });
+        },
         setChart() {
             let option = {
                 tooltip: {
@@ -55,13 +56,6 @@ export default {
                             show: false,
                             position: 'center'
                         },
-                        // emphasis: {
-                        //     label: {
-                        //         show: true,
-                        //         fontSize: '40',
-                        //         fontWeight: 'bold'
-                        //     }
-                        // },
                         labelLine: {
                             length: 10
                         },
@@ -98,8 +92,8 @@ export default {
                             }
                         },
                         data: [
-                            { value: 89, name: '参加' },
-                            { value: 112, name: '未参加' }
+                            { value: this.attend, name: '参加' },
+                            { value: 201 - this.attend, name: '未参加' }
                         ],
                         center: ['50%', '50%']
                     }
@@ -111,8 +105,7 @@ export default {
     },
     components: {
         WidgetCard
-    },
-    mixins: [widget]
+    }
 };
 </script>
 <style lang="less" scoped></style>

+ 3 - 3
src/main/vue/src/views/showStatistic/Dashboard.vue

@@ -38,7 +38,7 @@ import ExamWidegt from './ExamWidegt';
 import PassWidget from './PassWidget';
 import RateWidget from './RateWidget';
 import RateYearWidget from './RateYearWidget';
-import RatePieWidget from './RatePieWidget';
+import AttendRateWidget from './AttendRateWidget';
 import PerformanceWidget from './PerformanceWidget';
 
 export default {
@@ -49,7 +49,7 @@ export default {
                 { x: 0, y: 0, w: 12, h: 5, i: '0', name: 'DatasWidget' },
                 { x: 0, y: 6, w: 6, h: 12, i: '2', name: 'PassWidget' },
                 { x: 6, y: 6, w: 6, h: 12, i: '3', name: 'ExamWidegt' },
-                { x: 0, y: 12, w: 6, h: 12, i: '5', name: 'RatePieWidget' },
+                { x: 0, y: 12, w: 6, h: 12, i: '5', name: 'AttendRateWidget' },
                 { x: 6, y: 12, w: 6, h: 12, i: '6', name: 'RateYearWidget' },
                 { x: 0, y: 18, w: 12, h: 12, i: '7', name: 'PerformanceWidget' }
             ],
@@ -70,7 +70,7 @@ export default {
         ExamWidegt,
         PassWidget,
         RateYearWidget,
-        RatePieWidget,
+        AttendRateWidget,
         RateWidget,
         PerformanceWidget
     }

+ 3 - 1
src/main/vue/src/views/showStatistic/PassWidget.vue

@@ -22,13 +22,15 @@ export default {
     mounted() {
         setTimeout(() => {
             this.$nextTick(() => {
-                let info = { ...this.allData };
+                // let info = { ...this.allData };
+                // console.log(info);
                 // let data = Object.keys(info).map(item => {
                 //     return {
                 //         year: item,
                 //         ...info[item]
                 //     };
                 // });
+                // console.log(data);
                 let data = [
                     { year: 2019, baokao: 20.8 },
                     { year: 2020, baokao: 18.5 },

+ 144 - 180
src/main/vue/src/views/showStatistic/PerformanceWidget.vue

@@ -1,14 +1,12 @@
 <template>
     <widget-card :bodyStyle="bodyStyle" ref="container">
-        <template #header>年度报考考级人数</template>
+        <template #header>年度展演报名数</template>
         <div ref="chart" class="chart" style="flex-grow:1"></div>
     </widget-card>
 </template>
 <script>
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
-import widget from '@/mixins/widget';
-import { th } from 'date-fns/locale';
 
 export default {
     data() {
@@ -18,213 +16,179 @@ export default {
                 display: 'flex'
             },
             list: [],
-            seriesPar: [],
             last2020: {
                 year: 2020,
                 programmeNum: [
-                    { name: '戏曲戏剧', num: 100 },
                     { name: '音乐', num: 967 },
+                    { name: '舞蹈', num: 124 },
                     { name: '美术', num: 875 },
-                    { name: '舞蹈', num: 124 }
+                    { name: '戏曲戏剧', num: 100 },
+                    { name: '曲艺', num: 0 }
                 ],
                 participantNum: [
-                    { name: '戏曲戏剧', num: 435 },
                     { name: '音乐', num: 1198 },
+                    { name: '舞蹈', num: 345 },
                     { name: '美术', num: 875 },
-                    { name: '舞蹈', num: 345 }
+                    { name: '戏曲戏剧', num: 435 },
+                    { name: '曲艺', num: 0 }
                 ]
-            }
+            },
+            values: []
         };
     },
     mounted() {
-        let names = [];
-        let xAxisData = [];
-        let music = [];
-        let dance = [];
-        let art = [];
-        let operaDrama = [];
-        let folkArt = [];
-        let music1 = [];
-        let dance1 = [];
-        let art1 = [];
-        let operaDrama1 = [];
-        let folkArt1 = [];
-        var emphasisStyle = {
-            itemStyle: {
-                shadowBlur: 10,
-                shadowColor: 'rgba(0,0,0,0.3)'
-            }
-        };
-
-        this.$http.get('/report/performanceStatistics').then(res => {
-            // this.list = res;
-            this.list.push(this.last2020);
-            res.forEach(item => {
-                this.list.push(item);
-            });
+        setTimeout(() => {
+            this.$http
+                .get('/report/performanceStatistics')
+                .then(res => {
+                    this.list.push(this.last2020);
+                    res.forEach(item => {
+                        this.list.push(item);
+                    });
+                })
+                .then(() => {
+                    this.$nextTick(() => {
+                        this.setChart();
+                    });
+                });
+        }, 500);
+    },
+    methods: {
+        setChart() {
+            let seriesMap = new Map();
+            let names = [];
+            let xAxisData = [];
+            var emphasisStyle = {
+                itemStyle: {
+                    shadowBlur: 10,
+                    shadowColor: 'rgba(0,0,0,0.3)'
+                }
+            };
 
             for (let i = 0; i < this.list.length; i++) {
                 xAxisData.push(this.list[i].year);
                 let programmeNum = this.list[i].programmeNum;
-                for (let j = 0; j < programmeNum.length; j++) {
-                    names.push(programmeNum[j].name);
-                    if (programmeNum[j].name == '音乐') {
-                        music.push(programmeNum[j].num);
-                    } else if (programmeNum[j].name == '舞蹈') {
-                        dance.push(programmeNum[j].num);
-                    } else if (programmeNum[j].name == '美术') {
-                        art.push(programmeNum[j].num);
-                    } else if (programmeNum[j].name == '戏曲戏剧') {
-                        operaDrama.push(programmeNum[j].num);
-                    } else {
-                        folkArt.push(programmeNum[j].num);
-                    }
-                }
-                let participantNum = this.list[i].participantNum;
-                for (let j = 0; j < participantNum.length; j++) {
-                    names.push(participantNum[j].name);
-                    if (participantNum[j].name == '音乐') {
-                        music1.push(participantNum[j].num);
-                    } else if (participantNum[j].name == '舞蹈') {
-                        dance1.push(participantNum[j].num);
-                    } else if (participantNum[j].name == '美术') {
-                        art1.push(participantNum[j].num);
-                    } else if (participantNum[j].name == '戏曲戏剧') {
-                        operaDrama1.push(participantNum[j].num);
+                programmeNum.forEach(item => {
+                    let key = 'pro' + item.name;
+                    if (seriesMap.has(key)) {
+                        seriesMap.get(key).data.push(item.num);
                     } else {
-                        folkArt1.push(participantNum[j].num);
-                    }
-                }
-                // participantNum.forEach(item => {
-                //     this.seriesPar.push({
-                //         name: item.name,
-                //         type: 'bar',
-                //         stack: 'two',
-                //         emphasis: emphasisStyle,
-                //         data: [item.num]
-                //     });
-                // });
-            }
-        });
-
-        setTimeout(() => {
-            this.$nextTick(() => {
-                var chartDom = this.$refs.chart;
-                var myChart = echarts.init(chartDom);
-                var option;
-                console.log(this.seriesPar);
-                var option;
-                option = {
-                    legend: {
-                        data: names,
-                        left: '10%'
-                    },
-                    brush: {
-                        // toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
-                        // xAxisIndex: 0
-                    },
-                    toolbox: {
-                        feature: {
-                            magicType: {
-                                type: ['stack']
-                            },
-                            dataView: {}
-                        }
-                    },
-                    tooltip: {},
-                    xAxis: {
-                        data: xAxisData,
-                        name: '年份',
-                        axisLine: { onZero: true },
-                        splitLine: { show: false },
-                        splitArea: { show: false }
-                    },
-                    yAxis: {},
-                    grid: {
-                        bottom: 20
-                    },
-                    series: [
-                        {
-                            name: '音乐',
+                        seriesMap.set(key, {
+                            name: item.name,
                             type: 'bar',
                             stack: 'one',
                             emphasis: emphasisStyle,
-                            data: music
-                        },
-                        {
-                            name: '舞蹈',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: dance
-                        },
-                        {
-                            name: '美术',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: art
-                        },
-                        {
-                            name: '戏曲戏剧',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: operaDrama
-                        },
-                        {
-                            name: '曲艺',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: folkArt
-                        },
-                        {
-                            name: '音乐',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: music1
-                        },
-                        {
-                            name: '舞蹈',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: dance1
-                        },
-                        {
-                            name: '美术',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: art1
-                        },
-                        {
-                            name: '戏曲戏剧',
+                            data: [item.num]
+                        });
+                    }
+                });
+                let participantNum = this.list[i].participantNum;
+                participantNum.forEach(item => {
+                    let key = 'par' + item.name;
+                    if (seriesMap.has(key)) {
+                        seriesMap.get(key).data.push(item.num);
+                    } else {
+                        seriesMap.set(key, {
+                            name: item.name,
                             type: 'bar',
                             stack: 'two',
                             emphasis: emphasisStyle,
-                            data: operaDrama1
+                            data: [item.num]
+                        });
+                    }
+                });
+            }
+
+            let info = Object.fromEntries(seriesMap.entries());
+            this.values = Object.keys(info).map(item => {
+                return {
+                    ...info[item]
+                };
+            });
+
+            var chartDom = this.$refs.chart;
+            var myChart = echarts.init(chartDom);
+            var option;
+            option = {
+                legend: {
+                    data: names,
+                    left: '10%'
+                },
+                brush: {
+                    // toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
+                    // xAxisIndex: 0
+                },
+                toolbox: {
+                    feature: {
+                        magicType: {
+                            type: ['stack']
                         },
-                        {
-                            name: '曲艺',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: folkArt1
+                        dataView: {}
+                    }
+                },
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
+                    },
+                    formatter: function(params) {
+                        //自定义划过显示样式
+                        var str = '';
+                        for (var i = 0; i < params.length; i++) {
+                            // console.log(params);
+                            if (i == 0) {
+                                str += '<br/>' + '节目数量';
+                                str +=
+                                    '<div style="width:140px;border-top:1px solid #ccc;margin-top:4px;">' +
+                                    params[i].marker +
+                                    params[i].seriesName +
+                                    ':' +
+                                    params[i].value +
+                                    '</div >';
+                            } else if (i == 5) {
+                                str += '报名人数';
+                                str +=
+                                    '<div style="width:140px;border-top:1px solid #ccc;margin-top:4px;">' +
+                                    params[i].marker +
+                                    params[i].seriesName +
+                                    ':' +
+                                    params[i].value +
+                                    '</div >';
+                            } else {
+                                str +=
+                                    '<div style="width:140px;">' +
+                                    params[i].marker +
+                                    params[i].seriesName +
+                                    ':' +
+                                    params[i].value +
+                                    '</div >';
+                            }
                         }
-                    ]
-                };
+                        var tooltipHtml =
+                            '<div style="width:140px;overflow-y:auto;">' + params[0].axisValue + '年' + str + '</div>';
+                        return tooltipHtml;
+                    }
+                },
+                xAxis: {
+                    data: xAxisData,
+                    name: '年份',
+                    axisLine: { onZero: true },
+                    splitLine: { show: false },
+                    splitArea: { show: false }
+                },
+                yAxis: {},
+                grid: {
+                    bottom: 20
+                },
+                series: this.values
+            };
 
-                option && myChart.setOption(option);
-            });
-        }, 500);
+            option && myChart.setOption(option);
+        }
     },
     components: {
         WidgetCard
-    },
-    mixins: [widget]
+    }
 };
 </script>
 <style lang="less" scoped></style>

+ 30 - 95
src/main/vue/src/views/showStatistic/RateYearWidget.vue

@@ -12,7 +12,6 @@
 <script>
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
-import widget from '@/mixins/widget';
 
 export default {
     data() {
@@ -21,102 +20,44 @@ export default {
             bodyStyle: {
                 display: 'flex'
             },
-            types: [
-                { name: '优秀', complain: 15, unitType: 'GRADING_ORGANIZATION' },
-                { name: '合格', complain: 60, unitType: 'GRADING_ORGANIZATION' },
-                { name: '不合格', complain: 0, unitType: 'GRADING_ORGANIZATION' },
-                { name: '取消参评', complain: 14, unitType: 'GRADING_ORGANIZATION' }
-            ],
-            chooseYear: '2021'
+            types: [],
+            chooseYear: '2021',
+            years: ['2021', '2022', '2023', '2024']
         };
     },
-    computed: {
-        years() {
-            return Object.keys({ ...this.allData });
-        }
-    },
+    computed: {},
     mounted() {
         setTimeout(() => {
-            this.myChart = echarts.init(this.$refs.chart);
-            this.setChart();
+            this.getData();
+            // this.myChart = echarts.init(this.$refs.chart);
+            // this.setChart();
         });
     },
     methods: {
+        getData() {
+            this.$http.post('/report/rateResult', { year: this.chooseYear }).then(res => {
+                this.types = res;
+                this.myChart = echarts.init(this.$refs.chart);
+                this.setChart();
+            });
+        },
         setChart() {
-            let res = [...this.types];
-            let data = [];
-
-            res.forEach(item => {
-                data.push({
-                    name: item.name,
-                    value: item.complain
-                });
+            console.log(this.types);
+            let data = Object.keys(this.types).map(item => {
+                let name = '取消';
+                if (item == 'EXCELLENT') {
+                    name = '优秀';
+                } else if (item == 'ELIGIBLE') {
+                    name = '合格';
+                } else if (item == 'NOT_ELIGIBLE') {
+                    name = '不合格';
+                }
+                return {
+                    name: name,
+                    value: this.types[item]
+                };
             });
 
-            // let option = {
-            //     tooltip: {
-            //         trigger: 'item',
-            //         alwaysShowContent: true,
-            //         formatter: '{a} <br/>{b}: {c} ({d}%)'
-            //     },
-            //     legend: {
-            //         data: [...data].map(item => {
-            //             return item.name;
-            //         })
-            //     },
-            //     series: [
-            //         {
-            //             name: '投诉数量',
-            //             type: 'pie',
-            //             selectedMode: 'single',
-            //             radius: [0, '60%'],
-            //             label: {
-            //                 formatter: ' {b|{b}:}{c}场 {per|{d}%}  ',
-            //                 backgroundColor: '#F6F8FC',
-            //                 borderColor: '#8C8D8E',
-            //                 borderWidth: 1,
-            //                 borderRadius: 4,
-            //                 rich: {
-            //                     a: {
-            //                         color: '#6E7079',
-            //                         lineHeight: 22,
-            //                         align: 'center'
-            //                     },
-            //                     hr: {
-            //                         borderColor: '#8C8D8E',
-            //                         width: '100%',
-            //                         borderWidth: 1,
-            //                         height: 0
-            //                     },
-            //                     b: {
-            //                         color: '#4C5058',
-            //                         fontSize: 14,
-            //                         fontWeight: 'bold',
-            //                         lineHeight: 33
-            //                     },
-            //                     per: {
-            //                         color: '#fff',
-            //                         backgroundColor: '#4C5058',
-            //                         padding: [3, 4],
-            //                         borderRadius: 4
-            //                     }
-            //                 },
-            //                 position: 'inner',
-            //                 fontSize: 14
-            //             },
-            //             labelLine: {
-            //                 show: false
-            //             },
-            //             data: data,
-            //             select: {
-            //                 label: {
-            //                     show: true
-            //                 }
-            //             }
-            //         }
-            //     ]
-            // };
-
             let option = {
                 title: {
                     left: 'center'
@@ -133,12 +74,7 @@ export default {
                         name: '2021年等级评定',
                         type: 'pie',
                         radius: '60%',
-                        data: [
-                            { value: 15, name: '优秀' },
-                            { value: 60, name: '合格' },
-                            { value: 0, name: '不合格' },
-                            { value: 14, name: '取消参评' }
-                        ],
+                        data: data,
                         emphasis: {
                             itemStyle: {
                                 shadowBlur: 10,
@@ -190,8 +126,7 @@ export default {
     },
     components: {
         WidgetCard
-    },
-    mixins: [widget]
+    }
 };
 </script>
 <style lang="less" scoped></style>