فهرست منبع

添加长期有效

lifanagju_citu 7 ماه پیش
والد
کامیت
e4648e7018

+ 1 - 1
src/views/recruit/enterprise/positionManagement/components/add.vue

@@ -70,7 +70,7 @@ const handleSave = async () => {
   const baseInfo = await baseInfoRef.value[0].getQuery()
   if (baseInfo === 'failed') return
   const requirement = await jobRequirementsRef.value[0].getQuery()
-  if (!baseInfo.expireTime) {
+  if (!baseInfo.expireTime && !baseInfo.soFar) {
     Snackbar.warning('请选择职位过期时间')
     window.scrollTo({ top: 0, behavior: 'smooth' })
     return

+ 36 - 3
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -15,6 +15,21 @@
         </v-menu>
         <v-btn v-if="showTemplateBtn" class="ml-3 half-button" color="primary" style="margin-top: 2px;" @click="useJobTemplate(item)">职位模板</v-btn>
       </template>
+      <template #expireTime="{ item }">
+        <div>
+          <v-checkbox-btn
+            v-model="soFar"
+            color="primary"
+            label="长期有效"
+            class="ml-2"
+            :disabled="false"
+            :style="`line-height: ${item.dense === 'default' ? 56 : item.dense === 'comfortable' ? 48 : 40 }px;`"
+            style="width: 110px;"
+            hide-details
+            @update:modelValue="v => handleSoFarChange(v, item)"
+          ></v-checkbox-btn>
+        </div>
+      </template>
     </CtForm>
   </div>
 </template>
@@ -69,7 +84,8 @@ const items = ref({
       value: null,
       format: 'YYYY-MM-DD',
       label: '到期时间 *',
-      labelWidth: 120
+      labelWidth: 120,
+      slotName: 'expireTime',
     },
     {
       type: 'wangEditor',
@@ -102,6 +118,7 @@ watch(
         return
       }
       if (e.noParam) return
+      if (e.key === 'expireTime' && !val[e.key]) return handleSoFarChange(true, e)
       e.value = val[e.key]
     })
   },
@@ -148,15 +165,25 @@ const useJobTemplate = async () => {
   }
 }
 
+const soFar = ref(false)
+// 长期有效
+const handleSoFarChange = (bool, item) => {
+  soFar.value = bool
+  item.value = null
+  item.disabled = bool ? true : false
+  item.label = bool ? '到期时间' : '到期时间 *'
+}
+
 const getQuery = async () => {
   const { valid } = await formPageRef.value.formRef.validate()
   if (!valid) return
   const obj = {
     hirePrice: 0,
+    soFar: soFar.value,
     hire: false
   }
   items.value.options.forEach(e => {
-    if (e.noParam) return
+    if (e.noParam || e.value === null) return
     else obj[e.key] = e.value
   })
   if (!obj.content) {
@@ -167,8 +194,14 @@ const getQuery = async () => {
     Snackbar.warning('请填写岗位要求')
     return 'failed'
   }
+
+  if (!obj.expireTime && !soFar.value) {
+    Snackbar.warning('请填写到期时间')
+    return 'failed'
+  }
   
-  query = Object.assign(query, obj)
+  // query = Object.assign(query, obj)
+  query = {...obj, ...query}
   return query
 }