index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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 class="experience" 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>
  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 class="timeline-item-name ellipsis">{{ j.enterpriseName }}</div>
  91. <div class="timeline-item-name ellipsis">{{ 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. console.log(items.value)
  303. total.value = res.total
  304. } finally {
  305. loading.value = false
  306. }
  307. }
  308. // 分页
  309. const handleChangePage = (e) =>{
  310. query.value.pageNo = e
  311. getData()
  312. }
  313. const position = ref([])
  314. const handleSearch = (key, value) => {
  315. query.value.pageNo = 1
  316. queryParams.value[key] = value
  317. }
  318. const checkValue = (obj) => {
  319. return Object.values(obj).some(value => {
  320. return value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true)
  321. })
  322. }
  323. const handleConfirm = () => {
  324. const positionIds = position.value.map(k => k.id)
  325. queryParams.value.positionIds = positionIds || []
  326. query.value.pageNo = 1
  327. if (!checkValue(queryParams.value)) {
  328. Snackbar.warning('至少选择一个条件进行搜索')
  329. items.value = []
  330. total.value = 0
  331. return
  332. }
  333. getData()
  334. }
  335. // 清空筛选条件
  336. const clear = ref(false)
  337. const handleClear = () => {
  338. position.value = []
  339. queryParams.value = {
  340. content: null,
  341. positionIds: [],
  342. areaIds: [],
  343. expType: '',
  344. eduType: ''
  345. }
  346. query.value.pageNo = 1
  347. items.value = []
  348. total.value = 0
  349. clear.value = true
  350. }
  351. const handleClose = (item) => {
  352. position.value = position.value.filter(k => k.id !== item.id)
  353. }
  354. // 职位列表
  355. const jobNum = ref(0)
  356. const positionList = ref([])
  357. const getJobList = async () => {
  358. const { total, list } = await getJobAdvertisedList({ pageNo: 1, pageSize: 10, hasExpiredData: false, status: 0 })
  359. jobNum.value = total
  360. if (!list.length) {
  361. positionList.value = []
  362. jobNum.value = 0
  363. return
  364. }
  365. positionList.value = list.map(e => {
  366. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  367. return {
  368. label: `${e.name}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
  369. value: e.id,
  370. data: e
  371. }
  372. })
  373. }
  374. getJobList()
  375. // 立即沟通
  376. const handleCommunicate = async (item) => {
  377. // // 企业必须有招聘中的职位才能发起沟通
  378. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  379. const userId = item.userId
  380. if (!userId) return
  381. await talkToUser({userId, text: defaultTextEnt})
  382. let url = `/recruit/enterprise/chatTools?id=${userId}`
  383. router.push(url)
  384. }
  385. const showInvite = ref(false)
  386. const showTip = ref(false)
  387. const inviteRef = ref()
  388. const itemData = ref({})
  389. const handleInvite = (item) => {
  390. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  391. itemData.value = item
  392. showInvite.value = true
  393. }
  394. // 发送面试邀请
  395. const handleSubmit = async () => {
  396. const { valid } = await inviteRef.value.CtFormRef.formRef.validate()
  397. if (!valid) {
  398. return
  399. }
  400. const query = inviteRef.value.getQuery()
  401. if (!query.time) {
  402. Snackbar.warning('时间不能为空')
  403. return
  404. }
  405. delete query.id
  406. await saveInterviewInvite(query)
  407. showInvite.value = false
  408. showTip.value = true
  409. }
  410. const handleToInterviewManagement = () => {
  411. router.push('/recruit/enterprise/interviewManagement')
  412. }
  413. // 人才详情
  414. const handleToPersonDetail = ({ userId }) => {
  415. if (!userId) return
  416. window.open(`/recruit/enterprise/talentPool/details/${userId}`)
  417. }
  418. const badgeColor = computed(() => (item) => {
  419. return (item && item.sex) ? (item.sex === '1' ? '#1867c0' : 'error') : 'error'
  420. })
  421. const badgeIcon = computed(() => (item) => {
  422. return (item && item.sex) ? (item.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
  423. })
  424. </script>
  425. <style scoped lang="scss">
  426. .clear:hover {
  427. color: var(--v-primary-base);
  428. }
  429. .experience {
  430. width: 54%;
  431. height: 100%;
  432. }
  433. .second-title {
  434. color: var(--color-666);
  435. font-size: 15px;
  436. }
  437. .timeline-item {
  438. display: flex;
  439. align-items: center;
  440. justify-content: space-between;
  441. width: 100%;
  442. color: var(--color-666);
  443. font-size: 13px;
  444. .timeline-item-name {
  445. width: 26%;
  446. }
  447. }
  448. :deep(.v-timeline-item__body) {
  449. width: 100%;
  450. }
  451. :deep(.v-timeline--vertical.v-timeline) {
  452. row-gap: 0;
  453. }
  454. :deep(.v-timeline-divider__dot--size-small) {
  455. width: 10px !important;
  456. height: 10px !important;
  457. margin-top: 10px !important;
  458. }
  459. :deep(.v-timeline-divider__inner-dot) {
  460. width: 10px !important;
  461. height: 10px !important;
  462. }
  463. </style>