mirror of
https://gitee.com/wkeyuan/DWSurvey.git
synced 2024-12-02 03:58:23 +08:00
点击问卷二级菜单后其它菜单项显示,更换日期时间控件
This commit is contained in:
parent
1afe52f850
commit
34656e756c
@ -0,0 +1,40 @@
|
||||
package com.key.common.utils.web;
|
||||
|
||||
import net.sf.json.JsonConfig;
|
||||
import net.sf.json.processors.JsonValueProcessor;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class JsonDateValueProcessor implements JsonValueProcessor {
|
||||
|
||||
private String format = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
public JsonDateValueProcessor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JsonDateValueProcessor(String format) { // 自己需要的格式
|
||||
super();
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object processArrayValue(Object value, JsonConfig paramJsonConfig) {
|
||||
return process(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object processObjectValue(String key, Object value, JsonConfig paramJsonConfig) {
|
||||
return process(value);
|
||||
}
|
||||
|
||||
private Object process(Object value) {
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
|
||||
return sdf.format(value);
|
||||
}
|
||||
return value == null ? "" : value.toString();
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.key.dwsurvey.action.survey;
|
||||
import com.key.common.base.action.CrudActionSupport;
|
||||
import com.key.common.base.entity.User;
|
||||
import com.key.common.base.service.AccountManager;
|
||||
import com.key.common.utils.web.JsonDateValueProcessor;
|
||||
import com.key.common.utils.web.Struts2Utils;
|
||||
import com.key.dwsurvey.entity.SurveyDirectory;
|
||||
import com.key.dwsurvey.service.SurveyDirectoryManager;
|
||||
@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 我的问卷 action
|
||||
@ -30,7 +32,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
})
|
||||
@AllowedMethods({"surveyState","attrs"})
|
||||
public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
|
||||
|
||||
|
||||
@Autowired
|
||||
private SurveyDirectoryManager surveyDirectoryManager;
|
||||
@Autowired
|
||||
@ -46,7 +48,7 @@ public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
|
||||
page=surveyDirectoryManager.findByUser(page,entity);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
public String delete() throws Exception {
|
||||
HttpServletResponse response=Struts2Utils.getResponse();
|
||||
String result="false";
|
||||
@ -66,7 +68,7 @@ public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
|
||||
response.getWriter().write(result);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//问卷壮态设置
|
||||
public String surveyState() throws Exception{
|
||||
HttpServletResponse resp=Struts2Utils.getResponse();
|
||||
@ -89,7 +91,7 @@ public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
|
||||
resp.getWriter().write(result);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String attrs() throws Exception {
|
||||
@ -98,21 +100,24 @@ public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
|
||||
try{
|
||||
SurveyDirectory survey=surveyDirectoryManager.getSurvey(id);
|
||||
JsonConfig cfg = new JsonConfig();
|
||||
cfg.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor());
|
||||
cfg.setExcludes(new String[]{"handler","hibernateLazyInitializer"});
|
||||
JSONObject jsonObject=JSONObject.fromObject(survey,cfg);
|
||||
|
||||
|
||||
response.getWriter().write(jsonObject.toString());
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void prepareModel() throws Exception {
|
||||
entity=surveyDirectoryManager.getModel(id);
|
||||
}
|
||||
|
||||
|
||||
public void prepareSurveyState() throws Exception {
|
||||
prepareModel();
|
||||
}
|
||||
@ -120,5 +125,5 @@ public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
|
||||
public void prepareExecute() throws Exception {
|
||||
prepareModel();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import java.util.Date;
|
||||
@InterceptorRefs({ @InterceptorRef("paramsPrepareParamsStack")})
|
||||
@Results({})
|
||||
public class MySurveyStyleAction extends CrudActionSupport<SurveyStyle, String>{
|
||||
|
||||
|
||||
private String surveyId;
|
||||
@Autowired
|
||||
private SurveyStyleManager surveyStyleManager;
|
||||
@ -38,14 +38,15 @@ public class MySurveyStyleAction extends CrudActionSupport<SurveyStyle, String>{
|
||||
private SurveyDirectoryManager surveyDirectoryManager;
|
||||
@Autowired
|
||||
private AccountManager accountManager;
|
||||
|
||||
|
||||
public String save() throws Exception {
|
||||
|
||||
return NONE;
|
||||
}
|
||||
|
||||
|
||||
public String ajaxGetStyle() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,8 @@
|
||||
<script type="text/javascript" src="${ctx }/js/plugs/jquery-ui-1.10.3.custom/js/jquery-1.10.1.js"></script>
|
||||
<script type="text/javascript" src="${ctx }/js/plugs/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js"></script>
|
||||
<script type="text/javascript" src="${ctx }/js/dw/responsive-width.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="${ctx }/js/plugs/My97DatePickerBeta/My97DatePicker/WdatePicker.js"></script>
|
||||
<%--<script language="javascript" type="text/javascript" src="${ctx }/js/plugs/My97DatePickerBeta/My97DatePicker/WdatePicker.js"></script>--%>
|
||||
<script language="javascript" type="text/javascript" src="${ctx }/js/plugs/laydate/laydate.js"></script>
|
||||
<sitemesh:write property='head' />
|
||||
<link href="${ctx }/css/dw-user.css" rel="stylesheet" type="text/css" />
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
@ -21,8 +22,8 @@
|
||||
<input type="hidden" id="ctx" name="ctx" value="${ctx }">
|
||||
<%@ include file="/WEB-INF/page/layouts/header.jsp"%>
|
||||
<sitemesh:write property='body' />
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="dw_foot" style="padding-top:20px;">
|
||||
<%@ include file="/WEB-INF/page/layouts/footer-1.jsp"%>
|
||||
|
||||
@ -34,12 +35,12 @@
|
||||
</div>
|
||||
<!-- 必须保留声明 end -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<%@ include file="/WEB-INF/page/layouts/other.jsp"%>
|
||||
<script type="text/javascript">
|
||||
resizeBodyWidth();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -61,34 +61,35 @@ $(document).ready(function(){
|
||||
$("#myDialogRoot").remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//设置收集规则
|
||||
$(".sur_collectSet").unbind();
|
||||
$(".sur_collectSet").click(function(){
|
||||
var url=ctx+"/js/dw/html/collectset.html";
|
||||
|
||||
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:"get",
|
||||
dataType:"html",
|
||||
success:function(data){
|
||||
|
||||
|
||||
//$("body").append("<div id=\"myDialogRoot\"><div class='dialogMessage'></div></div>");
|
||||
$("body").append("<div id=\"myDialogRoot\">"+data+"</div>");
|
||||
$("#myDialogRoot .mailOnlyItem").hide();
|
||||
|
||||
|
||||
url=ctx+"/design/my-survey!attrs.action";
|
||||
var data="id="+$("#id").val();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url:url,
|
||||
data:data,
|
||||
type:'post',
|
||||
success:function(msg){
|
||||
|
||||
// console.debug(msg);
|
||||
|
||||
var survey=eval("("+msg+")");
|
||||
$("#myDialogRoot input[name='effective'][value='"+survey.surveyDetail.effective+"']").attr("checked",true);
|
||||
$("#myDialogRoot input[name='effectiveIp'][value='"+survey.surveyDetail.effectiveIp+"']").attr("checked",true);
|
||||
@ -99,16 +100,14 @@ $(document).ready(function(){
|
||||
$("#myDialogRoot input[name='ynEndNum'][value='"+survey.surveyDetail.ynEndNum+"']").attr("checked",true);
|
||||
$("#myDialogRoot input[name='endNum']").val(survey.surveyDetail.endNum);
|
||||
$("#myDialogRoot input[name='ynEndTime'][value='"+survey.surveyDetail.ynEndTime+"']").attr("checked",true);
|
||||
if(survey.surveyDetail.endTime!="null"){
|
||||
$("#myDialogRoot input[name='endTime']").val(survey.surveyDetail.endTime);
|
||||
}
|
||||
$("#myDialogRoot input[name='endTime']").val(survey.surveyDetail.endTime);
|
||||
$("#myDialogRoot input[name='showShareSurvey'][value='"+survey.surveyDetail.showShareSurvey+"']").attr("checked",true);
|
||||
$("#myDialogRoot input[name='showAnswerDa'][value='"+survey.surveyDetail.showAnswerDa+"']").attr("checked",true);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var myDialog=$( "#myDialogRoot" ).dialog({
|
||||
width:550,
|
||||
height:490,
|
||||
@ -140,6 +139,10 @@ $(document).ready(function(){
|
||||
}
|
||||
},
|
||||
open:function(event,ui){
|
||||
laydate.render({
|
||||
elem: '#surveyEndTime' //指定元素
|
||||
,type: 'datetime'
|
||||
});
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
},
|
||||
close:function(event,ui){
|
||||
@ -148,16 +151,16 @@ $(document).ready(function(){
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function saveAttrs(){
|
||||
|
||||
var url=ctx+"/design/my-survey-style!save.action";
|
||||
var url=ctx+"/design/my-survey-design!ajaxSave.action";
|
||||
var surveyId=$("#id").val();
|
||||
var data="surveyId="+surveyId;
|
||||
//收集规则
|
||||
//收集规则
|
||||
var effective=$("#myDialogRoot input[name='effective']:checked")[0]?"4":"0";
|
||||
var effectiveIp=$("#myDialogRoot input[name='effectiveIp']:checked")[0]?"1":"0";
|
||||
var rule=$("#myDialogRoot input[name='rule']:checked")[0]?"3":"0";
|
||||
@ -170,11 +173,11 @@ $(document).ready(function(){
|
||||
var endNum=$("#myDialogRoot input[name='endNum']").val();
|
||||
var showShareSurvey=$("#myDialogRoot input[name='showShareSurvey']:checked")[0]?"1":"0";
|
||||
var showAnswerDa=$("#myDialogRoot input[name='showAnswerDa']:checked")[0]?"1":"0";
|
||||
|
||||
|
||||
data+="&effective="+effective+"&effectiveIp="+effectiveIp+"&rule="+rule+"&refresh="+refresh+"&ruleCode="+ruleCode+"&mailOnly="+mailOnly;
|
||||
data+="&ynEndNum="+ynEndNum+"&ynEndTime="+ynEndTime+"&endTime="+endTime+"&endNum="+endNum;
|
||||
data+="&showShareSurvey="+showShareSurvey+"&showAnswerDa="+showAnswerDa;
|
||||
|
||||
|
||||
$.ajax({
|
||||
url : url,
|
||||
data : data,
|
||||
@ -186,12 +189,12 @@ $(document).ready(function(){
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
$(".sur_edit").unbind();
|
||||
$(".sur_edit").click(function(){
|
||||
//${ctx }/design/my-survey-design.action?surveyId=${surveyId}
|
||||
|
||||
|
||||
$("body").append("<div id=\"myDialogRoot\"><div class='dialogMessage'>您问卷已经发布,确认要重新编辑使问卷回到设计状态。<br/>是否确认返回设计状态!</div></div>");
|
||||
var myDialog=$( "#myDialogRoot" ).dialog({
|
||||
width:500,
|
||||
@ -229,10 +232,10 @@ $(document).ready(function(){
|
||||
$("#myDialogRoot").remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$(".surveyStateBtn").unbind();
|
||||
$(".surveyStateBtn").click(function(){
|
||||
//var thVal=$("#surveyState").val();
|
||||
@ -272,7 +275,7 @@ $(document).ready(function(){
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function notify(msg,delayHid) {
|
||||
@ -301,4 +304,4 @@ function notify(msg,delayHid) {
|
||||
}, function() {
|
||||
$( this ).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
<div class="p_DialogContent" >
|
||||
<div class="p_DialogContentTitle">何时结束</div>
|
||||
<div class="p_DialogContentRoot">
|
||||
<div class="p_DialogContentItem"><label><input type="checkbox" name="ynEndNum" value="1"> 收集到 <input type="text" size="12" class="inputSytle_1" name="endNum"> 份答卷时结束</label></div>
|
||||
<div class="p_DialogContentItem"><label><input type="checkbox" name="ynEndTime" value="1"> 到 <input type="text" size="20" class="inputSytle_1 Wdate" onfocus="WdatePicker({minDate:'%y-%M-{%d+1}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="endTime"> 时结束 </label></div>
|
||||
<div class="p_DialogContentItem"><label><input type="checkbox" name="ynEndNum" value="1"> 收集到 <input type="text" size="12" class="inputSytle_1" name="endNum" style="padding: 6px;" > 份答卷时结束</label></div>
|
||||
<div class="p_DialogContentItem"><label><input type="checkbox" name="ynEndTime" value="1"> 到 <input type="text" size="20" class="inputSytle_1" name="endTime" id="surveyEndTime" style="padding: 6px;" > 时结束 </label></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
@ -29,4 +29,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
// $(".createSsUl li").unbind();
|
||||
//
|
||||
//
|
||||
// $(".createSsUl li").hover(function(){
|
||||
// if(toggleTag){
|
||||
// toggleTag=false;
|
||||
@ -32,10 +32,10 @@ $(document).ready(function(){
|
||||
// $(".a-w-sel").slideUp("slow",function(){
|
||||
// toggleTag=true;
|
||||
// });
|
||||
//
|
||||
//
|
||||
// return false;
|
||||
// });
|
||||
|
||||
|
||||
var toggleTag=true;
|
||||
$(".clickHideUserMenu,.clickHideMenu").unbind();
|
||||
$(".clickHideUserMenu,.clickHideMenu").click(function(){
|
||||
@ -52,22 +52,26 @@ $(document).ready(function(){
|
||||
});
|
||||
$(".a-w-sel").not(stepLi.find(".a-w-sel")).slideUp();
|
||||
*/
|
||||
stepLi.find(".a-w-sel").slideToggle(0,function(){
|
||||
if(stepLi.find(".a-w-sel")[0]){
|
||||
stepLi.find(".a-w-sel").slideToggle(0,function(){
|
||||
toggleTag=true;
|
||||
});
|
||||
}else{
|
||||
toggleTag=true;
|
||||
});
|
||||
}
|
||||
//$(".a-w-sel").not(stepLi.find(".a-w-sel")).slideUp();
|
||||
$(".a-w-sel").not(stepLi.find(".a-w-sel")).hide();
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(document).click(function(){
|
||||
//$(".a-w-sel").slideUp("slow");
|
||||
$(".a-w-sel").hide();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
var browseWidth=$(window).width();
|
||||
var browseHeight=$(window).height();
|
||||
@ -99,4 +103,4 @@ function refreshAutoCode(codeImgId){
|
||||
function currentMenu(menuId){
|
||||
$(".dw-menu-a").removeClass("active");
|
||||
$("#"+menuId).addClass("active");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user