zhangjie 2 anos atrás
pai
commit
1637ec9a61

+ 5 - 0
src/constants/constants.js

@@ -147,6 +147,11 @@ export const QUESTION_TYPES = [
   { code: "PARAGRAPH_MATCHING", name: "段落匹配" },
   { code: "BANKED_CLOZE", name: "选词填空" },
 ];
+export const QUESTION_MAIN_TYPE = [
+  { code: "BASICS", name: "基础题型" },
+  { code: "COMBINATION", name: "组合题型" },
+  { code: "SPECIAL", name: "特殊题型" },
+];
 export const BASE_QUESTION_TYPES = [
   { code: "SINGLE_ANSWER_QUESTION", name: "单选" },
   { code: "MULTIPLE_ANSWER_QUESTION", name: "多选" },

+ 16 - 0
src/filters/filters.js

@@ -5,6 +5,8 @@ import {
   AUDIT_AUTHORITY,
   PAPER_AUDIT_STATUS,
   PAPER_TEMPLATE_TYPE,
+  QUESTION_MAIN_TYPE,
+  QUESTION_TYPES,
 } from "@/constants/constants";
 
 // 课程层次过滤器
@@ -34,3 +36,17 @@ Vue.filter("paperAuditStatusFilter", function (val) {
 Vue.filter("paperTempalteTypeFilter", function (val) {
   return PAPER_TEMPLATE_TYPE[val] || "";
 });
+Vue.filter("questionMainTypeFilter", function (val) {
+  for (let examType of QUESTION_MAIN_TYPE) {
+    if (examType.code === val) {
+      return examType.name;
+    }
+  }
+});
+Vue.filter("questionTypeFilter", function (val) {
+  for (let examType of QUESTION_TYPES) {
+    if (examType.code === val) {
+      return examType.name;
+    }
+  }
+});

+ 9 - 0
src/modules/paper/api.js

@@ -144,3 +144,12 @@ export const submitPaperApi = (paperIds) => {
     { params: { paperIds } }
   );
 };
+
+// build-paper
+export const paperSimpleTypeDistributeApi = (courseId) => {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/gen/paper/simple/type/distribute`,
+    {},
+    { params: { courseId } }
+  );
+};

+ 59 - 13
src/modules/paper/components/BuildPaperSimple.vue

@@ -7,16 +7,51 @@
       <el-table-column label="题型" align="center">
         <el-table-column
           label="题型大类"
-          prop="questionMainTypeName"
+          prop="quesMainType"
           align="center"
-          min-width="120"
-        ></el-table-column>
+          width="120"
+        >
+          <span slot-scope="scope">{{
+            scope.row.quesMainType | questionMainTypeFilter
+          }}</span>
+        </el-table-column>
         <el-table-column
           label="题型小类"
-          prop="questionTypeName"
+          prop="questionType"
+          align="center"
+          min-width="240"
+        >
+          <div slot-scope="scope" class="box-justify">
+            <div>{{ scope.row.quesStructType | questionTypeFilter }}</div>
+
+            <el-select
+              v-model="
+                questionTypeSources[scope.row.quesStructType].detailNames
+              "
+              class="dialog-input-width"
+              filterable
+              multiple
+              placeholder="选择大题来源"
+              @change="sourceInfoChange(scope.row.quesStructType)"
+            >
+              <el-option
+                v-for="item in questionTypeSources[scope.row.quesStructType]
+                  .sourceInfoList"
+                :key="item.detailName"
+                :value="item.detailName"
+                :label="item.detailName"
+              ></el-option>
+            </el-select>
+          </div>
+        </el-table-column>
+        <el-table-column
+          label="大题来源"
+          prop="detailName"
           align="center"
           min-width="120"
-        ></el-table-column>
+        >
+          <span slot-scope="scope">{{ scope.row.detailName }}</span>
+        </el-table-column>
       </el-table-column>
       <el-table-column
         label="试题数量"
@@ -69,7 +104,7 @@
 </template>
 
 <script>
-import { questionDistributionStatisticsApi } from "../../question/api";
+import { paperSimpleTypeDistributeApi } from "../api";
 
 export default {
   name: "BuildPaperSimple",
@@ -82,6 +117,7 @@ export default {
   data() {
     return {
       baseDataList: [],
+      questionTypeSources: {},
     };
   },
   mounted() {
@@ -97,25 +133,35 @@ export default {
       }
     },
     async getBaseData() {
-      const res = await questionDistributionStatisticsApi(this.courseId);
+      const res = await paperSimpleTypeDistributeApi(this.courseId);
       // console.log(res.data);
       // parse data
       let baseDataList = [];
+      let questionTypeSources = {};
       res.data.forEach((mainGroup) => {
-        const rowspan = mainGroup.questionTypeStatisticList.length;
-        mainGroup.questionTypeStatisticList.forEach((quesItem, index) => {
+        let qtRowspan = mainGroup.quesTypeDistributeList.length;
+        mainGroup.quesTypeDistributeList.forEach((quesItem, qindex) => {
           let nitem = {
-            questionMainTypeName: mainGroup.questionMainTypeName,
-            questionTypeName: quesItem.questionTypeName,
-            questionCount: quesItem.questionCount,
+            quesMainType: mainGroup.quesMainType,
+            quesStructType: quesItem.quesStructType,
+            detailName: "",
+            questionCount: undefined,
             selectCount: undefined,
             questionScore: undefined,
           };
-          if (index === 0) nitem.rowspan = rowspan;
+          if (qindex === 0) nitem.rowspan = qtRowspan;
           baseDataList.push(nitem);
+          questionTypeSources[quesItem.quesStructType] = {
+            detailNames: [],
+            sourceInfoList: quesItem.sourceInfoList || [],
+          };
         });
       });
       this.baseDataList = baseDataList;
+      this.questionTypeSources = questionTypeSources;
+    },
+    sourceInfoChange(quesStructType) {
+      console.log(quesStructType);
     },
     getData() {
       return this.baseDataList;

+ 19 - 11
src/modules/paper/views/BuildPaper.vue

@@ -73,8 +73,8 @@
             <el-input-number
               v-model="modalForm.maxLimit"
               style="width: 125px"
-              :min="1"
-              :max="10"
+              :min="0"
+              :max="100"
               :step="1"
               step-strictly
               :controls="false"
@@ -93,8 +93,8 @@
             <el-input-number
               v-model="modalForm.timeLimit"
               style="width: 125px"
-              :min="1"
-              :max="10"
+              :min="0"
+              :max="100"
               :step="1"
               step-strictly
               :controls="false"
@@ -135,6 +135,20 @@ import BuildPaperManual from "../components/BuildPaperManual.vue";
 import BuildPaperSimple from "../components/BuildPaperSimple.vue";
 import { buildPaperApi } from "../api";
 
+const initModalForm = {
+  courseId: "",
+  courseCode: "",
+  courseName: "",
+  paperName: "",
+  genNumber: 1,
+  genModelType: "simple",
+  checkRepeat: false,
+  storage: false,
+  maxLimit: 0,
+  topicOnly: false,
+  timeLimit: 0,
+};
+
 export default {
   name: "BuildPaper",
   components: { BuildPaperAuto, BuildPaperManual, BuildPaperSimple },
@@ -142,13 +156,7 @@ export default {
     return {
       loading: false,
       modalForm: {
-        courseId: "",
-        courseCode: "",
-        courseName: "",
-        paperName: "",
-        genNumber: 1,
-        topicRepeat: false,
-        genModelType: "auto",
+        ...initModalForm,
       },
       rules: {
         paperName: [

+ 6 - 6
src/modules/question/api.js

@@ -30,8 +30,8 @@ export const propertyTreeQueryApi = (coursePropertyId) => {
 
 // question-manage
 export function questionPageListApi(data) {
-  const url = `${QUESTION_API}/question/classify/find_classify_content`;
-  return $httpWithMsg.post(url, {}, { params: data });
+  const url = `${QUESTION_API}/question/question/page`;
+  return $httpWithMsg.get(url, { params: data });
 }
 export function classifyQuestionPageListApi(data) {
   const url = `${QUESTION_API}/question/classify/find_current_classify_question_page`;
@@ -160,7 +160,7 @@ export function clearQuestionRecycleApi() {
 // question-audit
 export const auditQuestionWaitPageListApi = (datas) => {
   return $httpWithMsg.post(
-    `${QUESTION_API}/find_pending_trial_question`,
+    `${QUESTION_API}/question/find_pending_trial_question`,
     {},
     {
       params: datas,
@@ -169,7 +169,7 @@ export const auditQuestionWaitPageListApi = (datas) => {
 };
 export const auditQuestionAuditedPageListApi = (datas) => {
   return $httpWithMsg.post(
-    `${QUESTION_API}/find_my_audit_question`,
+    `${QUESTION_API}/question/find_my_audit_question`,
     {},
     {
       params: datas,
@@ -178,7 +178,7 @@ export const auditQuestionAuditedPageListApi = (datas) => {
 };
 export const auditQuestionApplyPageListApi = (datas) => {
   return $httpWithMsg.post(
-    `${QUESTION_API}/find_my_question_status`,
+    `${QUESTION_API}/question/find_my_question_status`,
     {},
     {
       params: datas,
@@ -187,7 +187,7 @@ export const auditQuestionApplyPageListApi = (datas) => {
 };
 export const auditQuestionsUnsubmitPageListApi = (datas) => {
   return $httpWithMsg.post(
-    `${QUESTION_API}/find_will_submit_question`,
+    `${QUESTION_API}/question/find_will_submit_question`,
     {},
     {
       params: datas,

+ 10 - 8
src/modules/question/views/QuestionManage.vue

@@ -14,11 +14,14 @@
           </question-type-select>
         </el-form-item>
         <el-form-item label="题目内容">
-          <el-input v-model="filter.content" placeholder="题目内容"></el-input>
+          <el-input
+            v-model="filter.questionBody"
+            placeholder="题目内容"
+          ></el-input>
         </el-form-item>
         <el-form-item label="属性">
           <property-tree-select
-            v-model="filter.propertyIdList"
+            v-model="filter.questionProperty"
             :course-id="filter.courseId"
           ></property-tree-select>
         </el-form-item>
@@ -236,11 +239,10 @@ export default {
   data() {
     return {
       filter: {
-        classifyId: null,
         courseId: "",
         questionType: "",
-        content: "",
-        propertyIdList: [],
+        questionBody: "",
+        questionProperty: [],
       },
       curFolderAction: "",
       folderList: [],
@@ -270,12 +272,12 @@ export default {
         curPage: this.currentPage,
         pageSize: this.pageSize,
       };
-      data.propertyIdList = data.propertyIdList.join();
+      data.questionProperty = data.questionProperty.join();
       const res = await questionPageListApi(data).catch(() => {});
       this.loading = false;
       if (!res) return;
-      this.questionList = res.data.questionPageResult.content;
-      this.total = res.data.questionPageResult.totalElements;
+      this.questionList = res.data.content;
+      this.total = res.data.totalElements;
     },
     handleSizeChange(val) {
       this.pageSize = val;