Browse Source

06/04 17:27

111
mo 5 years ago
parent
commit
50f629be3c

+ 19 - 1
src/api/teacherManager.js

@@ -252,11 +252,29 @@ export function findTeacherCourseGroupsWithWeb (data) {
 }
 
 
-// 老师乐团课调
+// 老师乐团课调
 export function classGroupTeacherAdjust (data) {
   return request({
     url: api + '/courseSchedule/classGroupTeacherAdjust',
     method: 'post',
     data: qs.stringify(data)
   })
+}
+
+// 获取老师学员列表
+export function queryStudent (data) {
+  return request({
+    url: api + `/teacher/queryStudent`,
+    method: 'get',
+    params: data
+  })
+}
+
+// 修改老师服务学生
+export function batchUpdateAdviser (data) {
+  return request({
+    url: api + '/studentManage/batchUpdateAdviser',
+    method: 'post',
+    data: qs.stringify(data)
+  })
 }

+ 82 - 11
src/views/teacherManager/teacherDetail/components/courseInfo.vue

@@ -16,17 +16,20 @@
         <el-button type="danger"
                    @click='search'>搜索</el-button>
       </el-form-item>
-      <!-- <el-form-item>
-        <div class="newBand">课程交移</div>
-      </el-form-item> -->
+      <el-form-item>
+        <div class="newBand"
+             @click="resetCourses"
+             v-permission="'courseSchedule/classGroupTeacherAdjust'">课程交移</div>
+      </el-form-item>
     </el-form>
     <div class="tableWrap">
       <el-table :data='tableList'
                 @selection-change="handleSelectionChange"
                 :header-cell-style="{background:'#EDEEF0',color:'#444'}">
-        <!-- <el-table-column type="selection"
+        <el-table-column type="selection"
+                         :selectable='selectable'
                          width="55">
-        </el-table-column> -->
+        </el-table-column>
         <el-table-column label="乐团编号"
                          align="center"
                          prop="musicGroupId">
@@ -64,11 +67,18 @@
                          align="center"
                          prop="attendanceNum">
         </el-table-column>
+        <el-table-column label="是否可调整"
+                         align="center">
+          <template slot-scope="scope">
+            {{ scope.row.hasRestClass>0?'是':'否' }}
+          </template>
+        </el-table-column>
         <el-table-column label="操作"
                          align="center">
           <template slot-scope="scope">
             <div>
               <el-button type="text"
+                         v-permission="'courseSchedule/classGroupTeacherAdjust'"
                          @click="resetCourse(scope.row)">操作</el-button>
             </div>
           </template>
@@ -82,9 +92,12 @@
     </div>
     <el-dialog title='课程移交'
                :visible.sync="maskVisible"
-               width="600">
-      <el-form :model="maskForm">
-        <el-form-item label="选择老师">
+               width="400px">
+      <el-form :model="maskForm"
+               ref="maskForm">
+        <el-form-item label="选择老师"
+                      prop="targetTeacherId"
+                      :rules="[{ required: true, message: '请选择老师',trigger: 'blur'}]">
           <el-select v-model="maskForm.targetTeacherId"
                      clearable
                      filterable>
@@ -94,6 +107,13 @@
                        :key="index"></el-option>
           </el-select>
         </el-form-item>
+        <!-- <el-form-item label="备注"
+                      prop='memo'
+                      :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]">
+          <el-input type="textarea"
+                    :rows="5"
+                    v-model="maskForm.memo"></el-input>
+        </el-form-item> -->
       </el-form>
       <div slot="footer"
            class="dialog-footer">
@@ -135,8 +155,11 @@ export default {
       activeRow: null,
       maskVisible: false,
       maskForm: {
-        targetTeacherId: null
+        targetTeacherId: null,
+        memo: null
       },
+      isMultiple: false,
+      chioseList: []
     }
   },
   activated () {
@@ -155,7 +178,12 @@ export default {
     });
   },
   methods: {
-    handleSelectionChange (val) { },
+    selectable (row, index) {
+      return row.hasRestClass > 0
+    },
+    handleSelectionChange (val) {
+      this.chioseList = val
+    },
     search () {
       this.pageInfo.page = 1;
       this.getList();
@@ -175,9 +203,52 @@ export default {
     },
     resetCourse (row) {
       this.activeRow = row;
+      this.isMultiple = false
       this.maskVisible = true
     },
-    submitReset () { }
+    resetCourses () {
+      if (this.chioseList.length <= 0) {
+        this.$message.error('请至少选择一个乐团')
+        return
+      }
+      this.isMultiple = true
+      this.maskVisible = true
+    },
+    submitReset () {
+      this.$refs['maskForm'].validate(valid => {
+        if (valid) {
+          let obj = {};
+          if (this.isMultiple) {
+            // 批量调整
+            obj.classGroupIds = this.chioseList.map(res => {
+              return res.classGroupIds
+            }).join(',')
+          } else {
+            // 单词调整
+            obj.classGroupIds = this.activeRow.classGroupIds
+          }
+          obj.targetTeacherId = this.maskForm.targetTeacherId;
+          obj.teacherId = this.teacherId;
+          // obj.memo = this.maskForm.memo;
+          classGroupTeacherAdjust(obj).then(res => {
+            if (res.code == 200) {
+              this.maskVisible = false;
+              this.$message.success('修改成功')
+              this.getList()
+            }
+          })
+        }
+      })
+
+    }
+  },
+  watch: {
+    maskVisible (val) {
+      if (!val) {
+        this.maskForm.targetTeacherId = null;
+        this.maskForm.memo = null
+      }
+    }
   }
 }
 </script>

+ 196 - 0
src/views/teacherManager/teacherDetail/components/serveStudentList.vue

@@ -0,0 +1,196 @@
+<template>
+  <div class='courseInfo'>
+    <div class="newBand"
+         @click="resetCourses"
+         v-permission="'studentManage/batchUpdateAdviser'">课程交移</div>
+    <div class="tableWrap tableMargin">
+      <!-- <h4>试听课</h4> -->
+      <el-table :data='tableList'
+                @selection-change="handleSelectionChange"
+                :header-cell-style="{background:'#EDEEF0',color:'#444'}">
+        <el-table-column type="selection"
+                         width="55">
+        </el-table-column>
+        <el-table-column label="学员编号"
+                         width="150"
+                         prop='userId'>
+        </el-table-column>
+        <el-table-column label="学员名字"
+                         width="150"
+                         prop="name">
+        </el-table-column>
+        <el-table-column label="操作"
+                         align="right"
+                         prop="subjectNames">
+          <template slot-scope="scope">
+            <div>
+              <el-button type="text"
+                         v-permission="'studentManage/batchUpdateAdviser'"
+                         @click="resetCourse(scope.row)">操作</el-button>
+            </div>
+          </template>
+
+        </el-table-column>
+        <el-table-column width="40"
+                         align="right">
+        </el-table-column>
+      </el-table>
+      <pagination :total="pageInfo.total"
+                  :page.sync="pageInfo.page"
+                  :limit.sync="pageInfo.limit"
+                  :page-sizes="pageInfo.page_size"
+                  @pagination="getList" />
+    </div>
+    <el-dialog title='课程移交'
+               :visible.sync="maskVisible"
+               width="400px">
+      <el-form :model="maskForm"
+               ref="maskForm">
+        <el-form-item label="选择老师"
+                      prop="teacherId"
+                      :rules="[{ required: true, message: '请选择老师',trigger: 'blur'}]">
+          <el-select v-model="maskForm.teacherId"
+                     clearable
+                     filterable>
+            <el-option v-for="(item,index) in teacherList"
+                       :label="item.realName"
+                       :value="item.id"
+                       :key="index"></el-option>
+          </el-select>
+        </el-form-item>
+        <!-- <el-form-item label="备注"
+                      prop='memo'
+                      :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]">
+          <el-input type="textarea"
+                    :rows="5"
+                    v-model="maskForm.memo"></el-input>
+        </el-form-item> -->
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="maskVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   @click="submitReset">确定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { queryStudent, batchUpdateAdviser } from '@/api/teacherManager'
+import { getTeacher } from "@/api/buildTeam";
+import pagination from '@/components/Pagination/index'
+import store from '@/store'
+export default {
+  name: 'courseInfo2',
+  components: {
+    pagination
+  },
+  data () {
+    return {
+      tableList: [],
+      organId: null,
+      teacherId: this.$route.query.teacherId,
+      isMultiple: false,
+      maskVisible: false,
+      teacherList: [],
+      chioseList: [],
+      maskForm: {
+        educationalTeacherId: null,
+        memo: null
+      },
+      pageInfo: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 1, // 总条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
+      }
+    }
+  },
+  mounted () {
+    getTeacher({}).then(res => {
+      if (res.code == 200) {
+        this.teacherList = res.data;
+      }
+    });
+    this.getList()
+  },
+  activated () {
+    this.teacherId = this.$route.query.teacherId
+    this.getList()
+  },
+  methods: {
+    getList () {
+      queryStudent({
+        search: this.teacherId,
+        page: this.pageInfo.page,
+        rows: this.pageInfo.limit
+      }).then(res => {
+        if (res.code == 200) {
+          this.tableList = res.data.rows;
+          this.pageInfo.total = res.data.total;
+        }
+      })
+    },
+    resetCourse (row) {
+      this.activeRow = row;
+      this.isMultiple = false
+      this.maskVisible = true
+    },
+    resetCourses () {
+      if (this.chioseList.length <= 0) {
+        this.$message.error('请至少选择一个乐团')
+        return
+      }
+      this.isMultiple = true
+      this.maskVisible = true
+    },
+    handleSelectionChange (val) {
+      this.chioseList = val
+    },
+    submitReset () {
+      this.$refs['maskForm'].validate(valid => {
+        if (valid) {
+          let obj = {};
+          if (this.isMultiple) {
+            // 批量调整
+            obj.studentIds = this.chioseList.map(res => {
+              return res.userId
+            }).join(',')
+          } else {
+            // 单词调整
+            obj.studentIds = this.activeRow.userId
+          }
+          obj.teacherId = this.maskForm.teacherId;
+          // obj.memo = this.maskForm.memo;
+          batchUpdateAdviser(obj).then(res => {
+            if (res.code == 200) {
+              this.maskVisible = false;
+              this.$message.success('修改成功')
+              this.getList()
+            }
+          })
+        }
+      })
+
+    }
+  },
+  watch: {
+    maskVisible (val) {
+      if (!val) {
+        this.maskForm.teacherId = null;
+      }
+    }
+  }
+}
+</script>
+<style lang="scss" scope>
+.courseInfo {
+  h4 {
+    margin-bottom: 20px;
+  }
+  .tableMargin {
+    margin-top: 20px;
+  }
+}
+</style>

+ 169 - 41
src/views/teacherManager/teacherDetail/components/teacherNetwork.vue

@@ -1,72 +1,142 @@
 <!--  -->
 <template>
   <div class>
+    <div class="newBand"
+         @click="resetCourses"
+         v-permission="'courseSchedule/practiceGroupTeacherAdjust'">课程交移</div>
     <div class="m-core">
       <div class="tableWrap">
-        <el-table
-          style="width: 100%"
-          :header-cell-style="{background:'#EDEEF0',color:'#444'}"
-          :data="tableList"
-        >
-          <el-table-column align="center" prop="id" label="课程编号"></el-table-column>
-          <el-table-column align="center" prop="name" label="课程名称"></el-table-column>
+        <el-table style="width: 100%"
+                  :header-cell-style="{background:'#EDEEF0',color:'#444'}"
+                  @selection-change="handleSelectionChange"
+                  :data="tableList">
+          <el-table-column type="selection"
+                           :selectable='selectable'
+                           width="55">
+          </el-table-column>
+          <el-table-column align="center"
+                           prop="id"
+                           label="课程组编号"></el-table-column>
+          <el-table-column align="center"
+                           prop="name"
+                           label="课程组名称"></el-table-column>
           <!-- <el-table-column align="center" prop="subjectName" label="声部"></el-table-column>
           <el-table-column align="center" prop="teacherName" label="指导老师"></el-table-column> -->
-          <el-table-column align="center" prop="type" label="课程组类型" width="100">
+          <el-table-column align="center"
+                           prop="type"
+                           label="课程组类型"
+                           width="100">
             <template slot-scope="scope">
               <div>
                 <p>{{scope.row.type | comType}}</p>
               </div>
             </template>
           </el-table-column>
-             <el-table-column align="center" prop="groupStatus" label="课程组状态">
-                   <template slot-scope="scope">
+          <el-table-column align="center"
+                           prop="groupStatus"
+                           label="课程组状态">
+            <template slot-scope="scope">
               <div>
                 <p>{{scope.row.groupStatus | comCourseGroup}}</p>
               </div>
             </template>
-             </el-table-column>
-             <el-table-column align="center" label="开始时间">
-                 <template slot-scope="scope">
-                     <div>
-                          <div>{{scope.row.coursesStartDate|dateForMinFormat}}</div>
-                     </div>
-                 </template>
-             </el-table-column>
-             <el-table-column align="center" label="结束时间">
-                  <template slot-scope="scope">
-                     <div>
-                          <div>{{scope.row.coursesExpireDate|dateForMinFormat}}</div>
-                     </div>
-                 </template>
-             </el-table-column>
+          </el-table-column>
+          <el-table-column align="center"
+                           label="开始时间">
+            <template slot-scope="scope">
+              <div>
+                <div>{{scope.row.coursesStartDate|dateForMinFormat}}</div>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column align="center"
+                           label="结束时间">
+            <template slot-scope="scope">
+              <div>
+                <div>{{scope.row.coursesExpireDate|dateForMinFormat}}</div>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column label="是否可调整"
+                           align="center">
+            <template slot-scope="scope">
+              {{ scope.row.hasRestClass>0?'是':'否' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="操作"
+                           align="center">
+            <template slot-scope="scope">
+              <div>
+                <el-button type="text"
+                           v-permission="'courseSchedule/practiceGroupTeacherAdjust'"
+                           @click="resetCourse(scope.row)">操作</el-button>
+              </div>
+            </template>
+          </el-table-column>
         </el-table>
-        <pagination
-          :total="rules.total"
-          :page.sync="rules.page"
-          :limit.sync="rules.limit"
-          :page-sizes="rules.page_size"
-          @pagination="getList"
-        />
+        <pagination :total="rules.total"
+                    :page.sync="rules.page"
+                    :limit.sync="rules.limit"
+                    :page-sizes="rules.page_size"
+                    @pagination="getList" />
       </div>
     </div>
+    <el-dialog title='课程移交'
+               :visible.sync="maskVisible"
+               width="400px">
+      <el-form :model="maskForm"
+               ref="maskForm">
+        <el-form-item label="选择老师"
+                      prop="educationalTeacherId"
+                      :rules="[{ required: true, message: '请选择老师',trigger: 'blur'}]">
+          <el-select v-model="maskForm.educationalTeacherId"
+                     clearable
+                     filterable>
+            <el-option v-for="(item,index) in teacherList"
+                       :label="item.realName"
+                       :value="item.id"
+                       :key="index"></el-option>
+          </el-select>
+        </el-form-item>
+        <!-- <el-form-item label="备注"
+                      :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]"
+                      prop='memo'>
+          <el-input type="textarea"
+                    :rows="5"
+                    v-model="maskForm.memo"></el-input>
+        </el-form-item> -->
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="maskVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   @click="submitReset">确定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import pagination from "@/components/Pagination/index";
 import load from "@/utils/loading";
-import { practiceGroupManage } from "@/api/buildTeam";
+import { practiceGroupManage, getTeacher, practiceGroupTeacherAdjust } from "@/api/buildTeam";
 export default {
   components: { pagination },
-  data() {
+  data () {
     return {
       searchForm: {
         search: null
       },
       teacherId: null,
       tableList: [],
-
+      isMultiple: false,
+      maskVisible: false,
+      teacherList: [],
+      chioseList: [],
+      maskForm: {
+        educationalTeacherId: null,
+        memo: null
+      },
       rules: {
         // 分页规则
         limit: 10, // 限制显示条数
@@ -77,21 +147,29 @@ export default {
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created () { },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
+  mounted () {
+    getTeacher({}).then(res => {
+      if (res.code == 200) {
+        this.teacherList = res.data;
+      }
+    });
     // 获取分部
     this.init();
   },
-  activated() {
+  activated () {
     this.init();
   },
   methods: {
-    init() {
-       this.teacherId = this.$route.query.teacherId
+    selectable (row, index) {
+      return row.hasRestClass > 0
+    },
+    init () {
+      this.teacherId = this.$route.query.teacherId
       this.getList();
     },
-    getList() {
+    getList () {
       practiceGroupManage({
         teacherId: this.teacherId,
         page: this.rules.page,
@@ -102,6 +180,56 @@ export default {
           this.rules.total = res.data.total;
         }
       });
+    },
+    resetCourse (row) {
+      this.activeRow = row;
+      this.isMultiple = false
+      this.maskVisible = true
+    },
+    resetCourses () {
+      if (this.chioseList.length <= 0) {
+        this.$message.error('请至少选择一个乐团')
+        return
+      }
+      this.isMultiple = true
+      this.maskVisible = true
+    },
+    handleSelectionChange (val) {
+      this.chioseList = val
+    },
+    submitReset () {
+      this.$refs['maskForm'].validate(valid => {
+        if (valid) {
+          let obj = {};
+          if (this.isMultiple) {
+            // 批量调整
+            obj.practiceGroupId = this.chioseList.map(res => {
+              return res.id
+            }).join(',')
+          } else {
+            // 单词调整
+            obj.practiceGroupId = this.activeRow.id
+          }
+          obj.educationalTeacherId = this.maskForm.educationalTeacherId;
+          obj.teacherId = this.teacherId;
+          // obj.memo = this.maskForm.memo;
+          practiceGroupTeacherAdjust(obj).then(res => {
+            if (res.code == 200) {
+              this.maskVisible = false;
+              this.$message.success('修改成功')
+              this.getList()
+            }
+          })
+        }
+      })
+    }
+  },
+  watch: {
+    maskVisible (val) {
+      if (!val) {
+        this.maskForm.educationalTeacherId = null;
+        this.maskForm.memo = null
+      }
     }
   }
 };

+ 48 - 18
src/views/teacherManager/teacherDetail/index.vue

@@ -1,38 +1,64 @@
 <template>
   <div class="m-container">
     <h2>
-      <el-page-header @back="onCancel" :content="teacherName"></el-page-header>
+      <el-page-header @back="onCancel"
+                      :content="teacherName"></el-page-header>
     </h2>
     <div class="m-core">
       <!-- navMenu -->
-      <el-tabs v-model.trim="activeName" type="card" @tab-click="handleClick">
-        <el-tab-pane label="基本信息" v-if="permissionList.teacherInfo" name="0">
+      <el-tabs v-model.trim="activeName"
+               type="card"
+               @tab-click="handleClick">
+        <el-tab-pane label="基本信息"
+                     v-if="permissionList.teacherInfo"
+                     name="0">
           <teacherInfo v-if="activeName == 0" />
         </el-tab-pane>
-        <el-tab-pane label="乐团课" v-if="permissionList.musicGroup" name="1">
+        <el-tab-pane label="乐团课"
+                     v-if="permissionList.musicGroup"
+                     name="1">
           <courseInfo v-if="activeName == 1" />
         </el-tab-pane>
-        <el-tab-pane label="VIP课" v-if="permissionList.VipCourse" name="2">
+        <el-tab-pane label="VIP课"
+                     v-if="permissionList.VipCourse"
+                     name="2">
           <courseInfo1 v-if="activeName == 2" />
         </el-tab-pane>
-        <el-tab-pane label="网管课" v-if="permissionList.teacherNetwork" name="8">
+        <el-tab-pane label="网管课"
+                     v-if="permissionList.teacherNetwork"
+                     name="8">
           <teacherNetwork v-if="activeName == 8" />
         </el-tab-pane>
-        <el-tab-pane label="对外课" v-if="permissionList.outCourseList" name="3">
+        <el-tab-pane label="对外课"
+                     v-if="permissionList.outCourseList"
+                     name="3">
           <outCourseList v-if="activeName == 3" />
         </el-tab-pane>
-        <el-tab-pane label="课表详情" v-if="permissionList.teacherRecord" name="4">
+        <el-tab-pane label="课表详情"
+                     v-if="permissionList.teacherRecord"
+                     name="4">
           <teacherRecord v-if="activeName == 4" />
         </el-tab-pane>
-        <el-tab-pane label="请假记录" v-if="permissionList.leaveRecord" name="5">
+        <el-tab-pane label="请假记录"
+                     v-if="permissionList.leaveRecord"
+                     name="5">
           <leaveRecord v-if="activeName == 5" />
         </el-tab-pane>
-        <el-tab-pane label="上课结算列表" v-if="permissionList.settlement" name="6">
+        <el-tab-pane label="上课结算列表"
+                     v-if="permissionList.settlement"
+                     name="6">
           <settlement v-if="activeName == 6" />
         </el-tab-pane>
-        <el-tab-pane label="时间记录" v-if="permissionList.timerList" name="7">
+        <el-tab-pane label="时间记录"
+                     v-if="permissionList.timerList"
+                     name="7">
           <timerList v-if="activeName == 7" />
         </el-tab-pane>
+        <el-tab-pane label="学员"
+                     v-if="permissionList.serveStudentList"
+                     name="9">
+          <serveStudentList v-if="activeName == 9" />
+        </el-tab-pane>
       </el-tabs>
     </div>
   </div>
@@ -48,6 +74,7 @@ import settlement from "@/views/teacherManager/teacherDetail/components/settleme
 import timerList from "@/views/teacherManager/teacherDetail/components/timerList";
 import outCourseList from "@/views/teacherManager/teacherDetail/components/outCourseList";
 import teacherNetwork from "@/views/teacherManager/teacherDetail/components/teacherNetwork";
+import serveStudentList from "@/views/teacherManager/teacherDetail/components/serveStudentList";
 import { permission } from "@/utils/directivePage";
 export default {
   components: {
@@ -60,10 +87,11 @@ export default {
     settlement,
     timerList,
     outCourseList,
-    teacherNetwork
+    teacherNetwork,
+    serveStudentList
   },
   name: "teacherDetail",
-  data() {
+  data () {
     return {
       teacherName: this.$route.query.teacherName,
       activeName: "0",
@@ -78,13 +106,15 @@ export default {
         settlement: permission("/teacherDetail/settlement"),
         timerList: permission("/teacherDetail/timerList"),
         outCourseList: permission("/teacherDetail/outCourseList"), // 
-        teacherNetwork:permission("/teacherDetail/teacherNetwork"),
+        teacherNetwork: permission("/teacherDetail/teacherNetwork"),
+        serveStudentList: permission("/teacherDetail/serveStudentList"),
+
       },
       Fsearch: null,
       Frules: null
     };
   },
-  activated() {
+  activated () {
     this.teacherName = this.$route.query.teacherName;
     if (this.$route.query.search) {
       this.Fsearch = this.$route.query.search;
@@ -95,7 +125,7 @@ export default {
     this.activeName = "0";
   },
 
-  created() {
+  created () {
     if (this.$route.query.search) {
       this.Fsearch = this.$route.query.search;
     }
@@ -104,11 +134,11 @@ export default {
     }
   },
   methods: {
-    handleClick(val, event) {
+    handleClick (val, event) {
       this.activeName = val.name;
       // this.activeStatus[val.name] = true
     },
-    onCancel() {
+    onCancel () {
       this.$router.push({
         path: "/business/teacherList",
         query: { rules: this.Frules, search: this.Fsearch }