123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- var code,
- remind = true; //提醒状态,当反馈人数=调查总人数,提醒状态为false
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- code = self.code;
- getDetail();
- bindEvents();
- });
- function getDetail(){
- var url = "/doctor/questionnaire/getQuestionnaireSummary",
- params = {id: code};
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- var status = res.data.status; //问卷状态 1正常 2暂停
- if(status == 1){
- $("#group1").show();
- $("#group2").hide();
- }else{
- $("#group2").show();
- $("#group1").hide();
- }
- if(res.data.complete == res.data.amount){
- remind = false;
- }else{
- remind = true;
- }
-
- $.extend(res.data.surveyTarget, {
- sex_text: res.data.surveyTarget.sex?res.data.surveyTarget.sex.join(""):"不限",
- healthCondition_text : res.data.surveyTarget.healthCondition?res.data.surveyTarget.healthCondition.join("、"):"不限",
- disease_text : res.data.surveyTarget.disease?res.data.surveyTarget.disease.join("、"):"不限",
- service_text : res.data.surveyTarget.service?res.data.surveyTarget.service.join("、"):"不限"
- });
-
- var html = template("info_tmp", res.data);
- $("#info_panel").empty().append(html);
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
- function changeStatus(status){
- plus.nativeUI.showWaiting();
- var url = "/doctor/questionnaire/modifyQuestionnaireStatus";
- sendGet(url, {id: code}, null, function(res){
- if(res.status == 200){
- if(status == 0){
- //停止调查
- $("#group1").hide();
- $("#group2").show();
- mui.toast("关闭问卷成功");
- }else{
- //启动调查
- $("#group2").hide();
- $("#group1").show();
- mui.toast("启动问卷成功");
- }
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
-
- }
- function bindEvents(){
- $(".view-btn").on('click', function(){
- openWebview("survey_result.html", {code: code});
- });
-
- $(".remind-btn").on('click', function(){
- if(!remind){
- dialog({
- content: "所有居民均已反馈",
- okValue: "我知道了",
- ok: function(){},
- cancel: false
- }).showModal();
- }else{
- dialog({
- content: "是否提醒全部未作答居民?",
- okValue: "立即提醒",
- ok: function(){
- plus.nativeUI.showWaiting();
- var url = "/doctor/questionnaire/remindAnswer",
- params = {code: code};
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- mui.toast(res.msg);
- //将反馈人数设置为调查人数
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
- },
- cancelValue: "不了,谢谢",
- cancel: function(){}
- }).showModal();
- }
- });
-
- $(".stop-btn").on('click', function(){
- dialog({
- content: "是否确认停止调查?暂停后,居民将无法作答",
- okValue: "立即停止",
- ok: function(){
- changeStatus(0);
- },
- cancelValue: "不了,谢谢",
- cancel: function(){}
- }).showModal();
- });
-
- $(".start-btn").on('click', function(){
- dialog({
- content: "是否确认重新启动调查?启动后,居民将可继续作答",
- okValue: "立即启动",
- ok: function(){
- changeStatus(1);
- },
- cancelValue: "不了,谢谢",
- cancel: function(){}
- }).showModal();
- });
-
- $("body").on('click', '.view_detail', function(){
- openWebview("survey_detail.html", {code: code});
- });
- }
|