resetCourses.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div>
  3. <el-form :inline="true" v-model="timeForm" ref="timeForm">
  4. <el-form-item label="开始时间" prop="starttime">
  5. <el-time-picker
  6. v-model="timeForm.starttime"
  7. @change="changeStartTime"
  8. format="HH:mm"
  9. value-format="HH:mm"
  10. :picker-options="{
  11. selectableRange: `04:00:00 - 23:59:00`,
  12. }"
  13. placeholder="选择时间"
  14. ></el-time-picker>
  15. </el-form-item>
  16. <el-form-item label="结束时间" prop="endTime">
  17. <el-time-picker
  18. v-model="timeForm.endTime"
  19. format="HH:mm"
  20. value-format="HH:mm"
  21. :disabled="true"
  22. placeholder="选择时间"
  23. ></el-time-picker>
  24. </el-form-item>
  25. <el-form-item label=" 上课模式" prop="teachMode" v-if="groupType == 'VIP'">
  26. <el-select
  27. v-model.trim="timeForm.teachMode"
  28. style="width: 220px !important"
  29. @change="()=>{timeForm.address=''}"
  30. >
  31. <el-option label="线上课" value="ONLINE"></el-option>
  32. <el-option label="线下课" value="OFFLINE"></el-option>
  33. <el-option label="不修改" value=""></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label=" 教学地点" prop="address" v-if="timeForm.teachMode == 'OFFLINE'&&groupType == 'VIP'">
  37. <el-select
  38. v-model.trim="timeForm.address"
  39. style="width: 220px !important"
  40. filterable
  41. clearable
  42. >
  43. <el-option
  44. v-for="(item, index) in schoolList"
  45. :key="index"
  46. :value="item.id"
  47. :label="item.name"
  48. ></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label=" 教学地点" prop="address" v-if="groupType == 'MUSIC'">
  52. <el-select
  53. v-model.trim="timeForm.address"
  54. style="width: 220px !important"
  55. filterable
  56. clearable
  57. >
  58. <el-option label="不修改" :value="''"></el-option>
  59. <el-option
  60. v-for="(item, index) in schoolList"
  61. :key="index"
  62. :value="item.id"
  63. :label="item.name"
  64. ></el-option>
  65. </el-select>
  66. </el-form-item>
  67. </el-form>
  68. <div class="buttonWrap">
  69. <el-button @click="gotoNext" type="primary">下一步</el-button>
  70. <el-button @click="()=>{$emit('cancaleMerge')}" >取 消</el-button>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  76. import { getSchool } from "@/api/systemManage";
  77. export default {
  78. props: ["idList", "dataList"],
  79. data() {
  80. return {
  81. timeForm: {
  82. starttime: null,
  83. endTime: "",
  84. teachMode: "",
  85. address: "",
  86. },
  87. timeRules: {
  88. endTime: [
  89. { required: true, message: "请选择结束时间", trigger: "blur" },
  90. ],
  91. address: [
  92. { required: true, message: "请选教学地点", trigger: "blur" },
  93. ],
  94. },
  95. schoolList: [],
  96. groupType:''
  97. };
  98. },
  99. mounted() {
  100. this.groupType = this.dataList[0].groupType
  101. getSchool().then((res) => {
  102. if (res.code == 200) {
  103. this.schoolList = res.data;
  104. }
  105. });
  106. },
  107. methods: {
  108. changeStartTime(val) {
  109. let dayjs = this.$helpers.dayjs;
  110. const time = diffTimerFormMinute(
  111. dayjs(this.dataList[0]?.classDate).format("YYYY-MM-DD"),
  112. dayjs(this.dataList[0]?.startClassTime).format("HH:mm"),
  113. dayjs(this.dataList[0]?.endClassTime).format("HH:mm")
  114. );
  115. if (val) {
  116. this.$nextTick((res) => {
  117. this.$set(this.timeForm, "starttime", val);
  118. });
  119. this.$set(
  120. this.timeForm,
  121. "endTime",
  122. addTimerFormMinute(
  123. dayjs(this.dataList[0]?.classDate).format("YYYY-MM-DD"),
  124. this.timeForm.starttime,
  125. time
  126. )
  127. );
  128. } else {
  129. this.$set(this.timeForm, "endTime", "");
  130. }
  131. },
  132. gotoNext() {
  133. if(!this.timeForm.starttime){
  134. this.$message.error('请选择开始时间')
  135. return
  136. }
  137. if(this.timeForm.teachMode == 'OFFLINE'&&this.groupType == 'VIP'&&!this.timeForm.address){
  138. this.$message.error('请选择教学点')
  139. return
  140. }
  141. let obj = {
  142. courseScheduleIds: this.idList,
  143. changeMainTeacher: false,
  144. changeTeachingTeacher: false,
  145. startDate: null,
  146. startTime: this.timeForm.starttime+":00",
  147. pauseDate: null,
  148. recoveryDate: null,
  149. classGroupTeacherMapperList: null,
  150. teachMode: this.timeForm.teachMode,
  151. allowZeroSalary: false,
  152. schoolId: this.timeForm.address,
  153. confirmGenerate: false,
  154. holiday: null,
  155. };
  156. this.$emit("submit", obj);
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="scss" scoped>
  162. .buttonWrap {
  163. width: 100%;
  164. display: flex;
  165. flex-direction: row;
  166. justify-content: flex-end;
  167. }
  168. </style>