From f0f200abf841d5d7fe5e2921e6ded8f0147e9c92 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期三, 10 七月 2024 18:02:07 +0800 Subject: [PATCH] feat 用户列表增加部门条件 随机试卷列表增加部门,时间,科目条件 补考直接展示学生 试卷标题默认展示一个 --- src/views/answer/dataStatistics.vue | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/src/views/answer/dataStatistics.vue b/src/views/answer/dataStatistics.vue index 45defa0..03861d0 100644 --- a/src/views/answer/dataStatistics.vue +++ b/src/views/answer/dataStatistics.vue @@ -8,6 +8,8 @@ </el-form-item> <el-form-item> <el-button type="primary" @click="submitForm">鏌ヨ</el-button> + <el-button type="danger" @click="handleExport" class="link-left">瀵煎嚭</el-button> + <el-button type="danger" @click="downloadUrlFile" class="link-left">鎴浘</el-button> </el-form-item> </el-form> @@ -134,7 +136,8 @@ chartLoading: false, queryParam: { id: '', - type: 1 + type: 1, + name: '鍒嗘暟缁熻' }, admin: true }; @@ -148,14 +151,41 @@ this.examPaperList = res.response; this.queryParam.id = this.examPaperList[0].id; this.queryParam.type = this.examPaperList[0].paperType; + this.queryParam.name = this.examPaperList[0].name; this.getChartData(); this.observe(); }); }, methods: { + downloadUrlFile(url, fileName) { + // 鑾峰彇base64鍥剧墖 + const chartImgUrl = this.myChart.getDataURL({ + pixelRatio: 2, + backgroundColor: '#fff' + }) + console.log(chartImgUrl) + // 涓嬭浇base64鍥剧墖 + this.downloadUrlFile(chartImgUrl, 'ECharts 2鍊嶅浘') + }, + handleExport(){ + let that = this + let url ='/api/admin/examPaperAnswer/export?id=' +this.queryParam.id + '&type=' + this.queryParam.type + var x = new XMLHttpRequest(); + x.open("GET", url, true); + x.responseType = "blob"; + x.onload = function () { + var url = window.URL.createObjectURL(x.response); + var a = document.createElement("a"); + a.href = url; + a.download = that.queryParam.name; + a.click(); + }; + x.send(); + }, getType(val) { const selectedItem = this.examPaperList.find(item => item.id === val); this.queryParam.type = selectedItem.paperType; + this.queryParam.name = selectedItem.name; this.getChartData(); }, getChartData() { -- Gitblit v1.8.0