5871b1ea by weimo934

:to(qlxz):起始时间结束时间验证,

1 parent af4c6928
......@@ -105,9 +105,10 @@
:disabled="formData.qszt!='0'"
v-model="childItem.tdsyqssj"
type="date"
:picker-options="childItem.pickerStart"
value-format="yyyy-MM-dd"
placeholder="选择日期"
@change="startTime(index,childIndex)"
>
</el-date-picker>
</li>
......@@ -211,7 +212,8 @@
:disabled="formData.qszt!='0'"
v-model="childItem.tdsyjssj"
type="date"
:picker-options="childItem.pickerEnd"
@change="endTime(index,childIndex)"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
......@@ -290,6 +292,8 @@ export default {
sjytmj: 0,
syqx: "",
tdsyjssj: "",
pickerStart:{},
pickerEnd:{},
tdsyqssj: "",
tdzh: "",
},
......@@ -304,6 +308,42 @@ export default {
console.log(this.formData,'formData');
},
methods: {
startTime(index,childIndex){
let startTime= this.countList[index].list[childIndex].tdsyqssj;
let endTime=this.countList[index].list[childIndex].tdsyjssj;
this.countList[index].list[childIndex].pickerEnd={
disabledDate: (time) => {
if (Object.keys(startTime).length>0) {
return new Date(startTime).getTime()>time.getTime();
}else {
return time.getTime()< Date.now();
}
}
}
if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) {
let startYear= new Date(startTime).getFullYear();
let endYear=new Date(endTime).getFullYear();
this.countList[index].list[childIndex].syqx=endYear-startYear;
}
},
endTime(index,childIndex){
let startTime = this.countList[index].list[childIndex].tdsyqssj;
let endTime = this.countList[index].list[childIndex].tdsyjssj;
this.countList[index].list[childIndex].pickerStart={
disabledDate: (time) => {
if (Object.keys(endTime).length>0) {
return new Date(endTime).getTime()<time.getTime();
}else {
return time.getTime() > Date.now();
}
}
}
if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) {
let startYear= new Date(startTime).getFullYear();
let endYear=new Date(endTime).getFullYear();
this.countList[index].list[childIndex].syqx=endYear-startYear;
}
},
//外层操作
handleClick(ind, type) {
let outsideObj = {
......@@ -325,6 +365,8 @@ export default {
sjdjbsm: "",
sjdjmc: "",
sjytdm: "",
pickerStart:{},
pickerEnd:{},
sjytmc: "",
sjytmj: 0,
syqx: "",
......@@ -360,6 +402,8 @@ export default {
sjytdm: "",
sjytmc: "",
sjytmj: 0,
pickerStart:{},
pickerEnd:{},
syqx: "",
tdsyjssj: "",
tdsyqssj: "",
......