index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div>
  3. <CtFilter :items="formItems" @reset="handleReset" @search="handleSearch" />
  4. <v-card elevation="5" class="mt-3">
  5. <CtTable
  6. :items="items"
  7. class="pa-3"
  8. :headers="headers"
  9. :loading="loading"
  10. :disable-sort="true"
  11. :elevation="0"
  12. :isTools="false"
  13. height="calc(100vh - 400px)"
  14. :showPage="true"
  15. :total="total"
  16. :pageInfo="query"
  17. itemKey="id"
  18. @pageHandleChange="handleChangePage"
  19. >
  20. <template #workTerritory="{ item }">
  21. <div class="ellipsis" style="max-width: 150px;">
  22. {{ item.workTerritory }}
  23. <v-tooltip activator="parent" location="top">{{ item.workTerritory }}</v-tooltip>
  24. </div>
  25. </template>
  26. <template #workHistory="{ item }">
  27. <div class="ellipsis" style="max-width: 150px;">
  28. {{ item.workHistory }}
  29. <v-tooltip activator="parent" location="top">{{ item.workHistory }}</v-tooltip>
  30. </div>
  31. </template>
  32. <template #actions="{ item }">
  33. <v-btn variant="text" color="primary" @click.stop="handleDetail(item)">详 情</v-btn>
  34. <v-btn :disabled="!item.userPersonList || !item.userPersonList.length" variant="text" color="primary" @click.stop="handleContactInformation(item)">
  35. 联系方式
  36. </v-btn>
  37. </template>
  38. </CtTable>
  39. </v-card>
  40. <v-navigation-drawer v-model="showDetail" absolute location="right" rounded temporary width="700" class="pa-5">
  41. <div style="width: 300px; height: 300px; margin: 0 auto;">
  42. <v-img :src="detail?.picUrl" width="300" height="300" />
  43. </div>
  44. <div class="mt-10" v-if="detail?.detailIntroduction" v-html="detail?.detailIntroduction.replace(/\n/g, '</br>')"></div>
  45. </v-navigation-drawer>
  46. <!-- 无权限提示 -->
  47. <CtDialog :visible="showDialog" :widthType="4" :footer="false" titleClass="text-h6" title="系统提示" @close="showDialog = false">
  48. <div class="d-flex align-center flex-column">
  49. <div class="color-warning">
  50. <p>很抱歉,您当前没有权限查看门墩儿新任命的相关信息</p>
  51. <p>请用微信扫描下方企业微信联系门墩儿管理员开通权限</p>
  52. </div>
  53. <div style="width: 150px; height: 150px;">
  54. <v-img src="https://minio.menduner.com/dev/menduner/contact.png"></v-img>
  55. </div>
  56. <div class="text-center ml-5">潘青海先生(Peter Pan)</div>
  57. </div>
  58. </CtDialog>
  59. <!-- 联系方式 -->
  60. <CtDialog :visible="showContactDialog" title="当前联系方式匹配人员" :footer="false" widthType="0" @close="showContactDialog = false">
  61. <CtTable
  62. :loading="false"
  63. :items="contactList"
  64. :headers="contactHeaders"
  65. :elevation="0"
  66. :isTools="false"
  67. :showPage="false"
  68. itemKey="user.id"
  69. >
  70. <template #name="{ item }">
  71. <div class="d-flex align-center cursor-pointer">
  72. <v-badge
  73. v-if="item?.person?.sex === '1' || item?.person?.sex === '2'"
  74. bordered
  75. offset-y="6"
  76. :color="badgeColor(item)"
  77. :icon="badgeIcon(item)">
  78. <v-avatar size="40" :image="getUserAvatar(item.person.avatar, item.person.sex)"></v-avatar>
  79. </v-badge>
  80. <v-avatar v-else size="40" :image="getUserAvatar(item.person?.avatar, item.person?.sex)"></v-avatar>
  81. <span class="ml-3">{{ item?.person?.name || item?.phone }}</span>
  82. </div>
  83. </template>
  84. <template #actions="{ item }">
  85. <v-btn variant="text" color="primary" @click.stop="handleContactInformation({ userPersonList: [item] })">联系方式</v-btn>
  86. </template>
  87. </CtTable>
  88. </CtDialog>
  89. </div>
  90. </template>
  91. <script setup>
  92. defineOptions({ name: 'newlyAppointedTable'})
  93. import { ref, computed } from 'vue'
  94. import { getNewAppointmentsPage, getNewAppointmentsDetail } from '@/api/recruit/enterprise/newlyAppointed'
  95. import { useUserStore } from '@/store/user'
  96. import Snackbar from '@/plugins/snackbar'
  97. import { getUserAvatar } from '@/utils/avatar'
  98. import { dealDictObjData } from '@/utils/position'
  99. const store = useUserStore()
  100. const loading = ref(false)
  101. const total = ref(10)
  102. const query = ref({
  103. pageSize: 10,
  104. pageNo: 1
  105. })
  106. const items = ref([])
  107. const headers = [
  108. { title: '宣布日期', key: 'announceTime', sortable: false },
  109. { title: '中文名', key: 'nameChinese', sortable: false },
  110. { title: '英文名', key: 'nameEnglish', sortable: false },
  111. { title: '性别', key: 'gender', sortable: false },
  112. { title: '职位', key: 'position', sortable: false },
  113. { title: '任职酒店', key: 'inaugurationHotel', sortable: false },
  114. { title: '酒店品牌', key: 'hotelBrand', sortable: false },
  115. { title: '工作地域', key: 'workTerritory', sortable: false },
  116. { title: '过往工作酒店品牌', key: 'workHistory', sortable: false },
  117. { title: '操作', key: 'actions', sortable: false, align: 'center' }
  118. ]
  119. const formItems = ref({
  120. options: [
  121. {
  122. type: 'text',
  123. key: 'nameChinese',
  124. value: '',
  125. label: '中文名',
  126. clearable: true,
  127. hideDetails: true,
  128. width: 200
  129. },
  130. {
  131. type: 'text',
  132. key: 'nameEnglish',
  133. value: '',
  134. label: '英文名',
  135. clearable: true,
  136. hideDetails: true,
  137. width: 200
  138. },
  139. {
  140. type: 'text',
  141. key: 'position',
  142. value: '',
  143. label: '职位',
  144. clearable: true,
  145. hideDetails: true,
  146. width: 200
  147. },
  148. {
  149. type: 'text',
  150. key: 'inaugurationHotel',
  151. value: '',
  152. label: '任职酒店',
  153. clearable: true,
  154. hideDetails: true,
  155. width: 200
  156. },
  157. {
  158. type: 'text',
  159. key: 'hotelBrand',
  160. value: '',
  161. label: '酒店品牌',
  162. clearable: true,
  163. hideDetails: true,
  164. width: 200
  165. },
  166. {
  167. type: 'text',
  168. key: 'workTerritory',
  169. value: '',
  170. label: '工作地域',
  171. clearable: true,
  172. hideDetails: true,
  173. width: 200
  174. },
  175. {
  176. type: 'text',
  177. key: 'workHistory',
  178. value: '',
  179. label: '过往工作酒店品牌',
  180. clearable: true,
  181. hideDetails: true,
  182. width: 200
  183. }
  184. ]
  185. })
  186. const showDialog = ref(false)
  187. // 获取企业权益信息
  188. const info = ref(localStorage.getItem('entBaseInfo') ? JSON.parse(localStorage.getItem('entBaseInfo')) : {})
  189. store.$subscribe((mutation, state) => {
  190. if (Object.keys(state.entBaseInfo).length) info.value = state.entBaseInfo
  191. })
  192. // 获取新任命分页
  193. const getList = async () => {
  194. loading.value = true
  195. try {
  196. const result = await getNewAppointmentsPage(query.value)
  197. items.value = result.list
  198. total.value = result.total
  199. } finally {
  200. loading.value = false
  201. }
  202. }
  203. getList()
  204. // 分页切换
  205. const handleChangePage = async (e) => {
  206. await store.getEnterpriseInfo(true)
  207. // 没有权限提示联系门墩儿
  208. if (!info.value?.entitlement?.newAppointment) {
  209. showDialog.value = true
  210. return
  211. }
  212. query.value.pageNo = e
  213. getList()
  214. }
  215. // 搜索
  216. const handleSearch = async (obj) => {
  217. await store.getEnterpriseInfo(true)
  218. // 没有权限提示联系门墩儿
  219. if (!info.value?.entitlement?.newAppointment) {
  220. showDialog.value = true
  221. return
  222. }
  223. query.value = Object.assign(query.value, obj)
  224. query.value.pageNo = 1
  225. getList()
  226. }
  227. // 重置
  228. const handleReset = (obj) => {
  229. query.value = Object.assign(query.value, obj)
  230. query.value.pageNo = 1
  231. getList()
  232. }
  233. // 查看详情
  234. const showDetail = ref(false)
  235. const detail = ref({})
  236. const handleDetail = async (item) => {
  237. await store.getEnterpriseInfo(true)
  238. // 没有权限提示联系门墩儿
  239. if (!info.value?.entitlement?.newAppointment) {
  240. showDialog.value = true
  241. return
  242. }
  243. const result = await getNewAppointmentsDetail(item.id)
  244. if (!result || !Object.keys(result).length) return Snackbar.warning('暂无详细信息,去查看其他人的信息吧~')
  245. detail.value = result
  246. showDetail.value = true
  247. }
  248. // 查看联系方式
  249. const contactList = ref([])
  250. const showContactDialog = ref(false)
  251. const contactHeaders = ref([
  252. { title: '中文名', key: 'name', sortable: false },
  253. { title: '英文名', key: 'person.foreignName', sortable: false },
  254. { title: '求职状态', key: 'person.jobStatusName', sortable: false },
  255. { title: '工作经验', key: 'person.expName', sortable: false },
  256. { title: '最高学历', key: 'person.eduName', sortable: false },
  257. { title: '联系电话', key: 'phone', sortable: false, value: item => item?.person?.phone || item.user.phone },
  258. { title: '电子邮箱', key: 'email', sortable: false, value: item => item?.person?.email || item.user.email },
  259. { title: '操作', key: 'actions', sortable: false, align: 'center' }
  260. ])
  261. const handleContactInformation = async ({ userPersonList }) => {
  262. await store.getEnterpriseInfo(true)
  263. // 没有权限提示联系门墩儿
  264. if (!info.value?.entitlement?.newAppointment) {
  265. showDialog.value = true
  266. return
  267. }
  268. // 只匹配到一个用户的直接查看详情
  269. if (userPersonList.length === 1) {
  270. window.open(`/recruit/enterprise/talentPool/details/${userPersonList[0].user.id}`)
  271. return
  272. }
  273. // 匹配到多个用户,展示列表
  274. contactList.value = userPersonList.map(e => {
  275. if (e?.person) e.person = Object.assign(e.person, dealDictObjData({}, e.person))
  276. return e
  277. })
  278. showContactDialog.value = true
  279. }
  280. const badgeColor = computed(() => (item) => {
  281. return (item.person && item.person.sex) ? (item.person.sex === '1' ? '#1867c0' : 'error') : 'error'
  282. })
  283. const badgeIcon = computed(() => (item) => {
  284. return (item.person && item.person.sex) ? (item.person.sex === '1' ? 'mdi-gender-male' : 'mdi-gender-female') : 'mdi-gender-female'
  285. })
  286. </script>
  287. <style scoped lang="scss">
  288. </style>