Browse Source

日期控件多个默认问题

gjy 2 năm trước cách đây
mục cha
commit
e7fcd49bbf

+ 32 - 26
components/itmister-date-picker/itmister-date-picker.nvue

@@ -335,13 +335,10 @@
 					this.year=val
 					this.$nextTick(() => {
 						setTimeout(() => {
-							if(val!='长期'&&val!='随时'){
-								this.value=this.setValue()
-								// console.log(this.value)
-							}else{
+							if(val=='长期'||val=='随时'){
 								this.value=[0,0,0]
 							}
-						}, 350);
+						}, 500);
 					})
 				}
 			},
@@ -354,45 +351,54 @@
 			},
 			"checkMonth":{
 				handler(val){
-					// console.log(val)
 					this.checkMonth=val
 					this.month=val
 					this.$nextTick(() => {
 						setTimeout(() => {
+							// console.log(this.month,this.day,this.days)
 							if(val!='长期'&&val!='随时'){
 								this.value=this.setValue()
 								// console.log(this.value)
-							}else{
-								this.value=[0,0,0]
 							}
-						}, 350);
+						}, 500);
 					})
+					// this.$nextTick(() => {
+					// 	setTimeout(() => {
+					// 		if(val!='长期'&&val!='随时'){
+					// 			this.value=this.setValue()
+					// 			// console.log(this.value)
+					// 		}else{
+					// 			this.value=[0,0,0]
+					// 		}
+					// 	}, 350);
+					// })
 				}
 			},
 			"checkDay":{
 				handler(val){
-					// console.log(val)
+					console.log(val,333333)
 					this.checkDay=val
 					this.day=val
-					this.$nextTick(() => {
-						setTimeout(() => {
-							if(val!='长期'&&val!='随时'){
-								this.value=this.setValue()
-								// console.log(this.value)
-							}else{
-								this.value=[0,0,0]
-							}
-						}, 350);
-					})
+					// this.$nextTick(() => {
+					// 	setTimeout(() => {
+					// 		if(val!='长期'&&val!='随时'){
+					// 			this.value=this.setValue()
+					// 			// console.log(this.value)
+					// 		}else{
+					// 			this.value=[0,0,0]
+					// 		}
+					// 	}, 350);
+					// })
 				}
 			},
 			"month": { // 监听月份变化,改变当前月份天数值 
 				handler(val) {
+					console.log(this.endDate)
 					if (val < 8&&this.year!='长期'&&val < 8&&this.year!='随时') {
 						if (val % 2 !== 0) {
 							this.days = [''];
 							if(this.endDate.day&&val===this.endDate.month&&this.year===this.endDate.year){
-								for (let i = 1; i <= this.endDate.month; i++) {
+								for (let i = 1; i <= this.endDate.day; i++) {
 									this.days.push(i);
 								}
 							}else{
@@ -403,7 +409,7 @@
 						} else {
 							this.days = [''];
 							if(this.endDate.day&&val===this.endDate.month&&this.year===this.endDate.year){
-								for (let i = 1; i <= this.endDate[2]; i++) {
+								for (let i = 1; i <= this.endDate.day; i++) {
 									this.days.push(i);
 								}
 							}else{
@@ -417,7 +423,7 @@
 						if (val % 2 === 0) {
 							this.days = [''];
 							if(this.endDate.day&&val===this.endDate.month&&this.year===this.endDate.year){
-								for (let i = 1; i <= this.endDate[2]; i++) {
+								for (let i = 1; i <= this.endDate.day; i++) {
 									this.days.push(i);
 								}
 							}else{
@@ -428,7 +434,7 @@
 						} else {
 							this.days = [''];
 							if(this.endDate.day&&val===this.endDate.month&&this.year===this.endDate.year){
-								for (let i = 1; i <= this.endDate[2]; i++) {
+								for (let i = 1; i <= this.endDate.day; i++) {
 									this.days.push(i);
 								}
 							}else{
@@ -442,7 +448,7 @@
 						if (this.year % 4 === 0) {
 							this.days = [''];
 							if(this.endDate.day&&val===this.endDate.month&&this.year===this.endDate.year){
-								for (let i = 1; i <= this.endDate[2]; i++) {
+								for (let i = 1; i <= this.endDate.day; i++) {
 									this.days.push(i);
 								}
 							}else{
@@ -453,7 +459,7 @@
 						} else {
 							this.days = [''];
 							if(this.endDate.day&&val===this.endDate.month&&this.year===this.endDate.year){
-								for (let i = 1; i <= this.endDate[2]; i++) {
+								for (let i = 1; i <= this.endDate.day; i++) {
 									this.days.push(i);
 								}
 							}else{

+ 6 - 0
pages/release/editRelease.vue

@@ -828,6 +828,8 @@
 				}
 				if(this.dataObj.taskValidity=='长期'){
 					this.year='长期'
+					this.month=''
+					this.day=''
 				}
 				this.$refs.dateEl.show()
 			},
@@ -857,6 +859,8 @@
 						}
 						if(this.dataObj.loadingDateStart=='随时'){
 							this.year='随时'
+							this.month=''
+							this.day=''
 						}
 						break
 					case 1:
@@ -868,6 +872,8 @@
 						}
 						if(this.dataObj.loadingDateEnd=='随时'){
 							this.year='随时'
+							this.month=''
+							this.day=''
 						}
 						break