123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <div class="resume-box">
- <div class="resume-header mb-3">
- <div class="resume-title">{{ $t('resume.jobIntention') }}</div>
- <v-btn v-if="!isAdd" variant="text" color="primary" prepend-icon="mdi-plus-box" @click="isAdd = true">{{ $t('common.add') }}</v-btn>
- </div>
- <div v-if="!isAdd">
- <div v-if="interestList.length">
- <div
- :class="['position-item', 'mx-n2', 'px-2']"
- v-for="(k, i) in interestList"
- :key="i"
- @mouseenter="k.active = true"
- @mouseleave="k.active = false"
- >
- <div class="d-flex">
- <div>{{ k.position }}</div>
- <div class="line">|</div>
- <div>{{k.payFrom}}-{{k.payTo}}</div>
- <div class="line">|</div>
- <div class="grey-text text-box">{{ k.industry.map(e => e.nameCn).join('、') }}</div>
- <div class="line" v-if="k.industry.length && k.jobTypeName">|</div>
- <div class="grey-text">{{ k.jobTypeName }}</div>
- <div class="line" v-if="k.jobTypeName && k.workArea">|</div>
- <div class="grey-text">{{ k.workArea }}</div>
- </div>
- <div class="float-right" v-if="k.active">
- <v-btn variant="text" color="primary" prepend-icon="mdi-square-edit-outline" @click="handleEdit(k)">{{ $t('common.edit') }}</v-btn>
- <v-btn variant="text" color="primary" prepend-icon="mdi-trash-can-outline" @click="handleDelete(k)">{{ $t('common.delete') }}</v-btn>
- </div>
- </div>
- </div>
- <div v-else class="resumeNoDataText">{{ $t('resume.dataDefaultPrompt') }}{{ $t('resume.jobIntention') }}...</div>
- </div>
- <div v-if="isAdd" class="mt-2">
- <CtForm ref="formPageRef" :items="items" style="width: 100%;">
- <!-- 期望岗位 -->
- <template #positionId="{ item }">
- <v-menu :close-delay="1" :open-delay="0" v-bind="$attrs">
- <template v-slot:activator="{ props }">
- <textUI
- :modelValue="item.value"
- :item="item"
- v-bind="props"
- style="position: relative;"
- ></textUI>
- </template>
- <jobTypeCard class="jobTypeCardBox" :select="[query.positionId].filter(Boolean)" :isSingle="true" @handleJobClick="handleJobClickItem"></jobTypeCard>
- </v-menu>
- </template>
- <!-- 期望行业 -->
- <template #industryIdList="{ item }">
- <v-menu :close-delay="1" :open-delay="0" v-bind="$attrs" :close-on-content-click="false">
- <template v-slot:activator="{ props }">
- <textUI
- v-model="item.value"
- :item="item"
- v-bind="props"
- ></textUI>
- </template>
- <industryTypeCard :select="query.industryIdList" :currentData="currentSelect" showSelect @handleClickIndustry="handleIndustry"></industryTypeCard>
- </v-menu>
- </template>
- <!-- <template #workAreaId_old="{ item }">
- <v-menu :close-delay="1" :open-delay="0" v-bind="$attrs">
- <template v-slot:activator="{ props }">
- <textUI
- v-model="item.value"
- :item="item"
- v-bind="props"
- style="position: relative;"
- ></textUI>
- </template>
- <areaType :select="[query.workAreaId_old].filter(Boolean)" @handleAreaClick="handleArea" class="jobTypeCardBox" isSingle></areaType>
- </v-menu>
- </template> -->
- </CtForm>
- <div class="text-end">
- <v-btn class="half-button mr-3" variant="tonal" @click="isAdd = false; resetForm()">{{ $t('common.cancel') }}</v-btn>
- <v-btn color="primary" class="half-button" @click="handleSave">{{ $t('common.save') }}</v-btn>
- </div>
- </div>
- </div>
- </template>
- <script setup name="jobIntention">
- import { ref, reactive } from 'vue'
- import CtForm from '@/components/CtForm'
- import textUI from '@/components/FormUI/TextInput'
- import jobTypeCard from '@/components/jobTypeCard'
- import industryTypeCard from '@/components/industryTypeCard'
- // import areaType from '@/components/AreaSelect'
- import Snackbar from '@/plugins/snackbar'
- import Confirm from '@/plugins/confirm'
- import { saveResumeJobInterested, getResumeJobInterested, deleteResumeJobInterested } from '@/api/recruit/personal/resume'
- import { dealJobData } from './dict'
- import { getDict } from '@/hooks/web/useDictionaries'
- import { cityToProvince } from '@/utils/areaDeal'
- const isAdd = ref(false)
- const formPageRef = ref()
- const editId = ref(null)
- let query = reactive({})
- const items = ref({
- options: [
- {
- slotName: 'positionId',
- key: 'positionId',
- value: '',
- col: 6,
- label: '期望岗位 *',
- flexStyle: 'mr-3',
- valueKey: 'position',
- hideDetails: true,
- outlined: true,
- rules: [v => !!v || '请选择期望岗位']
- },
- {
- slotName: 'industryIdList',
- key: 'industryIdList',
- value: '',
- outlined: true,
- label: '期望行业 *',
- col: 6,
- rules: [v => !!v || '请选择期望行业']
- },
- {
- type: 'number',
- key: 'payFrom',
- value: null,
- label: '期望薪资(最低要求) *',
- col: 6,
- flexStyle: 'mr-3',
- outlined: true,
- rules: [v => !!v || '请输入薪资最低要求']
- },
- {
- type: 'number',
- key: 'payTo',
- value: null,
- label: '期望薪资(最高要求) *',
- col: 6,
- outlined: true,
- rules: [v => !!v || '请输入薪资最高要求']
- },
- // {
- // slotName: 'workAreaId_old',
- // key: 'workAreaId_old',
- // value: null,
- // label: '工作城市 *',
- // valueKey: 'workArea',
- // col: 6,
- // flexStyle: 'mr-3',
- // rules: [v => !!v || '请选择工作城市']
- // },
- // {
- // type: 'nestedListGroup',
- // key: 'workAreaId',
- // value: null,
- // label: '工作城市 *',
- // itemText: 'name',
- // itemValue: 'id',
- // col: 6,
- // flexStyle: 'mr-3',
- // selectLevel: 2,
- // items: [],
- // rules: [v => !!v || '请选择工作城市'],
- // },
- {
- type: 'autocomplete',
- key: 'workAreaProvinceId',
- value: null,
- label: '工作城市:省 *',
- outlined: true,
- itemText: 'name',
- itemValue: 'id',
- returnSelect: true,
- col: 6,
- flexStyle: 'mr-3',
- rules: [v => !!v || '请选择工作城市:省'],
- items: [],
- change: null
- },
- {
- type: 'autocomplete',
- key: 'workAreaId',
- value: null,
- label: '工作城市:市 *',
- outlined: true,
- itemText: 'name',
- itemValue: 'id',
- col: 6,
- rules: [v => !!v || '请选择工作城市:市'],
- items: [],
- change: null
- },
- {
- type: 'autocomplete',
- key: 'jobType',
- value: null,
- label: '求职类型 *',
- outlined: true,
- itemText: 'label',
- col: 12,
- itemValue: 'value',
- rules: [v => !!v || '请选择求职类型'],
- items: [
- { label: '全职', value: '0' },
- { label: '兼职', value: '1' },
- { label: '临时', value: '2' },
- { label: '实习', value: '3' }
- ]
- }
- ]
- })
- // items.value.options.forEach((e, index) => { if (index%2 === 0 && !e.flexStyle) { e.flexStyle = 'mr-3' } }) //
- const provinceChange = (value, val, obj) => {
- const item = items.value.options.find(e => e.key === 'workAreaId')
- if (!item) return
- item.items = obj.children || []
- item.value = null
- }
- getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
- data = data?.length && data || []
- if (!data?.length) return console.error('areaTreeData获取失败!')
- //
- const china = data.find(e => e.id === '1')
- const chinaTreeData = china?.children?.length ? china.children : []
- //
- if (!chinaTreeData?.length) return console.error('chinaTreeData获取失败!')
- const item = items.value.options.find(e => e.key === 'workAreaProvinceId')
- if (item?.items) {
- item.items = chinaTreeData
- item.change = provinceChange
- }
- })
- // 获取求职意向
- const interestList = ref([])
- const getJobInterested = async () => {
- const data = await getResumeJobInterested()
- if (!data.length) return
- interestList.value = data
- interestList.value = dealJobData(data)
- }
- getJobInterested()
- const setValue = (key, value) => {
- items.value.options.find(e => e.key === key).value = value
- }
- // 期望职位
- const handleJobClickItem = (list, name) => {
- if (!list.length) return
- query.positionId = list[0]
- setValue('positionId', name)
- }
- // 行业类型
- let currentSelect = reactive([])
- const handleIndustry = (list, arr) => {
- if (!list.length) return setValue('industryIdList', '')
- query.industryIdList = list
- currentSelect = arr
- const str = arr.map(e => e.nameCn).join('、')
- setValue('industryIdList', str)
- }
- // // 工作城市
- // const handleArea = (list, name) => {
- // if (!list.length) return
- // query.workAreaId_old = list[0]
- // setValue('workAreaId_old', name)
- // }
- const resetForm = () => {
- items.value.options.forEach(e => {
- if (e.key === 'industryIdList') e.value = ''
- else e.value = null
- })
- editId.value = null
- query = {}
- currentSelect = []
- }
- const arr = ['payFrom', 'payTo', 'jobType', 'workAreaId']
- const handleSave = async () => {
- const { valid } = await formPageRef.value.formRef.validate()
- if (!valid) return
- items.value.options.forEach(e => {
- if (arr.includes(e.key)) query[e.key] = e.value
- })
- if (editId.value) query.id = editId.value
- await saveResumeJobInterested(query)
- Snackbar.success('保存成功')
- isAdd.value = false
- resetForm()
- getJobInterested()
- }
- const handleEdit = async (item) => {
- editId.value = item.id
- let workAreaId = ''
- items.value.options.forEach(e => {
- query[e.key] = item[e.key]
- if (e.valueKey) {
- e.value = item[e.valueKey]
- } else e.value = item[e.key]
- if (e.key === 'industryIdList') e.value = item.industry.map(e => e.nameCn).join('、')
- if (e.key === 'workAreaId' && item[e.key]) workAreaId = item[e.key]
- })
- if (workAreaId) { // 省份回显
- const province = items.value.options.find(pv => pv.key === 'workAreaProvinceId')
- if (province) {
- const dealReturnObj = await cityToProvince(workAreaId, {}, province.items || [])
- const city = items.value.options.find(pv => pv.key === 'workAreaId')
- if (city) city.items = dealReturnObj.cityList || []
- province.value = dealReturnObj.pid || ''
- }
- }
- currentSelect = item.industry
- isAdd.value = true
- }
- const handleDelete = ({ id }) => {
- Confirm('系统提示', '是否确认删除此项求职意向?').then(async () => {
- await deleteResumeJobInterested(id)
- Snackbar.success('删除成功!')
- getJobInterested()
- })
- }
- </script>
- <style scoped lang="scss">
- .jobTypeCardBox {
- position: absolute;
- top: -22px;
- left: 0;
- }
- .position-item {
- display: flex;
- justify-content: space-between;
- cursor: pointer;
- border-radius: 6px;
- line-height: 40px;
- font-size: 15px;
- &:hover {
- background-color: var(--color-f8);
- }
- span {
- font-size: 15px;
- }
- .grey-text {
- color: var(--color-999);
- }
- }
- .text-box {
- max-width: 200px;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- .line {
- color: #e0e0e0;
- margin: 0 10px;
- }
- </style>
|