index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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-8">
  24. <v-btn class="half-button" color="primary" @click="handleConfirm">搜 索</v-btn>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="mt-8" v-loading="loading">
  29. <v-divider></v-divider>
  30. <div v-if="items?.length" 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 v-if="total && !loading" :total="total" :page="query.pageNo" :limit="query.pageSize" @handleChange="handleChangePage"></CtPagination>
  99. <Empty v-else :elevation="false" :message="checkValue(queryParams) ? '无匹配数据' : '请加入条件后点击搜索'"></Empty>
  100. </div>
  101. <CtDialog :visible="showInvite" :widthType="4" titleClass="text-h6" title="邀请面试" @close="showInvite = false" @submit="handleSubmit">
  102. <InvitePage v-if="showInvite" ref="inviteRef" :item-data="itemData" :position="positionList"></InvitePage>
  103. </CtDialog>
  104. <TipDialog :visible="showTip" icon="mdi-check-circle-outline" message="面试邀请发送成功" @close="showTip = false">
  105. <div class="color-primary text-decoration-underline cursor-pointer" @click="handleToInterviewManagement">点击到面试中查看。</div>
  106. </TipDialog>
  107. </template>
  108. <script setup>
  109. defineOptions({ name: 'searchRetrieval' })
  110. import { ref, computed } from 'vue'
  111. import CommonPage from '../components/common.vue'
  112. import Position from './components/position.vue'
  113. import { getPersonSearchPage } from '@/api/enterprise.js'
  114. import { dealDictArrayData } from '@/utils/position'
  115. import { timesTampChange } from '@/utils/date'
  116. import { talkToUser, defaultTextEnt } from '@/hooks/web/useIM'
  117. import { getUserAvatar } from '@/utils/avatar'
  118. import { getJobAdvertisedList } from '@/api/position'
  119. import Snackbar from '@/plugins/snackbar'
  120. import { saveInterviewInvite } from '@/api/recruit/enterprise/interview'
  121. import { useRouter } from 'vue-router'; const router = useRouter()
  122. import InvitePage from '@/views/recruit/enterprise/interviewManagement/components/invite'
  123. import { getDict } from '@/hooks/web/useDictionaries'
  124. import { getTimeDifferenceInChinese } from '@/utils/date'
  125. import { formatName } from '@/utils/getText'
  126. const textItem = ref({
  127. type: 'text',
  128. width: 600,
  129. value: '',
  130. label: '输入关键字',
  131. clearable: true,
  132. appendInnerIcon: 'mdi-magnify'
  133. })
  134. const query = ref({
  135. pageNo: 1,
  136. pageSize: 5
  137. })
  138. const queryParams = ref({
  139. content: null,
  140. positionIds: [],
  141. areaIds: [],
  142. expType: '',
  143. eduType: ''
  144. })
  145. const selectItems = ref({
  146. value: null,
  147. itemText: 'name',
  148. itemValue: 'id',
  149. hideDetails: true,
  150. clearable: true,
  151. multiple: true,
  152. checkStrictly: true,
  153. collapseTags: true,
  154. placeholder: '地区',
  155. items: [],
  156. })
  157. const positionData = ref([])
  158. getDict('areaTreeData', null, 'areaTreeData').then(res => {
  159. const data = res?.data?.length ? res.data : []
  160. if (data[0] && data[0].id === 10000) data[0].children = []
  161. selectItems.value.items = data
  162. })
  163. getDict('positionData', {}, 'positionData').then(({ data }) => {
  164. positionData.value = data
  165. })
  166. const total = ref(0)
  167. const items = ref([])
  168. const loading = ref(false)
  169. const getData = async () => {
  170. loading.value = true
  171. try {
  172. const res = await getPersonSearchPage({...queryParams.value, ...query.value})
  173. if (!res?.list?.length) {
  174. items.value = []
  175. total.value = 0
  176. return
  177. }
  178. items.value = dealDictArrayData([], res.list).map(e => {
  179. e.name = e.name + `(${e.type === '1' ? '在校学生' : '职场人士'})`
  180. e.regName = e.reg?.str ?? ''
  181. e.areaName = e.area?.str ?? '暂无'
  182. e.subTitle = [e.jobStatusName, e.expName ? e.expName + '' : null, e.eduName, e.maritalStatusName].filter(k => k).join(' | ')
  183. if (e.workList?.length) {
  184. e.workList.forEach(exp => {
  185. exp.startTimeStr = exp.startTime ? timesTampChange(exp.startTime, 'Y-M') : '未填写工作时间'
  186. exp.endTimeStr = exp.startTime ? exp.endTime ? timesTampChange(exp.endTime, 'Y-M') : '至今' : ''
  187. exp.year = exp.endTimeStr ? getTimeDifferenceInChinese(exp.startTime, exp.endTime) : ''
  188. // 未填写工作经验内容,不展示
  189. exp.show = Boolean(exp.year) || Boolean(exp.enterpriseName) || Boolean(exp.positionName)
  190. })
  191. }
  192. return e
  193. })
  194. total.value = res.total
  195. } finally {
  196. loading.value = false
  197. }
  198. }
  199. // 分页
  200. const handleChangePage = (e) =>{
  201. query.value.pageNo = e
  202. getData()
  203. }
  204. const position = ref([])
  205. const handleSearch = (key, value) => {
  206. query.value.pageNo = 1
  207. queryParams.value[key] = value
  208. }
  209. const checkValue = (obj) => {
  210. return Object.values(obj).some(value => {
  211. return value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true)
  212. })
  213. }
  214. const handleConfirm = () => {
  215. const positionIds = position.value.map(k => k.id)
  216. queryParams.value.positionIds = positionIds || []
  217. query.value.pageNo = 1
  218. if (!checkValue(queryParams.value)) {
  219. Snackbar.warning('至少选择一个条件进行搜索')
  220. items.value = []
  221. total.value = 0
  222. return
  223. }
  224. getData()
  225. }
  226. // 清空筛选条件
  227. const clear = ref(false)
  228. const handleClear = () => {
  229. position.value = []
  230. queryParams.value = {
  231. content: null,
  232. positionIds: [],
  233. areaIds: [],
  234. expType: '',
  235. eduType: ''
  236. }
  237. query.value.pageNo = 1
  238. items.value = []
  239. total.value = 0
  240. clear.value = true
  241. }
  242. const handleClose = (item) => {
  243. position.value = position.value.filter(k => k.id !== item.id)
  244. }
  245. // 职位列表
  246. const jobNum = ref(0)
  247. const positionList = ref([])
  248. const getJobList = async () => {
  249. const { total, list } = await getJobAdvertisedList({ pageNo: 1, pageSize: 10, hasExpiredData: false, status: 0 })
  250. jobNum.value = total
  251. if (!list?.length) {
  252. positionList.value = []
  253. jobNum.value = 0
  254. return
  255. }
  256. positionList.value = list.map(e => {
  257. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  258. return {
  259. label: `${e.name}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
  260. value: e.id,
  261. data: e
  262. }
  263. })
  264. }
  265. getJobList()
  266. // 立即沟通
  267. const handleCommunicate = async (item) => {
  268. // // 企业必须有招聘中的职位才能发起沟通
  269. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  270. const userId = item.userId
  271. if (!userId) return
  272. await talkToUser({userId, text: defaultTextEnt})
  273. let url = `/recruit/enterprise/invite/chatTools?id=${userId}`
  274. router.push(url)
  275. }
  276. const showInvite = ref(false)
  277. const showTip = ref(false)
  278. const inviteRef = ref()
  279. const itemData = ref({})
  280. const handleInvite = (item) => {
  281. if (jobNum.value === 0) return Snackbar.warning('请先发布职位')
  282. itemData.value = item
  283. showInvite.value = true
  284. }
  285. // 发送面试邀请
  286. const handleSubmit = async () => {
  287. const { valid } = await inviteRef.value.CtFormRef.formRef.validate()
  288. if (!valid) {
  289. return
  290. }
  291. const query = inviteRef.value.getQuery()
  292. if (!query.time) {
  293. Snackbar.warning('时间不能为空')
  294. return
  295. }
  296. delete query.id
  297. await saveInterviewInvite(query)
  298. showInvite.value = false
  299. showTip.value = true
  300. }
  301. const handleToInterviewManagement = () => {
  302. router.push('/recruit/enterprise/invite/interviewManagement')
  303. }
  304. // 人才详情
  305. const handleToPersonDetail = ({ userId }) => {
  306. if (!userId) return
  307. window.open(`/recruit/enterprise/talentPool/details/${userId}`)
  308. }
  309. const badgeColor = computed(() => (item) => {
  310. return (item && item.sex) ? (item.sex === '1' ? '#1867c0' : 'error') : 'error'
  311. })
  312. const badgeIcon = computed(() => (item) => {
  313. return (item && item.sex) ? (item.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
  314. })
  315. </script>
  316. <style scoped lang="scss">
  317. .clear:hover {
  318. color: var(--v-primary-base);
  319. }
  320. .second-title {
  321. color: var(--color-666);
  322. font-size: 15px;
  323. }
  324. .timeline-item {
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. width: 100%;
  329. color: var(--color-666);
  330. font-size: 13px;
  331. .timeline-item-name {
  332. width: 40%;
  333. }
  334. }
  335. :deep(.v-timeline-item__body) {
  336. width: 100%;
  337. }
  338. :deep(.v-timeline--vertical.v-timeline) {
  339. row-gap: 0;
  340. }
  341. :deep(.v-timeline-divider__dot--size-small) {
  342. width: 10px !important;
  343. height: 10px !important;
  344. margin-top: 10px !important;
  345. }
  346. :deep(.v-timeline-divider__inner-dot) {
  347. width: 10px !important;
  348. height: 10px !important;
  349. }
  350. </style>