class-pay-list.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div>
  3. <classPayListItem
  4. :payInfo="payInfo"
  5. ref="base"
  6. :courseTypesByType="courseTypesByType"
  7. v-for="(item, index) in form.classList"
  8. :key="index"
  9. :item="item"
  10. :index="index"
  11. />
  12. <div slot="footer" class="dialog-footer">
  13. <el-button @click="close">上一步</el-button>
  14. <el-button type="primary" @click="gotoLast">下一步</el-button>
  15. </div>
  16. <div style="clear: both"></div>
  17. <el-dialog
  18. :visible.sync="showLastVisable"
  19. title="合并结果确认"
  20. append-to-body
  21. width="800px"
  22. >
  23. <classSetting
  24. :form='form'
  25. ref="classSetting"
  26. :musicGroupPaymentCalenderDtos="musicGroupPaymentCalenderDtos"
  27. :classType="5"
  28. :teacherList="selects.teachers"
  29. :musicGroupId="teamid"
  30. :activeType="activeType"
  31. :courseTypeList="courseTypeList"
  32. :cooperationList="selects.teachers"
  33. :studentSubmitedData="studentSubmitedData"
  34. :classIdList="classIdList"
  35. :classGroupStudents="classGroupStudents"
  36. @close="showLastVisable = false"
  37. v-if="showLastVisable"
  38. />
  39. <div slot="footer" class="dialog-footer" >
  40. <el-button @click="showLastVisable = false">上一步</el-button>
  41. <el-button type="primary" @click="submitResetClass">确 定</el-button>
  42. </div>
  43. </el-dialog>
  44. </div>
  45. </template>
  46. <script>
  47. import { getDefaultPaymentCalender } from "@/api/buildTeam";
  48. import classNewInfo from "./class-new-info";
  49. import classPayListItem from './class-pay-list-item'
  50. import classSetting from './classroom-setting'
  51. import {getCourseType} from "@/utils/utils"
  52. export default {
  53. props: ["form", "payInfo", "courseTypesByType","classIdList"],
  54. components: {
  55. classNewInfo,
  56. classPayListItem,
  57. classSetting
  58. },
  59. data() {
  60. return {
  61. showLastVisable:false,
  62. musicGroupPaymentCalenderDtos:null,
  63. teacherList:[],
  64. studentList:[],
  65. teamid:'',
  66. activeType:'',
  67. courseTypeList:[],
  68. studentSubmitedData:{},
  69. classGroupStudents:[]
  70. };
  71. },
  72. methods: {
  73. init(){
  74. this.$store.dispatch('setTeachers')
  75. this.studentList = []
  76. let classGroupStudents = []
  77. this.form.classList.forEach(classes=>{
  78. this.studentList = this.studentList.concat(classes.studentList)
  79. let arr = []
  80. classes.studentList.forEach(stu=>{
  81. arr.push(stu.userId)
  82. })
  83. classGroupStudents.push({[classes.classId]:arr.join(',')})
  84. })
  85. this.classGroupStudents = classGroupStudents
  86. this.teamid = this.$route.query.id
  87. this.activeType = this.form.classList[0].type
  88. console.log(this.form.classList)
  89. this.courseTypeList = getCourseType(this.activeType)
  90. console.log('courseTypeList:',this.courseTypeList)
  91. this.studentSubmitedData = {
  92. name:'',
  93. seleched:this.studentList.map(stu=> {return stu.userId})
  94. }
  95. this.showLastVisable = true
  96. },
  97. close() {
  98. this.$emit("close");
  99. },
  100. getForms() {
  101. const { $refs: refs } = this;
  102. // [refs.base, refs.eclass, refs.cycle, ...(refs.cycles || []), refs.other, refs.payment]
  103. return [...refs.base]
  104. .filter((item) => !!item)
  105. .map((item) => item.$refs.form || item);
  106. },
  107. gotoLast() {
  108. const forms = this.getForms();
  109. let musicGroupPaymentCalenderDtos = []
  110. // 判断有没有缴费项目(因为又可能没有)
  111. // let flag = false
  112. for (const form of forms) {
  113. let data = form.getData()
  114. if(data){
  115. musicGroupPaymentCalenderDtos.push(data)
  116. }
  117. }
  118. // 弹出最后一页
  119. this.musicGroupPaymentCalenderDtos = musicGroupPaymentCalenderDtos
  120. this.init()
  121. },
  122. submitResetClass(){
  123. this.$refs.classSetting.submit()
  124. }
  125. },
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .studentTitle {
  130. width: 120px !important;
  131. text-align: right;
  132. display: inline-block;
  133. color: #409eff;
  134. }
  135. .dialog-footer {
  136. text-align: right;
  137. }
  138. </style>