123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <template>
- <div>
- <el-dialog
- :visible.sync="modalIsShow"
- title="试卷结构列表"
- :modal="true"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- fullscreen
- @opened="dialogOpened"
- >
- <!-- 正文信息 -->
- <div class="part-box">
- <el-form class="part-filter-form" :inline="true" :model="filter">
- <el-form-item label="课程名称">
- <course-select v-model="filter.courseId" :disabled="!!courseId">
- </course-select>
- </el-form-item>
- <el-form-item label="结构名称">
- <el-input
- v-model="filter.structName"
- placeholder="结构名称"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="toPage(1)">查询</el-button>
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- @click="toBatchDelete"
- >批量删除</el-button
- >
- </div>
- </div>
- <div class="part-box">
- <el-table
- v-loading="loading"
- element-loading-text="加载中"
- :data="dataList"
- @selection-change="tableSelectChange"
- >
- <el-table-column
- type="selection"
- width="50"
- align="center"
- ></el-table-column>
- <el-table-column label="试卷结构名称" prop="structName">
- </el-table-column>
- <el-table-column label="关联课程">
- <template slot-scope="scope">
- <span
- >{{ scope.row.courseName }}({{ scope.row.courseCode }})</span
- >
- </template>
- </el-table-column>
- <el-table-column label="大题数" prop="detailCount" width="100">
- </el-table-column>
- <el-table-column label="小题数" prop="questionCount" width="100">
- </el-table-column>
- <el-table-column label="总分" prop="totalScore" width="100">
- </el-table-column>
- <el-table-column label="创建人" prop="creatorName" width="120">
- </el-table-column>
- <el-table-column label="创建时间" width="170" prop="creationTime">
- </el-table-column>
- <el-table-column label="操作" width="220" fixed="right">
- <template slot-scope="scope">
- <div class="operate_left">
- <el-button
- size="mini"
- type="primary"
- plain
- @click="toUse(scope.row)"
- >使用</el-button
- >
- <el-button
- size="mini"
- type="primary"
- plain
- @click="toEdit(scope.row)"
- >编辑</el-button
- >
- <el-button
- size="mini"
- type="danger"
- plain
- @click="toDelete(scope.row)"
- >删除</el-button
- >
- </div>
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- :current-page="currentPage"
- :page-size="pageSize"
- :page-sizes="[10, 20, 50, 100, 200, 300]"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- @current-change="toPage"
- @size-change="handleSizeChange"
- >
- </el-pagination>
- </div>
- </div>
- </el-dialog>
- <!-- ModifyAutoBuildPaperStruct -->
- <modify-auto-build-paper-struct
- ref="ModifyAutoBuildPaperStruct"
- :instance="curRow"
- @modified="getList"
- ></modify-auto-build-paper-struct>
- </div>
- </template>
- <script>
- import {
- autoBuildPaperStructPageListApi,
- autoBuildPaperStructDeleteApi,
- } from "../api";
- import ModifyAutoBuildPaperStruct from "./ModifyAutoBuildPaperStruct.vue";
- export default {
- name: "AutoBuildPaperStructManage",
- components: { ModifyAutoBuildPaperStruct },
- props: {
- courseId: {
- type: [String, Number],
- default: "",
- },
- },
- data() {
- return {
- modalIsShow: false,
- loading: false,
- filter: {
- courseId: "",
- structName: "",
- },
- dataList: [],
- currentPage: 1,
- pageSize: 10,
- total: 0,
- curRow: {},
- selectedQuestionIds: [],
- };
- },
- methods: {
- dialogOpened() {
- this.filter.courseId = this.courseId;
- this.toPage(1);
- },
- cancel() {
- this.modalIsShow = false;
- },
- open() {
- this.modalIsShow = true;
- },
- toPage(page) {
- this.currentPage = page;
- this.getList();
- },
- async getList() {
- this.loading = true;
- let data = {
- ...this.filter,
- curPage: this.currentPage,
- pageSize: this.pageSize,
- };
- const res = await autoBuildPaperStructPageListApi(data).catch(() => {});
- this.loading = false;
- if (!res) return;
- this.dataList = res.data.content;
- this.total = res.data.totalElements;
- },
- handleSizeChange(val) {
- this.pageSize = val;
- this.toPage(1);
- },
- tableSelectChange(selections) {
- this.selectedQuestionIds = selections.map((item) => item.id);
- },
- toUse(row) {
- this.$emit("selected", row);
- this.cancel();
- },
- toEdit(row) {
- this.curRow = row;
- this.$refs.ModifyAutoBuildPaperStruct.open();
- },
- async toDelete(row) {
- const confirm = await this.$confirm("确认删除结构吗?", "提示", {
- type: "warning",
- }).catch(() => {});
- if (confirm !== "confirm") return;
- this.deleteStruct([row.id]);
- },
- async deleteStruct(ids) {
- this.loading = true;
- const res = await autoBuildPaperStructDeleteApi(ids.join()).catch(
- () => {}
- );
- this.loading = false;
- if (!res) return;
- this.$message.success("删除成功");
- this.getList();
- },
- async toBatchDelete() {
- if (!this.selectedQuestionIds.length) {
- this.$message.error("请选择试题!");
- return;
- }
- const confirm = await this.$confirm("确认删除选中数据吗?", "提示", {
- type: "warning",
- }).catch(() => {});
- if (confirm !== "confirm") return;
- this.deleteStruct(this.selectedQuestionIds);
- },
- },
- };
- </script>
|