var pro_id, self, prescriptionCode, followupid, project_data; var $form = $("#question_form"); var initPage = function(){ var classes; prescriptionCode = self.prescriptionCode; followupid = self.followupid; project_data = gTemplate[pro_id]; var nameObj = {1:'症状',2:'体征及生活方式问卷'} $('#title').text(nameObj[pro_id]) if(pro_id == 1){classes='1'} if(pro_id == 2){classes='2,4'} var params = { prescriptioncode:prescriptionCode, followupProject:classes } plus.nativeUI.showWaiting(); sendGet('doctor/prescription/followupcontent/getinfo', params,function(){ plus.nativeUI.closeWaiting(); mui.toast('请求失败') }, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ if(! $.isEmptyObject(res.data)){ for(var key in project_data){ project_data[key].value = res.data[key]; } console.log(project_data) var html = template("item", {data:project_data}) $form.append(html); bindEvents() } } }) }, bindEvents = function(){ $("#save").on("tap", function(){ if(! followupid){ mui.toast('随访创建失败,请重新登记') return } var params = { followupid:followupid, prescriptioncode:prescriptionCode, type:pro_id } plus.nativeUI.showWaiting(); sendPost('doctor/prescription/followupcontent/importfollowupcontent', params,function(){ plus.nativeUI.closeWaiting(); mui.toast('请求失败') }, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ mui.toast('成功填入随访记录') setTimeout(function(){ mui.back() },1000) }else{ mui.toast(res.msg) } }) }) } mui.plusReady(function(){ self = plus.webview.currentWebview(); pro_id = self.pro_id; //初始化页面内容 initPage(); })