123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <div>
- <div v-if="props.items.length" class="d-flex align-center mb-1">
- <v-checkbox v-if="tab !== 3 && tab !== 4" v-model="selectAll" :label="!selectAll ? $t('common.selectAll') : `已选中${selectList.length}条`" hide-details color="primary" @update:model-value="handleChangeSelectAll"></v-checkbox>
- <div v-if="tab === 1" class="ml-8">
- <v-btn :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(2, 'batch', {})">{{ $t('common.refresh') }}</v-btn>
- <v-btn class="mx-3" :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(3, 'top', {})">{{ $t('common.topping') }}</v-btn>
- <v-btn :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(0, 'close', {})">{{ $t('common.close') }}</v-btn>
- </div>
- <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>
- </div>
- <div v-for="val in items" :key="val.id" class="itemBox mb-3" :style="{'height': val?.hire ? '162px' : '134px'}">
- <div class="d-flex justify-space-between" style="padding: 10px 20px;">
- <div class="position">
- <div v-if="tab !== 3 && tab !== 4" class="item-select">
- <v-checkbox v-model="val.select" hide-details color="primary" @update:model-value="handleChangeSelect"></v-checkbox>
- </div>
- <div :class="[{'ml-10': tab !== 3 && tab !== 4} ,'d-flex' ,'align-center']">
- <span v-if="val.name.indexOf('style')" v-html="val.name" class="position-name" @click="handleDetails(val)"></span>
- <span v-else class="position-name" @click="handleDetails(val)">{{ val.name }}</span>
- <svg-icon v-if="tab === 4" class="ml-3" name="pin" size="25"></svg-icon>
- </div>
- <div :class="['mt-3', 'other-info', 'ellipsis', {'ml-10': tab !== 3 && tab !== 4}]">
- <span>{{ val.areaName }}</span>
- <span class="lines" v-if="val.areaName && val.eduName"></span>
- <span>{{ val.eduName }}</span>
- <span class="lines"></span>
- <span>{{ val.expName }}</span>
- <span class="lines"></span>
- <span>{{ val.payFrom }}-{{ val.payTo }}/{{ val.payName }}</span>
- <span class="lines"></span>
- <span>{{ val.positionName }}</span>
- </div>
- <div v-if="val?.hire" class="mt-2">
- <v-chip v-if="val?.hirePrice && val.hirePrice > 0" class="mr-3" label color="primary" size="small">赏金:{{ commissionCalculation(val.hirePrice, 1) }}元</v-chip>
- <v-chip v-if="val?.hirePoint && val.hirePoint > 0" label color="primary" size="small">积分:{{ commissionCalculation(val.hirePoint, 1) }}点</v-chip>
- </div>
- </div>
- <div class="d-flex align-center">
- <div v-if="tab === 1">
- <!-- <v-btn color="primary" variant="tonal">{{ $t('position.talentSearch') }}</v-btn> -->
- <v-btn class="ml-3" color="primary" @click="handleAction(2, '', val)">{{ $t('common.refresh') + $t('common.position') }}</v-btn>
- </div>
- <div v-if="tab === 2">
- <v-btn color="primary" @click="handleAction(1, '', val)">{{ $t('common.activatePosition') }}</v-btn>
- </div>
- </div>
- </div>
- <div class="bottom pa-5 d-flex justify-space-between align-center">
- <div>{{ $t('position.refreshTime') }} :{{ timesTampChange(val.updateTime, 'Y-M-D') }} {{ val.expireDay && Number(val.expireDay) >= 1 ? `(${ val.expireDay }天后到期)` : '' }}</div>
- <div class="d-flex">
- <div class="ml-10 d-flex">
- <div v-if="tab === 4 && (val.status-0) === 99">
- <span class="cursor-pointer defaultLink" style="color: primary;" @click="toPay(val)">去支付</span>
- <span class="lines"></span>
- </div>
- <div v-if="tab === 1">
- <span class="cursor-pointer" @click="handleAction(3, '', val)">{{ $t('common.topping') }}</span>
- <span class="lines"></span>
- <span class="cursor-pointer" @click="handleAction(0, '', val)">{{ $t('common.close') }}</span>
- <span class="lines"></span>
- </div>
- <span class="cursor-pointer" @click="handleToStatistics">{{ $t('position.recruitmentStatistics') }}</span>
- <div v-if="tab !== 3">
- <span class="lines"></span>
- <span class="cursor-pointer" @click="handleEdit(val)">{{ $t('common.edit') }}</span>
- </div>
- <div v-if="tab === 4">
- <span class="lines"></span>
- <span class="cursor-pointer">{{ $t('common.close') }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <confirmPaymentDialog
- v-if="showConfirmPaymentDialog"
- :cost="cost"
- :spuId="spuId"
- :spuName="spuName"
- :type="2"
- @close="showConfirmPaymentDialog = false"
- ></confirmPaymentDialog>
- </template>
- <script setup>
- import { commissionCalculation } from '@/utils/position'
- defineOptions({ name: 'enterprise-position-item'})
- import { ref, watch } from 'vue'
- import { useRouter } from 'vue-router'
- import { timesTampChange } from '@/utils/date'
- import { useI18n } from '@/hooks/web/useI18n'
- import { closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised } from '@/api/position'
- import Snackbar from '@/plugins/snackbar'
- import confirmPaymentDialog from '@/components/pay/confirmPaymentDialog.vue'
- const { t } = useI18n()
- const emit = defineEmits(['refresh'])
- const props = defineProps({
- tab: {
- type: Number,
- default: 1
- },
- items: Array
- })
- const showConfirmPaymentDialog = ref(false)
- const cost = ref(0)
- const spuId = ref('')
- const spuName = ref('')
- const toPay = (val) => {
- console.log('1', val)
- //
- spuId.value = val.id || ''
- spuName.value = val.name || ''
- cost.value = (val.hirePrice - 0) || 0
- // 打开支付弹窗
- showConfirmPaymentDialog.value = true
- }
- const selectAll = ref(false) // 全选
- const selectList = ref([]) // 选中列表
- const dealSelect = () => {
- selectList.value = props.items.filter(e => e.select).map(k => k.id)
- }
- // 全选
- const handleChangeSelectAll = () => {
- props.items.map(k => {
- k.select = selectAll.value
- return k
- })
- dealSelect()
- }
- // 单选
- const handleChangeSelect = () => {
- const length = props.items.filter(k => k.select).length
- selectAll.value = length > 0 ? true : false
- dealSelect()
- }
- // tab改变时清空选中的项
- watch(
- () => props.tab,
- () => {
- props.items.map(e => e.select = false)
- selectList.value = []
- selectAll.value = false
- },
- { immediate: true }
- )
- // 分页选中回显
- watch(
- () => props.items,
- (newVal) => {
- selectList.value.forEach(e => {
- const obj = newVal.find(k => k.id === e)
- if (obj) obj.select = true
- })
- },
- { immediate: true },
- { deep: true }
- )
- const apiList = [ closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised ]
- // 职位关闭、激活、刷新、置顶
- const handleAction = async (index, type, { id }) => {
- const ids = type ? props.items.filter(e => e.select).map(k => k.id) : [id]
- if (!ids.length && !index) return
- await apiList[index](ids)
- Snackbar.success(t('common.operationSuccessful'))
- // 清空选项
- selectList.value = []
- selectAll.value = false
- emit('refresh')
- }
- const router = useRouter()
- // 职位编辑
- const handleEdit = (val) => {
- router.push(`/recruit/enterprise/position/edit?id=${val.id}`)
- }
- // 职位详情
- const handleDetails = (val) => {
- window.open(`/recruit/enterprise/position/details/${val.id}`)
- }
- // 跳转招聘统计
- const handleToStatistics = () => {
- router.push('/recruit/enterprise/statistics/overallAnalysis')
- }
- </script>
- <style scoped lang="scss">
- .itemBox {
- position: relative;
- border: 1px solid #e5e6eb;
- }
- .position-name {
- color: var(--color-333);
- font-size: 19px;
- cursor: pointer;
- &:hover {
- color: var(--v-primary-base);
- }
- }
- .position {
- max-width: 46%;
- position: relative;
- .item-select {
- position: absolute;
- left: -8px;
- top: -13px;
- }
- }
- .lines {
- display: inline-block;
- width: 1px;
- height: 17px;
- vertical-align: middle;
- background-color: #e0e0e0;
- margin: 0 10px;
- }
- .other-info {
- font-size: 15px;
- color: var(--color-666);
- }
- .bottom {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 40px;
- background-color: #f7f8fa;
- font-size: 14px;
- color: var(--color-888);
- }
- .resume {
- display: flex;
- font-size: 13px;
- flex-direction: column;
- align-items: center;
- color: var(--color-888);
- margin-right: 100px;
- cursor: pointer;
- }
- .resume-number {
- font-size: 20px;
- font-weight: 700;
- color: var(--color-999);
- }
- </style>
|