下面是代码实现

@{
    ViewBag.Title = "人员查找";
    ViewBag.LeftWidth = "200px";
    ViewBag.MiddleWidth = "200px";
}
<html>
<head>
    <link href="../../../Script/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../Script/easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Content/themes/base/Common/common.css" rel="stylesheet" type="text/css" />
    <script src="../../../Script/easyui/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="../../../Script/Common/json2.js" type="text/javascript"></script>
    <script src="../../../Script/easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Script/easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../../../Script/Common/Toolbar.js" type="text/javascript"></script>
    <script src="../../../Script/easyui/plugins/JValidator.js" type="text/javascript"></script>
    <script src="../../../Script/Common/Common.js" type="text/javascript"></script>
</head>
<body class="easyui-layout">
    <div region="north"  data-options="border:false" style="height: 50px;" >
 
  
                       <div   style=" margin-top:15px; margin-left:15px"    >
                    <a id="btn_byforDepmen"  onclick="searchByforDep()" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search'">
                        按部门设置</a>
           
                    <a id="btn_byforRose" onclick="searchByforRose()"  href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search'">
                        按角色设置</a>
                        </div>
              
               
         
      
    </div>
    <div region="west" title="部门树" id="leftDepTree"  split="true"  style="width: 230px;">
        <div style="border: 1px;">
            <ul id="Deptree" class="easyui-tree">
            </ul>
        </div>
    </div>
    <div region="center">

<div id="cc" class="easyui-layout" data-options="fit:true,border:false">
       <div region="center" title="选择人员">
        <table id="SearchEmployeeList" class="easyui-datagrid" data-options="fit:true,border:true">
        </table>
        </div>
        </div>

</div>

<div region="east"  title="选中人员" split="true" style="width: 260px;">
        <table id="EmployeeList" class="easyui-datagrid"   fitColumns="true" data-options="fit:true,border:false"
       
        checkOnSelect:"true" singleselect="false">
            <thead>
                <tr>
                    <th field="ck" width="50" checkbox="true">
                     
                    </th>
                   <th field="UserId"  hidden= "true"  width="50">
                
                   </th>
                    <th field="RealName"  width="50">
                       姓名
                    </th>
                </tr>
            </thead>
        </table>
    </div>

<div region="south" split="true" style="margin-bottom: 15px; margin-right: auto;
        margin-left: auto; text-align: center">

<table>

<tr>
                <td>
                    <a id="btn_query" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save'">确定</a>
                </td>
                <td>
                    <a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">
                        清空</a>
                </td>
                <td>
                    <a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">
                        取消</a>
                </td>
            </tr>

</table>
    </div>
</body>
</html>
<script type="text/javascript">
    //页面加载按部门搜索部门树列表
    var MySearchEmployee = {
        //加载左侧部门树
        onloadDepTree: function (flag) { //部门树方法
            $('#Deptree').tree({
                checkbox: false,
                url: '../SearchEmployee/GetOrganizationList',
                onClick: function (node) {
                    //flag代表着开关, D表示加载部门信息
                    if (flag == "D") {
                        MySearchEmployee.EmployeeListByforOrg(node.EX1, node.id); //传递参数绑定gridList
                    }
                    else {
                        MySearchEmployee.onloadRoleTree(node.id); //加载员工数
                    }
                }
            });

$('#cc').layout('remove', 'west');
        },
        //加载左侧岗位上
        onloadRoleTree: function (orgid) {
            $('#roleTree').tree({
                checkbox: false,
                url: '../SearchEmployee/GetRoseList?orgID=' + orgid,
                onClick: function (node) {
                    MySearchEmployee.onloadSeachEmpListByforRole(node.id); //加载人员列表
                }
            });
        },
        //清空原来的数据
        removeEmpListTree: function () {//岗位树
            MySearchEmployee.onloadDepTree("R");
            //隐藏部门加载人员列表
            var region = 'west';
            var options = {
                region: region
            };
            options.width = 260;
            options.split = true;
            options.title = "岗位树";
            options.id = "leftroleTree";
            $('#cc').layout('add', options);
            $("#leftroleTree").append("  <div style=\"border: 1px;\"> <ul id=\"roleTree\" class=\"easyui-tree\"> </ul> </div> ");
            var data = $('#SearchEmployeeList').datagrid('getData'); //清空下searList
            for (var i = (data.total - 1); i >= 0; i--) {
                $('#SearchEmployeeList').datagrid('deleteRow', i);
            }
            $('#EmployeeList').datagrid('clearChecked');
        },
        //点击部门按钮
        checkDepTree: function () {

//去掉岗位树
            $('#cc').layout('remove', 'west');
            var data = $('#SearchEmployeeList').datagrid('getData'); //清空下searList
            for (var i = (data.total - 1); i >= 0; i--) {
                $('#SearchEmployeeList').datagrid('deleteRow', i);
            }
            $('#EmployeeList').datagrid('clearChecked');
            MySearchEmployee.onloadDepTree("D");

},

onloadSeachEmpList: function (UserId, RealName) {//单击选中checkbox 确定最终的显示人
            var contains = false;
            var data = $('#EmployeeList').datagrid('getData');
            if (data.total == 0) {
                $('#EmployeeList').datagrid('insertRow', {
                    index: 1, // index start with 0
                    row: { "UserId": UserId, "RealName": RealName }
                });
            }
            else {
                for (var i = 0; i < data.total; i++) {
                    if (data.rows[i].UserId == UserId) {
                        contains = true;
                        break;
                    }
                }
                if (!contains) {
                    $('#EmployeeList').datagrid('insertRow', {
                        index: 1, // index start with 0
                        row: { "UserId": UserId, "RealName": RealName }
                    });
                }
            }
            $('#EmployeeList').datagrid('checkAll'); //默认全部选中
        },
        EmployeeListByforOrg: function (Category, OrganizationId) {//根据部门的ID和种类查询出本部门下所有的人员
            var param = {
                "Category": Category, "OrganizationId": OrganizationId

};
            $("#SearchEmployeeList").datagrid({
                url: '../SearchEmployee/GetEmployeeByForOrg',
                nowrap: false, //是否换行,True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                fitColumns: true, //True 就会自动扩大或缩小列的尺寸以适应表格的宽度并且防止水平滚动。          
                queryParams: param,
                onSelect: function (rowIndex, rowData) //选中时绑定人员表
                {
                    MySearchEmployee.onloadSeachEmpList(rowData.UserId, rowData.RealName);
                },
                onUnselect: function (rowIndex, rowData) {  //取消选中是的时候同时也要删

MySearchEmployee.UnloadEmployeeList(rowData.UserId);
                },

onSelectAll: function (rows) //全部选中
                {
                    MySearchEmployee.onSelectAllByforSearchEmployeeList(rows); //全部选中
                },
                onUnselectAll: function (rows) {

MySearchEmployee.onUnselectAllByforSearchEmployeeList(rows); //全部不选中
                },
                onLoadSuccess: function (data) {

MySearchEmployee.selectedByforSeacherEmployeeList(data);
                },
                columns: [[
                  { field: 'ck', checkbox: 'true', width: 30 },
                  { field: 'UserId', width: 30, hidden: true },
                  { field: 'RealName', title: '姓名', width: 300 }
           ]]
            });
        },
        //根据角色树加载List列表
        onloadSeachEmpListByforRole: function (roleID) {

var param = {
                "roleID": roleID
            };
            $("#SearchEmployeeList").datagrid({
                url: '../SearchEmployee/GetUserByforRole',
                nowrap: false, //是否换行,True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                fitColumns: true, //True 就会自动扩大或缩小列的尺寸以适应表格的宽度并且防止水平滚动。          
                queryParams: param,
                onSelect: function (rowIndex, rowData) //选中时绑定人员表
                {
                    MySearchEmployee.onloadSeachEmpList(rowData.UserId, rowData.RealName);

},
                onUnselect: function (rowIndex, rowData) {  //取消选中是的时候同时也要删

MySearchEmployee.UnloadEmployeeList(rowData.UserId);
                },

onSelectAll: function (rows) //全部选中
                {
                    MySearchEmployee.onSelectAllByforSearchEmployeeList(rows); //全部选中
                },
                onUnselectAll: function (rows) {

MySearchEmployee.onUnselectAllByforSearchEmployeeList(rows); //全部不选中
                },
                onLoadSuccess: function (data) {

MySearchEmployee.selectedByforSeacherEmployeeList(data);
                },
                columns: [[
                  { field: 'ck', checkbox: 'true', width: 30 },
                  { field: 'UserId', width: 30, hidden: true },
                  { field: 'RealName', title: '姓名', width: 300 }
           ]]
            });
        },
        UnloadEmployeeList: function (UserId) { //取消的时候删除行
            //根据userID查找这一行的索引
            var data = $('#EmployeeList').datagrid('getData');

for (var i = 0; i < data.total; i++) {

if (data.rows[i].UserId == UserId) {
                    $('#EmployeeList').datagrid('deleteRow', i);
                }
            }
        },
        unselectRowEmployeeList: function (UserId) {  //去除已经选择上的人员,并且在SearchEmployeeList把打钩去掉
            var data = $('#SearchEmployeeList').datagrid('getData');
            for (var i = 0; i < data.total; i++) {
                if (data.rows[i].UserId == UserId) {
                    $('#SearchEmployeeList').datagrid('unselectRow', i);
                }
            }
        },
        onSelectAllByforSearchEmployeeList: function (rows) { //SearchEmployeeList 全选

//那么EmployeeList 就要显示选中的行
            //选清空一下
            //  $('#EmployeeList').datagrid('clearChecked');
            //然后在增加
            for (var i = 0; i < rows.length; i++) {
                MySearchEmployee.onloadSeachEmpList(rows[i].UserId, rows[i].RealName);
            }
        },
        onUnselectAllByforSearchEmployeeList: function (rows) { //SearchEmployeeList 全不选

var data = $('#EmployeeList').datagrid('getData'); //获取当前的EmloyeeList所有的数据
            //删除EmployeeList
            for (var i = 0; i < rows.length; i++) {
                for (var k = 0; k < data.total; k++) {
                    if (rows[i].UserId == data.rows[k].UserId) {
                        $('#EmployeeList').datagrid('deleteRow', k);
                    }
                }
            }
        },
        onloadForEmployeeList: function () {

$("#EmployeeList").datagrid({
                onUnselect: function (rowIndex, rowData) {
                    $('#EmployeeList').datagrid('deleteRow', rowIndex); //删除当前行

MySearchEmployee.unselectRowEmployeeList(rowData.UserId); //去除SearchEmployeeList打钩数据
                },
                onLoadSuccess: function (data) { //接收data

//全局变量

},
                onUnselectAll: function (rows) {
                    MySearchEmployee.deleteAllforEmployeeList(rows); //删除所有的列表人员
                }
            });

},
        deleteAllforEmployeeList: function (rows) { //清空选中的列表

var data = $('#SearchEmployeeList').datagrid('getData'); //获取当前的EmloyeeList所有的数据

var arryList = [];

for (var i = (rows.length - 1); i >= 0; i--) {
                for (var k = 0; k < data.total; k++) {
                    if (data.rows[k].UserId == rows[i].UserId) {
                        arryList.push(k);
                    }
                }
                $('#EmployeeList').datagrid('deleteRow', i); //删除list列表             
            }

for (var i = 0; i < arryList.length; i++) {
                $('#SearchEmployeeList').datagrid('unselectRow', arryList[i]);
            }
        },
        selectedByforSeacherEmployeeList: function (Depdata) { //执行回调打钩
            var Empdata = $('#EmployeeList').datagrid('getData');
            var arryList = []; //存放索引的值
            for (var i = 0; i < Depdata.total; i++) {
                for (var k = 0; k < Empdata.total; k++) {
                    if (Depdata.rows[i].UserId == Empdata.rows[k].UserId) {
                        arryList.push(i);
                    }
                }
            }
            for (var i = 0; i < arryList.length; i++) {
                $('#SearchEmployeeList').datagrid('checkRow', arryList[i]); // checkRow  selectRow
            }
        },
        retureEmpListData: function () { //返回提交EmpList表中的数据

var Empdata = $('#EmployeeList').datagrid('getData');
            return Empdata.rows;
        }
    };
    //单击部门
    function searchByforDep() {  //按部门搜索
        MySearchEmployee.checkDepTree();

}
    //单击按角色查询
    function searchByforRose() {
        MySearchEmployee.removeEmpListTree(); //加载角色权限树
    }
    $("#btn_query").click(function () {  //点击确定回传数据
        // MySearchEmployee.retureEmpListData();
    });

//页面初始化
    $(function () {
        MySearchEmployee.onloadDepTree("D");
        MySearchEmployee.onloadForEmployeeList(); //页面出
    });
</script>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.Mvc;
using System.Web;
using System.Data;
using GWork.Models;
using Newtonsoft.Json;
using GWork.DataAccess;
using GWork.Business;
using GWork.IBusiness;
using SysManager.Models;
using SysManager.Common.Utilities;
using Newtonsoft.Json.Converters;
namespace GWork.Controllers.OpenWindows.SearchEmployee
{
    public class SearchEmployeeController : Controller
    {

private SYS_User userinfo = new SYS_User();
        private SYS_Organization organizationinfo = new SYS_Organization(); //权限表中的组织部门
        private SysManager.IBusiness.IOrganizationBLL organizationibll = SysManager.Business.BusinessFactory.Instance.CreateOrganization();//部门工厂
        private SysManager.IBusiness.IRolesBLL rolesbll = SysManager.Business.BusinessFactory.Instance.CreateRoles();//角色工厂
        private SysManager.IBusiness.IUserBLL userbll = SysManager.Business.BusinessFactory.Instance.CreateUser();//  获取员工用户方法

public ActionResult SearchEmployeeList()
        {
            return View();
        }

#region 获取部门列表树集合
        /// <summary>
        /// 获取部门列表树集合
        /// </summary>
        /// <returns></returns>
        public string GetOrganizationList()
        {

System.Collections.IList orgainList = organizationibll.GetList();//获取部门方法
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";
            List<SYS_Organization> listtree = SysManager.Common.Utilities.IListHelper.IListToList<SYS_Organization>(orgainList);//将IList 转化成List
            SYS_Organization orgobj = listtree.Find(org => org.ParentId == "0");//构造顶级节点//(数据库中用的是O)
            LEFTTREE lefttree = new LEFTTREE();
            lefttree.ID = orgobj.OrganizationId; //树节点
            lefttree.TEXT = orgobj.FullName;   //公司名称
            lefttree.CHILDREN = new List<LEFTTREE>();  //树子节点
            lefttree.EX1 = orgobj.Category;// (额外条件种类)

TreeDiGui(lefttree.ID, lefttree, listtree); //递归用法

return "[" + JsonConvert.SerializeObject(lefttree).Replace("TEXT", "text").Replace("ID", "id").Replace("CHILDREN", "children") + "]";
        }

#region 查找树的子节点
        /// <summary>
        /// 查找树的子节点
        /// </summary>
        /// <param name="sb"></param>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        public LEFTTREE TreeDiGui(string ParentId, LEFTTREE LEFTTREE, IEnumerable<SYS_Organization> ALLTREE)
        {

//
            IEnumerable<SYS_Organization> FindTree = ALLTREE.Where(new Func<SYS_Organization, bool>(d => d.ParentId == ParentId));
            foreach (SYS_Organization item in FindTree)
            {
                LEFTTREE ChildTree = new LEFTTREE();
                ChildTree.ID = item.OrganizationId;
                ChildTree.TEXT = item.FullName;
                ChildTree.CHILDREN = new List<LEFTTREE>();
                ChildTree.EX1 = item.Category;//种类
                LEFTTREE.CHILDREN.Add(ChildTree);
                TreeDiGui(ChildTree.ID, ChildTree, ALLTREE);
            }
            return LEFTTREE;
        }
        #endregion

#region 根据部门查找该部门下所有的人
        /// <summary>
        /// 根据组织部门下的人员
        /// </summary>
        /// <returns></returns>
        public string GetEmployeeByForOrg()
        {
            try
            {
                string Category = Request["Category"].ToString(); //获取种类
                string OrganizationId = Request["OrganizationId"].ToString();//获取部门ID
                System.Collections.IList userIList = userbll.GetDataTableByOrganizationId(Category, OrganizationId);//根据种类和orgid查询出该部门下所有的人员
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";
                List<SYS_User> userList = SysManager.Common.Utilities.IListHelper.IListToList<SYS_User>(userIList);//把得到IList转化成List格式
                return JsonConvert.SerializeObject(userList, timeConverter);
            }
            catch (Exception ex)
            {
                throw (ex);

}
        }

#endregion
        #endregion

#region  获取岗位列表树集合
        /// <summary>
        /// 获取角色列表集合
        /// </summary>
        /// <returns></returns>
        public string GetRoseList() //string
        {
            string orgID = Request["orgID"].ToString();//获取orgID

System.Collections.IList roseList = rolesbll.GetList(orgID);
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";
            List<SYS_Roles> listtree = SysManager.Common.Utilities.IListHelper.IListToList<SYS_Roles>(roseList);//将IList 转化成List
            List<LEFTTREE> List = new List<LEFTTREE>();
            foreach (SYS_Roles item in listtree)
            {
                LEFTTREE lefttree = new LEFTTREE();
                lefttree.ID = item.RoleId; //树节点
                lefttree.TEXT = item.FullName;   //公司名称
                lefttree.CHILDREN = new List<LEFTTREE>();  //树子节点
                List.Add(lefttree);
            }
            return JsonConvert.SerializeObject(List, timeConverter).Replace("TEXT", "text").Replace("ID", "id").Replace("CHILDREN", "children") ;
     
       
        }
        #endregion

#region 根据岗位角色条件查询人
        /// <summary>
        ///根据角色条件查询
        /// </summary>
        /// <returns></returns>
        public string GetUserByforRole()
        {
            try
            {
                string roleID = Request["roleID"].ToString();

string strWhere = " and roleid=" + "'" + roleID + "'";
                System.Collections.IList userList = userbll.GetUserListBywhere(strWhere);

IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";
                List<SYS_User> list = SysManager.Common.Utilities.IListHelper.IListToList<SYS_User>(userList);//把得到IList转化成List格式
                return JsonConvert.SerializeObject(userList, timeConverter);
            }
            catch (Exception ex)
            {
                throw (ex);

}

}

#endregion

}
}

--

easyui DatagrId 的实例讲解的更多相关文章

  1. Jquery EasyUI DataGrid .net实例

    前台界面:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...

  2. JSON.stringify 语法实例讲解+easyui data-options属性+expires【申明:来源于网络】

    JSON.stringify 语法实例讲解+easyui data-options属性+expires[申明:来源于网络] JSON.stringify 语法实例讲解:http://www.jb51. ...

  3. EasyUI datagrid优化

    easyui datagrid 在IE上加载速度慢, 150行数据就无法忍受了. firefox加载速度还可以. jquery easyui datagrid使用参考 http://www.cnblo ...

  4. 实现easyui datagrid在没有数据时显示相关提示内容

    本示例实现easyui datagrid加载/查询数据时,如果没有相关记录,则在datagrid中显示没有相关记录的提示信息,效果如下图所示 本实例要实现如下图所示的效果: 本示例easyui版本为1 ...

  5. jQuery EasyUI datagrid实现本地分页的方法

    http://www.codeweblog.com/jquery-easyui-datagrid%e5%ae%9e%e7%8e%b0%e6%9c%ac%e5%9c%b0%e5%88%86%e9%a1% ...

  6. [转载]再次谈谈easyui datagrid 的数据加载

    这篇文章只谈jQuery easyui datagrid 的数据加载,因为这也是大家谈论最多的内容.其实easyui datagrid加载数据只有两种方式:一种是ajax加载目标url返回的json数 ...

  7. 解决easyui datagrid加载数据时,checkbox列没有根据checkbox的值来确定是否选中

    背景:   昨天帮朋友做一个easyui datagrid的小实例时,才发现easyui datagrid的checkbox列,没有根据值为true或false来选中checkbox,当时感觉太让人失 ...

  8. springMVC注解方式+easyUI+MYSQL配置实例

    刚接触springMVC,使用的注解方式,也在学习阶段,所以把自己学习到的记下来.本文利用springMVC从数据库读取用户信息为例,分享一下. 1.准备相关架包及资源.因为使用springMVC+e ...

  9. 谈谈easyui datagrid 的数据加载(转)

    这篇文章只谈jQuery easyui datagrid 的数据加载,因为这也是大家谈论最多的内容.其实easyui datagrid加载数据只有两种方式:一种是ajax加载目标url返回的json数 ...

随机推荐

  1. 阿里云创建CentOS系统设置

    1 首先设置你购买的云盘配置,例如cpu,内存,磁盘类型.容量,网络类型等 2.阿里云可以使用浏览器进行远程shell连接 首先需要输入远程密码,第一次连接的时候会提示 一定要牢记 输入密码后进入sh ...

  2. Python面向对象,析构继承多态

    析构: def __del__(self): print("del..run...") r1 = Role("xx") del r1 结果打印del..run. ...

  3. mysql连接错误解决(ERROR 2049 (HY000): Connection using old (pre-4.1.1) authentication protocol ref used (client option 'secure_auth' enabled))

    当使用mysql的新版本是,连接老版本的mysql,就会有可能报: ERROR 2049 (HY000): Connection using old (pre-4.1.1) authenticatio ...

  4. python面试题之如何在Python中创建自己的包

    Python中创建包是比较方便的,只需要在当前目录建立一个文件夹, 文件夹中包含一个__init__.py文件和若干个模块文件, 其中__init__.py可以是一个空文件,但还是建议将包中所有需要导 ...

  5. Oracle学习总结(4)——MySql、SqlServer、Oracle数据库行转列大全

    MySql行转列 以id分组,把name字段的值打印在一行,逗号分隔(默认) select CustomerDrugCode,group_concat(AuditItemName) from noau ...

  6. Bellman-ford算法的学习http://blog.csdn.net/niushuai666/article/details/6791765

    http://blog.csdn.net/niushuai666/article/details/6791765

  7. [K/3Cloud]在插件中根据条件取消表单打开过程

    新建一个类,继承自动态表单抽象插件类AbstractBillPlugIn,重写PreOpenForm. /// <summary> /// 销售订单 单据维护界面插件 /// </s ...

  8. [bzoj1507][Usaco2009 Hol]Transmission Delay 传输谍延时_动态规划

    Transmission Delay 传输谍延时 bzoj-1581 Usaco-2009 Hol 题目大意:题目链接. 注释:略. 想法: 动态规划. 首先我们考虑从后往前dp.(最近好多题都是从后 ...

  9. 简单解决 WIN10更新后 远程桌面提示 CredSSP加密Oracle修正的问题

    更新WIN10后,打开远程桌面,提示: 以 管理员身份打开 cmd或者PowerShell,贴入: REG ADD HKLM\Software\Microsoft\Windows\CurrentVer ...

  10. autoconfig

    實例:假設我們有個資料夾為d:\tmp和e:\tmp ,而我們只要將d:\tmp中有異動的檔案複製到e:\tmp下的話,用法如下xcopy d:\tmp\. e:\tmp\ /D /S /Y實例:如果 ...