zhiyuan-list.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <dynamic-table v-loading="loading" ref="table" height="800px" :rows="tableList" :columns="columns"
  3. @expand-change="expand">
  4. <template #t0="{row}">
  5. <!-- 录取概率 -->
  6. <div>
  7. <!-- <p class="mb10"><span class="f18">{{ row.enrollRatio }}</span>%</p>-->
  8. <!-- <p class="mb10 f-9b f12">{{ row.enrollRatioText }}</p>-->
  9. <p>
  10. <el-tag type="danger" v-if="row.pickType == 0">冲</el-tag>
  11. <el-tag type="warning" v-if="row.pickType == 1">稳</el-tag>
  12. <el-tag type="success" v-if="row.pickType == 2">保</el-tag>
  13. </p>
  14. </div>
  15. </template>
  16. <template #t1="{row}">
  17. <!-- 院校 -->
  18. <div>
  19. <p class="mb10"><span class="pointer">{{ `${row.university.name}(${row.recruitPlan.collegeCode})` || '' }}</span></p>
  20. <p class="mb5 f-9b f12">{{ row.university.features.split(',').join(' ') }}</p>
  21. <p class="mb5 f-9b f12">{{ row.university.location }} {{ row.university.cityName }}
  22. 排名{{ row.university.ranking }}</p>
  23. <p class="f-9b f12">代码 {{ row.recruitPlan.collegeCode }}</p>
  24. </div>
  25. </template>
  26. <template #t2="{row}">
  27. <!-- 招生计划 -->
  28. <div>
  29. <p><span class="f18">{{ row.recruitPlan.planCount }}</span>人</p>
  30. <p class="f-9b f12">{{ row.recruitPlan.course }}</p>
  31. </div>
  32. </template>
  33. <template #t3="{row}">
  34. <!-- 历年 -->
  35. <div class="f14">
  36. <p>{{ row.history ? row.history.year || '-' : '-' }}{{ `(${row.history.type || '-'})`}}</p>
  37. </div>
  38. </template>
  39. <template #t4="{row}">
  40. <div class="f14">
  41. <p>{{ row.history ? row.history.numReal || '-' : '-' }}</p>
  42. </div>
  43. </template>
  44. <template #t5="{row}">
  45. <div class="f14">
  46. <p>{{ row.history ? row.history.score || '-' : '-' }}</p>
  47. </div>
  48. </template>
  49. <template #t6="{row}">
  50. <div class="f14">
  51. <p>{{ row.history ? row.history.seat || '-' : '-' }}</p>
  52. </div>
  53. </template>
  54. <template #t7="{row}">
  55. <p type="primary" v-if="row.recruitPlan.majorCount"> 专业({{ row.recruitPlan.majorCount }}个)</p>
  56. <p class="f12 f-primary" v-show="row.majors.filter(major => {return major.selected}).length"> 已填 <span>{{
  57. row.majors.filter(major => {
  58. return major.selected
  59. }).length
  60. }}</span></p>
  61. </template>
  62. <template #expand="{row: recommend,$index}">
  63. <div>
  64. <dynamic-table :columns="majorCol" :show-header="false" :rows="recommend.majors">
  65. <template #t0="{row}">
  66. <!-- 录取概率 -->
  67. <div>
  68. </div>
  69. </template>
  70. <template #t1="{row}">
  71. <div>
  72. <p class="mb10"><span class="pointer">{{ row.marjorName }}</span></p>
  73. <p class="f-9b f12">代码 {{ row.marjorBelongs }}</p>
  74. </div>
  75. </template>
  76. <template #t2="{row}">
  77. <div>
  78. <p><span class="f18">{{ row.planCount || '-' }}</span>人</p>
  79. <p class="f-9b f12">{{ `${row.xuezhi || ''} ¥${row.xuefei}` }}</p>
  80. </div>
  81. </template>
  82. <template #t3="{row}">
  83. <div class="f14">
  84. <p>{{ row.history ? row.history.year || '-' : '-' }}</p>
  85. </div>
  86. </template>
  87. <template #t4="{row}">
  88. <div class="f14">
  89. <p>{{ row.history ? row.history.numReal || '-' : '-' }}</p>
  90. </div>
  91. </template>
  92. <template #t5="{row}">
  93. <div class="f14">
  94. <p>{{ row.history ? row.history.score || '-' : '-' }}</p>
  95. </div>
  96. </template>
  97. <template #t6="{row}">
  98. <div class="f14">
  99. <p>{{ row.history ? row.history.seat || '-' : '-' }}</p>
  100. </div>
  101. </template>
  102. <template #t7="{row}" v-if="!readonly">
  103. <el-button :type="row.selected ? 'danger' : 'primary'" @click="apply(row,recommend)">
  104. {{ row.selected ? '取消' : '填报' }}
  105. </el-button>
  106. </template>
  107. </dynamic-table>
  108. </div>
  109. </template>
  110. </dynamic-table>
  111. </template>
  112. <script>
  113. import DynamicTable from '@/components/dynamic-table'
  114. export default {
  115. components: {
  116. DynamicTable
  117. },
  118. props: {
  119. tableList: {
  120. type: Array,
  121. default: []
  122. },
  123. cols: {
  124. type: Array,
  125. default: []
  126. },
  127. loading: {
  128. type: Boolean,
  129. default: []
  130. },
  131. readonly: {
  132. type: Boolean,
  133. default: false
  134. }
  135. },
  136. data() {
  137. return {
  138. show: false,
  139. input: '',
  140. selectedList: []
  141. }
  142. },
  143. computed: {
  144. columns() {
  145. if (!this.cols.length) return []
  146. const columns = [
  147. // {
  148. // type: 'expand',
  149. // slotBody: 'expand'
  150. // }
  151. ]
  152. this.cols.map((item, index) => {
  153. columns.push({
  154. label: item,
  155. slotBody: 't' + index,
  156. width: index >= 3 || index == 0 ? '100px' : ''
  157. })
  158. })
  159. columns.push({
  160. type: 'expand',
  161. slotBody: 'expand',
  162. label: '查看'
  163. })
  164. return columns
  165. },
  166. majorCol() {
  167. return this.cols.map((item, index) => {
  168. return {
  169. label: item,
  170. slotBody: 't' + index,
  171. width: index >= 3 || index == 0 ? 100 + 'px' : ''
  172. }
  173. })
  174. }
  175. },
  176. methods: {
  177. expand(item) {
  178. this.$emit('expand', item)
  179. },
  180. scrollTop() {
  181. this.$refs.table.toScrollTop()
  182. },
  183. apply(item, parent) {
  184. this.$emit('apply', item, parent)
  185. }
  186. }
  187. }
  188. </script>
  189. <style scoped lang="scss">
  190. .f-9b {
  191. color: #9b9b9b;
  192. }
  193. ::v-deep .el-table__expanded-cell {
  194. padding-top: 0;
  195. //padding-right: 50;
  196. padding-bottom: 0;
  197. padding-left: 0;
  198. }
  199. ::v-deep .el-table__expand-icon {
  200. font-size: 18px;
  201. color: #666;
  202. .el-icon-arrow-right {
  203. font-weight: bold;
  204. }
  205. }
  206. </style>