123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- var switchery = null;
- var date = new Date();
- var year = date.getFullYear();
- var begindate;
- var enddate;
- var page = 1;
- var pagesize = 10;
- var pagetype = 5;
- var patientCode = "";
- var charType = 1;
- var scroller1 = null;
- var self = null;
- var type = null;
- var charts = [];
- var $duringList = $('#duringList'),
- $qushiView = $('#qushiView'),
- $liebiaoView = $('#liebiaoView'),
- $xtEdit = $('.xt-edit'),
- $xtAdd = $('.xt-add'),
- $btns = $('.btns'),
- $cancelBtn = $('.cancel-btn'),
- $okBtn = $('.ok-btn'),
- $popMain = $('.pop-main'),
- $popBtns = $('.pop-btns'),
- $popEditBtn = $('.pop-edit-btn'),
- $popDelBtn = $('.pop-del-btn'),
- $popCancelBtn = $('.pop-cancel-btn'),
- isTrue = false,
- page = 0,
- pagesize = 10,
- $xyList = $('.xy-list-con'),
- $xyTmp = $('#xyTmp');
- mui.plusReady(function() {
- self = plus.webview.currentWebview();
- patientCode = self.code;
- begindate = self.dateT;
- type = self.type;
- plus.nativeUI.showWaiting();
- scroller1 = new IScrollPullUpDown('wrapper6', {
- probeType: 2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel: false,
- scrollbars: true,
- fadeScrollbars: true,
- interactiveScrollbars: false,
- click: true,
- }, null, pullUpAction);
- console.log(1);
- loadData();
- });
- var render = function(tmpl, data) {
- return tmpl.replace(/\{\{(\w+)\}\}/g, function(m, $1) {
- return data[$1];
- });
- },
- //根据sd获取n天前的时间
- getBeforeDate = function(sd, n) {
- var n = n;
- var d = new Date(sd.replace(/\-/g, "/"));
- var year = d.getFullYear();
- var mon = d.getMonth() + 1;
- var day = d.getDate();
- if(day <= n) {
- if(mon > 1) {
- mon = mon - 1;
- } else {
- year = year - 1;
- mon = 12;
- }
- }
- d.setDate(d.getDate() - n);
- year = d.getFullYear();
- mon = d.getMonth() + 1;
- day = d.getDate();
- s = year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day);
- return s;
- };
- function changeTabCon() {
- var qsv = $qushiView.css('display'),
- lbv = $liebiaoView.css('display');
- if(qsv === 'block') {
- lbv.hide();
- }
- }
- //加载运动记录
- function querySportList(page, pagesize, begindate, enddate,code) {
- //拼请求内容
- var params = {};
- params.page = page;
- params.pagesize = pagesize;
- params.start = begindate + " 00:00:00";
- params.end = enddate + " 23:59:59";
- params.patient = code;
- return new Promise(function(resolve, reject) {
- //发送ajax请求
- sendPost("doctor/health_record/list_sports", params, function(res) {
- resolve(res)
- console.log(res);
- plus.nativeUI.closeWaiting();
- }, function(res) {
- plus.nativeUI.closeWaiting();
- if(res.status == 200) {
- resolve(res)
- } else {
- queryListFailed(res);
- }
- });
- })
- }
- //上拉加载数据
- function pullUpAction(theScrollerTemp) {
- $(".pullUp").show();
- setTimeout(function() {
- loadData();
- }, 1000);
- }
- function loadData() {
- page++;
- Promise.all([
- querySportList(page, pagesize, getBeforeDate(begindate, 1000), begindate,patientCode)
- ])
- .then(function(res) {
- var data = res[0];
- $(".pullUp").hide();
- if (data.list.length > 0) {
- $xyList.append(template('xyTmp', {
- data: data.list
- }));
- $('#no_result_wrap').hide()
- $('.j-control').show()
- scroller1.myScroll.refresh();
- } else {
- if(!isTrue) {
- $('.j-control').hide()
- $('#no_result_wrap').show()
- } else {
- mui.toast("暂无更多数据!");
- }
- }
- isTrue = true;
- })
- .catch(function(e) {
- console && console.error(e)
- });
- }
|