Quellcode durchsuchen

时间轴排序

yht2016 vor 4 Jahren
Ursprung
Commit
9b284b107a

+ 44 - 50
app/rehabilitation/js/rehabilitation_management.js

@ -262,11 +262,6 @@
					}
				});
			},
			excuteServerItem: function(type, detailId){
				if(type==1){
					
				}
			},
			changeStatus:function(val){
				this.status=this.status==val?null:val;
			},
@ -561,59 +556,58 @@
				}
				rehaAPI.calendarPlanDetailList(params).then(function(res){
					if(res.status==200){
						var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
						// var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
						var list=_.map(res.data||{},function(o){
							// var _time=o.executeTime.split(' ');
							// var thatTime=+new Date(_time[0]);
							// var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
							// (o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
							// var _html=o.status==2?'预':(future==-1?'逾':'');
							// _html=future==1?'今':_html;
							// if(_html=='预') future=3;
							var _time=o.executeTime.split(' ');
							var thatTime=+new Date(_time[0]);
							var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
							(o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
							var _html=o.status==2?'预':(future==-1?'逾':'');
							_html=future==1?'今':_html;
							if(_html=='预') future=3;
							// var d = new Date(o.execute_time);
							// if(d.format("yyyy-MM-dd") == new Date().format("yyyy-MM-dd")) {
							// 	o.dateClass = "today";
							// 	o.firstSort = '1'
							// 	o.dateText = "今";
							// 	o.today = true;
							// 	obj = getStatusInfo(o.status);
							// 	future=1
							// 	if(o.status) {
							// 		o.secondSort = '2'
							// 	} else {
							// 		o.secondSort = '1'
							// 	}
							// } else if(d > new Date()) {
							// 	o.firstSort = '3 '
							// 	o.dateText = "";
							// 	o.dateClass = "blue";
							// 	future=2
							// 	if(o.status) {
							// 		o.secondSort = '2'
							// 	} else {
							// 		o.secondSort = '1'
							// 	}
							// } else {
							// 	obj = getStatusInfo(o.status);
							// 	o.firstSort = '2'
							// 	future=0
							// 	if(o.status == 0) {
							// 		o.dateClass = "overlay";
							// 		o.dateText = "逾";
							// 		o.secondSort = '1'
							// 	} else {
							// 		o.dateText = "";
							// 		o.dateClass = "";
							// 		o.secondSort = '2'
							// 	}
							// }
							var _html = ''
							var d = new Date(o.execute_time);
							if(d.format("yyyy-MM-dd") == new Date().format("yyyy-MM-dd")) {
								o.firstSort = '1'
								future = 1
								_html = '今'
								if(o.status) {
									o.secondSort = '2'
								} else {
									o.secondSort = '1'
								}
							} else if(d > new Date()) {
								o.firstSort = '3'
								future = 2
								if(o.status) {
									o.secondSort = '2'
								} else {
									o.secondSort = '1'
								}
							} else {
								o.firstSort = '2'
								future = 0
								if(o.status == 0) {
									future = -1
									_html = '逾'
									o.secondSort = '1'
								} else {
									o.secondSort = '2'
								}
							}
							o.html=_html
							o.date=_time[0];
							o.time=_time[1];
							o.future=future;
							o.doctorName = o.doctor_name
							o.hospitalName = o.hospital_name
							return o;
						})||[];
						vm.timeAxisData = list
						var nowTime = new Date().getTime()
						vm.timeAxisData = _.sortBy(list, function(o) {
							return o.firstSort + o.secondSort + (nowTime/o.execute_time)
						});
					}
				})
			},

+ 87 - 30
component/rehabilitation/server-items-detail.js

@ -622,15 +622,46 @@ Vue.component('server-items-detail', {
			}
			rehaAPI.calendarPlanDetailList(params).then(function(res){
				if(res.status==200){
					var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
					vm.timeAxisData=_.map(res.data||{},function(o){
					// var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
					var list=_.map(res.data||{},function(o){
						// var _time=o.executeTime.split(' ');
						// var thatTime=+new Date(_time[0]);
						// var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
						// (o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
						// var _html=o.status==2?'预':(future==-1?'逾':'');
						// _html=future==1?'今':_html;
						// if(_html=='预') future=3;
						var _time=o.executeTime.split(' ');
						var thatTime=+new Date(_time[0]);
						var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
						(o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
						var _html=o.status==2?'预':(future==-1?'逾':'');
						_html=future==1?'今':_html;
						if(_html=='预') future=3;
						var _html = ''
						var d = new Date(o.execute_time);
						if(d.format("yyyy-MM-dd") == new Date().format("yyyy-MM-dd")) {
							o.firstSort = '1'
							future = 1
							_html = '今'
							if(o.status) {
								o.secondSort = '2'
							} else {
								o.secondSort = '1'
							}
						} else if(d > new Date()) {
							o.firstSort = '3'
							future = 2
							if(o.status) {
								o.secondSort = '2'
							} else {
								o.secondSort = '1'
							}
						} else {
							o.firstSort = '2'
							future = 0
							if(o.status == 0) {
								future = -1
								_html = '逾'
								o.secondSort = '1'
							} else {
								o.secondSort = '2'
							}
						}
						o.html=_html
						o.date=_time[0];
						o.time=_time[1];
@ -639,6 +670,10 @@ Vue.component('server-items-detail', {
						o.hospitalName = o.hospital_name
						return o;
					})||[];
					var nowTime = new Date().getTime()
					vm.timeAxisData = _.sortBy(list, function(o) {
						return o.firstSort + o.secondSort + (nowTime/o.execute_time)
					});
				} else {
					showErrorMessage(res.msg)
				}
@ -654,28 +689,50 @@ Vue.component('server-items-detail', {
				pagesize: 10000
			}
			rehaAPI.selectByPlanDetaiId(params).then(function(res){
				if(res.status == 200){
					var arr = []
					if(res.data.list&&res.data.list.length>0){
						var list = res.data.list
						var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
						console.log('_currentTimeStamp=======', _currentTimeStamp)
						arr=_.map(list||[],function(o){
							var _time=o.completeTime.split(' ');
							var thatTime=+new Date(_time[0]);
							var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
							(o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
							var _html=o.status==2?'预':(future==-1?'逾':'');
							_html=future==1?'今':_html;
							if(_html=='预') future=3;
							o.html=_html
							o.date=_time[0];
							o.time=_time[1];
							o.future=future;
							return o;
						})||[];
					}
					vm.timeAxisData = arr
				if(res.status==200){
					var list=_.map(res.data.list||{},function(o){
						var _time=o.completeTime.split(' ');
						var _html = ''
						var d = new Date(o.completeTime);
						if(d.format("yyyy-MM-dd") == new Date().format("yyyy-MM-dd")) {
							o.firstSort = '1'
							future = 1
							_html = '今'
							if(o.status) {
								o.secondSort = '2'
							} else {
								o.secondSort = '1'
							}
						} else if(d > new Date()) {
							o.firstSort = '3'
							future = 2
							if(o.status) {
								o.secondSort = '2'
							} else {
								o.secondSort = '1'
							}
						} else {
							o.firstSort = '2'
							future = 0
							if(o.status == 0) {
								future = -1
								_html = '逾'
								o.secondSort = '1'
							} else {
								o.secondSort = '2'
							}
						}
						o.html=_html
						o.date=_time[0];
						o.time=_time[1];
						o.future=future;
						o.hospitalName = o.hosiptalName
						return o;
					})||[];
					var nowTime = new Date().getTime()
					vm.timeAxisData = _.sortBy(list, function(o) {
						return o.firstSort + o.secondSort + (nowTime/o.execute_time)
					});
				} else {
					showErrorMessage(res.msg)
				}