lookCourse.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div>
  3. <el-form :inline="true">
  4. <el-form-item>
  5. <div class="newBand"
  6. @click="gotoPlan">新增</div>
  7. </el-form-item>
  8. <el-form-item label="选择合奏班">
  9. <el-select v-model="chioseMix"
  10. @change="chioseList">
  11. <el-option v-for='(item,index) in maxClassList'
  12. :key="index"
  13. :value="item.id"
  14. :label="item.name"></el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type='danger'
  19. @click="removeAllCourse">清空课表</el-button>
  20. </el-form-item>
  21. </el-form>
  22. <el-table :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  23. :data="tableList">
  24. <el-table-column prop="classDate"
  25. label="日期"
  26. align="center"
  27. width="180">
  28. <template slot-scope="scope">
  29. <div>
  30. {{ scope.row.classDate | formatTimer }}
  31. </div>
  32. </template>
  33. </el-table-column>
  34. </el-table-column>
  35. <el-table-column label="课程类型"
  36. align="center"
  37. width="180">
  38. <template slot-scope="scope">
  39. <div>
  40. {{scope.row.type |coursesType }}
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="classGroupName"
  45. align="center"
  46. label="班级名称">
  47. </el-table-column>
  48. <el-table-column prop="name"
  49. align="center"
  50. label="课程名称">
  51. </el-table-column>
  52. <el-table-column label="上课时间"
  53. align="left"
  54. width="180">
  55. <template slot-scope="scope">
  56. <div>
  57. {{ scope.row.startClassTimeStr+ '-'+ scope.row.endClassTimeStr}}
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column>
  62. </el-table-column>
  63. </el-table>
  64. <div class="btnWrap">
  65. <div class="setBtn"
  66. @click="gotoNext">下一步</div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import { getAllClass, getClassCOurse, deteleAllCourse } from '@/api/buildTeam'
  72. export default {
  73. name: 'lookCourse',
  74. props: {
  75. isSetSalary: {
  76. type: Boolean,
  77. required: true
  78. }
  79. },
  80. data () {
  81. return {
  82. teamid: '',
  83. maxClassList: [],
  84. chioseMix: '',
  85. tableList: []
  86. }
  87. }, mounted () {
  88. sessionStorage.setItem('setStep', 2)
  89. sessionStorage.setItem('resetCode', 4)
  90. this.teamid = this.$route.query.id;
  91. getAllClass({ musicGroupId: this.teamid }).then(res => {
  92. if (res.code == 200 && res.data.length > 0) {
  93. this.maxClassList = res.data;
  94. this.chioseMix = this.maxClassList[0].id;
  95. // 发请求获取数据
  96. getClassCOurse({ classGroupId: this.chioseMix }).then(res => {
  97. if (res.code == 200) {
  98. this.tableList = res.data;
  99. }
  100. })
  101. }
  102. })
  103. }, methods: {
  104. gotoPlan () {
  105. if (this.isSetSalary) {
  106. this.$message.error('课酬确认后无法编辑')
  107. return;
  108. }
  109. this.$router.push({ path: '/business/coursePlan', query: { id: this.teamid } })
  110. },
  111. gotoNext () {
  112. if (this.isSetSalary) {
  113. this.$message.error('课酬确认后无法编辑')
  114. return;
  115. }
  116. // 获取课程类型 3.0跳小班课 2.0跳课酬
  117. let type = sessionStorage.getItem('chargeTypeId');
  118. type == 3 ? this.$emit('gotoNav', 3) : this.$emit('gotoNav', 4)
  119. },
  120. chioseList (val) {
  121. getClassCOurse({ classGroupId: val }).then(res => {
  122. if (res.code == 200) {
  123. this.tableList = res.data;
  124. }
  125. })
  126. },
  127. // 删除乐团所有未上课程
  128. removeAllCourse () {
  129. if (this.isSetSalary) {
  130. this.$message.error('课酬确认后无法编辑')
  131. return;
  132. }
  133. this.$confirm('是否清除课程?', '提示', {
  134. confirmButtonText: '确定',
  135. cancelButtonText: '取消',
  136. type: 'warning'
  137. }).then(() => {
  138. deteleAllCourse({ musicGroupId: this.teamid }).then(res => {
  139. if (res.code == 200) {
  140. this.$message.success('删除成功');
  141. this.chioseList(this.maxClassList[0].id)
  142. }
  143. })
  144. })
  145. },
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .setBtn {
  151. width: 120px;
  152. height: 40px;
  153. line-height: 40px;
  154. text-align: center;
  155. border-radius: 4px;
  156. color: #fff;
  157. background-color: #444;
  158. cursor: pointer;
  159. margin: 20px 0;
  160. }
  161. </style>