查询详情在模态框展示
1.
<a href="#" onclick="detail('${alarmTask.id}')"class="btn btn-sm btn-primary">查看任务</a>
2.
<script> function detail(id) { alert("aaaaaaaaaaaaaa"); $.ajax({ type: "GET", url: "${ctx}/direct/alarmTask/look", data: {id:id}, dataType: "json", success: function(alarmTask){ alert("请求成功id="+id); $("#task_name").val(alarmTask.taskName); $("#task_num").val(alarmTask.taskNum); $("#queryTaskModal").modal('show'); }, error:function(){ alert("请求失败id="+id); } }) } </script>
3.
@RequestMapping(value = { "look" }) @ResponseBody public ApAlarmTaskPO look(HttpServletRequest request,ApAlarmTaskPO alarmTask, Model model) { String id=request.getParameter("id"); alarmTask=alarmTaskService.selectById(id); model.addAttribute("alarmTask",alarmTask); return alarmTask; }
4.
<div class="modal fade" style="width: 900px;margin:0 auto;" id="queryTaskModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog" style="width:100%;margin: 0 auto; "> <div class="modal-content" style="width:100%; margin: 0 auto;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">任务信息</h4> </div> <div class="modal-body row"> <form role="form" class="form-horizontal"> <div class="form-group"> <label class="control-label col-sm-2">任务名称</label> <div class="col-sm-4"> <input type="text" class="form-control" name="task_name" id="task_name"> </div> </div> <div class="form-group"> <label class="control-label col-sm-2">任务编号</label> <div class="col-sm-4"> <input type="text" class="form-control" name="task_num" id="task_num"> </div> </div> <div class="form-group"> <label class="control-label col-sm-2">任务类别</label> <div class="col-sm-4"> <select class="form-control m-b" name=""> <option value=""></option> <option>突发灾害</option> <option selected="selected">自然灾害</option> </select> </div> </div> <div class="form-group"> <label class="control-label col-sm-2">下发时间</label> <div class="col-sm-4"> <input type="text" class="form-control" name="publicOrg" value="2019-08-06 15:32:25"> </div> </div> <div class="form-group"> <label class="control-label col-sm-2">来源</label> <div class="col-sm-4"> <select class="form-control m-b" name="type"> <option value=""></option> <option selected="selected">预案</option> <option selected="selected">分配</option> </select> </div> </div> <div class="form-group"> <label class="control-label col-sm-2">任务概述</label> <div class="col-sm-8"> <textarea class="form-control" rows="6" name="textNote"> 请参与救火 </textarea> </div> </div> </form> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div>