<%@ page language="C#" autoeventwireup="true" inherits="SB_admin_N47_WorkSchedule, App_Web_wkioulim" %>

<!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("~/SB/control/easy_ui/jquery.min.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.easyui.min.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/locale/easyui-lang-zh_CN.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.load.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.json.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.easyui.validtor.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/js/PageDialog.js?v=1")%>"></script>
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/easy_ui/themes/bootstrap/easyui.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/easy_ui/themes/icon.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/easy_ui/load.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/css/main.css?v=1")%>" />
    <script language="javascript" type="text/javascript">
       function query(){
	        $("#dataview").datagrid("load",{			
				ws_uid:$('#qws_uid').combobox('getValue')
	        });
   	   }

       function userFormat(row){
                var s = '<span >' + row.u_name + '('+row.u_pys+')</span><br/>' +  
                        '<span style="color:#888">(' +row.u_isLogin+')'+ row.u_note + '</span>';  
                return s;  
       }
    </script>
   
</head>
<body class="easyui-layout" style="visibility:hidden" >
    <div region="center" border="false">
        <table id="dataview">
            <thead>
                <tr>  
					<th field="ck" checkbox="true"></th>
					<th field="id" width="80" formatter='OperFormat'>操作</th>
					<th field="ws_pid" width="150" >所属项目</th>
					<th field="ws_uid" width="80" >操作员</th>
					<th field="ws_date" width="150" >日期</th>
					<th field="ws_content" width="300" >完成状况</th>
					<th field="ws_note" width="150" >备注</th>
				</tr>
            </thead>
        </table>
    </div>
    <div id="toolbar"   style="height:55px"   >
        <a class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="Add()">添 加</a>
        
        <asp:Literal ID="litDelete" runat="server" Visible=false>
        
        <a class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deleteList()">删除</a>
        </asp:Literal>
        
        <br />
				&nbsp;所属人员 ：
				<input id="qws_uid" name="name" type="text" 
				
				class="easyui-combobox"
                                data-options="  
                                        panelWidth: 350,  
                                        valueField: 'id',  
                                        textField: 'u_name',  
                                        url: 'N47_User/N47_User_ComboData.aspx',
                                        formatter: userFormat "
				 onkeydown= "if(event.keyCode==13)query()"/>
				
				
				
				
				
        <a class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="query()">查询 </a>
        <a class="easyui-linkbutton" iconcls="icon-book" plain="true" onclick="$('#dataview').datagrid('load',{})">全部显示</a>
    </div>
    
</body>

<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,
        url:"N47_WorkSchedule/N47_WorkSchedule_Dataview.aspx?ws_pid=<%=pid %>",
        onLoadSuccess:function(){ $('#dataview').datagrid("unselectAll"); }
      
    });
    $("body").css("visibility","visible"); 
});
function OperFormat(value,row,index){

    var str ='';
    str += row.isEdit ? "<a href='javascript:void(0)' onclick=\"editItem('"+value+"')\">编辑</a>&nbsp;|&nbsp;":"<span>编辑</sapn>&nbsp;|&nbsp;";
    str +=  row.isDelete ? "<a href='javascript:void(0)' onclick=\"deleteItem('"+value+"')\">删除</a>&nbsp;|&nbsp;":"<span>删除</sapn>&nbsp;|&nbsp;";

    return str;
}
function deleteItem(key){
     $.messager.confirm('确认','确定要删除选中吗?',function(r){
     if(!r){ return }load("删除中...");
             $.ajax({
                type: "POST",
                url:"N47_WorkSchedule/N47_WorkSchedule_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 deleteList(){
     var row = $('#dataview').datagrid('getSelections');
     if(row.length==0){$.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:"N47_WorkSchedule/N47_WorkSchedule_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 editItem(key){
    ShowDialog("edit","N47_WorkSchedule/N47_WorkSchedule_Edit.aspx?id="+key,600,300,100,100);
}
function Add(){
 	ShowDialog("add","N47_WorkSchedule/N47_WorkSchedule_Insert.aspx?pid=<%=pid %>",600,300,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');
}
</script>

</html>
