瀏覽代碼

02/11 14:45

提交测试
261568008@qq.com 5 年之前
父節點
當前提交
bd2a80bf24
共有 2 個文件被更改,包括 119 次插入10 次删除
  1. 17 0
      src/api/buildTeam.js
  2. 102 10
      src/views/accompanyManager/accompanys.vue

+ 17 - 0
src/api/buildTeam.js

@@ -934,4 +934,21 @@ export function practiceCourseAdjus(data) {
     method: 'post',
     data: qs.stringify(data)
   })
+}
+
+// 陪练课程组老师修改
+export function practiceGroupTeacherAdjust(data) {
+  return request({
+    url: api + '/courseSchedule/practiceGroupTeacherAdjust',
+    method: 'post',
+    data: qs.stringify(data)
+  })
+}
+// 陪练课老师修改
+export function practiceCourseTeacherAdjust(data) {
+  return request({
+    url: api + '/courseSchedule/practiceCourseTeacherAdjust',
+    method: 'post',
+    data: qs.stringify(data)
+  })
 }

+ 102 - 10
src/views/accompanyManager/accompanys.vue

@@ -4,7 +4,7 @@
       <el-page-header @back="goBack" :content="name"></el-page-header>
     </h2>
     <!--   v-permission="'vipGroupManage/updateVipBaseInfo'" -->
-    <!-- <div class="newBand" @click="teacherVisible = true">修改老师</div> -->
+    <div class="newBand" @click="resetTeachers">修改老师</div>
     <div class="tableWrap">
       <el-table :data="tableList" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
         <!-- @selection-change="handleSelectionChange" -->
@@ -18,7 +18,7 @@
               {{scope.row.teacher.realName}}
             </div>
           </template>
-        </el-table-column> -->
+        </el-table-column>-->
         <!-- <el-table-column label="班级id"
                          align="center"
                          prop="classGroupId">
@@ -54,6 +54,12 @@
                 v-if="!scope.row.isSettlement"
                 @click="resetClass(scope.row)"
               >调整</el-button>
+              <!--  v-permission="'courseSchedule/classStartDateAdjust'" -->
+              <el-button
+                type="text"
+                v-if="!scope.row.isSettlement"
+                @click="resetTeacher(scope.row)"
+              >更换老师</el-button>
             </div>
           </template>
         </el-table-column>
@@ -147,14 +153,18 @@
       >
         <el-form-item label="老师姓名">
           <el-select v-model.trim="teacherForm.teacher" filterable clearable>
-            <el-option value="11" label="22"></el-option>
+            <el-option
+              v-for="(item,index) in teacherList"
+              :key="index"
+              :value="item.id"
+              :label="item.realName"
+            ></el-option>
           </el-select>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="teacherVisible = false">取 消</el-button>
-        <el-button type="primary" v-if="isMultiple" @click="resetTeacher">确 定</el-button>
-        <el-button type="primary" v-else @click="resetSingle">确 定</el-button>
+        <el-button type="primary" @click="subresetTeacher">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -163,7 +173,11 @@
 import pagination from "@/components/Pagination/index";
 import {
   findPracticeGroupCourseSchedules,
-  practiceCourseAdjus
+  practiceCourseAdjus,
+  getTeacher,
+  practiceGroupManage,
+  practiceGroupTeacherAdjust,
+  practiceCourseTeacherAdjust
 } from "@/api/buildTeam";
 export default {
   components: {
@@ -177,6 +191,8 @@ export default {
       teacherVisible: false,
       Frules: null,
       FsearchForm: null,
+      userId: null,
+      activeRow: null,
       rules: {
         // 分页规则
         limit: 20, // 限制显示条数
@@ -185,6 +201,8 @@ export default {
         page_size: [10, 20, 50, 100] // 选择限制显示条数
       },
       tableList: [],
+      teacherList: [],
+      courseData: [],
       practiceId: null,
       maskForm: {
         date: "",
@@ -216,6 +234,7 @@ export default {
   methods: {
     init() {
       this.practiceId = this.$route.query.id;
+      this.userId = this.$route.query.userId;
       if (this.$route.query.rules) {
         this.Frules = this.$route.query.rules;
       }
@@ -223,17 +242,32 @@ export default {
         this.FsearchForm = this.$route.query.searchForm;
       }
       //   console.log(this.practiceId)
+      //   <!-- 状态 指导老师 活动方案-->
+      getTeacher({ organId: this.organId }).then(res => {
+        if (res.code == 200) {
+          this.teacherList = res.data;
+        }
+      });
+      // 获取课程组信息
+      this.getCourseGroup();
       this.getList();
     },
+    getCourseGroup() {
+      practiceGroupManage({ search: this.practiceId }).then(res => {
+        if (res.code == 200) {
+          this.courseData = res.data.rows;
+          if (this.courseData.length > 0) {
+            this.name = this.courseData[0].name;
+          }
+        }
+      });
+    },
     getList() {
       findPracticeGroupCourseSchedules({ practiceId: this.practiceId }).then(
         res => {
           if (res.code == 200) {
             this.tableList = res.data.pageInfo.rows;
             this.rules.total = res.data.pageInfo.total;
-            if (this.tableList.length > 0) {
-              this.name = this.tableList[0].name;
-            }
           }
         }
       );
@@ -293,7 +327,65 @@ export default {
       // 修改课时
       this.courseVisible = true;
     },
-    resetTeacher() {}
+    resetTeacher(row) {
+      // 单节课
+      this.isMultiple = false;
+      this.activeRow = row;
+      this.teacherForm.teacher = row.actualTeacherId;
+      console.log(row.actualTeacherId)
+      this.teacherVisible = true;
+    },
+    resetTeachers() {
+      // 课程组
+      this.isMultiple = true;
+      this.teacherForm.teacher = this.courseData[0].userId;
+      this.teacherVisible = true;
+    },
+    subresetTeacher() {
+      this.$refs.teacherForm.validate(some => {
+        if (some) {
+          if (this.isMultiple) {
+            // 修改课程组老师
+            this.$confirm("此操作将修改所有未上课程的老师, 是否继续?", "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            })
+              .then(() => {
+                   practiceGroupTeacherAdjust({
+              practiceGroupId: this.practiceId,
+              teacherId: this.teacherForm.teacher
+            }).then(res => {
+              if (res.code == 200) {
+                this.$message.success("修改成功");
+                this.getCourseGroup();
+                this.getList();
+                this.teacherVisible = false;
+              }
+            });
+              })
+              .catch(() => {
+                return
+              });
+         
+          } else {
+            // 修改单节课老师
+            practiceCourseTeacherAdjust({
+              courseScheduleId: this.activeRow.id,
+              teacherId: this.teacherForm.teacher
+            }).then(res => {
+              if (res.code == 200) {
+                this.$message.success("修改成功");
+                this.getList();
+                this.teacherVisible = false;
+              }
+            });
+          }
+        } else {
+          return;
+        }
+      });
+    }
   }
 };
 </script>