规则 提前转正1-2个月内
正常转正3个月
延迟转正4-6个月
限制3种状态根据入职日期判断转正生效时间 15号以前算一个月 超过15号不算满一个月 每个月1号生效
<el-radio-group v-model="form.turnPositiveType" @change="typeChange" >
<el-radio label="1" >${@m.lang('bs.Betheformal')}</el-radio>
<el-radio label="2" >${@m.lang('bs.Betheformalemployee')}</el-radio>
<el-radio label="3" >${@m.lang('bs.Delaytheprobation')}</el-radio>
</el-radio-group>
<el-form-item label="转正生效日期">
<el-date-picker
:picker-options="pickerOptions"
v-model="form.effectiveTime"
type="month"
:editable="false"
format="yyyy-MM"
value-format="yyyy-MM-dd"
placeholder="转正生效日期">
</el-date-picker>
</el-form-item>
1.提前转正
2.正常转正
3.延迟转正
js实现
pickerOptions: {
disabledDate(time) {
var now= new Date(vm.form.dateOfEntry);
var minYear = now.getFullYear();
var maxYear = now.getFullYear();
var day = now.getDate();
var flag=true;//禁用
if (vm.form.turnPositiveType==1) { //如果提前转正
var minMonth = now.getMonth()+2;
var maxMonth = now.getMonth()+3;
if(day>15){
var minMonth = minMonth+1;
var maxMonth = maxMonth+1;
}
if(minMonth>12){
minYear=minYear+1;
minMonth=minMonth-12;
}
if(maxMonth>12){
maxYear=maxYear+1;
maxMonth=maxMonth-12;
}
if(new Date(minYear+'-'+minMonth).getTime()<new Date(time).getTime()&&new Date(maxYear+'-'+maxMonth).getTime()>=new Date(time).getTime()){
flag=false;
}
}else if(vm.form.turnPositiveType==2) {//如果正常转正
var minMonth = now.getMonth()+4;
if(day>15){
var minMonth = minMonth+1;
}
if(minMonth>12){
minYear=minYear+1;
minMonth=minMonth-12;
}
if(minMonth==new Date(time).getMonth()+1&&minYear==new Date(time).getFullYear()){
flag=false;
}
}else if(vm.form.turnPositiveType==3) {//如果延迟转正 最多6个月
var minMonth = now.getMonth()+5;
var maxMonth = now.getMonth()+7;
if(day>15){
var minMonth = minMonth+1;
var maxMonth = maxMonth+1;
}
if(minMonth>12){
minYear=minYear+1;
minMonth=minMonth-12;
}
if(maxMonth>12){
maxYear=maxYear+1;
maxMonth=maxMonth-12;
}
if(new Date(minYear+'-'+minMonth).getTime()<new Date(time).getTime()&&new Date(maxYear+'-'+maxMonth).getTime()>=new Date(time).getTime()){
flag=false;
}
}
return flag;
}
}