classList-item.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div>
  3. <!-- :closable="false" -->
  4. <el-alert
  5. :title="'班级' + (index + 1)"
  6. type="info"
  7. @close="deteleClass"
  8. :closable="index > 0"
  9. class="alert"
  10. >
  11. </el-alert>
  12. <el-form-item
  13. label="选择班级"
  14. style="padding-left: 20px"
  15. :rules="[{ required: true, message: '请选择班级', trigger: 'change' }]"
  16. :prop="'classList.' + index + '.classId'"
  17. >
  18. <el-select
  19. v-model="item.classId"
  20. style="margin-right: 20px"
  21. clearable
  22. @change="changeValue"
  23. >
  24. <el-option
  25. :label="item.name"
  26. :value="item.id"
  27. v-for="(item, index) in classList"
  28. :key="index"
  29. :disabled='item.disabled'
  30. ></el-option>
  31. </el-select>
  32. <el-button
  33. type="text"
  34. @click="lookStudentList"
  35. :disabled="!item.classId"
  36. class="studentTitle"
  37. >学员列表>></el-button
  38. >
  39. </el-form-item>
  40. <div class="infomsg">
  41. <div class="left" v-if="!isNoCourse">
  42. 剩余课时:
  43. <div v-for="(val, key) in item.courseList" :key="key">
  44. <p style="margin-right: 5px">
  45. {{ key | courseTypeFormat }}:<span>{{ val }}</span
  46. >节
  47. </p>
  48. </div>
  49. </div>
  50. <div class="left" v-else>
  51. <div>暂无剩余课时</div>
  52. </div>
  53. <div class="right">
  54. 已选学员:
  55. <p>
  56. <span>{{ item.studentList.length }}</span
  57. >人
  58. </p>
  59. </div>
  60. </div>
  61. <el-dialog
  62. title="学员列表"
  63. width="700px"
  64. :visible.sync="studentListModalVisible"
  65. append-to-body
  66. destroy-on-close
  67. >
  68. <viewStudentList
  69. :list="studentList"
  70. :chioseList="item.studentList"
  71. v-if="studentListModalVisible"
  72. :showOk="true"
  73. :isChiose="true"
  74. @close="closeStudentView"
  75. />
  76. </el-dialog>
  77. </div>
  78. </template>
  79. <script>
  80. import { getClassAllStudent } from "@/api/studentManager";
  81. import { getClassGroupSubCourseNum } from "@/api/buildTeam";
  82. import viewStudentList from "./view-student-list";
  83. import paymentCycle from "@/views/resetTeaming/modals/payment-cycle";
  84. import extraClass from "../../../resetTeaming/modals/extra-class";
  85. export default {
  86. props: ["item", "index", "classList", "form"],
  87. components: { viewStudentList, paymentCycle, extraClass },
  88. data() {
  89. return {
  90. studentList: [],
  91. studentListModalVisible: false,
  92. organizationCourseUnitPriceSettingsByType: [],
  93. eclass: [],
  94. isNoCourse: false,
  95. activeClassList: [],
  96. };
  97. },
  98. mounted() {
  99. this.activeClassList =this.classList
  100. },
  101. methods: {
  102. async changeValue(val) {
  103. this.item.studentList = [];
  104. if (val) {
  105. try {
  106. let reset = await getClassGroupSubCourseNum({ classGroupId: val });
  107. this.setClassCourse(reset.data);
  108. // 成功之后
  109. this.$emit("filterClassList", val);
  110. } catch {}
  111. } else {
  112. this.setClassCourse({});
  113. this.$emit("filterClassList", null);
  114. }
  115. },
  116. deteleClass() {
  117. this.$emit("deteleClass", this.index);
  118. },
  119. lookStudentList() {
  120. if (!this.item.classId) {
  121. this.$message.error("请先选择班级,再查询学生列表");
  122. return;
  123. }
  124. // 查学生
  125. getClassAllStudent({ classGroupId: this.item.classId }).then((res) => {
  126. if (res.code == 200) {
  127. this.studentList = res.data.map((item) => {
  128. return {
  129. userId: item.userId,
  130. nickName: item.name,
  131. gender: item.gender,
  132. phone: item.parentsPhone,
  133. subjectNames: item.subjectName,
  134. };
  135. });
  136. this.studentListModalVisible = true;
  137. }
  138. });
  139. },
  140. closeStudentView(list) {
  141. this.item.studentList = list;
  142. this.studentListModalVisible = false;
  143. },
  144. setClassCourse(data) {
  145. console.log(data);
  146. if (Object.keys(data).length > 0) {
  147. this.item.courseList = data;
  148. this.isNoCourse = false;
  149. } else {
  150. this.isNoCourse = true;
  151. }
  152. },
  153. priceChange() {},
  154. syncAllMoney() {},
  155. },
  156. };
  157. </script>
  158. <style lang="scss" scoped>
  159. .alert {
  160. margin-bottom: 10px;
  161. }
  162. .infomsg {
  163. background-color: #f5faf9;
  164. height: 34px;
  165. line-height: 34px;
  166. padding: 0 25px;
  167. color: #333;
  168. display: flex;
  169. flex-direction: row;
  170. justify-content: space-between;
  171. margin-bottom: 20px;
  172. div {
  173. display: flex;
  174. flex-direction: row;
  175. p {
  176. color: #1a1a1a;
  177. font-weight: bold;
  178. span {
  179. color: #3b7f7a;
  180. }
  181. }
  182. }
  183. }
  184. .studentTitle {
  185. width: 120px !important;
  186. text-align: right;
  187. display: inline-block;
  188. // color: #409eff;
  189. }
  190. /deep/.dialog-footer {
  191. display: flex;
  192. flex-direction: row;
  193. justify-content: flex-end;
  194. }
  195. </style>