|
|
@@ -47,10 +47,10 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="薪资" prop="salaryMin">
|
|
|
<div class="inline-mixed-field input-unit-field salary-range-field">
|
|
|
- <el-input v-model="form.salaryMin" placeholder="最低薪资" maxlength="10" />
|
|
|
+ <el-input v-model="form.salaryMin" placeholder="最低薪资" maxlength="10" @input="(v: string) => (form.salaryMin = v.replace(/[^0-9.]/g, '').replace(/\.{2,}/g, '.').replace(/^(\d*\.)(.*)\.(.*)$/, '$1$2'))" />
|
|
|
<span class="field-unit">k</span>
|
|
|
<span class="salary-range-separator">-</span>
|
|
|
- <el-input v-model="form.salaryMax" placeholder="最高薪资" maxlength="10" />
|
|
|
+ <el-input v-model="form.salaryMax" placeholder="最高薪资" maxlength="10" @input="(v: string) => (form.salaryMax = v.replace(/[^0-9.]/g, '').replace(/\.{2,}/g, '.').replace(/^(\d*\.)(.*)\.(.*)$/, '$1$2'))" />
|
|
|
<span class="field-unit">k</span>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
@@ -102,7 +102,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="性别" prop="genderRequirement">
|
|
|
<el-select v-model="form.genderRequirement" placeholder="请选择性别" clearable>
|
|
|
- <el-option v-for="item in genderOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ <el-option v-for="item in genderOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="年级" prop="gradeRequirement">
|
|
|
@@ -183,9 +183,9 @@ import { useRoute, useRouter } from 'vue-router';
|
|
|
import { regionData, codeToText } from 'element-china-area-data';
|
|
|
import type { CascaderOption } from 'element-plus';
|
|
|
import PageShell from '@/components/PageShell/index.vue';
|
|
|
-import { addPostManage, getPostManage, updatePostManage } from '@/api/main/postManage';
|
|
|
+import { addPostManage, checkPostCode, getPostManage, updatePostManage } from '@/api/main/postManage';
|
|
|
import type { MainPostApplyVO } from '@/api/main/postManage/types';
|
|
|
-import { getDicts } from '@/api/system/dict/data';
|
|
|
+import { getDictsFresh } from '@/api/system/dict/data';
|
|
|
import { listIndustryOpen, listIndustrySkillOpen } from '@/api/system/industry';
|
|
|
import type { IndustrySkillVO, IndustryVO } from '@/api/system/industry/types';
|
|
|
import { listTag } from '@/api/system/tag';
|
|
|
@@ -249,11 +249,7 @@ const schoolRequirementOptions = ref<DictDataVO[]>([]);
|
|
|
const gradeOptions = ref<DictDataVO[]>([]);
|
|
|
const arrivalTimeOptions = ref<DictDataVO[]>([]);
|
|
|
const internshipDurationOptions = ref<DictDataVO[]>([]);
|
|
|
-const genderOptions = [
|
|
|
- { label: '不限', value: '2' },
|
|
|
- { label: '男', value: '0' },
|
|
|
- { label: '女', value: '1' }
|
|
|
-];
|
|
|
+const genderOptions = ref<DictDataVO[]>([]);
|
|
|
|
|
|
const form = reactive<PostCreateFormModel>({
|
|
|
id: undefined,
|
|
|
@@ -315,6 +311,23 @@ const validatePassingScores = (rule: any, value: any, callback: any) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const validatePostCode = async (rule: any, value: any, callback: any) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('岗位编码不能为空'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await checkPostCode(value, form.id);
|
|
|
+ if (!res.data) {
|
|
|
+ callback(new Error('岗位编码已存在'));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const rules = reactive<any>({
|
|
|
postNamePath: [{ required: true, message: '岗位名称不能为空', trigger: 'change' }],
|
|
|
regionCodes: [{ required: true, message: '地区不能为空', trigger: 'change' }],
|
|
|
@@ -322,7 +335,7 @@ const rules = reactive<any>({
|
|
|
jobType: [{ required: true, message: '岗位类型不能为空', trigger: 'change' }],
|
|
|
salaryMin: [{ required: true, message: '最低薪资不能为空', trigger: 'blur' }],
|
|
|
salaryMax: [{ required: true, message: '最高薪资不能为空', trigger: 'blur' }],
|
|
|
- postCode: [{ required: true, message: '岗位编码不能为空', trigger: 'blur' }],
|
|
|
+ postCode: [{ required: true, validator: validatePostCode, trigger: 'blur' }],
|
|
|
postCategory: [{ required: true, message: '岗位级别不能为空', trigger: 'change' }],
|
|
|
evaluationDuration: [{ required: true, message: '测评时长不能为空', trigger: 'blur' }],
|
|
|
postSort: [{ required: true, message: '岗位顺序不能为空', trigger: 'blur' }],
|
|
|
@@ -475,35 +488,40 @@ const loadPostNameOptions = async () => {
|
|
|
};
|
|
|
|
|
|
const loadJobTypeOptions = async () => {
|
|
|
- const res = await getDicts('main_position_type');
|
|
|
+ const res = await getDictsFresh('main_position_type');
|
|
|
jobTypeOptions.value = res.data || [];
|
|
|
};
|
|
|
|
|
|
const loadPostLevelOptions = async () => {
|
|
|
- const res = await getDicts('main_position_level');
|
|
|
+ const res = await getDictsFresh('main_position_level');
|
|
|
postLevelOptions.value = res.data || [];
|
|
|
};
|
|
|
|
|
|
const loadSchoolRequirementOptions = async () => {
|
|
|
- const res = await getDicts('main_education');
|
|
|
+ const res = await getDictsFresh('main_education');
|
|
|
schoolRequirementOptions.value = res.data || [];
|
|
|
};
|
|
|
|
|
|
const loadGradeOptions = async () => {
|
|
|
- const res = await getDicts('main_experience');
|
|
|
+ const res = await getDictsFresh('main_experience');
|
|
|
gradeOptions.value = res.data || [];
|
|
|
};
|
|
|
|
|
|
const loadArrivalTimeOptions = async () => {
|
|
|
- const res = await getDicts('main_arrival_time');
|
|
|
+ const res = await getDictsFresh('main_arrival_time');
|
|
|
arrivalTimeOptions.value = res.data || [];
|
|
|
};
|
|
|
|
|
|
const loadInternshipDurationOptions = async () => {
|
|
|
- const res = await getDicts('main_internship_duration');
|
|
|
+ const res = await getDictsFresh('main_internship_duration');
|
|
|
internshipDurationOptions.value = res.data || [];
|
|
|
};
|
|
|
|
|
|
+const loadGenderOptions = async () => {
|
|
|
+ const res = await getDictsFresh('sys_user_sex');
|
|
|
+ genderOptions.value = res.data || [];
|
|
|
+};
|
|
|
+
|
|
|
const loadTagOptions = async () => {
|
|
|
const res = await listTag({
|
|
|
pageNum: 1,
|
|
|
@@ -668,7 +686,8 @@ onMounted(async () => {
|
|
|
loadGradeOptions(),
|
|
|
loadArrivalTimeOptions(),
|
|
|
loadInternshipDurationOptions(),
|
|
|
- loadTagOptions()
|
|
|
+ loadTagOptions(),
|
|
|
+ loadGenderOptions()
|
|
|
]);
|
|
|
await loadDetail();
|
|
|
});
|