index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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 class="mr-10">所在城市: {{ item.areaName }}</div> -->
  67. <div v-if="item.interestedList?.length" class="mr-10 d-flex flex-wrap">
  68. <div>求职意向:</div>
  69. <div
  70. v-for="(interested, index) in item.interestedList"
  71. :key="interested.id"
  72. >
  73. <span :class="{'mx-3': index}">{{ (index ? '|' : '') }}</span>
  74. <span>{{ positionData.find(e => e.id === interested.positionId)?.nameCn ?? '暂无' }}</span>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <div class="px-5 pb-8">
  80. <div v-if="item.workList.length">
  81. <div class="second-title">工作经验</div>
  82. <v-timeline density="compact" align="start" side="end" truncate-line="both">
  83. <v-timeline-item v-for="(j, i) in item.workList" :key="i" dot-color="primary" size="small">
  84. <div v-if="j.show" class="timeline-item mt-1">
  85. <div v-ellipse-tooltip style="width: 20%;">
  86. <span>{{ j.startTimeStr }}</span>
  87. <span v-if="j.endTimeStr"> - {{ j.endTimeStr }}</span>
  88. <span v-if="j.year"> ({{ j.year }})</span>
  89. </div>
  90. <div v-ellipse-tooltip class="timeline-item-name mx-3">{{ j.enterpriseName }}</div>
  91. <div v-ellipse-tooltip class="timeline-item-name">{{ j.positionName }}</div>
  92. </div>
  93. </v-timeline-item>
  94. </v-timeline>
  95. </div>
  96. </div>
  97. <!-- <div style="padding-left: 84px;" class="pb-5 d-flex align-center">
  98. <div class="d-flex align-center mr-10">
  99. <div class="mr-3">最新职位:</div>
  100. <div>
  101. <v-chip
  102. class="mr-3"
  103. color="primary"
  104. >{{ item.workList[0]?.positionName ?? '暂无' }}</v-chip>
  105. </div>
  106. </div>
  107. <div class="d-flex align-center">
  108. <div class="mr-3">求职意向:</div>
  109. <v-chip
  110. v-for="interested in item.interestedList"
  111. :key="interested.id"
  112. class="mr-3"
  113. color="primary"
  114. >{{ positionData.find(e => e.id === interested.positionId)?.nameCn ?? '暂无' }}</v-chip>
  115. </div>
  116. </div> -->
  117. <!-- <v-divider></v-divider> -->
  118. <!-- <v-card-text class="d-flex mb-10"> -->
  119. <!-- <div style="width: 50%;" class="d-flex align-center">
  120. <div class="mr-3">最新职位:</div>
  121. <div class="mr-10">
  122. <v-chip
  123. class="mr-3"
  124. color="primary"
  125. >{{ item.workList[0]?.positionName ?? '暂无' }}</v-chip>
  126. </div>
  127. </div>
  128. <div style="width: 50%;" class="d-flex align-center">
  129. <div class="mr-3">求职意向</div>
  130. <v-chip
  131. v-for="interested in item.interestedList"
  132. :key="interested.id"
  133. class="mr-3"
  134. color="primary"
  135. >{{ positionData.find(e => e.id === interested.positionId)?.nameCn ?? '暂无' }}</v-chip>
  136. </div> -->
  137. <!-- <v-timeline truncate-line="both" side="end" class="justify-start">
  138. <v-timeline-item
  139. dot-color="primary"
  140. size="x-small"
  141. v-for="work in item.workList"
  142. :key="work.id"
  143. >
  144. <div class="d-flex">
  145. <div style="width: 200px;">
  146. {{ timesTampChange(work.startTime, 'Y.M.D') || '暂无' }}
  147. -
  148. {{ timesTampChange(work.endTime, 'Y.M.D') || timesTampChange(work.startTime, 'Y.M.D') ? '至今' : '暂无' }}
  149. </div>
  150. <div class="pr-3" style="min-width: 200px;">{{ work.enterpriseName }}</div>
  151. <div>{{ work.positionName }}</div>
  152. </div>
  153. </v-timeline-item>
  154. </v-timeline> -->
  155. <!-- <div style="width: 50%;">
  156. <div class="pa-3">求职意向</div>
  157. <v-chip
  158. v-for="interested in item.interestedList"
  159. :key="interested.id"
  160. class="mr-3"
  161. color="primary"
  162. >{{ positionData.find(e => e.id === interested.positionId)?.nameCn ?? '暂无' }}</v-chip>
  163. </div> -->
  164. <!-- </v-card-text> -->
  165. </v-card>
  166. </div>
  167. <CtPagination :total="total" :page="query.pageNo" :limit="query.pageSize" @handleChange="handleChangePage"></CtPagination>
  168. <!-- <CtTable
  169. :items="items"
  170. :headers="headers"
  171. :loading="loading"
  172. :elevation="0"
  173. :isTools="false"
  174. :showPage="true"
  175. :total="total"
  176. :page-info="query"
  177. itemKey="id"
  178. @pageHandleChange="handleChangePage"
  179. >
  180. <template #name="{ item }">
  181. <div class="d-flex align-center cursor-pointer" @click="handleToPersonDetail(item)">
  182. <v-badge
  183. v-if="item?.sex === '1' || item?.sex === '2'"
  184. bordered
  185. offset-y="6"
  186. :color="badgeColor(item)"
  187. :icon="badgeIcon(item)">
  188. <v-avatar size="40" :image="getUserAvatar(item.avatar, item.sex)"></v-avatar>
  189. </v-badge>
  190. <v-avatar v-else size="40" :image="getUserAvatar(item.avatar, item.sex)"></v-avatar>
  191. <span class="defaultLink ml-3 mt-2">{{ item?.name }}</span>
  192. </div>
  193. </template>
  194. <template #actions="{ item }">
  195. <v-btn color="primary" variant="text" @click="handleInvite(item)">邀请面试</v-btn>
  196. <v-btn color="primary" variant="text" @click="handleCommunicate(item)">立即沟通</v-btn>
  197. </template>
  198. </CtTable> -->
  199. </div>
  200. <CtDialog :visible="showInvite" :widthType="4" titleClass="text-h6" title="邀请面试" @close="showInvite = false" @submit="handleSubmit">
  201. <InvitePage v-if="showInvite" ref="inviteRef" :item-data="itemData" :position="positionList"></InvitePage>
  202. </CtDialog>
  203. <TipDialog :visible="showTip" icon="mdi-check-circle-outline" message="面试邀请发送成功" @close="showTip = false">
  204. <div class="color-primary text-decoration-underline cursor-pointer" @click="handleToInterviewManagement">点击到面试中查看。</div>
  205. </TipDialog>
  206. </template>
  207. <script setup>
  208. defineOptions({ name: 'searchRetrieval' })
  209. import { ref, computed } from 'vue'
  210. import CommonPage from '../components/common.vue'
  211. import Position from './components/position.vue'
  212. import { getPersonSearchPage } from '@/api/enterprise.js'
  213. import { dealDictArrayData } from '@/utils/position'
  214. import { timesTampChange } from '@/utils/date'
  215. import { talkToUser, defaultTextEnt } from '@/hooks/web/useIM'
  216. import { getUserAvatar } from '@/utils/avatar'
  217. import { getJobAdvertisedList } from '@/api/position'
  218. import Snackbar from '@/plugins/snackbar'
  219. import { saveInterviewInvite } from '@/api/recruit/enterprise/interview'
  220. import { useRouter } from 'vue-router'; const router = useRouter()
  221. import InvitePage from '@/views/recruit/enterprise/interviewManagement/components/invite'
  222. import { getDict } from '@/hooks/web/useDictionaries'
  223. import { getTimeDifferenceInChinese } from '@/utils/date'
  224. const textItem = ref({
  225. type: 'text',
  226. width: 600,
  227. value: '',
  228. label: '输入关键字',
  229. clearable: true,
  230. appendInnerIcon: 'mdi-magnify'
  231. })
  232. const query = ref({
  233. pageNo: 1,
  234. pageSize: 5
  235. })
  236. const queryParams = ref({
  237. content: null,
  238. positionIds: [],
  239. areaIds: [],
  240. expType: '',
  241. eduType: ''
  242. })
  243. const selectItems = ref({
  244. value: null,
  245. itemText: 'name',
  246. itemValue: 'id',
  247. hideDetails: true,
  248. clearable: true,
  249. multiple: true,
  250. checkStrictly: true,
  251. collapseTags: true,
  252. placeholder: '地区',
  253. items: [],
  254. })
  255. const positionData = ref([])
  256. getDict('areaTreeData', null, 'areaTreeData').then(res => {
  257. const data = res?.data?.length ? res.data : []
  258. if (data[0] && data[0].id === 10000) data[0].children = []
  259. selectItems.value.items = data
  260. })
  261. getDict('positionData', {}, 'positionData').then(({ data }) => {
  262. positionData.value = data
  263. })
  264. const total = ref(0)
  265. const items = ref([])
  266. const loading = ref(false)
  267. // const headers = ref([
  268. // { title: '姓名', key: 'name', sortable: false },
  269. // { title: '求职状态', key: 'jobStatusName', sortable: false },
  270. // { title: '工作年限', key: 'expName', sortable: false },
  271. // { title: '最高学历', key: 'eduName', sortable: false },
  272. // { title: '所在城市', key: 'areaName', sortable: false },
  273. // { title: '户籍地', key: 'regName', sortable: false },
  274. // { title: '婚姻状况', key: 'maritalStatusName', sortable: false },
  275. // { title: '首次工作时间', key: 'firstWorkTime', sortable: false, value: item => timesTampChange(item.firstWorkTime, 'Y-M-D') },
  276. // { title: '操作', key: 'actions', sortable: false }
  277. // ])
  278. const getData = async () => {
  279. loading.value = true
  280. try {
  281. const res = await getPersonSearchPage(Object.assign(queryParams.value, query.value))
  282. if (!res.list.length) {
  283. items.value = []
  284. total.value = 0
  285. return
  286. }
  287. items.value = dealDictArrayData([], res.list).map(e => {
  288. e.regName = e.reg?.str ?? ''
  289. e.areaName = e.area?.str ?? '暂无'
  290. e.subTitle = [e.jobStatusName, e.expName ? e.expName + '工作经验' : null, e.eduName, e.maritalStatusName].filter(k => k).join(' | ')
  291. if (e.workList?.length) {
  292. e.workList.forEach(exp => {
  293. exp.startTimeStr = exp.startTime ? timesTampChange(exp.startTime, 'Y-M') : '未填写工作时间'
  294. exp.endTimeStr = exp.startTime ? exp.endTime ? timesTampChange(exp.endTime, 'Y-M') : '至今' : ''
  295. exp.year = exp.endTimeStr ? getTimeDifferenceInChinese(exp.startTime, exp.endTime) : ''
  296. // 未填写工作经验内容,不展示
  297. exp.show = Boolean(exp.year) || Boolean(exp.enterpriseName) || Boolean(exp.positionName)
  298. })
  299. }
  300. return e
  301. })
  302. total.value = res.total
  303. } finally {
  304. loading.value = false
  305. }
  306. }
  307. // 分页
  308. const handleChangePage = (e) =>{
  309. query.value.pageNo = e
  310. getData()
  311. }
  312. const position = ref([])
  313. const handleSearch = (key, value) => {
  314. query.value.pageNo = 1
  315. queryParams.value[key] = value
  316. }
  317. const checkValue = (obj) => {
  318. return Object.values(obj).some(value => {
  319. return value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true)
  320. })
  321. }
  322. const handleConfirm = () => {
  323. const positionIds = position.value.map(k => k.id)
  324. queryParams.value.positionIds = positionIds || []
  325. query.value.pageNo = 1
  326. if (!checkValue(queryParams.value)) {
  327. Snackbar.warning('至少选择一个条件进行搜索')
  328. items.value = []
  329. total.value = 0
  330. return
  331. }
  332. getData()
  333. }
  334. // 清空筛选条件
  335. const clear = ref(false)
  336. const handleClear = () => {
  337. position.value = []
  338. queryParams.value = {
  339. content: null,
  340. positionIds: [],
  341. areaIds: [],
  342. expType: '',
  343. eduType: ''
  344. }
  345. query.value.pageNo = 1
  346. items.value = []
  347. total.value = 0
  348. clear.value = true
  349. }
  350. const handleClose = (item) => {
  351. position.value = position.value.filter(k => k.id !== item.id)
  352. }
  353. // 职位列表
  354. const jobNum = ref(0)
  355. const positionList = ref([])
  356. const getJobList = async () => {
  357. const { total, list } = await getJobAdvertisedList({ pageNo: 1, pageSize: 10, hasExpiredData: false, status: 0 })
  358. jobNum.value = total
  359. if (!list.length) {
  360. positionList.value = []
  361. jobNum.value = 0
  362. return
  363. }
  364. positionList.value = list.map(e => {
  365. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  366. return {
  367. label: `${e.name}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
  368. value: e.id,
  369. data: e
  370. }
  371. })
  372. }
  373. getJobList()
  374. // 立即沟通
  375. const handleCommunicate = async (item) => {
  376. // // 企业必须有招聘中的职位才能发起沟通
  377. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  378. const userId = item.userId
  379. if (!userId) return
  380. await talkToUser({userId, text: defaultTextEnt})
  381. let url = `/recruit/enterprise/invite/chatTools?id=${userId}`
  382. router.push(url)
  383. }
  384. const showInvite = ref(false)
  385. const showTip = ref(false)
  386. const inviteRef = ref()
  387. const itemData = ref({})
  388. const handleInvite = (item) => {
  389. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  390. itemData.value = item
  391. showInvite.value = true
  392. }
  393. // 发送面试邀请
  394. const handleSubmit = async () => {
  395. const { valid } = await inviteRef.value.CtFormRef.formRef.validate()
  396. if (!valid) {
  397. return
  398. }
  399. const query = inviteRef.value.getQuery()
  400. if (!query.time) {
  401. Snackbar.warning('时间不能为空')
  402. return
  403. }
  404. delete query.id
  405. await saveInterviewInvite(query)
  406. showInvite.value = false
  407. showTip.value = true
  408. }
  409. const handleToInterviewManagement = () => {
  410. router.push('/recruit/enterprise/invite/interviewManagement')
  411. }
  412. // 人才详情
  413. const handleToPersonDetail = ({ userId }) => {
  414. if (!userId) return
  415. window.open(`/recruit/enterprise/talentPool/details/${userId}`)
  416. }
  417. const badgeColor = computed(() => (item) => {
  418. return (item && item.sex) ? (item.sex === '1' ? '#1867c0' : 'error') : 'error'
  419. })
  420. const badgeIcon = computed(() => (item) => {
  421. return (item && item.sex) ? (item.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
  422. })
  423. </script>
  424. <style scoped lang="scss">
  425. .clear:hover {
  426. color: var(--v-primary-base);
  427. }
  428. .second-title {
  429. color: var(--color-666);
  430. font-size: 15px;
  431. }
  432. .timeline-item {
  433. display: flex;
  434. align-items: center;
  435. justify-content: space-between;
  436. width: 100%;
  437. color: var(--color-666);
  438. font-size: 13px;
  439. .timeline-item-name {
  440. width: 40%;
  441. }
  442. }
  443. :deep(.v-timeline-item__body) {
  444. width: 100%;
  445. }
  446. :deep(.v-timeline--vertical.v-timeline) {
  447. row-gap: 0;
  448. }
  449. :deep(.v-timeline-divider__dot--size-small) {
  450. width: 10px !important;
  451. height: 10px !important;
  452. margin-top: 10px !important;
  453. }
  454. :deep(.v-timeline-divider__inner-dot) {
  455. width: 10px !important;
  456. height: 10px !important;
  457. }
  458. </style>