zhangjie 2 年 前
コミット
01e00d944e

+ 43 - 1
src/assets/styles/pages.scss

@@ -972,7 +972,7 @@
   }
 }
 // build-paper-manual
-.build-paper-manual {
+.build-paper {
   .detail-header {
     flex-grow: 2;
     display: flex;
@@ -1002,6 +1002,48 @@
     padding-right: 10px;
   }
 }
+.question-group-struct {
+  overflow: hidden;
+  .struct-set {
+    margin: 10px 0;
+  }
+  .struct-box {
+    display: flex;
+    justify-content: space-between;
+    align-items: stretch;
+    height: 400px;
+  }
+  .struct-folder {
+    width: 300px;
+    overflow-x: hidden;
+    overflow-y: auto;
+    flex-flow: 0;
+    flex-shrink: 0;
+    padding: 10px;
+    border-radius: 5px;
+    background-color: $--color-background;
+    margin-right: 10px;
+
+    .el-tree {
+      background-color: $--color-background;
+    }
+  }
+  .struct-prop {
+    flex-grow: 2;
+    overflow-x: hidden;
+    overflow-y: auto;
+
+    .el-input-number {
+      width: 60px;
+      margin-right: 5px;
+
+      .el-input__inner {
+        border-radius: 3px;
+        padding: 3px 5px;
+      }
+    }
+  }
+}
 .detail-question {
   // &-part {
   //   padding: 10px 0;

+ 5 - 2
src/modules/paper/api.js

@@ -16,7 +16,10 @@ export const buildPaperApi = (datas) => {
   // return $httpWithMsg.post(`${QUESTION_API}/paper/build`, datas);
   return Promise.resolve(datas);
 };
+// export const questionGroupStructListApi = (datas) => {
+//   return $httpWithMsg.post(`${QUESTION_API}/paper/build`, datas);
+// };
+import folderPropStruct from "./datas/folderPropStruct.json";
 export const questionGroupStructListApi = (datas) => {
-  // return $httpWithMsg.post(`${QUESTION_API}/paper/build`, datas);
-  return Promise.resolve(datas);
+  return Promise.resolve({ data: folderPropStruct, filter: datas });
 };

+ 15 - 4
src/modules/paper/components/BuildPaperAuto.vue

@@ -19,8 +19,8 @@
     <el-collapse v-model="activeNames" accordion>
       <el-collapse-item
         v-for="(detail, index) in details"
-        :key="detail.questionKey"
-        :name="index"
+        :key="detail.id"
+        :name="detail.id"
       >
         <div slot="title" class="detail-header">
           <h3>{{ index + 1 }}、{{ detail.name }}</h3>
@@ -55,6 +55,9 @@
             <td>{{ detail.questionCount * detail.scorePerQuestion }}</td>
           </tr>
         </table>
+        <question-group-struct
+          :filter-data="{ courseId, questionType: detail.questionType }"
+        ></question-group-struct>
       </el-collapse-item>
     </el-collapse>
 
@@ -69,14 +72,22 @@
 
 <script>
 import ModifyDetailStruct from "../components/ModifyDetailStruct.vue";
+import QuestionGroupStruct from "./QuestionGroupStruct.vue";
 
 export default {
   name: "BuildPaperAuto",
-  components: { ModifyDetailStruct },
+  components: { ModifyDetailStruct, QuestionGroupStruct },
+  props: {
+    courseId: {
+      type: [String, Number],
+      default: "",
+    },
+  },
   data() {
     return {
       details: [],
       curDetail: {},
+      activeNames: [],
     };
   },
   methods: {
@@ -100,7 +111,7 @@ export default {
     detailModified(data) {
       const index = this.details.findIndex((item) => item.id === data.id);
       if (index === -1) {
-        this.details.push({ ...data, questions: [] });
+        this.details.push({ ...data, questionCount: 0 });
         if (!this.activeNames.includes(data.id)) this.activeNames.push(data.id);
       } else {
         this.$set(

+ 6 - 0
src/modules/paper/components/BuildPaperManual.vue

@@ -100,6 +100,12 @@ export default {
     BuildPaperQuestionBase,
     BuildPaperQuestionNested,
   },
+  props: {
+    courseId: {
+      type: [String, Number],
+      default: "",
+    },
+  },
   data() {
     return {
       // details: [],

+ 9 - 3
src/modules/paper/components/BuildPaperSimple.vue

@@ -32,11 +32,11 @@
       >
         <template slot-scope="scope">
           <el-input-number
-            v-model="scope.row.questionSelectCount"
+            v-model="scope.row.selectCount"
             placeholder="请输入抽取试题数量"
             :step="1"
             :min="1"
-            :max="999"
+            :max="scope.row.questionCount"
             :controls="false"
             :precision="0"
             step-strictly
@@ -71,6 +71,12 @@ import { questionDistributionStatisticsApi } from "../../question/api";
 
 export default {
   name: "BuildPaperSimple",
+  props: {
+    courseId: {
+      type: [String, Number],
+      default: "",
+    },
+  },
   data() {
     return {
       baseDataList: [],
@@ -100,7 +106,7 @@ export default {
             questionMainTypeName: mainGroup.questionMainTypeName,
             questionTypeName: quesItem.questionTypeName,
             questionCount: quesItem.questionCount,
-            questionSelectCount: undefined,
+            selectCount: undefined,
             questionScore: undefined,
           };
           if (index === 0) nitem.rowspan = rowspan;

+ 105 - 33
src/modules/paper/components/QuestionGroupStruct.vue

@@ -8,17 +8,31 @@
         >按难度抽题</el-checkbox
       >
       <el-checkbox v-model="isProperty" @change="setChange"
-        >按课程抽题</el-checkbox
+        >按课程属性抽题</el-checkbox
       >
+      <el-select
+        v-if="isProperty"
+        v-model="curCoursePropertyId"
+        class="margin-left-10"
+        size="small"
+      >
+        <el-option
+          v-for="item in propertyInfo"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id"
+        ></el-option>
+      </el-select>
     </div>
     <div class="struct-box">
-      <div class="struct-folder">
+      <div v-if="isClassify" class="struct-folder">
         <el-tree
           class="folder-tree"
           :data="folderTree"
           node-key="id"
           default-expand-all
           :expand-on-click-node="false"
+          check-on-click-node
           show-checkbox
           check-strictly
           :props="treeProps"
@@ -26,20 +40,32 @@
         ></el-tree>
       </div>
       <div class="struct-prop">
-        <el-table :data="tableData" :tree-props="tableTreeProps" row-key="id">
-          <el-table-column label="分类" prop="name"></el-table-column>
+        <el-table
+          :data="tableData"
+          :tree-props="tableTreeProps"
+          row-key="id"
+          border
+        >
+          <el-table-column label="分类" prop="name">
+            <template slot-scope="scope">
+              <i
+                v-if="scope.row.isClassify"
+                class="icon icon-files-act margin-right-5"
+              ></i>
+              <span class="inline-middle">{{ scope.row.name }}</span>
+            </template>
+          </el-table-column>
           <el-table-column
-            v-if="!isDifficult"
+            v-if="!isDifficult || IS_ONLY_DIFFICULT"
             label="数量"
-            width="200"
-            align="center"
+            width="150"
           >
             <template slot-scope="scope">
               <el-input-number
                 v-model="scope.row.selectCount"
-                class="search_width_80px"
+                size="mini"
                 :step="1"
-                :min="1"
+                :min="0"
                 :max="scope.row.questionCount"
                 :controls="false"
                 :precision="0"
@@ -53,13 +79,20 @@
             v-else
             :key="dindex"
             :label="dinfo"
+            width="150"
           >
-            <template slot-scope="scope">
+            <template
+              v-if="
+                scope.row.difficultDistributeInfo &&
+                !(scope.row.isClassify && isProperty)
+              "
+              slot-scope="scope"
+            >
               <el-input-number
                 v-model="scope.row.difficultDistributeInfo[dindex].selectCount"
-                class="search_width_80px"
+                size="mini"
                 :step="1"
-                :min="1"
+                :min="0"
                 :max="scope.row.difficultDistributeInfo[dindex].questionCount"
                 :controls="false"
                 :precision="0"
@@ -116,13 +149,11 @@ export default {
         hasChildren: "hasChildren",
       },
       difficultDistributeInfo: [],
-      curCoursePropertyName: "",
+      curCoursePropertyId: "",
+      propertyInfo: [],
     };
   },
   computed: {
-    IS_ONLY_FOLDER() {
-      return this.isClassify && !this.isDifficult && !this.isProperty;
-    },
     IS_ONLY_DIFFICULT() {
       return !this.isClassify && this.isDifficult && !this.isProperty;
     },
@@ -139,6 +170,9 @@ export default {
       },
     },
   },
+  mounted() {
+    this.resetDataList();
+  },
   methods: {
     setChange() {
       if (!this.isClassify) this.selectedFolderIds = [];
@@ -152,21 +186,15 @@ export default {
       await this.getOriginList();
 
       if (this.isProperty) {
-        const curCourseProp = this.originList.find(
-          (item) => item.coursePropertyName === this.curCoursePropertyName
-        );
-        if (!curCourseProp) {
-          this.curCoursePropertyName =
-            this.originList[0] && this.originList[0].coursePropertyName;
-        }
+        this.parsePropertyInfo();
       }
       this.buildDataList();
     },
     async getOriginList() {
       let data = {
         ...this.filterData,
-        difficult: this.isDifficult,
-        property: this.isProperty,
+        isDifficult: this.isDifficult,
+        isProperty: this.isProperty,
       };
       if (this.isClassify && this.selectedFolderIds.length)
         data.folderIds = this.selectedFolderIds;
@@ -174,14 +202,49 @@ export default {
       const res = await questionGroupStructListApi(data);
       this.originList = res.data || [];
     },
+    parsePropertyInfo() {
+      if (!this.isProperty) {
+        this.propertyInfo = [];
+        return;
+      }
+      let coursePropertyIds = [],
+        propertyInfo = [];
+      this.originList.forEach((item) => {
+        if (!item.propertyDistributeInfo || !item.propertyDistributeInfo.length)
+          return;
+
+        item.propertyDistributeInfo.forEach((prop) => {
+          if (coursePropertyIds.includes(prop.coursePropertyId)) return;
+          coursePropertyIds.push(prop.coursePropertyId);
+          propertyInfo.push({
+            id: prop.coursePropertyId,
+            name: prop.coursePropertyName,
+          });
+        });
+      });
+      this.propertyInfo = propertyInfo;
+
+      if (!propertyInfo.length) {
+        this.curCourseProp = {};
+        return;
+      }
+
+      const curCourseProp = propertyInfo.find(
+        (item) => item.coursePropertyId === this.curCoursePropertyId
+      );
+      if (!curCourseProp) {
+        this.curCoursePropertyId = propertyInfo[0].id;
+      }
+    },
     buildDataList() {
+      let _this = this;
       function buildClassifyData(data) {
         let classifyData = {
           id: data.classifyId,
           name: data.classifyName,
           classifyId: data.classifyId,
           classifyName: data.classifyName,
-          isFolder: true,
+          isClassify: true,
           questionCount: data.questionCount,
           selectCount: undefined,
           difficultDistributeInfo: null,
@@ -198,7 +261,7 @@ export default {
           return classifyData;
 
         const curCourseProp = data.propertyDistributeInfo.find(
-          (item) => item.coursePropertyName === this.curCoursePropertyName
+          (item) => item.coursePropertyId === _this.curCoursePropertyId
         );
         if (!curCourseProp) {
           return classifyData;
@@ -212,8 +275,8 @@ export default {
       }
 
       function parseQuestionDistributeInfo(data) {
-        if (!this.difficultDistributeInfo.length) {
-          this.difficultDistributeInfo = data.map(
+        if (!_this.difficultDistributeInfo.length) {
+          _this.difficultDistributeInfo = data.map(
             (item) => item.difficultLevel
           );
         }
@@ -254,13 +317,22 @@ export default {
 
       if (this.IS_ONLY_DIFFICULT) {
         this.tableData = this.dataList[0].difficultDistributeInfo;
-        this.tableData.forEach((elem) => {
-          elem.id = elem.name;
+        this.tableData.map((item) => {
+          let nitem = { ...item };
+          (item.id = item.difficultLevel), (item.name = item.difficultLevel);
+          return nitem;
         });
         return;
       }
-      if (this.IS_ONLY_PROPERTY) {
-        this.tableData = this.dataList[0].children;
+      if (this.isClassify && !this.isProperty) {
+        this.tableData = this.dataList.map((item) => {
+          let nitem = { ...item };
+          nitem.propertyDistributeInfo = [];
+          return nitem;
+        });
+      }
+      if (!this.isClassify && this.isProperty) {
+        this.tableData = this.dataList[0].propertyDistributeInfo;
         return;
       }
     },

ファイルの差分が大きいため隠しています
+ 14 - 3071
src/modules/paper/datas/folderPropStruct.json


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません