Commit da9346ee2016249d24cc25c97eaeb51ee894bfce

Authored by 梁保满
1 parent ee00775c

全选和排序问题

src/views/standard/test/contrast.vue
... ... @@ -94,6 +94,7 @@
94 94 <el-table-column
95 95 prop="rank"
96 96 label="排名"
  97 + sortable
97 98 align="center"
98 99 ></el-table-column>
99 100 <el-table-column
... ... @@ -104,7 +105,6 @@
104 105 <el-table-column
105 106 prop="className"
106 107 label="班级"
107   - sortable
108 108 align="center"
109 109 ></el-table-column>
110 110 <el-table-column
... ... @@ -116,7 +116,6 @@
116 116 <el-table-column
117 117 prop="levelName"
118 118 label="成绩等级"
119   - sortable
120 119 align="center"
121 120 ></el-table-column>
122 121 </el-table>
... ... @@ -389,7 +388,11 @@ export default {
389 388 this.title = data.title;
390 389 this.subjectNames = data.subjectName;
391 390 this.tableData = data.classes || [];
392   - this.tableData2 = data.students || [];
  391 + this.tableData2 =
  392 + data.students.map((item) => {
  393 + item.score = Number(item.score);
  394 + return item;
  395 + }) || [];
393 396 } else {
394 397 this.$message.error(info);
395 398 }
... ... @@ -521,7 +524,7 @@ export default {
521 524 }
522 525 }
523 526 }
524   -.p1{
525   - line-height:18px;
  527 +.p1 {
  528 + line-height: 18px;
526 529 }
527 530 </style>
528 531 \ No newline at end of file
... ...
src/views/standard/test/index.vue
... ... @@ -32,6 +32,9 @@
32 32 multiple
33 33 collapse-tags
34 34 >
  35 + <el-checkbox v-model="classAll" @change="selectAll" class="select-all"
  36 + >全选</el-checkbox
  37 + >
35 38 <el-option
36 39 :disabled="
37 40 query.classIds.length == 1 && query.classIds[0] == item.value
... ... @@ -525,12 +528,7 @@
525 528 </p>
526 529 </div>
527 530 <div v-show="query.classIds.length > 1" class="table-box">
528   - <el-empty
529   - :imag-size="48"
530   - v-if="!classTableLen && !loading"
531   - description="暂无数据"
532   - ></el-empty>
533   - <div class="head-box" v-if="classTableLen">
  531 + <div class="head-box">
534 532 <div class="tit">
535 533 <p class="txt">已考试卷信息</p>
536 534 <p>
... ... @@ -552,7 +550,12 @@
552 550 ></el-button>
553 551 </el-input>
554 552 </div>
555   - <ul class="tab-ul">
  553 + <el-empty
  554 + :imag-size="48"
  555 + v-if="!classTableLen && !loading"
  556 + description="暂无数据"
  557 + ></el-empty>
  558 + <ul class="tab-ul" v-if="classTableLen">
556 559 <template v-for="(item, index) in classTable">
557 560 <li class="tab-li">
558 561 <p class="tab-tit">
... ... @@ -681,6 +684,7 @@ export default {
681 684 total: 0,
682 685 multipleSelection: [], //选中的试卷ID
683 686 classTable: [], //多班级数据
  687 + classAll: false, //搜索条件多班全选
684 688 };
685 689 },
686 690 computed: {
... ... @@ -731,6 +735,17 @@ export default {
731 735 });
732 736 },
733 737 methods: {
  738 + //搜索条件多班全选
  739 + selectAll(val) {
  740 + this.query.classIds = [];
  741 + if (val) {
  742 + this.classList.forEach((item) => {
  743 + this.query.classIds.push(item.value);
  744 + });
  745 + } else {
  746 + this.query.classIds.push(this.classList[0].value);
  747 + }
  748 + },
734 749 // 多班级选择同一试卷
735 750 checkboxDisabled(obj) {
736 751 let id = this.multipleSelection[0] || "";
... ... @@ -943,7 +958,12 @@ export default {
943 958 this._QueryData();
944 959 },
945 960 //切换班级
946   - async changeclass() {
  961 + async changeclass(list) {
  962 + if (list.length == this.classList.length) {
  963 + this.classAll = true;
  964 + } else {
  965 + this.classAll = false;
  966 + }
947 967 if (this.query.classIds.length == 0) {
948 968 this.$message.warning("请至少选择一个班级!");
949 969 }
... ... @@ -1078,11 +1098,11 @@ export default {
1078 1098 if (!query.classId) {
1079 1099 //多班级
1080 1100 this.classTable = [];
1081   - let classIds = []
  1101 + let classIds = [];
1082 1102 let tableData = [];
1083 1103 data?.list?.map((item) => {
1084   - if(!classIds.includes(item.classId)){
1085   - classIds.push(item.classId)
  1104 + if (!classIds.includes(item.classId)) {
  1105 + classIds.push(item.classId);
1086 1106 }
1087 1107 let idx = classIds.indexOf(item.classId);
1088 1108 if (tableData[idx]) {
... ... @@ -1377,4 +1397,7 @@ div::-webkit-scrollbar-thumb {
1377 1397 background: transparent;
1378 1398 }
1379 1399 }
  1400 +.select-all {
  1401 + padding-left: 16px;
  1402 +}
1380 1403 </style>
1381 1404 \ No newline at end of file
... ...