| 
					
				 | 
			
			
				@@ -5,7 +5,7 @@ import timeRange from '../../component/v2/plugins/time-range' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import week from '../../component/v2/plugins/week' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import holidays from '../../component/v2/plugins/holidays/index' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import plugin from '../../component/v2/plugins/index' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import util, {formatDate, sec2Date} from '../../utils/util.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import util, {formatDate, object2Date} from '../../utils/util.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const app = getApp() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 plugin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   .use(todo) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -19,6 +19,8 @@ const conf = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     outList:[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     visitList:[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    tableData: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    curDate: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     calendarConfig: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       theme: 'elegant', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // showHolidays: true, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,39 +103,66 @@ const conf = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   afterTapDate(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('afterTapDate', e.detail) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let curDate = object2Date( e.detail ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.setData({curDate}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.filterData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  onLoad: function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  onShow: function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     app.checkLogin(res=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if( !res.userId ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         wx.navigateTo({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           url: '/pages/index/index', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        console.log("loadData", res ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.loadData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  filterData(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let {curDate, outList, visitList} = this.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let allList = outList.map( item=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        item.isOut= true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return item; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }).concat( visitList ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let tableData = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for( let i in  allList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if( allList[i].fromDate <= curDate && allList[i].toDate >= curDate){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tableData.push( allList[i] ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log("tableData", curDate, allList, tableData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.setData({tableData}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  gotoDetail( e ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let {id,out} = e.currentTarget.dataset; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if( out ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      wx.navigateTo({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        url: `/pages/detail/out/index?id=${id}`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      wx.navigateTo({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        url: `/pages/detail/visit/index?id=${id}`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   loadData(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let curDate = this.data.calendarConfig.defaultDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let fromDate = curDate.substr(0,8)+ "01" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let toDate = curDate.substr(0,8)+ "31" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     app.formPost("User.loadData", {fromDate, toDate}).then( res=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log("loadData", res ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if( res.code == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let outList = res.data.outList||[]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let visitList = res.data.visitList||[]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.setData({outList, visitList}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.loadMarks() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.filterData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.loadMarks(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   loadMarks(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const calendar = this.selectComponent('#calendar').calendar 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let {outList, visitList} = this.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log("loadMarks", outList, visitList ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var dateMap = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 外出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for(let i in outList ){ 
			 |