Commit c8c928f4e0e75003e5459949cf4257a586a4e14d

Authored by 梁保满
1 parent 31fe9b9a

学生管理交互优化

src/views/standard/setUp/student.vue
... ... @@ -48,17 +48,8 @@
48 48 :value="item.value"
49 49 >
50 50 </el-option>
51   - </el-select>
52   - <el-select
53   - class="sel"
54   - v-model="query.status"
55   - @change="_QueryData(4)"
56   - placeholder="学生状态"
57   - >
58   - <el-option disabled label="请选择" :value=9></el-option>
59   - <el-option label="正常" :value="0"></el-option>
60   - <el-option label="未分配" :value="-1"></el-option>
61   - <el-option label="已毕业" :value="2"></el-option>
  51 + <el-option label="未分配" :value="80"></el-option>
  52 + <el-option label="已毕业" :value="81"></el-option>
62 53 </el-select>
63 54 <el-input
64 55 placeholder="请输入学生姓名"
... ... @@ -86,15 +77,29 @@
86 77 </el-input>
87 78 </div>
88 79 </div>
89   - <p class="total" v-if="studentList.length && !query.grade">
  80 + <p
  81 + class="total"
  82 + v-if="
  83 + studentList.length &&
  84 + (query.grade == 80 || query.grade == 81 || !query.grade)
  85 + "
  86 + >
90 87 共筛选出{{ studentList.length }}名学生。
91 88 </p>
92   - <p class="total" v-if="getStuTotal && query.grade">
  89 + <p
  90 + class="total"
  91 + v-if="
  92 + getStuTotal && query.grade && query.grade != 80 && query.grade != 81
  93 + "
  94 + >
93 95 共筛选出{{ getStuTotal }}名学生。
94 96 </p>
95 97 <div class="page-content">
96 98 <div class="stu-box">
97   - <div class="stu-list" v-show="query.grade">
  99 + <div
  100 + class="stu-list"
  101 + v-show="query.grade && query.grade != 80 && query.grade != 81"
  102 + >
98 103 <div class="h-title">班级列表</div>
99 104 <ul class="stu-ul">
100 105 <li
... ... @@ -109,7 +114,15 @@
109 114 </ul>
110 115 </div>
111 116 <div class="stu-detail" v-loading="loading">
112   - <div class="clazz-detail" v-if="clazzDetail.stationSn && query.grade">
  117 + <div
  118 + class="clazz-detail"
  119 + v-if="
  120 + clazzDetail.stationSn &&
  121 + query.grade &&
  122 + query.grade != 80 &&
  123 + query.grade != 81
  124 + "
  125 + >
113 126 <p>基站SN:{{ clazzDetail.stationSn }}</p>
114 127 <p>配对码:{{ clazzDetail.pairingCode }}</p>
115 128 <p>频点:{{ clazzDetail.frequency }}</p>
... ... @@ -129,7 +142,7 @@
129 142 </el-popconfirm>
130 143 <i
131 144 class="el-icon-user-solid"
132   - v-if="!code && query.status != 2"
  145 + v-if="!code && query.grade != 81"
133 146 @click.stop="openChangeClazz(item)"
134 147 ></i>
135 148 <div class="s-li-box" @click="sayChange(item)">
... ... @@ -167,13 +180,14 @@
167 180 <el-form-item label="当前班级:">
168 181 <span>{{ formStuCla.className }}</span>
169 182 </el-form-item>
170   - <el-form-item label="调到班级:">
  183 + <el-form-item label="调到班级:" prop="classId">
171 184 <el-col :span="10">
172 185 <el-select
173 186 class="sel"
174 187 v-model="formStuCla.classId"
175 188 placeholder="选择年级"
176 189 >
  190 + <el-option disabled label="请选择" value=""></el-option>
177 191 <el-option
178 192 v-for="item in classList"
179 193 :key="item.id"
... ... @@ -345,9 +359,7 @@ export default {
345 359 studentCode: "",
346 360 },
347 361 rulesStuCla: {
348   - className: [
349   - { required: true, message: "请输入班级名称", trigger: "blur" },
350   - ],
  362 + classId: [{ required: true, message: "请选择班级", trigger: "blur" }],
351 363 studentCode: [
352 364 { required: true, message: "请输入学生号", trigger: "blur" },
353 365 ],
... ... @@ -409,7 +421,7 @@ export default {
409 421 this._QueryData(3);
410 422 },
411 423  
412   - upSuccess(res) {
  424 + async upSuccess(res) {
413 425 this.$message.closeAll();
414 426 this.$message({
415 427 showClose: true,
... ... @@ -419,7 +431,8 @@ export default {
419 431 });
420 432 //导入成功
421 433 this.diaUp = false;
422   - this._QueryData(5);
  434 + await this._QueryClazz(this.query.grade);
  435 + this._QueryData();
423 436 },
424 437 //添加学生
425 438 addStu() {
... ... @@ -449,6 +462,7 @@ export default {
449 462 if (status === 0) {
450 463 this.$message.success(info);
451 464 this.diaStu = false;
  465 + await this._QueryClazz(this.query.grade);
452 466 this._QueryData();
453 467 } else {
454 468 this.$message.error(info);
... ... @@ -465,13 +479,10 @@ export default {
465 479 },
466 480 //学生调班弹窗
467 481 openChangeClazz(obj) {
468   - if (!this.query.grade) {
  482 + if (this.query.grade == 80) {
469 483 this._QueryClazz(obj.grade);
470   - this.formStuCla.classId = "";
471   - } else {
472   - this.formStuCla.classId = this.classList[0].id;
473 484 }
474   -
  485 + this.formStuCla.classId = "";
475 486 this.formStuCla.studentId = obj.id;
476 487 this.formStuCla.className = obj.className;
477 488 this.formStuCla.studentName = obj.studentName;
... ... @@ -484,6 +495,10 @@ export default {
484 495 function () {
485 496 this.$refs.formStuCla.validate(async (valid) => {
486 497 if (valid) {
  498 + if (this.formStuCla.classId == this.formStuCla.oldClassId) {
  499 + this.$message.warning("班级无变更~");
  500 + return;
  501 + }
487 502 const { data, status, info } =
488 503 await this.$request.studentChangeClass({
489 504 studentId: this.formStuCla.studentId,
... ... @@ -494,6 +509,7 @@ export default {
494 509 if (status == 0) {
495 510 this.diaChangeClass = false;
496 511 this.$message.success(info);
  512 + await this._QueryClazz(this.query.grade);
497 513 this._QueryData();
498 514 } else {
499 515 this.$message.error(info);
... ... @@ -528,7 +544,7 @@ export default {
528 544 });
529 545 if (status === 0) {
530 546 this.$message.success("删除成功");
531   - this.studentList.splice(index, 1);
  547 + await this._QueryClazz(this.query.grade);
532 548 this._QueryData();
533 549 } else {
534 550 this.$message.error(info);
... ... @@ -539,7 +555,9 @@ export default {
539 555 this.query.classId = "";
540 556 this.query.studentName = "";
541 557 this.query.studentCode = "";
542   - await this._QueryClass(val);
  558 + if (val != 80 && val != 81) {
  559 + await this._QueryClass(val);
  560 + }
543 561 this._QueryData(3);
544 562 },
545 563 serQuery(type) {
... ... @@ -550,44 +568,33 @@ export default {
550 568 return;
551 569 }
552 570 this.query.classId = "";
553   - this.query.status = 9;
554 571 this.query.studentCode = "";
555 572 this.query.grade = "";
556 573 query.studentName = this.query.studentName;
557   - query.status = this.query.status;
  574 + query.status = 9;
558 575 } else if (type == 2) {
559 576 if (!this.query.studentCode) {
560 577 this.$message.warning("输入学生学号~");
561 578 return;
562 579 }
563 580 this.query.classId = "";
564   - this.query.status = 9;
565 581 this.query.studentName = "";
566 582 this.query.grade = "";
567 583 query.studentCode = this.query.studentCode;
568   - query.status = this.query.status;
  584 + query.status = 9;
569 585 } else if (type == 3) {
570 586 this.query.studentName = "";
571 587 this.query.studentCode = "";
572   - this.query.status = 0;
573   - query.grade = this.query.grade;
574   - query.classId = this.query.classId;
575   - } else if (type == 4) {
576   - this.clazzDetail.stationSn = "";
577   - this.query.studentName = "";
578   - this.query.studentCode = "";
579   - if (this.query.status) {
580   - this.query.grade = "";
581   - this.query.classId = "";
  588 + if (this.query.grade == 80) {
  589 + query.status = -1;
  590 + } else if (this.query.grade == 81) {
  591 + query.status = 2;
582 592 } else {
583   - this.query.grade = this.gradeList[0]?.value;
584   - this.query.classId = this.classList[0]?.id;
585 593 query.grade = this.query.grade;
586 594 query.classId = this.query.classId;
587 595 }
588   - query.status = this.query.status;
589 596 } else {
590   - query = this.query;
  597 + query = { ...this.query };
591 598 }
592 599 return query;
593 600 },
... ... @@ -645,7 +652,6 @@ export default {
645 652 });
646 653 if (status === 0) {
647 654 this.classList = (data.list && [...data?.list]) || [];
648   - this.formStuCla.classId = this.classList[0].id;
649 655 } else {
650 656 this.$message.error(info);
651 657 }
... ... @@ -774,7 +780,7 @@ export default {
774 780 box-shadow: 2px 2px 5px #7f7f7f;
775 781 margin: 0 20px 20px 0;
776 782 .s-li-box {
777   - width: 180px;
  783 + width: 160px;
778 784 border-radius: 10px;
779 785 min-height: 120px;
780 786 padding: 0 12px 5px;
... ...