Browse Source

01/29 提交班级删除优化

1
mo 4 years ago
parent
commit
6d0817da48
1 changed files with 23 additions and 19 deletions
  1. 23 19
      src/views/teamDetail/components/resetClass.vue

+ 23 - 19
src/views/teamDetail/components/resetClass.vue

@@ -120,9 +120,18 @@
                   @click="classAdjustment(scope.row)"
                   >排课</el-button
                 >
+                   <el-button
+                    type="text"
+                    v-if="
+                      scope.row.studentNum == '0' ||
+                      scope.row.totalClassTimes == '0'
+                    "
+                      @click="removeClass(scope)"
+                    >删除</el-button
+                  >
                 <!--<el-button type="text"
                 @click="recourse(scope.row)">重新排课</el-button>-->
-                <el-popover
+                <!-- <el-popover
                   placement="top"
                   width="200"
                   :ref="`popover-${scope.$index}`"
@@ -144,17 +153,8 @@
                       >确定</el-button
                     >
                   </div>
-                  <!-- v-if="scope.row.type !='MIX'" -->
-                  <el-button
-                    type="text"
-                    v-if="
-                      scope.row.studentNum == '0' ||
-                      scope.row.totalClassTimes == '0'
-                    "
-                    slot="reference"
-                    >删除</el-button
-                  >
-                </el-popover>
+
+                </el-popover> -->
               </div>
             </template>
           </el-table-column>
@@ -1032,22 +1032,26 @@ export default {
     },
     // 删除班级
     removeClass(scope) {
-      removeSingleClass({ classGroupId: scope.row.id })
+         this.$confirm("是否确定删除该班级?", "提示", {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning"
+    })
+      .then(() => {
+        removeSingleClass({ classGroupId: scope.row.id })
         .then((res) => {
           if (res.code == 200) {
-            scope._self.$refs[`popover-${scope.$index}`].doClose();
             this.$message.success("删除成功");
-
             // 重新请求列表
             this.getList(this.activeMixClass);
-          } else {
-            this.$message.error(res.msg);
-            scope._self.$refs[`popover-${scope.$index}`].doClose();
           }
         })
         .catch((res) => {
-          scope._self.$refs[`popover-${scope.$index}`].doClose();
+
         });
+      })
+      .catch(() => { });
+
     },
     // 修改班级
     resetClass(row) {