Commit 4fab460c41892ccfc82685ca6dd4af58989ead6c

Authored by 梁保满
1 parent 47a01cb6

班级归档操作交互

src/views/standard/setUp/student.vue
@@ -69,12 +69,11 @@ @@ -69,12 +69,11 @@
69 <template v-if="!code && role !== 'ROLE_PERSONAL'"> 69 <template v-if="!code && role !== 'ROLE_PERSONAL'">
70 <el-tooltip effect="dark" content="班级归档" placement="top"> 70 <el-tooltip effect="dark" content="班级归档" placement="top">
71 <div class="popconfirm-box"> 71 <div class="popconfirm-box">
72 - <el-popconfirm  
73 - title="确定要将该班级归档吗?"  
74 - @confirm="archivingClass(item, index)"  
75 - >  
76 - <i slot="reference" class="fa fa-file-archive-o"></i>  
77 - </el-popconfirm> 72 + <i
  73 + slot="reference"
  74 + class="fa fa-file-archive-o"
  75 + @click.stop="openArchivingDia(item, index)"
  76 + ></i>
78 </div> 77 </div>
79 </el-tooltip> 78 </el-tooltip>
80 <el-tooltip effect="dark" content="修改班级" placement="top"> 79 <el-tooltip effect="dark" content="修改班级" placement="top">
@@ -296,6 +295,15 @@ @@ -296,6 +295,15 @@
296 <el-button @click="diaUp = false">取 消</el-button> 295 <el-button @click="diaUp = false">取 消</el-button>
297 </div> 296 </div>
298 </el-dialog> 297 </el-dialog>
  298 + <el-dialog title="班级归档" :visible.sync="diaArchiving" width="400">
  299 + <p>注意该操作会将该班级进行归档操作,且不可撤销,请谨慎操作!</p>
  300 + <div class="dialog-footer" slot="footer">
  301 + <el-button type="danger" @click="archivingClass">确认归档</el-button>
  302 + <el-button type="primary" @click="diaArchiving = false"
  303 + >取 消</el-button
  304 + >
  305 + </div>
  306 + </el-dialog>
299 </div> 307 </div>
300 </template> 308 </template>
301 309
@@ -373,7 +381,10 @@ export default { @@ -373,7 +381,10 @@ export default {
373 teacherCourseList: [], 381 teacherCourseList: [],
374 teacherGradeList: [], 382 teacherGradeList: [],
375 }, 383 },
  384 + diaArchiving: false,
376 archivedTotal: 0, //已归档班级 385 archivedTotal: 0, //已归档班级
  386 + archivingObj: {}, //即将归档班级信息
  387 + archivingIndex: 0, //即将归档班级下标
377 }; 388 };
378 }, 389 },
379 async created() { 390 async created() {
@@ -519,17 +530,27 @@ export default { @@ -519,17 +530,27 @@ export default {
519 2000, 530 2000,
520 { leading: true, trailing: false } 531 { leading: true, trailing: false }
521 ), 532 ),
  533 +
  534 + openArchivingDia(obj, index) {
  535 + this.archivingObj = { ...obj };
  536 + this.archivingIndex = index;
  537 + this.diaArchiving = true;
  538 + },
522 //班级归档 539 //班级归档
523 - async archivingClass(obj, index) { 540 + async archivingClass() {
524 const { data, status, info } = await this.$request.classArchiving({ 541 const { data, status, info } = await this.$request.classArchiving({
525 - classId: obj.id, 542 + classId: this.archivingObj.id,
526 }); 543 });
  544 + this.diaArchiving = false;
527 if (status === 0) { 545 if (status === 0) {
528 this.$message.success("归档成功"); 546 this.$message.success("归档成功");
529 - this.classList.splice(index, 1);  
530 - this.classDetail(this.classList[index]); 547 + this.classList.splice(this.archivingIndex, 1);
  548 + if (this.archivingIndex == this.classList.length) {
  549 + this.classDetail(this.classList[this.archivingIndex - 1]);
  550 + } else {
  551 + this.classDetail(this.classList[this.archivingIndex]);
  552 + }
531 this._QueryArchivedNum(); 553 this._QueryArchivedNum();
532 -  
533 this._QueryData(3); 554 this._QueryData(3);
534 } else { 555 } else {
535 this.$message.error(info); 556 this.$message.error(info);