PrevEnrollPlanTree.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <el-container v-loading="loading" class="layout-prev-container">
  3. <el-aside width="400" class="tree-container">
  4. <div class="bg-white pd20">
  5. <el-select v-model="query.year" placeholder="请选择年份" @change="handleYearChange">
  6. <el-option v-for="item in queryData.years" :key="item.label" :label="item.label" :value="item.value" />
  7. </el-select>
  8. <el-input v-model="tagKeyword" placeholder="输入类别名称进行筛选" class="mt20" />
  9. <el-tree ref="tree" class="mt10" :data="preTree" node-key="value" highlight-current :expand-on-click-node="false" :filter-node-method="filterNode" @node-click="handleTagChange" />
  10. </div>
  11. </el-aside>
  12. <el-main class="content-container">
  13. <div class="bg-white pb40 pl20 pr20">
  14. <div class="text-right pt20">
  15. <el-input v-model="query.keyword" placeholder="请输入院校/专业名称" suffix-icon="el-icon-search" style="width: 250px" clearable @keyup.enter.native="handleSearch" />
  16. <el-button type="primary" class="ml10" @click="handleSearch">搜索</el-button>
  17. </div>
  18. <sub-major-table
  19. v-for="row in rows"
  20. :key="row.id"
  21. :row="row"
  22. :is-new-gaokao="isNewGaokao"
  23. :show-shift-line-entry="!isEnrollMode"
  24. :custom-cols-length="isEnrollMode?getShiftCols(row).length:undefined"
  25. @university="toDetail(row)"
  26. @shift-line="toShiftLine(row)"
  27. >
  28. <template v-if="isEnrollMode" #default="scope">
  29. <el-descriptions-item v-for="c in getShiftCols(row)" :key="c.prop" :label="c.label">{{ scope[c.prop] || '-' }}</el-descriptions-item>
  30. </template>
  31. </sub-major-table>
  32. <evaluation-empty v-if="!rows.length" title="暂无数据" class="mt20" />
  33. <vip-guide-more v-if="total>1&&!isBind" />
  34. <pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList" />
  35. </div>
  36. </el-main>
  37. </el-container>
  38. </template>
  39. <script>
  40. import PrevEnrollPlanV2 from '@/views/career/PrevBatch/PrevEnrollPlanV2.vue'
  41. import PlanShiftColumns from '@/views/career/PrevBatch/components/PlanShiftColumns'
  42. export default {
  43. name: 'PreEnrollPlanTree',
  44. extends: PrevEnrollPlanV2,
  45. mixins: [PlanShiftColumns],
  46. data() {
  47. return {
  48. tagKeyword: '',
  49. isEnrollMode: false // 计划与投档混用
  50. }
  51. },
  52. watch: {
  53. 'query.year': function() {
  54. this.query.tagCode = ''
  55. this.tagKeyword = ''
  56. this.loadPreTree({ year: this.query.year })
  57. },
  58. 'tagKeyword': function(val) {
  59. this.$refs.tree.filter(val)
  60. }
  61. },
  62. methods: {
  63. filterNode(value, data) {
  64. console.log('filterNode', value, data)
  65. if (!value) return true
  66. if (data.value == this.query.tagCode) return true // keep the current selected node
  67. return data.label.indexOf(value) !== -1
  68. },
  69. async initProcess() {
  70. await this.initQueryYear()
  71. // await this.initQueryType() // ignore query.type
  72. await this.getList()
  73. },
  74. handleTagChange(node) {
  75. if (this.query.tagCode != node.value) {
  76. this.query.tagCode = node.value
  77. this.getList()
  78. } else {
  79. // set el-tree highlighted node
  80. this.$refs.tree.setCurrentKey(null)
  81. this.query.tagCode = ''
  82. this.getList()
  83. }
  84. },
  85. toShiftLine(row) {
  86. const next = { code: row.universityCode, tab: 7 }
  87. this.transferTo('/career/plan/UniversityDetail', next, null, '_blank')
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. </style>