|
@@ -11,13 +11,13 @@
|
|
|
<div>
|
|
|
<h2 class="mt-n1 headline font-weight-regular">{{ val.title }}</h2>
|
|
|
<div class="mb-4 desc">{{ val.desc }}</div>
|
|
|
- <component class="mt-10" :is="val.path" :ref="val.ref"></component>
|
|
|
+ <component class="mt-10" :is="val.path" :ref="val.ref" :itemData="itemData"></component>
|
|
|
</div>
|
|
|
</v-timeline-item>
|
|
|
</v-timeline>
|
|
|
<div class="text-center mb">
|
|
|
- <v-btn class="half-button mr-3" color="primary" variant="outlined" @click="handleCancel">取 消</v-btn>
|
|
|
- <v-btn class="half-button" color="primary" @click="handleSave">发 布</v-btn>
|
|
|
+ <v-btn class="half-button mr-3" color="primary" variant="outlined" @click="handleCancel">{{ $t('common.cancel') }}</v-btn>
|
|
|
+ <v-btn class="half-button" color="primary" @click="handleSave">{{ $t('common.release') }}</v-btn>
|
|
|
</div>
|
|
|
</v-card>
|
|
|
</div>
|
|
@@ -26,29 +26,34 @@
|
|
|
<script setup>
|
|
|
defineOptions({ name: 'enterprise-position-add'})
|
|
|
import { ref } from 'vue'
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
-import { saveJobAdvertised } from '@/api/position'
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
|
+import { dealDictArrayData } from '@/views/recruit/position/components/dict'
|
|
|
+import { saveJobAdvertised, getJobAdvertisedList } from '@/api/position'
|
|
|
import baseInfo from './baseInfo.vue'
|
|
|
import jobRequirements from './jobRequirements.vue'
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
+import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
|
|
+const { t } = useI18n()
|
|
|
+const route = useRoute()
|
|
|
const router = useRouter()
|
|
|
const baseInfoRef = ref()
|
|
|
const jobRequirementsRef = ref()
|
|
|
+const itemData = ref({})
|
|
|
const list = [
|
|
|
{
|
|
|
color: '#00897B',
|
|
|
icon: 'mdi-numeric-1',
|
|
|
- title: '职位基本信息',
|
|
|
- desc: '职位发布成功后,招聘类型、职位名称、职位类型、工作城市,将无法修改',
|
|
|
+ title: t('position.positionInformation'),
|
|
|
+ desc: '',
|
|
|
path: baseInfo,
|
|
|
ref: baseInfoRef
|
|
|
},
|
|
|
{
|
|
|
color: 'indigo-lighten-2',
|
|
|
icon: 'mdi-numeric-2',
|
|
|
- title: '职位要求',
|
|
|
- desc: '我们将通过以下条件,为您精确推荐合适的人才,请尽量详细填写',
|
|
|
+ title: t('position.jobRequirements'),
|
|
|
+ desc: t('position.requirementDesc'),
|
|
|
path: jobRequirements,
|
|
|
ref: jobRequirementsRef
|
|
|
}
|
|
@@ -56,6 +61,7 @@ const list = [
|
|
|
|
|
|
// 取消
|
|
|
const handleCancel = () => {
|
|
|
+ itemData.value = {}
|
|
|
router.push('/enterprise/position')
|
|
|
}
|
|
|
|
|
@@ -65,9 +71,24 @@ const handleSave = async () => {
|
|
|
const requirement = await jobRequirementsRef.value[0].getQuery()
|
|
|
if (!baseInfo || !requirement) return Snackbar.warning('请将信息填写完整')
|
|
|
const query = Object.assign(baseInfo, requirement)
|
|
|
+// 有id则为编辑
|
|
|
+ if (route.query && route.query.id) query.id = route.query.id
|
|
|
await saveJobAdvertised(query)
|
|
|
- Snackbar.success('发布成功')
|
|
|
- router.push('/enterprise/position')
|
|
|
+ Snackbar.success(route.query.id ? t('common.editSuccessMsg') : t('common.publishSuccessMsg'))
|
|
|
+ handleCancel()
|
|
|
+}
|
|
|
+
|
|
|
+// 获取编辑的职位详情
|
|
|
+const getPositionDetail = async (id) => {
|
|
|
+ const { list } = await getJobAdvertisedList({ pageSize: 1, pageNo: 1, id })
|
|
|
+ if (!list.length) return
|
|
|
+ const arr = dealDictArrayData([], list)
|
|
|
+ itemData.value = arr[0]
|
|
|
+}
|
|
|
+
|
|
|
+// 有id为编辑
|
|
|
+if (route.query && route.query.id) {
|
|
|
+ if (route.query.id) getPositionDetail(route.query.id)
|
|
|
}
|
|
|
</script>
|
|
|
|