1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- var code,
- pre_info,
- table_tp_id,
- question_info;
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- code = self.code;
- table_tp_id = self.table_tp_id;
- pre_info = self.info; //获取前一个页面修改后的信息
- if(self.question_info){
- question_info = self.question_info;
- for(i=0;i<question_info.length; i++){
- var item = question_info[i];
- if(!item.optionArr){
- question_info[i].optionArr = item.options;
- }
- }
- var html = template("question_tmp", {list: question_info});
- $("#question_list").empty().append(html);
- $("#group1").hide();
- $("#group2").show();
- }else{
- getDetail();
- $("#group1").show();
- $("#group2").hide();
- }
- bindEvents();
- });
- template.helper("setType", function(str){
- if(str == 0){
- return "单选";
- }
- if(str == 1){
- return "多选";
- }
- if(str == 2){
- return "填空";
- }
- return "";
- });
- function getDetail(){
- var url = "/doctor/questionnaire/getTemplateDetail",
- params = {code: code};
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- question_info = res.data.questions; //保存当前模板中的问题信息
- for(i=0;i<question_info.length; i++){
- var item = question_info[i];
- if(!item.optionArr){
- question_info[i].optionArr = item.options;
- }
- }
- var html = template("question_tmp", {list: question_info});
- $("#question_list").empty().append(html);
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
- function bindEvents(){
- $("#edit_btn").on('click', function(){
- dialog({
- content: "该问卷问题包含逻辑跳转关系,继续修改则将删除所有逻辑跳转关系,且不可新增逻辑跳转。是否继续修改?",
- okValue: "继续修改",
- ok: function(){
- openWebview("edit_questions.html", {
- code: code,
- table_tp_id: table_tp_id,
- info: pre_info,
- question_info: question_info
- });
- },
- cancelValue: "我再看看",
- cancel:function(){}
- }).showModal();
- });
- $(".next_btn").on('click', function(){
- openWebview("choose_respondent.html", {
- code: code,
- pre_info: pre_info,
- question_info: question_info
- });
- });
- }
|