Pārlūkot izejas kodu

双选会职位附加内容改为非必填

lifanagju_citu 6 mēneši atpakaļ
vecāks
revīzija
e78045de50
1 mainītis faili ar 14 papildinājumiem un 11 dzēšanām
  1. 14 11
      src/views/recruit/enterprise/jobFair/editJob.vue

+ 14 - 11
src/views/recruit/enterprise/jobFair/editJob.vue

@@ -41,18 +41,18 @@ const items = ref({
       type: 'text',
       key: 'dept',
       value: null,
-      label: '招聘部门 *',
-      rules: [v => !!v || '请选择招聘部门']
+      label: '招聘部门 ',
+      // rules: [v => !!v || '请选择招聘部门']
     },
     {
       type: 'autocomplete',
       key: 'majorId',
       search: getMajorList,
       value: null,
-      label: '专业要求 *',
+      label: '专业要求 ',
       itemText: 'nameCn',
       itemValue: 'id',
-      rules: [v => !!v || '专业要求'],
+      // rules: [v => !!v || '专业要求'],
       noDataText: '请输入检索专业',
       items: []
     },
@@ -60,9 +60,9 @@ const items = ref({
       type: 'autocomplete',
       key: 'frequency-dateType',
       value: null,
-      label: '工作频率 *',
+      label: '工作频率 ',
       col: 6,
-      rules: [v => !!v || '请选择工作频率'],
+      // rules: [v => !!v || '请选择工作频率'],
       items: [
         { label: '每周', value: 'week' },
         { label: '每月', value: 'month' },
@@ -75,19 +75,19 @@ const items = ref({
       value: null,
       flexStyle: 'ml-3',
       col: 6,
-      label: '出勤天数 *',
-      rules: [v => v > 0 || '请填写正确的出勤天数']
+      label: '出勤天数 ',
+      // rules: [v => v > 0 || '请填写正确的出勤天数']
     },
     {
       type: 'ifRadio',
       key: 'hot',
       value: 1,
-      label: '热门职位 *',
+      label: '热门职位 ',
       items: [
         { label: '是', value: 1 },
         { label: '否', value: 0 },
       ],
-      rules: [v => !!v || '请选择是否热门']
+      // rules: [v => !!v || '请选择是否热门']
     },
   ]
 })
@@ -100,6 +100,7 @@ if (route.query.id) {
 
 async function initPosition (jobId) {
   const res = await getJobAdvertisedExtend(jobId)
+  if (!res) return
   items.value.options.forEach(e => {
     if (e.key.includes('frequency') && res.frequency) {
       const keys = e.key.split('-')
@@ -122,6 +123,7 @@ async function getMajorList (name) {
 }
 
 async function getMajorById (id) {
+  if (!id) return
   const res = await schoolMajorById({ id })
   items.value.options.find(e => e.key === 'majorId').items = [res]
 }
@@ -142,7 +144,7 @@ const afterAdd = async (jobId) => {
         return r
       }
       if (v.key === 'majorId') {
-        r.major = v.items.find(e => e.id === v.value).nameCn
+        r.major = v.items.find(e => e.id === v.value)?.nameCn || ''
       }
       r[v.key] = v.type === 'number' ? +v.value : v.value
       return r
@@ -157,6 +159,7 @@ const afterAdd = async (jobId) => {
     router.push(`/recruit/enterprise/jobFair/details/${route.params.id}`)
   } catch (error) {
     console.log(error)
+    console.error(error)
     Snackbar.error(t('sys.api.operationFailed'))
   }
 }