| | |
| | | <template> |
| | | <div style="padding: 10px" ref="pageContent"> |
| | | <div class="app-container" ref="pageContent"> |
| | | <el-form :model="queryParam" ref="queryForm" :inline="true" style="display: flex"> |
| | | <el-form-item label="试卷:"> |
| | | <el-select v-model="queryParam.id" filterable placeholder="试卷" @change="getType"> |
| | | <el-select v-model="queryParam.id" filterable placeholder="试卷" @change="getType" size="small"> |
| | | <el-option v-for="item,index in examPaperList" :key="index" :value="item.id" :label="item.name" /> |
| | | </el-select> |
| | | </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="primary" @click="submitForm" size="small">查询</el-button> |
| | | <el-button type="danger" @click="handleExport" size="small" class="link-left">导出</el-button> |
| | | <el-button type="success" @click="downloadUrlFile" size="small" class="link-left">截图</el-button> |
| | | </el-form-item> |
| | | |
| | | </el-form> |
| | |
| | | }); |
| | | }, |
| | | methods: { |
| | | downloadUrlFile() { |
| | | var fileName = this.queryParam.name + '.png'; |
| | | var canvasElement = document.getElementsByTagName('canvas')[0]; |
| | | var MIME_TYPE = "image/png"; |
| | | var imgURL = canvasElement.toDataURL(MIME_TYPE); |
| | | var dlLink = document.createElement('a'); |
| | | dlLink.download = fileName; |
| | | dlLink.href = imgURL; |
| | | dlLink.dataset.downloadurl = [MIME_TYPE, dlLink.download, dlLink.href].join(':'); |
| | | document.body.appendChild(dlLink); |
| | | dlLink.click(); |
| | | document.body.removeChild(dlLink); |
| | | }, |
| | | handleExport(){ |
| | | let that = this |
| | | let url ='/api/admin/examPaperAnswer/export?id=' +this.queryParam.id + '&type=' + this.queryParam.type |
| | |
| | | var url = window.URL.createObjectURL(x.response); |
| | | var a = document.createElement("a"); |
| | | a.href = url; |
| | | a.download = that.queryParam.name; |
| | | a.download = that.queryParam.name + '.xlsx'; |
| | | a.click(); |
| | | }; |
| | | x.send(); |