Commit 3ac930bd4754ff163e40570720aecff95fc3818b

Authored by 梁保满
1 parent ded06772

低分设置

Showing 1 changed file with 148 additions and 12 deletions
src/views/basic/test/analysis.vue
... ... @@ -27,14 +27,24 @@
27 27 </div>
28 28 </div>
29 29 <div class="page-content">
30   - <div class="tab-box">
31   - <span
32   - v-for="(item, index) in tabList"
33   - :key="item"
34   - class="tab-item"
35   - :class="type == index ? 'active' : ''"
36   - @click="setType(index)"
37   - >{{ item }}</span
  30 + <div class="content-header">
  31 + <div class="tab-box">
  32 + <span
  33 + v-for="(item, index) in tabList"
  34 + :key="item"
  35 + class="tab-item"
  36 + :class="type == index ? 'active' : ''"
  37 + @click="setType(index)"
  38 + >{{ item }}</span
  39 + >
  40 + </div>
  41 + <el-button
  42 + v-if="!status"
  43 + class="setMinScore"
  44 + @click="diaMinScore = true"
  45 + round
  46 + size="small"
  47 + >设置低分值</el-button
38 48 >
39 49 </div>
40 50 <div id="print-content" class="table-box" v-loading="loading">
... ... @@ -444,7 +454,12 @@
444 454 >
445 455 </div>
446 456 </div>
447   - <el-dialog :close-on-click-modal="false" title="导入主观题分数" :visible.sync="diaUp" width="600">
  457 + <el-dialog
  458 + :close-on-click-modal="false"
  459 + title="导入主观题分数"
  460 + :visible.sync="diaUp"
  461 + width="600"
  462 + >
448 463 <up-load :url="url" :examId="id" @upSuccess="upSuccess">
449 464 <template slot="down">
450 465 <p class="down-txt">
... ... @@ -458,6 +473,55 @@
458 473 <el-button @click="diaUp = false">取 消</el-button>
459 474 </div>
460 475 </el-dialog>
  476 + <el-dialog
  477 + :close-on-click-modal="false"
  478 + title="低分区间设置"
  479 + :visible.sync="diaMinScore"
  480 + width="480px"
  481 + @closed="closeDiaMinScore"
  482 + >
  483 + <el-form>
  484 + <el-form-item label="低分设置模式:">
  485 + <el-select v-model="lowRange.type" @change="changeScore">
  486 + <el-option label="按分数设置" :value="0"></el-option>
  487 + <el-option label="按已考人数比例" :value="1"></el-option>
  488 + <el-option label="按分数比例设置(按题目)" :value="2"></el-option>
  489 + </el-select>
  490 + </el-form-item>
  491 + <el-form-item label="低分区间:">
  492 + <el-input
  493 + class="score-ipt"
  494 + type="number"
  495 + v-model="lowRange.range[0]"
  496 + :min="0"
  497 + :max="100"
  498 + @input="lowRange.range[1] > 100 ? (lowRange.range[1] = 100) : ''"
  499 + @keydown.native="keydownRange($event)"
  500 + ></el-input
  501 + >{{ lowRange.type != 0 ? "%" : "分" }}(含)
  502 + <el-input
  503 + class="score-ipt"
  504 + type="number"
  505 + v-model="lowRange.range[1]"
  506 + :min="0"
  507 + :max="100"
  508 + @input="lowRange.range[1] > 100 ? (lowRange.range[1] = 100) : ''"
  509 + @keydown.native="keydownRange($event)"
  510 + ></el-input
  511 + >{{ lowRange.type != 0 ? "%" : "分" }}(含)
  512 + </el-form-item>
  513 + </el-form>
  514 +
  515 + <div
  516 + class="dialog-footer"
  517 + slot="footer"
  518 + align="center"
  519 + v-loading="loadingTange"
  520 + >
  521 + <el-button type="danger" @click="_SavelowRange">保存</el-button>
  522 + <el-button @click="diaMinScore = false">取 消</el-button>
  523 + </div>
  524 + </el-dialog>
461 525 </div>
462 526 </div>
463 527 </template>
... ... @@ -468,18 +532,20 @@ export default {
468 532 data() {
469 533 return {
470 534 role: "",
471   - status: 0,
  535 + status: 0,// 1:已归档试卷
472 536 tableMaxHeight: 600,
473 537 loading: false,
474 538 exportLoading: false,
475 539 diaUp: false,
476 540 url: "/api_html/teaching/importSubjectiveScore",
477 541 id: "",
  542 + classId: "",
  543 + subjectName: "",
478 544 title: "",
479 545 score: "",
480 546 tabList: ["试题分析", "成绩排名", "小题分报表", "作答明细表"],
481 547 type: 0,
482   - paperModifyLog: {
  548 + paperModifyLog: { //修改信息
483 549 realName: "",
484 550 modifiedTime: "",
485 551 },
... ... @@ -507,6 +573,17 @@ export default {
507 573 page: 1,
508 574 size: 20,
509 575 total: 0,
  576 + // 设置低分值
  577 + loadingTange: false,
  578 + diaMinScore: false,
  579 + lowRange: {
  580 + type: 0,
  581 + range: [60, 0],
  582 + },
  583 + defaultLowRange: {
  584 + type: 0,
  585 + range: [],
  586 + },
510 587 };
511 588 },
512 589 created() {
... ... @@ -516,6 +593,8 @@ export default {
516 593 this.id = this.$route.query.id;
517 594 this.status = this.$route.query.status ? this.$route.query.status : 0;
518 595 this.title = this.$route.query.title || "";
  596 + this.classId = this.$route.query.classId || "";
  597 + this.subjectName = this.$route.query.subjectName || "";
519 598 this._QueryData();
520 599 },
521 600 methods: {
... ... @@ -569,6 +648,42 @@ export default {
569 648 this.page = page;
570 649 this.examQuestionReport();
571 650 },
  651 + // 切换低分设置类型设置默认分值
  652 + changeScore() {
  653 + this.lowRange.range = [...this.defaultLowRange.range];
  654 + },
  655 + // 禁止输入负数
  656 + keydownRange(event) {
  657 + if (event.key == "-" || event.key == "e") {
  658 + event.returnValue = "";
  659 + }
  660 + },
  661 + // 关闭低分设置
  662 + closeDiaMinScore() {
  663 + this.lowRange.type = this.defaultLowRange.type;
  664 + this.lowRange.range = [...this.defaultLowRange.range];
  665 + },
  666 + // 保存低分设置
  667 + async _SavelowRange() {
  668 + if(this.lowRange.range[0].trim() == "" || this.lowRange.range[1].trim() == ""){
  669 + this.$message.warning("请补全低分设置!");
  670 + return
  671 + }
  672 + this.loadingTange = true;
  673 + let { data, status, info } = await this.$request.setLowRange({
  674 + classId: this.classId,
  675 + subjectName: this.subjectName,
  676 + ...this.lowRange,
  677 + });
  678 + this.loadingTange = false;
  679 + if (status === 0) {
  680 + this.$message.success(info);
  681 + this.diaMinScore = false;
  682 + this.examDetail();
  683 + } else {
  684 + this.$message.error(info);
  685 + }
  686 + },
572 687 async _QueryData() {
573 688 this.examDetail();
574 689 this.examStudentReport();
... ... @@ -586,6 +701,12 @@ export default {
586 701 this.paperModifyLog = { ...data?.paperModifyLog };
587 702 }
588 703 this.examReport = { ...data?.examReport };
  704 + this.defaultLowRange = data.lowRange || {
  705 + type: 1,
  706 + range: [60, 0],
  707 + };
  708 + this.lowRange.type = this.defaultLowRange.type;
  709 + this.lowRange.range = [...this.defaultLowRange.range];
589 710 } else {
590 711 this.$message.error(info);
591 712 }
... ... @@ -625,7 +746,7 @@ export default {
625 746 detail.map((items, index) => {
626 747 params["que" + items.id] = items.id;
627 748 params["score" + items.id] = String(items.score).includes(".")
628   - ? Number(items.score).toFixed(2)
  749 + ? Number(items.score)
629 750 : items.score;
630 751 params["answer" + items.id] =
631 752 items.answer == 1 ? "✓" : items.answer == 2 ? "✗" : items.answer;
... ... @@ -875,4 +996,19 @@ div::-webkit-scrollbar-thumb {
875 996 }
876 997 }
877 998 }
  999 +
  1000 +// 设置低分值
  1001 +.content-header {
  1002 + width: 100%;
  1003 + position: relative;
  1004 + .setMinScore {
  1005 + position: absolute;
  1006 + bottom: 0;
  1007 + right: 0px;
  1008 + }
  1009 +}
  1010 +.score-ipt {
  1011 + width: 80px;
  1012 + margin: 0 5px;
  1013 +}
878 1014 </style>
879 1015 \ No newline at end of file
... ...