|
@@ -25,7 +25,22 @@
|
|
</div>
|
|
</div>
|
|
<el-table :data="papers" stripe style="width: 100%;">
|
|
<el-table :data="papers" stripe style="width: 100%;">
|
|
<el-table-column label="试卷名称">
|
|
<el-table-column label="试卷名称">
|
|
- <span slot-scope="scope">{{ scope.row.name }}</span>
|
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-select
|
|
|
|
+ v-if="scope.row.isHandleAdd"
|
|
|
|
+ v-model="scope.row.id"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ @change="selectPaperChange(scope)"
|
|
|
|
+ >
|
|
|
|
+ <ol-option
|
|
|
|
+ v-for="paper in paperSources"
|
|
|
|
+ :key="paper.id"
|
|
|
|
+ :value="paper.id"
|
|
|
|
+ :label="paper.name"
|
|
|
|
+ ></ol-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ <span v-else>{{ scope.row.name }}</span>
|
|
|
|
+ </template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column width="100" label="分值">
|
|
<el-table-column width="100" label="分值">
|
|
<span slot-scope="scope">{{ scope.row.totalScore }}</span>
|
|
<span slot-scope="scope">{{ scope.row.totalScore }}</span>
|
|
@@ -59,7 +74,7 @@
|
|
<el-table-column label="操作" width="100">
|
|
<el-table-column label="操作" width="100">
|
|
<div slot-scope="scope">
|
|
<div slot-scope="scope">
|
|
<el-button size="mini" type="danger" plain @click="toDelete(scope)">
|
|
<el-button size="mini" type="danger" plain @click="toDelete(scope)">
|
|
- 编辑
|
|
|
|
|
|
+ 删除
|
|
</el-button>
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -100,6 +115,7 @@ import {
|
|
searchPapers,
|
|
searchPapers,
|
|
saveCourse,
|
|
saveCourse,
|
|
savePapers,
|
|
savePapers,
|
|
|
|
+ searchUnionPapers,
|
|
} from "@/api/examwork-course";
|
|
} from "@/api/examwork-course";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -115,6 +131,7 @@ export default {
|
|
refreshCourse: {},
|
|
refreshCourse: {},
|
|
papers: [],
|
|
papers: [],
|
|
loading: false,
|
|
loading: false,
|
|
|
|
+ paperSources: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -123,11 +140,16 @@ export default {
|
|
handler() {
|
|
handler() {
|
|
this.refreshCourse = {};
|
|
this.refreshCourse = {};
|
|
this.papers = [];
|
|
this.papers = [];
|
|
|
|
+ this.getPaperSources();
|
|
this.initData();
|
|
this.initData();
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ async getPaperSources() {
|
|
|
|
+ const res = await searchUnionPapers(this.course.courseCode);
|
|
|
|
+ this.paperSources = res.data || [];
|
|
|
|
+ },
|
|
async initData() {
|
|
async initData() {
|
|
if (!this.course?.examId) return;
|
|
if (!this.course?.examId) return;
|
|
const courseRes = await searchCourses({
|
|
const courseRes = await searchCourses({
|
|
@@ -159,11 +181,22 @@ export default {
|
|
totalScore: null,
|
|
totalScore: null,
|
|
weight: 100,
|
|
weight: 100,
|
|
audioPlayCount: 2,
|
|
audioPlayCount: 2,
|
|
|
|
+ isHandleAdd: true,
|
|
});
|
|
});
|
|
},
|
|
},
|
|
toDelete({ $index }) {
|
|
toDelete({ $index }) {
|
|
this.papers.splice($index, 1);
|
|
this.papers.splice($index, 1);
|
|
},
|
|
},
|
|
|
|
+ selectPaperChange({ row, $index }) {
|
|
|
|
+ const sPapers = this.papers
|
|
|
|
+ .filter((item, index) => index !== $index)
|
|
|
|
+ .map((item) => item.id);
|
|
|
|
+ if (sPapers.includes(row.id)) {
|
|
|
|
+ row.id = null;
|
|
|
|
+ this.$message.error("当前试卷已经被选择!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async submitForm() {
|
|
async submitForm() {
|
|
try {
|
|
try {
|
|
const totalWieght = this.papers
|
|
const totalWieght = this.papers
|