一个easyui的案例(SSH)

/*
 * name :tuzuoquan mail :tuzq@css.com.cn date :2014/02/14 version :0.1
 * description:气象信息共享门户系统通用JS,TreeTable CopyRight (C) 2014-02
 */
// 获取选中一行的情况,下面的一个参数可以代表一个DataGrid
function getSelected(dialogEle) {
 // 获取选中一行的情况。
 var datagrid = $("#fileInfoDataGrid").datagrid('getSelected');
// alert(datagrid.fileName + " " + datagrid.filePath + " "
//   + datagrid.lastModified + " " + datagrid.fileType);
 if(datagrid == null){
  alert("对不起!您还没有选择文件!");
 } else {
  if(datagrid.fileType == "文件夹"){
   alert("对不起,您选择的是文件夹,请您选择确切的文件!");
  } else {
   //alert($(".service1 #path").length);
   //给这个文本域赋值
   $(".service1 #path").attr("value",datagrid.filePath);
   dialogEle.dialog("close");
  }
 }
}

// 获取选中多行的情况
function getSelections() {
 var ids = [];
 var rows = $("#fileInfoDataGrid").datagrid('getSelections');
 for (var i = 0; i < rows.length; i++) {
  ids.push(rows[i].filePath);
 }

 alert(ids.join(':'));
}

//选中指定行
function selectRow(rowNum){
 $("#fileInfoDataGrid").datagrid('selectRow',rowNum);
}

//不选中指定行
function unselectRow(rowNum){
 $("#fileInfoDataGrid").datagrid('unselectRow',rowNum);
}

function clearSelections(){
 $("#fileInfoDataGrid").datagrid('clearSelections');
}

$(function() {
 $("#dialog-diskFileInfo").dialog({
  resizable : false,
  height : 500,
  minHeight : 150,
  width : 1015,
  modal : true,
  show : "blind",
  hide : "explode",
  closeOnEscape : true,
  autoOpen : false,
  draggable : true,
  buttons : {
   "确定" : function() {
    $.fn.diskFileDialogEleBtnCheckOk($(this),
      $("#diskFileStructureTree"), $("#fileInfoDataGrid"));
   },
   "取消" : function() {
    $(this).dialog("close");
   }
  }
 });

 // 带有class属性为openDiskFileInfoDialog的元素,为这个元素添加点击事件
 $("#openDiskFileInfoDialog").bind("click", function() {
  // 加载数据
  $("#diskFileStructureTree").tree({
   height : 355,
   checkbox : false,
   url : basePath + "/onlinegraph/treeDataAction_treeNodes.action",
   method : 'post',
   animate : true,
   dnd : true,
   lines : true,
   onClick : function(node) {
//    $("#fileInfoDataGrid").datagrid({
//     // 通过这个获得参数
//     url : basePath
//       + "/onlinegraph/fileInfoAction_folderFileInfoList.action?path=" + node.id,
//     method : 'post'
//    });
    
    $("#fileInfoDataGrid").datagrid('load', {
       page : 1,
       pageSize : "10",
       path:node.id
      });
    
    //$("#fileInfoDataGrid").datagrid('reload');
   },
   onBeforeExpand : function(node, param) {
    $("#diskFileStructureTree").tree('options').url = basePath
      + "/onlinegraph/treeDataAction_treeNodeList.action?path="
      + node.id;
   }
  });

  // 打开表格
  $("#fileInfoDataGrid").datagrid({
   height:325,
   width:815,
   // 通过这个获得参数
   url : basePath
     + "/onlinegraph/fileInfoAction_folderFileInfoList.action",
   // 行阴影,但目前看没有效果
   striped : true,
   method : 'post',
   nowrap : false,
   border : false,
   singleSelect : true,
   // 自适应窗口大小变化
   fit : true,
   title : '文件信息',
   fitColumns : true,
   rownumbers : true,
   idField : 'filePath',
   collapsible : true,
   sortName:'fileName',
   // 排序规则
   sortOrder : 'desc',
   // 本地排序,不是在服务器端排
   remoteSort : false,
   frozenColumns : [[{
      field : 'checkbox',
      checkbox : true
     }]],
   columns : [[{
      field : 'fileName',
      title : '名称',
      sortable : true,
      sortable : true,
      width : 50
     }, {
      field : 'filePath',
      title : '文件路径',
      sortable : true,
      sortable : true,
      width : 160
     }, {
      field : 'lastModified',
      title : '修改日期',
      sortable : true,
      sortable : true,
      width : 100
     }, {
      field : 'fileType',
      title : '类型',
      sortable : true,
      width : 50,
      align : 'left'
     }, {
      field : 'fileSize',
      title : '大小',
      sortable : true,
      width : 50,
      align : 'left'
     }]],
   // 事件调用的方式
   onLoadSuccess : function() {
   },
   onDblClickRow:function(index,row){
    //alert("index == " + index + " row == " + row.filePath);
    
    if(row.fileType == "文件夹"){
     alert("对不起,您选择的是文件夹,请您选择确切的文件!");
    } else {
     //alert($(".service1 #path").length);
     //给这个文本域赋值
     $(".service1 #path").attr("value",row.filePath);
     $("#dialog-diskFileInfo").dialog("close");
    }
   },
   pagination : true
  });

  var p = $("#fileInfoDataGrid").datagrid('getPager');
  $(p).pagination({
   pageList:[5,10,20,30,40,50,100],
   //layout:['list','sep','first','prev','links','next','last','sep','refresh'],
   beforePageText : '第',
   afterPageText : '页  共{pages}页',
   displayMsg : '当前显示 {from} - {to} 条记录   共 {total} 条记录',
   showPageList:true,
   showRefresh:true,
   onSelectPage : function(pageNumber, pageSize) {
    $(this).pagination('loading');
    $(this).pagination('loaded');
    
    // 选择相应的页码时刷新显示内容列表
    $("#fileInfoDataGrid").datagrid('load', {
       page : pageNumber,
       pageSize : pageSize
      });

    $("#fileInfoDataGrid").datagrid('reload');

    // $("#fileInfoDataGrid").datagrid({
    // //通过这个获得参数
    // url: basePath +
    // "/onlinegraph/fileInfoAction_folderFileInfoList.action?page="
    // + pageNumber + "&pageSize=" + pageSize,
    // method:'post'
    // });
   },
   onBeforeRefresh : function(pageNumber, pageSize) {
    // 刷新触发事件
    $(this).pagination('loading');
    $(this).pagination('loaded');
   },
   onRefresh : function(pageNumber, pageSize) {
    //alert("pageNumber = " + pageNumber + " pageSize = " + pageSize);
    // 上一页触发事件
    $("#fileInfoDataGrid").datagrid('load', {
       page : pageNumber,
       pageSize : pageSize
      });

    $(this).pagination('loading');
    $(this).pagination('loaded');

    $("#fileInfoDataGrid").datagrid('reload');
   },
   onChangePageSize : function(pageSize) {
    $(this).pagination('loading');
                $(this).pagination('loaded');
   }
  });

  $("#dialog-diskFileInfo").dialog("open");
 });

 // 插件的第一个参数表示的是弹出的dialog元素
 $.fn.diskFileDialogEleBtnCheckOk = function(dialogEle,
   diskFileStructureTree, fileInfoDataGrid) {

  // 获得选中列
  getSelected(dialogEle);
    
  //获取选中多行的信息
  //getSelections();
  
  //选中第二行
  //selectRow(2);
    
  //不选中第三行
  //unselectRow(2);
  
  //清除所有的选中行
  //clearSelections();
 }
});

 

struts2配置:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
 <package name="system_onlinegraph" namespace="/onlinegraph" extends="global-struts-default">
  <action name="treeDataAction_*" class="cn.com.css.misps.onlinegraph.web.action.TreeDataAction" method="{1}">
   <result name="treeNodes" type="json">
    <param name="root">treeList</param>
   </result>
   <result name="treeNodeList" type="json">
    <param name="root">treeNodeList</param>
   </result>
  </action>
  
  <action name="fileInfoAction_*" class="cn.com.css.misps.onlinegraph.web.action.FileInfoAction" method="{1}">
   <result type="json"></result>
  </action>
    </package>
</struts>

 

 

 

action的写法:

package cn.com.css.misps.onlinegraph.web.action;

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

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.com.css.common.action.BaseAction;
import cn.com.css.misps.onlinegraph.bean.TreeDataBean;
import cn.com.css.misps.onlinegraph.service.ITreeDataService;
import cn.com.css.misps.onlinegraph.service.impl.TreeDataServiceImpl;
import cn.com.css.misps.onlinegraph.util.ProductsStorageUtils;

/**
 * @brief FileInfoAction.java 通过这个类查看文件夹下的文件信息
 * @attention
 * @author 涂作权
 * @date 2014-2-25
 * @note begin modify by null
 */
@SuppressWarnings("serial")
@Scope("prototype")
@Controller
public class FileInfoAction extends BaseAction {
 private int total = 0;
 private List<Object> rows;
 private String path;
 private String page;
 private String pageSize;
 
 /**
  * \brief 通过此方法返回指定文件夹下的文件信息
  *
  * @return
  * @attention
  * @author 涂作权
  * @date 2014-2-25
  * @note begin modify by null
  */
 public String folderFileInfoList() {
  rows = new ArrayList<Object>();
  ITreeDataService treeDataService = new TreeDataServiceImpl();

  // 如果path为空,显示的是根目录的文件信息
  List<TreeDataBean> list = null;
  
  //先获得当前页和每页大小,如果在
  int intPage = Integer.parseInt((page == null || page == "0") ? "1":page);
  System.out.println("intPage  ==  "+intPage);
  
  if (path == null) {
   // 如果path为空,显示的是根目录的文件信息
   list = treeDataService.getAllFileList(ProductsStorageUtils.micapsAbsolutePath);
  } else {
   // 如果文件路径是空,查询指定目录下的文件信息
   list = treeDataService.getAllFileList(path);
  }
  
  //每页显示条数
  int number = Integer.parseInt((pageSize == null || pageSize == "0") ? "10":pageSize);
  
  if ((pageSize == null || pageSize == "0")) {
   pageSize = "10";
   page = "1";
  }
  
  //每页的开始记录  第一页为1, 第二页为number+1
  int start = (intPage - 1) * number;
  int end = ((start + number) < list.size()) ? start + number : list.size();
  
  //注意要将每个对象的内容放到map集合中,然后将每个map放到rows集合中
  for (int i = start; i < end; i++) {
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("fileName", list.get(i).getFileName());
   map.put("filePath", list.get(i).getFilePath());
   map.put("lastModified", list.get(i).getLastModified());
   map.put("fileType", list.get(i).getFileType());
   map.put("fileSize", list.get(i).getFileSize());
   rows.add(map);
  }
  
  total = list.size();
  
  return SUCCESS;
 }

 /**
  * @return the total
  */
 public int getTotal() {
  return total;
 }

 /**
  * @param total the total to set
  */
 
 public void setTotal(int total) {
  this.total = total;
 }

 /**
  * @return the rows
  */
 public List<Object> getRows() {
  return rows;
 }

 /**
  * @param rows the rows to set
  */
 
 public void setRows(List<Object> rows) {
  this.rows = rows;
 }

 /**
  * @return the path
  */
 public String getPath() {
  return path;
 }

 /**
  * @param path the path to set
  */
 
 public void setPath(String path) {
  this.path = path;
 }

 /**
  * @return the page
  */
 public String getPage() {
  return page;
 }

 /**
  * @param page the page to set
  */
 
 public void setPage(String page) {
  this.page = page;
 }

 /**
  * @return the pageSize
  */
 public String getPageSize() {
  return pageSize;
 }

 /**
  * @param pageSize the pageSize to set
  */
 
 public void setPageSize(String pageSize) {
  this.pageSize = pageSize;
 }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
阅读目录 1.1 编写目的 1.2 是否开源 1.1 基于RBAC 1.2 数据模型 1.1 登录 1.2 资源信息维护 1.3 角色管理 1.4 组管理 1.5 系统字典维护 1.6 系统信息维护 1.7 日志管理 1.8 操作信息维护 1.9 全局参数维护 1.10 人员信息维护 第一章 引言 1.1 编写目的 使用easyui+ssh2+shiro的权限管理系统,粒度可细化到按钮及菜单级别。目前是第一个稳定版本,可实现基本的权限控制功能,并且可以使用shiro的标签对细粒度的权限进行管理。 Jar包除了几个核心包之外全部使用maven管理。 回到顶部 1.2 是否开源 完全开源免费。 第一章 设计思路 回到顶部 1.1 基于RBAC RBAC认为权限授权实际上是Who、What、How的问题。在RBAC模型中,who、what、how构成了访问权限三元组,也就是“Who对What(Which)进行How的操作”。 Who:权限的拥用者或主体(如Principal、User、Group、Role、Actor等等) What:权限针对的对象或资源(Resource、Class)。 How:具体的权限(Privilege,正向授权与负向授权)。 Operator:操作。表明对What的How操作。也就是Privilege+Resource Role:角色,一定数量的权限的集合。权限分配的单位与载体,目的是隔离User与Privilege的逻辑关系. Group:用户组,权限分配的单位与载体。权限不考虑分配给特定的用户而给组。组可以包括组(以实现权限的继承),也可以包含用户,组内用户继承 组的权限。User与Group是多对多的关系。Group可以层次化,以满足不同层级权限控制的要求。 RBAC的关注点在于Role和User, Permission的关系。称为User assignment(UA)和Permission assignment(PA).关系的左右两边都是Many-to-Many关系。就是user可以有多个role,role可以包括多个user。 回到顶部 1.2 数据模型 第一章 系统操作 回到顶部 1.1 登录 部署完成后需要输入: http://localhost:8080/sshpermission 进入登录界面 输入管理员 用户名:admin 密码:admin 进入系统 回到顶部 1.2 资源信息维护 维护系统的资源信息,资源指的是系统中所有的除按钮外的相关信息,比如菜单,首页显示列表等。 回到顶部 1.3 角色管理 维护系统角色信息,可对系统进行分配资源授权和操作授权。 角色维护 资源分配 操作分配 回到顶部 1.4 组管理 维护一组用户的信息,可以跟角色和用户进行组合。可以向组内添加用户,可以给组添加角色。 向组内添加用户 给组授权角色 回到顶部 1.5 系统字典维护 维护系统内的字典数据。 回到顶部 1.6 系统信息维护 维护系统信息,可以设置多个系统,进行多个系统的维护与授权。 回到顶部 1.7 日志管理 维护系统日志,使用AOP进行记录,可对需要维护的部分进行配置。 回到顶部 1.8 操作信息维护 维护操作信息 回到顶部 1.9 全局参数维护 维护全局参数。 回到顶部 1.10 人员信息维护 维护用户的基本信息
jquery easyui一个轻量级、开源的前端框架,提供了丰富的UI组件和简单易用的API,使开发人员能够快速构建用户界面。它可以用于开发各种Web应用程序,包括管理系统、数据报表、表单验证等。 要下载jquery easyui,可以按照以下步骤进行: 1. 打开jquery easyui的官方网站,网址为 https://www.jeasyui.com。 2. 在网站的首页上方,可以看到一个"Download"(下载)的标签按钮,点击它。 3. 进入下载页面后,会看到列出了jquery easyui的各个版本。根据自己的需求,选择适合的版本进行下载。一般来说,最新的稳定版本是最推荐的。 4. 在下载页面中,可以找到相应版本的下载链接。点击链接后,会开始下载jquery easyui的压缩包文件。 5. 下载完成后,解压缩该压缩包文件到你的项目目录中。 6. 在项目中引入jquery和easyui的相关文件。可以在HTML文件的<head>标签中添加如下代码: ```html <link rel="stylesheet" type="text/css" href="jquery-easyui-1.9.x/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="jquery-easyui-1.9.x/themes/icon.css"> <script type="text/javascript" src="jquery-easyui-1.9.x/jquery.min.js"></script> <script type="text/javascript" src="jquery-easyui-1.9.x/jquery.easyui.min.js"></script> ``` 请注意,上述代码中的"jquery-easyui-1.9.x"需要根据你实际解压缩后的文件夹名称进行修改。 7. 引入上述文件后,就可以在你的项目中使用jquery easyui提供的各种UI组件和API了。 以上就是下载jquery easyui的详细步骤。希望对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

涂作权的博客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值