123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- var page = 1,
- pageSize = 10,
- dateVal = '',
- statusVal = '',
- typeVal = '';
- var scroller;
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
-
- getData(true);
-
- bindEvents();
- initFilterPage(self);
- initScroller();
- })
- function getData(isInit){
- if(isInit){
- page = 1;
- }
- var url = "doctor/device/getDevicesList",
- params = {
- noGaugeDay: dateVal,//未测量天数(1今日为测量 2七天未测量 3本月未测量 4超过一个月未测量)
- isBinding: statusVal, //是否绑定(1绑定 2解绑)
- categoryCode: typeVal, //设备类型(1血糖仪 2血压计)
- isSend: '', //今日是否已发送提醒消息(1已发送)
- page: page,
- pageSize: pageSize
- };
-
- plus.nativeUI.showWaiting();
- sendGet(url, params, null,function(res){
- if(res.status == 200){
- $("#count").text("("+res.data.tatalCount+")");
- var list = res.data.data;
- if(list.length == 0){
- if(isInit){
- $("#result_wrapper").hide();
- $("#no_result_wrap").show();
- }else{
- scroller.endPullupToRefresh(true);
- }
- }else{
- $("#result_wrapper").show();
- $("#no_result_wrap").hide();
-
- var html = template("li-tmp", {list: list});
- if(isInit){
- $("#result_wrapper").empty().append(html);
- }else{
- $("#result_wrapper").append(html);
- }
-
- if(list.length < pageSize){
- scroller.endPullupToRefresh(true);
- }else{
- page ++;
- if(isInit){
- scroller.refresh(true);
- }else{
- scroller.endPullupToRefresh(false);
- }
- }
- }
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
- }
- function bindEvents(){
- $(".header-link").on('click', function(){
- openWebview("../../wdsb/html/scan2.html");
- });
-
- //提醒测量
- $("#remindBtn").on('click', function(){
- openWebview("choose-patient.html", {
- dateVal: dateVal,
- statusVal: statusVal,
- typeVal: typeVal,
- dateName: $(".filter-label:eq(0)").text(),
- statusName: $(".filter-label:eq(1)").text(),
- typeName: $(".filter-label:eq(2)").text()
- })
- });
-
- //左滑筛选区域的数据
- $('#filterBtn').on("tap", function(){
- var self = plus.webview.currentWebview();
- mui.fire(self, "showShaiXuan");
- });
-
- //点击患者查看患者设备列表
- $("#result_wrapper").on('tap', "li", function(){
- var $this = $(this),
- jsonObj = $this.data("json");
-
- openWebview("device-physical-records.html", {
- patiCode: jsonObj.patient,
- deviceSn: jsonObj.device_sn,
- type: jsonObj.category_code,
- deviceName: jsonObj.device_name
- })
- });
-
- window.addEventListener("setFilterData", function(arg){
- var info = arg.detail;
-
- dateVal = info.date;
- statusVal = info.status;
- typeVal = info.type;
-
- scroller.scrollTo(0, 0, 500);
- getData(true);
-
- $(".filter-label:eq(0)").text(info.dateName);
- $(".filter-label:eq(1)").text(info.statusName);
- $(".filter-label:eq(2)").text(info.typeName);
- })
- }
- function initFilterPage(main){
- var shaixuan = plus.webview.getWebviewById('filter.html');
- if(!shaixuan){
- shaixuan = mui.createWindow({
- id: 'filter.html',
- url: 'filter.html',
- styles: {
- top: 0,
- bottom: 0,
- left: '20%',
- width: '80%',
- scorllIndicator: "none"
- },
- show:{
- aniShow: "slide-in-right",
- duration: "400"
- },
- extras:{
- dateVal : dateVal,
- statusVal : statusVal,
- typeVal : typeVal
- }
- });
- }
- window.addEventListener("hideShaiXuan",function(){
- main.setStyle({mask:"none"});
- shaixuan.hide();
- }, false);
-
- window.addEventListener("showShaiXuan", function() {
- mui.fire(shaixuan, "setTagActive", {
- dateVal : dateVal,
- statusVal : statusVal,
- typeVal : typeVal
- });
- shaixuan.show();
- main.setStyle({mask:"rgba(0,0,0,0.5)"});
- main.addEventListener("maskClick",function(){
- main.setStyle({mask:"none"});
- shaixuan.hide();
- }, false);
- });
- }
- function initScroller(){
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
-
- scroller = mui(".mui-scroll-wrapper").pullRefresh({
- down:{
- callback: function(){
- getData(true);
- this.endPulldownToRefresh();
- }
- },
- up: {
- callback: function(){
- getData(false);
- // this.endPullupToRefresh();
- }
- }
- })
- }
|