zhangjie 1 년 전
부모
커밋
b2066cdbe4

+ 9 - 1
src/modules/base/components/ModifyExamStudent.vue

@@ -107,8 +107,8 @@
         >
         </el-date-picker>
         <el-time-picker
-          is-range
           v-model="createTime"
+          is-range
           range-separator="至"
           start-placeholder="考试开始时间"
           end-placeholder="考试结束时间"
@@ -206,13 +206,21 @@ export default {
           this.createDate = getTimeDatestamp(examStartTime);
           this.modalForm.examStartTime = this.createTime[0];
           this.modalForm.examEndTime = this.createTime[1];
+        } else {
+          this.getInitCreateTime();
         }
       } else {
         this.modalForm = { ...initModalForm };
+        this.getInitCreateTime();
         this.initExamTime();
       }
       this.updateRules();
     },
+    getInitCreateTime() {
+      const curDate = getTimeDatestamp(Date.now());
+      const hour = 60 * 60 * 1000;
+      this.createTime = [curDate + 8 * hour, curDate + 10 * hour];
+    },
     visibleChange() {
       this.initData(this.instance);
     },

+ 2 - 2
src/modules/base/components/course-simple/AddClazzSimpleDialog.vue

@@ -12,11 +12,11 @@
   >
     <el-form ref="FilterForm" label-position="left" inline label-width="0px">
       <el-form-item>
-        <course-select
+        <course-common-select
           v-model="filter.courseCode"
           placeholder="请选择课程"
           clearable
-        ></course-select>
+        ></course-common-select>
       </el-form-item>
       <el-form-item>
         <el-input

+ 15 - 1
src/modules/base/components/course-simple/CourseEvaluationManage.vue

@@ -20,8 +20,15 @@
           min-width="300"
         >
         </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="80px">
+        <el-table-column class-name="action-column" label="操作" width="120px">
           <template slot-scope="scope">
+            <el-button
+              v-if="scope.row.type === 'CUSTOM'"
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >编辑</el-button
+            >
             <el-button
               v-if="scope.row.type === 'CUSTOM'"
               class="btn-danger"
@@ -84,6 +91,13 @@ export default {
       };
       this.$refs.ModifyCourseEvaluation.open();
     },
+    toEdit(row) {
+      this.curRow = {
+        teachCourseId: this.course.id,
+        ...row,
+      };
+      this.$refs.ModifyCourseEvaluation.open();
+    },
     async toDelete(row) {
       const confirm = await this.$confirm(
         `删除评价方式会影响权重设置,确定要删除评价方式【${row.evaluation}】吗?`,

+ 1 - 1
src/modules/base/components/course-simple/CourseTargetManage.vue

@@ -126,7 +126,7 @@ export default {
           duration: 5000,
         });
       }
-      this.dataList = this.dataList.filter((item) => item.id !== row.id);
+      this.getList();
     },
   },
 };

+ 2 - 1
src/modules/base/components/course-simple/ModifyCourseEvaluation.vue

@@ -21,6 +21,7 @@
           v-model.trim="modalForm.evaluation"
           placeholder="请输入评价方式"
           clearable
+          :disabled="isEdit"
         ></el-input>
       </el-form-item>
       <el-form-item prop="evaluationDesc" label="评价方式描述:">
@@ -133,7 +134,7 @@ export default {
 
       if (this.isSubmit) return;
       this.isSubmit = true;
-      let datas = { ...this.modalForm };
+      let datas = { ...this.modalForm, id: this.modalForm.evaluationId };
       const res = await updateCourseEvaluation(datas).catch(() => {});
       this.isSubmit = false;
 

+ 7 - 2
src/modules/base/components/course-simple/SelectDimensionDialog.vue

@@ -18,6 +18,7 @@
       <div class="part-box part-box-pad mb-0">
         <el-tree
           ref="treeRef"
+          :key="treeKey"
           :data="treeData"
           show-checkbox
           check-on-click-node
@@ -92,6 +93,7 @@ export default {
         children: "children",
         label: "name",
       },
+      treeKey: "",
       // import
       uploadUrl: "/api/admin/teach/course_target/dimension_import",
       dfilename: "课程知识点导入模板.xlsx",
@@ -142,13 +144,17 @@ export default {
         });
       };
       mdTree(this.treeData);
+      this.treeKey = this.$randomCode();
     },
     toImport() {
       this.$refs.ImportFile.open();
     },
     visibleChange() {
       this.updateDisableNode();
-      this.$refs.treeRef.setCheckedKeys(this.selectedData);
+
+      this.$nextTick(() => {
+        this.$refs.treeRef.setCheckedKeys(this.selectedData);
+      });
     },
     cancel() {
       this.modalIsShow = false;
@@ -158,7 +164,6 @@ export default {
     },
     submit() {
       const selectedNodes = this.$refs.treeRef.getCheckedNodes();
-      console.log(selectedNodes);
 
       if (!selectedNodes.length) {
         this.$message.error("请选择知识点");

+ 0 - 1
src/modules/card/components/CardBuildDialog.vue

@@ -140,7 +140,6 @@ export default {
         examId: this.presetData.examId,
         paperId: this.presetData.paperId,
         uuid: this.presetData.uuid,
-        paperType: this.presetData.paperType,
       }).catch(() => {});
       if (!res) {
         this.emitResult({ success: false, message: "试卷内容获取失败" });

+ 4 - 36
src/modules/course/components/SelectBlueDimensionDialog.vue

@@ -11,6 +11,7 @@
     @opened="visibleChange"
   >
     <el-tree
+      v-if="treeData.length"
       ref="treeRef"
       :data="treeData"
       show-checkbox
@@ -29,8 +30,6 @@
 </template>
 
 <script>
-import { courseTargetList } from "../../base/api";
-
 export default {
   name: "select-blue-dimension-dialog",
   props: {
@@ -40,59 +39,28 @@ export default {
         return [];
       },
     },
-    course: {
-      type: Object,
+    treeData: {
+      type: Array,
       default() {
-        return {
-          examId: "",
-          courseCode: "",
-        };
+        return [];
       },
     },
   },
   data() {
     return {
       modalIsShow: false,
-      treeData: [],
       defaultProps: {
         children: "children",
         label: "name",
       },
     };
   },
-  watch: {
-    course: {
-      immediate: true,
-      handler(val, oldVal) {
-        if (!val) return;
-        if (val !== oldVal) this.getTree();
-      },
-    },
-  },
   methods: {
-    async getTree() {
-      const data = await courseTargetList({
-        examId: this.course.examId,
-        courseCode: this.course.courseCode,
-      });
-      this.treeData = (data || []).map((item) => {
-        return {
-          id: item.id,
-          name: item.targetName,
-          disabled: false,
-          children: item.dimensionList.map((elem) => {
-            return { ...elem, disabled: false };
-          }),
-        };
-      });
-    },
     visibleChange() {
       this.$refs.treeRef.setCheckedKeys(this.selectedData);
 
       this.$nextTick(() => {
         this.updateTreeStatus();
-
-        console.log(this.treeData);
       });
     },
     cancel() {

+ 82 - 7
src/modules/course/components/SetBlueDialog.vue

@@ -4,13 +4,14 @@
       :visible.sync="modalIsShow"
       title="设置试卷蓝图"
       top="10px"
-      width="800px"
+      width="660px"
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
       @open="visibleChange"
     >
-      <el-table :data="dataList">
+      <p class="mb-2">{{ targetDesc }}</p>
+      <el-table :data="dataList" border>
         <el-table-column
           prop="mainNumber"
           label="大题号"
@@ -21,7 +22,19 @@
           label="小题号"
           width="80px"
         ></el-table-column>
-        <el-table-column prop="dimensionList" label="知识点">
+        <el-table-column
+          prop="score"
+          label="小题满分"
+          width="80px"
+        ></el-table-column>
+        <el-table-column prop="target" label="所属课程目标">
+          <template slot-scope="scope">
+            <p v-for="target in scope.row.targetList" :key="target.targetId">
+              {{ target.targetName }}
+            </p>
+          </template>
+        </el-table-column>
+        <!-- <el-table-column prop="dimensionList" label="知识点">
           <template slot-scope="scope">
             <template v-for="target in scope.row.targetList">
               <p
@@ -32,7 +45,7 @@
               </p>
             </template>
           </template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column class-name="action-column" label="操作" width="110px">
           <template slot-scope="scope">
             <el-button
@@ -55,7 +68,7 @@
     <!-- 设置知识点 -->
     <select-blue-dimension-dialog
       ref="SelectBlueDimensionDialog"
-      :course="course"
+      :tree-data="treeData"
       :selected-data="selectedData"
       @confirm="dimensionSelected"
     ></select-blue-dimension-dialog>
@@ -63,6 +76,8 @@
 </template>
 
 <script>
+import { calcSum } from "@/plugins/utils";
+import { courseTargetList } from "../../base/api";
 import { endScorePaperPositiveDetail, endScorePaperPositiveSave } from "../api";
 import SelectBlueDimensionDialog from "./SelectBlueDimensionDialog.vue";
 
@@ -84,9 +99,42 @@ export default {
       dataList: [],
       curRow: {},
       selectedData: [],
+      treeData: [],
+      targetDesc: "",
     };
   },
+  watch: {
+    course: {
+      immediate: true,
+      handler(val, oldVal) {
+        if (!val) return;
+        if (val !== oldVal) this.getTree();
+      },
+    },
+  },
   methods: {
+    async getTree() {
+      const data = await courseTargetList({
+        examId: this.course.examId,
+        courseCode: this.course.courseCode,
+      });
+      this.treeData = (data || []).map((item) => {
+        return {
+          id: item.id,
+          name: item.targetName,
+          totalWeight: item.totalWeight,
+          disabled: false,
+          children: item.dimensionList.map((elem) => {
+            return { ...elem, disabled: false };
+          }),
+        };
+      });
+
+      this.targetDesc = this.treeData
+        .map((item) => `${item.name}占比${item.totalWeight}%`)
+        .join(",");
+      this.targetDesc += "。";
+    },
     async getBlueDetail() {
       const res = await endScorePaperPositiveDetail({
         examId: this.course.examId,
@@ -105,9 +153,36 @@ export default {
       this.modalIsShow = true;
     },
     checkData() {
-      return !this.dataList.some(
+      const valid = !this.dataList.some(
         (item) => !item.targetList || !item.targetList.length
       );
+
+      if (!valid) {
+        this.$message.error("还有小题未设置知识点,请完成设置!");
+        return;
+      }
+
+      const scoreData = {};
+      this.dataList.forEach((item) => {
+        if (!item.targetList || !item.targetList.length) return;
+        const targetId = item.targetList[0].targetId;
+        if (!scoreData[targetId]) scoreData[targetId] = 0;
+        scoreData[targetId] += item.score;
+      });
+      console.log(scoreData);
+      const totalScore = calcSum(Object.values(scoreData));
+
+      const unvalidTargets = [];
+      this.treeData.forEach((target) => {
+        const rate = (100 * scoreData[target.id]) / totalScore;
+        if (rate != target.totalWeight) unvalidTargets.push(target.name);
+      });
+      if (unvalidTargets.length) {
+        this.$message.error(`${unvalidTargets.join("、")}占比不符合要求`);
+        return;
+      }
+
+      return true;
     },
     toLink(row) {
       this.curRow = row;
@@ -124,9 +199,9 @@ export default {
     },
     async submit() {
       if (!this.checkData()) {
-        this.$message.error("还有小题未设置知识点,请完成设置!");
         return;
       }
+
       if (this.isSubmit) return;
       this.isSubmit = true;
       const datas = {

+ 2 - 1
src/modules/course/components/TargetReportDetail.vue

@@ -703,7 +703,7 @@ export default {
             type: "line",
             symbol: "none",
             data: this.courseTargetList.map(
-              (item) => this.courseBasicInfo.courseDegree
+              (item) => this.courseBasicInfo.courseDegree || 0
             ),
           },
         ],
@@ -839,6 +839,7 @@ export default {
 
       if (!res) return;
       this.$message.success("保存成功!");
+      this.initData();
     },
     async toExport() {
       if (this.downloading) return;

+ 0 - 1
src/modules/exam/components/ApplyContent.vue

@@ -1346,7 +1346,6 @@ export default {
         courseCode: this.examTask.courseCode,
         courseName: this.examTask.courseName,
         schoolName: this.$ls.get("schoolName"),
-        paperType: this.curAttachment.name,
         makeMethod: "SELF",
         cardName: "",
         cardRuleId: this.examTask.cardRuleId,

+ 0 - 1
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -825,7 +825,6 @@ export default {
         examId: this.examTask.examId,
         courseCode: this.examTask.courseCode,
         courseName: this.examTask.courseName,
-        paperType: this.curAttachment.name,
         schoolName: this.$ls.get("schoolName"),
         makeMethod: "SELF",
         cardName: "",