function finishSurvey(){ var flag = true; $('input[name="finishAnswers"]').each(function(a,b){ if(!$(b).is(':checked')){ layer.msg("还有遗留问题未处理!"); window.location.hash=b.id; flag = false; return false; } }); if(flag == false) return; if($(".end-sign-in").is(":hidden")){ layer.msg("请先签到!"); return; } var signImgPath = $("#signImgPath").val(); if(signImgPath =="") layer.msg("客户经理请签名确认!"); else{ layer.confirm("确定提交勘查结果吗?提交后将不可更改!", { title:"勘查结果提交", btn: ['确定','取消'] //按钮 }, function(){ var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); $.ajax({ type : 'POST', url : baseUrl + "/wechat/survey/finishSurvey", data : $("#inputForm").serialize(), dataType : "json", // async :false, success : function(data) { layer.close(loadIndex); layer.msg(data.message); if(data.status == "200"){ var planId = $("#planId").val(); window.location.assign(baseUrl + "/wechat/survey/siteSurveyView/"+planId); } }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); }, function(){ }); } } function removePhoto(photoId) { layer.confirm("确定删除此照片?", { btn: ['确定','取消'] //按钮 }, function(){ var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); $.ajax({ type : 'POST', url : baseUrl + "/wechat/survey/removePhoto", data : { "photoId" : photoId }, dataType : "json", async : false, success : function(data) { layer.close(loadIndex); layer.msg(data.message); if (data.status == 200) $("#photo" + photoId).remove(); }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); }, function(){ }); } function findSurveyQuestion(){ var taskId = $("#taskId").val(); if(taskId == ""){ layer.msg("请选择勘查项目"); return; } var time = $("#time").val(); if(time == ""){ layer.msg("请选择勘查次数"); return; } url = baseUrl + "/wechat/survey/findSurveyQuestion"; var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); $.ajax({ type : 'POST', url : url, data : $("#inputForm").serialize(), dataType : "text", // async :false, success : function(data) { layer.close(loadIndex); $("#siteSurveyDetail").html(data); $("#siteSurveyDetail").show(); }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); } function getMyLocationAndSign() { var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); var geolocation = new BMap.Geolocation();// 定位当前位置 geolocation.getCurrentPosition(function(r) { if (this.getStatus() == BMAP_STATUS_SUCCESS) { var planId = $("#planId").val(); $.ajax({ type : 'POST', url : baseUrl + "/wechat/user/userSign.json", data : { "planId":planId, "latitude":r.point.lat, "longitude":r.point.lng }, async :false, dataType : "json", success : function(data) { layer.close(loadIndex); layer.msg(data.message); $(".sign-in").hide(); $(".end-sign-in").show(); }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); } else { layer.msg('failed' + this.getStatus()); } }, { enableHighAccuracy : true }) } function createQuestion(questionnaireId){ window.location.assign(baseUrl + "/wechat/question/createQuestion/init/"+questionnaireId); } function changeTask(){ var taskId = $("#taskId").val(); getSurveyTime(taskId); } function getSurveyTime(taskId){ var oldPlanTime = $("#oldPlanTime").val(); $("#time").empty(); $("#time").append(""); if(taskId != ""){ var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); $.ajax({ type : 'POST', url : baseUrl + "/wechat/task/findSurveyPlanListByTaskIdForSiteSurvey.json", data : {"taskId":taskId}, async :false, dataType : "json", success : function(data) { var plans = data.plans; for(var i=0;i第"+plans[i].time+"次勘查"; $("#time").append(option); } layer.close(loadIndex); }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); } } function changeTime(){ var time=$("#time").val(); $("#surveyStep").val(""); $("#showSurveyStep").html(""); if(time !=""){ var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); var taskId=$("#taskId").val(); $("#siteSurveyDetail").hide(); $.ajax({ type : 'POST', url : baseUrl + "/wechat/survey/findSurveyStepByTaskIdAndTime.json", data : {"taskId":taskId, "time":time }, dataType : "json", success : function(data) { $("#showSurveyStep").html(data.stepName); $("#showCmsAddress").html(data.cmsAddress); layer.close(loadIndex); }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); } } function showNewQuestion(questionId,questionIndex,question) { var newQuestion = '
'; newQuestion = newQuestion +'
'; newQuestion = newQuestion +'
'; newQuestion = newQuestion +' '+questionIndex+'、'+question+''; newQuestion = newQuestion +' '; newQuestion = newQuestion +'
'; newQuestion = newQuestion +'
'; newQuestion = newQuestion +' '; newQuestion = newQuestion +'
'; newQuestion = newQuestion +'
'; newQuestion = newQuestion +'
'; $("#supplementArea").append(newQuestion); } function removeQuestion(questionId) { layer.confirm("确定删除此问题?删除后将不可恢复", { title:"删除问题", btn: ['确定','取消'] //按钮 }, function(){ var loadIndex = layer.load(0, {shade: [0.3,'#808080']}); $.ajax({ type : 'POST', url : baseUrl + "/wechat/survey/removeQuestion.json", data : { "questionId":questionId }, dataType : "json", async :false, success : function(data) { layer.close(loadIndex); layer.msg(data.message); if(data.status =="200"){ $("#question" + questionId).remove(); } }, error: function(e) { layer.close(loadIndex); layer.msg(e); } }); }, function(){ }); }