index.vue 13 KB

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