easyui(1)

easyui(1)

ui框架
  1. easyui
  2. bootstrap
  3. layui
easyui布局
  1. panel
  2. layout
  3. accordion
  4. tabs
easyui窗口
  1. waindow
  2. dialog
  3. messaher
easyui高级
  1. conbox
  2. tree
  3. Datagrid
  4. TreeGrid
easyui控件的两种创建方式
  1. 直接通过html标签创建(定义easyui属性)
  2. JS创建

导入easyui
在这里插入图片描述

导入EasyUI的CSS和Javascript文件


<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">   
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">   
<script type="text/javascript" src="easyui/jquery-1.7.2.min.js"></script>   
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script> 

layout

<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>后台主界面</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/js/public/easyui5/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/js/public/easyui5/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/public/easyui5/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/public/easyui5/jquery.easyui.min.js"></script>
</head>
<body class="easyui-layout">
	<div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">north region</div>
	<div data-options="region:'west',split:true,title:'West'" style="width:150px;padding:10px;">west content</div>
	<div data-options="region:'east',split:true,collapsed:true,title:'East'" style="width:100px;padding:10px;">east region</div>
	<div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px;">south region</div>
	<div data-options="region:'center',title:'Center'"></div>
</body>

</html>

代码效果显示
在这里插入图片描述
easyui的tree组件
导入util工具包
在这里插入图片描述
导入jar包
在这里插入图片描述
json


[{
	"id":1,
	"text":"菜单管理",
	"children":[{
		"id":11,
		"text":"财务",
		"state":"closed",
		"children":[{
			"id":111,
			"text":"学费缴纳"
		},{
			"id":112,
			"text":"Wife"
		},{
			"id":113,
			"text":"Company"
		}]
	},{
		"id":12,
		"text":"后勤",
		"children":[{
			"id":121,
			"text":"Intel"
		},{
			"id":122,
			"text":"宿舍费用缴纳",
			"attributes":{
				"p1":"Custom Attribute1",
				"p2":"Custom Attribute2"
			}
		},{
			"id":123,
			"text":"Microsoft Office"
		},{
			"id":124,
			"text":"Games",
			"checked":true
		}]
	},{
		"id":13,
		"text":"index.html"
	},{
		"id":14,
		"text":"about.html"
	},{
		"id":15,
		"text":"welcome.html"
	}]
}]

TreeNode


package com.lrc.entity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 通过这个类转换成tree_data1.json的字符串
 *
 */
public class TreeNode {
	private String id;
	private String text;
	private List<TreeNode> children=new ArrayList<TreeNode>();
	private Map<String, Object> attributes=new HashMap<String, Object>();
	public String getId() {
		return id;
	}
	public void setId(Object object) {
		this.id = (String) object;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public List<TreeNode> getChildren() {
		return children;
	}
	public void setChildren(List<TreeNode> children) {
		this.children = children;
	}
	public Map<String, Object> getAttributes() {
		return attributes;
	}
	public void setAttributes(Map<String, Object> attributes) {
		this.attributes = attributes;
	}
	@Override
	public String toString() {
		return "TreeNode [id=" + id + ", text=" + text + ", children=" + children + ", attributes=" + attributes + "]";
	}
	
	
}

MenuDao


package com.lrc.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.lrc.entity.TreeNode;
import com.lrc.util.JsonBaseDao;
import com.lrc.util.JsonUtils;
import com.lrc.util.PageBean;
import com.lrc.util.StringUtils;
//相互调用
public class MenuDao extends JsonBaseDao {
	/**
	 * 前台返回tree_data1,json的字符串 paMap 从前台传递过滤的参数集合 pageBean
	 */
	//上面的调用下面的
	public List<TreeNode> listTreeNode(Map<String, String[]> Map, PageBean pageBean) throws Exception{
		List<Map<String,Object>> listMap=this.listMap(Map, pageBean);
		List<TreeNode> listTreeNode=new ArrayList<TreeNode>();
		this.listMapToListTreeNode(listMap, listTreeNode);
		return null;
	}

	public List<Map<String, Object>> listMap(Map<String, String[]> map, PageBean pageBean) throws Exception {
		String sql = "select * from t_easyui_menu where true";
		String menuId = JsonUtils.getParamVal(map, "Menuid");
		if (StringUtils.isNotBlank(menuId)) {
			sql += " and parentid=" + menuId;
		} else {
			sql += " and parentid=-1";
		}
		// 存放数据库中的菜单信息
		List<Map<String, Object>> listMap = super.executeQuery(sql, pageBean);

		return listMap;
	}

	private void mapToTreeNode(Map<String, Object> map, TreeNode treeNode) throws Exception{
		treeNode.setId(map.get("Menuid"+""));
		treeNode.setText(map.get("menuname")+"");
		treeNode.setAttributes(map);
		
		//讲子节点添加到父节点中,建立数据之间的父子关系
//		treeNode.setChildren(children);
		Map<String,String[]> childrenMap=new HashMap<String, String[]>();
		childrenMap.put("Menuid", new String[] {treeNode.getId()});
		List<Map<String , Object>> listMap=this.listMap(childrenMap, null);
		List<TreeNode> listTreeNode=new ArrayList<>();
		this.listMapToListTreeNode(listMap, listTreeNode);
		treeNode.setChildren(listTreeNode);
	}

	public void listMapToListTreeNode(List<Map<String, Object>> listMap, List<TreeNode> listTreeNode) throws Exception{
		TreeNode treeNode=null;
		for (Map<String,Object> map : listMap) {
			treeNode=new TreeNode();
			this.mapToTreeNode(map, treeNode);
			listTreeNode.add(treeNode);
		}
	}

}

MenuAction


package com.lrc.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.lrc.dao.MenuDao;
import com.lrc.entity.TreeNode;
import com.lrc.framework.ActionSupport;
import com.lrc.util.ResponseUtil;

public class MenuAction extends ActionSupport {
	private MenuDao menuDao=new MenuDao();
	public String menuTree(HttpServletRequest req,HttpServletResponse resp) {
		ObjectMapper om=new ObjectMapper();
		try {
			//获取easyui框架所识别的json格式
			List<TreeNode> listTreeNode=this.menuDao.listTreeNode(req.getParameterMap(), null);
			ResponseUtil.write(resp, om.writeValueAsString(listTreeNode));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}

mvc.xml配置


<?xml version="1.0" encoding="UTF-8"?>
<config>
	<!-- <action path="/regAction" type="test.RegAction">
		<forward name="failed" path="/reg.jsp" redirect="false" />
		<forward name="success" path="/login.jsp" redirect="true" />
	</action> -->
	
	<action path="/menuAction" type="com.lrc.web.MenuAction">
	</action>
</config>

index.js


$(function() {
	$('#tt').tree({    
	    url:'menuAction.action?methodName=menuTree'   
	});
	
})

代码效果显示
在这里插入图片描述

创建选项卡


<div id="tt" class="easyui-tabs" style="width:500px;height:250px;">   
    <div title="Tab1" style="padding:20px;display:none;">   
        tab1    
    </div>   
    <div title="Tab2" data-options="closable:true" style="overflow:auto;padding:20px;display:none;">   
        tab2    
    </div>   
    <div title="Tab3" data-options="iconCls:'icon-reload',closable:true" style="padding:20px;display:none;">   
        tab3    
    </div>   
</div>  


添加新的选项卡面板


// add a new tab panel    
$('#tt').tabs('add',{    
    title:'New Tab',    
    content:'Tab Body',    
    closable:true,    
    tools:[{    
        iconCls:'icon-mini-refresh',    
        handler:function(){    
            alert('refresh');    
        }    
    }]    
});  


exists which 表明指定的面板是否存在,'which’参数可以是选项卡面板的标题或索引。
select which 选择一个选项卡面板,'which’参数可以是选项卡面板的标题或者索引。
index.js


$(function() {
	$('#tt').tree({    
	    url:'menuAction.action?methodName=menuTree'  , 
	    	onClick: function() {
	    		alert(node.text);//用户点击的时候提示一下
	    		// add a new tab panel    
	    		var content = '<iframe scrolling="no" frameborder="0" src="'+node.attributes.menuURL+'" width="99%" height="99%"></iframe>';
	    		if($('#tt').tabs('exists',node.text)){//存在实行选项卡定位操作
	    			$('#tt').tabs('select',node.text);
	    		}else{//不存在实行添加操作
	    			$('#menuTab').tabs('add',{    
		    		    title:node.text,    
		    		    content:content,    
		    		    closable:true,    
//		    		    tools:[{    
//		    		        iconCls:'icon-mini-refresh',    
//		    		        handler:function(){    
//		    		            alert('refresh');    
//		    		        }    
//		    		    }]    
		    		});
	    		}
	    		
			}
	});
	
})

index.jsp


<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>后台主界面</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/js/public/easyui5/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/js/public/easyui5/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/public/easyui5/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/public/easyui5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/index.js"></script>
</head>
<body class="easyui-layout">
	<div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">north region</div>
	<div data-options="region:'west',split:true,title:'West'" style="width:150px;padding:10px;">
	<ul id="tt"></ul>
	</div>
	<div data-options="region:'east',split:true,collapsed:true,title:'East'" style="width:100px;padding:10px;">east region</div>
	<div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px;">south region</div>
	<div data-options="region:'center',title:'Center'">
	<div id="menuTab" class="easyui-tabs" style="">   
    <div title="首页" style="padding:20px;display:none;">   
        welcome to here!!!
    </div>   
     
</div>
	
	</div>
</body>

</html>

代码效果显示
在这里插入图片描述
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
毕业设计,基于SpringBoot+Vue+MySQL开发的海滨体育馆管理系统,源码+数据库+毕业论文+视频演示 本基于Spring Boot的海滨体育馆管理系统设计目标是实现海滨体育馆的信息化管理,提高管理效率,使得海滨体育馆管理工作规范化、高效化。 本文重点阐述了海滨体育馆管理系统的开发过程,以实际运用为开发背景,基于Spring Boot框架,运用了Java技术和MySQL作为系统数据库进行开发,充分保证系统的安全性和稳定性。本系统界面良好,操作简单方便,通过系统概述、系统分析、系统设计、数据库设计、系统测试这几个部分,详细的说明了系统的开发过程,最后并对整个开发过程进行了总结,实现了海滨体育馆相关信息管理的重要功能。 本系统的使用使管理人员从繁重的工作中解脱出来,实现无纸化办公,能够有效的提高海滨体育馆管理效率。 关键词:海滨体育馆管理,Java技术,MySQL数据库,Spring Boot框架 本基于Spring Boot的海滨体育馆管理系统主要实现了管理员功能模块和学生功能模块两大部分,这两大功能模块分别实现的功能如下: (1)管理员功能模块 管理员登录后可对系统进行全面管理操作,包括个人中心、学生管理、器材管理、器材借出管理、器材归还管理、器材分类管理、校队签到管理、进入登记管理、离开登记管理、活动预约管理、灯光保修管理、体育论坛以及系统管理。 (2)学生功能模块 学生在系统前台可查看系统信息,包括首页、器材、体育论坛以及体育资讯等,没有账号的学生可进行注册操作,注册登录后主要功能模块包括个人中心、器材管理、器材借出管理、器材归还管理、校队签到管理、进入登记管理、离开登记管理、活动预约管理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值