blob: 672dcf4552aa8f53fa158debec4384ece25ade34 [file] [log] [blame]
huibing.xiebba5eb92018-08-27 11:12:36 +08001<template>
2 <div class="app-container">
3 <div class="filter-container">
4 <el-row :gutter="20">
5 <el-col :span="4">
6 <el-select clearable class="filter-item" v-model="listQuery.pcmc" placeholder="批次名称">
7 </el-select>
8 </el-col>
9 <el-col :span="4">
10 <el-select clearable @change="initZyList" class="filter-item" v-model="listQuery.yx" placeholder="所在院系">
huibing.xiec95b6a22018-08-29 14:15:43 +080011 <el-option v-for="item in yxList" :key="item.id" :label="item.name" :value="item.id">
huibing.xiebba5eb92018-08-27 11:12:36 +080012 </el-option>
13 </el-select>
14 </el-col>
15 <el-col :span="4">
16 <el-select clearable class="filter-item" v-model="listQuery.zy" placeholder="专业">
17 <el-option v-for="item in zyList" :key="item.id" :label="item.zymc" :value="item.id">
18 </el-option>
19 </el-select>
20 </el-col>
21 <el-col :span="4">
22 <el-select clearable class="filter-item" v-model="listQuery.bm" placeholder="部门">
huibing.xiec95b6a22018-08-29 14:15:43 +080023 <el-option v-for="item in bmList" :key="item.id" :label="item.name" :value="item.id">
huibing.xiebba5eb92018-08-27 11:12:36 +080024 </el-option>
25 </el-select>
26 </el-col>
27 <el-col :span="8">
28 <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查询</el-button>
29 <el-button class="filter-item" style="margin-left: 10px;" @click="handleReset" type="primary" icon="el-icon-edit">重置</el-button>
30 </el-col>
31 </el-row>
32 </div>
33 <el-col :span="24">
34 <el-card>
35 <div id="myChart" :style="{width: '100%', height: '300px'}"></div>
36 </el-card>
37 </el-col>
38 <el-dialog title="详情" :visible.sync="dialogFormVisible" width="80%" top="2vh">
39 <audit-student-list :tableheight="tableheight" :queryparam="queryparam"></audit-student-list>
40 </el-dialog>
41 </div>
42</template>
43
44<script>
45import { getList } from '@/api/nodereport-api'
46import { getDeptList, getSectionList } from '@/api/department-api'
47import { getZyListByYx } from '@/api/major-api'
48import waves from '@/directive/waves' // 水波纹指令
49import { resetForm } from '@/utils'
50import { crudPageList } from '@/utils/crud'
51import mixindata from '@/utils/crud'
52import AuditStudentList from '@/components/AuditStudentList'
53
54export default {
55 name: 'class',
56 components: { AuditStudentList },
57 directives: {
58 waves
59 },
60 mixins: [mixindata],
61 data() {
62 return {
63 tableheight: 500,
64 pcmcList: [],
65 yxList: [],
66 zyList: [],
67 bmList: [],
68 queryparam: {}
69 }
70 },
71 created() {
72 this.listQuery = this.$route.params
73 this.initYxList()
74 this.initZyList()
75 this.initBmList()
76 this.handlePageList()
77 this.tableheight = window.innerHeight - 320
78 },
79 methods: {
80 drawLine() {
81 this.$nextTick(function() {
82 const xdata = []
83 const xiddata = []
84 const tgdata = []
85 const btgdata = []
86 const dshdata = []
87 for (const item of this.items) {
88 xdata.push(item.hjmc)
89 xiddata.push(item.hjid)
90 tgdata.push(item.shtg)
91 btgdata.push(item.shbtg)
92 dshdata.push(item.dsh)
93 }
94 // 基于准备好的dom,初始化echarts实例
95 const myChart = window.echarts.init(document.getElementById('myChart'))
96 // 绘制图表
97 const option = {
98 tooltip: {
99 trigger: 'axis'
100 },
101 toolbox: {
102 feature: {
103 saveAsImage: {}
104 }
105 },
106 xAxis: {
107 type: 'category',
108 data: xdata,
109 xiddata: xiddata
110 },
111 yAxis: {
112 type: 'value'
113 },
114 legend: {
115 data: ['通过', '不通过', '待审核']
116 },
117 series: [
118 {
119 name: '通过',
120 type: 'bar',
121 data: tgdata,
122 shzt: 1
123 },
124 {
125 name: '不通过',
126 type: 'bar',
127 data: btgdata,
128 shzt: 2
129 },
130 {
131 name: '待审核',
132 type: 'bar',
133 data: dshdata,
134 shzt: 3
135 }]
136 }
137 myChart.setOption(option)
138 const that = this
139 myChart.on('click', function(params) {
140 const hjid = option.xAxis.xiddata[params.dataIndex]
141 const shzt = option.series[params.seriesIndex].shzt
142 that.showDetail(hjid, shzt)
143 })
144 })
145 },
146 initYxList() {
147 getDeptList().then(response => {
148 this.yxList = response.items
149 })
150 },
151 initZyList() {
152 getZyListByYx({ yx: this.listQuery.yx }).then(response => {
153 this.zyList = response.items
huibing.xiebba5eb92018-08-27 11:12:36 +0800154 })
155 },
156 initBmList() {
157 getSectionList().then(response => {
158 this.bmList = response.items
159 })
160 },
161 handlePageList() {
162 crudPageList(this, getList, this.drawLine)
163 },
164 handleReset() {
165 resetForm(this.listQuery)
166 },
167 handleFilter() {
168 this.listQuery.pageIndex = 1
169 this.handlePageList()
170 },
171 showDetail(hjid, shzt) {
172 this.listQuery['hjid'] = hjid
173 this.listQuery['shzt'] = shzt
174 this.queryparam = Object.assign({}, this.listQuery)
175 this.dialogFormVisible = true
176 }
177 }
178}
179</script>
180<style scoped>
181.app-container a {
182 color: #00a4f4;
183 text-decoration: none;
184}
185.el-card {
186 margin: 5px;
187}
188</style>
189