22996745 by 杨威
2 parents 29e92088 d2b91f8e
...@@ -105,9 +105,10 @@ ...@@ -105,9 +105,10 @@
105 :disabled="formData.qszt!='0'" 105 :disabled="formData.qszt!='0'"
106 v-model="childItem.tdsyqssj" 106 v-model="childItem.tdsyqssj"
107 type="date" 107 type="date"
108 108 :picker-options="childItem.pickerStart"
109 value-format="yyyy-MM-dd" 109 value-format="yyyy-MM-dd"
110 placeholder="选择日期" 110 placeholder="选择日期"
111 @change="startTime(index,childIndex)"
111 > 112 >
112 </el-date-picker> 113 </el-date-picker>
113 </li> 114 </li>
...@@ -150,7 +151,7 @@ ...@@ -150,7 +151,7 @@
150 <li> 151 <li>
151 <input 152 <input
152 type="text" 153 type="text"
153 154
154 :disabled="formData.qszt!='0'" 155 :disabled="formData.qszt!='0'"
155 v-model="childItem.syqx" 156 v-model="childItem.syqx"
156 class="formInput" 157 class="formInput"
...@@ -211,7 +212,8 @@ ...@@ -211,7 +212,8 @@
211 :disabled="formData.qszt!='0'" 212 :disabled="formData.qszt!='0'"
212 v-model="childItem.tdsyjssj" 213 v-model="childItem.tdsyjssj"
213 type="date" 214 type="date"
214 215 :picker-options="childItem.pickerEnd"
216 @change="endTime(index,childIndex)"
215 value-format="yyyy-MM-dd" 217 value-format="yyyy-MM-dd"
216 placeholder="选择日期" 218 placeholder="选择日期"
217 > 219 >
...@@ -290,6 +292,8 @@ export default { ...@@ -290,6 +292,8 @@ export default {
290 sjytmj: 0, 292 sjytmj: 0,
291 syqx: "", 293 syqx: "",
292 tdsyjssj: "", 294 tdsyjssj: "",
295 pickerStart:{},
296 pickerEnd:{},
293 tdsyqssj: "", 297 tdsyqssj: "",
294 tdzh: "", 298 tdzh: "",
295 }, 299 },
...@@ -304,6 +308,42 @@ export default { ...@@ -304,6 +308,42 @@ export default {
304 console.log(this.formData,'formData'); 308 console.log(this.formData,'formData');
305 }, 309 },
306 methods: { 310 methods: {
311 startTime(index,childIndex){
312 let startTime= this.countList[index].list[childIndex].tdsyqssj;
313 let endTime=this.countList[index].list[childIndex].tdsyjssj;
314 this.countList[index].list[childIndex].pickerEnd={
315 disabledDate: (time) => {
316 if (Object.keys(startTime).length>0) {
317 return new Date(startTime).getTime()>time.getTime();
318 }else {
319 return time.getTime()< Date.now();
320 }
321 }
322 }
323 if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) {
324 let startYear= new Date(startTime).getFullYear();
325 let endYear=new Date(endTime).getFullYear();
326 this.countList[index].list[childIndex].syqx=endYear-startYear;
327 }
328 },
329 endTime(index,childIndex){
330 let startTime = this.countList[index].list[childIndex].tdsyqssj;
331 let endTime = this.countList[index].list[childIndex].tdsyjssj;
332 this.countList[index].list[childIndex].pickerStart={
333 disabledDate: (time) => {
334 if (Object.keys(endTime).length>0) {
335 return new Date(endTime).getTime()<time.getTime();
336 }else {
337 return time.getTime() > Date.now();
338 }
339 }
340 }
341 if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) {
342 let startYear= new Date(startTime).getFullYear();
343 let endYear=new Date(endTime).getFullYear();
344 this.countList[index].list[childIndex].syqx=endYear-startYear;
345 }
346 },
307 //外层操作 347 //外层操作
308 handleClick(ind, type) { 348 handleClick(ind, type) {
309 let outsideObj = { 349 let outsideObj = {
...@@ -325,6 +365,8 @@ export default { ...@@ -325,6 +365,8 @@ export default {
325 sjdjbsm: "", 365 sjdjbsm: "",
326 sjdjmc: "", 366 sjdjmc: "",
327 sjytdm: "", 367 sjytdm: "",
368 pickerStart:{},
369 pickerEnd:{},
328 sjytmc: "", 370 sjytmc: "",
329 sjytmj: 0, 371 sjytmj: 0,
330 syqx: "", 372 syqx: "",
...@@ -360,6 +402,8 @@ export default { ...@@ -360,6 +402,8 @@ export default {
360 sjytdm: "", 402 sjytdm: "",
361 sjytmc: "", 403 sjytmc: "",
362 sjytmj: 0, 404 sjytmj: 0,
405 pickerStart:{},
406 pickerEnd:{},
363 syqx: "", 407 syqx: "",
364 tdsyjssj: "", 408 tdsyjssj: "",
365 tdsyqssj: "", 409 tdsyqssj: "",
......