<template>
  <div>
    <el-form
      :model="maskForm"
      class="maskForm"
      ref="maskForm"
      :rules="maskRules"
      label-position="right"
      :inline="true"
    >
      <!--  label-width="120px" -->
      <el-row>
        <el-col :span="12">
          <el-form-item label="主教老师" prop="teacher">
            <remote-search
              :commit="'setTeachers'"
              v-model="maskForm.teacher"
              :width="220"
            />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="助教老师" prop="assistant">
            <!-- :multiple="true" -->
            <remote-search
              :commit="'setTeachers'"
              v-model="maskForm.assistant"
              :multiple="true"
              :width="220"
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="buttonWrap">
      <el-button @click="gotoNext" type="primary">下一步</el-button>
          <el-button @click="()=>{$emit('cancaleMerge')}" >取 消</el-button>
    </div>
  </div>
</template>
<script>
export default {
  props:['idList','dataList'],
  data() {
    return {
      maskForm: {
        teacher: "",
        assistant: [],
      },
      maskRules: {
        teacher: [
          { required: true, message: "请选择主教老师名称", trigger: "blur" },
        ],
      },
    };
  },
  methods: {
    cancaleMerge() {
      this.$emit("cancaleMerge");
    },
    gotoNext() {
      this.$refs.maskForm.validate((reset) => {
        if (reset) {
          let classGroupTeacherMapperList = [
            { userId: this.maskForm.teacher, teacherRole: "BISHOP" },
          ];
          for (let i in this.maskForm.assistant) {
            classGroupTeacherMapperList.push({
              userId: this.maskForm.assistant[i],
              teacherRole: "TEACHING",
            });
          }
          let obj = {
            courseScheduleIds: this.idList,
            changeMainTeacher: true,
            changeTeachingTeacher: true,
            startDate: null,
            startTime: "",
            pauseDate: "",
            recoveryDate: "",
            classGroupTeacherMapperList:classGroupTeacherMapperList,
            teachMode: null,
            allowZeroSalary: false,
            schoolId: null,
            confirmGenerate: false,
            holiday: false,
          };
          this.$emit("submit", obj);
        }
      });
    },
  },
};
</script>
<style  lang="scss" scoped>
  .buttonWrap{
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
  }
</style>
