talentSearch.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. <template #default="scope">
  63. <dict-tag :type="DICT_TYPE.MENDUNER_JOB_SEEK_STATUS" :value="scope.row.jobStatus" />
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="电话号码" align="center" prop="phone" />
  67. <el-table-column label="出生日期" align="center" prop="birthday" />
  68. <el-table-column label="婚姻状况" align="center" prop="maritalStatus">
  69. <template #default="scope">
  70. <dict-tag :type="DICT_TYPE.MENDUNER_MARITAL_STATUS" :value="scope.row.maritalStatus" />
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="所在城市" align="center" prop="areaId">
  74. <template #default="scope">
  75. <dict-tag :type="DICT_TYPE.MENDUNER_AREA_TYPE" :value="scope.row.areaId" />
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="首次工作时间" align="center" prop="firstWorkTime">
  79. <template #default="scope">
  80. {{ formatDate(scope.row.firstWorkTime, 'YYYY-MM-DD') }}
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="工作经验" align="center" prop="expType">
  84. <template #default="scope">
  85. <dict-tag :type="DICT_TYPE.MENDUNER_EXP_TYPE" :value="scope.row.expType" />
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="最高学历" align="center" prop="eduType">
  89. <template #default="scope">
  90. <dict-tag :type="DICT_TYPE.MENDUNER_EDUCATION_TYPE" :value="scope.row.eduType" />
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="操作" align="left">
  94. <template #default="scope">
  95. <el-button
  96. link
  97. type="primary"
  98. @click="getDetails(scope.row.id)"
  99. >
  100. 查看
  101. </el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <Pagination
  106. :total="total"
  107. v-model:page="pageInfo.pageNo"
  108. v-model:limit="pageInfo.pageSize"
  109. @pagination="getList"
  110. />
  111. </ContentWrap>
  112. </template>
  113. <script setup>
  114. import { ref, computed } from 'vue'
  115. import { Search } from '@element-plus/icons-vue'
  116. import { DICT_TYPE } from '@/utils/dict'
  117. import { pyTalentMap } from '@/api/menduner/system/talentMap'
  118. import { formatDate } from '@/utils/formatTime'
  119. const { searchTalent, getTalentLabel } = pyTalentMap
  120. const searchValue = ref(null)
  121. const loading = ref(false)
  122. const list = ref([])
  123. const total = ref(0)
  124. const pageInfo = ref({
  125. pageNo: 1,
  126. pageSize: 10
  127. })
  128. const tagsPageInfo = ref({
  129. current: 1,
  130. size: 15
  131. })
  132. const tags = ref([])
  133. const searchParam = ref({
  134. labels: [],
  135. content: null
  136. })
  137. const isSearch = computed(() => {
  138. return searchParam.value.content || searchParam.value.labels.length
  139. })
  140. const getDetails = async (id) => {
  141. console.log(id)
  142. }
  143. const getLabelData = async () => {
  144. const res = await getTalentLabel({ ...tagsPageInfo.value, type: 'person' }) //type: job enterprise person
  145. tags.value = res.records
  146. if (res.current * res.size >= res.total) {
  147. tagsPageInfo.value.current = 0
  148. }
  149. }
  150. const getList = async () => {
  151. loading.value = true
  152. const res = await searchTalent({ ...pageInfo.value, ...searchParam.value })
  153. list.value = res.list
  154. total.value = res.total
  155. loading.value = false
  156. }
  157. const changeTags = () => {
  158. tagsPageInfo.value.current++
  159. getLabelData()
  160. }
  161. const handleClose = (tag, index) => {
  162. searchParam.value.labels.splice(index, 1)
  163. pageInfo.value.current = 1
  164. getList()
  165. }
  166. const handleClear = () => {
  167. searchParam.value.labels = []
  168. pageInfo.value.current = 1
  169. getList()
  170. }
  171. const handleSearch = () => {
  172. searchParam.value.content = searchValue.value
  173. pageInfo.value.current = 1
  174. getList()
  175. }
  176. const handleSearchTag = async (tag) => {
  177. if (searchParam.value.labels.includes(tag)) {
  178. return
  179. }
  180. searchParam.value.labels.push(tag)
  181. pageInfo.value.current = 1
  182. getList()
  183. }
  184. getLabelData()
  185. </script>
  186. <style scoped lang="scss">
  187. .contentWidth {
  188. width: 75%;
  189. max-width: 900px;
  190. }
  191. .box {
  192. min-height: 500px;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. flex-direction: column;
  197. transition: .5s;
  198. // &-search {
  199. // width: 75%;
  200. // max-width: 900px;
  201. // }
  202. &.active {
  203. min-height: unset;
  204. }
  205. .search-tags {
  206. width: 100%;
  207. margin-top: 10px;
  208. display: flex;
  209. font-size: 14px;
  210. &-label {
  211. padding-top: 7px;
  212. margin-right: 10px;
  213. &-content {
  214. width: 0;
  215. flex: 1;
  216. }
  217. }
  218. &-tag {
  219. margin-right: 10px;
  220. margin-bottom: 10px;
  221. }
  222. }
  223. }
  224. .change {
  225. // width: 75%;
  226. // max-width: 900px;
  227. margin-top: 10px;
  228. width: 100%;
  229. display: flex;
  230. justify-content: flex-end;
  231. }
  232. .tags {
  233. // width: 75%;
  234. // max-width: 900px;
  235. padding: 10px 0;
  236. .tag {
  237. margin: 5px;
  238. cursor: pointer;
  239. }
  240. }
  241. </style>