|
@@ -51,7 +51,7 @@
|
|
|
</el-select>
|
|
|
<p style="display: inline-block; margin-left: 40px">
|
|
|
难度:<span style="color: #409eff; font-weight: bold">{{
|
|
|
- curStruct?.difficulty
|
|
|
+ difficultyDegree
|
|
|
}}</span>
|
|
|
</p>
|
|
|
</el-form-item>
|
|
@@ -94,7 +94,7 @@
|
|
|
<el-option label="卷库来源" value="GENERATE"></el-option>
|
|
|
</el-select>
|
|
|
<span
|
|
|
- v-if="checked && !multipleSelection.length"
|
|
|
+ v-if="checked && !tempPapers.length"
|
|
|
class="red"
|
|
|
style="font-size: 12px; font-weight: bold; margin-left: 10px"
|
|
|
>请选择数据</span
|
|
@@ -102,6 +102,7 @@
|
|
|
</el-form-item>
|
|
|
<el-table
|
|
|
ref="table2"
|
|
|
+ v-loading="tableLoading2"
|
|
|
:data="tableData2"
|
|
|
border
|
|
|
@selection-change="handleSelectionChange"
|
|
@@ -121,6 +122,46 @@
|
|
|
>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <div class="page pull-right">
|
|
|
+ <el-pagination
|
|
|
+ :current-page="curSelect"
|
|
|
+ :page-size="pageSize"
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
+ :total="totalSelect"
|
|
|
+ @current-change="selectCurrentChange"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ <div style="clear: both; margin-top: 5px"></div>
|
|
|
+
|
|
|
+ <el-form
|
|
|
+ :inline="true"
|
|
|
+ label-position="right"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
+ <el-form-item label="选中列表" class="form-item"></el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-table :data="tempPapers" border>
|
|
|
+ <el-table-column label="名称" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.name }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ @click="removeSelected(scope.row.id)"
|
|
|
+ >移除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
</div>
|
|
|
<div style="width: 60%; padding-left: 20px">
|
|
|
<div style="color: #606266; font-size: 14px; line-height: 32px">
|
|
@@ -186,6 +227,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import qs from "qs";
|
|
|
+import { cloneDeep } from "lodash";
|
|
|
import { mapState } from "vuex";
|
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
|
import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
|
|
@@ -194,9 +236,14 @@ export default {
|
|
|
components: { LinkTitlesCustom },
|
|
|
data() {
|
|
|
return {
|
|
|
+ tempPapers: [],
|
|
|
+ tempPaperIds: [],
|
|
|
+ curSelect: 1,
|
|
|
+ totalSelect: 10,
|
|
|
+ pageSize: 10,
|
|
|
hasError: false,
|
|
|
form: {
|
|
|
- paperStructType: "BLUEPRINT",
|
|
|
+ paperStructType: "EXACT",
|
|
|
name: "",
|
|
|
paperStructId: "",
|
|
|
paperType: "IMPORT",
|
|
@@ -205,6 +252,7 @@ export default {
|
|
|
paperIdsArr: [],
|
|
|
options1: [],
|
|
|
tableData1: [],
|
|
|
+ difficultyDegree: "",
|
|
|
tableColumns1: [
|
|
|
{ label: "题型", prop: "detailName", minWidth: "100" },
|
|
|
{ label: "总分", prop: "totalScore", minWidth: "80" },
|
|
@@ -230,8 +278,10 @@ export default {
|
|
|
lastRequestKey: "",
|
|
|
tableLoading3: false,
|
|
|
tableLoading1: false,
|
|
|
+ tableLoading2: false,
|
|
|
checked: false,
|
|
|
initSelectedRows: [],
|
|
|
+ isEditInitPage: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -259,6 +309,7 @@ export default {
|
|
|
watch: {
|
|
|
"form.paperStructId"() {
|
|
|
this.structChange();
|
|
|
+ this.changePaperType(true);
|
|
|
},
|
|
|
// "form.paperStructType"() {
|
|
|
// this.form.paperStructId = "";
|
|
@@ -274,14 +325,19 @@ export default {
|
|
|
let res = await this.getTplData();
|
|
|
if (res) {
|
|
|
this.getStruct();
|
|
|
- this.getTable2(true);
|
|
|
+ // this.getTable2(true);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ selectCurrentChange(val) {
|
|
|
+ this.curSelect = val;
|
|
|
+ this.getTable2();
|
|
|
+ },
|
|
|
paperStructTypeChange() {
|
|
|
this.form.paperStructId = "";
|
|
|
this.getStruct();
|
|
|
this.tableData1 = [];
|
|
|
+ this.difficultyDegree = "";
|
|
|
this.$refs.table2.clearSelection();
|
|
|
},
|
|
|
async getTplData() {
|
|
@@ -298,10 +354,14 @@ export default {
|
|
|
}
|
|
|
);
|
|
|
const tplData = data.data;
|
|
|
- this.paperIdsArr = tplData.paperIds || [];
|
|
|
+ this.tempPaperIds = tplData.paperIds || [];
|
|
|
+ this.tempPapers = tplData.papers || [];
|
|
|
+ this.isEditInitPage = true;
|
|
|
Object.assign(this.form, tplData || {}, {
|
|
|
paperIds: (tplData.paperIds || []).join(","),
|
|
|
});
|
|
|
+ this.getTable2();
|
|
|
+ this.getTable3();
|
|
|
return true;
|
|
|
} catch (e) {
|
|
|
return false;
|
|
@@ -311,21 +371,23 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
back() {
|
|
|
- if (this.$route.params?.id) {
|
|
|
- this.$router.push("/questions/extract_paper_template");
|
|
|
- } else {
|
|
|
- this.$router.push("/questions/gen_paper/0");
|
|
|
- }
|
|
|
+ // if (this.$route.params?.id) {
|
|
|
+ this.$router.push("/questions/extract_paper_template");
|
|
|
+ // } else {
|
|
|
+ // this.$router.push("/questions/gen_paper/0");
|
|
|
+ // }
|
|
|
},
|
|
|
save() {
|
|
|
this.checked = true;
|
|
|
+ let paperIds = this.tempPaperIds.join(",");
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.multipleSelection.length && !this.hasError) {
|
|
|
+ if (this.tempPaperIds.length && !this.hasError) {
|
|
|
let params = {
|
|
|
courseId: this.$route.query.courseId,
|
|
|
...this.form,
|
|
|
rootOrgId: this.user.rootOrgId,
|
|
|
+ paperIds,
|
|
|
};
|
|
|
if (this.$route.params.id) {
|
|
|
params.id = this.$route.params.id;
|
|
@@ -334,7 +396,17 @@ export default {
|
|
|
.post("/api/ecs_ques/randompaper/save", qs.stringify(params))
|
|
|
.then(() => {
|
|
|
this.$message.success("保存成功");
|
|
|
- this.$router.back();
|
|
|
+ // this.$router.back();
|
|
|
+ this.$router.push("/questions/extract_paper_template");
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ if (
|
|
|
+ err.response &&
|
|
|
+ err.response.data &&
|
|
|
+ err.response.data.desc
|
|
|
+ ) {
|
|
|
+ this.$message.error(err.response.data.desc);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
@@ -358,6 +430,7 @@ export default {
|
|
|
})
|
|
|
.then((res) => {
|
|
|
this.tableData1 = res.data.structQuestionInfo || [];
|
|
|
+ this.difficultyDegree = res.data.difficultyDegree;
|
|
|
this.tableLoading1 = false;
|
|
|
});
|
|
|
},
|
|
@@ -375,39 +448,92 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- getTable2(bool) {
|
|
|
+ getTable2() {
|
|
|
+ this.tableLoading2 = true;
|
|
|
let apiUrl =
|
|
|
this.form.paperType === "IMPORT"
|
|
|
- ? "/api/ecs_ques/importPaper/huoge/1/10000"
|
|
|
- : "/api/ecs_ques/genPaper/huoge/1/10000";
|
|
|
+ ? "/api/ecs_ques/importPaper/huoge"
|
|
|
+ : "/api/ecs_ques/genPaper/huoge";
|
|
|
this.$http
|
|
|
- .get(apiUrl, {
|
|
|
- params: { courseNo: this.$route.query.courseNo, ids: "" },
|
|
|
- })
|
|
|
+ .get(
|
|
|
+ apiUrl +
|
|
|
+ `/${this.curSelect}/${this.pageSize}?courseNo=${this.$route.query.courseNo}&ids=${this.tempPaperIds}`,
|
|
|
+ {
|
|
|
+ // params: {
|
|
|
+ // courseNo: this.$route.query.courseNo,
|
|
|
+ // ids: this.tempPaperIds,
|
|
|
+ // },
|
|
|
+ }
|
|
|
+ )
|
|
|
.then((res) => {
|
|
|
this.tableData2 = res.data.content || [];
|
|
|
- if (bool) {
|
|
|
- this.tableData2.forEach((item) => {
|
|
|
- if (this.paperIdsArr.includes(item.id)) {
|
|
|
- this.initSelectedRows.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- this.initSelectedRows.forEach((item) => {
|
|
|
- this.$refs.table2.toggleRowSelection(item, true);
|
|
|
- });
|
|
|
- }, 0);
|
|
|
- }
|
|
|
+ this.totalSelect = res.data.totalElements;
|
|
|
+ // this.curSelect = res.data.number + 1;
|
|
|
+ // if (bool) {
|
|
|
+ // this.tableData2.forEach((item) => {
|
|
|
+ // if (this.paperIdsArr.includes(item.id)) {
|
|
|
+ // this.initSelectedRows.push(item);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.initSelectedRows.forEach((item) => {
|
|
|
+ // this.$refs.table2.toggleRowSelection(item, true);
|
|
|
+ // });
|
|
|
+ // }, 0);
|
|
|
+ // }
|
|
|
+ this.tableLoading2 = false;
|
|
|
});
|
|
|
},
|
|
|
- changePaperType() {
|
|
|
- this.tableData2 = [];
|
|
|
- this.multipleSelection = [];
|
|
|
+ removeSelected(id) {
|
|
|
+ for (let [index, paper] of this.tempPapers.entries()) {
|
|
|
+ if (id == paper.id) {
|
|
|
+ this.tempPapers.splice(index, 1);
|
|
|
+ this.tableData2.push(paper);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var i = 0; i < this.tempPaperIds.length; i++) {
|
|
|
+ if (this.tempPaperIds[i] == id) {
|
|
|
+ this.tempPaperIds.splice(i, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
this.getTable2();
|
|
|
+ this.getTable3();
|
|
|
+ },
|
|
|
+ changePaperType() {
|
|
|
+ console.log("changePaperType");
|
|
|
+ if (!this.isEditInitPage) {
|
|
|
+ this.tempPapers = [];
|
|
|
+ this.tempPaperIds = [];
|
|
|
+ this.tableData2 = [];
|
|
|
+ this.tableData3 = [];
|
|
|
+ this.multipleSelection = [];
|
|
|
+ this.curSelect = 1;
|
|
|
+ this.getTable2();
|
|
|
+ } else {
|
|
|
+ this.isEditInitPage = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (bool === true) {
|
|
|
+ // // this.handleSelectionChange([]);
|
|
|
+ // this.tempPapers = [];
|
|
|
+ // this.tempPaperIds = [];
|
|
|
+ // // this.$refs.table2.clearSelection();
|
|
|
+ // this.getTable3();
|
|
|
+ // } else {
|
|
|
+ // this.tableData2 = [];
|
|
|
+ // this.tempPapers = [];
|
|
|
+ // this.tempPaperIds = [];
|
|
|
+ // this.multipleSelection = [];
|
|
|
+ // this.curSelect = 1;
|
|
|
+ // this.getTable2();
|
|
|
+ // }
|
|
|
},
|
|
|
getTable3() {
|
|
|
- let paperIds = this.multipleSelection.map((item) => item.id);
|
|
|
- if (!paperIds.length) {
|
|
|
+ // let paperIds = this.multipleSelection.map((item) => item.id);
|
|
|
+ // if (!paperIds.length) {
|
|
|
+ if (!this.tempPaperIds.length) {
|
|
|
this.tableData3 = [];
|
|
|
this.tableLoading3 = false;
|
|
|
return false;
|
|
@@ -419,7 +545,7 @@ export default {
|
|
|
.post(
|
|
|
"/api/ecs_ques/randompaper/struct/question/view/info",
|
|
|
qs.stringify({
|
|
|
- paperIds: paperIds.join(","),
|
|
|
+ paperIds: this.tempPaperIds.join(","),
|
|
|
structId: this.form.paperStructId,
|
|
|
}),
|
|
|
{
|
|
@@ -435,8 +561,15 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
handleSelectionChange(val) {
|
|
|
- this.multipleSelection = val;
|
|
|
- this.getTable3();
|
|
|
+ // this.multipleSelection = val;
|
|
|
+ if (val.length) {
|
|
|
+ val.forEach((element) => {
|
|
|
+ this.tempPapers.push(cloneDeep(element));
|
|
|
+ this.tempPaperIds.push(element.id);
|
|
|
+ });
|
|
|
+ this.getTable2();
|
|
|
+ this.getTable3();
|
|
|
+ }
|
|
|
},
|
|
|
hasNumError(row) {
|
|
|
return (
|