myRecommendation.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <!-- 我的推荐 -->
  2. <template>
  3. <div class="d-flex">
  4. <div class="pa-3 mr-3 white-bgc" style="border-radius: 5px; flex: 1;">
  5. <div style="width: 100%;">
  6. <!-- 统计 -->
  7. <div class="statisticsBox">
  8. <div class="statisticsBox-item" :class="{'act': index === active}" v-for="(item, index) in statisticsList" :key="item.value" @click="handleStatisticsItem(item, index)">
  9. <div style="font-size: 18px; color: var(--color-333); font-weight: bold;">{{ item.count }}</div>
  10. <div style="font-size: 13px; color: var(--color-666);">{{ item.label }}</div>
  11. </div>
  12. </div>
  13. <div class="topTip">推荐好友入职得赏金</div>
  14. <!-- 数据 -->
  15. <TablePage :items="items"></TablePage>
  16. <CtPagination
  17. v-if="total > 0"
  18. :total="total"
  19. :page="query.pageNo"
  20. :limit="query.pageSize"
  21. @handleChange="handleChangePage"
  22. ></CtPagination>
  23. </div>
  24. </div>
  25. <!-- 滚动区域 -->
  26. <div class="pa-3 white-bgc" style="height: 300px; border-radius: 5px; width: 360px;">
  27. <bountyDisplay></bountyDisplay>
  28. </div>
  29. </div>
  30. </template>
  31. <script setup>
  32. defineOptions({name: 'defineOptions-name'})
  33. import { ref } from 'vue'
  34. import { getDict } from '@/hooks/web/useDictionaries'
  35. import { getHireJobCvRelCount, getHireJobCvRelPage } from '@/api/publicRecruitment'
  36. import TablePage from './components/table.vue'
  37. import bountyDisplay from './components/bountyDisplay.vue'
  38. const active = ref(0)
  39. // 数据统计
  40. const statisticsList = ref([])
  41. const getData = async () => {
  42. const data = await getHireJobCvRelCount()
  43. if (!data || !data.length) return
  44. statisticsList.value.forEach(e => {
  45. const obj = data.find(k => k.key === e.value)
  46. if (!obj) return
  47. e.count = obj.value
  48. })
  49. }
  50. // 列表
  51. const items = ref([])
  52. const total = ref(0)
  53. const query = ref({
  54. pageSize: 10,
  55. pageNo: 1,
  56. status: null
  57. })
  58. const getTableList = async () => {
  59. const res = await getHireJobCvRelPage(query.value)
  60. items.value = res.list
  61. total.value = res.total
  62. }
  63. // 状态
  64. const getStatusData = () => {
  65. getDict('menduner_hire_job_cv_status').then(({ data }) => {
  66. data = data?.length && data || []
  67. statisticsList.value = data.map(e => {
  68. return { ...e, count: 0 }
  69. })
  70. query.value.status = data[0].value
  71. getData()
  72. getTableList()
  73. })
  74. }
  75. getStatusData()
  76. // 分页
  77. const handleChangePage = (e) => {
  78. query.value.pageNo = e
  79. getTableList()
  80. }
  81. // 钻取
  82. const handleStatisticsItem = (item, index) => {
  83. active.value = index
  84. query.value.pageNo = 1
  85. query.value.status = item.value
  86. getTableList()
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .topTip {
  91. color: var(--color-999);
  92. margin-top: 8px;
  93. font-size: 14px;
  94. padding: 5px 10px;
  95. width: 100%;
  96. // background-color: var(--default-bgc);
  97. }
  98. .statisticsBox {
  99. display: flex;
  100. justify-content: space-around;
  101. border-radius: 10px;
  102. text-align: center;
  103. padding: 10px 0;
  104. background-color: var(--default-bgc);
  105. .act {
  106. div, span { color: var(--v-primary-base) !important; }
  107. }
  108. .statisticsBox-item {
  109. cursor: pointer;
  110. &:hover {
  111. div { color: var(--v-primary-base) !important; }
  112. }
  113. }
  114. }
  115. </style>