Commit f8fc024d by 宋珺琪

单位分数统计导出添加时间条件

parent d53d4f4f
......@@ -8,7 +8,17 @@
<el-button>单位导出</el-button>
</download-excel>
<el-button @click="personExport('null')">人员导出</el-button>
<el-date-picker
v-model="selectTime"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions">
</el-date-picker>
</div>
<section class="content-el">
<el-table ref="filterTable" :data="scoreTj" v-loading="loading">
......@@ -60,6 +70,7 @@
export default {
data() {
return {
selectTime:[],
pagination: { //分页后的留言列表
current: 1, //当前页
total: null, //记录条数
......@@ -91,17 +102,58 @@ export default {
"答题量":'dtcount',
"答题正确率":'right',
"总成绩":'countsum',
}
},
pickerOptions: {
shortcuts: [{
text: '本月',
onClick(picker) {
picker.$emit('pick', [new Date(), new Date()]);
}
}, {
text: '今年至今',
onClick(picker) {
const end = new Date();
const start = new Date(new Date().getFullYear(), 0);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近六个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 6);
picker.$emit('pick', [start, end]);
}
}]
},
}
},
created() {
this.getScoreTj()
this.loading = true //数据加载则遮罩表格
},
watch: {
selectTime(newVal, oldVal) {
console.log(newVal)
this.getScoreTj();
}
},
methods: {
//导出
personExport(text){
this.$axios(`/api/listAllStudentScoreTj/${text}`,{
let self = this;
console.log(self.selectTime)
let url ;
debugger
if (self.selectTime && self.selectTime!=""){
const kssj = self.selectTime[0].replace(/\d{2}:\d{2}:\d{2}$/, '00:00:00');
const jssj = self.selectTime[1].replace(/\d{2}:\d{2}:\d{2}$/, '23:59:59');
url= `/api/listAllStudentScoreTj/${text}/${kssj}/${jssj}`
}else {
url = `/api/listAllStudentScoreTj/${text}/null/null`
}
this.$axios(url,{
loading: true,
loadingText: "正在导出...",
responseType: "blob",
......@@ -121,8 +173,15 @@ export default {
});
},
getScoreTj() {
let studentId = this.$cookies.get("cid")
this.$axios(`/api/scoreDwTj`).then(res => {
let url = ''
if (this.selectTime && this.selectTime!=""){
const kssj = this.selectTime[0].replace(/\d{2}:\d{2}:\d{2}$/, '00:00:00');
const jssj = this.selectTime[1].replace(/\d{2}:\d{2}:\d{2}$/, '23:59:59');
url = `/api/scoreDwTj/${kssj}/${jssj}`
}else {
url = `/api/scoreDwTj/null/null`
}
this.$axios(url).then(res => {
debugger
if(res.data.code == 200) {
this.loading = false //数据加载完成去掉遮罩
......@@ -159,8 +218,16 @@ export default {
current: 1, //当前页
total: null, //记录条数
size: 5 //每页条数
},
this.$axios(`/api/scoreDwTsTj/${this.pagination.current}/${this.pagination.size}/${row.clazz}`).then(res => {
}
let url ;
if (this.selectTime && this.selectTime!=""){
const kssj = this.selectTime[0].replace(/\d{2}:\d{2}:\d{2}$/, '00:00:00');
const jssj = this.selectTime[1].replace(/\d{2}:\d{2}:\d{2}$/, '23:59:59');
url = `/api/scoreDwTsTj/${this.pagination.current}/${this.pagination.size}/${row.clazz}/${kssj}/${jssj}`
}else {
url = `/api/scoreDwTsTj/${this.pagination.current}/${this.pagination.size}/${row.clazz}/null/null`
}
this.$axios(url).then(res => {
this.loadingDialog = false
this.scoreTjXq=res.data.data.records
this.pagination = {...res.data.data}
......@@ -169,7 +236,15 @@ export default {
// 下一页请求
nextClazzClick(row) {
this.clazz = row;
this.$axios(`/api/scoreDwTsTj/${this.pagination.current}/${this.pagination.size}/${row.clazz}`).then(res => {
let url ;
if (this.selectTime && this.selectTime!=""){
const kssj = this.selectTime[0].replace(/\d{2}:\d{2}:\d{2}$/, '00:00:00');
const jssj = this.selectTime[1].replace(/\d{2}:\d{2}:\d{2}$/, '23:59:59');
url = `/api/scoreDwTsTj/${this.pagination.current}/${this.pagination.size}/${row.clazz}/${kssj}/${jssj}`
}else {
url = `/api/scoreDwTsTj/${this.pagination.current}/${this.pagination.size}/${row.clazz}/null/null`
}
this.$axios(url).then(res => {
this.loadingDialog = false
this.scoreTjXq=res.data.data.records
this.pagination = {...res.data.data}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment