fix : 文件下载路径(总部文件)
This commit is contained in:
parent
2ae5c21a1a
commit
28e2cc84e2
File diff suppressed because one or more lines are too long
|
@ -117,6 +117,15 @@ export function createPaper(data) {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//导入试卷
|
||||||
|
export function UploadPaper(data) {
|
||||||
|
return request({
|
||||||
|
url: `/exam/paper/upload_paper/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
//编辑试卷
|
//编辑试卷
|
||||||
export function updatePaper(id, data) {
|
export function updatePaper(id, data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="名称" min-width="110">
|
<el-table-column label="名称" min-width="110">
|
||||||
<template slot-scope="scope" v-if="scope.row.file_.file">
|
<template slot-scope="scope" v-if="scope.row.file_.file">
|
||||||
<a v-if="scope.row.file_.file.indexOf('.pdf')>-1 " :href="`/static/build/generic/web/viewer.html?file=${scope.row.file_.file}`" target="view_window" class="flv">
|
<a v-if="scope.row.file_.file.indexOf('.pdf')>-1 " :href="scope.row.file_.file" target="view_window" class="flv">
|
||||||
<el-link type="primary">{{ scope.row.name }}</el-link>
|
<el-link type="primary">{{ scope.row.name }}</el-link>
|
||||||
</a>
|
</a>
|
||||||
<el-link v-else :href="scope.row.file_.file" type="primary">{{ scope.row.name }}</el-link>
|
<el-link v-else :href="scope.row.file_.file" type="primary">{{ scope.row.name }}</el-link>
|
||||||
|
|
|
@ -153,9 +153,9 @@
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="考试部门" prop="participant_dep" style="width:100%" clearable>
|
<el-form-item label="考试部门" prop="participant_dep" style="width:100%" clearable collapse-tags filterable >
|
||||||
<el-button @click="selectAll">全选部门</el-button>
|
<el-button @click="selectAll">全选部门</el-button>
|
||||||
<el-select v-model="exam.participant_dep" multiple placeholder = "选择部门" >
|
<el-select v-model="exam.participant_dep" multiple collapse-tags filterable placeholder = "选择部门" >
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in depOptions"
|
v-for="item in depOptions"
|
||||||
:key = "item.id"
|
:key = "item.id"
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="考试人员" prop="participant_user" style="width:100%" clearable>
|
<el-form-item label="考试人员" prop="participant_user" style="width:100%" clearable>
|
||||||
<el-select v-model="exam.participant_user" multiple placeholder = "请选择人员">
|
<el-select v-model="exam.participant_user" multiple filterable placeholder = "请选择人员">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in userOptions"
|
v-for="item in userOptions"
|
||||||
:key = "item.id"
|
:key = "item.id"
|
||||||
|
@ -174,6 +174,15 @@
|
||||||
:value = "item.id">
|
:value = "item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[10, 20, 30, 40]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total"
|
||||||
|
></el-pagination>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align:right;">
|
<div style="text-align:right;">
|
||||||
|
@ -230,6 +239,9 @@
|
||||||
dialogType: "new",
|
dialogType: "new",
|
||||||
workscopeOptions:[],
|
workscopeOptions:[],
|
||||||
paperOptions:[],
|
paperOptions:[],
|
||||||
|
currentPage: 1, // 当前页码
|
||||||
|
pageSize: 10, // 每页显示的条数
|
||||||
|
total: 0, // 总条数
|
||||||
rule1: {
|
rule1: {
|
||||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
place: [{ required: true, message: "请输入", trigger: "change" }],
|
place: [{ required: true, message: "请输入", trigger: "change" }],
|
||||||
|
@ -248,6 +260,7 @@
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getCourseList();
|
this.getCourseList();
|
||||||
this.getDepartmentList();
|
this.getDepartmentList();
|
||||||
|
this.getUser();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
|
@ -268,16 +281,27 @@
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
// 改变每页显示的条数
|
||||||
|
this.pageSize = val;
|
||||||
|
this.getUser();
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
// 改变当前页码
|
||||||
|
this.currentPage = val;
|
||||||
|
this.getUser();
|
||||||
|
},
|
||||||
getDepartmentList(){
|
getDepartmentList(){
|
||||||
getDepartment().then(response =>{
|
getDepartment().then(response =>{
|
||||||
this.depOptions = response.data
|
this.depOptions = response.data
|
||||||
return this.depOptions
|
return this.depOptions
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getUserList(){
|
getUser(){
|
||||||
getUserList().then(response =>{
|
getUserList({page: this.currentPage, size: this.pageSize}).then(response =>{
|
||||||
this.userOptions = response.data
|
this.userOptions = response.data.results
|
||||||
console.log(this.userOptions)
|
this.total = response.data.total;
|
||||||
|
// console.log(this.userOptions)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCourseList(){
|
getCourseList(){
|
||||||
|
|
|
@ -24,8 +24,12 @@
|
||||||
<div style="text-align: left; margin: 0;">
|
<div style="text-align: left; margin: 0;">
|
||||||
<el-link href="/media/muban/question.xlsx" target="_blank" @click="popovervisible = false"
|
<el-link href="/media/muban/question.xlsx" target="_blank" @click="popovervisible = false"
|
||||||
type="primary">下载模板</el-link>
|
type="primary">下载模板</el-link>
|
||||||
<el-upload :action="upUrl" :on-success="handleUploadSuccess" accept=".xlsx" :headers="upHeaders"
|
<el-upload
|
||||||
:show-file-list="false">
|
:action="upUrl"
|
||||||
|
:on-success="handleUploadSuccess"
|
||||||
|
accept=".xlsx"
|
||||||
|
:headers="upHeaders"
|
||||||
|
:show-file-list="false">
|
||||||
<el-button size="small" type="primary" @click="popovervisible = false">上传导入</el-button>
|
<el-button size="small" type="primary" @click="popovervisible = false">上传导入</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</div>
|
</div>
|
||||||
|
@ -153,8 +157,9 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file) {
|
||||||
if (res.code == 200) {
|
if (res.code == 201) {
|
||||||
const loading = this.$loading({ text: "正在导入中..." })
|
const loading = this.$loading({ text: "正在导入中..." })
|
||||||
|
console.log(res.data);
|
||||||
importQuestion(res.data).then(response => {
|
importQuestion(res.data).then(response => {
|
||||||
loading.close()
|
loading.close()
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
|
|
|
@ -45,7 +45,20 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<h3>选题信息</h3>
|
<h3>选题信息</h3>
|
||||||
<el-button type="primary" @click="handleChoose" icon="el-icon-plus">选择试题</el-button>
|
<!-- <div> -->
|
||||||
|
<div style="display: flex;">
|
||||||
|
<el-button type="primary" @click="handleChoose" icon="el-icon-plus" style="margin-right: 10px;">选择试题</el-button>
|
||||||
|
<el-upload
|
||||||
|
:action="upUrl"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:headers="upHeaders"
|
||||||
|
:file-list="fileList"
|
||||||
|
:limit="1"
|
||||||
|
accept=".doc,.docx">
|
||||||
|
<el-button icon="el-icon-plus" type="primary" >上传试题</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
<div v-for="(item, index) in questions">
|
<div v-for="(item, index) in questions">
|
||||||
<h4>
|
<h4>
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -61,19 +74,37 @@
|
||||||
</h4>
|
</h4>
|
||||||
<div v-for="(value, name) in item.options">{{ name }}: {{ value }}</div>
|
<div v-for="(value, name) in item.options">{{ name }}: {{ value }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-for="(item, index) in up_questions">
|
||||||
|
<h4>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="handleDeleteUp(index)"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
></el-button>
|
||||||
|
{{ index+1 }} -
|
||||||
|
<el-tag>{{item.type}}</el-tag>
|
||||||
|
{{ item.name }}
|
||||||
|
<span>(正确答案:{{item.right}})</span>
|
||||||
|
</h4>
|
||||||
|
<div v-for="(value, name) in item.options">{{ name }}: {{ value }}</div>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<Questionchoose v-bind:chooseVisible="chooseVisible" @closeDg="closeDg" @choseQ="choseQ"></Questionchoose>
|
<Questionchoose v-bind:chooseVisible="chooseVisible" @closeDg="closeDg" @choseQ="choseQ"></Questionchoose>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getQuestioncatList, createPaper } from "@/api/exam";
|
import { getQuestioncatList, createPaper, UploadPaper } from "@/api/exam";
|
||||||
import Questionchoose from "@/views/exam/questionChoose";
|
import Questionchoose from "@/views/exam/questionChoose";
|
||||||
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
export default {
|
export default {
|
||||||
components: { Questionchoose },
|
components: { Questionchoose },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
questions: [],
|
questions: [],
|
||||||
|
up_questions: [],
|
||||||
Form: {
|
Form: {
|
||||||
name: "",
|
name: "",
|
||||||
// workscope: null,
|
// workscope: null,
|
||||||
|
@ -81,6 +112,7 @@
|
||||||
total_score: 0,
|
total_score: 0,
|
||||||
pass_score: 60,
|
pass_score: 60,
|
||||||
questions_: [],
|
questions_: [],
|
||||||
|
uo_questions: [],
|
||||||
danxuan_score: 2,
|
danxuan_score: 2,
|
||||||
danxuan_count: 0,
|
danxuan_count: 0,
|
||||||
duoxuan_score: 4,
|
duoxuan_score: 4,
|
||||||
|
@ -88,7 +120,13 @@
|
||||||
panduan_score: 2,
|
panduan_score: 2,
|
||||||
panduan_count: 0
|
panduan_count: 0
|
||||||
},
|
},
|
||||||
|
upUrl: upUrl(),
|
||||||
|
fileList: [],
|
||||||
|
upHeaders: upHeaders(),
|
||||||
submitLoding: false,
|
submitLoding: false,
|
||||||
|
impForm:{
|
||||||
|
doc_path:''
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||||
|
@ -118,6 +156,27 @@
|
||||||
this.workscopeData = response.data.results;
|
this.workscopeData = response.data.results;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleUpSuccess(res, file, filelist) {
|
||||||
|
if (res.code == 201){
|
||||||
|
// this.impForm.file = res.data.path;
|
||||||
|
this.impForm.doc_path = "C:\\code\\data\\test.docx";
|
||||||
|
console.log(this.impForm)
|
||||||
|
UploadPaper(this.impForm).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.up_questions == res.data;
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "上传成功"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRemove() {
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
|
},
|
||||||
submitForm(formName) {
|
submitForm(formName) {
|
||||||
this.$refs[formName].validate(valid => {
|
this.$refs[formName].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
@ -155,6 +214,9 @@
|
||||||
handleDelete(val) {
|
handleDelete(val) {
|
||||||
this.questions.splice(val, 1);
|
this.questions.splice(val, 1);
|
||||||
},
|
},
|
||||||
|
handleDeleteUp(val) {
|
||||||
|
this.up_questions.splice(val, 1);
|
||||||
|
},
|
||||||
calScore() {
|
calScore() {
|
||||||
let danxuan_count = 0,
|
let danxuan_count = 0,
|
||||||
duoxuan_count = 0,
|
duoxuan_count = 0,
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip">
|
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip">
|
||||||
<el-button size="small" type="primary">上传文件</el-button>
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>``
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="close_dialog">取消</el-button>
|
<el-button type="danger" @click="close_dialog">取消</el-button>
|
||||||
|
@ -352,7 +352,6 @@ export default {
|
||||||
handleUpSuccess(res, file, filelist) {
|
handleUpSuccess(res, file, filelist) {
|
||||||
this.Content.file = res.data.id;
|
this.Content.file = res.data.id;
|
||||||
this.impForm.file = res.data.path;
|
this.impForm.file = res.data.path;
|
||||||
|
|
||||||
},
|
},
|
||||||
handleRemove(file, filelist) {
|
handleRemove(file, filelist) {
|
||||||
this.Content.file = null;
|
this.Content.file = null;
|
||||||
|
|
Loading…
Reference in New Issue