| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <%--
- Created by IntelliJ IDEA.
- User: njc
- Date: 2022/5/8
- Time: 10:02
- To change this template use File | Settings | File Templates.
- --%>
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <script type="text/javascript">
- function formatBlogType(val, row) {
- return val.typeName;
- }
- /**
- * 根据标题查询
- */
- function searchBlog() {
- $("#dg").datagrid('load', {"title": $("#s_title").val()});
- }
- /**
- * 修改一条博客信息
- */
- function openBlogModifyTab() {
- var selectedRows = $("#dg").datagrid("getSelections");
- if (selectedRows.length != 1) {
- $.messager.alert("系统提示", "请选择一个要修改的博客!");
- return;
- }
- var row = selectedRows[0];
- window.parent.addTab("修改博客", "modifyBlog.jsp?id=" + row.id, "icon-writeBlog");
- }
- /**
- * 删除一条博客信息
- */
- function deleteBlog() {
- var selectedRows = $("#dg").datagrid("getSelections");
- if (selectedRows.length == 0) {
- $.messager.alert("系统提示", "请选择要删除的博客!");
- return;
- }
- var strIds = [];
- for (var i = 0; i < selectedRows.length; i++) {
- strIds.push(selectedRows[i].id);
- }
- var ids = strIds.join(",");
- $.messager.confirm("系统提示!", "你确定要删除<font color=red>" + selectedRows.length + "<font>条数据吗?", function (r) {
- if (r) {
- $.post("${pageContext.request.contextPath}/admin/blog/delete.do", {ids: ids}, function (result) {
- if (result.success) {
- $.messager.alert("系统提示", "数据已经成功删除!");
- $("#dg").datagrid("reload");
- } else {
- $.messager.alert("系统提示", "数据删除失败!");
- }
- }, "json");
- }
- });
- }
- </script>
- <table id="dg" title="博客管理" class="easyui-datagrid" fitcolumns="true" pagination="true" rownumber="true"
- toolbar="#tb" url="${pageContext.request.contextPath}/admin/blog/list.do">
- <thead>
- <tr>
- <th field="cb" checkbox="true" align="center"></th>
- <th field="id" width="20" align="center">编号</th>
- <th field="title" width="200" align="center">标题</th>
- <th field="releaseDate" width="50" align="center">发布日期</th>
- <th field="blogType" width="50" align="center" formatter="formatBlogType">博客类型</th>
- </tr>
- </thead>
- </table>
- <div id="tb">
- <div>
- <a href="javascript:openBlogModifyTab()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改</a>
- <a href="javascript:deleteBlog()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
- </div>
- 标题: <input type="text" id="s_title" size="20" onkeydown="if (event.keyCode===13) searchBlog()"/>
- <a href="javascript:searchBlog()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
- </div>
|