1 公告查询
1.1查询公告详细
noticeIndex.jsp
/**
* tool操作栏监听事件
*/
table.on('tool(currentTableFilter)', function (obj) {
var data=obj.data;
if (obj.event === 'query') { // 监听添加操作
var index = layer.open({
title: '查看公告详情',
type: 2,
shade: 0.2,
maxmin:true,
shadeClose: true,
area: ['60%', '60%'],
content: '<%=basePath%>queryNotice?id='+data.id,
});
$(window).on("resize", function () {
layer.full(index);
});
} else if (obj.event === 'delete') { // 监听删除操作
layer.confirm('真的删除行么', function (index) {
//调用删除功能
deleteInfoByIds(data.id,index);
layer.close(index);
});
}
});
1.2进行信息的查询
NoticeController.java
/**
* 详情转
*/
@GetMapping("/queryNotice")
public String queryNoticeById(Integer id, Model model){
//根据id查询公告详细信息
Notice notice= noticeService.queryNoticeById(id);
model.addAttribute("info",notice);
return "notice/queryNotice";
}
1.3页面的处理
queryNotice.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<%
String path=request.getContextPath();
String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<meta charset="utf-8">
<title>查询公告详情</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="<%=basePath%>lib/layui-v2.5.5/css/layui.css" media="all">
<link rel="stylesheet" href="<%=basePath%>css/public.css" media="all">
<style>
body {
background-color: #ffffff;
}
</style>
</head>
<body>
<div class="layui-form layuimini-form">
<input type="hidden" name="id" value="${info.id}">
<div class="layui-form-item">
<label class="layui-form-label">公告查询:</label>
<div class="layui-input-block">
${info.content}
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">发布人:</label>
<div class="layui-input-block">
${info.author}
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">发布时间:</label>
<div class="layui-input-block">
<fmt:formatDate value="${info.createDate}" pattern="yyyy-MM-dd"></fmt:formatDate>
</div>
</div>
</div>
<script src="<%=basePath%>lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
</body>
</html>