trainTimer.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. ></i>
  16. </el-tooltip> -->
  17. </div>
  18. </template>
  19. </el-alert>
  20. <!-- 周期选择 -->
  21. <save-form
  22. :inline="true"
  23. class="searchForm"
  24. save-key="teamTrainTimer"
  25. ref="searchForm"
  26. :model.sync="searchForm"
  27. >
  28. <el-form-item prop="year" label="年份">
  29. <el-date-picker
  30. style="width: 180px !important"
  31. v-model="searchForm.year"
  32. type="year"
  33. value-format="yyyy"
  34. placeholder="选择年"
  35. :clearable="false"
  36. @change="changeYear"
  37. >
  38. </el-date-picker>
  39. </el-form-item>
  40. <el-form-item prop="term" label="学期">
  41. <el-select
  42. :disabled="!searchForm.year"
  43. class="multiple"
  44. filterable
  45. style="width: 180px !important"
  46. v-model.trim="searchForm.term"
  47. placeholder="请选择学期"
  48. @change="changeTerm"
  49. >
  50. <el-option value="0" label="上学期"></el-option>
  51. <el-option value="1" label="下学期"></el-option>
  52. </el-select>
  53. </el-form-item>
  54. </save-form>
  55. <div v-if="dataList.length >= 4">
  56. <!-- {{ item.name }}{{item.type | classType}}: -->
  57. <!-- <el-row class="row">
  58. <el-col
  59. class="col"
  60. :span="6"
  61. v-for="(item, index) in dataList"
  62. :key="index"
  63. >
  64. <span class="col-title">
  65. <overflow-text :text="item.name+':'" width="100%"></overflow-text
  66. >
  67. </span>
  68. <span> {{ item.currentClassTimes }}/{{item.totalClassTimes}}课时</span>
  69. </el-col>
  70. </el-row> -->
  71. <descriptions :column="4">
  72. <descriptions-item
  73. :label="item.name"
  74. :key="index"
  75. v-for="(item, index) in dataList"
  76. >
  77. <div v-if="item.id">
  78. {{ item.currentClassTimes }}/{{ item.totalClassTimes }}课时
  79. </div>
  80. </descriptions-item>
  81. </descriptions>
  82. </div>
  83. <div
  84. v-else-if="dataList.length > 0 && dataList.length < 4"
  85. class="descriptions"
  86. >
  87. <div
  88. class="descriptionItem"
  89. :style="`width:${100 / 4}%`"
  90. :key="index"
  91. v-for="(item, index) in dataList"
  92. >
  93. <div class="descriptionItemLabel">
  94. {{item.name}}
  95. </div>
  96. <div
  97. class="descriptionItemConcat"
  98. >
  99. {{ item.currentClassTimes }}/{{ item.totalClassTimes }}课时
  100. </div>
  101. </div>
  102. </div>
  103. <div v-else>
  104. <empty desc="暂无数据" />
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import { getPlanCourseNum } from "./api";
  110. export default {
  111. data() {
  112. return {
  113. searchForm: {
  114. year: "",
  115. term: "",
  116. },
  117. dataList: [],
  118. };
  119. },
  120. created() {
  121. let date = new Date();
  122. this.searchForm.year = String(date.getFullYear());
  123. // console.log('year',date.getFullYear())
  124. let month = date.getMonth() + 1;
  125. if (month > 3 && month < 8) {
  126. this.searchForm.term = "0";
  127. } else {
  128. this.searchForm.term = "1";
  129. }
  130. },
  131. mounted() {
  132. this.getList();
  133. },
  134. methods: {
  135. changeYear(val) {
  136. this.getList();
  137. },
  138. changeTerm(val) {
  139. this.getList();
  140. },
  141. async getList() {
  142. try {
  143. const res = await getPlanCourseNum({
  144. musicGroupId: this.$route.query.id,
  145. year: this.searchForm.year,
  146. term: this.searchForm.term,
  147. });
  148. this.dataList = res.data;
  149. // if(this.dataList.length > 0&&this.dataList.length<4){
  150. // // 样式丑 至少对齐一排
  151. // for(let i=0;i<=4-this.dataList.length;i++){
  152. // this.dataList.push({name:null,totalClassTimes:null,currentClassTimes:null})
  153. // }
  154. // }
  155. // console.log(this.dataList )
  156. } catch (e) {}
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="scss" scoped>
  162. .divider {
  163. margin-top: 0 !important;
  164. }
  165. .marginBtm22 {
  166. margin-bottom: 22px;
  167. }
  168. .row {
  169. padding: 8px 16px;
  170. margin-bottom: 30px;
  171. .col {
  172. margin-bottom: 20px;
  173. line-height: 20px;
  174. display: flex;
  175. flex-direction: row;
  176. align-items: center;
  177. .col-title {
  178. display: inline-block;
  179. width: 150px;
  180. text-align: right;
  181. text-overflow: ellipsis;
  182. white-space: nowrap;
  183. overflow: hidden;
  184. }
  185. .col-value {
  186. display: inline-block;
  187. // color: #14928a;
  188. // cursor: pointer;
  189. }
  190. }
  191. }
  192. .shapeWrap {
  193. display: flex;
  194. flex-direction: row;
  195. justify-content: flex-start;
  196. align-items: center;
  197. .shape {
  198. position: relative;
  199. top: -1px;
  200. display: block;
  201. margin-right: 10px;
  202. height: 14px;
  203. width: 4px;
  204. background-color: #14928a;
  205. z-index: 500;
  206. }
  207. }
  208. .descriptions {
  209. margin-bottom: 30px;
  210. display: flex;
  211. flex-direction: row;
  212. .col-value {
  213. color: #14928a;
  214. cursor: pointer;
  215. }
  216. .descriptionItem {
  217. display: flex;
  218. flex-direction: row;
  219. justify-content: flex-start;
  220. height: 46px;
  221. line-height: 46px;
  222. border-top: 1px solid #e8e8e8;
  223. border-bottom: 1px solid #e8e8e8;
  224. &:first-child {
  225. border-left: 1px solid #e8e8e8;
  226. }
  227. .descriptionItemLabel {
  228. border-right: 1px solid #e8e8e8;
  229. background-color: #fafafa;
  230. color: rgba(0, 0, 0, 0.85);
  231. font-weight: 400;
  232. font-size: 14px;
  233. width: 50%;
  234. text-align: center;
  235. }
  236. .descriptionItemConcat {
  237. .col-value {
  238. color: #14928a;
  239. cursor: pointer;
  240. }
  241. text-align: center;
  242. white-space: nowrap;
  243. overflow: hidden;
  244. text-overflow: ellipsis;
  245. border-right: 1px solid #e8e8e8;
  246. font-size: 14px;
  247. line-height: 1.5;
  248. padding: 12px 16px;
  249. color: rgba(0, 0, 0, 0.65);
  250. display: table-cell;
  251. width: 50%;
  252. }
  253. }
  254. }
  255. </style>