<script id="jp_on_list" type="text/template">
<tr orgNo="<%=epId%>" class="active">
<td class="title col_hide jpId">
<%=epId%>
</td>
<td class="title col_hide jpPosition">
<%=title%>
</td>
<td class="title">
<%=index%>
</td>
<td class="postyle"><i ></i>
<%=title%>
</td>
<td class="postyle"><i ></i>
<%=time%>
</td>
<td>
<span class="btn btn-default btn-menu jpBtn-modify" epId="<%=epId%>" content="<%=title%>" style="color: red;">添加评教试题</span>
<span class="btn btn-default btn-menu jpBtn-pub" epId="<%=epId%>" content="<%=title%>" style="color: red;">发布评教活动</span>
<span class="btn btn-default btn-menu jpBtn-modifytime" epId="<%=epId%>" content="<%=title%>" postDate="<%=postDate%>" deadline="<%=deadline%>" style="color: red;">修改评教时间</span>
</td>
</tr>
</script>
@RequestMapping("{schId}/listJP.do")
@ResponseBody
public JSONObject list(@PathVariable("schId") long schId ) {
try{
JSONObject jo = new JSONObject();
JSONArray ary = new JSONArray();
JSONArray ja = evaluationDao.getEvaluationPostByschId(schId);
if(ja.size() != 0){
int index = 0;
for (Object obj : ja) {
index = index + 1;
EvaluationPost post = (EvaluationPost)obj;
long epId = post.getEpId();
String title = post.getTitle();
String postDate = (post.getPostDate()).substring(0, 10);
String deadline = (post.getDeadline()).substring(0, 10);
String time = postDate +" 到 "+deadline;
JSONObject jso = new JSONObject();
jso.put("postDate", postDate);
jso.put("deadline", deadline);
jso.put("title", title);
jso.put("time", time);
jso.put("isActive", 1);
jso.put("index", index);
jso.put("epId", epId);
ary.add(jso);
}
}
jo.put("ary", ary);
return getSuccessResult(jo);
}catch(Exception e){
e.printStackTrace();
return getErrorResult(e.getMessage());
}
}
修改教评日期
var modifyJPtime = function() {
function init() {
$('.jpBtn-modifytime').click(function(e) {
$t = $(this);
var epId = $t.attr("epId");
var content = $t.attr("content");
var postDate = $t.attr("postDate");
var deadline = $t.attr("deadline");
$.blockUI({
message: $('.modal_jp_modifytime'),
overlayCSS: {
cursor: 'default',
borderkey: '0px'
},
css: {
cursor: 'default',
position: 'relative',
textAlign: 'left',
border: '0px'
}
});
$('.btn-apply-jp-modifytime').unbind("click");
$('.btn-apply-jp-modifytime').click(function() {
ZX.formSubmitByAjax(
$('.jpModifytimeForm'),
jpUrl.base + jpUrl.modifytime,
function() {
var note = noty({
text: "修改成功",
type: 'success',
killer: true,
timeout: 2000
});
list.init();
$.unblockUI();
},
function(r) {
var note = noty({
text: r.error,
type: 'error',
killer: true,
timeout: 2000
});
}
)
})
$('.btn-close-jp-modifytime').unbind("click");
$('.btn-close-jp-modifytime').click(function(e) {
$.unblockUI();
});
$(".jpModifytimeForm :input[name='epId']").val(epId);
$(".jpModifytimeForm :input[name='content']").val(content);
$(".jpModifytimeForm :input[name='postDate']").val(postDate);
$(".jpModifytimeForm :input[name='deadline']").val(deadline);
});
}
return {
init: function() {
init();
}
}
}();
<div class="modalWin modal_jp_modifytime row" style="display:none">
<div class="col-md-12 modal_content" style="margin-top: -20px;">
<h3 class="caption">修改评教时间</h3>
<form action="" class="form-horizontal jpModifytimeForm">
<div class="mw-panel-0 xk_new">
<div class="form-group">
<label class="control-label col-md-3">评教标题:</label>
<div class="col-md-4 input-group ">
<span class="input-group-addon"><i class="icon-file-alt"></i></span>
<input class="form-control" name="content" type="text" >
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">评价开始日期:</label>
<div class="col-md-4 input-group deadlineDateDiv">
<span class="input-group-addon"><i class="icon-calendar"></i></span>
<input type="text" name="postDate" value="" class="form-control deadline_date" />
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">评价截止日期:</label>
<div class="col-md-4 input-group deadlineDateDiv">
<span class="input-group-addon"><i class="icon-calendar"></i></span>
<input type="text" name="deadline" value="" class="form-control deadline_date" />
</div>
</div>
<input type="hidden" name="epId" value="">
</div>
</form>
<div class="mw-btn">
<button class="btn btn-success btn-apply-jp-modifytime">提交</button>
<button class="btn btn-warning btn-close-jp-modifytime">取消</button>
</div>
</div>
</div>
@RequestMapping(value="/modifytime.do", method=RequestMethod.POST )
@ResponseBody
public JSONObject modifytime(@Context HttpServletRequest request, @RequestBody String jsonString) {
logger.debug( "MODIFY JP ,INFO IS: " + jsonString);
if( jsonString.isEmpty()){
return getErrorResult( null);
}
JSONObject jObt = JSONObject.parseObject( jsonString);
long epId = jObt.getLongValue("epId");
String title = jObt.getString("content");
String postDate = jObt.getString("postDate")+" 00:00:00";
String deadline = jObt.getString("deadline")+" 23:59:59";
try{
evaluationDao.updatePostTime(epId, title, postDate, deadline);
return getSuccessResult(null);
}catch(Exception e){
e.printStackTrace();
return getErrorResult(e.getMessage());
}
}
<update id="updatePostTime">
update te_evaluation_post set title=#{title}, postDate=#{postDate}, deadline=#{deadline} where epId=#{epId}
</update>