Explorar el Código

Merge branch 'Inspection' into online

wolyshaw hace 4 años
padre
commit
614eb9170d

+ 93 - 0
src/views/teamDetail/components/modals/change-teacher.vue

@@ -0,0 +1,93 @@
+<template>
+  <div>
+    <el-form
+      :model="form"
+      ref="form"
+      label-position="right"
+      label-width="80px;"
+      :inline="true"
+    >
+      <el-form-item
+        label="主教老师"
+        prop="coreTeacher"
+        :rules="[{ required: true, message: '请选择主教老师' }]"
+      >
+        <el-select
+          v-model.trim="form.coreTeacher"
+          placeholder="请选择主教老师"
+          clearable
+          filterable
+        >
+          <el-option
+            v-for="(item, index) in teacherList"
+            :key="index"
+            :label="item.realName"
+            :value="String(item.id)"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="助教老师"
+        prop="assistant"
+        v-if="activeType!='HIGH'&&activeType!='HIGH_ONLINE'"
+      >
+        <el-select
+          v-model.trim="form.assistant"
+          placeholder="请选择助教老师"
+          filterable
+          clearable
+          collapse-tags
+          multiple
+        >
+          <el-option
+            v-for="(item, index) in cooperationList"
+            :key="index"
+            :label="item.realName"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer" style="text-align: right;">
+      <el-button @click="$emit('close')">取 消</el-button>
+      <el-button type="primary" @click="subresetTeacher">确 定</el-button>
+    </div>
+  </div>
+</template>
+<script>
+import { practiceCourseTeacherAdjust } from '@/api/buildTeam'
+export default {
+  props: ['teacherList', 'cooperationList', 'detail', 'activeType'],
+  data() {
+    return {
+      form: {
+        coreTeacher: '',
+        assistant: [],
+      },
+    }
+  },
+  mounted() {
+    console.log(this.detail)
+    const row = this.detail
+    for (let i in row.classGroupTeacherMapperList) {
+      if (row.classGroupTeacherMapperList[i].teacherRole == "BISHOP") {
+        this.form.coreTeacher = String(row.classGroupTeacherMapperList[i].userId);
+      }
+      if (row.classGroupTeacherMapperList[i].teacherRole == "TEACHING") {
+        this.form.assistant.push(row.classGroupTeacherMapperList[i].userId);
+      }
+    }
+  },
+  methods: {
+    subresetTeacher () {
+      this.$refs.form.validate(some => {
+        if (some) {
+          this.$emit('submited', {...this.form});
+        } else {
+          return;
+        }
+      });
+    }
+  }
+};
+</script>

+ 56 - 5
src/views/teamDetail/components/modals/select-student.vue

@@ -1,6 +1,55 @@
 <template>
 <template>
   <div>
   <div>
-    <el-form :model="form" ref="form" label-suffix=": " inline>
+    <el-form :model="form" ref="form" label-suffix=": " inline label-width="90px">
+      <el-row>
+        <el-col :span="10" v-if="showName">
+          <el-form-item
+            label="主教老师"
+            prop="coreTeacher"
+            v-if="!isOnlyChangeUser"
+            :rules="[{ required: true, message: '请选择主教老师' }]"
+          >
+            <el-select
+              v-model.trim="form.coreTeacher"
+              placeholder="请选择主教老师"
+              clearable
+              filterable
+            >
+              <el-option
+                v-for="(item, index) in teacherList"
+                :key="index"
+                :label="item.realName"
+                :value="String(item.id)"
+              ></el-option>
+            </el-select>
+            <!-- <remote-search :commit="'setTeachers'" v-model="form.coreTeacher"  /> -->
+          </el-form-item>
+        </el-col>
+        <el-col :span="10" :offset="4">
+          <el-form-item
+            label="助教老师"
+            prop="assistant"
+            v-if="!isOnlyChangeUser && activeType!='HIGH'&&activeType!='HIGH_ONLINE'"
+          >
+            <!-- <remote-search :commit="'setTeachers'" v-model="form.assistant"  :multiple='true'/> -->
+            <el-select
+              v-model.trim="form.assistant"
+              placeholder="请选择助教老师"
+              filterable
+              clearable
+              collapse-tags
+              multiple
+            >
+              <el-option
+                v-for="(item, index) in cooperationList"
+                :key="index"
+                :label="item.realName"
+                :value="item.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
       <el-row>
       <el-row>
         <el-col :span="10" v-if="showName">
         <el-col :span="10" v-if="showName">
           <el-form-item
           <el-form-item
@@ -18,7 +67,7 @@
           </el-form-item>
           </el-form-item>
         </el-col>
         </el-col>
         <el-col :span="10" :offset="showName ? 4 : 0">
         <el-col :span="10" :offset="showName ? 4 : 0">
-          <el-form-item label="声部">
+          <el-form-item label="声部" style="margin-right: 0;">
             <el-select
             <el-select
               v-model="sound"
               v-model="sound"
               style="width: 100%"
               style="width: 100%"
@@ -75,7 +124,7 @@ import { genderType } from "@/constant";
 import { updateClassGroupStudents } from '../../api'
 import { updateClassGroupStudents } from '../../api'
 import { uniqBy } from 'lodash'
 import { uniqBy } from 'lodash'
 export default {
 export default {
-  props: ["studentList", "soundList", "activeType", 'activeListStudent', 'isOnlyChangeUser', 'classGroupId', 'type'],
+  props: ["studentList", "soundList", "activeType", 'activeListStudent', 'isOnlyChangeUser', 'classGroupId', 'type', 'teacherList', 'cooperationList'],
   computed: {
   computed: {
     data() {
     data() {
       return uniqBy([...this.studentList, ...this.activeListStudent], 'userId')
       return uniqBy([...this.studentList, ...this.activeListStudent], 'userId')
@@ -105,6 +154,8 @@ export default {
       sound: [],
       sound: [],
       form: {
       form: {
         name: '',
         name: '',
+        coreTeacher: '',
+        assistant: '',
       },
       },
       seleched: [],
       seleched: [],
     };
     };
@@ -169,13 +220,13 @@ export default {
               this.$message.success('提交成功')
               this.$message.success('提交成功')
             } catch (error) {}
             } catch (error) {}
             this.$listeners.submited()
             this.$listeners.submited()
+            this.$listeners.close()
           } else {
           } else {
             this.$listeners.submited({
             this.$listeners.submited({
               seleched: this.seleched,
               seleched: this.seleched,
-              name: this.form.name
+              ...this.form
             })
             })
           }
           }
-          this.$listeners.close()
         }
         }
       })
       })
     }
     }

+ 99 - 6
src/views/teamDetail/components/resetClass.vue

@@ -109,7 +109,7 @@
               <div>{{ scope.row.totalClassTimes }}</div>
               <div>{{ scope.row.totalClassTimes }}</div>
             </template>
             </template>
           </el-table-column>
           </el-table-column>
-          <el-table-column align="center" width="220px" label="操作">
+          <el-table-column align="center" width="240px" label="操作">
             <template slot-scope="scope">
             <template slot-scope="scope">
               <div>
               <div>
                 <!-- v-if="scope.row.type !='MIX'" -->
                 <!-- v-if="scope.row.type !='MIX'" -->
@@ -122,13 +122,20 @@
                 >
                 >
                 <el-button
                 <el-button
                   type="text"
                   type="text"
+                  @click="resetTeacher(scope.row)"
+                  v-permission="'classGroup/classGroupUpdate'"
+                  v-if="scope.row.type != 'MUSIC_NETWORK'"
+                  >老师调整</el-button
+                >
+                <el-button
+                  type="text"
                   v-if="
                   v-if="
                     permission('classGroup/classGroupUpdate') ||
                     permission('classGroup/classGroupUpdate') ||
                     permission('classGroup/revisionClassGroup') ||
                     permission('classGroup/revisionClassGroup') ||
                     permission('classGroup/revisionAddClassGroup')
                     permission('classGroup/revisionAddClassGroup')
                   "
                   "
                   @click="classAdjustment(scope.row)"
                   @click="classAdjustment(scope.row)"
-                  >班级调整</el-button
+                  >排课</el-button
                 >
                 >
                 <!--<el-button type="text"
                 <!--<el-button type="text"
                 @click="recourse(scope.row)">重新排课</el-button>-->
                 @click="recourse(scope.row)">重新排课</el-button>-->
@@ -162,7 +169,7 @@
                       scope.row.totalClassTimes == '0'
                       scope.row.totalClassTimes == '0'
                     "
                     "
                     slot="reference"
                     slot="reference"
-                    >删除班级</el-button
+                    >删除</el-button
                   >
                   >
                 </el-popover>
                 </el-popover>
               </div>
               </div>
@@ -194,9 +201,26 @@
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
+    <el-dialog
+      title="老师调整"
+      width="750px"
+      :visible.sync="teacherVisible"
+      destroy-on-close
+    >
+      <changeTeacher
+        v-if="teacherVisible && teacherDetail"
+        :classGroupId="activeClass"
+        :activeType="activeType"
+        :teacherList="teacherList"
+        :cooperationList="cooperationList"
+        :detail="teacherDetail"
+        @submited="teacherSubmited"
+        @close="teacherVisible = false"
+      />
+    </el-dialog>
     <!-- 学员选择 -->
     <!-- 学员选择 -->
     <el-dialog
     <el-dialog
-      title="学员选择"
+      :title="isOnlyChangeUser ? '学员调整' : '新建班级'"
       width="750px"
       width="750px"
       :visible.sync="studentVisible"
       :visible.sync="studentVisible"
       destroy-on-close
       destroy-on-close
@@ -206,6 +230,8 @@
         :studentList="studentList"
         :studentList="studentList"
         :soundList="activeSoundList"
         :soundList="activeSoundList"
         :classGroupId="activeClass"
         :classGroupId="activeClass"
+        :teacherList="teacherList"
+        :cooperationList="cooperationList"
         :isOnlyChangeUser="isOnlyChangeUser"
         :isOnlyChangeUser="isOnlyChangeUser"
         :activeType="activeType"
         :activeType="activeType"
         @changeActiveChioseSound="changeActiveChioseSound"
         @changeActiveChioseSound="changeActiveChioseSound"
@@ -558,11 +584,26 @@ import axios from "axios";
 import { classTimeList, musicClassTypeList } from "@/utils/searchArray";
 import { classTimeList, musicClassTypeList } from "@/utils/searchArray";
 import viewStudentList from "./modals/view-student-list";
 import viewStudentList from "./modals/view-student-list";
 import selectStudent from "./modals/select-student";
 import selectStudent from "./modals/select-student";
+import changeTeacher from "./modals/change-teacher";
 import classroomSetting from "./modals/classroom-setting";
 import classroomSetting from "./modals/classroom-setting";
 import studentResetView from "./modals/student-reset-view";
 import studentResetView from "./modals/student-reset-view";
 import qs from "qs";
 import qs from "qs";
 import { permission } from "@/utils/directivePage";
 import { permission } from "@/utils/directivePage";
 import { getCourseType } from "@/utils/utils";
 import { getCourseType } from "@/utils/utils";
+
+const formatClassGroupTeacherMapperList = (core, ass) => {
+  const list = [];
+  if (core) {
+    list.push({ userId: core, teacherRole: "BISHOP" });
+  }
+  if (ass) {
+    for (const item of ass) {
+      list.push({ userId: item, teacherRole: "TEACHING" });
+    }
+  }
+  return list;
+};
+
 export default {
 export default {
   props: ["musicGroupInfo"],
   props: ["musicGroupInfo"],
   name: "tresetClass",
   name: "tresetClass",
@@ -571,9 +612,11 @@ export default {
     selectStudent,
     selectStudent,
     classroomSetting,
     classroomSetting,
     studentResetView,
     studentResetView,
+    changeTeacher,
   },
   },
   data() {
   data() {
     return {
     return {
+      teacherVisible: false,
       musicGroupInfos: this.musicGroupInfo,
       musicGroupInfos: this.musicGroupInfo,
       classType: 0,
       classType: 0,
       pickerOptions: {
       pickerOptions: {
@@ -679,6 +722,7 @@ export default {
         courseTime: "",
         courseTime: "",
         courseNum: "",
         courseNum: "",
       },
       },
+      teacherDetail: null,
       organId: "",
       organId: "",
       newClassVisible: false,
       newClassVisible: false,
       newClassForm: {
       newClassForm: {
@@ -767,10 +811,59 @@ export default {
       });
       });
       // 根据分部id和缴费类型获取 可选课程类型
       // 根据分部id和缴费类型获取 可选课程类型
     },
     },
+    resetTeacher(row) {
+      this.teacherVisible = true
+      this.teacherDetail = row
+    },
+    teacherSubmited(data) {
+      const obj = this.getSubmitData(data, {classGroupId: this.teacherDetail?.id, courseAddType: 'onlyUpdateTeacher'})
+      classGroupUpdate(obj).then((res) => {
+        if (res.code == 200) {
+          this.$message.success("修改成功");
+          this.teacherVisible = false;
+          this.getList();
+        }
+      });
+    },
+    getSubmitData(data, more = {}) {
+      return [{
+        type: this.activeType,
+        classGroupName: data?.name,
+        musicGroupId: this.teamid,
+        classGroupTeacherMapperList: formatClassGroupTeacherMapperList(
+          data.coreTeacher,
+          data.assistant
+        ),
+        students: data?.seleched,
+        ...more
+      }]
+    },
+    async submitClass(data) {
+      const list = this.getSubmitData(data, {onlyCreateClassGroup: true});
+      try {
+        if (this.classType == 1) {
+          // 0新建班级 2 3 4新增班级修改
+          await revisionClassGroup(list);
+          this.$message.success("提交成功");
+        } else if (
+          this.classType == 2 ||
+          this.classType == 3 ||
+          this.classType == 4
+        ) {
+          await revisionAddClassGroup(list);
+          this.$message.success("提交成功");
+        }
+        this.studentVisible = false
+        this.getList()
+      } catch (error) {
+        console.log(error);
+      }
+    },
     studentSubmited(data) {
     studentSubmited(data) {
       if (!this.isOnlyChangeUser) {
       if (!this.isOnlyChangeUser) {
-        this.studentSubmitedData = data;
-        this.infoVisible = true;
+        this.submitClass(data)
+        // this.studentSubmitedData = data;
+        // this.infoVisible = true;
       } else {
       } else {
         this.getList();
         this.getList();
       }
       }