|
@@ -9,6 +9,18 @@
|
|
|
>
|
|
|
<template slot="filter-content">
|
|
|
<el-input v-model="listQuery.params.realName" placeholder="搜索用户名" style="width: 200px;" class="filter-item" />
|
|
|
+ <el-cascader
|
|
|
+ style="width: 280px;"
|
|
|
+ class="filter-item"
|
|
|
+ ref="cascader"
|
|
|
+ placeholder="选择部门"
|
|
|
+ :options="departList"
|
|
|
+ :props="props"
|
|
|
+ :show-all-levels="false"
|
|
|
+ collapse-tags
|
|
|
+ @change="funCasChange"
|
|
|
+ clearable>
|
|
|
+ </el-cascader>
|
|
|
<el-button type="primary" icon="el-icon-download" style="float: right" size="mini" @click="handleExport">导出</el-button>
|
|
|
|
|
|
</template>
|
|
@@ -94,7 +106,7 @@
|
|
|
import DataTable from '@/components/DataTable'
|
|
|
import CourseFileLearnPaging from '@/views/admin/course/learn/file'
|
|
|
import { apiExportUserStat } from '@/api/stat/course'
|
|
|
-
|
|
|
+import { fetchTree } from "@/api/sys/depart/depart";
|
|
|
export default {
|
|
|
name: 'LearnStatPaging',
|
|
|
components: { CourseFileLearnPaging, DataTable },
|
|
@@ -103,7 +115,13 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
+ props: {
|
|
|
+ multiple: true,
|
|
|
+ label: "deptName",
|
|
|
+ value: "deptCode",
|
|
|
+ children: "children",
|
|
|
+ },
|
|
|
+ departList: [],
|
|
|
dialogVisible: false,
|
|
|
|
|
|
listQuery: {
|
|
@@ -111,6 +129,7 @@ export default {
|
|
|
size: 10,
|
|
|
params: {
|
|
|
courseId: this.courseId,
|
|
|
+ courseDeparts: null,
|
|
|
catId: null
|
|
|
}
|
|
|
},
|
|
@@ -130,9 +149,36 @@ export default {
|
|
|
|
|
|
created() {
|
|
|
this.listQuery.params.courseId = this.courseId
|
|
|
+
|
|
|
+ fetchTree({}).then((response) => {
|
|
|
+ this.departList = this.filterDepart(response.data)
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ filterDepart(mapArr){
|
|
|
+ return mapArr.map(o => {
|
|
|
+ if(o.children.length === 0){
|
|
|
+ delete o.children
|
|
|
+ return {
|
|
|
+ ...o
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return {
|
|
|
+ ...o,
|
|
|
+ children: this.filterDepart(o.children)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ funCasChange(){
|
|
|
+ const checkNodes = this.$refs.cascader.getCheckedNodes(true)
|
|
|
+ if(checkNodes.length){
|
|
|
+ this.listQuery.params.courseDeparts = checkNodes.map(o => o.value)
|
|
|
+ }else{
|
|
|
+ this.listQuery.params.courseDeparts = null
|
|
|
+ }
|
|
|
+ },
|
|
|
showDetail(userId) {
|
|
|
this.userId = userId
|
|
|
this.dialogVisible = true
|