Browse Source

用药提醒修正

wgl 4 years ago
parent
commit
980ee00ffd

+ 24 - 14
src/projects/pension/components/DrugCalendar.vue

@@ -21,7 +21,8 @@
 	import {
 		currentTimeStamp,
 		parseUnixTime,
-		inDateBetwen
+		inDateBetwen,
+		unixTimeStamp
 	} from '$project/utils'
 	export default {
 		name: 'DrugCalendar',
@@ -98,23 +99,18 @@
 						dateNum: date.getDate()
 					})
 				}
-				//console.log(this.canlender)
+				console.log(this.canlender)
 			},
 			//显示title
 			titleStr(date) {
-				var monthList = this.monthList;
-				if (monthList.length) {
-					for (var i = 0; i < monthList.length; i++) {
-						if (monthList[i]['name'] == date) {
-							return '用药' + monthList[i]['times'] + '次';
-						} else if (inDateBetwen(date, monthList[0]['name'], monthList[monthList.length - 1]['name'])) {
-							return '停药';
-						} else {
-							return '';
-						}
-					}
+				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 '';
 				}
-				return '';
 			},
 		},
 		mounted() {
@@ -131,6 +127,20 @@
 					console.log(newValue)
 				}
 			},
+			hasDayList: {
+				// getter
+				get: function() {
+					var list = [];
+					for (var i = 0; i < this.monthList.length; i++) {
+						list.push(this.monthList[i]['name']);
+					}
+					return list;
+				},
+				// setter
+				set: function(newValue) {
+					console.log(newValue)
+				}
+			}
 		}
 	}
 </script>

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

@@ -25,7 +25,7 @@
 						</button>
 					</div>
 					<div class="mui-input-row">
-						<label>使用天数</label>
+						<label>用天数</label>
 						<input v-model="subForm.medicationDays" type="number" class="mui-input-clear" placeholder="请输入">
 					</div>
 					<div class="mui-input-row">

+ 21 - 12
src/projects/pension/views/Master/Drug/Home.vue

@@ -237,19 +237,14 @@
 			},
 			//显示title
 			titleStr(date) {
-				var monthList = this.monthList;
-				if (monthList.length) {
-					for (var i = 0; i < monthList.length; i++) {
-						if (monthList[i]['name'] == date) {
-							return '正常用药';
-						} else if (inDateBetwen(date, monthList[0]['name'], monthList[monthList.length - 1]['name'])) {
-							return '停药';
-						} else {
-							return '';
-						}
-					}
+				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 '';
 				}
-				return '';
 			},
 			asynCallBack() {
 
@@ -288,6 +283,20 @@
 					console.log(newValue)
 				}
 			},
+			hasDayList: {
+				// getter
+				get: function() {
+					var list = [];
+					for (var i = 0; i < this.monthList.length; i++) {
+						list.push(this.monthList[i]['name']);
+					}
+					return list;
+				},
+				// setter
+				set: function(newValue) {
+					console.log(newValue)
+				}
+			},
 			...mapGetters({
 				openId: 'wx_openid',
 				token: 'token',