item.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div>
  3. <div v-if="props.items.length" class="d-flex align-center mb-1">
  4. <v-checkbox v-model="selectAll" :label="!selectAll ? $t('common.selectAll') : `已选中${selectList.length}条`" hide-details color="primary" @update:model-value="handleChangeSelectAll"></v-checkbox>
  5. <div v-if="tab === 1" class="ml-8">
  6. <v-btn :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(2, 'batch', {})">{{ $t('common.refresh') }}</v-btn>
  7. <v-btn class="mx-3" :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(3, 'top', {})">{{ $t('common.topping') }}</v-btn>
  8. <v-btn :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(0, 'close', {})">{{ $t('common.close') }}</v-btn>
  9. </div>
  10. <v-btn v-if="tab === 2" class="ml-8" :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(1, 'activation', {})">{{ $t('common.activation') }}</v-btn>
  11. </div>
  12. <div v-for="val in items" :key="val.id" class="itemBox mb-3" :style="{'height': val?.hire ? '162px' : '134px'}">
  13. <div class="d-flex justify-space-between" style="padding: 10px 20px;">
  14. <div class="position">
  15. <div class="item-select">
  16. <v-checkbox v-model="val.select" hide-details color="primary" @update:model-value="handleChangeSelect"></v-checkbox>
  17. </div>
  18. <div class="ml-10 d-flex align-center">
  19. <span v-if="val.name.indexOf('style')" v-html="val.name" class="position-name" @click="handleDetails(val)"></span>
  20. <span v-else class="position-name" @click="handleDetails(val)">{{ val.name }}</span>
  21. <svg v-if="tab === 4" t="1719193613512" class="icon ml-3" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7666" width="25" height="25"><path d="M592.331776 439.619584l10.840064-30.636032 49.16224 17.398784-10.842112 30.633984-49.160192-17.396736z m96.054272-115.116032l-10.840064 30.635008-49.156096-17.39776 10.842112-30.635008 49.154048 17.39776z m296.593408 363.10528L451.8912 498.937856l-27.737088 78.367744 57.70752 20.424704-55.916544 90.039296 230.827008 81.692672c-9.371648 28.745728-21.200896 34.97984-47.558656 25.652224-27.072512-9.581568-81.678336-29.704192-116.795392-43.738112-2.545664 34.371584-6.008832 66.813952-11.152384 99.465216 45.597696 16.137216 100.243456 33.875968 127.8208 42.0352 69.653504 20.640768 105.135104 1.93024 132.8128-60.423168 15.962112-36.032512 30.455808-70.188032 43.681792-100.77696L565.44256 653.766656l14.022656-21.492736 369.80224 130.878464c-87.150592 150.434816-249.872384 251.63776-436.237312 251.63776-87.114752 0-169.064448-22.115328-240.54784-61.032448l86.624256-244.754432c14.751744 3.617792 29.504512 7.236608 43.544576 10.602496 8.411136-28.286976 20.257792-61.770752 33.829888-97.855488-15.0016-2.906112-29.044736-6.270976-43.082752-9.636864l125.060096-353.362944 24.221696 8.572928 32.776192-92.613632-275.70688-97.577984-32.779264 92.61568 27.072512 9.57952-133.13024 376.160256c-7.324672-1.603584-87.942144-16.722944-151.430144-28.83072A511.248384 511.248384 0 0 1 9.216 510.977024C9.216 232.728576 234.78272 7.161856 513.030144 7.161856c95.85664 0 185.460736 26.7776 261.745664 73.250816l-58.9056 166.436864-135.359488-47.906816-100.349952 283.546624L843.498496 611.08224l100.350976-283.547648-136.786944-48.410624 48.638976-137.43104c99.104768 92.005376 161.142784 223.39072 161.142784 369.28512 0 62.150656-11.28448 121.66144-31.864832 176.630784zM732.680192 489.288704l10.84416-30.63296 49.156096 17.400832-10.842112 30.629888-49.158144-17.39776z m96.057344-115.11296l-10.845184 30.635008-49.155072-17.400832 10.840064-30.633984 49.160192 17.399808z m-575.744 204.278784l25.213952-71.240704 48.444416 17.144832-23.701504 66.967552c-16.89088-4.37248-33.068032-8.49408-49.956864-12.87168z m178.547712-350.462976l-23.954432 67.678208L359.1424 278.528l23.955456-67.680256 48.443392 17.143808zM306.69824 426.71104l23.953408-67.683328 48.44544 17.145856-23.952384 67.68128-48.446464-17.143808zM193.521664 900.518912c-80.457728-66.070528-140.06272-156.583936-167.51104-260.184064 92.57472 17.773568 208.65024 39.995392 242.648064 47.880192l-75.137024 212.303872z" fill="#FE6E5A" p-id="7667"></path></svg>
  22. </div>
  23. <div class="mt-3 other-info ellipsis ml-10">
  24. <span>{{ val.areaName }}</span>
  25. <span class="lines"></span>
  26. <span>{{ val.eduName }}</span>
  27. <span class="lines"></span>
  28. <span>{{ val.expName }}</span>
  29. <span class="lines"></span>
  30. <span>{{ val.payFrom }}-{{ val.payTo }}/{{ val.payName }}</span>
  31. <span class="lines"></span>
  32. <span>{{ val.positionName }}</span>
  33. </div>
  34. <div v-if="val?.hire" class="ml-10 mt-2">
  35. <v-chip v-if="val?.hirePrice && val.hirePrice > 0" class="mr-3" label color="primary" size="small">赏金:{{ commissionCalculation(val.hirePrice, 1) }}元</v-chip>
  36. <v-chip v-if="val?.hirePoint && val.hirePoint > 0" label color="primary" size="small">积分:{{ commissionCalculation(val.hirePoint, 1) }}点</v-chip>
  37. </div>
  38. </div>
  39. <div class="d-flex align-center">
  40. <div v-if="tab === 1">
  41. <v-btn color="primary" variant="tonal">{{ $t('position.talentSearch') }}</v-btn>
  42. <v-btn class="ml-3" color="primary" @click="handleAction(2, '', val)">{{ $t('common.refresh') + $t('common.position') }}</v-btn>
  43. </div>
  44. <div v-if="tab === 2">
  45. <v-btn color="primary" @click="handleAction(1, '', val)">{{ $t('common.activatePosition') }}</v-btn>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="bottom pa-5 d-flex justify-space-between align-center">
  50. <div>{{ $t('position.refreshTime') }} :{{ timesTampChange(val.updateTime, 'Y-M-D') }} {{ val.expireDay && Number(val.expireDay) >= 1 ? `(${ val.expireDay }天后到期)` : '' }}</div>
  51. <div class="d-flex">
  52. <div class="ml-10 d-flex">
  53. <div v-if="tab === 1">
  54. <span class="cursor-pointer" @click="handleAction(3, '', val)">{{ $t('common.topping') }}</span>
  55. <span class="lines"></span>
  56. <span class="cursor-pointer" @click="handleAction(0, '', val)">{{ $t('common.close') }}</span>
  57. <span class="lines"></span>
  58. </div>
  59. <span class="cursor-pointer" @click="handleToStatistics">{{ $t('position.recruitmentStatistics') }}</span>
  60. <div v-if="tab !== 3">
  61. <span class="lines"></span>
  62. <span class="cursor-pointer" @click="handleEdit(val)">{{ $t('common.edit') }}</span>
  63. </div>
  64. <div v-if="tab === 4">
  65. <span class="lines"></span>
  66. <span class="cursor-pointer">{{ $t('common.close') }}</span>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script setup>
  75. import { commissionCalculation } from '@/utils/position'
  76. defineOptions({ name: 'enterprise-position-item'})
  77. import { ref, watch } from 'vue'
  78. import { useRouter } from 'vue-router'
  79. import { timesTampChange } from '@/utils/date'
  80. import { useI18n } from '@/hooks/web/useI18n'
  81. import { closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised } from '@/api/position'
  82. import Snackbar from '@/plugins/snackbar'
  83. const { t } = useI18n()
  84. const emit = defineEmits(['refresh'])
  85. const props = defineProps({
  86. tab: {
  87. type: Number,
  88. default: 1
  89. },
  90. items: Array
  91. })
  92. const selectAll = ref(false) // 全选
  93. const selectList = ref([]) // 选中列表
  94. const dealSelect = () => {
  95. selectList.value = props.items.filter(e => e.select).map(k => k.id)
  96. }
  97. // 全选
  98. const handleChangeSelectAll = () => {
  99. props.items.map(k => {
  100. k.select = selectAll.value
  101. return k
  102. })
  103. dealSelect()
  104. }
  105. // 单选
  106. const handleChangeSelect = () => {
  107. const length = props.items.filter(k => k.select).length
  108. selectAll.value = length > 0 ? true : false
  109. dealSelect()
  110. }
  111. // tab改变时清空选中的项
  112. watch(
  113. () => props.tab,
  114. () => {
  115. props.items.map(e => e.select = false)
  116. selectList.value = []
  117. selectAll.value = false
  118. },
  119. { immediate: true }
  120. )
  121. // 分页选中回显
  122. watch(
  123. () => props.items,
  124. (newVal) => {
  125. selectList.value.forEach(e => {
  126. const obj = newVal.find(k => k.id === e)
  127. if (obj) obj.select = true
  128. })
  129. },
  130. { immediate: true },
  131. { deep: true }
  132. )
  133. const apiList = [ closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised ]
  134. // 职位关闭、激活、刷新、置顶
  135. const handleAction = async (index, type, { id }) => {
  136. const ids = type ? props.items.filter(e => e.select).map(k => k.id) : [id]
  137. if (!ids.length && !index) return
  138. await apiList[index](ids)
  139. Snackbar.success(t('common.operationSuccessful'))
  140. // 清空选项
  141. selectList.value = []
  142. selectAll.value = false
  143. emit('refresh')
  144. }
  145. const router = useRouter()
  146. // 职位编辑
  147. const handleEdit = (val) => {
  148. router.push(`/recruit/enterprise/position/edit?id=${val.id}`)
  149. }
  150. // 职位详情
  151. const handleDetails = (val) => {
  152. window.open(`/recruit/enterprise/position/details/${val.id}`)
  153. }
  154. // 跳转招聘统计
  155. const handleToStatistics = () => {
  156. router.push('/recruit/enterprise/statistics/overallAnalysis')
  157. }
  158. </script>
  159. <style scoped lang="scss">
  160. .itemBox {
  161. position: relative;
  162. border: 1px solid #e5e6eb;
  163. }
  164. .position-name {
  165. color: var(--color-333);
  166. font-size: 19px;
  167. cursor: pointer;
  168. &:hover {
  169. color: var(--v-primary-base);
  170. }
  171. }
  172. .position {
  173. max-width: 46%;
  174. position: relative;
  175. .item-select {
  176. position: absolute;
  177. left: -8px;
  178. top: -13px;
  179. }
  180. }
  181. .lines {
  182. display: inline-block;
  183. width: 1px;
  184. height: 17px;
  185. vertical-align: middle;
  186. background-color: #e0e0e0;
  187. margin: 0 10px;
  188. }
  189. .other-info {
  190. font-size: 15px;
  191. color: var(--color-666);
  192. }
  193. .bottom {
  194. position: absolute;
  195. bottom: 0;
  196. left: 0;
  197. width: 100%;
  198. height: 40px;
  199. background-color: #f7f8fa;
  200. font-size: 14px;
  201. color: var(--color-888);
  202. }
  203. .resume {
  204. display: flex;
  205. font-size: 13px;
  206. flex-direction: column;
  207. align-items: center;
  208. color: var(--color-888);
  209. margin-right: 100px;
  210. cursor: pointer;
  211. }
  212. .resume-number {
  213. font-size: 20px;
  214. font-weight: 700;
  215. color: var(--color-999);
  216. }
  217. </style>