提交 958e5e43 authored 作者: matian's avatar matian

代码提交

上级 f0c8559b
<template> <template>
<app-container> <app-container>
<app-list v-bind="tableOptions" ref="list" @sort-change="sortChange"> <app-list v-bind="tableOptions" ref="list" @sort-change="sortChange">
<div style="display: flex; justify-content: flex-start">
<el-input v-model="queryInfo.query" clearable style="width: 200px; margin-right: 20px" placeholder="学生姓名" />
<el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
<el-button icon="el-icon-refresh-left" @click="reset">重置</el-button>
</div>
<template #header-aside> <template #header-aside>
<el-button type="text" size="mini" @click="toExamData(row)">导出</el-button> <el-button type="text" size="mini" @click="toExamData(row)">导出</el-button>
</template> </template>
...@@ -16,7 +22,12 @@ ...@@ -16,7 +22,12 @@
import { getClassDetail } from '../api' import { getClassDetail } from '../api'
export default { export default {
data() { data() {
return {} return {
callList: [],
queryInfo: {
query: ''
}
}
}, },
computed: { computed: {
// 列表配置 // 列表配置
...@@ -24,6 +35,7 @@ export default { ...@@ -24,6 +35,7 @@ export default {
return { return {
remote: { remote: {
httpRequest: getClassDetail, httpRequest: getClassDetail,
callback: this.callback,
params: { params: {
type: this.$route.query.type, type: this.$route.query.type,
course_id: this.$route.query.course_id, course_id: this.$route.query.course_id,
...@@ -33,7 +45,7 @@ export default { ...@@ -33,7 +45,7 @@ export default {
status: this.$route.query.status status: this.$route.query.status
} }
}, },
filters: [{ type: 'input', prop: 'personal_name', placeholder: '学生姓名', label: '学生姓名' }], // filters: [{ type: 'input', prop: 'personal_name', placeholder: '学生姓名', label: '学生姓名' }],
columns: [ columns: [
{ label: '学生姓名', prop: 'personal_name', align: 'center' }, { label: '学生姓名', prop: 'personal_name', align: 'center' },
{ label: '总得分', prop: 'score', align: 'center', sortable: 'custom' }, { label: '总得分', prop: 'score', align: 'center', sortable: 'custom' },
...@@ -62,6 +74,28 @@ export default { ...@@ -62,6 +74,28 @@ export default {
} }
}, },
methods: { methods: {
callback(val) {
this.callList = val.list
console.log(val.list, 'val')
return this.callList
},
// 搜索
search() {
if (this.queryInfo.query === '') {
this.$refs.list.dataList = this.callList
return false
}
const data = this.callList.reduce((a, b) => {
b.personal_name.indexOf(this.queryInfo.query) !== -1 && (a.push(b))
return a
}, [])
this.$refs.list.dataList = data
// console.log(this.tableOptions.data, 'hfdsjjsj')
},
// 重置
reset() {
this.$refs.list.dataList = this.callList
},
toExamData(row) { toExamData(row) {
this.$router.push({ this.$router.push({
path: path:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论