UniversitiesLineTable.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div id="lineTable">
  3. <mx-search-group class="mb10" justify="end" :span="6" v-model="tableParams.univerName" placeholder="搜索" @search="clickSuffix"
  4. ></mx-search-group>
  5. <el-table :data="tableData" v-loading="tableLoading" border>
  6. <el-table-column prop="code" label="院校" align="center">
  7. <template slot-scope="scope">
  8. <el-link :underline="false" @click="goDetails(scope.row.universityId)">【{{ scope.row.universityName }}】
  9. </el-link>
  10. </template>
  11. </el-table-column>
  12. <el-table-column prop="location" label="所在地" align="center"></el-table-column>
  13. <el-table-column prop="year" label="年份" align="center"></el-table-column>
  14. <el-table-column prop="type" label="科类" align="center"></el-table-column>
  15. <el-table-column prop="level" label="层次" align="center"></el-table-column>
  16. <el-table-column prop="score" label="投档线" align="center"></el-table-column>
  17. <el-table-column
  18. prop="batchName"
  19. label="投档分位次"
  20. >
  21. </el-table-column>
  22. </el-table>
  23. <el-pagination
  24. style="margin-top:10px;"
  25. :page-sizes="[10,20,30,40,50,60,70,80,90,100]"
  26. :page-size=tableParams.pageSize
  27. layout="prev,pager,next,jumper,total,sizes"
  28. :total="examRecordTotal"
  29. @current-change="currentChange"
  30. @size-change="sizeChange"
  31. >
  32. </el-pagination>
  33. </div>
  34. </template>
  35. <script>
  36. import { selectUniversityList } from '@/api/webApi/shiftLine'
  37. import MxSearchGroup from '@/components/MxSearch/mx-search-group'
  38. export default {
  39. name: 'UniversitiesLineTable',
  40. components: {
  41. MxSearchGroup
  42. },
  43. props: {
  44. universityParams: {
  45. type: Object, default() {
  46. return {}
  47. }
  48. }
  49. },
  50. data() {
  51. return {
  52. tableLoading: '',
  53. examRecordTotal: 0,
  54. tableParams: {
  55. pageSize: 20,
  56. pageNum: 1,
  57. level: '',
  58. location: '',
  59. type: '',
  60. univerName: '',
  61. year: ''
  62. },
  63. tableData: []
  64. }
  65. },
  66. watch: {
  67. universityParams: {
  68. immediate: true,
  69. deep: true,
  70. handler(val) {
  71. if ( val.locationsRes == '' || val.yearRes == '' ) {
  72. return
  73. }
  74. this.tableParams.level = val.levelsRes
  75. this.tableParams.location = val.locationsRes
  76. this.tableParams.type = val.typeRes
  77. this.tableParams.year = val.yearRes
  78. this.getUniversityList()
  79. }
  80. }
  81. },
  82. methods: {
  83. clickSuffix() {
  84. this.getUniversityList()
  85. },
  86. getUniversityList() {
  87. this.tableLoading = true
  88. console.log(this.tableParams)
  89. selectUniversityList(this.tableParams).then(res => {
  90. console.log(res)
  91. this.tableData = res.rows
  92. this.examRecordTotal = res.total
  93. }).finally(_ => {
  94. this.tableLoading = false
  95. })
  96. },
  97. sizeChange(e) {
  98. this.tableParams.pageSize = e
  99. this.getUniversityList()
  100. },
  101. currentChange(e) {
  102. //页数
  103. this.tableParams.pageNum = e
  104. this.getUniversityList()
  105. },
  106. goDetails(id) {
  107. this.$router.push({ name: 'UniversityDetail', params: { id: id } })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. #lineTable {
  114. .search {
  115. .el-input {
  116. .el-input__inner {
  117. border-radius: 50px;
  118. }
  119. }
  120. }
  121. }
  122. </style>