本文主要是介绍在实现回显功能模块的时候,把ID设置成全局变量了,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在hsapprove.jsp中:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">function edittodayhs(hsid){//alert(hsid);//alert("会商情况");window.hsids = hsid;//var url = "static/pop/edittodaysub.html";var url = "static/pop/ediths.html";$.get(url, function(data){$("#poptodaymeetDiv").html(data);BUI.use('bui/overlay',function(Overlay){dialog = new Overlay.Dialog({title:'审批会商情况',width:700,height:600,mask:true,closeAction : 'destroy',//每次关闭dialog释放buttons:[],contentId:'poptodaymeetDiv'});dialog.show();}); });}
</script>
<div class="panel panel-info" ><div class="panel-header panel-header-index clearfix" ><h3 class="pull-left">值班领导会商审批</h3></div><div class="panel-body" style="border: 0;padding: 8px;"><c:if test="${fn:length(indexHs) <= 0 }"><div class="tips tips-small tips-info span6"><span class="x-icon x-icon-small x-icon-info"><iclass="icon icon-white icon-info"></i></span><div class="tips-content">暂无审批</div></div></c:if><c:if test="${fn:length(indexHs) > 0 }"><table cellspacing="0" class="table table-condensed" style="margin-bottom: 0px;font-size: 14px;"><tbody><c:forEach items="${indexHs }" varStatus="v" var="hs"><tr><td style="text-align: center;vertical-align:middle;"><span class="badge badge-error">${v.index +1}</span></td><td style="text-align: left;"><a style="cursor: pointer;" οnclick="edittodayhs('${hs.hsid}')" >${hs.con } (${hs.mman } ${hs.ddatetime })</a></td></tr></c:forEach></tbody></table></c:if></div>
</div>
在ediths.html中: <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>审批会商情况</title>
<style>.bui-select .bui-select-input{width:420px;}.bui-select-list{overflow: auto;overflow-x: hidden;max-height: 250px;_height : 150px;text-align:left;};
</style><script type="text/javascript">BUI.use('bui/calendar',function(Calendar){var datepicker = new Calendar.DatePicker({trigger:'.calendar',autoRender : true});});</script>
<script type="text/javascript">
var dialog = null;$(document).ready(function(){//alert("全局变量会商id" + window.hsids);var hsid = window.hsids;//alert(hsid);$.ajax({type: "POST",//url: path+"/pop/nowTodayMeet2",url: path+"/pop/hsapprove", //会商审批data : {hsid:hsid},dataType: "json",success: function(data){$("#hsid").val(data.hsid);$("#mman").val(data.mman);$("#discussTopicsEdit").val(data.distopics);$("#metOp_Date").val(data.metdate);$("#verdict").val(data.verdict);$("#reason").val(data.reason);//alert(data.part);//alert(data.nopartreason);$("input[name=part][value="+data.part+"]").attr("checked",true);//$("input[name=nopartreason][value="+data.nopartreason+"]").attr("checked",true);//$("input[name='part'][value='data.part']").attr("checked",true);//$("input[name='part']").attr("checked",'0');//$("input[type=radio]").attr("checked",'0');//$("input[name='nopartreason'][value='data.nopartreason']").attr("checked",true);$("#nopartreason2").val(data.nopartreason2);}});//审批通过$("#submitApproveOk").click(function(){var hsid = $("#hsid").val();var mman = $("#mman").val();var content = $("#discussTopicsEdit").val(); //主题var metOpDate = $("#metOp_Date").val(); //会商时间var verdict = $("#verdict").val(); //预报结论var reason = $("#reason").val(); //预报理由var part = $("input[name='part']:checked").val();//是否参加var nopartreason = $("input[name='nopartreason']:checked").val();var nopartreason2 = $("#nopartreason2").val(); //其它$.ajax({type: "POST",url: path+"/pop/islogin",dataType: "json",success: function(data){if(data.flag==1){$.ajax({type: "POST",//url: path+"/pop/subjecttoday",url: path+"/pop/hsApproveOk", //审批通过方法data: {hsid:hsid,content:content,metOpDate:metOpDate,verdict:verdict,reason:reason,part:part,nopartreason:nopartreason,nopartreason2:nopartreason2},dataType: "json",success: function(msg){if(msg.msg == "OK") {dialog.close( );// complete(newrtid,null,null,newrole);alert( "审批通过成功!");//刷新主页面window.location.reload();} else {alert( "审批通过失败!");}}});return false;}else{alert("请值班领导登录!")}}});});//审批不通过$("#submitApproveNo").click(function(){var hsid = $("#hsid").val();var content = $("#discussTopicsEdit").val(); //主题var metOpDate = $("#metOp_Date").val(); //会商时间var verdict = $("#verdict").val(); //预报结论var reason = $("#reason").val(); //预报理由var part = $("input[name='part']:checked").val();//是否参加var nopartreason = $("input[name='nopartreason']:checked").val();var nopartreason2 = $("#nopartreason2").val(); //其它$.ajax({type: "POST",url: path+"/pop/islogin",dataType: "json",success: function(data){if(data.flag==1){$.ajax({type: "POST",//url: path+"/pop/subjecttoday",url: path+"/pop/hsApproveNo", //审批不通过方法data: {hsid:hsid,content:content,metOpDate:metOpDate,verdict:verdict,reason:reason,part:part,nopartreason:nopartreason,nopartreason2:nopartreason2},dataType: "json",success: function(msg){if(msg.msg == "OK") {dialog.close( );// complete(newrtid,null,null,newrole);alert( "审批不通过成功!");//刷新主页面window.location.reload();} else {alert( "审批不通过失败!");}}});return false;}else{alert("请值班领导登录!")}}});});});
</script>
</head>
<body><input id="hsid" type="hidden"><div class="row" style="height: 195px;"><div class="span24 doc-content" style="height: 295px;"><form class="form-horizontal" style="font-size:14px;"><div class="row show-grid" style="height: 100px;"><div class="span8" style="height: 80px;width:650px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">会商主题:</label><div class="controls control-row4"><textarea id="discussTopicsEdit" style="height: 80px; width: 450px;" disabled="true"></textarea></div></div></div><div class="row show-grid" style="height: 20px;"><div class="span8" style="height: 40px;width:650px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">会商人员:</label><div class="controls control-row4"><textarea id="mman" style="height: 20px; width: 100px;" disabled="true"></textarea></div></div></div><div class="row show-grid" style="height: 100px;"><div class="span8" style="height: 80px;width:650px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">预报结论:</label><div class="controls control-row4"><textarea id="verdict" style="height: 60px; width: 450px;" disabled="true"></textarea></div></div></div><div class="row show-grid" style="height: 100px;"><div class="span8" style="height: 80px;width:650px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">预报理由:</label><div class="controls control-row4"><textarea id="reason" style="height: 60px; width: 450px;" disabled="true"></textarea></div></div></div><div class="row show-grid" ><div class="span8" style="width:650px;height:50px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">会商日期:</label><div class="controls control-row4"><input id="metOp_Date" type="text" class="calendar" style="font-size: 14px;width:100px;" disabled="true"></div></div><div class="span8" style="width:650px;height:50px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">是否参加:</label><div class="controls control-row4"><label><input name="part" id="part" type="radio" value="1" style="width:20px" disabled="true"/>参加</label> <label><input name="part" id="part" type="radio" value="0" style="width:20px" disabled="true"/>不参加</label> </div></div><div class="span8" style="width:650px;height:50px;"><label class="control-label" style="padding-left: 5px;text-align: right;width:100px">不参加理由:</label><div class="controls control-row4"><!-- <label><input name="nopartreason" id="nopartreason" type="radio" value="1" style="width:20px"/>补休</label> <label><input name="nopartreason" id="nopartreason" type="radio" value="2" style="width:20px"/>开会</label> <label><input name="nopartreason" id="nopartreason" type="radio" value="3" style="width:20px"/>出差</label> --><label><input id="nopartreason2" type="text" style="font-size: 14px;width:450px;" disabled="true"></label></div></div></div></form><div class="row show-grid" style="padding-left: 170px;"><div class="span8"><button class="button button-primary" id="submitApproveOk">审批通过</button><button class="button button-primary" id="submitApproveNo">审批不通过</button></div></div></div></div>
</body>
</html>
Java代码:
@RequestMapping(value = "/hsApproveOk")public @ResponseBody String hsApproveOk(HttpServletRequest request, HttpServletResponse response) throws Exception {ResMessage message = ResMessageFactory.getDefaultInstance(request);JSONObject jsonObject = new JSONObject();try {LUser user = (LUser) request.getSession().getAttribute("user");String hsid = request.getParameter("hsid");Assert.notNull(user, "请登录!");EntityManager entityManager = dao.getEntityManager();String sqlHs = "update T_SUBJECT set state=?,mdate=sysdate where hsid = ?";List<Object> list = new ArrayList<Object>();list.add("0");list.add(hsid);int num = ybzxTwoService.updateByList(sqlHs, list, entityManager);if(num>0) {jsonObject.put("msg", "OK");this.setSuccess(message);}else {jsonObject.put("msg", "Error");this.setSuccess(message);}} catch (Exception e) {log.error(e.getMessage(), e);jsonObject.put("msg", "Error");this.setError(this.getClass(), message, e.getMessage(), request);}return jsonObject.toString();}
注:
设置全局变量;window.hsids = hsid;
在另外一个方法中得到:var hsid = window.hsids;
通过ajax传入参数:
data : {
hsid:hsid
},
hsid:hsid
},
这篇关于在实现回显功能模块的时候,把ID设置成全局变量了的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!