Kaynağa Gözat

薪资面议

lifanagju_citu 1 ay önce
ebeveyn
işleme
4a0782567b

+ 8 - 36
components/positionItem/components/requirement.vue

@@ -20,7 +20,7 @@
       <uni-forms-item label="最高薪资" name="payTo" :required="salary?.length === 0" label-width="90px">
         <uni-number-box v-model="formData.payTo" :disabled="salary?.length > 0" :min="payToMin" :max="999999999" :step="salaryStep" :width="100"></uni-number-box>
 			</uni-forms-item>
-			<uni-forms-item v-if="!salary?.length" label="计薪时段" name="payUnit">
+			<uni-forms-item v-if="!salary?.length" label="计薪时段" name="payUnit" required>
 				<uni-data-picker popup-title="请选择计薪时段" v-model="formData.payUnit" placeholder="请选择" :localdata="dictObj?.payUnit || []" :clear-icon="false" :map="{ text: 'label', value: 'value'}"></uni-data-picker>
 			</uni-forms-item>
       <uni-forms-item label="工作城市" name="areaId" required label-width="90px">
@@ -54,7 +54,7 @@
 	</view>
 </template>
 <script setup>
-import { ref, unref, watch } from 'vue'
+import { ref, unref } from 'vue'
 import { dictObj } from '@/utils/position.js'
 import { getEnterprisePubJobTypePermission } from '@/api/new/position'
 import portrait from './portrait.vue'
@@ -78,20 +78,6 @@ const formData = ref({
 })
 const tagList = ref(props.data?.tagList?.length ? props.data.tagList : [])
 
-watch(
-  () => props.data, 
-  (newVal) => {
-    salary.value = newVal?.payUnit === null ? [1] : []
-    if (!salary.value?.length) {
-      formData.value.payFrom = null
-      formData.value.payTo = null
-      formData.value.payUnit = null
-    }
-  },
-  { immediate: true },
-  { deep: true }
-)
-
 // const salaryDisabled = computed(() => {
 //   return Boolean(salary?.value.length)
 // })
@@ -123,11 +109,9 @@ const rules = {
   // 薪资
 	payFrom: {
 		rules: [
+      // { required: true, errorMessage: '请填写最低薪资' },
       {
         validateFunction: function (rule, value, data, callback) {
-          if (salary?.value.length) {
-            callback('请填写最低薪资')
-          }
           if (value < 1) {
             callback('数额不得小于1')
           }
@@ -147,11 +131,9 @@ const rules = {
 	},
 	payTo: {
 		rules: [
+      // { required: true, errorMessage: '请填写最高薪资' },
       {
         validateFunction: function (rule, value, data, callback) {
-          if (salary?.value.length) {
-            callback('请填写最高薪资')
-          }
           if (value < 1) {
             callback('数额不得小于1')
           }
@@ -170,18 +152,7 @@ const rules = {
     ]
 	},
 	payUnit: {
-		// rules: [{required: true, errorMessage: '请选择计薪时段' }]
-		rules: [
-      {
-        validateFunction: function (rule, value, data, callback) {
-          if (salary?.value.length) {
-            callback('请选择计薪时段')
-          }
-          return true
-        }
-      }
-      
-    ]
+		rules: [{required: true, errorMessage: '请选择计薪时段' }]
 	}
 }
 // const salaryRules = {}
@@ -198,7 +169,7 @@ const salaryStep = 1000
 const payToMin = ref(0)
 const payChange = (val) => {
   payToMin.value = val
-  // if (val > formData.value.payTo) formData.value.payTo = val + salaryStep
+  if (val > formData.value.payTo) formData.value.payTo = val + salaryStep
 }
 
 const portraitRef = ref()
@@ -215,7 +186,8 @@ const typeChange = (e) => {
 }
 
 const form = ref()
-const salary = ref(props.data?.payUnit === null ? [1] : [])
+// const salary = ref([])
+const salary = ref((props.data?.payFrom === null &&props.data?.payTo === null) ? [1] : [])
 const getQuery = async () => {
   const valid = await unref(form).validate()
   if (!valid) return