trainTimer.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. <el-tooltip placement="top" popper-class="mTooltip">
  9. <div slot="content">
  10. 声部课包括:声部课、集训声部课;合奏课包括:合奏课、集训合奏课
  11. </div>
  12. <i
  13. class="el-icon-question micon el-tooltip"
  14. style="font-size: 18px; color: #f56c6c"
  15. v-permission="'export/teacherSalary'"
  16. ></i>
  17. </el-tooltip>
  18. </div>
  19. </template>
  20. </el-alert>
  21. <!-- 周期选择 -->
  22. <save-form
  23. :inline="true"
  24. class="searchForm"
  25. save-key="teamTrainTimer"
  26. ref="searchForm"
  27. :model.sync="searchForm"
  28. >
  29. <el-form-item prop="year" label="年份">
  30. <el-date-picker
  31. style="width: 180px !important"
  32. v-model="searchForm.year"
  33. type="year"
  34. value-format="yyyy"
  35. placeholder="选择年"
  36. :clearable="false"
  37. @change="changeYear"
  38. >
  39. </el-date-picker>
  40. </el-form-item>
  41. <el-form-item prop="term" label="学期">
  42. <el-select
  43. :disabled="!searchForm.year"
  44. class="multiple"
  45. filterable
  46. style="width: 180px !important"
  47. v-model.trim="searchForm.term"
  48. placeholder="请选择学期"
  49. @change="changeTerm"
  50. >
  51. <el-option value="0" label="上学期"></el-option>
  52. <el-option value="1" label="下学期"></el-option>
  53. </el-select>
  54. </el-form-item>
  55. </save-form>
  56. <div v-if="dataList.length > 0">
  57. <!-- {{ item.name }}{{item.type | classType}}: -->
  58. <!-- <el-row class="row">
  59. <el-col
  60. class="col"
  61. :span="6"
  62. v-for="(item, index) in dataList"
  63. :key="index"
  64. >
  65. <span class="col-title">
  66. <overflow-text :text="item.name+':'" width="100%"></overflow-text
  67. >
  68. </span>
  69. <span> {{ item.currentClassTimes }}/{{item.totalClassTimes}}课时</span>
  70. </el-col>
  71. </el-row> -->
  72. <descriptions :column="4">
  73. <descriptions-item
  74. :label="item.name"
  75. :key="index"
  76. v-for="(item, index) in dataList"
  77. >
  78. <div v-if="item.totalClassTimes">
  79. {{ item.currentClassTimes }}/{{ item.totalClassTimes }}课时
  80. </div>
  81. </descriptions-item>
  82. </descriptions>
  83. </div>
  84. <div v-else>
  85. <empty desc="暂无数据" />
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import { getPlanCourseNum } from "./api";
  91. export default {
  92. data() {
  93. return {
  94. searchForm: {
  95. year: "",
  96. term: "",
  97. },
  98. dataList: [],
  99. };
  100. },
  101. created() {
  102. let date = new Date();
  103. this.searchForm.year = String(date.getFullYear());
  104. // console.log('year',date.getFullYear())
  105. let month = date.getMonth() + 1;
  106. if (month > 3 && month < 8) {
  107. this.searchForm.term = "0";
  108. } else {
  109. this.searchForm.term = "1";
  110. }
  111. },
  112. mounted() {
  113. this.getList();
  114. },
  115. methods: {
  116. changeYear(val) {
  117. this.getList();
  118. },
  119. changeTerm(val) {
  120. this.getList();
  121. },
  122. async getList() {
  123. try {
  124. const res = await getPlanCourseNum({
  125. musicGroupId: this.$route.query.id,
  126. year: this.searchForm.year,
  127. term: this.searchForm.term,
  128. });
  129. this.dataList = res.data;
  130. if(this.dataList.length > 0&&this.dataList.length<4){
  131. // 样式丑 至少对齐一排
  132. for(let i=0;i<=4-this.dataList.length;i++){
  133. this.dataList.push({name:null,totalClassTimes:null,currentClassTimes:null})
  134. }
  135. }
  136. console.log(this.dataList )
  137. } catch (e) {}
  138. },
  139. },
  140. };
  141. </script>
  142. <style lang="scss" scoped>
  143. .divider {
  144. margin-top: 0 !important;
  145. }
  146. .marginBtm22 {
  147. margin-bottom: 22px;
  148. }
  149. .row {
  150. padding: 8px 16px;
  151. margin-bottom: 30px;
  152. .col {
  153. margin-bottom: 20px;
  154. line-height: 20px;
  155. display: flex;
  156. flex-direction: row;
  157. align-items: center;
  158. .col-title {
  159. display: inline-block;
  160. width: 150px;
  161. text-align: right;
  162. text-overflow: ellipsis;
  163. white-space: nowrap;
  164. overflow: hidden;
  165. }
  166. .col-value {
  167. display: inline-block;
  168. // color: #14928a;
  169. // cursor: pointer;
  170. }
  171. }
  172. }
  173. .shapeWrap {
  174. display: flex;
  175. flex-direction: row;
  176. justify-content: flex-start;
  177. align-items: center;
  178. .shape {
  179. position: relative;
  180. top: -1px;
  181. display: block;
  182. margin-right: 10px;
  183. height: 14px;
  184. width: 4px;
  185. background-color: #14928a;
  186. z-index: 500;
  187. }
  188. }
  189. </style>