index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <v-card class="pa-5" style="height: calc(100vh - 130px);font-size: 14px;">
  3. <div class="d-flex justify-space-between">
  4. <div class="d-flex mb-3">
  5. <Autocomplete class="mr-3" v-model="query.jobId" :item="jobItem"></Autocomplete>
  6. <Autocomplete v-model="query.status" :item="statusItem"></Autocomplete>
  7. <v-btn color="primary" class="half-button ml-3" @click="handleSearch()">查 询</v-btn>
  8. <v-btn class="half-button mx-3" variant="outlined" color="primary" @click="handleReset">重 置</v-btn>
  9. <v-btn class="half-button" prepend-icon="mdi-refresh" variant="outlined" color="primary" @click="handleSearch(true)">刷 新</v-btn>
  10. </div>
  11. </div>
  12. <v-divider class="mb-3"></v-divider>
  13. <div class="d-flex" style="height: calc(100vh - 228px);">
  14. <div>
  15. <div class="d-flex justify-space-between px-5">
  16. <div v-if="selectDateValue">
  17. <span>{{ timesTampChange(selectDateValue, 'Y-M-D') }}</span>
  18. <span class="ml-2" style="cursor: pointer; color: var(--v-primary-base);" @click="handleClear">{{ $t('common.cleanUp') }}</span>
  19. </div>
  20. <div v-else class="color-999">{{ $t('interview.noDateSelected') }}</div>
  21. <v-btn color="primary" variant="text" size="small" @click="selectDateValue = new Date(); handleChangeDate()">{{ $t('interview.today') }}</v-btn>
  22. </div>
  23. <VueDatePicker
  24. v-model="selectDateValue"
  25. inline auto-apply
  26. locale="zh-CN"
  27. :enable-time-picker="false"
  28. :day-names="['一', '二', '三', '四', '五', '六', '七']"
  29. :markers="markers"
  30. hide-offset-dates
  31. @update:model-value="handleChangeDate"
  32. >
  33. <template #marker>
  34. <span class="custom-marker"></span>
  35. </template>
  36. </VueDatePicker>
  37. </div>
  38. <v-divider style="height: auto;" class="mr-3" vertical></v-divider>
  39. <div style="flex: 1;">
  40. <div v-if="items.length">
  41. <div style="height: calc(100vh - 318px);overflow: auto;">
  42. <itemPage :items="items" :statusList="statusList" :positionItems="positionItems" @refresh="handleRefresh"></itemPage>
  43. </div>
  44. <CtPagination
  45. v-if="total > 0"
  46. :total="total"
  47. :page="query.pageNo"
  48. :limit="query.pageSize"
  49. @handleChange="handleChangePage"
  50. ></CtPagination>
  51. </div>
  52. <Empty v-else :elevation="false"></Empty>
  53. </div>
  54. </div>
  55. </v-card>
  56. </template>
  57. <script setup>
  58. defineOptions({ name: 'enterprise-interview'})
  59. import { ref } from 'vue'
  60. import { getInterviewInvitePage, getEnterpriseInterviewCountByTime } from '@/api/recruit/enterprise/interview'
  61. import { getDict } from '@/hooks/web/useDictionaries'
  62. import { getJobAdvertised } from '@/api/enterprise'
  63. import { dealDictArrayData } from '@/utils/position'
  64. import { timesTampChange, getStartAndEndOfDay } from '@/utils/date'
  65. import itemPage from './components/item.vue'
  66. import Snackbar from '@/plugins/snackbar'
  67. import { formatName } from '@/utils/getText'
  68. const items = ref([])
  69. const statusList = ref()
  70. const total = ref(0)
  71. const query = ref({
  72. pageSize: 20,
  73. pageNo: 1,
  74. status: null,
  75. jobId: null,
  76. time: []
  77. })
  78. const positionItems = ref([])
  79. const jobItem = ref({ width: 300, items: positionItems, clearable: true, hideDetails: true, label: '职位' })
  80. const statusItem = ref({ width: 300, items: statusList, clearable: true, hideDetails: true, label: '面试状态' })
  81. // 获取有面试的日期列表
  82. const markers = ref([])
  83. const getCountByTime = async () => {
  84. const data = await getEnterpriseInterviewCountByTime()
  85. if (!data || !data.length) return
  86. markers.value = data.map(e => {
  87. return { date: e.key, type: 'dot' }
  88. })
  89. }
  90. getCountByTime()
  91. // 状态字典
  92. const getStatusList = async () => {
  93. const { data } = await getDict('menduner_interview_invite_status')
  94. statusList.value = data
  95. }
  96. getStatusList()
  97. // 列表
  98. const getData = async (isRefresh = false) => {
  99. const { list, total: number } = await getInterviewInvitePage(query.value)
  100. items.value = list
  101. total.value = number
  102. if (isRefresh) Snackbar.success('刷新成功')
  103. }
  104. getData()
  105. const handleRefresh = () => {
  106. query.value.pageNo = 1
  107. getData()
  108. }
  109. // 分页
  110. const handleChangePage = (e) => {
  111. query.value.pageNo = e
  112. getData()
  113. }
  114. // 日期选择
  115. const selectDateValue = ref(null)
  116. const handleChangeDate = () => {
  117. const time = getStartAndEndOfDay(selectDateValue.value)
  118. if (!time || !time.length) return delete query.value.time
  119. query.value.time = time
  120. query.value.pageNo = 1
  121. getData()
  122. }
  123. // 清除
  124. const handleClear = () => {
  125. query.value.pageNo = 1
  126. selectDateValue.value = null
  127. delete query.value.time
  128. getData()
  129. }
  130. const handleSearch = (refresh = false) => {
  131. query.value.pageNo = 1
  132. getData(refresh)
  133. }
  134. const handleReset = () => {
  135. query.value = {
  136. pageSize: 10,
  137. pageNo: 1,
  138. status: null,
  139. jobId: null,
  140. time: []
  141. }
  142. selectDateValue.value = null
  143. getData()
  144. }
  145. // 职位
  146. const getPositionList = async () => {
  147. const data = await getJobAdvertised()
  148. if (!data.length) return
  149. const list = dealDictArrayData([], data)
  150. positionItems.value = list.map(e => {
  151. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  152. return { label: `${formatName(e.name)}_${e.areaName ? e.area?.str ?? '全国' : '全国'} ${salary}_${Number(e.status) === 0 ? '招聘中' : '已关闭'}`, value: e.id, status: e.status }
  153. })
  154. }
  155. getPositionList()
  156. </script>
  157. <style scoped lang="scss">
  158. :deep(.dp__menu) {
  159. border: none !important;
  160. }
  161. .custom-marker {
  162. position: absolute;
  163. bottom: 0;
  164. right: 50%;
  165. transform: translateX(50%);
  166. height: 8px;
  167. width: 8px;
  168. border-radius: 100%;
  169. background-color: var(--v-primary-base);
  170. }
  171. /* 滚动条样式 */
  172. ::-webkit-scrollbar {
  173. -webkit-appearance: none;
  174. width: 4px;
  175. height: 0px;
  176. }
  177. /* 滚动条内的轨道 */
  178. ::-webkit-scrollbar-track {
  179. background: rgba(0, 0, 0, 0.1);
  180. border-radius: 0;
  181. }
  182. /* 滚动条内的滑块 */
  183. ::-webkit-scrollbar-thumb {
  184. cursor: pointer;
  185. border-radius: 5px;
  186. background: rgba(0, 0, 0, 0.15);
  187. transition: color 0.2s ease;
  188. }
  189. </style>