|
@@ -31,7 +31,7 @@
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :span="22" style="text-align: right;">
|
|
<a-col :span="22" style="text-align: right;">
|
|
<Space>
|
|
<Space>
|
|
- <a-button @click="addPost">
|
|
|
|
|
|
+ <a-button @click="addPost" v-if="!isEdit">
|
|
<template #icon>
|
|
<template #icon>
|
|
<plus-circle-outlined/>
|
|
<plus-circle-outlined/>
|
|
</template>
|
|
</template>
|
|
@@ -129,7 +129,7 @@
|
|
</a-col>
|
|
</a-col>
|
|
<a-col flex="400px">
|
|
<a-col flex="400px">
|
|
<a-form-item
|
|
<a-form-item
|
|
- label="是否试用期"
|
|
|
|
|
|
+ label="是否有试用期"
|
|
:label-col="{ span: 9 }"
|
|
:label-col="{ span: 9 }"
|
|
name="isTrail"
|
|
name="isTrail"
|
|
:rules="[{ required: false, message: '请选择是否试用期!' }]"
|
|
:rules="[{ required: false, message: '请选择是否试用期!' }]"
|
|
@@ -145,7 +145,7 @@
|
|
</a-col>
|
|
</a-col>
|
|
<a-col flex="400px" :offset="1">
|
|
<a-col flex="400px" :offset="1">
|
|
<a-form-item
|
|
<a-form-item
|
|
- label="试用期时长(月)"
|
|
|
|
|
|
+ label="试用期(月)"
|
|
:label-col="{ span: 9 }"
|
|
:label-col="{ span: 9 }"
|
|
name="trailtime"
|
|
name="trailtime"
|
|
:rules="[{ required: false, message: '请选择试用期时长!' }]"
|
|
:rules="[{ required: false, message: '请选择试用期时长!' }]"
|
|
@@ -158,7 +158,7 @@
|
|
<a-row>
|
|
<a-row>
|
|
<a-col flex="300px" style="margin-left: 3px;">
|
|
<a-col flex="300px" style="margin-left: 3px;">
|
|
<a-form-item
|
|
<a-form-item
|
|
- label="试用期(元)"
|
|
|
|
|
|
+ label="试用期月薪(元)"
|
|
name="trailMaxSalary"
|
|
name="trailMaxSalary"
|
|
:label-col="{span:9}"
|
|
:label-col="{span:9}"
|
|
:rules="[{ required: false, message: '请输入金额!' }]"
|
|
:rules="[{ required: false, message: '请输入金额!' }]"
|
|
@@ -178,7 +178,7 @@
|
|
</a-col>
|
|
</a-col>
|
|
<a-col flex="400px">
|
|
<a-col flex="400px">
|
|
<a-form-item
|
|
<a-form-item
|
|
- label="工作年限"
|
|
|
|
|
|
+ label="工作年限要求"
|
|
:label-col="{ span: 9 }"
|
|
:label-col="{ span: 9 }"
|
|
name="workYear"
|
|
name="workYear"
|
|
:rules="[{ required: false, message: '请选择工作年限!' }]"
|
|
:rules="[{ required: false, message: '请选择工作年限!' }]"
|
|
@@ -223,7 +223,7 @@
|
|
</a-form-item>
|
|
</a-form-item>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
- <a-row>
|
|
|
|
|
|
+ <a-row v-if="!isEdit">
|
|
<a-col style="text-align: right;" span="23">
|
|
<a-col style="text-align: right;" span="23">
|
|
<a-button type="danger" @click="delPostItem(index)">删除</a-button>
|
|
<a-button type="danger" @click="delPostItem(index)">删除</a-button>
|
|
</a-col>
|
|
</a-col>
|
|
@@ -242,8 +242,9 @@
|
|
import {defineComponent, reactive, ref} from 'vue';
|
|
import {defineComponent, reactive, ref} from 'vue';
|
|
import {useRouter} from 'vue-router';
|
|
import {useRouter} from 'vue-router';
|
|
// import {save, getPostByID,savePostList} from '@/api/companyService/post'
|
|
// import {save, getPostByID,savePostList} from '@/api/companyService/post'
|
|
-import {savePostList} from '@/api/companyService/post'
|
|
|
|
|
|
+import {savePostList, getPostByID} from '@/api/companyService/post'
|
|
import type {SelectProps} from 'ant-design-vue';
|
|
import type {SelectProps} from 'ant-design-vue';
|
|
|
|
+import {message} from 'ant-design-vue';
|
|
import {useTabsViewStore} from '@/store/modules/tabsView';
|
|
import {useTabsViewStore} from '@/store/modules/tabsView';
|
|
import BUploadFile from '@/components/file/uploadFile.vue';
|
|
import BUploadFile from '@/components/file/uploadFile.vue';
|
|
import {get} from '@/api/common';
|
|
import {get} from '@/api/common';
|
|
@@ -277,17 +278,17 @@ export default defineComponent(
|
|
name: 'PostEdit',
|
|
name: 'PostEdit',
|
|
components: {BUploadFile},
|
|
components: {BUploadFile},
|
|
setup() {
|
|
setup() {
|
|
- const postCompany=reactive<companyModel>({companyId:null});//关联企业信息
|
|
|
|
|
|
+ const postCompany = reactive<companyModel>({companyId: null});//关联企业信息
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const fullpath = router.currentRoute.value.fullPath;
|
|
const fullpath = router.currentRoute.value.fullPath;
|
|
const tabsViewStore = useTabsViewStore();
|
|
const tabsViewStore = useTabsViewStore();
|
|
|
|
+ const isEdit = ref(false);
|
|
|
|
|
|
const cultureLevelList = ref<SelectProps['options']>();
|
|
const cultureLevelList = ref<SelectProps['options']>();
|
|
const WorkYearTypelList = ref<SelectProps['options']>();
|
|
const WorkYearTypelList = ref<SelectProps['options']>();
|
|
const companyList = ref<SelectProps['options']>();
|
|
const companyList = ref<SelectProps['options']>();
|
|
const postStatusList = [{name: '启用', value: 1}, {name: '停用', value: 0}];
|
|
const postStatusList = [{name: '启用', value: 1}, {name: '停用', value: 0}];
|
|
const trialStatusList = [{name: '是', value: true}, {name: '否', value: false}];
|
|
const trialStatusList = [{name: '是', value: true}, {name: '否', value: false}];
|
|
-
|
|
|
|
const postDataList = ref<postModel[]>([]);
|
|
const postDataList = ref<postModel[]>([]);
|
|
const addPost = () => {
|
|
const addPost = () => {
|
|
(postDataList.value as any[]).push({
|
|
(postDataList.value as any[]).push({
|
|
@@ -338,6 +339,12 @@ export default defineComponent(
|
|
item.companyID = postCompany.companyId + "";
|
|
item.companyID = postCompany.companyId + "";
|
|
item.recordStatus = 1;
|
|
item.recordStatus = 1;
|
|
})
|
|
})
|
|
|
|
+ //判断重复-根据岗位名称、工作年限、学历要求、岗位薪资、试用期薪资
|
|
|
|
+ const isRepetition = hasDuplicates(postDataList.value, compareFunction);
|
|
|
|
+ if (isRepetition) {
|
|
|
|
+ message.warning('岗位信息存在重复!');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
savePostList(postDataList.value).then((result) => {
|
|
savePostList(postDataList.value).then((result) => {
|
|
if (result) {
|
|
if (result) {
|
|
tabsViewStore.closeCurrentTab(fullpath);
|
|
tabsViewStore.closeCurrentTab(fullpath);
|
|
@@ -346,15 +353,34 @@ export default defineComponent(
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- // const loadData = (id: any) => {
|
|
|
|
- // getPostByID(id).then(result => {
|
|
|
|
- // formState.dataModel = result;
|
|
|
|
- // })
|
|
|
|
- // };
|
|
|
|
|
|
+ const hasDuplicates = (arr, compareFn) => {
|
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
|
+ for (let j = i + 1; j < arr.length; j++) {
|
|
|
|
+ if (compareFn(arr[i], arr[j])) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const compareFunction = (obj1, obj2) => obj1.postName === obj2.postName && obj1.workYear === obj2.workYear
|
|
|
|
+ && obj1.maxSalary === obj2.maxSalary && obj1.minSalary === obj2.minSalary
|
|
|
|
+ && obj1.trailMaxSalary === obj2.trailMaxSalary && obj1.trailMinSalary === obj2.trailMinSalary
|
|
|
|
+ && obj1.cultureRank === obj2.cultureRank;
|
|
|
|
+
|
|
|
|
+ const loadData = (id: any) => {
|
|
|
|
+ getPostByID(id).then(result => {
|
|
|
|
+ // formState.dataModel = result;
|
|
|
|
+ console.log(result);
|
|
|
|
+ postCompany.companyId = (result as postModel).companyID;
|
|
|
|
+ (postDataList.value as any[]).push(result);
|
|
|
|
+ })
|
|
|
|
+ };
|
|
|
|
|
|
return {
|
|
return {
|
|
// ...toRefs(formState),
|
|
// ...toRefs(formState),
|
|
- // loadData,
|
|
|
|
|
|
+ loadData,
|
|
onClose,
|
|
onClose,
|
|
onFinish,
|
|
onFinish,
|
|
companyList,
|
|
companyList,
|
|
@@ -365,12 +391,14 @@ export default defineComponent(
|
|
addPost,
|
|
addPost,
|
|
WorkYearTypelList,
|
|
WorkYearTypelList,
|
|
delPostItem,
|
|
delPostItem,
|
|
- postCompany
|
|
|
|
|
|
+ postCompany,
|
|
|
|
+ isEdit
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- // const id = history.state.params?.id;
|
|
|
|
- // this.loadData(id);
|
|
|
|
|
|
+ const id = history.state.params?.id;
|
|
|
|
+ if (id) this.isEdit = true;
|
|
|
|
+ this.loadData(id);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|