wgl il y a 4 ans
Parent
commit
850d58f4b8

+ 9 - 5
src/projects/pension/components/DrugCalendar.vue

@@ -103,11 +103,15 @@
 			},
 			//显示title
 			titleStr(date) {
-				var hasIndex = this.hasDayList.indexOf(date);
-				if (hasIndex > -1) {
-					return '用药' + this.monthList[hasIndex]['times'] + '次';
-				} else if (inDateBetwen(date, this.monthList[0]['name'], this.monthList[this.monthList.length - 1]['name'])) {
-					return '停药';
+				if (this.monthList.length) {
+					var hasIndex = this.hasDayList.indexOf(date);
+					if (hasIndex > -1) {
+						return '用药' + this.monthList[hasIndex]['times'] + '次';
+					} else if (inDateBetwen(date, this.monthList[0]['name'], this.monthList[this.monthList.length - 1]['name'])) {
+						return '停药';
+					} else {
+						return '';
+					}
 				} else {
 					return '';
 				}

+ 9 - 2
src/projects/pension/views/Master/Drug/Add.vue

@@ -240,8 +240,15 @@
 				API_Drug.medicationDetail(this.subForm.id).then(response => {
 					this.isLoading = false;
 
-					this.subForm = response;
-					this.remindTimeList = response.remindTime.split(',');
+					if (response) {
+						this.subForm = response;
+						this.remindTimeList = response.remindTime.split(',');
+					} else {
+						this.$router.push({
+							name: 'MasterDrug'
+						})
+					}
+
 
 				}).catch(error => {
 					this.isLoading = false;