studentAndTeacher.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <div>
  3. <el-alert title="" :closable="false" class="alert marginBtm22" type="info">
  4. <template slot="title">
  5. <div class="shapeWrap">
  6. <span class="shape"></span>
  7. <p style="margin-right: 5px">学员分布</p>
  8. <span v-if="graduateNums > 0" style="color: red; font-weight: bold"
  9. >该乐团当前有{{ graduateNums }}名学员在毕业年级</span
  10. >
  11. </div>
  12. </template>
  13. </el-alert>
  14. <p class="title">声部分布</p>
  15. <!-- <el-divider class="divider"></el-divider> -->
  16. <descriptions :column="4" class="descriptions" v-if="subject.length >= 4">
  17. <descriptions-item
  18. :label="item.key"
  19. :key="index"
  20. v-for="(item, index) in subject"
  21. >
  22. <div
  23. v-if="item.value"
  24. class="col-value"
  25. @click="getSoundInfo(item.courseScheduleId)"
  26. >
  27. {{ item.value }}人
  28. </div>
  29. </descriptions-item>
  30. </descriptions>
  31. <div
  32. v-else-if="subject.length > 0 && subject.length < 4"
  33. class="descriptions"
  34. >
  35. <div
  36. class="descriptionItem"
  37. :style="`width:${100 / 4}%`"
  38. :key="index"
  39. v-for="(item, index) in subject"
  40. >
  41. <div class="descriptionItemLabel">
  42. {{ item.key }}
  43. </div>
  44. <div
  45. class="descriptionItemConcat col-value"
  46. @click="getSoundInfo(item.courseScheduleId)"
  47. >
  48. {{ item.value }}人
  49. </div>
  50. </div>
  51. </div>
  52. <div v-else>
  53. <empty desc="暂无声部" />
  54. </div>
  55. <p class="title">年级分布</p>
  56. <!-- <el-divider class="divider"></el-divider> -->
  57. <descriptions :column="4" class="descriptions" v-if="grade.length >= 4">
  58. <descriptions-item
  59. :label="gradeMap[item.key]"
  60. :key="index"
  61. v-for="(item, index) in grade"
  62. >
  63. <div
  64. v-if="item.value"
  65. class="col-value"
  66. @click="getGradeInfo(String(item.key))"
  67. >
  68. {{ item.value || 0 }}人
  69. </div>
  70. </descriptions-item>
  71. </descriptions>
  72. <div v-else-if="grade.length > 0 && grade.length < 4" class="descriptions">
  73. <div
  74. class="descriptionItem"
  75. :style="`width:${100 / 4}%`"
  76. :key="index"
  77. v-for="(item, index) in grade"
  78. >
  79. <div class="descriptionItemLabel">
  80. {{ gradeMap[item.key] }}
  81. </div>
  82. <div
  83. class="descriptionItemConcat col-value"
  84. @click="getGradeInfo(String(item.key))"
  85. >
  86. {{ item.value || 0 }}人
  87. </div>
  88. </div>
  89. </div>
  90. <div v-else>
  91. <empty desc="暂无年纪" />
  92. </div>
  93. <el-alert :closable="false" class="alert marginBtm22" type="info">
  94. <template slot="title">
  95. <div class="shapeWrap">
  96. <span class="shape"></span>
  97. <p style="margin-right: 5px">师资安排</p>
  98. <el-tooltip placement="top" popper-class="mTooltip">
  99. <div slot="content">师资安排中第一位为主教老师</div>
  100. <i
  101. class="el-icon-question micon el-tooltip"
  102. style="font-size: 18px; color: #f56c6c"
  103. ></i>
  104. </el-tooltip>
  105. </div>
  106. </template>
  107. </el-alert>
  108. <el-form
  109. :inline="true"
  110. class="searchForm"
  111. save-key="teamTrainTimer"
  112. ref="searchForm"
  113. :model.sync="teacherForm"
  114. >
  115. <el-form-item label="班级类型">
  116. <el-select v-model.trim="teacherForm.type" clearable filterable>
  117. <el-option
  118. v-for="(item, index) in musicClassTypeList"
  119. :key="index"
  120. :label="item.label"
  121. :value="item.value"
  122. ></el-option>
  123. </el-select>
  124. </el-form-item>
  125. </el-form>
  126. <descriptions :column="4" class="descriptions" v-if="teacherFilter.length >= 4">
  127. <descriptions-item
  128. :label="item.key"
  129. :key="index"
  130. v-for="(item, index) in teacherFilter"
  131. >
  132. <div v-if="item.value">
  133. <overflow-text :text="item.value || ''"></overflow-text>
  134. </div>
  135. </descriptions-item>
  136. </descriptions>
  137. <div
  138. v-else-if="teacherFilter.length > 0 && teacherFilter.length < 4"
  139. class="descriptions"
  140. >
  141. <div
  142. class="descriptionItem"
  143. :style="`width:${100 / 4}%`"
  144. :key="index"
  145. v-for="(item, index) in teacherFilter"
  146. >
  147. <div class="descriptionItemLabel">
  148. <overflow-text :text="item.key || ''"></overflow-text>
  149. </div>
  150. <div class="descriptionItemConcat">
  151. <overflow-text :text="item.value || ''"></overflow-text>
  152. </div>
  153. </div>
  154. </div>
  155. <div v-else>
  156. <empty desc="暂无师资安排" />
  157. </div>
  158. <!-- <el-row class="row">
  159. <el-col
  160. class="col"
  161. :span="6"
  162. v-for="(item, index) in teacher"
  163. :key="index"
  164. >
  165. <span class="col-title">
  166. <overflow-text :text="item.key || ''"></overflow-text>:</span
  167. >
  168. <span>:</span>
  169. </el-col>
  170. </el-row> -->
  171. <!-- studentMaster -->
  172. <el-dialog
  173. width="1200px"
  174. title="学员列表"
  175. :visible.sync="studentVisible"
  176. v-if="studentVisible"
  177. >
  178. <studentMaster
  179. v-if="studentVisible"
  180. :searchForm="searchForm"
  181. :soundList="soundList"
  182. :gradeList="gradeList"
  183. :gradeMap="gradeMap"
  184. />
  185. <div slot="footer" class="dialog-footer">
  186. <el-button type="primary" @click="studentVisible = false"
  187. >确 定</el-button
  188. >
  189. </div>
  190. </el-dialog>
  191. </div>
  192. </template>
  193. <script>
  194. import { getStudentAndTeacher } from "./api";
  195. import studentMaster from "./modals/studentMaster";
  196. import { findSound } from "@/api/buildTeam";
  197. import { musicClassTypeList } from "@/utils/searchArray";
  198. export default {
  199. props: ["graduateNum"],
  200. components: { studentMaster },
  201. data() {
  202. return {
  203. grade: [],
  204. subject: [],
  205. teacher: [],
  206. studentVisible: false,
  207. searchForm: {
  208. search: "",
  209. subjectId: "",
  210. currentGradeNum: "",
  211. isBuyInstrumentsInsurance: "",
  212. },
  213. teamid: this.$route.query.id,
  214. soundList: [],
  215. gradeList: [],
  216. teacherForm:{
  217. type: "",
  218. },
  219. musicClassTypeList,
  220. };
  221. },
  222. async mounted() {
  223. findSound({ musicGroupId: this.teamid }).then((res) => {
  224. if (res.code == 200) {
  225. this.soundList = res.data;
  226. }
  227. });
  228. try {
  229. const res = await getStudentAndTeacher({
  230. musicGroupId: this.$route.query.id,
  231. });
  232. this.grade = res.data.grade;
  233. this.gradeMap = res.data.gradeMap;
  234. this.gradeList = [];
  235. for (let i in this.gradeMap) {
  236. this.gradeList.push({
  237. value: i,
  238. label: this.gradeMap[i],
  239. });
  240. }
  241. this.subject = res.data.subject;
  242. // if (this.subject.length > 0 && this.subject.length < 4) {
  243. // // 样式丑 至少对齐一排
  244. // for (let i = 0; i <= 4 - this.subject.length; i++) {
  245. // this.subject.push({ key: null, value: null });
  246. // }
  247. // }
  248. this.teacher = res.data.teacher;
  249. // if (this.teacher.length > 0 && this.teacher.length < 4) {
  250. // // 样式丑 至少对齐一排
  251. // for (let i = 0; i <= 4 - this.subject.length; i++) {
  252. // this.teacher.push({ key: null, value: null });
  253. // }
  254. // }
  255. } catch (e) {
  256. console.log(e);
  257. }
  258. },
  259. methods: {
  260. getSoundInfo(val) {
  261. this.$set(this, "searchForm", {
  262. search: "",
  263. subjectId: val,
  264. currentGradeNum: "",
  265. isBuyInstrumentsInsurance: "",
  266. });
  267. // this.searchForm = {
  268. // search: "",
  269. // subjectId: val,
  270. // currentGradeNum: "",
  271. // isBuyInstrumentsInsurance: "",
  272. // };
  273. this.studentVisible = true;
  274. },
  275. getGradeInfo(val) {
  276. this.$set(this, "searchForm", {
  277. search: "",
  278. subjectId: "",
  279. currentGradeNum: val,
  280. isBuyInstrumentsInsurance: "",
  281. });
  282. // this.searchForm = {
  283. // search: "",
  284. // subjectId: "",
  285. // currentGradeNum: val,
  286. // isBuyInstrumentsInsurance: "",
  287. // };
  288. this.studentVisible = true;
  289. },
  290. },
  291. computed: {
  292. graduateNums() {
  293. return this.graduateNum;
  294. },
  295. teacherFilter() {
  296. let arr = [];
  297. if (this.teacherForm.type) {
  298. arr = this.teacher.filter((item) => {
  299. return item.type == this.teacherForm.type;
  300. });
  301. } else {
  302. arr = this.teacher;
  303. }
  304. return arr;
  305. },
  306. },
  307. };
  308. </script>
  309. <style lang="scss" scoped="scoped">
  310. .title {
  311. padding: 8px 16px;
  312. }
  313. .divider {
  314. margin-top: 0 !important;
  315. }
  316. .marginBtm22 {
  317. margin-bottom: 22px;
  318. }
  319. .row {
  320. padding: 8px 16px;
  321. margin-bottom: 30px;
  322. .col {
  323. margin-bottom: 20px;
  324. .col-title {
  325. display: inline-block;
  326. width: 150px;
  327. text-align: right;
  328. }
  329. .col-value {
  330. color: #14928a;
  331. cursor: pointer;
  332. }
  333. }
  334. }
  335. .shapeWrap {
  336. display: flex;
  337. flex-direction: row;
  338. justify-content: flex-start;
  339. align-items: center;
  340. .shape {
  341. position: relative;
  342. top: -1px;
  343. display: block;
  344. margin-right: 10px;
  345. height: 14px;
  346. width: 4px;
  347. background-color: #14928a;
  348. z-index: 500;
  349. }
  350. }
  351. .descriptions {
  352. margin-bottom: 30px;
  353. display: flex;
  354. flex-direction: row;
  355. .col-value {
  356. color: #14928a;
  357. cursor: pointer;
  358. }
  359. .descriptionItem {
  360. display: flex;
  361. flex-direction: row;
  362. justify-content: flex-start;
  363. height: 46px;
  364. line-height: 46px;
  365. border-top: 1px solid #e8e8e8;
  366. border-bottom: 1px solid #e8e8e8;
  367. &:first-child {
  368. border-left: 1px solid #e8e8e8;
  369. }
  370. .descriptionItemLabel {
  371. border-right: 1px solid #e8e8e8;
  372. background-color: #fafafa;
  373. color: rgba(0, 0, 0, 0.85);
  374. font-weight: 400;
  375. font-size: 14px;
  376. width: 50%;
  377. text-align: center;
  378. }
  379. .descriptionItemConcat {
  380. text-align: center;
  381. white-space: nowrap;
  382. overflow: hidden;
  383. text-overflow: ellipsis;
  384. border-right: 1px solid #e8e8e8;
  385. font-size: 14px;
  386. line-height: 1.5;
  387. padding: 12px 16px;
  388. color: rgba(0, 0, 0, 0.65);
  389. display: table-cell;
  390. width: 50%;
  391. }
  392. .col-value {
  393. color: #14928a;
  394. cursor: pointer;
  395. }
  396. }
  397. }
  398. </style>