studentWroks.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="studentWroks">
  3. <el-checkbox-group
  4. v-if="subjectList.length > 1"
  5. @change="checkSubject"
  6. v-model="subjectId"
  7. size="medium"
  8. style="margin-bottom: 20px"
  9. >
  10. <el-checkbox-button
  11. :class="subjectList.length == 1 ? 'one' : ''"
  12. v-for="(item, index) in subjectList"
  13. :key="index"
  14. :label="item.id"
  15. >{{ item.name }}</el-checkbox-button
  16. >
  17. </el-checkbox-group>
  18. <el-table
  19. max-height="300px"
  20. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  21. :data="list"
  22. >
  23. <el-table-column type="expand">
  24. <template slot-scope="props">
  25. <el-table
  26. style="width: 100%;padding-left: 48px"
  27. :show-header="false"
  28. :data="props.row.studentLessonTrainingDetail"
  29. :border="false"
  30. >
  31. <el-table-column
  32. label="名称"
  33. prop="musicScoreName"
  34. ></el-table-column>
  35. <el-table-column label="类型" prop="type"
  36. ><template slot-scope="scope">{{
  37. scope.row.homeworkType === "MUSIC_SCORE" ? "曲目" : "视频"
  38. }}</template>
  39. </el-table-column>
  40. <el-table-column label="速度" prop="trainingSpeed">
  41. <template slot-scope="scope">
  42. <span v-if="scope.row.homeworkType === 'MUSIC_SCORE'">
  43. {{ scope.row.trainingSpeed }}速度
  44. </span>
  45. <span v-else>--</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="times" label="次数/总计">
  49. <template slot-scope="scope"
  50. >{{ scope.row.trainingTimes }}/{{ scope.row.times }}次</template
  51. >
  52. </el-table-column>
  53. </el-table>
  54. <!-- <el-row
  55. :gutter="20"
  56. v-for="(item, index) in props.row.studentLessonTrainingDetail"
  57. :key="index"
  58. >
  59. <el-col :span="12"
  60. ><div class="rowFirst">{{ item.musicScoreName }}</div></el-col
  61. >
  62. <el-col :span="6"
  63. ><div class="rowSecond">
  64. <span>{{ item.trainingSpeed }}</span> 速度
  65. </div></el-col
  66. >
  67. <el-col :span="6"
  68. ><div class="rowlast">
  69. <span :class="item.trainingTimes >= item.times ? '' : 'red'">{{
  70. item.trainingTimes
  71. }}</span>
  72. / {{ item.times }} 次
  73. </div></el-col
  74. >
  75. </el-row> -->
  76. </template>
  77. </el-table-column>
  78. <el-table-column prop="userName" align="left" label="学生姓名">
  79. </el-table-column>
  80. <el-table-column prop="phone" align="left" label="手机号">
  81. </el-table-column>
  82. <el-table-column prop="subjectName" align="left" label="声部名称">
  83. </el-table-column>
  84. <el-table-column prop="submitTime" align="left" label="完成时间">
  85. <template slot-scope="scope">
  86. <div>{{ scope.row.submitTime | dateForMinFormat }}</div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="finishFlag" align="right" label="训练情况">
  90. <template slot-scope="scope">
  91. <div>{{ scope.row.finishFlag ? "已完成" : "未完成" }}</div>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. </div>
  96. </template>
  97. <script>
  98. import { getHomeworkStudent, getHomeworkSubjectPublic } from "../api";
  99. export default {
  100. props: ["courseScheduleId"],
  101. data() {
  102. return {
  103. subjectId: [],
  104. list: [],
  105. subjectList: []
  106. };
  107. },
  108. mounted() {
  109. console.log(this.courseScheduleId, "mounted");
  110. if (this.courseScheduleId) {
  111. this.getStudentList(this.courseScheduleId);
  112. this.getPublicSubject();
  113. }
  114. },
  115. methods: {
  116. async getStudentList() {
  117. try {
  118. const res = await getHomeworkStudent({
  119. courseScheduleId: this.courseScheduleId,
  120. type: "HOMEWORK",
  121. subjectId: this.subjectId[0] ? this.subjectId[0] : ""
  122. });
  123. this.list = res.data;
  124. } catch (e) {
  125. console.log(e);
  126. }
  127. },
  128. async getPublicSubject() {
  129. try {
  130. const res = await getHomeworkSubjectPublic({
  131. courseScheduleId: this.courseScheduleId,
  132. type: "HOMEWORK"
  133. });
  134. this.subjectList = res.data;
  135. } catch (e) {
  136. console.log(e);
  137. }
  138. },
  139. checkSubject(val) {
  140. if (this.subjectId.length > 1) {
  141. this.subjectId.shift();
  142. }
  143. this.getStudentList();
  144. }
  145. }
  146. };
  147. </script>
  148. <style lang="scss" scoped>
  149. ::v-deep.one {
  150. .el-checkbox-button__inner {
  151. border-radius: 4px !important;
  152. }
  153. }
  154. .rowFirst {
  155. padding-left: 58px;
  156. color: #101010;
  157. }
  158. .rowSecond {
  159. text-align: right;
  160. span {
  161. color: #101010;
  162. }
  163. color: #9a9a9a;
  164. }
  165. .rowlast {
  166. text-align: right;
  167. padding-right: 10px;
  168. color: #101010;
  169. .red {
  170. color: #f44743;
  171. }
  172. }
  173. </style>