<%@ page language="C#" autoeventwireup="true" inherits="disk__admin_manager_disk_ResourceComment, App_Web_nrfe0pyq" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>操作</title>

    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/easy_ui/jquery.min.js?v=1.7.2")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/easy_ui/jquery.easyui.min.js?v=1.3")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/easy_ui/locale/easyui-lang-zh_CN.js?v=1.0")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/easy_ui/jquery.load.js?v=1.0")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/easy_ui/jquery.json.js?v=1.0")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/easy_ui/jquery.easyui.validtor.js?v=1.0")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/disk/control/js/PageDialog.js?v=1.0")%>"></script>
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/disk/control/easy_ui/themes/gray/easyui.css?v=1.0")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/disk/control/easy_ui/themes/icon.css?v=1.0")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/disk/control/easy_ui/load.css?v=1.0")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/disk/control/css/main.css?v=1.0")%>" />

    <script language="javascript" type="text/javascript">

    $(function(){
 
        $("#dataview").datagrid({
            toolbar:"#toolbar",
            fit:true,
            idfield:"id",
            border:false,
            pageSize:30,
            resizable:true,
            pagination:true,
            rownumbers:true,
            nowrap:false,
            url:"disk_ResourceComment/disk_ResourceComment_dataview.aspx",
            onLoadSuccess:function(){ $('#dataview').datagrid("unselectAll"); }
          
        });
    });
    		
		function OperFormat(value,row,index){
		    return "<a href='javascript:void(0)' onclick=\"editItem('"+value+"')\">编辑</a>&nbsp;|&nbsp;<a href='javascript:void(0)' onclick=\"deleteItem('"+value+"')\">删除</a>";
		}
																		             

      
	  function deleteItem(key){
         $.messager.confirm('确认','确定要删除选中吗?',function(r){
                 if(!r){ return }
                 load("删除中...");
                 $.ajax({
                    type: "POST",
                    url:"disk_ResourceComment/disk_ResourceComment_Delete.aspx",
                    dataType:"json",
                    data: {"deleteKey": key},
                    success: function(data){
                      unload();
                      if(data.state==1){
                          $.messager.show({title: '提示', msg: data.data});
                          $('#dataview').datagrid('reload').datagrid("unselectAll");
                      }
                      else{
                         $.messager.alert('错误',data.data,'message');
                      }
                   }
                });
         });
	   }

	   function editItem(key){

		    ShowDialog("edit","disk_ResourceComment/disk_ResourceComment_Edit.aspx?id="+key,400,400,100,100);
	   }
	   function deleteList(){
	         var row = $('#dataview').datagrid('getSelections');
	         if(row==null){
	             $.messager.alert('提示',"请选择删除项！",'message');
	             return;
	         }
	         $.messager.confirm('确认','确定要删除选中吗?',function(r){
	                 if(r){
	                     load("删除中...");
	                     var list = new Array();
	                     for(var index =0; index<row.length;index++){
	                        list.push(row[index].id);
	                     }
	                     $.ajax({
	                        type: "POST",
	                        url:"disk_ResourceComment/disk_ResourceComment_Delete.aspx",
	                        dataType:"json",
	                        data: {"deleteList": list.join(",")}, 
	                        success: function(data){
	                          unload();
	                          if(data.state==1){
	                              $.messager.show({ title: '提示', msg: "总共删除"+data.data+"条信息" });
	                              $('#dataview').datagrid('reload').datagrid("unselectAll");
	                          }else{
                                 $.messager.alert('错误',data.data,'message');
                              }
	                  
	                       }
	                    });
	                 }
	         });
       }

	   function Add(){

		 	ShowDialog("add","disk_ResourceComment/disk_ResourceComment_Insert.aspx",400,400,100,100);
	   }
       function reload(param){
            if(param=='last'){
                var grid = $('#dataview'); 
                var gridOptions = grid.datagrid("options"); 
                var options = grid.datagrid('getPager').data("pagination").options;  
                var pagenumber = options.total==0?1:Math.ceil( options.total/options.pageSize);
                gridOptions.pageNumber = pagenumber 
                options.pageNumber = pagenumber;
                $('#dataview').datagrid('reload');
            }
            $('#dataview').datagrid('reload');
       }
       function query(){
	        var query = $("#txtQuery").val();
	        $("#dataview").datagrid("load",{
	             ur_name: query ,
	             df_name : $("#txtRsQuery").val()  
	        });
   	   }
    </script>

</head>
<body class="easyui-layout">
    <div region="center" border="false">
        <table id="dataview">
            <thead>
                <tr>
                    <th field="ck" checkbox="true"></th>
                    <th field="rc_comment" width="400">评论</th>
                    <th field="rc_dfid" width="300">教案名称</th>
                    <th field="rc_urid" width="70">用户名称</th>
                    <th field="rc_cdate" width="150">评论日期</th>
                </tr>
            </thead>
        </table>
    </div>
    <div id="toolbar">
        <a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true"  onclick="deleteList()">删除</a> 
         用户姓名 ： <input id="txtQuery" name="name" type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()"/>
         教案名称： <input id="txtRsQuery" name="name" type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()"/>
        <a href="#" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="query()">
            查询</a>
    </div>
</body>
</html>
