index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div class="mt-4">
  3. <div class="d-flex justify-center">
  4. <TextInput v-model="queryParams.content" :item="textItem" @enter="handleConfirm" @appendInnerClick="handleConfirm"></TextInput>
  5. </div>
  6. <div>
  7. <Position :isClear="clear" @clear="clear = false" :selectData="position" @select="val => position = val"></Position>
  8. <div class="font-size-15 d-flex align-center color-666">
  9. <span>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区:</span>
  10. <cascade v-model="queryParams.areaIds" :item="selectItems" @change="val => handleSearch('areaIds', val)" style="width: 300px;"></cascade>
  11. </div>
  12. <CommonPage :isClear="clear" @clear="clear = false" class="my-3" dictType="menduner_education_type" title="最高学历" @select="val => handleSearch('eduType', val)"></CommonPage>
  13. <CommonPage :isClear="clear" @clear="clear = false" dictType="menduner_exp_type" title="工作经验" @select="val => handleSearch('expType', val)"></CommonPage>
  14. <v-divider class="mt-1 mb-3"></v-divider>
  15. <div>
  16. <div>
  17. <v-chip v-for="k in position" :key="k.id" label class="mr-3" closable @click:close="handleClose(k)">{{ k.nameCn }}</v-chip>
  18. </div>
  19. <div class="text-end">
  20. <v-btn color="primary" variant="text" @click="handleClear">清空筛选条件</v-btn>
  21. </div>
  22. </div>
  23. <div class="text-center mt-3">
  24. <v-btn class="half-button" color="primary" @click="handleConfirm">搜 索</v-btn>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="mt-10" v-loading="loading">
  29. <v-divider></v-divider>
  30. <div class="py-3">
  31. <v-card
  32. v-for="item in items"
  33. :key="item.id"
  34. elevation="5"
  35. class="mb-3"
  36. :subtitle="item.subTitle"
  37. :title="item?.name"
  38. >
  39. <template #prepend>
  40. <v-badge
  41. v-if="item?.sex === '1' || item?.sex === '2'"
  42. class="mr-3 cursor-pointer"
  43. bordered
  44. offset-y="6"
  45. :color="badgeColor(item)"
  46. :icon="badgeIcon(item)"
  47. @click="handleToPersonDetail(item)"
  48. >
  49. <v-avatar size="48" :image="getUserAvatar(item.avatar, item.sex)"></v-avatar>
  50. </v-badge>
  51. <v-avatar v-else class="mr-3 cursor-pointer" size="48" :image="getUserAvatar(item.avatar, item.sex)" @click="handleToPersonDetail(item)"></v-avatar>
  52. </template>
  53. <template #append>
  54. <v-btn color="primary" variant="text" @click="handleInvite(item)">邀请面试</v-btn>
  55. <v-btn color="primary" variant="text" @click="handleCommunicate(item)">立即沟通</v-btn>
  56. </template>
  57. <template #title>
  58. <span class="cursor-pointer defaultLink" @click="handleToPersonDetail(item)">
  59. {{ item.name }}
  60. </span>
  61. </template>
  62. <template #subtitle>
  63. <div class="d-flex">
  64. <div class="mr-10">{{ item.subTitle }}</div>
  65. <div class="mr-10">首次工作时间: {{ timesTampChange(item.firstWorkTime, 'Y-M-D') }}</div>
  66. <div v-if="item.interestedList?.length" class="mr-10 d-flex flex-wrap">
  67. <div>求职意向:</div>
  68. <div
  69. v-for="(interested, index) in item.interestedList"
  70. :key="interested.id"
  71. >
  72. <span :class="{'mx-3': index}">{{ (index ? '|' : '') }}</span>
  73. <span>{{ positionData.find(e => e.id === interested.positionId)?.nameCn ?? '暂无' }}</span>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <div class="px-5 pb-8">
  79. <div v-if="item?.workList?.length">
  80. <div class="second-title">工作经验</div>
  81. <v-timeline density="compact" align="start" side="end" truncate-line="both">
  82. <v-timeline-item v-for="(j, i) in item.workList" :key="i" dot-color="primary" size="small">
  83. <div v-if="j.show" class="timeline-item mt-1">
  84. <div v-ellipse-tooltip style="width: 20%;">
  85. <span>{{ j.startTimeStr }}</span>
  86. <span v-if="j.endTimeStr"> - {{ j.endTimeStr }}</span>
  87. <span v-if="j.year"> ({{ j.year }})</span>
  88. </div>
  89. <div v-ellipse-tooltip class="timeline-item-name mx-3">{{ formatName(j.enterpriseName) || '' }}</div>
  90. <div v-ellipse-tooltip class="timeline-item-name">{{ formatName(j.positionName) || '' }}</div>
  91. </div>
  92. </v-timeline-item>
  93. </v-timeline>
  94. </div>
  95. </div>
  96. </v-card>
  97. </div>
  98. <CtPagination :total="total" :page="query.pageNo" :limit="query.pageSize" @handleChange="handleChangePage"></CtPagination>
  99. </div>
  100. <CtDialog :visible="showInvite" :widthType="4" titleClass="text-h6" title="邀请面试" @close="showInvite = false" @submit="handleSubmit">
  101. <InvitePage v-if="showInvite" ref="inviteRef" :item-data="itemData" :position="positionList"></InvitePage>
  102. </CtDialog>
  103. <TipDialog :visible="showTip" icon="mdi-check-circle-outline" message="面试邀请发送成功" @close="showTip = false">
  104. <div class="color-primary text-decoration-underline cursor-pointer" @click="handleToInterviewManagement">点击到面试中查看。</div>
  105. </TipDialog>
  106. </template>
  107. <script setup>
  108. defineOptions({ name: 'searchRetrieval' })
  109. import { ref, computed } from 'vue'
  110. import CommonPage from '../components/common.vue'
  111. import Position from './components/position.vue'
  112. import { getPersonSearchPage } from '@/api/enterprise.js'
  113. import { dealDictArrayData } from '@/utils/position'
  114. import { timesTampChange } from '@/utils/date'
  115. import { talkToUser, defaultTextEnt } from '@/hooks/web/useIM'
  116. import { getUserAvatar } from '@/utils/avatar'
  117. import { getJobAdvertisedList } from '@/api/position'
  118. import Snackbar from '@/plugins/snackbar'
  119. import { saveInterviewInvite } from '@/api/recruit/enterprise/interview'
  120. import { useRouter } from 'vue-router'; const router = useRouter()
  121. import InvitePage from '@/views/recruit/enterprise/interviewManagement/components/invite'
  122. import { getDict } from '@/hooks/web/useDictionaries'
  123. import { getTimeDifferenceInChinese } from '@/utils/date'
  124. import { formatName } from '@/utils/getText'
  125. const textItem = ref({
  126. type: 'text',
  127. width: 600,
  128. value: '',
  129. label: '输入关键字',
  130. clearable: true,
  131. appendInnerIcon: 'mdi-magnify'
  132. })
  133. const query = ref({
  134. pageNo: 1,
  135. pageSize: 5
  136. })
  137. const queryParams = ref({
  138. content: null,
  139. positionIds: [],
  140. areaIds: [],
  141. expType: '',
  142. eduType: ''
  143. })
  144. const selectItems = ref({
  145. value: null,
  146. itemText: 'name',
  147. itemValue: 'id',
  148. hideDetails: true,
  149. clearable: true,
  150. multiple: true,
  151. checkStrictly: true,
  152. collapseTags: true,
  153. placeholder: '地区',
  154. items: [],
  155. })
  156. const positionData = ref([])
  157. getDict('areaTreeData', null, 'areaTreeData').then(res => {
  158. const data = res?.data?.length ? res.data : []
  159. if (data[0] && data[0].id === 10000) data[0].children = []
  160. selectItems.value.items = data
  161. })
  162. getDict('positionData', {}, 'positionData').then(({ data }) => {
  163. positionData.value = data
  164. })
  165. const total = ref(0)
  166. const items = ref([])
  167. const loading = ref(false)
  168. const getData = async () => {
  169. loading.value = true
  170. try {
  171. const res = await getPersonSearchPage(Object.assign(queryParams.value, query.value))
  172. if (!res?.list?.length) {
  173. items.value = []
  174. total.value = 0
  175. return
  176. }
  177. items.value = dealDictArrayData([], res.list).map(e => {
  178. e.name = e.name + `(${e.type === '1' ? '在校学生' : '职场人士'})`
  179. e.regName = e.reg?.str ?? ''
  180. e.areaName = e.area?.str ?? '暂无'
  181. e.subTitle = [e.jobStatusName, e.expName ? e.expName + '' : null, e.eduName, e.maritalStatusName].filter(k => k).join(' | ')
  182. if (e.workList?.length) {
  183. e.workList.forEach(exp => {
  184. exp.startTimeStr = exp.startTime ? timesTampChange(exp.startTime, 'Y-M') : '未填写工作时间'
  185. exp.endTimeStr = exp.startTime ? exp.endTime ? timesTampChange(exp.endTime, 'Y-M') : '至今' : ''
  186. exp.year = exp.endTimeStr ? getTimeDifferenceInChinese(exp.startTime, exp.endTime) : ''
  187. // 未填写工作经验内容,不展示
  188. exp.show = Boolean(exp.year) || Boolean(exp.enterpriseName) || Boolean(exp.positionName)
  189. })
  190. }
  191. return e
  192. })
  193. total.value = res.total
  194. } finally {
  195. loading.value = false
  196. }
  197. }
  198. // 分页
  199. const handleChangePage = (e) =>{
  200. query.value.pageNo = e
  201. getData()
  202. }
  203. const position = ref([])
  204. const handleSearch = (key, value) => {
  205. query.value.pageNo = 1
  206. queryParams.value[key] = value
  207. }
  208. const checkValue = (obj) => {
  209. return Object.values(obj).some(value => {
  210. return value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true)
  211. })
  212. }
  213. const handleConfirm = () => {
  214. const positionIds = position.value.map(k => k.id)
  215. queryParams.value.positionIds = positionIds || []
  216. query.value.pageNo = 1
  217. if (!checkValue(queryParams.value)) {
  218. Snackbar.warning('至少选择一个条件进行搜索')
  219. items.value = []
  220. total.value = 0
  221. return
  222. }
  223. getData()
  224. }
  225. // 清空筛选条件
  226. const clear = ref(false)
  227. const handleClear = () => {
  228. position.value = []
  229. queryParams.value = {
  230. content: null,
  231. positionIds: [],
  232. areaIds: [],
  233. expType: '',
  234. eduType: ''
  235. }
  236. query.value.pageNo = 1
  237. items.value = []
  238. total.value = 0
  239. clear.value = true
  240. }
  241. const handleClose = (item) => {
  242. position.value = position.value.filter(k => k.id !== item.id)
  243. }
  244. // 职位列表
  245. const jobNum = ref(0)
  246. const positionList = ref([])
  247. const getJobList = async () => {
  248. const { total, list } = await getJobAdvertisedList({ pageNo: 1, pageSize: 10, hasExpiredData: false, status: 0 })
  249. jobNum.value = total
  250. if (!list?.length) {
  251. positionList.value = []
  252. jobNum.value = 0
  253. return
  254. }
  255. positionList.value = list.map(e => {
  256. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  257. return {
  258. label: `${e.name}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
  259. value: e.id,
  260. data: e
  261. }
  262. })
  263. }
  264. getJobList()
  265. // 立即沟通
  266. const handleCommunicate = async (item) => {
  267. // // 企业必须有招聘中的职位才能发起沟通
  268. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  269. const userId = item.userId
  270. if (!userId) return
  271. await talkToUser({userId, text: defaultTextEnt})
  272. let url = `/recruit/enterprise/invite/chatTools?id=${userId}`
  273. router.push(url)
  274. }
  275. const showInvite = ref(false)
  276. const showTip = ref(false)
  277. const inviteRef = ref()
  278. const itemData = ref({})
  279. const handleInvite = (item) => {
  280. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  281. itemData.value = item
  282. showInvite.value = true
  283. }
  284. // 发送面试邀请
  285. const handleSubmit = async () => {
  286. const { valid } = await inviteRef.value.CtFormRef.formRef.validate()
  287. if (!valid) {
  288. return
  289. }
  290. const query = inviteRef.value.getQuery()
  291. if (!query.time) {
  292. Snackbar.warning('时间不能为空')
  293. return
  294. }
  295. delete query.id
  296. await saveInterviewInvite(query)
  297. showInvite.value = false
  298. showTip.value = true
  299. }
  300. const handleToInterviewManagement = () => {
  301. router.push('/recruit/enterprise/invite/interviewManagement')
  302. }
  303. // 人才详情
  304. const handleToPersonDetail = ({ userId }) => {
  305. if (!userId) return
  306. window.open(`/recruit/enterprise/talentPool/details/${userId}`)
  307. }
  308. const badgeColor = computed(() => (item) => {
  309. return (item && item.sex) ? (item.sex === '1' ? '#1867c0' : 'error') : 'error'
  310. })
  311. const badgeIcon = computed(() => (item) => {
  312. return (item && item.sex) ? (item.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
  313. })
  314. </script>
  315. <style scoped lang="scss">
  316. .clear:hover {
  317. color: var(--v-primary-base);
  318. }
  319. .second-title {
  320. color: var(--color-666);
  321. font-size: 15px;
  322. }
  323. .timeline-item {
  324. display: flex;
  325. align-items: center;
  326. justify-content: space-between;
  327. width: 100%;
  328. color: var(--color-666);
  329. font-size: 13px;
  330. .timeline-item-name {
  331. width: 40%;
  332. }
  333. }
  334. :deep(.v-timeline-item__body) {
  335. width: 100%;
  336. }
  337. :deep(.v-timeline--vertical.v-timeline) {
  338. row-gap: 0;
  339. }
  340. :deep(.v-timeline-divider__dot--size-small) {
  341. width: 10px !important;
  342. height: 10px !important;
  343. margin-top: 10px !important;
  344. }
  345. :deep(.v-timeline-divider__inner-dot) {
  346. width: 10px !important;
  347. height: 10px !important;
  348. }
  349. </style>