|
@@ -46,14 +46,15 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-collapse v-model="collapses" @change="collapseChange">
|
|
<el-collapse v-model="collapses" @change="collapseChange">
|
|
<el-collapse-item
|
|
<el-collapse-item
|
|
- v-for="(item, index) in courseTypeList"
|
|
|
|
- :title="item.label"
|
|
|
|
|
|
+ v-for="(item, key, index) in form.classs"
|
|
:name="index"
|
|
:name="index"
|
|
- :key="index"
|
|
|
|
|
|
+ :key="key"
|
|
>
|
|
>
|
|
|
|
+ <template #title>
|
|
|
|
+ <p>{{courseTypeListByName[key]}}, 剩余可排课时长{{item.courseTotalMinuties}}分钟</p>
|
|
|
|
+ </template>
|
|
<courseItem
|
|
<courseItem
|
|
- :key="index"
|
|
|
|
- :form="form.classs[item.value]"
|
|
|
|
|
|
+ :form="item"
|
|
/>
|
|
/>
|
|
</el-collapse-item>
|
|
</el-collapse-item>
|
|
</el-collapse>
|
|
</el-collapse>
|
|
@@ -65,8 +66,22 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import { getMusicCourseSettingsWithStudents, classGroupUpdate } from '@/api/buildTeam'
|
|
|
|
|
|
+import { getMusicCourseSettingsWithStudents, classGroupUpdate, revisionClassGroup, revisionAddClassGroup } from '@/api/buildTeam'
|
|
import courseItem from "./classroom-setting-item";
|
|
import courseItem from "./classroom-setting-item";
|
|
|
|
+
|
|
|
|
+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: ["teacherList", "activeType", "courseTypeList", 'cooperationList', 'musicGroupId', 'detail', 'studentSubmitedData'],
|
|
props: ["teacherList", "activeType", "courseTypeList", 'cooperationList', 'musicGroupId', 'detail', 'studentSubmitedData'],
|
|
components: {
|
|
components: {
|
|
@@ -80,58 +95,77 @@ export default {
|
|
classs: {}
|
|
classs: {}
|
|
},
|
|
},
|
|
collapses: [0],
|
|
collapses: [0],
|
|
- courseTimes: {}
|
|
|
|
|
|
+ courseTimes: {},
|
|
|
|
+ courseTypeListByName: {}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- created() {
|
|
|
|
- const classs = {}
|
|
|
|
- for (const item of this.courseTypeList) {
|
|
|
|
- classs[item.value] = {
|
|
|
|
- cycle: [{}]
|
|
|
|
|
|
+ watch: {
|
|
|
|
+ courseTypeList() {
|
|
|
|
+ const courseTypeListByName = {}
|
|
|
|
+ for (const item of this.courseTypeList) {
|
|
|
|
+ courseTypeListByName[item.value] = item.label
|
|
}
|
|
}
|
|
|
|
+ this.courseTypeListByName = courseTypeListByName
|
|
|
|
+ },
|
|
|
|
+ studentSubmitedData() {
|
|
|
|
+ this.formatClasss()
|
|
|
|
+ },
|
|
|
|
+ detail() {
|
|
|
|
+ this.formatClasss()
|
|
}
|
|
}
|
|
- this.form.classs = classs
|
|
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
- try {
|
|
|
|
- const studentIds = this.detail ? this.detail.subjectIdList : this.studentSubmitedData.seleched.join(',')
|
|
|
|
- const res = await getMusicCourseSettingsWithStudents({
|
|
|
|
- musicGroupId: this.musicGroupId,
|
|
|
|
- studentIds: studentIds
|
|
|
|
- })
|
|
|
|
- const classs = {}
|
|
|
|
- const courseTimes = {}
|
|
|
|
- for (const item of res.data) {
|
|
|
|
- courseTimes[item.courseType] = item
|
|
|
|
- }
|
|
|
|
- for (const key in this.form.classs) {
|
|
|
|
- if (this.form.classs.hasOwnProperty(key)) {
|
|
|
|
- const item = this.form.classs[key]
|
|
|
|
|
|
+ this.formatClasss()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ async formatClasss() {
|
|
|
|
+ try {
|
|
|
|
+ console.log(this.detail)
|
|
|
|
+ const res = await getMusicCourseSettingsWithStudents({
|
|
|
|
+ musicGroupId: this.musicGroupId,
|
|
|
|
+ studentIds: (this.detail ? undefined : this.studentSubmitedData?.seleched.join(',')),
|
|
|
|
+ classGroupId: this.detail?.id
|
|
|
|
+ })
|
|
|
|
+ const classs = {}
|
|
|
|
+ const courseTimes = {}
|
|
|
|
+ for (const item of res.data) {
|
|
|
|
+ courseTimes[item.courseType] = item
|
|
|
|
+ }
|
|
|
|
+ for (const item of this.courseTypeList) {
|
|
|
|
+ const key = item.value
|
|
if (courseTimes[key]) {
|
|
if (courseTimes[key]) {
|
|
- classs[key] = item
|
|
|
|
|
|
+ classs[key] = {
|
|
|
|
+ courseTotalMinuties: courseTimes[key].courseTotalMinuties,
|
|
|
|
+ cycle: [{}]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ this.$set(this.form, 'classs', classs)
|
|
|
|
+ // this.courseTimes = courseTimes
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
}
|
|
}
|
|
- console.log(classs)
|
|
|
|
- this.$set(this.form, 'classs', classs)
|
|
|
|
- this.courseTimes = courseTimes
|
|
|
|
- } catch (error) {}
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
|
|
+ },
|
|
submit() {
|
|
submit() {
|
|
this.$refs.form.validate(async valid => {
|
|
this.$refs.form.validate(async valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- console.log({...this.form})
|
|
|
|
const list = []
|
|
const list = []
|
|
for (const key in this.form.classs) {
|
|
for (const key in this.form.classs) {
|
|
if (this.form.classs.hasOwnProperty(key)) {
|
|
if (this.form.classs.hasOwnProperty(key)) {
|
|
const item = this.form.classs[key];
|
|
const item = this.form.classs[key];
|
|
list.push({
|
|
list.push({
|
|
type: key,
|
|
type: key,
|
|
|
|
+ courseType: key,
|
|
classGroupId: this.detail?.id,
|
|
classGroupId: this.detail?.id,
|
|
|
|
+ musicGroupId: this.musicGroupId,
|
|
startDate: item.courseTime,
|
|
startDate: item.courseTime,
|
|
- coreTeacher: this.form.coreTeacher,
|
|
|
|
- assistant: this.form.assistant,
|
|
|
|
|
|
+ classGroupTeacherMapperList: formatClassGroupTeacherMapperList(
|
|
|
|
+ this.form.coreTeacher,
|
|
|
|
+ this.form.assistant
|
|
|
|
+ ),
|
|
|
|
+ holiday: item.holiday,
|
|
|
|
+ students: this.studentSubmitedData.seleched,
|
|
|
|
+ courseTimes: item.courseTimes,
|
|
courseTimeDtoList: item.cycle.map(_ => ({
|
|
courseTimeDtoList: item.cycle.map(_ => ({
|
|
courseType: key,
|
|
courseType: key,
|
|
dayOfWeek: _.dayOfWeek,
|
|
dayOfWeek: _.dayOfWeek,
|
|
@@ -142,9 +176,15 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- await classGroupUpdate(list)
|
|
|
|
- tthis.$message.success('排课成功')
|
|
|
|
- } catch (error) {}
|
|
|
|
|
|
+ if (this.detail) {
|
|
|
|
+ await classGroupUpdate(list)
|
|
|
|
+ tthis.$message.success('排课成功')
|
|
|
|
+ } else {
|
|
|
|
+ await revisionClassGroup(list)
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|