talentSearch.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <ContentWrap>
  3. <div class="box" :class="{ active: isSearch }">
  4. <div class="box-search contentWidth">
  5. <el-input
  6. v-model="searchValue"
  7. size="large"
  8. placeholder="请输入您的描述信息定位人才"
  9. :suffix-icon="Search"
  10. @keydown.enter="handleSearch"
  11. />
  12. </div>
  13. <div class="change contentWidth">
  14. <el-button class="button-new-tag" size="small" @click="changeTags">
  15. 换一批
  16. </el-button>
  17. </div>
  18. <div class="tags contentWidth">
  19. <el-tag
  20. class="tag"
  21. v-for="tag in tags"
  22. :key="tag"
  23. :type="searchParam.labels.includes(tag) ? 'info' : ''"
  24. size="large"
  25. @click="handleSearchTag(tag)"
  26. >{{ tag }}</el-tag>
  27. </div>
  28. <div v-if="searchParam.labels.length" class="search-tags">
  29. <div class="search-tags-label">标签:</div>
  30. <div class="search-tags-label-content">
  31. <el-tag
  32. v-for="(tag, i) in searchParam.labels"
  33. :key="tag"
  34. size="large"
  35. class="search-tags-tag"
  36. closable
  37. :disable-transitions="false"
  38. @close="handleClose(tag, i)"
  39. >
  40. {{ tag }}
  41. </el-tag>
  42. <el-button class="search-tags-tag" type="danger" @click="handleClear">清除</el-button>
  43. </div>
  44. </div>
  45. </div>
  46. </ContentWrap>
  47. <ContentWrap v-if="isSearch">
  48. <el-table
  49. v-loading="loading"
  50. :data="list"
  51. :stripe="true"
  52. row-key="id"
  53. >
  54. <el-table-column label="头像" align="left" prop="name" >
  55. <template #default="scope">
  56. <el-avatar :size="30" :src="scope.row.avatar" />
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="姓名" align="left" prop="name" />
  60. <el-table-column label="英文名" align="left" prop="foreignName" />
  61. <el-table-column label="求职状态" align="center" prop="jobStatus" />
  62. <el-table-column label="电话号码" align="center" prop="phone" />
  63. <el-table-column label="出生日期" align="center" prop="birthday" />
  64. <el-table-column label="婚姻状况" align="center" prop="maritalStatus" />
  65. <el-table-column label="所在城市" align="center" prop="areaId" />
  66. <el-table-column label="首次工作时间" align="center" prop="firstWorkTime" />
  67. <el-table-column label="工作年限" align="center" prop="expType" />
  68. <el-table-column label="最高学历" align="center" prop="eduType" />
  69. <el-table-column label="操作" align="left">
  70. <template #default="scope">
  71. <el-button
  72. link
  73. type="primary"
  74. @click="getDetails(scope.row.id)"
  75. >
  76. 查看
  77. </el-button>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <Pagination
  82. :total="total"
  83. v-model:page="pageInfo.pageNo"
  84. v-model:limit="pageInfo.pageSize"
  85. @pagination="getList"
  86. />
  87. </ContentWrap>
  88. </template>
  89. <script setup>
  90. import { ref, computed } from 'vue'
  91. import { Search } from '@element-plus/icons-vue'
  92. import { pyTalentMap } from '@/api/menduner/system/talentMap'
  93. const { searchTalent, getTalentLabel } = pyTalentMap
  94. const searchValue = ref(null)
  95. const loading = ref(false)
  96. const list = ref([])
  97. const total = ref(0)
  98. const pageInfo = ref({
  99. pageNo: 1,
  100. pageSize: 10
  101. })
  102. const tagsPageInfo = ref({
  103. current: 1,
  104. size: 15
  105. })
  106. const tags = ref([])
  107. const searchParam = ref({
  108. labels: [],
  109. content: null
  110. })
  111. const isSearch = computed(() => {
  112. return searchParam.value.content || searchParam.value.labels.length
  113. })
  114. const getDetails = async (id) => {
  115. console.log(id)
  116. }
  117. const getLabelData = async () => {
  118. const res = await getTalentLabel({ ...tagsPageInfo.value, type: 'person' }) //type: job enterprise person
  119. tags.value = res.records
  120. if (res.current * res.size >= res.total) {
  121. tagsPageInfo.value.current = 0
  122. }
  123. }
  124. const getList = async () => {
  125. loading.value = true
  126. const res = await searchTalent({ ...pageInfo.value, ...searchParam.value })
  127. list.value = res.list
  128. total.value = res.total
  129. loading.value = false
  130. }
  131. const changeTags = () => {
  132. tagsPageInfo.value.current++
  133. getLabelData()
  134. }
  135. const handleClose = (tag, index) => {
  136. searchParam.value.labels.splice(index, 1)
  137. pageInfo.value.current = 1
  138. getList()
  139. }
  140. const handleClear = () => {
  141. searchParam.value.labels = []
  142. pageInfo.value.current = 1
  143. getList()
  144. }
  145. const handleSearch = () => {
  146. searchParam.value.content = searchValue.value
  147. pageInfo.value.current = 1
  148. getList()
  149. }
  150. const handleSearchTag = async (tag) => {
  151. if (searchParam.value.labels.includes(tag)) {
  152. return
  153. }
  154. searchParam.value.labels.push(tag)
  155. pageInfo.value.current = 1
  156. getList()
  157. }
  158. getLabelData()
  159. </script>
  160. <style scoped lang="scss">
  161. .contentWidth {
  162. width: 75%;
  163. max-width: 900px;
  164. }
  165. .box {
  166. min-height: 500px;
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. flex-direction: column;
  171. transition: .5s;
  172. // &-search {
  173. // width: 75%;
  174. // max-width: 900px;
  175. // }
  176. &.active {
  177. min-height: unset;
  178. }
  179. .search-tags {
  180. width: 100%;
  181. margin-top: 10px;
  182. display: flex;
  183. font-size: 14px;
  184. &-label {
  185. padding-top: 7px;
  186. margin-right: 10px;
  187. &-content {
  188. width: 0;
  189. flex: 1;
  190. }
  191. }
  192. &-tag {
  193. margin-right: 10px;
  194. margin-bottom: 10px;
  195. }
  196. }
  197. }
  198. .change {
  199. // width: 75%;
  200. // max-width: 900px;
  201. margin-top: 10px;
  202. width: 100%;
  203. display: flex;
  204. justify-content: flex-end;
  205. }
  206. .tags {
  207. // width: 75%;
  208. // max-width: 900px;
  209. padding: 10px 0;
  210. .tag {
  211. margin: 5px;
  212. cursor: pointer;
  213. }
  214. }
  215. </style>