|
@@ -69,17 +69,24 @@
|
|
|
<div class="form-title" >
|
|
|
其他信息
|
|
|
<div style="float: right;">
|
|
|
- <ion-icon :icon="chevronDownOutline" @click="isShow=!isShow" v-if="!isShow"
|
|
|
- style="font-size: 24px;"></ion-icon>
|
|
|
- <ion-icon :icon="chevronUpOutline" @click="isShow=!isShow" v-if="isShow"
|
|
|
- style="font-size: 24px;"></ion-icon>
|
|
|
+ <ion-label style="color: red;font-size: 14px;" @click="isShow=!isShow">{{isShow?"收起":"展开"}}</ion-label>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-show="isShow" >
|
|
|
+ <div class="form-select">
|
|
|
+ <ion-label>工作性质</ion-label>
|
|
|
+ <ion-select interface="action-sheet" placeholder="请选择工作性质" cancel-text="取消" name="workNatureID"
|
|
|
+ id="workNatureID" v-model="dataModel.workNatureID" style="width: 100%;text-align: left;" @ionChange="onIsTrailChange">
|
|
|
+ <ion-select-option v-for="(record,key) in workNatureList" :key="key"
|
|
|
+ v-model:value="record.value">
|
|
|
+ {{ record.name }}
|
|
|
+ </ion-select-option>
|
|
|
+ </ion-select>
|
|
|
+ </div>
|
|
|
<div class="form-input">
|
|
|
<ion-label>岗位月薪(元)</ion-label>
|
|
|
<div>
|
|
|
- <ion-input placeholder="请输入金额" label-placement="stacked" style="float:left;width:40%;"
|
|
|
+ <ion-input type="number" placeholder="请输入金额" label-placement="stacked" style="float:left;width:40%;"
|
|
|
v-model="dataModel.minSalary" class="custom">
|
|
|
</ion-input>
|
|
|
<ion-label style="float:left;width:5%;padding-top: 8px;">至</ion-label>
|
|
@@ -92,7 +99,7 @@
|
|
|
<div class="form-select">
|
|
|
<ion-label>是否有试用期</ion-label>
|
|
|
<ion-select interface="action-sheet" placeholder="请选择是否有试用期" cancel-text="取消"
|
|
|
- id="isTrail" v-model="dataModel.isTrail" style="width: 100%;text-align: left;">
|
|
|
+ id="isTrail" v-model="dataModel.isTrail" style="width: 100%;text-align: left;" @ionChange="onIsTrailChange">
|
|
|
<ion-select-option v-for="(record,key) in isTrailList" :key="key"
|
|
|
v-model:value="record.value">
|
|
|
{{ record.name }}
|
|
@@ -101,7 +108,7 @@
|
|
|
</div>
|
|
|
<div class="form-input">
|
|
|
<ion-label>试用期(月)</ion-label>
|
|
|
- <ion-input type="number" placeholder="请输入试用期月数" label-placement="stacked"
|
|
|
+ <ion-input :disabled="!dataModel.isTrail" type="number" placeholder="请输入试用期月数" label-placement="stacked"
|
|
|
v-model="dataModel.trailMonths" class="custom">
|
|
|
</ion-input>
|
|
|
</div>
|
|
@@ -138,6 +145,12 @@
|
|
|
</ion-select-option>
|
|
|
</ion-select>
|
|
|
</div>
|
|
|
+ <div class="form-input">
|
|
|
+ <ion-label>其他要求</ion-label>
|
|
|
+ <ion-textarea placeholder="请输入其他要求" :rows="3" label-placement="stacked"
|
|
|
+ v-model="dataModel.postDesc" class="custom" style="border-bottom: 1px solid #fff2e8;">
|
|
|
+ </ion-textarea>
|
|
|
+ </div>
|
|
|
<div class="form-input">
|
|
|
<ion-label>福利待遇</ion-label>
|
|
|
<ion-textarea placeholder="请输入福利待遇" :rows="3" label-placement="stacked"
|
|
@@ -145,10 +158,32 @@
|
|
|
</ion-textarea>
|
|
|
</div>
|
|
|
<div class="form-input">
|
|
|
- <ion-label>其他要求</ion-label>
|
|
|
- <ion-textarea placeholder="请输入其他要求" :rows="3" label-placement="stacked"
|
|
|
- v-model="dataModel.postDesc" class="custom" style="border-bottom: 1px solid #fff2e8;">
|
|
|
- </ion-textarea>
|
|
|
+ <ion-label>岗位联系人</ion-label>
|
|
|
+ <ion-input placeholder="请输入岗位联系人" label-placement="stacked"
|
|
|
+ v-model="dataModel.contactName" class="custom">
|
|
|
+ </ion-input>
|
|
|
+ </div>
|
|
|
+ <div class="form-input">
|
|
|
+ <ion-label>岗位联系电话</ion-label>
|
|
|
+ <ion-input placeholder="请输入岗位联系电话" label-placement="stacked"
|
|
|
+ v-model="dataModel.contactMobile" class="custom">
|
|
|
+ </ion-input>
|
|
|
+ </div>
|
|
|
+ <div class="form-input">
|
|
|
+ <ion-label>岗位联系人邮箱</ion-label>
|
|
|
+ <ion-input placeholder="请输入岗位联系人邮箱" label-placement="stacked"
|
|
|
+ v-model="dataModel.contactEmail" class="custom">
|
|
|
+ </ion-input>
|
|
|
+ </div>
|
|
|
+ <div class="form-select">
|
|
|
+ <ion-label>岗位标签</ion-label>
|
|
|
+ <ion-select interface="action-sheet" placeholder="请选择岗位标签" cancel-text="取消"
|
|
|
+ id="tagID" v-model="dataModel.tagID" style="width: 100%;text-align: left;">
|
|
|
+ <ion-select-option v-for="(record,key) in postTagList" :key="key"
|
|
|
+ v-model:value="record.value">
|
|
|
+ {{ record.name }}
|
|
|
+ </ion-select-option>
|
|
|
+ </ion-select>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -163,7 +198,7 @@
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import {computed, defineComponent, reactive, ref, toRefs, watch} from "vue";
|
|
|
-import {chevronDownOutline, chevronUpOutline, arrowBackOutline} from 'ionicons/icons';
|
|
|
+import {arrowBackOutline} from 'ionicons/icons';
|
|
|
import {useRoute, useRouter} from "vue-router";
|
|
|
import {alertController, onIonViewDidEnter} from "@ionic/vue";
|
|
|
import {useVuelidate} from "@vuelidate/core";
|
|
@@ -185,7 +220,6 @@ export default defineComponent({
|
|
|
const formState = reactive({
|
|
|
dataModel: {
|
|
|
companyID:null,
|
|
|
- postID:null,
|
|
|
professionName:null,
|
|
|
professionID:null,
|
|
|
postName:null,
|
|
@@ -196,13 +230,19 @@ export default defineComponent({
|
|
|
minSalary:null,
|
|
|
maxSalary:null,
|
|
|
isTrail:null,
|
|
|
- trailMonths:null,
|
|
|
+ trailMonths:0,
|
|
|
trailMinSalary:null,
|
|
|
trailMaxSalary:null,
|
|
|
workYear:null,
|
|
|
cultureRank:null,
|
|
|
welfare:null,
|
|
|
- postDesc:null
|
|
|
+ postDesc:null,
|
|
|
+ workNatureID:null,
|
|
|
+ contactName:null,
|
|
|
+ contactMobile:null,
|
|
|
+ contactEmail:null,
|
|
|
+ tagID:null,
|
|
|
+ bonus:null
|
|
|
}});
|
|
|
const rules = computed(() => {
|
|
|
return {
|
|
@@ -223,6 +263,8 @@ export default defineComponent({
|
|
|
]);
|
|
|
const workYearList = ref([]);
|
|
|
const cultureRankList = ref([]);
|
|
|
+ const workNatureList = ref([]);
|
|
|
+ const postTagList = ref([]);
|
|
|
|
|
|
const presentAlert = async (message: string) => {
|
|
|
const alert = await alertController.create({
|
|
@@ -239,18 +281,21 @@ export default defineComponent({
|
|
|
formState.dataModel.professionName = data.text;
|
|
|
}
|
|
|
const onSave = async function (){
|
|
|
- isCommit.value =true;
|
|
|
+ isCommit.value = true;
|
|
|
+ ifInputAllValid();
|
|
|
const isFormCorrect = await v$.value.$validate();
|
|
|
console.log("当前岗位信息",formState.dataModel);
|
|
|
if (!isFormCorrect) {
|
|
|
await presentAlert('请输入完整信息!');
|
|
|
return null;
|
|
|
}
|
|
|
- savePost(formState.dataModel).then(result=>{
|
|
|
- if(result){
|
|
|
- router.push({path: "./postList", query: {reload:1,id:formState.dataModel.companyID,status: 3}});
|
|
|
- }
|
|
|
- })
|
|
|
+ if(isCommit.value){
|
|
|
+ savePost(formState.dataModel).then(result=>{
|
|
|
+ if(result){
|
|
|
+ router.push({path: "./postList", query: {reload:1,id:formState.dataModel.companyID,status: 3}});
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const back = () => {
|
|
@@ -260,24 +305,117 @@ export default defineComponent({
|
|
|
const getWorkYearList = async function(){
|
|
|
const data :any = await getSysDictionaryList("WorkYearType");
|
|
|
workYearList.value = data;
|
|
|
- console.log(workYearList.value);
|
|
|
}
|
|
|
const getCultureRankList = async function(){
|
|
|
const data:any = await getSysDictionaryList("CultureLevel");
|
|
|
cultureRankList.value = data;
|
|
|
- console.log(cultureRankList.value);
|
|
|
+ }
|
|
|
+
|
|
|
+ const getWorkNationList = async function(){
|
|
|
+ const data:any = await getSysDictionaryList("WorkNature");
|
|
|
+ workNatureList.value = data;
|
|
|
+ }
|
|
|
+
|
|
|
+ const getPostTagList = async function(){
|
|
|
+ const data:any = await getSysDictionaryList("PostTag");
|
|
|
+ postTagList.value = data;
|
|
|
}
|
|
|
|
|
|
const loadData = async (postID: any,companyID:any) => {
|
|
|
isCommit.value =false;
|
|
|
await getWorkYearList();
|
|
|
await getCultureRankList();
|
|
|
+ await getWorkNationList();
|
|
|
+ await getPostTagList();
|
|
|
const reqData = await getPostByID(postID);
|
|
|
formState.dataModel = reqData;
|
|
|
formState.dataModel.companyID = companyID;
|
|
|
+ formState.dataModel.welfare = formState.dataModel.bonus;
|
|
|
console.log("初始化岗位信息",formState.dataModel);
|
|
|
};
|
|
|
|
|
|
+ const onIsTrailChange = ()=>{
|
|
|
+ if(!formState.dataModel.isTrail){
|
|
|
+ formState.dataModel.trailMonths = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const ifInputAllValid = ()=>{
|
|
|
+ let errorMessage = "";
|
|
|
+ let hasMinSalary = false;
|
|
|
+ let hasTrailMinSalary = false;
|
|
|
+ let curMinSalary = 0;
|
|
|
+ let curTrailMinSalary = 0;
|
|
|
+ if(dayjs(formState.dataModel.startTime).isAfter(dayjs(formState.dataModel.endTime))){
|
|
|
+ errorMessage +="招聘结束日期不能早于开始日期!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ if (formState.dataModel.minSalary!=null) {
|
|
|
+ hasMinSalary = true;
|
|
|
+ curMinSalary = formState.dataModel.minSalary;
|
|
|
+ if(formState.dataModel.minSalary<0){
|
|
|
+ errorMessage +="岗位最低月薪不能小于0!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (formState.dataModel.trailMinSalary!=null) {
|
|
|
+ hasTrailMinSalary = true;
|
|
|
+ curTrailMinSalary = formState.dataModel.trailMinSalary;
|
|
|
+ if(formState.dataModel.trailMinSalary<0){
|
|
|
+ errorMessage +="试用期最低月薪不能小于0!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (formState.dataModel.maxSalary!=null) {
|
|
|
+ if(formState.dataModel.maxSalary<0){
|
|
|
+ errorMessage +="岗位最高月薪不能小于0!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ if(hasMinSalary){
|
|
|
+ if(formState.dataModel.maxSalary < curMinSalary){
|
|
|
+ errorMessage +="岗位最高月薪不能小于岗位最低月薪!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (formState.dataModel.trailMaxSalary!=null) {
|
|
|
+ if(formState.dataModel.trailMaxSalary<0){
|
|
|
+ errorMessage +="试用期最高月薪不能小于0!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ if(hasTrailMinSalary){
|
|
|
+ if(formState.dataModel.trailMaxSalary < curTrailMinSalary){
|
|
|
+ errorMessage +="试用期最高月薪不能小于岗位最低月薪!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (formState.dataModel.trailMonths!=null) {
|
|
|
+ if(formState.dataModel.isTrail&&formState.dataModel.trailMonths<0){
|
|
|
+ errorMessage +="试用月数不能小于0!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const mobileReg = /^1[3|4|5|6|7|8|9]\d{9}$/;
|
|
|
+ const landlineReg = /[0-9-()()]{7,18}/;
|
|
|
+ if(formState.dataModel.contactMobile != null){
|
|
|
+ if(!mobileReg.test(formState.dataModel.contactMobile)&&!landlineReg.test(formState.dataModel.contactMobile)){
|
|
|
+ errorMessage += "输入的联系电话有误!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const emailReg = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
|
|
|
+ if(formState.dataModel.contactEmail!=""&&formState.dataModel.contactEmail!=null){
|
|
|
+ if(!emailReg.test(formState.dataModel.contactEmail)){
|
|
|
+ errorMessage += "输入的邮箱有误!";
|
|
|
+ isCommit.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!isCommit.value){presentAlert(errorMessage);}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
const reload = (postID: any,companyID:any) => {
|
|
|
formState.dataModel.recruitCount = null;
|
|
|
loadData(postID,companyID);
|
|
@@ -290,8 +428,6 @@ export default defineComponent({
|
|
|
|
|
|
return {
|
|
|
...toRefs(formState),
|
|
|
- chevronDownOutline,
|
|
|
- chevronUpOutline,
|
|
|
arrowBackOutline,
|
|
|
isCommit,
|
|
|
route,
|
|
@@ -300,8 +436,11 @@ export default defineComponent({
|
|
|
isEdit,
|
|
|
isTrailList,
|
|
|
workYearList,
|
|
|
+ workNatureList,
|
|
|
cultureRankList,
|
|
|
+ postTagList,
|
|
|
v$,
|
|
|
+ onIsTrailChange,
|
|
|
onSetProfessionID,
|
|
|
onSave,
|
|
|
back,
|