123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- var page = 1,
- pageSize = 100,
- patientCode;
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- patientCode = self.patientCode;
-
- getPatientDeviceList(true);
- initScroller();
- bindEvents();
- })
- function getPatientDeviceList(isInit){
- if(isInit){
- page = 1;
- }
- var url = "doctor/device/PatientDeviceList",
- params = {
- page: page,
- pagesize: pageSize,
- patient: patientCode
- };
-
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- var list = res.data;
- if(list.length == 0){
- if(isInit){
- $("#deviceList").empty().hide();
- $("#no_result_wrap").show();
- }else{
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
- }
- }else{
- $("#deviceList").show();
- $("#no_result_wrap").hide();
- var html = template("device-tmp", {list: list});
- if(isInit){
- $("#deviceList").empty().append(html);
- }else{
- $("#deviceList").append(html);
- }
-
- if(list.length < pageSize){
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
- }else{
- mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(false);
- }
- }
- }else{
- mui.toast(res.msg)
- }
- }, true);
- }
- function bindEvents(){
- template.helper("getBindUser", function(obj){
- if(obj.doctor){
- return obj.doctorName;
- }else{
- return "患者绑定";
- }
- });
-
- template.helper("getJsonStr", function(obj){
- return JSON.stringify(obj);
- });
-
- template.helper("getPhoto", function(str){
- return getImgUrl(str);
- });
-
- $("#deviceList").on('tap', ".device-box", function(){
- var $this = $(this),
- jsonObj = $this.data("json");
- if(jsonObj.type==1){
- mui.openWindow('../../wdsb/html/view-xuetangyi.html', 'view-xuetangyi.html', {
- extras: {
- deviceId: jsonObj.deviceId,
- dataId: jsonObj.code,
- patient: patientCode,
- role: jsonObj.role
- }
- })
- }else if(jsonObj.type==2){
- mui.openWindow('../../wdsb/html/view-xueyaji.html', 'view-xueyaji.html', {
- extras: {
- deviceId: jsonObj.deviceId,
- dataId: jsonObj.code,
- patient: patientCode,
- role: jsonObj.role
- }
- })
- }
- })
- }
- function initScroller(){
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
-
- mui(".mui-scroll-wrapper").pullRefresh({
- down:{
- callback: function(){
- getPatientDeviceList(true);
- this.endPulldownToRefresh();
- }
- },
- up: {
- callback: function(){
- getPatientDeviceList(false);
- }
- }
- })
- }
|