classInfoDetail.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <div class="panel-body">
  5. <br>
  6. <el-page-header @back="goBack" content="课程成绩">
  7. <br>
  8. </el-page-header>
  9. <span class="classNames">
  10. {{title}}
  11. </span>
  12. </div>
  13. </div>
  14. <div class="table">
  15. <el-table
  16. :data="tableData"
  17. border
  18. is-horizontal-resize
  19. :default-sort="{prop: 'date', order: 'descending'}"
  20. element-loading-background="rgba(0, 0, 0, 0.8)"
  21. class=""
  22. >
  23. >
  24. <el-table-column
  25. type="index"
  26. label="排名"
  27. align="center"
  28. width="50">
  29. </el-table-column>
  30. <el-table-column
  31. prop="head"
  32. label="头像"
  33. align="center"
  34. sortable
  35. >
  36. <template slot-scope="scope">
  37. <!--<img class="head" :src="scope.row.Head" alt="" height="51" width="51" v-if="scope.row.Head">-->
  38. <div class="demo-image__preview" v-if="scope.row.Head">
  39. <el-image
  40. style="width: 25px; height: 25px"
  41. :src="scope.row.Head"
  42. :preview-src-list="[scope.row.Head]"
  43. >
  44. </el-image>
  45. </div>
  46. <img src="../assets/img/nav/head.png" alt="" v-else width="25px" height="25px">
  47. <!--<img class="head" src="../assets/img/nav/head.png" height="51" width="51" v-else/>-->
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. prop="Name"
  52. label="会员名"
  53. sortable
  54. >
  55. </el-table-column>
  56. <el-table-column
  57. prop="Cle"
  58. label="卡路里"
  59. :formatter="filterCle"
  60. sortable
  61. >
  62. </el-table-column>
  63. <el-table-column
  64. prop="Ck"
  65. label="ck值"
  66. :formatter="filterCK"
  67. sortable
  68. >
  69. </el-table-column>
  70. <el-table-column
  71. prop="MaxHr"
  72. label="最大心率"
  73. sortable
  74. >
  75. </el-table-column>
  76. <el-table-column
  77. prop="AvgHr"
  78. label="平均心率"
  79. sortable
  80. >
  81. </el-table-column>
  82. <el-table-column
  83. prop="Weight"
  84. label="体重(kg)"
  85. :formatter="filterWeight"
  86. sortable
  87. >
  88. </el-table-column>
  89. <el-table-column
  90. prop="Height"
  91. label="身高(cm)"
  92. sortable
  93. >
  94. </el-table-column>
  95. <el-table-column
  96. prop="Sex"
  97. label="性别"
  98. sortable
  99. >
  100. <template slot-scope="scope">
  101. <span v-if="scope.row.Sex == 1">男</span>
  102. <span v-if="scope.row.Sex == 2">女</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column
  106. prop="GroupNo"
  107. label="队伍"
  108. sortable
  109. >
  110. <template slot-scope="scope">
  111. <span v-if="scope.row.GroupNo == 0">不分组</span>
  112. <span v-if="scope.row.GroupNo == 1" style="color: red">红队</span>
  113. <span v-if="scope.row.GroupNo == 2" style="color: blue">蓝队</span>
  114. <span v-if="scope.row.GroupNo == 3" style="color: goldenrod">黄队</span>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <br>
  119. <el-pagination
  120. background
  121. :total="pageination.total"
  122. :page-size="pageination.pageItem"
  123. @current-change="pageChange"
  124. ></el-pagination>
  125. </div>
  126. </div>
  127. </template>
  128. <script>
  129. import Global from '../Global.js'
  130. import {
  131. ClassOverDetailListQuery,
  132. FinshedDispPlanQuery,
  133. } from "../api/getApiRes";
  134. let qs = require('qs');
  135. export default {
  136. data() {
  137. return {
  138. tableData: [],
  139. title: '',
  140. pageination: {
  141. pageItem: 100,
  142. pageoptions: pageOptions(),
  143. total: 100,
  144. pageIndex: 1,
  145. },
  146. }
  147. },
  148. mounted() {
  149. this.getTableQuery();
  150. this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
  151. },
  152. methods: {
  153. goBack() {
  154. this.$router.push({
  155. path: '/courses', query: {}
  156. });
  157. },
  158. // 页面数据查询
  159. getTableQuery() {
  160. let that = this;
  161. that.loading = true;
  162. let param = {
  163. token: localStorage.token,
  164. stdId: this.$route.query.StdId,
  165. start: 1,//
  166. tableMax: 9999,//
  167. };
  168. let postdata = qs.stringify(param);
  169. FinshedDispPlanQuery(postdata).then(res => {
  170. let json = res;
  171. if (json.Code == 0) {
  172. that.loading = false;
  173. if (json.Rs) {
  174. that.allTableData = json.Rs;
  175. that.recordsTotal = json.Rs.length;
  176. } else {
  177. that.allTableData = [];
  178. that.recordsTotal = 0;
  179. }
  180. // 设置分页数据
  181. that.setPaginations();
  182. } else {
  183. that.$message.error(json.Memo + '错误码:' + json.Code);
  184. }
  185. })
  186. },
  187. // 设置分页数据
  188. setPaginations() {
  189. // 分页属性
  190. let that = this;
  191. that.pageination.total = that.recordsTotal;
  192. // 默认分页
  193. that.tableData = that.allTableData.filter((item, index) => {
  194. return index < that.pageination.pageItem;
  195. });
  196. },
  197. // 每页显示数量
  198. handleSizeChange() {
  199. let that = this;
  200. that.tableData = that.allTableData.filter((item, index) => {
  201. return index < that.pageination.pageItem;
  202. });
  203. that.draw = that.pageination.pageItem;
  204. // that.getTableQuery();
  205. },
  206. // 翻页
  207. pageChange(pageIndex) {
  208. let that = this;
  209. // 获取当前页
  210. let index = that.pageination.pageItem * (pageIndex - 1);
  211. // 数据总数
  212. let nums = that.pageination.pageItem * pageIndex;
  213. // 容器
  214. let tables = [];
  215. for (var i = index; i < nums; i++) {
  216. if (that.allTableData[i]) {
  217. tables.push(that.allTableData[i])
  218. }
  219. this.tableData = tables;
  220. }
  221. that.start = index * that.draw;
  222. // that.getTableQuery();
  223. },
  224. // 单位转换去6个零
  225. filterCle(value, row, column) {
  226. return parseFloat(column / 1000000).toFixed(1);
  227. },
  228. // 单位转换去6个零
  229. filterCK(value, row, column) {
  230. return parseInt(column / 1000000);
  231. },
  232. // 单位转换去1个零
  233. filterWeight(value, row, column) {
  234. return parseInt(column / 10);
  235. },
  236. },
  237. watch: {
  238. $route(to) {
  239. if (to.name == 'classInfoDetail') {
  240. this.getTableQuery();
  241. this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
  242. }
  243. },
  244. },
  245. }
  246. </script>
  247. <style scoped>
  248. @import "../assets/css/panel.css";
  249. .context {
  250. height: 770px;
  251. overflow-y: scroll;
  252. display: block;
  253. margin: 0 auto;
  254. background-color: #fff !important;
  255. padding: 30px;
  256. }
  257. .classNames {
  258. width: 211px;
  259. height: 25px;
  260. background: #f0f2f5;
  261. font-family: "Source Han Sans CN";
  262. font-weight: normal;
  263. font-size: 16px;
  264. color: #3799ff;
  265. border-radius: 250px;
  266. text-align: center;
  267. margin-top: 15px;
  268. margin-bottom: 3px;
  269. float: left;
  270. }
  271. .head {
  272. overflow: hidden;
  273. display: block;
  274. margin: 0 auto;
  275. border-radius: 250px;
  276. }
  277. </style>