zhangjie 3 hónapja
szülő
commit
73d1c3eb90

+ 35 - 0
src/assets/styles/pages.scss

@@ -931,10 +931,14 @@
 .modify-mark-params {
   .el-dialog {
     background-color: $--color-background;
+    overflow: hidden;
 
     &.is-fullscreen {
       .el-dialog__body {
         padding: 70px 20px 20px;
+        height: 100%;
+        display: flex;
+        flex-direction: column;
       }
     }
     .el-dialog__title {
@@ -942,6 +946,37 @@
       margin-right: 20px;
     }
   }
+  .mark-param-head {
+    flex: 0;
+  }
+  .mark-param-body {
+    flex: 1;
+    overflow: hidden;
+    display: flex;
+    flex-direction: column;
+
+    > .part-box {
+      flex: 0;
+    }
+
+    .structure-body {
+      flex: 1;
+      margin: 0;
+    }
+    .group-body,
+    .class-body {
+      flex: 1;
+      margin: 0;
+      overflow-x: hidden;
+      overflow-y: auto;
+    }
+
+    .obj-answer-body {
+      flex: 1;
+      margin: 0;
+    }
+  }
+
   .step-title.el-button {
     outline: none;
     border: none;

+ 3 - 1
src/modules/mark/components/ModifyMarkSetting.vue

@@ -257,7 +257,9 @@ export default {
     },
     async getDefaultSheetConfig() {
       const detData = await cardDetail(this.instance.cardId);
-      const cardContent = JSON.parse(detData.content);
+      const cardContent = detData?.content
+        ? JSON.parse(detData.content)
+        : { pages: [] };
       const areas = [];
       cardContent.pages.forEach((item, index) => {
         if (item.exchange.info_area && item.exchange.info_area.length) {

+ 1 - 1
src/modules/mark/components/markParam/MarkParamClass.vue

@@ -29,7 +29,7 @@
         <el-button type="primary" @click="toNext(1)">下一步</el-button>
       </div>
     </div>
-    <div v-if="classMarkIsOpen" class="part-box part-box-pad">
+    <div v-if="classMarkIsOpen" class="part-box part-box-pad class-body">
       <el-table :data="dataList" border>
         <el-table-column type="index" width="50"> </el-table-column>
 

+ 1 - 1
src/modules/mark/components/markParam/MarkParamGroup.vue

@@ -14,7 +14,7 @@
       </div>
     </div>
 
-    <div class="part-box part-box-pad">
+    <div class="part-box part-box-pad group-body">
       <el-table
         :data="subjectiveTaskList"
         border

+ 21 - 2
src/modules/mark/components/markParam/MarkParamObjectiveAnswer.vue

@@ -27,20 +27,21 @@
             :label="`${item}卷`"
           ></el-option>
         </el-select>
+        <el-button type="primary" @click="toPrev(1)">上一步</el-button>
         <el-button type="primary" @click="toImport">导入标答</el-button>
         <el-button type="primary" :disabled="loading" @click="submit"
           >提交</el-button
         >
-        <el-button type="primary" @click="toPrev(1)">上一步</el-button>
       </div>
     </div>
 
-    <div class="part-box part-box-pad">
+    <div class="part-box part-box-pad obj-answer-body">
       <el-table
         ref="TableList"
         :data="tableData"
         :row-class-name="getRowClassName"
         border
+        :height="tableHeight"
       >
         <el-table-column width="50" align="center">
           <template slot-scope="scope" v-if="scope.row.mainFirstSub">
@@ -230,6 +231,7 @@ export default {
       paperTypes: [],
       curPaperType: "A",
       prevPaperType: "A",
+      tableHeight: 200,
       // import
       uploadUrl: "/api/admin/mark/question/objective/import",
       dfilename: "客观题标答导入模板.xlsx",
@@ -248,6 +250,7 @@ export default {
   },
   mounted() {
     this.initData();
+    this.registResize();
   },
   methods: {
     async initData(defaultPaperType = null) {
@@ -297,6 +300,7 @@ export default {
       this.tableData = this.tableDict[this.curPaperType];
 
       this.cacheDataMd5 = this.getSubmitDataMd5();
+      this.updateTableHeight();
     },
     getSubmitDataMd5() {
       return MD5(JSON.stringify(this.tableDict));
@@ -476,6 +480,21 @@ export default {
       if (!res) return;
       this.$emit("prev", step);
     },
+    // table height
+    updateTableHeight() {
+      this.$nextTick(() => {
+        if (!this.$refs.TableList) return;
+        const tableOffsetTop = this.$refs.TableList.$el.offsetTop;
+        this.tableHeight = window.innerHeight - tableOffsetTop - 45;
+        // console.log(this.tableHeight);
+      });
+    },
+    registResize() {
+      window.addEventListener("resize", this.updateTableHeight);
+    },
+  },
+  beforeDestroy() {
+    window.removeEventListener("resize", this.updateTableHeight);
   },
 };
 </script>

+ 27 - 11
src/modules/mark/components/markParam/MarkParamStructure.vue

@@ -27,10 +27,10 @@
       </div>
     </div>
 
-    <div class="part-box part-box-pad mb-0">
+    <div class="part-box part-box-pad structure-body">
       <div class="box-justify mb-2">
         <div>
-          <el-button v-if="structureEditable" type="primary" @click="toAddMain"
+          <el-button v-if="editOpen" type="primary" @click="toAddMain"
             >新增大题</el-button
           >
         </div>
@@ -45,6 +45,7 @@
         border
         :row-class-name="getRowClassName"
         :key="tableKey"
+        :height="tableHeight"
       >
         <el-table-column width="50" align="center">
           <template slot-scope="scope" v-if="scope.row.mainFirstSub">
@@ -61,7 +62,7 @@
             </div>
           </template>
         </el-table-column>
-        <template v-if="structureEditable">
+        <template v-if="editOpen">
           <el-table-column prop="mainTitle" label="大题名称">
             <span slot-scope="scope" v-if="scope.row.mainFirstSub">
               <el-input
@@ -230,7 +231,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          v-if="structureEditable"
+          v-if="editOpen"
           class-name="action-column"
           label="操作"
           width="140px"
@@ -293,12 +294,12 @@ export default {
       editOpen: false,
       tableKey: "",
       hasMarkerQuestions: [],
+      tableHeight: 200,
     };
   },
   computed: {
     ...mapState("markParam", [
       "basicInfo",
-      "structureCanEdit",
       "paperStructureInfo",
       "subjectiveTaskList",
     ]),
@@ -326,23 +327,21 @@ export default {
         objectiveQuestionCount: questionCount - subjectiveQuestionCount,
       };
     },
-    structureEditable() {
-      return this.structureCanEdit || this.editOpen;
-    },
   },
   watch: {
-    structureEditable() {
+    editOpen() {
       this.tableKey = this.$randomCode();
+      this.updateTableHeight();
     },
   },
   mounted() {
     this.initData();
+    this.registResize();
   },
   methods: {
     ...mapMutations("markParam", ["setPaperStructureInfo"]),
     initData() {
       this.tableKey = this.$randomCode();
-      this.editOpen = this.structureCanEdit;
       this.hasMarkerQuestions = this.subjectiveTaskList
         .filter((item) => item.markers.length)
         .map((item) => `${item.mainNumber}-${item.subNumber}`);
@@ -384,10 +383,12 @@ export default {
       this.scoresPerTopic = scoresPerTopic;
       this.intervalScorePerTopic = intervalScorePerTopic;
 
-      if (!this.tableData.length && this.structureEditable) {
+      if (!this.tableData.length && this.editOpen) {
         this.createMain();
       }
       this.cacheDataMd5 = this.getSubmitDataMd5();
+
+      this.updateTableHeight();
     },
     getSubmitDataMd5() {
       return MD5(JSON.stringify(this.getData()));
@@ -690,6 +691,21 @@ export default {
       }
       this.$emit("next", step);
     },
+    // table height
+    updateTableHeight() {
+      this.$nextTick(() => {
+        if (!this.$refs.TableList) return;
+        const tableOffsetTop = this.$refs.TableList.$el.offsetTop;
+        this.tableHeight = window.innerHeight - tableOffsetTop - 115;
+        // console.log(this.tableHeight);
+      });
+    },
+    registResize() {
+      window.addEventListener("resize", this.updateTableHeight);
+    },
+  },
+  beforeDestroy() {
+    window.removeEventListener("resize", this.updateTableHeight);
   },
 };
 </script>

+ 9 - 11
src/modules/mark/components/markParam/ModifyMarkParams.vue

@@ -20,7 +20,7 @@
       <button class="el-dialog__headerbtn" @click="cancel"></button>
     </div>
 
-    <div v-if="dataReady" class="part-box part-box-pad">
+    <div v-if="dataReady" class="part-box part-box-pad mark-param-head">
       <el-steps :active="curStepIndex" align-center finish-status="success">
         <el-step
           v-for="(item, ind) in steps"
@@ -45,14 +45,14 @@
       </el-steps>
     </div>
 
-    <div v-if="dataReady">
-      <component
-        ref="paramComponentRef"
-        :is="currentComponent"
-        @next="nextHandler"
-        @prev="prevHandler"
-      ></component>
-    </div>
+    <component
+      v-if="dataReady"
+      ref="paramComponentRef"
+      class="mark-param-body"
+      :is="currentComponent"
+      @next="nextHandler"
+      @prev="prevHandler"
+    ></component>
     <div slot="footer"></div>
   </el-dialog>
 </template>
@@ -144,7 +144,6 @@ export default {
     ...mapMutations("markParam", [
       "setBasicInfo",
       "setPaperStructureInfo",
-      "setStructureCanEdit",
       "setSubjectiveTaskList",
       "setOpenMergeMarker",
       "setOpenDoubleMark",
@@ -176,7 +175,6 @@ export default {
         return nitem;
       });
       this.setPaperStructureInfo(questions || []);
-      this.setStructureCanEdit(structRes.canCreate);
       this.questionSubmit = structRes.questionSubmit;
 
       // group

+ 0 - 6
src/modules/mark/components/markParam/store.js

@@ -9,8 +9,6 @@ const state = {
     // "markMode": "评卷模式",
     // "cardId":"题卡ID"
   },
-  // 试卷结构是否可编辑
-  structureCanEdit: false,
   // 试卷结构
   paperStructureInfo: [],
   // 主观题任务列表
@@ -36,9 +34,6 @@ const mutations = {
   setPaperStructureInfo(state, paperStructureInfo) {
     state.paperStructureInfo = paperStructureInfo;
   },
-  setStructureCanEdit(state, structureCanEdit) {
-    state.structureCanEdit = structureCanEdit;
-  },
   setSubjectiveTaskList(state, subjectiveTaskList) {
     state.subjectiveTaskList = subjectiveTaskList;
   },
@@ -74,7 +69,6 @@ const mutations = {
   },
   initStore(state) {
     state.basicInfo = {};
-    state.structureCanEdit = false;
     state.paperStructureInfo = [];
     state.subjectiveTaskList = [];
     state.openClassMark = false;