index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <div>
  3. <v-card class="card-box pa-5" style="height: 100%;">
  4. <div class="d-flex flex-column align-center" :class="{'v-center': init}">
  5. <TextUI
  6. v-model="content"
  7. :item="textItem"
  8. @keyup.enter="handleConfirm"
  9. @appendInnerClick="handleConfirm"
  10. ></TextUI>
  11. <div class="align-center">
  12. <template v-if="init && defaultLabelsShow?.length">
  13. <v-btn
  14. v-for="(val, index) in defaultLabelsShow" :key="val + index"
  15. class="mr-3 my-2 py-0 px-2"
  16. density="comfortable"
  17. color="primary" variant="tonal"
  18. v-bind="props"
  19. @click="clickChip(index)"
  20. >
  21. {{ val }}
  22. </v-btn>
  23. <!-- <v-btn class="ml-0 my-1 py-0 px-2" density="comfortable" variant="tonal" color="error" @click="moreLabels">
  24. 更多人才标签...
  25. </v-btn> -->
  26. </template>
  27. </div>
  28. </div>
  29. <template v-if="!init">
  30. <span class="mr-2 color-666" style="width: 68px; min-width: 68px;">人才标签:</span>
  31. <v-btn
  32. v-for="(val, index) in chosenLabels" :key="val + index"
  33. class="mr-3 my-2 py-0 px-2"
  34. density="comfortable"
  35. color="primary" variant="tonal"
  36. v-bind="props"
  37. >
  38. {{ val }}
  39. <v-icon class="ml-1" style="margin-top: 1px;" @click="deleteChip(index)">mdi-close</v-icon>
  40. </v-btn>
  41. <!-- <v-btn
  42. class="mr-3 my-2 py-0 px-0"
  43. density="comfortable"
  44. color="primary" variant="tonal"
  45. @click="moreLabels"
  46. >
  47. <v-icon>mdi-plus-box</v-icon>
  48. </v-btn> -->
  49. <v-btn icon="mdi-plus" class="mr-8" v-bind="props" variant="outlined" size="x-small" @click="moreLabels"></v-btn>
  50. <span v-if="chosenLabels?.length" class="my-2" style="font-size: 14px;cursor: pointer;color: var(--color-999);" @click="resetLabel">清空标签</span>
  51. </template>
  52. <!-- 人员信息表单 -->
  53. <CtTable
  54. v-if="dataList?.length"
  55. class="mt-3"
  56. :items="dataList"
  57. :headers="headers"
  58. :loading="loading"
  59. :elevation="0"
  60. :isTools="false"
  61. :showPage="true"
  62. :total="total"
  63. :page-info="pageInfo"
  64. itemKey="id"
  65. @pageHandleChange="handleChangePage"
  66. >
  67. <template #name="{ item }">
  68. <div class="d-flex align-center cursor-pointer" @click="talentPoolDetails(item)">
  69. <v-badge
  70. v-if="item?.sex === '1' || item?.sex === '2'"
  71. bordered
  72. offset-y="6"
  73. :color="badgeColor(item)"
  74. :icon="badgeIcon(item)">
  75. <v-avatar size="40" :image="getUserAvatar(item.avatar, item.sex)"></v-avatar>
  76. </v-badge>
  77. <v-avatar v-else size="40" :image="getUserAvatar(item.avatar, item.sex)"></v-avatar>
  78. <span class="defaultLink ml-3">{{ item?.name }}</span>
  79. </div>
  80. </template>
  81. <template #actions="{ item }">
  82. <v-btn color="primary" variant="text" @click="talentPoolDetails(item)">查看</v-btn>
  83. </template>
  84. </CtTable>
  85. <Empty v-if="!init && !total" :message="loading ? '加载中...' : '没有找到对应人才信息,请换个条件搜索'" :elevation="false" class="mt-15"></Empty>
  86. </v-card>
  87. <CtDialog :visible="showMore" titleClass="text-h6" title="选择人才标签" @close="showMore = false" @submit="handleSubmit">
  88. <div style="width: 80%; margin: 0 auto; min-height: 400px;">
  89. <CtForm :items="formItems" style="width: 100%;"></CtForm>
  90. </div>
  91. </CtDialog>
  92. </div>
  93. </template>
  94. <script setup>
  95. defineOptions({ name: 'enterprise-talent-map'})
  96. import { getRecruitPersonMapPage } from '@/api/recruit/enterprise/resumeManagement/talentMap'
  97. import { getRocketLabelList } from '@/api/recruit/enterprise/resumeManagement/talentMap'
  98. import { dealDictArrayData } from '@/utils/position'
  99. import { getUserAvatar } from '@/utils/avatar'
  100. import { timesTampChange } from '@/utils/date'
  101. import TextUI from '@/components/FormUI/TextInput'
  102. import Snackbar from '@/plugins/snackbar'
  103. import { computed, reactive, ref } from 'vue'
  104. const loading = ref(false)
  105. const content = ref('')
  106. const pageInfo = reactive({ pageNo: 1, pageSize: 10 })
  107. const dataList = ref([])
  108. const total = ref(0)
  109. const headers = [
  110. { title: '姓名', key: 'name', sortable: false },
  111. { title: '求职状态', key: 'jobStatusName', sortable: false },
  112. // { title: '求职类型', key: 'jobName', sortable: false },
  113. { title: '电话号码', key: 'phone', sortable: false },
  114. // { title: '常用邮箱', key: 'email', sortable: false },
  115. // { title: '微信二维码', key: 'wxCode', sortable: false },
  116. { title: '出生日期', key: 'birthday', sortable: false, value: item => timesTampChange(item.birthday, 'Y-M-D') },
  117. { title: '婚姻状况', key: 'maritalStatusName', sortable: false },
  118. { title: '所在城市', key: 'areaName', sortable: false },
  119. // { title: '户籍地', key: 'regName', sortable: false },
  120. { title: '首次工作时间', key: 'firstWorkTime', sortable: false, value: item => timesTampChange(item.firstWorkTime, 'Y-M-D') },
  121. // { title: '个人优势', key: 'advantage', sortable: false },
  122. { title: '工作年限', key: 'expName', sortable: false },
  123. { title: '最高学历', key: 'eduName', sortable: false },
  124. { title: '操作', value: 'actions', sortable: false }
  125. ]
  126. const init = ref(true)
  127. const labelList = ref([])
  128. const chosenLabels = ref([])
  129. const defaultLabelsShow = ref([])
  130. // 人才标签
  131. const getLabelData = async () => {
  132. const res = await getRocketLabelList({ current: 1, size:9999, type: 'person' }) //type: job enterprise person
  133. labelList.value = res?.records?.length ? res.records : []
  134. defaultLabelsShow.value = labelList.value?.length ? labelList.value.slice(0, 15) : [] // 默认展示且没有删除按钮
  135. //
  136. const labelsItem = formItems.value.options.find(f => f.key === 'labels')
  137. if (labelsItem) {
  138. labelsItem.items = labelList.value?.length ? labelList.value.map(e => ({ label: e, value: e })) : []
  139. }
  140. }
  141. getLabelData()
  142. const showMore = ref(false)
  143. const moreLabels = () => {
  144. const labelsItem = formItems.value.options.find(f => f.key === 'labels')
  145. if (labelsItem) {
  146. labelsItem.value = chosenLabels.value
  147. }
  148. showMore.value = true
  149. }
  150. const clickChip = (index) => {
  151. chosenLabels.value = [labelList.value[index]]
  152. handleConfirm()
  153. }
  154. const deleteChip = (index) => {
  155. chosenLabels.value.splice(index, 1)
  156. handleConfirm()
  157. }
  158. const resetLabel = () => {
  159. chosenLabels.value = []
  160. handleConfirm()
  161. }
  162. const formItems = ref({
  163. options: [
  164. {
  165. type: 'autocomplete',
  166. key: 'labels',
  167. value: null,
  168. label: '人才标签 ',
  169. multiple: true,
  170. outlined: true,
  171. itemText: 'label',
  172. itemValue: 'value',
  173. clearable: true,
  174. items: [
  175. // { label: '标签', value: '0' },
  176. ]
  177. },
  178. ]
  179. })
  180. const handleSubmit = () => {
  181. const labelsItem = formItems.value.options.find(f => f.key === 'labels')
  182. chosenLabels.value = labelsItem?.value?.length ? labelsItem.value : []
  183. showMore.value = false
  184. handleConfirm()
  185. }
  186. // 获取数据
  187. const getData = async () => {
  188. loading.value = true
  189. init.value = false
  190. const obj = { ...pageInfo, content: content.value }
  191. if (chosenLabels.value?.length) obj.labels = chosenLabels.value
  192. //
  193. const res = await getRecruitPersonMapPage(obj)
  194. total.value = res?.total ? res.total-0 : 0
  195. dataList.value = res?.list?.length ? dealDictArrayData([], res?.list) : []
  196. loading.value = false
  197. }
  198. // getData()
  199. const handleChangePage = (e) => {
  200. pageInfo.pageNo = e
  201. getData()
  202. }
  203. // 筛选
  204. const handleConfirm = () => {
  205. if (!chosenLabels.value?.length && !content.value) { // && init.value
  206. Snackbar.warning('请先输入内容或选择人才标签!')
  207. init.value = true
  208. dataList.value = []; total.value = 0
  209. return
  210. }
  211. pageInfo.pageNo = 1
  212. getData()
  213. }
  214. const badgeColor = computed(() => (item) => {
  215. return (item && item.sex) ? (item.sex === '1' ? '#1867c0' : 'error') : 'error'
  216. })
  217. const badgeIcon = computed(() => (item) => {
  218. return (item && item.sex) ? (item.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
  219. })
  220. const textItem = ref({
  221. type: 'text',
  222. width: 1000,
  223. value: '',
  224. // label: '职位匹配',
  225. label: '请输入职位匹配相关内容',
  226. placeholder: '回车开始人才匹配',
  227. clearable: false,
  228. // readonly: true,
  229. appendInnerIcon: 'mdi-magnify'
  230. })
  231. // 人才详情
  232. const talentPoolDetails = ({ userId, id }) => {
  233. if (!userId || !id) return
  234. window.open(`/recruit/enterprise/talentPool/details/${userId}?id=${id}`)
  235. }
  236. </script>
  237. <style scoped lang="scss">
  238. :deep(.v-table > .v-table__wrapper > table > thead) {
  239. background-color: #f7f8fa !important;
  240. }
  241. :deep(.v-selection-control__input) {
  242. color: var(--v-primary-base) !important;
  243. }
  244. .card-box {
  245. position: relative;
  246. .v-center {
  247. position: absolute;
  248. top: 40%;
  249. left: 50%;
  250. translate: -50% -50%;
  251. }
  252. }
  253. .requirementBox {
  254. width: 150px;
  255. height: 28px;
  256. line-height: 28px;
  257. // overflow: hidden;
  258. }
  259. .requirement {
  260. white-space: pre-wrap;
  261. word-break: break-all;
  262. line-height: 28px;
  263. color: var(--color-333);
  264. font-size: 15px;
  265. text-align: justify;
  266. letter-spacing: 0;
  267. // width: 60%;
  268. }
  269. .list-item {
  270. border: 1px solid #e5e6eb;
  271. }
  272. .top {
  273. display: flex;
  274. background-color: #f7f8fa;
  275. height: 50px;
  276. line-height: 50px;
  277. font-size: 14px;
  278. color: var(--color-666);
  279. padding: 0 20px;
  280. }
  281. .user-name {
  282. font-size: 18px;
  283. font-weight: 700;
  284. color: #555;
  285. }
  286. .user-info {
  287. color: var(--color-666);
  288. font-size: 14px;
  289. font-weight: 500;
  290. }
  291. :deep(.v-timeline-divider__dot--size-small) {
  292. width: 10px !important;
  293. height: 10px !important;
  294. margin-top: 10px !important;
  295. }
  296. :deep(.v-timeline-divider__inner-dot) {
  297. width: 10px !important;
  298. height: 10px !important;
  299. }
  300. .bottom {
  301. display: flex;
  302. justify-content: space-between;
  303. padding-bottom: 12px;
  304. .experience {
  305. width: 54%;
  306. height: 100%;
  307. }
  308. .edu {
  309. width: 40%;
  310. height: 100%;
  311. }
  312. }
  313. .second-title {
  314. color: var(--color-666);
  315. font-size: 15px;
  316. }
  317. .timeline-item {
  318. display: flex;
  319. align-items: center;
  320. justify-content: space-between;
  321. width: 100%;
  322. color: var(--color-666);
  323. font-size: 13px;
  324. .timeline-item-name {
  325. width: 26%;
  326. }
  327. }
  328. :deep(.v-timeline-item__body) {
  329. width: 100%;
  330. }
  331. :deep(.v-timeline--vertical.v-timeline) {
  332. row-gap: 0;
  333. }
  334. </style>