|
|
@ -164,14 +164,11 @@ |
|
|
|
<el-dialog title="批量导入试题" :visible.sync="importVisible" width="520px" :close-on-click-modal="false" |
|
|
|
<el-dialog title="批量导入试题" :visible.sync="importVisible" width="520px" :close-on-click-modal="false" |
|
|
|
:modal-append-to-body="false"> |
|
|
|
:modal-append-to-body="false"> |
|
|
|
<el-form label-width="110px"> |
|
|
|
<el-form label-width="110px"> |
|
|
|
<el-form-item prop="userName" label="题库分类"> |
|
|
|
<el-form-item label="题库分类"> |
|
|
|
<el-select style="width: 100%" v-model="form.provinceId" placeholder="请选择题库分类"> |
|
|
|
<el-input v-model="questionBankCategory" disabled /> |
|
|
|
<el-option v-for="(item, i) in types" :key="i" :label="item.provinceName" |
|
|
|
|
|
|
|
:value="item.provinceId"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="userName" label="当前题库"> |
|
|
|
<el-form-item label="当前题库"> |
|
|
|
<el-input placeholder="请输入题库名称" v-model="form.name" disabled></el-input> |
|
|
|
<el-input v-model="questionBankName" disabled /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="userName" label="模板文件"> |
|
|
|
<el-form-item prop="userName" label="模板文件"> |
|
|
|
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button> |
|
|
|
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button> |
|
|
@ -180,9 +177,8 @@ |
|
|
|
<el-upload name="file" accept=".xls,.xlsx" ref="upload" class="import-file" drag :before-upload="beforeUpload" |
|
|
|
<el-upload name="file" accept=".xls,.xlsx" ref="upload" class="import-file" drag :before-upload="beforeUpload" |
|
|
|
:on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" |
|
|
|
:on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" |
|
|
|
:limit="1" :data="{ |
|
|
|
:limit="1" :data="{ |
|
|
|
// competitionId: id, |
|
|
|
questionBankId |
|
|
|
platformId: 2 |
|
|
|
}" :disabled="uploading" :on-exceed="handleExceed" :action="this.api.batchImportQuestions" |
|
|
|
}" :disabled="uploading" :on-exceed="handleExceed" :action="this.api.batchImportPersonalData" |
|
|
|
|
|
|
|
:file-list="uploadList" :headers="headers"> |
|
|
|
:file-list="uploadList" :headers="headers"> |
|
|
|
<i class="el-icon-upload"></i> |
|
|
|
<i class="el-icon-upload"></i> |
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|
|
@ -193,12 +189,49 @@ |
|
|
|
<p>3.仅支持上传.xls、 .xlsx文件格式</p> |
|
|
|
<p>3.仅支持上传.xls、 .xlsx文件格式</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-upload> |
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败,查看失败原因</el-link> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="importVisible = false">关闭</el-button> |
|
|
|
<el-button @click="importVisible = false">关闭</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <el-dialog title="批量导入试题" :visible.sync="importResultVisible" width="520px" :close-on-click-modal="false" |
|
|
|
|
|
|
|
:modal-append-to-body="false"> |
|
|
|
|
|
|
|
<el-form label-width="110px"> |
|
|
|
|
|
|
|
<el-form-item label="题库分类"> |
|
|
|
|
|
|
|
<el-input v-model="questionBankCategory" disabled /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="当前题库"> |
|
|
|
|
|
|
|
<el-input v-model="questionBankName" disabled /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="userName" label="模板文件"> |
|
|
|
|
|
|
|
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="userName" label="选择文件上传"> |
|
|
|
|
|
|
|
<el-upload name="file" accept=".xls,.xlsx" ref="upload" class="import-file" drag :before-upload="beforeUpload" |
|
|
|
|
|
|
|
:on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" |
|
|
|
|
|
|
|
:limit="1" :data="{ |
|
|
|
|
|
|
|
questionBankId |
|
|
|
|
|
|
|
}" :disabled="uploading" :on-exceed="handleExceed" :action="this.api.batchImportQuestions" |
|
|
|
|
|
|
|
:file-list="uploadList" :headers="headers"> |
|
|
|
|
|
|
|
<i class="el-icon-upload"></i> |
|
|
|
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|
|
|
|
|
|
|
<div class="el-upload__tip" slot="tip" style="line-height: 1.8;"> |
|
|
|
|
|
|
|
<p>上传说明:</p> |
|
|
|
|
|
|
|
<p>1.请按照模板要求,正确填写后上传</p> |
|
|
|
|
|
|
|
<p>2.上传文件大小限制50M</p> |
|
|
|
|
|
|
|
<p>3.仅支持上传.xls、 .xlsx文件格式</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败,查看失败原因</el-link> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
|
|
|
<el-button @click="importVisible = false">关闭</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
@ -209,6 +242,7 @@ import Breadcrumb from '@/components/breadcrumb' |
|
|
|
import Detail from '../detail' |
|
|
|
import Detail from '../detail' |
|
|
|
import Const from '@/const/ques' |
|
|
|
import Const from '@/const/ques' |
|
|
|
import Qs from 'qs' |
|
|
|
import Qs from 'qs' |
|
|
|
|
|
|
|
import axios from 'axios' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { Breadcrumb, Detail }, |
|
|
|
components: { Breadcrumb, Detail }, |
|
|
|
data () { |
|
|
|
data () { |
|
|
@ -600,8 +634,12 @@ export default { |
|
|
|
this.uploadFaild = false |
|
|
|
this.uploadFaild = false |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 模板下载 |
|
|
|
// 模板下载 |
|
|
|
download () { |
|
|
|
async download () { |
|
|
|
location.href = this.api[this.info.completeCompetitionSetup.competitionType ? 'competionTeamTemplate' : 'competionPersonTemplate'] |
|
|
|
const res = await axios.get(this.api.downloadQuesExcel, { |
|
|
|
|
|
|
|
headers: this.headers, |
|
|
|
|
|
|
|
responseType: 'blob' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
Util.downloadFileDirect('批量导入试题模板.xlsx', new Blob([res.data])) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 上传文件 |
|
|
|
// 上传文件 |
|
|
|
handleExceed (files, fileList) { |
|
|
|
handleExceed (files, fileList) { |
|
|
@ -611,31 +649,31 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 下载失败文件 |
|
|
|
// 下载失败文件 |
|
|
|
showFaild () { |
|
|
|
showFaild () { |
|
|
|
axios.get(`${this.api.TeamDataExportFailure}?exportCode=${this.exportCode}&platformId=2&type=${this.info.completeCompetitionSetup.competitionType ? 1 : 2}`, { |
|
|
|
axios.get(`${this.api.batchImportQuesFailure}?exportCode=${this.exportCode}`, { |
|
|
|
headers: this.headers, |
|
|
|
headers: this.headers, |
|
|
|
responseType: 'blob' |
|
|
|
responseType: 'blob' |
|
|
|
}).then((res) => { |
|
|
|
}).then((res) => { |
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
Util.downloadFileDirect(name ? decodeURI(name) : '批量导入报名人员失败数据导出.xlsx', new Blob([res.data])) |
|
|
|
Util.downloadFileDirect(name ? decodeURI(name) : '批量导入题目管理失败数据导出.xlsx', new Blob([res.data])) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSuccess ({ data, status }) { |
|
|
|
uploadSuccess ({ data, status, message }) { |
|
|
|
this.uploading = false |
|
|
|
this.uploading = false |
|
|
|
this.uploadFaild = false |
|
|
|
this.uploadFaild = false |
|
|
|
this.uploadTips = '' |
|
|
|
this.uploadTips = '' |
|
|
|
if (status === 200) { |
|
|
|
if (status === 200) { |
|
|
|
this.init() |
|
|
|
// this.init() |
|
|
|
const { tip } = data |
|
|
|
// const { tip } = data |
|
|
|
if (data.exportCode) { |
|
|
|
if (data.exportCode) { |
|
|
|
this.exportCode = data.exportCode |
|
|
|
this.exportCode = data.exportCode |
|
|
|
this.uploadFaild = true |
|
|
|
this.uploadFaild = true |
|
|
|
this.uploadTips = tip |
|
|
|
// this.uploadTips = tip |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000) |
|
|
|
// Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000) |
|
|
|
this.importVisible = false |
|
|
|
// this.importVisible = false |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Util.errorMsg(res.message || '上传失败,请检查数据', 3000) |
|
|
|
Util.errorMsg(message || '上传失败,请检查数据', 3000) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadError (err, file, fileList) { |
|
|
|
uploadError (err, file, fileList) { |
|
|
|