studentWroks.vue 5.2 KB

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