|
|
|
|
@ -80,6 +80,7 @@
|
|
|
|
|
><el-button @click="loadStats">重试</el-button></el-empty>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else v-loading="responsesLoading">
|
|
|
|
|
<div style="margin-bottom: 16px"><el-button type="primary" icon="el-icon-download" :loading="exporting" :disabled="exporting" @click="exportResponses">导出全部答卷及附件</el-button><span style="margin-left: 12px; color: #909399">导出当前问卷全部答卷,不限当前页</span></div>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="responses"
|
|
|
|
|
border
|
|
|
|
|
@ -165,7 +166,8 @@
|
|
|
|
|
<small>{{ item.created_at }}</small>
|
|
|
|
|
<SurveyAttachments
|
|
|
|
|
v-if="item.files && item.files.length"
|
|
|
|
|
:files="item.files" :response-id="item.id"
|
|
|
|
|
:files="item.files"
|
|
|
|
|
:response-id="item.id"
|
|
|
|
|
/>
|
|
|
|
|
<p v-else>{{ item.text }}</p>
|
|
|
|
|
<el-button
|
|
|
|
|
@ -188,6 +190,9 @@
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
import { saveAs } from 'file-saver'
|
|
|
|
|
import {
|
|
|
|
|
index,
|
|
|
|
|
show,
|
|
|
|
|
@ -212,6 +217,7 @@ export default {
|
|
|
|
|
summary: null,
|
|
|
|
|
loading: false,
|
|
|
|
|
responsesLoading: false,
|
|
|
|
|
exporting: false,
|
|
|
|
|
responses: [],
|
|
|
|
|
page: 1,
|
|
|
|
|
total: 0,
|
|
|
|
|
@ -251,6 +257,22 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async exportResponses() {
|
|
|
|
|
if (this.exporting || !this.surveyData) return
|
|
|
|
|
this.exporting = true
|
|
|
|
|
try {
|
|
|
|
|
const result = await axios.get('/api/admin/course-content-evaluation-form/index', {
|
|
|
|
|
baseURL: process.env.VUE_APP_BASE_API,
|
|
|
|
|
params: { export_bundle: 1, course_content_evaluation_id: this.surveyData.id },
|
|
|
|
|
headers: { Authorization: 'Bearer ' + getToken() }, responseType: 'blob', timeout: 300000
|
|
|
|
|
})
|
|
|
|
|
if ((result.headers['content-type'] || '').includes('application/json')) {
|
|
|
|
|
const error = JSON.parse(await result.data.text())
|
|
|
|
|
throw new Error(error.errmsg || '导出失败,请重试')
|
|
|
|
|
}
|
|
|
|
|
saveAs(result.data, '问卷答卷_' + this.surveyData.id + '.zip')
|
|
|
|
|
} catch (e) { this.$message.error('导出失败,请检查登录状态或稍后重试') } finally { this.exporting = false }
|
|
|
|
|
},
|
|
|
|
|
close() {
|
|
|
|
|
this.$emit('update:visible', false)
|
|
|
|
|
},
|
|
|
|
|
|