	mui.init();

		
			mui.back = function() {
				mui.openWindow({
					
					url: 'flow_main.html'				
				});
				
					
			}
			var pageNo = 1;
			var pageNo2 = 1;
			var pageNo3 = 1;
			(function($) {
				var segmentedControl = document.getElementById('segmentedControl22');
				$('.mui-input-group').on('change', 'input', function() {
					if(this.checked) {
						var styleEl = document.querySelector('input[name="style"]:checked');
						console.log(styleEl);
						var colorEl = document.querySelector('input[name="color"]:checked');
						if(styleEl && colorEl) {
							var style = styleEl.value;
							var color = colorEl.value;
							segmentedControl.className = 'mui-segmented-control' + (style ? (' mui-segmented-control-' + style) : '') + ' mui-segmented-control-' + color;
						}
					}
				});
				//初始化单页的区域滚动
				mui('.mui-scroll-wrapper').scroll();
				//阻尼系数
				var deceleration = mui.os.ios ? 0.003 : 0.0009;
				$('.mui-scroll-wrapper').scroll({
					bounce: false,
					indicators: true, //是否显示滚动条
					deceleration: deceleration
				});
				var my_plan;
				var pending;
				var approved;

				mui.plusReady(function() {
					my_plan = document.getElementById("my_plan");
					pending = document.getElementById("pending");
					approved = document.getElementById("approved");

					//循环初始化所有下拉刷新，上拉加载。
					$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
						$(pullRefreshEl).pullToRefresh({
							down: {
								callback: function() {
									var self = this;
									setTimeout(function() {
										var ul = self.element.querySelector('.mui-table-view');
										createFragment2(ul, self);
										self.endPullDownToRefresh();
									}, 1000);
								}
							},
							up: {
								contentrefresh: '正在加载...',
								auto: true, //可选,默认false.自动上拉加载一次
								callback: function() {
									var self = this;
									setTimeout(function() {
										var ul = self.element.querySelector('.mui-table-view');
										console.log(pullRefreshEl.id);
										createFragment(ul, self);
										self.endPullUpToRefresh();
									}, 1000);
								}
							}
						});
					});
					var createFragment = function(ul, self) {
						var dataType = self.element.id;
						if("my_planDiv" == dataType) {
							mpdown(ul, self);
						} else if("pendingDiv" == dataType){
							pddown(ul, self);
						} else if("approvedDiv" == dataType){
							apdown(ul, self)
						}
					}

					//下拉菜单

					var createFragment2 = function(ul, self) {
						var dataType = self.element.id;
						if("my_planDiv" == dataType) {
							pageNo = 1;
							vmA.itemAs = [];
							mpdown(ul, self);
						} else if("pendingDiv" == dataType){
							pageNo2 = 1;
							vmB.itemBs = [];
							pddown(ul, self);
						} else if("approvedDiv" == dataType){
							pageNo3 = 1;
							vmC.itemCs = [];
							apdown(ul, self)
						}
					}

					//我的工作计划和评价信息
					function mpdown(ul, self) {
						var url = API.API_URL();
						var state = app.getState(); //获取登陆信息
						var staffId = state.user.useId;
						var obj = {
							'serviceId': 'oa_2018B1030PHONE001',
							'params': '{staffId:' + staffId + ',p:"' + pageNo + '",pSize:"' + APP.PageSize + '"}'
						};
						mui.ajax(url, {
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							data: obj,
							timeout: 10000, //超时时间设置为10秒；
							headers: {
								'Accept': 'application/json'
							}, //超时时间设置为10秒；
							success: function(data) {
								if(data.returnCode == "0") {
									var result = data.returnParams.list;
									console.log(JSON.stringify(data));
									var totalRow = data.returnParams.total;
									var totalPage = Math.ceil(totalRow / APP.PageSize);
									if(totalPage == 0) {
										totalPage = 1;
									}
									console.log("我的工作计算总页数==" + totalPage);
									if(result.length > 0) {
										vmA.itemAs = vmA.itemAs.concat(result);
									}
									self.endPullUpToRefresh(totalPage == pageNo); //参数为true代表没有更多数据了。

									if(pageNo == 1 && totalPage > 1)

										self.refresh(true); //调用.refresh(true)方法，可重置上拉加载控件,注意：refresh()中需传入true
									pageNo = pageNo + 1;
								}
							},
							error: function(xhr, type, errorThrown) {}
						});
					}
					//待审批考核
					function pddown(ul, self) {
						var url = API.API_URL();
						var state = app.getState(); //获取登陆信息
						var staffId = state.user.useId;
						var obj = {
							'serviceId': 'oa_2018B1030PHONE002',
							'params': '{staffId:' + staffId + ',p:"' + pageNo2 + '",pSize:"' + APP.PageSize + '"}'
						};
						mui.ajax(url, {
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							data: obj,
							timeout: 10000, //超时时间设置为10秒；
							headers: {
								'Accept': 'application/json'
							}, //超时时间设置为10秒；
							success: function(data) {
								if(data.returnCode == "0") {
									var result = data.returnParams.list;
									console.log(JSON.stringify(data));
									var totalRow = data.returnParams.total;
									var totalPage = Math.ceil(totalRow / APP.PageSize);
									if(totalPage == 0) {
										totalPage = 1;
									}
									console.log("待审批考核计算总页数==" + totalPage);
									if(result.length > 0) {
										vmB.itemBs = vmB.itemBs.concat(result);
									}
									self.endPullUpToRefresh(totalPage == pageNo2); //参数为true代表没有更多数据了。

									if(pageNo2 == 1 && totalPage > 1)

										self.refresh(true); //调用.refresh(true)方法，可重置上拉加载控件,注意：refresh()中需传入true
									pageNo2 = pageNo2 + 1;
								}
							},
							error: function(xhr, type, errorThrown) {}
						});
					}
					//已审批考核
					function apdown(ul, self) {
						var url = API.API_URL();
						var state = app.getState(); //获取登陆信息
						var staffId = state.user.useId;
						var obj = {
							'serviceId': 'oa_2018B1030PHONE003',
							'params': '{staffId:' + staffId + ',p:"' + pageNo3 + '",pSize:"' + APP.PageSize + '"}'
						};
						mui.ajax(url, {
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							data: obj,
							timeout: 10000, //超时时间设置为10秒；
							headers: {
								'Accept': 'application/json'
							}, //超时时间设置为10秒；
							success: function(data) {
								if(data.returnCode == "0") {
									var result = data.returnParams.list;
									console.log(JSON.stringify(data));
									var totalRow = data.returnParams.total;
									var totalPage = Math.ceil(totalRow / APP.PageSize);
									if(totalPage == 0) {
										totalPage = 1;
									}
									console.log("已审批考核计算总页数==" + totalPage);
									if(result.length > 0) {
										vmC.itemCs = vmC.itemCs.concat(result);
									}
									self.endPullUpToRefresh(totalPage == pageNo3); //参数为true代表没有更多数据了。

									if(pageNo3 == 1 && totalPage > 1)

										self.refresh(true); //调用.refresh(true)方法，可重置上拉加载控件,注意：refresh()中需传入true
									pageNo3 = pageNo3 + 1;
								}
							},
							error: function(xhr, type, errorThrown) {}
						});
					}
				});
			})(mui);

			//我发起的
			var vmA = new Vue({
				el: '#my_planDiv',
				data: {
					itemAs: [] //列表信息流数据
				}
			});
			//待审批考核
			var vmB = new Vue({
				el: '#pendingDiv',
				data: {
					itemBs: [] //列表信息流数据
				}
			});
			//已审批考核
			var vmC = new Vue({
				el: '#approvedDiv',
				data: {
					itemCs: [] //列表信息流数据
				}
			});

			

			/**
			 * 打开我发起的详情
			 * itemAs
			 * @param {Object} item 当前点击的新闻对象
			 */
			function open_detailA(itemA) {
				
				//触发子窗口变更新闻详情
				//console.log("item****B" + itemA);
				var assess_id = itemA.assess_id;
				var title = itemA.title;
				var staff_name = itemA.staff_name;
				var dept = itemA.dept;
				var assess_result = itemA.assess_result;
				
				var page = "assess_Detail_list.html";
				//console.log("*************" + assess_id );
				mui.openWindow({
					createNew: true,
					url: page,
					extras: {
						assess_id: assess_id,
						title: title,
						staff_name: staff_name,
						dept: dept,
						assess_result: assess_result,
					}
				});
			}
			/**
			 * 打开待审批详情
			 * itemAs
			 * @param {Object} item 当前点击的新闻对象
			 */
			function open_detailB(itemB) {
				
				//触发子窗口变更新闻详情
				//console.log("item****B" + itemA);
				var state = app.getState(); //获取登陆信息
				var staffId = state.user.useId;
				var assess_id = itemB.assess_id;
				var title = itemB.title;
				var staff_name = itemB.staff_name;
				var dept = itemB.dept;
				var assess_result = itemB.assess_result;
				var manager_sign = itemB.manager_sign;
				var leader_sign = itemB.leader_sign;
				var chairman_sign = itemB.chairman_sign;
				var managerid = itemB.managerid; 
				var leaderid = itemB.leaderid; 
				var chairmanid = itemB.chairmanid; 
				var manager_type = itemB.manager_type;
				var leader_type = itemB.leader_type;
				var chairman_type = itemB.chairman_type;
				var page;
//				alert(staffId);
//				alert(managerid);
				if(staffId == managerid && manager_type=="0"){
					var page = "assess_Detail_list1.html";
					
				}else if(staffId==leaderid&&leader_type=="0"){
					var page = "assess_leader.html";
					
				}else if(staffId==chairmanid&&chairman_type=="0"){
					var page = "assess_chairman.html";
					
				}
				
				//var page = "assess_Detail_list1.html";
				console.log("*************" + assess_id );
				mui.openWindow({
					createNew: true,
					url: page,
					extras: {
						assess_id: assess_id,
						title: title,
						staff_name: staff_name,
						dept: dept,
						assess_result: assess_result,
						chairman_sign: chairman_sign,
						manager_sign: manager_sign,
						leader_sign: leader_sign
						
					}
				});
			}
			/**
			 * 打开已审批详情
			 * itemAs
			 * @param {Object} item 当前点击的新闻对象
			 */
			function open_detailC(itemC) {
				
				//触发子窗口变更新闻详情
				//console.log("item****B" + itemA);
				var assess_id = itemC.assess_id;
				var title = itemC.title;
				var staff_name = itemC.staff_name;
				var dept = itemC.dept;
				var assess_result = itemC.assess_result;
				
				var page = "assess_Detail_list2.html";
				console.log("*************" + assess_id );
				mui.openWindow({
					createNew: true,
					url: page,
					extras: {
						assess_id: assess_id,
						title: title,
						staff_name: staff_name,
						dept: dept,
						assess_result: assess_result,
					}
				});
			}