easyui(入门)

ui框架

1.easyui
2.bootstrap
3.layui

这里演示easyui的组件

layout组件
tree组件
tab组件

首先导入easyui
在这里插入图片描述
导入jar包
在这里插入图片描述
工具包:
在这里插入图片描述
truee_data1.json可以到导入的easyui里的demo去复制(一定要和jsp在同一级)

[{
	"id":1,
	"text":"dingjicaidan",
	"children":[{
		"id":11,
		"text":"stuguanli",
		"state":"closed",
		"children":[{
			"id":111,
			"text":"tesekecheng"
		},{
			"id":112,
			"text":"worktijiao"
		},{
			"id":113,
			"text":"Company"
		}]
	},{
		"id":12,
		"text":"houqingguanli",
		"children":[{
			"id":121,
			"text":"Intel"
		},{
			"id":122,
			"text":"Java",
			"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"
	}]
}]

创建js文件
在这里插入图片描述
js代码

$(function(){
	$('#tt').tree({    
	    url:'menuAction.action?methodName=menuTree',
	    onClick: function(node){
			//alert(node.attributes.menuURL);  // 在用户点击的时候提示
	    	var content = '<iframe scrolling="no" frameborder="0" src="'+node.attributes.menuURL+'" width="99%" height="99%"></iframe>';
	    	if($("#menuTab").tabs('exists',node.text)){
	    		//alert("存在")
	    		$("#menuTab").tabs('select',node.text)
	    	}else{
	    		//alert("不存在")
	    		// add a new tab panel    
				$('#menuTab').tabs('add',{    
				    title:node.text,    
				    content:content,    
				    closable:true 
				});  
	    	}
		}
	});  
})

实体类
TreeNode.java

package com.bk201.entity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 针对easyui属性展示的json格式串进行了实体类的描述
 * @author Felling
 *
 */
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(String id) {
	this.id = id;
}
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 + "]";
}



}

dao方法
MenuDao.java

package com.bk201.dao;

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

import com.bk201.entity.TreeNode;
import com.bk201.util.JsonBaseDao;
import com.bk201.util.JsonUtils;
import com.bk201.util.PageBean;
import com.bk201.util.StringUtils;
/**
 * 1、查询数据库所有数据用于easyui的tree树形展示(但是直接得来的数据格式easyui不识别)
 * 2、递归查询节点集合,形成子父节点关系,具备层次结构
 * 3、转格式
 * @author Felling
 *
 */
public class MenuDao extends JsonBaseDao{
	/**
	 *  List<TreeNode> 加上objectMapper可以转换成easyui的tree控件识别的json串
	 * @param map
	 * @param pageBean
	 * @return
	 * @throws SQLException 
	 * @throws IllegalAccessException 
	 * @throws InstantiationException 
	 */
	public List<TreeNode> listTreeNode(Map<String, String[]>map,PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException{
		List<Map<String, Object>> listMenu = this.listMenu(map, pageBean);
		List<TreeNode> listTreeNode = new ArrayList<TreeNode>();
		this.listMapToListTreeNode(listMenu, listTreeNode);
		return listTreeNode;
	}
	/*
	 * List<Map<String, Object>>
	 * 递归查询的字节点
	 * 
	 * 
	 */
public List<Map<String, Object>> listMenu(Map<String, String[]>map,PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException{
	String sql="select * from t_easyui_menu where true";
//	select * from t_easyui_menu where parentid=001
	String id=JsonUtils.getParamVal(map, "Menuid");
	if(StringUtils.isNotBlank(id)) {
	//当前节点的id当作子节点的父id进行查询
		sql +=" and parentid="+id;
	}else {
		sql +=" and parentid=-1";
	}
	return super.executeQuery(sql, pageBean);
	}
/**
 * 需要将后台数据库查出来的数据格式转换成前台easyui所识别的数据
 * @param map
 * @param treeNode
 * @throws SQLException 
 * @throws IllegalAccessException 
 * @throws InstantiationException 
 */
public void mapToTreeNode(Map<String, Object> map,TreeNode treeNode) throws InstantiationException, IllegalAccessException, SQLException {
	treeNode.setId(map.get("Menuid").toString());
	treeNode.setText(map.get("Menuname").toString());
	treeNode.setAttributes(map);
	
//	treeNode.setChildren(children);
	Map<String, String[]> childMap = new HashMap<String, String[]>();
	childMap.put("Menuid", new String[] {treeNode.getId()});
	//查询出当前节点所拥有的子节点的集合
	List<Map<String, Object>> listMenu = this.listMenu(childMap, null);
	List<TreeNode> listTreeNode = new ArrayList<TreeNode>();
	this.listMapToListTreeNode(listMenu, listTreeNode);
	treeNode.setChildren(listTreeNode);
	
}
public void listMapToListTreeNode(List<Map<String, Object>> list, List<TreeNode> listTreeNode) throws InstantiationException, IllegalAccessException, SQLException {
	TreeNode treeNode = null;
	for (Map<String, Object> map : list) {
		treeNode = new TreeNode();
		this.mapToTreeNode(map, treeNode);
		listTreeNode.add(treeNode);
	}

}
}



web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>easyui</display-name>
  <filter>
  	<filter-name>encodingFiter</filter-name>
  	<filter-class>com.bk201.util.EncodingFiter</filter-class>
  </filter>
  <filter-mapping>
  	<filter-name>encodingFiter</filter-name>
  	<url-pattern>/*</url-pattern>
  </filter-mapping>
  
  <servlet>
  	<servlet-name>actionServlet</servlet-name>
  	<servlet-class>com.zking.framework.ActionServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>actionServlet</servlet-name>
  	<url-pattern>*.action</url-pattern>
  </servlet-mapping>
</web-app>

web下
MenuAction.java

package com.bk201.web;

import java.util.List;

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

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

public class MenuAction extends ActionSupport{
	private MenuDao menuDao = new MenuDao();
	public String menuTree(HttpServletRequest req,HttpServletResponse resp) {
		try {
			List<TreeNode> listTreeNode = this.menuDao.listTreeNode(req.getParameterMap(), null);
			ObjectMapper om = new ObjectMapper();
			ResponseUtil.write(resp, om.writeValueAsString(listTreeNode));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}

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">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/easyui5/themes/default/easyui.css">   
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/easyui5/themes/icon.css">   
<script type="text/javascript" src="${pageContext.request.contextPath }/static/easyui5/jquery.min.js"></script>   
<script type="text/javascript" src="${pageContext.request.contextPath }/static/easyui5/jquery.easyui.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/index.js"></script>  
<title>后台管理主界面</title>
</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="height: 900px">   
    <div title="首页" style="padding:20px;display:none;">   
       首页擦擦擦
    </div>   
   
</div>  
	
	</div>
</body>

</html>

运行结果:
在这里插入图片描述
选项卡不可重复
在这里插入图片描述

基于SSM框架的智能家政保洁预约系统,是一个旨在提高家政保洁服务预约效率和管理水平的平台。该系统通过集成现代信息技术,为家政公司、家政服务人员和消费者提供了一个便捷的在线预约和管理系统。 系统的主要功能包括: 1. **用户管理**:允许消费者注册、登录,并管理他们的个人资料和预约历史。 2. **家政人员管理**:家政服务人员可以注册并更新自己的个人信息、服务类别和服务时间。 3. **服务预约**:消费者可以浏览不同的家政服务选项,选择合适的服务人员,并在线预约服务。 4. **订单管理**:系统支持订单的创建、跟踪和管理,包括订单的确认、完成和评价。 5. **评价系统**:消费者可以在家政服务完成后对服务进行评价,帮助提高服务质量和透明度。 6. **后台管理**:管理员可以管理用户、家政人员信息、服务类别、预约订单以及处理用户反馈。 系统采用Java语言开发,使用MySQL数据库进行数据存储,通过B/S架构实现用户与服务的在线交互。系统设计考虑了不同用户角色的需求,包括管理员、家政服务人员和普通用户,每个角色都有相应的权限和功能。此外,系统还采用了软件组件化、精化体系结构、分离逻辑和数据等方法,以便于未来的系统升级和维护。 智能家政保洁预约系统通过提供一个集中的平台,不仅方便了消费者的预约和管理,也为家政服务人员提供了一个展示和推广自己服务的机会。同时,系统的后台管理功能为家政公司提供了强大的数据支持和决策辅助,有助于提高服务质量和管理效率。该系统的设计与实现,标志着家政保洁服务向现代化和网络化的转型,为管理决策和控制提供保障,是行业发展中的重要里程碑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值