Quellcode durchsuchen

新增题型管理

zhangjie vor 2 Jahren
Ursprung
Commit
121f7bbe2c

+ 1 - 1
src/App.vue

@@ -81,7 +81,7 @@ export default {
         }
         this.onlineSignal();
 
-        const safeRoutes = ["QuestionManage"];
+        const safeRoutes = ["QuestionManage", "PaperManage"];
         if (
           this.user.safeEnable &&
           !this.user.questionUnlock &&

+ 1 - 1
src/components/selection/QuestionTypeSelect.vue

@@ -26,7 +26,7 @@ export default {
       default: "",
     },
     disabled: { type: Boolean, default: false },
-    placeholder: { type: String, default: "请选择题型" },
+    placeholder: { type: String, default: "请选择题型类型" },
     clearable: { type: Boolean, default: true },
   },
   data() {

+ 1 - 1
src/modules/paper-export/views/PaperTemplateManage.vue

@@ -146,7 +146,7 @@ export default {
 
       const res = await paperTemplatePageListApi({
         ...this.searchForm,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
 

+ 1 - 1
src/modules/paper/components/AuditPaperApply.vue

@@ -96,7 +96,7 @@ export default {
       this.loading = true;
       const res = await auditPaperApplyPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/paper/components/AuditPaperAudited.vue

@@ -91,7 +91,7 @@ export default {
       this.loading = true;
       const res = await auditPaperAuditedPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/paper/components/AuditPaperUnsubmit.vue

@@ -92,7 +92,7 @@ export default {
       this.loading = true;
       const res = await auditPaperUnsubmitPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/paper/components/AuditPaperWait.vue

@@ -127,7 +127,7 @@ export default {
       this.loading = true;
       const res = await auditPaperWaitPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/paper/components/PaperAuditInfo.vue

@@ -63,7 +63,7 @@ export default {
     async getList() {
       const res = await paperAuditInfoApi({
         paperId: this.paperId,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       if (!res) return;

+ 1 - 1
src/modules/paper/components/SelectQuestionDialog.vue

@@ -259,7 +259,7 @@ export default {
     async getList() {
       let data = {
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       };
       data.questionProperty = data.questionProperty.join();

+ 20 - 0
src/modules/question/api.js

@@ -246,3 +246,23 @@ export const questionSecurityCheckApi = (safePassword) => {
     }
   );
 };
+
+// source-detail
+export function sourceDetailPageListApi(data) {
+  const url = `${QUESTION_API}/source/detail/page`;
+  return $httpWithMsg.post(url, {}, { params: data });
+}
+export function deleteSourceDetailApi(ids) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/source/detail/delete`,
+    {},
+    { params: { ids: ids.join() } }
+  );
+}
+export function updateSourceDetailApi(data) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/source/detail/save`,
+    {},
+    { params: data }
+  );
+}

+ 1 - 1
src/modules/question/components/AuditQuestionApply.vue

@@ -117,7 +117,7 @@ export default {
       this.loading = true;
       const res = await auditQuestionApplyPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/question/components/AuditQuestionAudited.vue

@@ -111,7 +111,7 @@ export default {
       this.loading = true;
       const res = await auditQuestionAuditedPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/question/components/AuditQuestionUnsubmit.vue

@@ -115,7 +115,7 @@ export default {
       this.loading = true;
       const res = await auditQuestionsUnsubmitPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/question/components/AuditQuestionWait.vue

@@ -146,7 +146,7 @@ export default {
       this.loading = true;
       const res = await auditQuestionWaitPageListApi({
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       }).catch(() => {});
       this.loading = false;

+ 1 - 1
src/modules/question/components/FolderQuestionManageDialog.vue

@@ -249,7 +249,7 @@ export default {
       this.loading = true;
       let data = {
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       };
       data.propertyIdList = data.propertyIdList.join();

+ 141 - 0
src/modules/question/components/ModifySourceDetail.vue

@@ -0,0 +1,141 @@
+<template>
+  <el-dialog
+    custom-class="side-dialog"
+    :visible.sync="modalIsShow"
+    :title="title"
+    width="500px"
+    :modal="false"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      label-width="120px"
+    >
+      <el-form-item prop="name" label="题型名称">
+        <el-input
+          v-model="modalForm.name"
+          placeholder="请输入题型名称"
+          clearable
+        >
+        </el-input>
+      </el-form-item>
+      <el-form-item label="题型类型" prop="questionType">
+        <el-radio-group
+          v-model="modalForm.questionType"
+          size="medium"
+          style="line-height: 46px"
+        >
+          <el-radio
+            v-for="item in QUESTION_TYPES"
+            :key="item.code"
+            :label="item.code"
+            >{{ item.name }}</el-radio
+          >
+        </el-radio-group>
+      </el-form-item>
+    </el-form>
+
+    <div slot="footer">
+      <el-button type="primary" :disabled="loading" @click="confirm"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateSourceDetailApi } from "../api";
+import { QUESTION_TYPES } from "@/constants/constants";
+
+const initModalForm = {
+  id: "",
+  name: "",
+  courseId: "",
+  questionType: "",
+  rootOrgId: "",
+};
+
+export default {
+  name: "ModifySourceDetail",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      QUESTION_TYPES,
+      modalForm: {
+        ...initModalForm,
+      },
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "请输入来源大题名称",
+            trigger: "change",
+          },
+          {
+            max: 100,
+            message: "来源大题名称不能超过100",
+            trigger: "change",
+          },
+        ],
+        questionType: [
+          {
+            required: true,
+            message: "请输入试题类型",
+            trigger: "change",
+          },
+        ],
+      },
+      loading: false,
+    };
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "来源大题";
+    },
+  },
+  methods: {
+    visibleChange() {
+      this.modalForm = this.$objAssign(initModalForm, this.instance);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async confirm() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.loading) return;
+      this.loading = true;
+
+      const datas = { ...this.modalForm };
+      const res = await updateSourceDetailApi(datas).catch(() => {});
+      this.loading = false;
+      if (!res) return;
+
+      this.$message.success("修改成功!");
+      this.$emit("modified");
+      this.cancel();
+    },
+  },
+};
+</script>

+ 6 - 0
src/modules/question/router.js

@@ -1,5 +1,6 @@
 import QuestionManage from "./views/QuestionManage";
 import QuestionRecycle from "./views/QuestionRecycle";
+import SourceDetailManage from "./views/SourceDetailManage";
 
 export default [
   {
@@ -12,4 +13,9 @@ export default [
     name: "QuestionRecycle",
     component: QuestionRecycle,
   },
+  {
+    path: "/source-detail-manage",
+    name: "SourceDetailManage",
+    component: SourceDetailManage,
+  },
 ];

+ 28 - 2
src/modules/question/views/QuestionManage.vue

@@ -46,7 +46,20 @@
             @click="toSafetySet"
             >安全设置</el-button
           >
-          <el-button type="danger" @click="toRecycle">回收站</el-button>
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-setting"
+            @click="toSourceDetailManage"
+            >题型管理</el-button
+          >
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            @click="toRecycle"
+            >回收站</el-button
+          >
         </div>
         <div>
           <el-button
@@ -268,7 +281,7 @@ export default {
       this.loading = true;
       let data = {
         ...this.filter,
-        curPage: this.currentPage,
+        pageNumber: this.currentPage,
         pageSize: this.pageSize,
       };
       data.questionProperty = data.questionProperty.join();
@@ -295,6 +308,19 @@ export default {
     toSafetySet() {
       this.$refs.QuestionSafetySetDialog.open();
     },
+    toSourceDetailManage() {
+      if (!this.filter.courseId) {
+        this.$message.error("请先选择课程!");
+        return;
+      }
+      window.sessionStorage.setItem(
+        "courseInfo",
+        JSON.stringify(this.curCourse)
+      );
+      this.$router.push({
+        name: "SourceDetailManage",
+      });
+    },
     toCreateQuestion() {
       if (!this.filter.courseId) {
         this.$message.error("请先选择课程!");

+ 176 - 0
src/modules/question/views/SourceDetailManage.vue

@@ -0,0 +1,176 @@
+<template>
+  <div class="source-detail-manage">
+    <div class="part-box">
+      <h2 class="part-box-title">
+        题型管理 - {{ courseInfo.name }}({{ courseInfo.code }})
+      </h2>
+      <!-- 搜索 -->
+      <div class="box-justify">
+        <el-form class="part-filter-form" inline>
+          <el-form-item label="题型类型">
+            <question-type-select
+              v-model="searchForm.questionType"
+            ></question-type-select>
+          </el-form-item>
+          <el-form-item label="来源大题名称">
+            <el-input
+              v-model="searchForm.name"
+              placeholder="请输入来源大题名称"
+              maxlength="50"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="danger" @click="handleCurrentChange(1)">
+              查询
+            </el-button>
+          </el-form-item>
+        </el-form>
+
+        <div>
+          <el-button
+            type="primary"
+            plain
+            icon="icon icon-edit"
+            @click="toCreate"
+            >新建
+          </el-button>
+          <el-button
+            type="danger"
+            size="small"
+            plain
+            icon="icon icon-back"
+            @click="toback"
+            >返回</el-button
+          >
+        </div>
+      </div>
+    </div>
+
+    <div class="part-box">
+      <!-- 页面列表 -->
+      <el-table ref="table" :data="tableData">
+        <el-table-column prop="name" label="题型名称"> </el-table-column>
+        <el-table-column prop="questionTypeName" label="题型类型">
+        </el-table-column>
+        <el-table-column width="170" label="操作">
+          <template slot-scope="scope">
+            <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>
+          </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="handleCurrentChange"
+          @size-change="handleSizeChange"
+        />
+      </div>
+    </div>
+    <!-- ModifySourceDetail -->
+    <modify-source-detail
+      ref="ModifySourceDetail"
+      :instance="curRow"
+      @modified="search"
+    ></modify-source-detail>
+  </div>
+</template>
+
+<script>
+import { sourceDetailPageListApi, deleteSourceDetailApi } from "../api";
+
+import ModifySourceDetail from "../components/ModifySourceDetail.vue";
+
+export default {
+  name: "SourceDetailManage",
+  components: { ModifySourceDetail },
+  data() {
+    return {
+      loading: false,
+      searchForm: { name: "", questionType: "" },
+      tableData: [],
+      curRow: {},
+      currentPage: 1,
+      pageSize: 10,
+      total: 10,
+      courseInfo: {},
+      info: {},
+    };
+  },
+  mounted() {
+    let courseInfo = sessionStorage.getItem("courseInfo");
+    this.courseInfo = courseInfo ? JSON.parse(courseInfo) : {};
+    this.info = {
+      courseId: this.courseInfo.id,
+      rootOrgId: this.$store.state.user.rootOrgId,
+    };
+    this.search();
+  },
+  methods: {
+    async search() {
+      if (this.loading) return;
+      this.loading = true;
+
+      const res = await sourceDetailPageListApi({
+        ...this.searchForm,
+        ...this.info,
+        pageNumber: this.currentPage,
+        pageSize: this.pageSize,
+      }).catch(() => {});
+
+      this.loading = false;
+      if (!res) return;
+
+      this.tableData = res.data.content;
+      this.total = res.data.totalElements;
+    },
+    handleCurrentChange(val) {
+      console.log(val);
+      this.currentPage = val;
+      this.search();
+    },
+    handleSizeChange(val) {
+      this.currentPage = 1;
+      this.pageSize = val;
+      this.search();
+    },
+    toCreate() {
+      this.curRow = { ...this.info };
+      this.$refs.ModifySourceDetail.open();
+    },
+    toEdit(row) {
+      this.curRow = row;
+      this.$refs.ModifySourceDetail.open();
+    },
+    async toDelete(row) {
+      const confirm = await this.$confirm(`确定要删除该题型吗?`, "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await deleteSourceDetailApi([row.id]);
+      this.$message.success("删除成功!");
+      this.deletePageLastItem();
+    },
+    toback() {
+      window.history.go(-1);
+    },
+  },
+};
+</script>

+ 7 - 0
src/modules/questions/routes/routes.js

@@ -9,6 +9,7 @@ import PropertyInfo from "../views/PropertyInfo.vue";
 // import ImportPaper from "../views/ImportPaper.vue";
 import ImportPaper from "../../question/views/QuestionManage";
 import QuestionRecycle from "../../question/views/QuestionRecycle";
+import SourceDetailManage from "../../question/views/SourceDetailManage";
 import GenPaper from "../views/GenPaper.vue";
 import ImportPaperInfo from "../views/ImportPaperInfo.vue";
 // import GenPaperDetail from "../views/GenPaperDetail.vue";
@@ -119,6 +120,11 @@ export const menuRoutes = [
         component: QuestionRecycle,
         name: "QuestionRecycle",
       },
+      {
+        path: "source_detail_manage", // 题型管理
+        component: SourceDetailManage,
+        name: "SourceDetailManage",
+      },
       {
         path: "paper_pending_trial/:isClear", //题库待审列表
         component: QuestionAudit,
@@ -135,6 +141,7 @@ export const menuRoutes = [
       {
         path: "gen_paper/:isClear", //卷库试卷列表
         component: GenPaper,
+        name: "PaperManage",
       },
 
       {

+ 7 - 1
src/modules/questions/views/GenPaper.vue

@@ -88,7 +88,13 @@
             @click="openQuesPro"
             >试卷属性</el-button
           >
-          <el-button type="danger" @click="toRecycle">回收站</el-button>
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            @click="toRecycle"
+            >回收站</el-button
+          >
         </div>
         <div>
           <el-button