	mui.init();

		
			mui.back = function() {
				mui.openWindow({
					
					url: 'document.html'				
				});
				 
					
			};
			var pageNo = 1;
			var pageNo2 = 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 fwlist;
				var swlist;

				mui.plusReady(function() {


					var self1 = plus.webview.currentWebview();
					
					var sm = self1.smid;
					var re = self1.reid;
					
					var phfirst = true;
					var refirst = true;
					fwlist = document.getElementById("fwlist");
					swlist = document.getElementById("swlist");

					//循环初始化所有下拉刷新，上拉加载。
					$.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');
										createFragment(ul, self);
										self.endPullDownToRefresh();
									}, 1000);
								}
							}
						});
					});
					var createFragment = function(ul, self) {
						var dataType = self.element.id;
						if("dispatchDiv" == dataType) {
							pageNo = 1;
							vmA.itemAs = [];
							dispatchData(ul, self);
						} else if("receiveDiv" == dataType) {
							pageNo2 = 1;
							vmB.itemBs = [];
							receiveData(ul, self);
						} 
					}

					//下拉菜单

					var createFragment2 = function(ul, self) {
						var dataType = self.element.id;
						if("dispatchDiv" == dataType) {
							pageNo = 1;
							vmA.itemAs = [];
							dispatchData(ul, self);
						} else if("receiveDiv" == dataType) {
							pageNo2 = 1;
							vmB.itemBs = [];
							receiveData(ul, self);
						} 
					}
					//发文
					function dispatchData(ul, self) {
						var url = API.API_URL();
						var state = app.getState(); //获取登陆信息
						var staffId = state.user.useId;
						var type = '1';
						var searchname='';
						var obj = {
							'serviceId': 'gov_Dispatch_2018V0010PHONE003',
							'params': '{userId:' + staffId + ',p:"' + pageNo + '",pSize:"' + APP.PageSize +'",searchname:"' + APP.searchname + '"}'
						};
						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 receiveData(ul, self) {
						var url = API.API_URL();
						var state = app.getState(); //获取登陆信息
						var staffId = state.user.useId;
						var type = '2';
						var searchname='';
						var obj = {
							'serviceId': 'gov_Receive_2018V0010PHONE003',
							'params': '{userId:' + staffId + ',p:"' + pageNo2 + '",pSize:"' + APP.PageSize +'",searchname:"' + APP.searchname +'"}'
						};
						mui.ajax(url, {
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							data: obj,
							timeout: 10000, //超时时间设置为10秒；
							headers: {
								'Accept': 'application/json'
							},
							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) {}
						});
					}
					
				
					
				});
			})(mui);

			//发文
			var vmA = new Vue({
				el: '#dispatchDiv',
				data: {
					itemAs: [] //列表信息流数据
				}
			});
			//收文
			var vmB = new Vue({
				el: '#receiveDiv',
				data: {
					itemBs: [] //列表信息流数据
				}
			});

			

			/**
			 * 打开发文
			 * 
			 * @param {Object} item 当前点击的新闻对象
			 */
			function open_detailA(itemA) {
				
				//触发子窗口变更新闻详情
				//console.log("item****B" + itemA);
				var title = itemA.title;
				var open_type=itemA.open_type;
				var send_no=itemA.send_no;
				var emergency_degree=itemA.emergency_degree;
				var theme=itemA.theme;
				var content=itemA.content;
				var send_unit=itemA.send_unit;
				var cc_unit=itemA.cc_unit;
				var drafter=itemA.drafter;
				var draftdate=itemA.draftdate;
				var dept_huigao=itemA.dept_huigao;
				var office_audit=itemA.office_audit;
				var issue=itemA.issue;
				var print=itemA.print;
				var printdate=itemA.printdate;
				var srcFile=itemA.srcFile;
				var path=itemA.path;
				var page = "docstore_dispath.html";
				mui.openWindow({
					createNew: true,
					url: page,
					extras: {
						title: title,
						open_type:open_type,
						send_no: send_no,
						emergency_degree: emergency_degree,
						theme: theme,
						content: content,
						send_unit: send_unit,
						cc_unit: cc_unit,
						drafter: drafter,
						draftdate: draftdate,
						dept_huigao: dept_huigao,
						office_audit:office_audit,
						issue:issue,
						print:print,
						printdate: printdate,
						srcFile: srcFile,
						path: path
						
						
					}
				});
			}

			/**
			 * 打开收文
			 * 
			 * @param {Object} item 当前点击的新闻对象
			 */
			function open_detailB(itemB) {
				//触发子窗口变更新闻详情
				//console.log("itemB***" + itemB);
				var title = itemB.title;
				var receive_no=itemB.receive_no;
				var send_no=itemB.send_no;
				var send_dept=itemB.send_dept;
				var receivedate=itemB.receivedate;
				var senddate=itemB.senddate;
				var emergency_degree=itemB.emergency_degree;
				var open_type=itemB.open_type;
				var send_unit=itemB.send_unit;
				var cc_unit=itemB.cc_unit;
				var srcFile=itemB.srcFile;
				var path=itemB.path;
				var remark=itemB.remark;
				var niban_opinion=itemB.niban_opinion;
				var leader_opinion=itemB.leader_opinion;
				var deal_situation=itemB.deal_situation;
				var page = "docstore_receive.html";

				mui.openWindow({
					createNew: true,
					url: page,
					extras: {
						title: title,
						receive_no: receive_no,
						send_no: send_no,
						send_dept: send_dept,
						receivedate: receivedate,
						senddate: senddate,
						emergency_degree: emergency_degree,
						open_type: open_type,
						send_unit: send_unit,
						cc_unit: cc_unit,
						srcFile: srcFile,
						path: path,
						remark: remark,
						niban_opinion: niban_opinion,
						leader_opinion: leader_opinion,
						deal_situation: deal_situation
						
					}
				});
			}